Bug fixes, filter by category and tags

This commit is contained in:
Diego Najar 2017-06-01 00:22:20 +02:00
parent 818fdb453a
commit dc25f269e2
4 changed files with 39 additions and 5 deletions

View File

@ -17,6 +17,7 @@ function add($category)
{ {
global $dbCategories; global $dbCategories;
global $Language; global $Language;
global $Syslog;
if( Text::isEmpty($category) ) { if( Text::isEmpty($category) ) {
Alert::set($Language->g('Category name is empty'), ALERT_STATUS_FAIL); Alert::set($Language->g('Category name is empty'), ALERT_STATUS_FAIL);
@ -24,8 +25,17 @@ function add($category)
} }
if( $dbCategories->add($category) ) { if( $dbCategories->add($category) ) {
// Add to syslog
$Syslog->add(array(
'dictionaryKey'=>'new-category-created',
'notes'=>$category
));
// Create an alert
Alert::set($Language->g('Category added'), ALERT_STATUS_OK); Alert::set($Language->g('Category added'), ALERT_STATUS_OK);
return true;
// Redirect
Redirect::page('categories');
} }
else { else {
Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the category.'); Log::set(__METHOD__.LOG_SEP.'Error occurred when trying to create the category.');
@ -43,9 +53,7 @@ function add($category)
if( $_SERVER['REQUEST_METHOD'] == 'POST' ) if( $_SERVER['REQUEST_METHOD'] == 'POST' )
{ {
if( add($_POST['category']) ) { add($_POST['category']);
Redirect::page('categories');
}
} }
// ============================================================================ // ============================================================================

View File

@ -16,6 +16,27 @@ class dbSyslog extends dbJSON
parent::__construct(DB_SYSLOG); parent::__construct(DB_SYSLOG);
} }
// Returns TRUE if the ID of execution exists, FALSE otherwise
public function exists($idExecution)
{
foreach($this->db as $field) {
if( $field['idExecution']==$idExecution ) {
return true;
}
}
return false;
}
public function get($idExecution)
{
foreach($this->db as $field) {
if( $field['idExecution']==$idExecution ) {
return $field;
}
}
return false;
}
public function add($args) public function add($args)
{ {
global $Language; global $Language;

View File

@ -1,3 +1,8 @@
/* Hacks
------------------------------------------------------------------------------ */
img {
width: 100%;
}
/* Plugins /* Plugins
------------------------------------------------------------------------------ */ ------------------------------------------------------------------------------ */