public function save() { $db = new PHPWS_DB('checkin_visitor'); if (empty($this->arrival_time)) { $this->arrival_time = time(); } return $db->saveObject($this); }
public function save() { $db = new PHPWS_DB('analytics_tracker'); $result = $db->saveObject($this); if (PHPWS_Error::logIfError($result)) { return $result; } }
public function save() { $db = new \PHPWS_DB('prop_report'); if (!$this->id) { $this->date_sent = time(); } return $db->saveObject($this); }
/** * Saves a new or updated floor hall object */ public function save() { $db = new PHPWS_DB('hms_floor'); $result = $db->saveObject($this); if (!$result || PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } }
public function save($insert = TRUE) { $db = new PHPWS_DB('search_stats'); $this->keyword = trim($this->keyword); if (!$insert) { $db->addWhere('keyword', $this->keyword); } return $db->saveObject($this); }
public function save() { if (!$this->to_user_id || !$this->from_user_id) { return \PHPWS_Error('Cannot save message.'); } $this->date_sent = time(); $db = new \PHPWS_DB('prop_messages'); return $db->saveObject($this); }
/** * Saves the current Assignment object to the database. */ public function save() { $db = new PHPWS_DB('hms_learning_community_assignment'); $result = $db->saveObject($this); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } return TRUE; }
public function save() { $db = new PHPWS_DB('hms_special_assignment'); $result = $db->saveObject($this); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->getMessage()); } return true; }
public function save() { $db = new PHPWS_DB('hms_eligibility_waiver'); $result = $db->saveObject($this); if (!$result || PHPWS_Error::logIfError($result)) { return false; } return true; }
public function save() { $db = new PHPWS_DB('hms_movein_time'); $result = $db->saveObject($this); if (!$result || PHPWS_Error::logIfError($result)) { return false; } return true; }
public function save() { $this->stamp(); $db = new PHPWS_DB('hms_residence_hall'); $result = $db->saveObject($this); if (!$result || PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } return true; }
/** * Saves this queue item */ public function save() { $db = new PHPWS_DB('hms_banner_queue'); $this->stamp(); $result = $db->saveObject($this); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } return TRUE; }
public function save($key_id) { $db = new PHPWS_DB('ps_text'); $result = $db->saveObject($this); if (PHPWS_Error::isError($result)) { return $result; } $search = new Search($key_id); $search->addKeywords($this->content); return $search->save(); }
/** * Saves this term object. */ public function save() { $db = new PHPWS_DB('hms_term'); // "where" breaks the save if creating new term if (!$this->isNew) { $db->addWhere('term', $this->term); } $result = $db->saveObject($this); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } }
public function save($term) { $this->term = $term; $this->timestamp = time(); $db = new PHPWS_DB('hms_student_cache'); try { $result = $db->saveObject($this); } catch (\Exception $e) { // Silently log any errors PHPWS_Error::logIfError($e); } }
/** * Saves the given object to the database. * @param Object $obj */ public static function save(DbStorable $obj) { $db = new \PHPWS_DB($obj->getTableName()); try { $result = $db->saveObject($obj); } catch (\Exception $e) { // rethrow any exceptions throw $e; } if (\PHPWS_Error::logIfError($result)) { throw new \Exception($result->toString()); } return $obj->id; }
public function save() { $db = new PHPWS_DB('hms_checkin'); try { $result = $db->saveObject($this); } catch (Exception $e) { // rethrow any exceptions throw $e; } if (PHPWS_Error::logIfError($result)) { throw new Exception($result->toString()); } return $this->id; }
/** * Saves this SummerApplication object */ public function save() { $is_new = $this->getId() == 0 ? true : false; # Save the core application data using the parent class if (!parent::save()) { return false; } # Save the application-specific data $db = new PHPWS_DB('hms_summer_application'); /* If this is a new object, call saveObject with the third parameter as 'false' so * the database class will insert the object with the ID set by the parent::save() call. * Otherwise, call save object as normal so that the database class will detect the ID and * update the object. */ if ($is_new) { $result = $db->saveObject($this, false, false); } else { $result = $db->saveObject($this); } if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } return true; }
public function execute(CommandContext $context) { $roomId = $context->get('roomId'); $damageType = $context->get('damage_type'); $term = $context->get('term'); $side = $context->get('side'); $note = $context->get('note'); $room = RoomFactory::getRoomByPersistentId($roomId, $term); $damage = new RoomDamage($room, $term, $damageType, $side, $note); $db = new PHPWS_DB('hms_room_damage'); $result = $db->saveObject($damage); if (PHPWS_Error::logIfError($result)) { throw new DatabaseException($result->toString()); } echo 'success'; exit; }
public function save() { $db = new PHPWS_DB('rss_channel'); return $db->saveObject($this); }
public function save() { $this->updated = time(); if (!$this->id) { $this->created = time(); } $this->timeout = $this->updated + 86400 * 30; $db = new \PHPWS_DB('properties'); $result = $db->saveObject($this); if (\PEAR::isError($result)) { \PHPWS_Error::log($result); throw new \Exception('Could not save property to the database.'); } return true; }
public function save() { if (empty($this->last_log)) { $this->last_log = time(); } $db = new \PHPWS_DB('prop_contacts'); $result = $db->saveObject($this); if (\PEAR::isError($result)) { \PHPWS_Error::log($result); throw new \Exception('Could not save contact to the database.'); } return true; }
public function save() { if ($this->title != 'core') { $db = new PHPWS_DB('modules'); $db->addWhere('title', $this->title); $db->delete(); $db->resetWhere(); if (!$this->getProperName()) { $this->setProperName($this->getProperName(true)); } $result = $db->saveObject($this); if (PHPWS_Error::isError($result)) { return $result; } return $this->saveDependencies(); } else { $db = new PHPWS_DB('core_version'); $db->addValue('version', $this->version); $result = $db->update(); if (PHPWS_Error::isError($result)) { return $result; } } }
public function save($key_id = null) { $db = new PHPWS_DB('ps_block'); $db->saveObject($this); }
public function save($write = true, $thumbnail = true) { if (empty($this->file_directory)) { if ($this->folder_id) { $folder = new Folder($_POST['folder_id']); if ($folder->id) { $this->setDirectory($folder->getFullDirectory()); } else { return PHPWS_Error::get(FC_MISSING_FOLDER, 'filecabinet', 'PHPWS_Multimedia::save'); } } else { return PHPWS_Error::get(FC_DIRECTORY_NOT_SET, 'filecabinet', 'PHPWS_Multimedia::save'); } } if ($write) { $result = $this->write(); if (PHPWS_Error::isError($result)) { return $result; } } if (!$this->width || !$this->height) { $this->loadDimensions(); } if ($thumbnail) { if ($this->isVideo()) { $this->makeVideoThumbnail(); } else { $this->makeAudioThumbnail(); } } if (empty($this->title)) { $this->title = $this->file_name; } $db = new PHPWS_DB('multimedia'); $result = $db->saveObject($this); return $result; }
public function save() { $db = new PHPWS_DB('checkin_reasons'); return !PHPWS_Error::logIfError($db->saveObject($this)); }
public function savePermissions() { if (!$this->id) { return false; } $db = new PHPWS_DB('phpws_key'); $db->addValue('restricted', $this->restricted); if (PHPWS_Error::logIfError($db->saveObject($this))) { return false; } $view_db = new PHPWS_DB('phpws_key_view'); $view_db->addWhere('key_id', $this->id); $result = $view_db->delete(); if (PHPWS_Error::isError($result)) { return $result; } $edit_db = new PHPWS_DB('phpws_key_edit'); $edit_db->addWhere('key_id', $this->id); $result = $edit_db->delete(); if (PHPWS_Error::isError($result)) { return $result; } // we don't care if restricted is 0 because everyone can view // we don't care if it is KEY_LOGGED_RESTRICTED either because // just checking log status covers it if ($this->restricted == KEY_GROUP_RESTRICTED) { if (!empty($this->_view_groups) && is_array($this->_view_groups)) { $view_db->reset(); $this->_view_groups = array_unique($this->_view_groups); foreach ($this->_view_groups as $group_id) { $view_db->resetValues(); $view_db->addValue('key_id', $this->id); $view_db->addValue('group_id', $group_id); PHPWS_Error::logIfError($view_db->insert()); } } } if (!empty($this->_edit_groups) && is_array($this->_edit_groups)) { $edit_db->reset(); $this->_edit_groups = array_unique($this->_edit_groups); foreach ($this->_edit_groups as $group_id) { $edit_db->resetValues(); $edit_db->addValue('key_id', $this->id); $edit_db->addValue('group_id', $group_id); PHPWS_Error::logIfError($edit_db->insert()); } } return true; }
public function save() { if (!preg_match('/\\/$/', $this->directory)) { $this->directory .= '/'; } $db = new PHPWS_DB('branch_sites'); return $db->saveObject($this); }
public function save() { $db = new PHPWS_DB('layout_box'); $db->addWhere('module', $this->module); $db->addWhere('content_var', $this->content_var); $db->addWhere('theme', $this->theme); $result = $db->select('one'); if (PHPWS_Error::isError($result)) { return $result; } elseif ($result && $result != $this->id) { return FALSE; } $db->reset(); if (empty($this->box_order)) { $this->box_order = $this->nextBox(); } return $db->saveObject($this); }
public function save($save_key = TRUE) { $db = new PHPWS_DB('block'); $result = $db->saveObject($this); if (PHPWS_Error::isError($result)) { return $result; } if ($save_key) { $this->saveKey(); } }