本文整理汇总了PHP中Actions::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::getErrors方法的具体用法?PHP Actions::getErrors怎么用?PHP Actions::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions::getErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(&$params)
{
$model = new Actions();
$model->type = 'note';
$model->complete = 'Yes';
$model->associationId = $params['model']->id;
$model->associationType = $params['model']->module;
$model->actionDescription = $this->parseOption('comment', $params);
$model->assignedTo = $this->parseOption('assignedTo', $params);
$model->completedBy = $this->parseOption('assignedTo', $params);
if (empty($model->assignedTo) && $params['model']->hasAttribute('assignedTo')) {
$model->assignedTo = $params['model']->assignedTo;
$model->completedBy = $params['model']->assignedTo;
}
if ($params['model']->hasAttribute('visibility')) {
$model->visibility = $params['model']->visibility;
}
$model->createDate = time();
$model->completeDate = time();
if ($model->save()) {
return array(true, Yii::t('studio', 'View created action: ') . $model->getLink());
} else {
$errors = $model->getErrors();
return array(false, array_shift($errors));
}
}
示例2: execute
public function execute(&$params)
{
$options = $this->config['options'];
$action = new Actions();
$action->subject = $this->parseOption('subject', $params);
$action->dueDate = $this->parseOption('dueDate', $params);
$action->actionDescription = $this->parseOption('description', $params);
$action->priority = $this->parseOption('priority', $params);
$action->visibility = $this->parseOption('visibility', $params);
if (isset($params['model'])) {
$action->assignedTo = $this->parseOption('assignedTo', $params);
}
// if(isset($this->config['attributes']))
// $this->setModelAttributes($action,$this->config['attributes'],$params);
if ($action->save()) {
return array(true, Yii::t('studio', "View created action: ") . $action->getLink());
} else {
$errors = $action->getErrors();
return array(false, array_shift($errors));
}
// if($this->parseOption('reminder',$params)) {
// $notif=new Notification;
// $notif->modelType='Actions';
// $notif->createdBy=Yii::app()->user->getName();
// $notif->modelId=$model->id;
// if($_POST['notificationUsers']=='me'){
// $notif->user=Yii::app()->user->getName();
// }else{
// $notif->user=$model->assignedTo;
// }
// $notif->createDate=$model->dueDate-($_POST['notificationTime']*60);
// $notif->type='action_reminder';
// $notif->save();
// if($_POST['notificationUsers']=='both' && Yii::app()->user->getName()!=$model->assignedTo){
// $notif2=new Notification;
// $notif2->modelType='Actions';
// $notif2->createdBy=Yii::app()->user->getName();
// $notif2->modelId=$model->id;
// $notif2->user=Yii::app()->user->getName();
// $notif2->createDate=$model->dueDate-($_POST['notificationTime']*60);
// $notif2->type='action_reminder';
// $notif2->save();
// }
// }
}
示例3: execute
public function execute(&$params)
{
$action = new Actions();
$action->associationType = lcfirst(get_class($params['model']));
$action->associationId = $params['model']->id;
$action->subject = $this->parseOption('subject', $params);
$action->actionDescription = $this->parseOption('description', $params);
if ($params['model']->hasAttribute('assignedTo')) {
$action->assignedTo = $params['model']->assignedTo;
}
if ($params['model']->hasAttribute('priority')) {
$action->priority = $params['model']->priority;
}
if ($params['model']->hasAttribute('visibility')) {
$action->visibility = $params['model']->visibility;
}
if ($action->save()) {
return array(true, Yii::t('studio', "View created action: ") . $action->getLink());
} else {
return array(false, array_shift($action->getErrors()));
}
}