示例#1
0
 public function delete_by_id($id)
 {
     // validate parameters
     $id = intval($id);
     $this->db->query("DELETE FROM `" . $this->essence . "` WHERE `" . $this->essence . "_ID` = '" . $id . "'");
     return $this->db->rows_affected;
 }
示例#2
0
 /**
  * @return bool
  */
 public function update_file_path_and_mode()
 {
     if (!($this->type && $this->id && $this->relative_path)) {
         return false;
     }
     $SQL = "UPDATE {$this->type}\n                   SET File_Path = '{$this->relative_path}',\n                       File_Mode = 1\n                 WHERE {$this->type}_ID = {$this->id}";
     return $this->db->query($SQL);
 }
示例#3
0
 /**
  * Включение или выключение поля
  * @param string $action check - включение, uncheck - выключение
  * @param mixed $class_id номер компонента или имя системной таблицы
  * @param mixed $field номер поля или его имя
  * @return bool изменено поле или нет
  */
 public function edit_field($action, $class_id = 0, $field = '')
 {
     $system_tables = array("Catalogue" => 1, "Subdivision" => 2, "User" => 3, "Template" => 4);
     if (is_string($class_id)) {
         $system_table_id = $system_tables[$class_id];
     } else {
         $class_id = intval($class_id);
     }
     $this->db->query("UPDATE `Field`\n                      SET `Checked` = '" . ($action == 'check' ? 1 : 0) . "'\n                      WHERE\n                      " . (is_int($class_id) ? "`Class_ID` = '" . $class_id . "' AND " : "") . "\n                      " . ($system_table_id ? "`System_Table_ID` = '" . $system_table_id . "' AND " : "") . "\n                      " . (is_int($field) ? "`Field_ID` = '" . $field . "' " : " `Field_Name` = '" . $this->db->escape($field) . "' "));
     return $this->db->rows_affected;
 }