function delete($key_value, $join_table_key_field_value = false) { if (!$this->loadFields()) { return false; } $delete_fields_params = array(); foreach ($this->fields as $field) { if ($field['type'] != 'key') { $field = array_merge($field, $this->fields_params); $delete_fields_params[] = $field; } } $renderer = new DMRenderer(); $renderer->setFields($delete_fields_params); $renderer->setFieldsPrefix($this->fields_prefix); $renderer->triggerEvent('beforeDelete', $key_value, $this->table); if (!empty($this->join_table['name'])) { // $renderer->triggerEvent('beforeDelete', $join_table_key_field_value // , $this->join_table['name']); $this->where_conditions = array(); $this->addWhereCondition(" `{$this->join_table['key_field']}` = '{$join_table_key_field_value}' "); $result = parent::delete($this->join_table['name']); if (!$result) { return false; } } if ($this->key_field && $key_value) { $this->where_conditions = array(); $this->addWhereCondition(" `{$this->key_field}` = '{$key_value}' "); return parent::delete(); } return false; }
public function delete($id) { parent::delete($id); }
/** * 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(); }
/** * 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(); }
/** * Of to assign a user from a group * * @param string $sGroup * @param string $sUser * @return void */ function ofToAssignUser($sGroup = '', $sUser = '') { $this->Fields['GRP_UID'] = $sGroup; $this->Fields['USR_UID'] = $sUser; parent::delete(); }