protected function renderBeforeTableContent()
 {
     $dropDownContent = ZurmoHtml::dropDownList('attributeTypeName', null, $this->getValueTypeDropDownArray());
     $linkContent = static::renderConfigureLinkContent(null, 'attributeTypeNameButton');
     $url = Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/attributeEdit/', array('moduleClassName' => $this->moduleClassName));
     Yii::app()->clientScript->registerScript('attributeTypeCreateLink', "\n            \$('#attributeTypeNameButton').click( function()\n                {\n                    if (\$('#attributeTypeName').val() == '')\n                    {\n                        alert('" . CJavaScript::quote(Zurmo::t('DesignerModule', 'You must first select a field type')) . "');\n                    }\n                    else\n                    {\n                        window.location = '" . $url . "&attributeTypeName=' + \$('#attributeTypeName').val();\n                    }\n                }\n            );");
     DropDownUtil::registerScripts();
     $content = null;
     $content .= '<div class="add-custom-field">';
     $content .= '<h1>' . Zurmo::t('DesignerModule', 'Create Field') . '</h1>';
     $content .= '<div class="panel-buffer"><div>' . $dropDownContent . '</div>' . $linkContent . '</div>';
     $content .= '</div>';
     return $content;
 }
Example #2
0
 public static function renderDynamicSearchAttributeInput($viewClassName, $modelClassName, $formModelClassName, $rowNumber, $attributeIndexOrDerivedType, $searchAttributes = array(), $suffix = null)
 {
     assert('is_string($viewClassName)');
     assert('is_string($modelClassName)');
     assert('is_string($formModelClassName)');
     assert('is_int($rowNumber)');
     assert('is_string($attributeIndexOrDerivedType) || $attributeIndexOrDerivedType == null');
     assert('is_array($searchAttributes)');
     assert('is_string($suffix) || $suffix == null');
     $content = null;
     if (count(explode(FormModelUtil::RELATION_DELIMITER, $attributeIndexOrDerivedType)) > 1) {
         $model = new $modelClassName(false);
         $nestedAttributes = explode(FormModelUtil::RELATION_DELIMITER, $attributeIndexOrDerivedType);
         $inputPrefix = array($formModelClassName, DynamicSearchForm::DYNAMIC_NAME, $rowNumber);
         $totalNestedCount = count($nestedAttributes);
         $processCount = 1;
         $nestedSearchAttributes = $searchAttributes;
         foreach ($nestedAttributes as $attribute) {
             if ($processCount < $totalNestedCount && isset($nestedSearchAttributes[$attribute])) {
                 $nestedSearchAttributes = $nestedSearchAttributes[$attribute];
                 if (isset($nestedSearchAttributes['relatedData'])) {
                     unset($nestedSearchAttributes['relatedData']);
                 }
             }
             if ($processCount < $totalNestedCount) {
                 $model = SearchUtil::resolveModelToUseByModelAndAttributeName($model, $attribute);
                 $inputPrefix[] = $attribute;
                 $relatedDataName = Element::resolveInputNamePrefixIntoString($inputPrefix) . '[relatedData]';
                 $content .= ZurmoHtml::hiddenField($relatedDataName, true);
             }
             $processCount++;
         }
         $attributeIndexOrDerivedType = $attribute;
         $modelToUse = $model;
         $modelToUse->setAttributes($nestedSearchAttributes);
         $cellElementModelClassName = get_class($model->getModel());
         //Dynamic Search needs to always assume there is an available SearchForm
         //Always assumes the SearchView to use matches the exact pluralCamelCasedName.
         //Does not support nested relations to leads persay.  It will resolve as a Contact.
         //This is not a problem since you can't relate a model to a lead, it is related to a contact.
         //So this scenario would not come up naturally.
         $moduleClassName = $model->getModel()->getModuleClassName();
         $viewClassName = $moduleClassName::getPluralCamelCasedName() . 'SearchView';
         $element = DynamicSearchUtil::getCellElement($viewClassName, $cellElementModelClassName, $attributeIndexOrDerivedType);
     } else {
         $model = new $modelClassName(false);
         $model->setScenario('importModel');
         //this is so attributes such as modified user can be set
         $modelToUse = new $formModelClassName($model);
         $modelToUse->setAttributes($searchAttributes);
         $inputPrefix = array($formModelClassName, DynamicSearchForm::DYNAMIC_NAME, $rowNumber);
         $element = DynamicSearchUtil::getCellElement($viewClassName, $modelClassName, $attributeIndexOrDerivedType);
     }
     $form = new NoRequiredsActiveForm();
     $form->id = "search-form";
     $element['inputPrefix'] = $inputPrefix;
     $elementclassname = $element['type'] . 'Element';
     $element = new $elementclassname($modelToUse, $element['attributeName'], $form, array_slice($element, 2));
     $element->editableTemplate = '{content}{error}';
     $content .= $element->render();
     DropDownUtil::registerScripts(CClientScript::POS_END);
     return $content;
 }
 /**
  * If the metadata's designer rules support a panel configuration type, display that dropdown.
  */
 protected function renderLayoutPanelsType($form)
 {
     $formModel = PanelsDisplayTypeLayoutMetadataUtil::makeFormFromEditableMetadata($this->editableMetadata);
     //$this->editableMetadata populate if it exists.
     $content = null;
     $element = new LayoutPanelsTypeStaticDropDownElement($formModel, 'type', $form);
     $element->editableTemplate = '{content}';
     $content .= $element->render();
     DropDownUtil::registerScripts();
     return $content;
 }
Example #4
0
 /**
  * Renders special scripts required for displaying the view.  Renders scripts for dropdown styling and interaction.
  */
 protected function renderScripts()
 {
     DropDownUtil::registerScripts(CClientScript::POS_END);
 }
Example #5
0
 protected function registerScripts()
 {
     DropDownUtil::registerScripts();
     // Begin Not Coding Standard
     Yii::app()->clientScript->registerScript('search' . $this->getSearchFormId(), "\n                \$('#clear-search-link" . $this->gridIdSuffix . "').removeAttr('clearForm');\n                \$('#clear-search-link" . $this->gridIdSuffix . "').clearform({\n                        form: '#" . $this->getSearchFormId() . "'\n                    }\n                );\n                \$('#clear-search-link" . $this->gridIdSuffix . "').unbind('click.clear');\n                \$('#clear-search-link" . $this->gridIdSuffix . "').bind('click.clear', function(){\n                        \$('#" . $this->getClearingSearchInputId() . "').val('1');\n                        \$('#clear-search-link" . $this->gridIdSuffix . "').hide();\n                        " . $this->getExtraRenderForClearSearchLinkScript() . "\n                        \$(this).closest('form').submit();\n                        \$('#" . $this->getClearingSearchInputId() . "').val('');\n                        return false;\n                    }\n                );\n                \$('#more-search-link" . $this->gridIdSuffix . "').unbind('click.more');\n                \$('#more-search-link" . $this->gridIdSuffix . "').bind('click.more',  function(event){\n                        \$('.select-list-attributes-view').hide();\n                        \$('.kanban-board-options-view').hide();\n                        \$(this).closest('form').find('.search-view-1').toggle();\n                        return false;\n                    }\n                );\n                \$('#cancel-advanced-search').unbind('click');\n                \$('#cancel-advanced-search').live('click', function(event){\n                    \$(this).closest('form').find('.search-view-1').hide();\n                });\n            " . $this->getExtraRenderFormBottomPanelScriptPart());
     $this->renderAdvancedSearchScripts();
     // End Not Coding Standard
 }
 protected static function renderScripts()
 {
     DropDownUtil::registerScripts();
 }
 protected function renderAfterFormLayout($form)
 {
     DropDownUtil::registerScripts();
 }
 /**
  * Step 4 ajax process.  When you change the attribute dropdown, new mapping rule information is retrieved
  * and displayed in the user interface.
  */
 public function actionMappingRulesEdit($id, $attributeIndexOrDerivedType, $columnName, $columnType)
 {
     $import = Import::getById((int) $_GET['id']);
     $importWizardForm = ImportWizardUtil::makeFormByImport($import);
     $importRulesClassName = ImportRulesUtil::getImportRulesClassNameByType($importWizardForm->importRulesType);
     $mappableAttributeIndicesAndDerivedTypes = $importRulesClassName::getMappableAttributeIndicesAndDerivedTypes();
     $mappingFormLayoutUtil = ImportToMappingFormLayoutUtil::make(get_class($importWizardForm), new ZurmoActiveForm(), $importWizardForm->importRulesType, $mappableAttributeIndicesAndDerivedTypes);
     $content = $mappingFormLayoutUtil->renderMappingRulesElements($columnName, $attributeIndexOrDerivedType, $importWizardForm->importRulesType, $columnType, array());
     DropDownUtil::registerScripts(CClientScript::POS_END);
     Yii::app()->getClientScript()->setToAjaxMode();
     Yii::app()->getClientScript()->render($content);
     echo $content;
 }