コード例 #1
0
 /**
  * @param integer $rowCount
  * @param array $actions
  * @return array
  */
 protected function renderActions(&$rowCount, array $actions)
 {
     assert('is_int($rowCount)');
     assert('is_array($actions)');
     $items = array();
     foreach ($actions as $action) {
         $inputPrefixData = array(get_class($this->model), ComponentForWorkflowForm::TYPE_ACTIONS, (int) $rowCount);
         $view = new ActionRowForWorkflowComponentView($action, $rowCount, $inputPrefixData, $this->form);
         $view->addWrapper = false;
         $items[] = array('content' => $view->render());
         $rowCount++;
     }
     return $items;
 }
コード例 #2
0
 public function actionAddAction($moduleClassName, $type, $actionType, $rowNumber, $relation = null, $relatedModelRelation = null)
 {
     $form = new WizardActiveForm();
     $form->enableAjaxValidation = true;
     //ensures error validation populates correctly
     $form->id = WorkflowWizardView::getFormId();
     $wizardFormClassName = WorkflowToWizardFormAdapter::getFormClassNameByType($type);
     $model = ComponentForWorkflowFormFactory::makeByComponentType($moduleClassName, $moduleClassName::getPrimaryModelName(), $type, ComponentForWorkflowForm::TYPE_ACTIONS);
     $model->type = $actionType;
     $model->relation = $relation;
     $model->relatedModelRelation = $relatedModelRelation;
     $inputPrefixData = array($wizardFormClassName, ComponentForWorkflowForm::TYPE_ACTIONS, (int) $rowNumber);
     $view = new ActionRowForWorkflowComponentView($model, (int) $rowNumber, $inputPrefixData, $form);
     $content = $view->render();
     $form->renderAddAttributeErrorSettingsScript($view::getFormId());
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }