Beispiel #1
0
 /**
  * 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();
 }
 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));
 }
 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;
 }