Esempio n. 1
0
 public function beforeSave()
 {
     if ($this->id === self::LEVEL_ENGINEER) {
         $this->banned_resources_inheritance = NULL;
     }
     return parent::beforeSave();
 }
 /**
  * Before save operations
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->user_id = Yii::app()->user->id;
     }
     return parent::beforeSave();
 }
Esempio n. 3
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->user_id = user()->getId();
     }
     return parent::beforeSave();
 }
Esempio n. 4
0
 public function beforeSave()
 {
     if (!empty($this->id)) {
         $this->setProfileImage();
     }
     return parent::beforeSave();
 }
Esempio n. 5
0
 function beforeSave()
 {
     parent::beforeSave();
     if ($this->validate()) {
         $this->password = $this->hashPassword($this->password);
     }
     return true;
 }
Esempio n. 6
0
 protected function beforeSave()
 {
     if ($this->getIsNewRecord()) {
         $this->ip = userIp();
         $this->user_agent = request()->getUserAgent();
     }
     return parent::beforeSave();
 }
Esempio n. 7
0
 public function beforeSave()
 {
     $scoord = explode(',', $this->start_coords);
     $this->start_coords = new CDbExpression("GeomFromText(:start_point)", array(':start_point' => 'POINT(' . $scoord[0] . ' ' . $scoord[1] . ')'));
     $ecoord = explode(',', $this->end_coords);
     $this->end_coords = new CDbExpression("GeomFromText(:end_point)", array(':end_point' => 'POINT(' . $ecoord[0] . ' ' . $ecoord[1] . ')'));
     return parent::beforeSave();
 }
 /**
  *  Asignando anho y id del ente organo al cual pertenece el usuario.
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->anho = 2015;
         $this->ente_organo_id = Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id;
     }
     return parent::beforeSave();
 }
Esempio n. 9
0
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->referer = self::generateRefererCode();
         $this->registration_ip = userIp();
     }
     return parent::beforeSave();
 }
Esempio n. 10
0
 /**
  *  Asignando anho y id del ente organo al cual pertenece el usuario.
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->anho = Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'];
         $this->ente_organo_id = Usuarios::model()->findByPk(Yii::app()->user->getId())->enteOrgano->ente_organo_id;
     }
     return parent::beforeSave();
 }
Esempio n. 11
0
 /**
  * Обработка данных перед сохранением
  */
 protected function beforeSave()
 {
     if ($this->isNewRecord) {
         if (is_numeric(user()->getId())) {
             $this->user_id = user()->getId();
         }
     }
     return parent::beforeSave();
 }
Esempio n. 12
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         $this->created_at = time();
         return true;
     } else {
         return false;
     }
 }
Esempio n. 13
0
 public function beforeSave()
 {
     if ($this->getIsNewRecord()) {
         if (empty($this->from_user_id)) {
             $this->from_user_id = Yii::app()->user->id;
         }
     }
     return parent::beforeSave();
 }
Esempio n. 14
0
 /**
  * Before save operations
  */
 public function beforeSave()
 {
     // Check to make sure the theme dir is writeable
     $path = Yii::getPathOfAlias('application.www.themes');
     if (!is_writeable($path)) {
         $this->addError('dirname', at('Sorry, We could not create the theme directory as the theme path "{d}" is not writeable. Please set the appropriate permissions.', array('{d}' => $path)));
         return;
     }
     return parent::beforeSave();
 }
Esempio n. 15
0
 protected function beforeSave()
 {
     if ($this->protected_ip) {
         $ipList = str_replace(array("\r"), '', $this->protected_ip);
         $ipList = explode("\n", $ipList);
         $ipList = array_map('trim', $ipList);
         $this->protected_ip = json_encode($ipList);
     }
     return parent::beforeSave();
 }
Esempio n. 16
0
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         // echo CMS::gen(40);
         ///die();
         return true;
     } else {
         return false;
     }
 }
Esempio n. 17
0
 /**
  * Before save operations
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->author_id = Yii::app()->user->id;
     } else {
         $this->updated_author_id = Yii::app()->user->id;
     }
     // Fix the language, tags and visibility
     $this->visible = is_array($this->visible) && count($this->visible) ? implode(',', $this->visible) : $this->visible;
     return parent::beforeSave();
 }
Esempio n. 18
0
 /**
  * Before save operations
  */
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->loggedin_time = time();
         $this->userid = Yii::app()->user->id;
         $this->location = Yii::app()->getController()->id;
     } else {
         $this->lastclick_time = time();
         $this->location = Yii::app()->getController()->id;
     }
     return parent::beforeSave();
 }
Esempio n. 19
0
 /**
  * Before a PollVote is saved.
  */
 public function beforeSave()
 {
     $this->ip_address = $_SERVER['REMOTE_ADDR'];
     $this->timestamp = time();
     $this->user_id = Yii::app()->user->id;
     // Relation may not exist yet so find it normally
     $choice = PollChoice::model()->findByPk($this->choice_id);
     if ($choice) {
         $choice->votes += 1;
         $choice->save();
     } else {
         return FALSE;
     }
     return parent::beforeSave();
 }
Esempio n. 20
0
 function beforeSave()
 {
     parent::beforeSave();
     if ($this->validate()) {
         if ($this->widget) {
             $this->widget = serialize(Spyc::YAMLLoadString($this->widget));
         }
         if ($this->rules) {
             $this->rules = serialize(Spyc::YAMLLoadString($this->rules));
         }
         if ($this->automodel) {
             $this->automodel = serialize(Spyc::YAMLLoadString($this->automodel));
         }
     }
     return true;
 }
 public function beforeSave()
 {
     parent::beforeSave();
     $this->password = md5($this->password);
     return true;
 }
Esempio n. 22
0
 public function beforeSave()
 {
     return parent::beforeSave();
 }
Esempio n. 23
0
 public function beforeSave()
 {
     if (!$this->password) {
         unset($this->password);
     } else {
         $this->password = self::hash($this->password);
     }
     if (!$this->show_email) {
         $this->show_email = Yii::app()->settings->getValue('defaultsShowEmail');
     }
     if (!$this->send_message) {
         $this->send_message = Yii::app()->settings->getValue('defaultsSendMessage');
     }
     if ($this->scenario == 'update') {
         $this->askfill = false;
         Yii::app()->user->setState('askfill', null);
     }
     return parent::beforeSave();
 }
Esempio n. 24
0
 public function beforeSave()
 {
     $coords = explode(',', $this->center);
     $this->center = new CDbExpression("GeomFromText(:point)", array(':point' => 'POINT(' . $coords[0] . ' ' . $coords[1] . ')'));
     return parent::beforeSave();
 }
Esempio n. 25
0
 protected function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             if (UserIdentity::isCrypted($this->password)) {
                 $this->password = UserIdentity::crypt($this->password);
             }
         }
         return true;
     }
     return false;
 }
Esempio n. 26
0
 public function beforeSave()
 {
     if (Yii::app()->settings->get('shop', 'auto_fill_short_desc')) {
         //Yii::import('mod.shop.widgets.SAttributesTableRenderer');
         $a = new AttributesRender();
         $this->short_description = $a->getStringAttr($this);
     }
     return parent::beforeSave();
 }
Esempio n. 27
0
	public function beforeSave()
	{
		if (parent::beforeSave()) {
			if ($this->isNewRecord && get_class($this) != 'Page') {
				$this->sort = 1 + $this->dbConnection->createCommand("SELECT MAX(`sort`) FROM ".$this->tableName())->queryScalar();
				$this->created = date('Y-m-d H:i:s');
			}
			return true;
		}
		return false;
	}
Esempio n. 28
0
 protected function beforeSave()
 {
     //            $this->DateGet=date('Y-m-d',  strtotime($this->DateGet));
     return parent::beforeSave();
 }
Esempio n. 29
0
 public function beforeSave()
 {
     /*        // in this case, we will use the old hashed contrasena.
             if(empty($this->contrasena) && empty($this->repetir_contrasena) && !empty($this->contrasena_inicial))
                 $this->contrasena=$this->repetir_contrasena=$this->contrasena_inicial;
      		
     
      		//$this->codigo_onapre = $this->codigoOnapre->codigo_onapre;
     
     		//because the hashes needs to match
             if(!empty($this->contrasena) && !empty($this->repetir_contrasena))
             {
                 $this->contrasena = $this->hashPassword( $this->contrasena);
                 $this->repetir_contrasena =  $this->hashPassword($this->repetir_contrasena);
             }*/
     if ($this->isNewRecord) {
         $this->creado_el = date('Y-m-d H:i:s');
     } else {
         $this->actualizado_el = date('Y-m-d H:i:s');
     }
     $this->usuario = strtolower($this->usuario);
     $this->correo = strtolower($this->correo);
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     $this->anho = Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'];
     return parent::beforeSave();
 }