/** Add data to the system for a treasure action * @return object */ public function add($data) { if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) { $data['created'] = $this->_time; } $data['createdBy'] = $this->_auth->getIdentity()->id; $data['treasureID'] = $this->_treasureID; return parent::insert($data); }
/** Update system for a treasure action * @param array $data * @return boolean */ public function updateTreasure($data) { if (!isset($data['updated']) || $data['updated'] instanceof Zend_Db_Expr) { $data['updated'] = $this->_time; } $where = parent::getAdapter()->quoteInto('treasureID = ?', $this->_treasureID); $data['updatedBy'] = $this->_auth->getIdentity()->id; return parent::update($data, $where); }
/** Add new TVC date/case link to database * @access public * @param array $data * @return integer */ public function add(array $data) { if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) { $data['created'] = $this->timeCreation(); } $data['treasureID'] = Zend_Controller_Front::getInstance()->getRequest()->getParam('treasureID'); $data['createdBy'] = $this->getUserNumber(); return parent::insert($data); }
/** Add data to the system for a treasure action * @access public * @param array $data * @return integer */ public function add(array $data) { if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) { $data['created'] = $this->timeCreation(); } $data['createdBy'] = $this->getUserNumber(); $data['treasureID'] = $this->getTreasureID(); return parent::insert($data); }
/** Update system for a treasure action * @access public * @param array $data * @return integer */ public function updateTreasure(array $data) { if (!isset($data['updated']) || $data['updated'] instanceof Zend_Db_Expr) { $data['updated'] = $this->timeCreation(); } $where = parent::getAdapter()->quoteInto('treasureID = ?', $this->getTreasureID()); $data['updatedBy'] = $this->getUserNumber(); return parent::update($data, $where); }
/** Add new TVC date to database * @param array $data * @return boolean */ public function add($data) { if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) { $data['created'] = $this->timeCreation(); } $generator = new Pas_Generator_SecuID(); $data['secuid'] = $generator->secuid(); $data['createdBy'] = $this->getUserNumber(); return parent::insert($data); }
/** Over ride the abstract add and create secuid etc */ public function add($data) { $data = $this->getCleaner()->array_cleanup($data); if (empty($data['secuid'])) { $data['secuid'] = $this->generateSecuId(); } foreach ($data as $k => $v) { if ($v == "") { $data[$k] = NULL; } } return parent::insert($data); }
public function activate($data) { $where = array(); foreach ($data as $k => $v) { $where[] = $this->getAdapter()->quoteInto($k . ' = ?', $v); } $data = array('valid' => '1', 'activationKey' => NULL); $perm = 0775; mkdir(PATH . $username, $perm); mkdir(PATH . $username . '/small/', $perm); mkdir(PATH . $username . '/medium/', $perm); mkdir(PATH . $username . '/display/', $perm); mkdir(PATH . $username . '/zoom/', $perm); parent::update($data, $where); }
public function add($data) { if (empty($data['created'])) { $data['created'] = $this->timeCreation(); } if (empty($data['createdBy'])) { $data['createdBy'] = $this->getUserNumber(); } if (empty($data['secuid'])) { $data['secuid'] = $this->generateSecuId(); } foreach ($data as $k => $v) { if ($v == "") { $data[$k] = NULL; } } return parent::insert($data); }
/** Update the config * @access public * @param array $data The update data * @return int */ public function updateConfig(array $data) { if (array_key_exists('csrf', $data)) { unset($data['csrf']); } foreach ($data as $key => $value) { if (is_null($value) || $value === '' || $value === '0') { unset($data[$key]); } } $newFields = array_keys($data); $updateData['fields'] = serialize($newFields); $updateData['created'] = $this->timeCreation(); $updateData['createdBy'] = $this->getUserNumber(); $updateData['userID'] = $this->getUserNumber(); parent::delete('userID =' . $this->getUserNumber()); return parent::insert($updateData); }
/** Add and resize images * @access public * @param array $imageData */ public function addAndResize($imageData) { // Loop through the array of objects to add foreach ($imageData as $data) { $finds = new Finds(); $findID = $finds->fetchRow($finds->select()->where('id = ?', $data->findID))->secuid; // Create the image data array $images = array('secuid' => $data->secuid, 'filesize' => $data->size, 'filename' => $data->name, 'mimetype' => $data->mimetype, 'filecreated' => $this->timeCreation(), 'institution' => $this->getInstitution(), 'created' => $this->timeCreation(), 'createdBy' => $this->getUserNumber(), 'ccLicense' => 4, 'imagerights' => $this->getCopyright()); // Create the linking data $linkData = array('find_id' => $findID, 'image_id' => $data->secuid, 'created' => $this->timeCreation(), 'createdBy' => $this->getUserNumber(), 'secuid' => $this->generateSecuId()); // Insert the image data to slides table $slideID = parent::insert($images); // Create the links in the link table $links = new FindsImages(); // Insert that data $links->insert($linkData); // Now process the images $processor = new Pas_Image_Magick(); // Set the path $processor->setImage($data->path); // Set the thumbnail image number from slide insertion - must be an integer $processor->setImageNumber((int) $slideID); // Resize loop $processor->resize(); return $slideID; } }
/** Add the complaint * @access public * @param array $data * @return integer */ public function addComplaint(array $data) { if (!empty($data['csrf'])) { unset($data['csrf']); } if (empty($data['comment_date'])) { $data['comment_date'] = $this->timeCreation(); $data['created'] = $this->timeCreation(); } if (empty($data['createdBy'])) { $data['createdBy'] = $this->getUserNumber(); } if (empty($data['updatedBy'])) { $data['updatedBy'] = $this->getUserNumber(); } if (empty($data['user_ip'])) { $data['user_ip'] = Zend_Controller_Front::getInstance()->getRequest()->getClientIp(); } if (empty($data['user_agent'])) { $useragent = new Zend_Http_UserAgent(); $data['user_agent'] = $useragent->getUserAgent(); } if ($this->_akismet->isSpam($data)) { $data['comment_approved'] = self::SPAM; } else { $data['comment_approved'] = self::NOTSPAM; } return parent::insert($data); }
public function updateNews($data, $id) { $coords = $this->_geocoder->getCoordinates($data['primaryNewsLocation']); if ($coords) { ${$data}['latitude'] = $coords['lat']; ${$data}['longitude'] = $coords['lon']; $place = $this->_geoPlanet->reverseGeoCode($lat, $lon); $data['woeid'] = $place['woeid']; } else { ${$data}['latitude'] = NULL; ${$data}['longitude'] = NULL; $data['woeid'] = NULL; } $where = array(); $where[] = $this->getAdapter()->quoteInto($this->_primary . ' = ?', $id); return parent::update($data, $where); }
/** Function for adding and processing the findspot data * @access public * @param array $data */ public function addAndProcess($data) { if (is_array($data)) { foreach ($data as $k => $v) { if ($v == "") { $data[$k] = NULL; } } if (!is_null($data['gridref'])) { $data = $this->_processFindspot($data); } $findid = new Pas_Generator_FindID(); $data['old_findspotid'] = $findid->generate(); $secuid = new Pas_Generator_SecuID(); $data['secuid'] = $secuid->secuid(); if (array_key_exists('landownername', $data)) { unset($data['landownername']); } if (array_key_exists('csrf', $data)) { unset($data['csrf']); } if (empty($data['created'])) { $data['created'] = $this->timeCreation(); } if (empty($data['createdBy'])) { $data['createdBy'] = $this->userNumber(); return parent::insert($data); } else { throw new Exception('The data submitted is not an array', 500); } } }
/** Update the config for each user * @access public * @param $data */ public function updateConfig($data) { if (array_key_exists('csrf', $data)) { unset($data['csrf']); } $updateData['uri'] = $data['uri']; $updateData['created'] = $this->timeCreation(); $updateData['createdBy'] = $this->getUserNumber(); $updateData['userID'] = $this->getUserNumber(); //Delete the existing menu option parent::delete('userID =' . $this->getUserNumber()); //Insert the new option return parent::insert($updateData); }
/** Get the access keys, this could be changed to a constuct for passing keys * Uses the config.ini values * */ public function __construct() { parent::__construct(); }
/** Update a coroner * @access public * @param array $data * @param integer $id */ public function updateCoroner(array $data, $id) { $updateData = $this->_geocodeAddress($data); $where = $this->getAdapter()->quoteInto($this->_primary . '= ?', (int) $id); $this->_cache->remove('coroner' . $id); return parent::update($updateData, $where); }
/** Function for adding and processing the findspot data * @access public * @param array $data * @return array * @throws Exception */ public function addAndProcess(array $data) { if (is_array($data)) { foreach ($data as $k => $v) { if ($v == "") { $data[$k] = NULL; } } if (!is_null($data['gridref'])) { $data = $this->_processFindspot($data); } $findid = new Pas_Generator_FindID(); $data['old_findspotid'] = $findid->generate(); $secuid = new Pas_Generator_SecuID(); $data['secuid'] = $secuid->secuid(); //Get the label for the parish if (array_key_exists('parishID', $data) && !is_null($data['parishID'])) { $parishes = new OsParishes(); $data['parish'] = $parishes->fetchRow($parishes->select()->where('osID = ?', $data['parishID']))->label; } //Get the label for the county if (array_key_exists('countyID', $data) && !is_null($data['countyID'])) { $counties = new OsCounties(); $data['county'] = $counties->fetchRow($counties->select()->where('osID = ?', $data['countyID']))->label; } //Get the label for the district if (array_key_exists('districtID', $data) && !is_null($data['districtID'])) { $district = new OsDistricts(); $data['district'] = $district->fetchRow($district->select()->where('osID = ?', $data['districtID']))->label; } if (array_key_exists('landownername', $data)) { unset($data['landownername']); } if (array_key_exists('csrf', $data)) { unset($data['csrf']); } if (empty($data['created'])) { $data['created'] = $this->timeCreation(); } if (empty($data['createdBy'])) { $data['createdBy'] = $this->getUserNumber(); } return parent::insert($data); } else { throw new Exception('The data submitted is not an array', 500); } }
/** Update the news * @access public * @param array $data * @param integer $id * @return array */ public function updateNews(array $data, $id) { $coords = $this->getCoords($data['primaryNewsLocation']); if (empty($data['updated'])) { $data['updated'] = $this->timeCreation(); } if (empty($data['updatedBy'])) { $data['updatedBy'] = $this->getUserNumber(); } $clean = array_merge($data, $coords); $where = array(); $where[] = $this->getAdapter()->quoteInto($this->_primary . ' = ?', $id); return parent::update($clean, $where); }
public function updateCoroner($data, $id) { if (is_array($data)) { $address = $data['address_1'] . ',' . $data['address_2'] . ',' . $data['town'] . ',' . $data['county'] . ',' . $data['postcode'] . ',' . $data['country']; $coords = $this->_geocoder->getCoordinates($address); if ($coords) { ${$data}['latitude'] = $coords['lat']; ${$data}['longitude'] = $coords['lon']; $place = $this->_geoPlanet->reverseGeoCode($lat, $lon); $data['woeid'] = $place['woeid']; } else { ${$data}['latitude'] = NULL; ${$data}['longitude'] = NULL; $data['woeid'] = NULL; } $where = $this->getAdapter()->quoteInto($this->_primary . '= ?', (int) $id); return parent::update($data, $where); } else { throw new Exception('Data must be in array format'); } }
/** Activate an account * @access public * @param array $data * @return integer */ public function activate(array $data) { unset($data['csrf']); $where = array(); $where[] = $this->getAdapter()->quoteInto('activationKey = ?', $data['activationKey']); $where[] = $this->getAdapter()->quoteInto('username = ?', $data['username']); $where[] = $this->getAdapter()->quoteInto('email = ?', $data['email']); $data = array('valid' => 1, 'activationKey' => null); $username = $data['username']; $perm = 0775; mkdir(IMAGE_PATH . $username, $perm); mkdir(IMAGE_PATH . $username . '/small/', $perm); mkdir(IMAGE_PATH . $username . '/medium/', $perm); mkdir(IMAGE_PATH . $username . '/display/', $perm); mkdir(IMAGE_PATH . $username . '/zoom/', $perm); return parent::update($data, $where); }
/** Function for adding and processing the findspot data * @access public * @param array $data * @return array */ public function addAndProcess($data) { if (is_array($data)) { foreach ($data as $k => $v) { if ($v == "") { $data[$k] = null; } } if (!is_null($data['gridref'])) { $data = $this->_processFindspot($data); } if (array_key_exists('parishID', $data) && !is_null($data['parishID'])) { $parishes = new OsParishes(); $data['parish'] = $parishes->fetchRow($parishes->select()->where('osID = ?', $data['parishID']))->label; } if (array_key_exists('countyID', $data) && !is_null($data['countyID'])) { $counties = new OsCounties(); $data['county'] = $counties->fetchRow($counties->select()->where('osID = ?', $data['countyID']))->label; } if (array_key_exists('districtID', $data) && !is_null($data['districtID'])) { $district = new OsDistricts(); $data['district'] = $district->fetchRow($district->select()->where('osID = ?', $data['districtID']))->label; } if (array_key_exists('organisername', $data)) { unset($data['organisername']); } if (array_key_exists('csrf', $data)) { unset($data['csrf']); } if (array_key_exists('submit', $data)) { unset($data['submit']); } if (empty($data['created'])) { $data['created'] = $this->timeCreation(); } if (empty($data['createdBy'])) { $data['createdBy'] = $this->getUserNumber(); } return parent::insert($data); } else { throw new Exception('The data submitted is not an array', 500); } }