当前位置: 首页>>代码示例>>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;未经允许,请勿转载。