Пример #1
0
 /**
  * Deletes the given task along with all its context associations
  */
 function remove($task_id)
 {
     if (!$task_id) {
         return -1;
     }
     global $config;
     $this->where("user_id='{$_SESSION['user']}'");
     if (!$this->delete($task_id)) {
         return 0;
     }
     //Remove all the contexts of that Task.
     $TaskContext = new DBTable($config['db_prefix'] . 'TaskContext');
     $TaskContext->where("context_id={$task_id}", "user_id='{$_SESSION['user']}'");
     $TaskContext->delete();
 }
Пример #2
0
 /**
  * Deletes the context with the given ID
  * Argument : $id - The ID of the context that must be deleted.
  */
 function remove($id)
 {
     if (!$id) {
         return -1;
     }
     global $contexts, $sql, $config;
     if (!isset($contexts[$id])) {
         return 0;
     }
     $this->where("user_id='{$_SESSION['user']}'");
     $this->delete($id);
     if (!$sql->fetchAffectedRows()) {
         return 0;
     }
     unset($contexts[$id]);
     //Remove all the tasks in that project
     $TaskContext = new DBTable($config['db_prefix'] . 'TaskContext');
     $TaskContext->where("context_id={$id}", "user_id='{$_SESSION['user']}'");
     $TaskContext->delete();
 }