當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CActiveRecord::afterSave方法代碼示例

本文整理匯總了PHP中CActiveRecord::afterSave方法的典型用法代碼示例。如果您正苦於以下問題:PHP CActiveRecord::afterSave方法的具體用法?PHP CActiveRecord::afterSave怎麽用?PHP CActiveRecord::afterSave使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CActiveRecord的用法示例。


在下文中一共展示了CActiveRecord::afterSave方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: afterSave

 protected function afterSave()
 {
     if (parent::afterSave()) {
         //die($this->id);
         //return $this->id;
     }
 }
開發者ID:vnilov,項目名稱:delivery,代碼行數:7,代碼來源:User.php

示例2: afterSave

 public function afterSave()
 {
     if (!$this->isNewRecord) {
         Syslog::add(Logs::LOG_EDITED, 'Изменен комментарий к бану № <strong>' . $this->bid . '</strong>, написанный пользователем <strong>' . $this->name . '</strong>');
     }
     return parent::afterSave();
 }
開發者ID:urichalex,項目名稱:CS-Bans,代碼行數:7,代碼來源:Comments.php

示例3: afterSave

 protected function afterSave()
 {
     parent::afterSave();
     $this->validateServerFile('serverFile', null);
     require_once 'Image.php';
     // 保存圖片
     if ($this->hasErrors('serverFile') == false && $this->serverFile instanceof CUploadedFile) {
         // 保存原圖
         $file = $this->serverFile;
         $fileName = md5($file->tempName . uniqid()) . '.' . $file->extensionName;
         $filePath = Helper::mediaPath(Server::UPLOAD_ORIGINAL_FILE_PATH . $fileName, FRONTEND);
         $file->saveAs($filePath);
         // 如果是圖片需要進行裁切
         if (strtolower($file->extensionName) != 'swf') {
             // 裁切大圖
             // 位置不同圖片尺寸不同
             $image = new Image($filePath);
             $image->resize(350, 230)->save(Helper::mediaPath(Server::UPLOAD_THUMBNAIL_IMAGE_PATH . $fileName, FRONTEND));
         }
         // 更新數據
         $this->updateByPk($this->primaryKey, array('image_path' => $fileName));
     } else {
         if ($this->deleteServerFile) {
             // 刪除圖片
             @unlink(Helper::mediaPath(Server::UPLOAD_ORIGINAL_FILE_PATH . $this->image_path, FRONTEND));
             @unlink(Helper::mediaPath(Server::UPLOAD_THUMBNAIL_IMAGE_PATH . $this->image_path, FRONTEND));
             // 更新數據
             $this->updateByPk($this->primaryKey, array('image_path' => ''));
         }
     }
 }
開發者ID:kinghinds,項目名稱:kingtest2,代碼行數:31,代碼來源:ServerI18n.php

示例4: afterSave

 protected function afterSave()
 {
     parent::afterSave();
     $images = CUploadedFile::getInstances($this, 'images');
     if (isset($images) && count($images) > 0) {
         foreach ($images as $k => $img) {
             $imageName = md5(microtime()) . '.jpg';
             if ($img->saveAs($this->getFolder() . $imageName)) {
                 $advImg = new Image();
                 $advImg->goods_id = $this->getPrimaryKey();
                 $advImg->image = $imageName;
                 $advImg->save();
             }
         }
     }
     if ($this->isNewRecord) {
         $count = new Count();
         $count->goods_id = $this->id;
         $count->count = $this->count;
         $count->size = $this->size;
         $count->color = $this->color;
         $count->save();
     } else {
         Count::model()->updateAll(array('goods_id' => $this->id, 'count' => $this->count, 'size' => $this->size, 'color' => $this->color), 'goods_id=:goods_id', array(':goods_id' => $this->id));
     }
 }
開發者ID:resoul,項目名稱:resoul,代碼行數:26,代碼來源:Goods.php

示例5: afterSave

 /**
  * Notify everyone that was @mentioned in this share by email that they were mentioned
  */
 public function afterSave()
 {
     preg_match_all('/@([A-Za-z0-9\\/\\.]*)/', $this->text, $matches);
     $mentions = implode(',', $matches[1]);
     if (!empty($matches[1])) {
         /*			$criteria = new CDbCriteria;
         			$criteria->addInCondition('username', $matches[1]);
         			$users = User::model()->findAll($criteria);
         
         			foreach ($users as $user)
         			{
         				$sendgrid = new SendGrid(Yii::app()->params['includes']['sendgrid']['username'], Yii::app()->params['includes']['sendgrid']['password']);
         				$email    = new SendGrid\Email();
         
         				$email->setFrom(Yii::app()->params['includes']['sendgrid']['from'])
         					->addTo($user->email)
         					->setSubject("You've Been @mentioned!")
         					->setText("You've Been @mentioned!")
         					->setHtml(Yii::app()->controller->renderPartial('//email/mention', array('share' => $this, 'user' => $user), true));
         
         				// Send the email
         				$sendgrid->send($email);
         			}*/
     }
     return parent::afterSave();
 }
開發者ID:chezzy,項目名稱:yii-mblog,代碼行數:29,代碼來源:Share.php

示例6: afterSave

 protected function afterSave()
 {
     parent::afterSave();
     $this->validateBannerFile('bannerFile', null);
     require_once 'Image.php';
     // 保存圖片
     if ($this->hasErrors('bannerFile') == false && $this->bannerFile instanceof CUploadedFile) {
         // 保存原圖
         $file = $this->bannerFile;
         $fileName = md5($file->tempName . uniqid()) . '.' . $file->extensionName;
         $filePath = Helper::mediaPath(Banner::UPLOAD_LARGE_IMAGE_PATH . $fileName, FRONTEND);
         $file->saveAs($filePath);
         // 如果是圖片需要進行裁切
         // 右側底圖
         if (strtolower($file->extensionName) != 'swf') {
             $image = new Image($filePath);
             $image->save(Helper::mediaPath(Banner::UPLOAD_LARGE_IMAGE_PATH . $fileName, FRONTEND));
         }
         // 更新數據
         $this->updateByPk($this->primaryKey, array('banner_path' => $fileName));
     } else {
         if ($this->deleteBannerFile) {
             @unlink(Helper::mediaPath(Banner::UPLOAD_LARGE_IMAGE_PATH . $this->banner_path, FRONTEND));
             // 更新數據
             $this->updateByPk($this->primaryKey, array('banner_path' => ''));
         }
     }
 }
開發者ID:kinghinds,項目名稱:kingtest2,代碼行數:28,代碼來源:BannerI18n.php

示例7: afterSave

 public function afterSave()
 {
     if ($this->isNewRecord) {
         $this->created_date = new CDbExpression('NOW()');
     }
     parent::afterSave();
 }
開發者ID:nctruong,項目名稱:inputen,代碼行數:7,代碼來源:Danhngon.php

示例8: afterSave

 public function afterSave()
 {
     if ($this->_newRecord) {
         Yii::app()->authManager->assign('Member', 'Member-' . $this->id);
     }
     return parent::afterSave();
 }
開發者ID:kostya1017,項目名稱:our,代碼行數:7,代碼來源:Member.php

示例9: afterSave

 protected function afterSave()
 {
     parent::afterSave();
     if (!$this->textarea) {
         $this->info = $this->unparse($this->info);
     }
 }
開發者ID:balrok,項目名稱:aiajaya,代碼行數:7,代碼來源:EInfotext.php

示例10: AfterSave

 public function AfterSave()
 {
     $this->refresh();
     if ($this->activo == '1') {
         $this->activacion($this->hcodimpuesto);
     }
     return parent::afterSave();
 }
開發者ID:hipogea,項目名稱:zega,代碼行數:8,代碼來源:Valorimpuestos.php

示例11: afterSave

 public function afterSave()
 {
     $pk = (empty($this->primaryKey) or is_array($this->primaryKey)) ? 'id' : $this->primaryKey;
     if (isset($this->{$pk}) and empty($this->{$pk})) {
         $this->{$pk} = Yii::app()->db->lastInsertID;
     }
     return parent::afterSave();
 }
開發者ID:bruno-melo,項目名稱:components,代碼行數:8,代碼來源:MyActiveRecord.php

示例12: afterSave

 public function afterSave()
 {
     if ($this->isNewRecord) {
         $this->created_date = new CDbExpression('NOW()');
         $this->core_user_id = Yii::app()->user->id;
     }
     parent::afterSave();
 }
開發者ID:nctruong,項目名稱:inputen,代碼行數:8,代碼來源:Layout.php

示例13: afterSave

 public function afterSave()
 {
     /* insert default nodes */
     if ($this->isNewRecord) {
         Node::model()->insertDefaultNodes($this->id);
     }
     return parent::afterSave();
 }
開發者ID:schlypel,項目名稱:YiiBackboneBoilerplate,代碼行數:8,代碼來源:Mindmap.php

示例14: afterSave

 public function afterSave()
 {
     parent::afterSave();
     if ($this->isNewRecord) {
         $this->book->n_chapters++;
         $this->book->save(false, array("n_chapters"));
     }
 }
開發者ID:norayr,項目名稱:notabenoid,代碼行數:8,代碼來源:Chapter.php

示例15: afterSave

 public function afterSave()
 {
     if ($this->dateDBformat) {
         $this->dateDBformat = false;
         $this->date = date(Yii::app()->locale->getDateFormat('phpshort'), strtotime($this->date));
     }
     return parent::afterSave();
 }
開發者ID:hkhateb,項目名稱:linet3,代碼行數:8,代碼來源:Bankbook.php


注:本文中的CActiveRecord::afterSave方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。