Esempio n. 1
0
 /**
  * Deletes all class-fields from the project with given id
  *
  * @param int $id the project-id
  * @return int the number of affected rows
  */
 public function delete_by_project($id)
 {
     $db = FWS_Props::get()->db();
     if (!PC_Utils::is_valid_project_id($id)) {
         FWS_Helper::def_error('intge0', 'id', $id);
     }
     $stmt = $db->get_prepared_statement('DELETE FROM ' . PC_TB_CLASS_FIELDS . ' WHERE project_id = :id');
     $stmt->bind(':id', $id);
     $db->execute($stmt->get_statement());
     return $db->get_affected_rows();
 }
Esempio n. 2
0
 /**
  * Sets the project with given id to the current one
  *
  * @param int $id the project-id
  */
 public function set_current($id)
 {
     if (!PC_Utils::is_valid_project_id($id)) {
         FWS_Helper::def_error('intge0', 'id', $id);
     }
     $db = FWS_Props::get()->db();
     $db->update(PC_TB_PROJECTS, '', array('current' => 0));
     $db->update(PC_TB_PROJECTS, 'WHERE id = ' . $id, array('current' => 1));
 }