当前位置: 首页>>代码示例>>PHP>>正文


PHP Actions::completeAction方法代码示例

本文整理汇总了PHP中Actions::completeAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::completeAction方法的具体用法?PHP Actions::completeAction怎么用?PHP Actions::completeAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actions的用法示例。


在下文中一共展示了Actions::completeAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionComplete

 public function actionComplete($id)
 {
     $model = $this->loadModel($id);
     if (Yii::app()->user->getName() == $model->assignedTo || $model->assignedTo == 'Anyone' || $model->assignedTo == "" || Yii::app()->user->getName() == 'admin') {
         if (isset($_POST['note'])) {
             $model->actionDescription = $model->actionDescription . "\n\n" . $_POST['note'];
         }
         $model = $this->updateChangelog($model, 'Completed');
         $model->save();
         Actions::completeAction($id);
         $notif = new Notifications();
         $notif->record = "Actions:{$model->id}";
         $profile = CActiveRecord::model('ProfileChild')->findByAttributes(array('username' => Yii::app()->user->getName()));
         $notif->text = $profile->fullName . " completed an action.";
         $notif->user = 'admin';
         $notif->createDate = time();
         $notif->viewed = 0;
         $notif->save();
         $createNew = isset($_GET['createNew']) || isset($_POST['submit']) && $_POST['submit'] == 'completeNew';
         $redirect = isset($_GET['redirect']) || $createNew;
         if ($redirect) {
             if ($model->associationType != 'none' && !$createNew) {
                 // if the action has an association
                 $this->redirect(array($model->associationType . '/view', 'id' => $model->associationId));
                 // go back to the association
             } else {
                 // no association
                 if ($createNew) {
                     $this->redirect(array('/actions/create'));
                 } else {
                     $this->redirect(array('/actions/default/view', 'id' => $model->id));
                 }
                 // view the action
             }
         } else {
             $this->redirect(array('/actions/default/view', 'id' => $model->id));
         }
     } else {
         $this->redirect(array('/actions/invalid'));
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:41,代码来源:DefaultController.php


注:本文中的Actions::completeAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。