public function delete($id)
{
$is_admin = $this->app->user_manager->is_admin();
if (defined('MW_API_CALL') and $is_admin == false) {
return array('error' => 'You must be logged in as admin to perform: ' . __CLASS__ . '->' . __FUNCTION__);
}
if (is_array($id)) {
$id = array_pop($id);
}
$table = $this->table;
$table = $this->app->database_manager->real_table_name($this->table);
if ($id == 'all') {
$q = "DELETE FROM {$table} where id is not NULL ";
$this->app->database_manager->q($q);
} else {
$this->app->database_manager->delete_by_id($table, intval($id), $field_name = 'id');
}
$this->app->cache_manager->delete('notifications' . DIRECTORY_SEPARATOR . intval($id));
$this->app->cache_manager->delete('notifications' . DIRECTORY_SEPARATOR . 'global');
return true;
}