本文整理汇总了PHP中Actions::setAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Actions::setAttributes方法的具体用法?PHP Actions::setAttributes怎么用?PHP Actions::setAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actions
的用法示例。
在下文中一共展示了Actions::setAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: associateAction
/**
* Add note to model
* @param X2Model $model model to which note should be added
* @param string $note
*/
public static function associateAction(X2Model $model, array $attributes)
{
$now = time();
$action = new Actions();
$action->setAttributes(array_merge(array('assignedTo' => $model->assignedTo, 'visibility' => '1', 'associationType' => X2Model::getAssociationType(get_class($model)), 'associationId' => $model->id, 'associationName' => $model->name, 'createDate' => $now, 'lastUpdated' => $now, 'completeDate' => $now, 'complete' => 'Yes', 'updatedBy' => 'admin'), $attributes), false);
return $action->save();
}
示例2: renderInput
public function renderInput(CModel $model, $attribute, array $htmlOptions = array())
{
$action = new Actions();
$action->setAttributes($model->getAttributes(), false);
$defaultOptions = array('id' => $this->resolveId($attribute));
$htmlOptions = X2Html::mergeHtmlOptions($defaultOptions, $htmlOptions);
return preg_replace('/Actions(\\[[^\\]]*\\])/', get_class($this->formModel) . '$1', $action->renderInput($attribute, $htmlOptions));
}
示例3: getAction
public function getAction()
{
if (!isset($this->_action)) {
$action = new Actions();
$action->setAttributes(array('associationType' => X2Model::getAssociationType($this->secondModelName), 'associationId' => $this->secondModelId, 'assignedTo' => Yii::app()->user->getName()), true);
$this->_action = $action;
}
return $this->_action;
}