/** Add a valuation
  * @access public
  * @param array $data
  * @return integer
  */
 public function add(array $data)
 {
     if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) {
         $data['created'] = (string) $this->timeCreation();
     }
     $data['createdBy'] = (int) $this->getUserNumber();
     $data['treasureID'] = (string) $this->getTreasureID();
     return parent::insert($data);
 }
Пример #2
0
 /** Add data to the system for a treasure value
  * @param array $data 
  * @return boolean
  */
 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);
 }
Пример #3
0
 /** 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  a valuation
  * @param array $data 
  * @return boolean
  */
 public function add($data)
 {
     if (!isset($data['created']) || $data['created'] instanceof Zend_Db_Expr) {
         $data['created'] = $this->timeCreation();
     }
     $data['createdBy'] = $this->userNumber();
     $data['treasureID'] = $this->_treasureID;
     return parent::insert($data);
 }
Пример #5
0
 public function register($data)
 {
     $data['password'] = SHA1($this->_config->auth->salt . $data['password']);
     $data['activationKey'] = md5($data['username'] . $data['first_name']);
     $data['valid'] = 0;
     $data['role'] = 'member';
     $data['institution'] = 'PUBLIC';
     $data['imagedir'] = 'images/' . $data['username'] . '/';
     return parent::insert($data);
 }
Пример #6
0
 /** 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);
 }
Пример #7
0
 /** 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);
 }
Пример #8
0
 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);
 }
Пример #9
0
 /** 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);
 }
Пример #10
0
 public function addCoroner($data)
 {
     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;
         }
         return parent::insert($data);
     } else {
         throw new Exception('Data must be in array format');
     }
 }
Пример #11
0
 /** Register a person
  * @access public
  * @param array $data
  * @return integer
  */
 public function register(array $data)
 {
     unset($data['csrf']);
     unset($data['captcha']);
     $data['password'] = SHA1($this->_config->auth->salt . $data['password']);
     $data['activationKey'] = md5($data['username'] . $data['first_name']);
     $data['fullname'] = $data['first_name'] . ' ' . $data['last_name'];
     $data['valid'] = 0;
     $data['role'] = 'member';
     $data['institution'] = 'PUBLIC';
     $data['imagedir'] = 'images/' . $data['username'] . '/';
     $data['created'] = parent::timeCreation();
     $data['createdBy'] = parent::getUserNumber();
     return parent::insert($data);
 }
Пример #12
0
 /** 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);
         }
     }
 }
Пример #13
0
 /** 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);
 }
Пример #14
0
 /** Add a coroner to the system
  * @access public
  * @param array $data
  * @return array
  */
 public function addCoroner(array $data)
 {
     $insertData = $this->_geocodeAddress($data);
     return parent::insert($insertData);
 }
Пример #15
0
 public function addNews($data)
 {
     if (is_array($data)) {
         $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;
         }
         return parent::insert($data);
     } else {
         throw new Exception('The insert data must be in array format.');
     }
 }
Пример #16
0
 /** Add news to the database
  * @access public
  * @param array $data
  * @return array
  * @throws Exception
  */
 public function addNews(array $data)
 {
     if (is_array($data)) {
         $coords = $this->getCoords($data['primaryNewsLocation']);
         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();
         }
         $clean = array_merge($data, $coords);
         foreach ($clean as $k => $v) {
             if ($v == "") {
                 $clean[$k] = null;
             }
         }
         return parent::insert($clean);
     } else {
         throw new Exception('The insert data must be in array format.');
     }
 }
Пример #17
0
 /** 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);
 }
Пример #18
0
 /** 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);
     }
 }
Пример #19
0
 /** 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;
     }
 }
Пример #20
0
 /** 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);
     }
 }