/**
  * @return string
  * @throws NotSupportedException if the treeType is invalid or null
  */
 public function getContent()
 {
     $this->form->setInputPrefixData($this->inputPrefixData);
     $content = $this->getAttributeContent();
     $this->form->clearInputPrefixData();
     return $content;
 }
 /**
  * @return string
  */
 protected function renderHiddenRecipientsInputForValidationContent()
 {
     $hiddenInputId = Element::resolveInputIdPrefixIntoString(array_merge($this->inputPrefixData, array('recipientsValidation')));
     $hiddenInputName = Element::resolveInputNamePrefixIntoString(array_merge($this->inputPrefixData, array('recipientsValidation')));
     $idInputHtmlOptions = array('id' => $hiddenInputId);
     $id = Element::resolveInputIdPrefixIntoString(array_merge($this->inputPrefixData, array('recipientsValidation')));
     $content = ZurmoHtml::hiddenField($hiddenInputName, null, $idInputHtmlOptions);
     $content .= $this->form->error($this->model, 'recipientsValidation', array('inputID' => $hiddenInputId), true, true, $id);
     return $content;
 }
 protected function registerClickFlowScript()
 {
     Yii::app()->clientScript->registerScript('clickflow', "\n                \$('#" . ModuleForWorkflowWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . ModuleForWorkflowWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        url = '" . Yii::app()->createUrl(static::getModuleId() . '/' . static::getControllerId() . '/index') . "';\n                        window.location.href = url;\n                        return false;\n                    }\n                );\n                \$('#" . TriggersForWorkflowWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . TriggersForWorkflowWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . WorkflowWizardForm::MODULE_VALIDATION_SCENARIO . "');\n                        \$('#" . WizardActiveForm::makeErrorsSummaryId(static::getFormId()) . "').hide();\n                        \$('#ModuleForWorkflowWizardView').show();\n                        \$('#TriggersForWorkflowWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('20%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . ActionsForWorkflowWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . ActionsForWorkflowWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . WorkflowWizardForm::TRIGGERS_VALIDATION_SCENARIO . "');\n                        \$('#TriggersForWorkflowWizardView').show();\n                        \$('#ActionsForWorkflowWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('40%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . EmailMessagesForWorkflowWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . EmailMessagesForWorkflowWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . WorkflowWizardForm::ACTIONS_VALIDATION_SCENARIO . "');\n                        \$('#ActionsForWorkflowWizardView').show();\n                        \$('#EmailMessagesForWorkflowWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('60%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . GeneralDataForWorkflowWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . GeneralDataForWorkflowWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . WorkflowWizardForm::EMAIL_MESSAGES_VALIDATION_SCENARIO . "');\n                        \$('#EmailMessagesForWorkflowWizardView').show();\n                        \$('#GeneralDataForWorkflowWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('80%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n            ");
 }
 /**
  * Process attribute addition from tree and than renders it.
  *
  * @param string $nodeId
  * @param string $treeType
  * @param Report $report
  * @param int $rowNumber
  * @param bool $trackableStructurePosition
  */
 public static function processAttributeAdditionFromTree($nodeId, $treeType, Report $report, $rowNumber, $trackableStructurePosition)
 {
     $nodeIdWithoutTreeType = ReportRelationsAndAttributesToTreeAdapter::removeTreeTypeFromNodeId($nodeId, $treeType);
     $moduleClassName = $report->getModuleClassName();
     $modelClassName = $moduleClassName::getPrimaryModelName();
     $form = new WizardActiveForm();
     $form->id = 'edit-form';
     $form->enableAjaxValidation = true;
     //ensures error validation populates correctly
     $wizardFormClassName = ReportToWizardFormAdapter::getFormClassNameByType($report->getType());
     $model = ComponentForReportFormFactory::makeByComponentType($moduleClassName, $modelClassName, $report->getType(), $treeType);
     $form->modelClassNameForError = $wizardFormClassName;
     $attribute = ReportRelationsAndAttributesToTreeAdapter::resolveAttributeByNodeId($nodeIdWithoutTreeType);
     $model->attributeIndexOrDerivedType = ReportRelationsAndAttributesToTreeAdapter::resolveAttributeByNodeId($nodeIdWithoutTreeType);
     $inputPrefixData = ReportRelationsAndAttributesToTreeAdapter::resolveInputPrefixData($wizardFormClassName, $treeType, (int) $rowNumber);
     $adapter = new ReportAttributeToElementAdapter($inputPrefixData, $model, $form, $treeType);
     $view = new AttributeRowForReportComponentView($adapter, (int) $rowNumber, $inputPrefixData, $attribute, (bool) $trackableStructurePosition, true, $treeType);
     $content = $view->render();
     $form->renderAddAttributeErrorSettingsScript($view::getFormId());
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }
 protected function registerClickFlowScript()
 {
     Yii::app()->clientScript->registerScript('clickflow', "\n                \$('#" . ModuleForReportWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . ModuleForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        url = document.referrer;\n                        window.location.href = url;\n                        return false;\n                    }\n                );\n                \$('#" . FiltersForReportWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . FiltersForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . ReportWizardForm::MODULE_VALIDATION_SCENARIO . "');\n                        \$('#" . WizardActiveForm::makeErrorsSummaryId(static::getFormId()) . "').hide();\n                        \$('#ModuleForReportWizardView').show();\n                        \$('#FiltersForReportWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('20%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . DisplayAttributesForReportWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . DisplayAttributesForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . ReportWizardForm::FILTERS_VALIDATION_SCENARIO . "');\n                        \$('#FiltersForReportWizardView').show();\n                        \$('#DisplayAttributesForReportWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('40%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . OrderBysForReportWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . OrderBysForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . ReportWizardForm::DISPLAY_ATTRIBUTES_VALIDATION_SCENARIO . "');\n                        \$('#DisplayAttributesForReportWizardView').show();\n                        \$('#OrderBysForReportWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('60%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n                \$('#" . GeneralDataForReportWizardView::getPreviousPageLinkId() . "').unbind('click');\n                \$('#" . GeneralDataForReportWizardView::getPreviousPageLinkId() . "').bind('click', function()\n                    {\n                        \$('#" . static::getValidationScenarioInputId() . "').val('" . ReportWizardForm::ORDER_BYS_VALIDATION_SCENARIO . "');\n                        \$('#OrderBysForReportWizardView').show();\n                        \$('#GeneralDataForReportWizardView').hide();\n                        \$('.StepsAndProgressBarForWizardView').find('.progress-bar').width('80%');\n                        \$('.StepsAndProgressBarForWizardView').find('.current-step').removeClass('current-step').prev().addClass('current-step');\n                        return false;\n                    }\n                );\n            ");
 }
 public function actionAddEmailMessageRecipient($moduleClassName, $type, $recipientType, $rowNumber, $recipientRowNumber)
 {
     $form = new WizardActiveForm();
     $form->id = WorkflowWizardView::getFormId();
     $form->enableAjaxValidation = true;
     //ensures error validation populates correctly
     $wizardFormClassName = WorkflowToWizardFormAdapter::getFormClassNameByType($type);
     $model = WorkflowEmailMessageRecipientFormFactory::make($recipientType, $moduleClassName::getPrimaryModelName(), $type);
     $inputPrefixData = array($wizardFormClassName, ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES, (int) $rowNumber, EmailMessageForWorkflowForm::TYPE_EMAIL_MESSAGE_RECIPIENTS, $recipientRowNumber);
     $adapter = new WorkflowEmailMessageRecipientToElementAdapter($model, $form, $recipientType, $inputPrefixData);
     $view = new EmailMessageRecipientRowForWorkflowComponentView($adapter, (int) $recipientRowNumber, $inputPrefixData);
     $content = $view->render();
     $form->renderAddAttributeErrorSettingsScript($view::getFormId());
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }
 /**
  * Resolve any special client options
  * @return array
  */
 protected function resolveFormClientOptions()
 {
     return array('beforeValidate' => 'js:$(this).beforeValidateAction', 'afterValidate' => 'js:$(this).afterValidateAjaxAction', 'afterValidateAjax' => $this->renderConfigSaveAjax(), 'summaryID' => WizardActiveForm::makeErrorsSummaryId($this->resolveFormId()), 'validateOnSubmit' => true, 'validateOnChange' => false);
 }