本文整理汇总了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'));
}
}