Exemple #1
0
 public function save()
 {
     // Checagem de Codificação MD5
     if (!preg_match('/^[a-fA-F0-9]{32}$/', $this->password)) {
         $this->password = md5($this->password);
     }
     return parent::save();
 }
Exemple #2
0
                              $this->_translateData[$lang->codigo][$fieldLang] = $valueLang;

                      unset($data[$field]);

                  }

          }*/
        $data = $this->getTable()->filter($data);
        return parent::setFromArray($data);
    }
    public function save()
    {
        $r = parent::save();
        /*

                if($r && count($this->_translateData)){

           $languages = new Languages ();

           $languages_values = new Languages_Values();

           foreach($this->_translateData as $langCode => $data){

               $lang = $languages->fetchRow(array('codigo = ?' => $langCode));

               if(!$lang)

                   continue;

               if(!count($data)){

                   $languages_values->delete (array(

                       'tabela = ?' => $this->getTable()->info('name'),

                       'registro = ?' => $this->__get('id'),

                       'lang_id = ?' => $lang->id

                   ));

                   continue;

               }

               $fieldsUpdated = array();

               foreach($data as $fieldLang => $valueLang){

                   if(empty($valueLang))

                       continue;

                   $row = $languages_values->fetchRow(array(

                       'tabela = ?' => $this->getTable()->info('name'),

                       'registro = ?' => $this->__get('id'),
Exemple #3
0
 /**
  * Saves the properties to the database.
  *
  * This performs an intelligent insert/update, and reloads the
  * properties with fresh data from the table on success.
  *
  * @return mixed The primary key value(s), as an associative array if the
  *     key is compound, or a scalar if the key is single-column.
  */
 public function save()
 {
     $this->_getTable()->getAdapter()->beginTransaction();
     try {
         $result = parent::save();
         $this->_getTable()->getAdapter()->commit();
         return $result;
     } catch (Exception $e) {
         $this->_getTable()->getAdapter()->rollBack();
         throw $e;
     }
 }
Exemple #4
0
 public function save()
 {
     if ($this->created === null) {
         unset($this->created);
     }
     if (empty($this->idpeople) || !is_numeric($this->idpeople)) {
         $this->idpeople = null;
     }
     if (empty($this->ip)) {
         $front = Zend_Controller_Front::getInstance();
         $this->ip = $front->getRequest()->getClientIp();
     }
     return parent::save();
 }
Exemple #5
0
 /**
  * Moves the record position one above
  * @param Zend_Db_Table_Row_Abstract $widget
  * @return boolean|Ambigous <mixed, multitype:>
  */
 function moveUp(Zend_Db_Table_Row_Abstract $widget)
 {
     $ordering = $widget->ordering;
     if ($ordering < 1) {
         return false;
     } else {
         $select = $this->select()->order('ordering DESC')->where("ordering < ?", $ordering, Zend_Db::INT_TYPE)->where("position = ?", $widget->position);
         $previousItem = $this->fetchRow($select);
         if ($previousItem) {
             $previousPosition = $previousItem->ordering;
             $previousItem->ordering = $ordering;
             $previousItem->save();
             $widget->ordering = $previousPosition;
             return $widget->save();
         }
     }
     return false;
 }
 /**
  * Set the job state, add a message
  * 
  * @param string $state
  * @param string $message
  * @param boolean $doSave
  * @return Core_Plugin_Job_Abstract
  */
 protected function _setState($state, $message = null, $doSave = true)
 {
     $this->_job->state = $state;
     if (in_array($state, array('failed', 'completed', 'cancelled'))) {
         $this->_job->is_complete = true;
         $this->_job->completion_date = new Zend_Db_Expr('NOW()');
         $this->_setIsComplete(true);
     } else {
         if (in_array($state, array('pending', 'active', 'sleeping'))) {
             $this->_job->is_complete = false;
             $this->_job->completion_date = new Zend_Db_Expr('NULL');
         }
     }
     if ($message) {
         $this->_job->messages .= $message . PHP_EOL;
     }
     if ($doSave) {
         $this->_job->save();
     }
     return $this;
 }
 /**
  * @return mixed
  * @todo documentation
  */
 public function save()
 {
     $this->_preSave();
     $result = parent::save();
     $this->_postSave();
     return $result;
 }
Exemple #8
0
 /**
  * @return bool|mixed
  */
 public function save()
 {
     if (isset($this->_modifiedFields['username']) || isset($this->_modifiedFields['firstname']) || isset($this->_modifiedFields['lastname'])) {
         $currentUsername = $this->username;
         $result = parent::save();
         $searchindex = new Process();
         return $result && $searchindex->updateUser($currentUsername, $this->username, $this->firstname . " " . $this->lastname);
     } elseif (array_key_exists('field', $_POST)) {
         $profileFieldsUser = new ProfileFieldsUsers([], $this);
         return $profileFieldsUser->update($_POST['field'], '');
     } else {
         return parent::save();
     }
 }
 /**
  * save array from Zend_Db_Table_Row_Abstract object
  * @author duy.ngo
  * @param Zend_Db_Table_Row_Abstract $row
  * @since 19-11-2012
  */
 private function _saveArray($row, $data)
 {
     $row->setFromArray($data);
     $row->save();
 }
Exemple #10
0
 /**
  * Moves the record position one above
  * @param Zend_Db_Table_Row_Abstract $contact
  * @return boolean|Ambigous <mixed, multitype:>
  */
 function moveUp(Zend_Db_Table_Row_Abstract $contact)
 {
     $ordering = $contact->ordering;
     if ($ordering < 1) {
         return false;
     } else {
         $select = $this->select()->order('ordering DESC')->where("ordering < ?", $ordering, Zend_Db::INT_TYPE)->where("category_id = ?", $contact->category_id, Zend_Db::INT_TYPE);
         $previousItem = $this->fetchRow($select);
         if ($previousItem) {
             $previousPosition = $previousItem->ordering;
             $previousItem->ordering = $ordering;
             $previousItem->save();
             $contact->ordering = $previousPosition;
             return $contact->save();
         }
     }
 }
Exemple #11
0
 /**
  * @return mixed The primary key value(s), as an associative array if the
  *     key is compound, or a scalar if the key is single-column.
  */
 public function save()
 {
     try {
         $this->_preSave();
         $return = parent::save();
         $this->_postSave();
         return $return;
     } catch (Exception $e) {
         Axis::message()->addError($e->getMessage());
         return false;
     }
 }
 public function save()
 {
     $ret = parent::save();
     $this->_updateFilters(true);
     return $ret;
 }