/**
  * Renders the editable dropdown content.
  * @return A string containing the element's content.
  */
 protected function renderControlEditable()
 {
     if (ArrayUtil::getArrayValue($this->params, 'defaultToBlank')) {
         return ZurmoHtml::dropDownList($this->getNameForSelectInput(), null, $this->getDropDownArray(), $this->resolveHtmlOptions());
     } else {
         return $this->form->dropDownList($this->model->{$this->attribute}->currency, 'id', $this->getDropDownArray(), $this->resolveHtmlOptions());
     }
 }
 protected function renderControlEditable()
 {
     $this->attribute = 'contactEmailTemplateNames';
     $dropDownArray = $this->getDropDownArray();
     $htmlOptions = $this->getEditableHtmlOptions();
     $name = $this->getEditableInputName();
     $this->registerScripts();
     return ZurmoHtml::dropDownList($name, null, $dropDownArray, $htmlOptions);
 }
 protected function renderEditableFirstValueContent()
 {
     $content = parent::renderEditableFirstValueContent();
     $htmlOptions = array('id' => $this->getCurrencyIdForValueEditableInputId(), 'empty' => Zurmo::t('Core', '(None)'));
     $data = Yii::app()->currencyHelper->getActiveCurrenciesOrSelectedCurrenciesData((int) $this->model->currencyIdForValue);
     $content .= ZurmoHtml::dropDownList($this->getCurrencyIdForValueEditableInputName(), $this->model->currencyIdForValue, $data, $htmlOptions);
     $error = $this->form->error($this->model, 'currencyIdForValue', array('inputID' => $this->getCurrencyIdForValueEditableInputId()));
     return $content . $error;
 }
 /**
  * Renders the editable dropdown content.
  * @return A string containing the element's content.
  */
 protected function renderControlEditable()
 {
     $this->assertModelIsValid();
     $dropDownArray = UserStatusUtil::getStatusArray();
     $value = UserStatusUtil::getSelectedValueByUser($this->getUserModel());
     $htmlOptions = array('id' => $this->getEditableInputId('userStatus'));
     $content = ZurmoHtml::dropDownList($this->getEditableInputName('userStatus'), $value, $dropDownArray, $htmlOptions);
     $content = ZurmoHtml::tag('div', array('class' => 'beforeToolTip'), $content);
     $content .= self::renderTooltipContent();
     return $content;
 }
 /**
  * Renders the editable dropdown content.
  * @return A string containing the element's content.
  */
 protected function renderControlEditable()
 {
     $this->registerScripts();
     $dropDownArray = $this->getHelperDropDownArray();
     $inputId = $this->getIdForInput();
     $compareValue = PolicyIntegerAndStaticDropDownElement::HELPER_DROPDOWN_VALUE_YES;
     $htmlOptions = array('id' => $this->getIdForHelperInput(), 'onchange' => 'enableDisablePolicyTextField($(this).val(), \'' . $inputId . '\', \'' . $compareValue . '\');');
     $content = $this->getInheritedContent();
     $content .= ZurmoHtml::dropDownList($this->getNameForHelperInput(), $this->getHelperValue(), $dropDownArray, $htmlOptions);
     $htmlOptions = array('id' => $inputId, 'class' => $this->resolveInputClassDisabled());
     $content .= $this->form->textField($this->model, $this->attribute, $htmlOptions);
     return $content;
 }
 /**
  * Renders the editable dropdown content.
  * @return A string containing the element's content.
  */
 protected function renderControlEditable()
 {
     $dropDownArray = $this->getDropDownArray();
     $value = $this->model->{$this->attribute};
     $htmlOptions = array('id' => $this->getEditableInputId($this->attribute));
     $content = ZurmoHtml::dropDownList($this->getEditableInputName($this->attribute), $value, $dropDownArray, $htmlOptions);
     $toolTipContent = static::renderTooltipContent();
     if ($toolTipContent != null) {
         $content = ZurmoHtml::tag('div', array('class' => 'beforeToolTip'), $content);
         $content .= $toolTipContent;
     }
     return $content;
 }
 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;
 }
 protected function renderSavedSearchList()
 {
     $savedSearches = SavedSearch::getByOwnerAndViewClassName(Yii::app()->user->userModel, get_class($this));
     $idOrName = static::getSavedSearchListDropDown();
     $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
     if (count($savedSearches) == 0) {
         $htmlOptions['style'] = "display:none;";
         $htmlOptions['class'] = 'ignore-style';
         $idOrName = static::getSavedSearchListDropDown();
         $htmlOptions = array('id' => $idOrName, 'empty' => Zurmo::t('ZurmoModule', 'Load a saved search'));
         $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
         $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
         return $content;
     }
     $content = ZurmoHtml::dropDownList($idOrName, $this->model->savedSearchId, self::resolveSavedSearchesToIdAndLabels($savedSearches), $htmlOptions);
     $this->renderSavedSearchDropDownOnChangeScript($idOrName, $this->model->loadSavedSearchUrl);
     return $content;
 }
 protected function renderSelectableGroupsContent()
 {
     list($selectableAttributeName, $selectableRelationAttributeName) = $this->resolveSelectableAttributeNameAndRelatedAttributes();
     $htmlOptions = array('id' => $this->getEditableInputId($selectableAttributeName, $selectableRelationAttributeName), 'onclick' => 'document.getElementById("{bindId}").checked="checked";');
     $name = $this->getEditableInputName($selectableAttributeName, $selectableRelationAttributeName);
     $dropDownArray = static::getSelectableGroupsData();
     if ($dropDownArray == null) {
         return null;
     }
     return ZurmoHtml::dropDownList($name, $this->resolveSelectedGroup(), $dropDownArray, $htmlOptions);
 }
 public function actionChangeActionTypeRelatedModel($moduleClassName, $type, $relation)
 {
     $content = ZurmoHtml::dropDownList(ActionsForWorkflowWizardView::ACTION_TYPE_RELATED_MODEL_RELATION_NAME, null, ActionsForWorkflowWizardView::resolveTypeRelatedModelRelationDataAndLabels($moduleClassName, $moduleClassName::getPrimaryModelName(), $type, $relation));
     echo $content;
 }
Ejemplo n.º 11
0
 /**
  * @param boolean $renderedInForm
  * @param string $barType
  * @return A string containing the element's content.
  * @throws NotSupportedException
  */
 protected function renderElementBar($renderedInForm, $barType)
 {
     assert('$barType == "toolbar" || $barType == "secondToolbar"');
     $metadata = $this::getMetadata();
     $content = null;
     $first = true;
     $dropDownId = null;
     $dropDownItems = array();
     $dropDownItemHtmlOptions = array('prompt' => '');
     // we need this so we have a default one to select at the end of operation.
     if (isset($metadata['global'][$barType]) && is_array($metadata['global'][$barType]['elements'])) {
         foreach ($metadata['global'][$barType]['elements'] as $elementInformation) {
             $renderedContent = null;
             $this->resolveActionElementInformationDuringRender($elementInformation);
             array_walk($elementInformation, array($this, 'resolveEvaluateSubString'));
             $params = array_slice($elementInformation, 1);
             $elementClassName = $elementInformation['type'] . 'ActionElement';
             $element = new $elementClassName($this->controllerId, $this->moduleId, $this->modelId, $params);
             if (!$this->shouldRenderToolBarElement($element, $elementInformation)) {
                 continue;
             }
             if (!$renderedInForm && $element->isFormRequiredToUse()) {
                 throw new NotSupportedException();
             }
             $continueRendering = $this->resolveMassActionLinkActionElementDuringRender($elementClassName, $element, $dropDownItems, $dropDownItemHtmlOptions);
             if ($continueRendering) {
                 $renderedContent = $element->render();
             } else {
                 if (!$dropDownId) {
                     $dropDownId = $elementClassName::getDropdownId();
                 }
             }
             if (!$first && !empty($renderedContent)) {
                 // $content .= '&#160;|&#160;';
             }
             $first = false;
             $content .= $renderedContent;
         }
     }
     if (!empty($dropDownItems)) {
         $content .= ZurmoHtml::link('', '#', array('class' => 'mobile-actions'));
         $content .= ZurmoHtml::tag('div', array('class' => 'mobile-view-toolbar-container'), ZurmoHtml::dropDownList($dropDownId, '', $dropDownItems, $dropDownItemHtmlOptions));
     }
     return $content;
 }
Ejemplo n.º 12
0
 protected function renderAttributeDropDownContent()
 {
     $name = $this->formModelClassName . '[' . DynamicSearchForm::DYNAMIC_NAME . '][' . $this->rowNumber . '][attributeIndexOrDerivedType]';
     $id = $this->formModelClassName . '_' . DynamicSearchForm::DYNAMIC_NAME . '_' . $this->rowNumber . '_attributeIndexOrDerivedType';
     $htmlOptions = array('id' => $id, 'class' => 'attribute-dropdown', 'empty' => Zurmo::t('ZurmoModule', 'Select a field'));
     Yii::app()->clientScript->registerScript('AttributeDropDown' . $id, $this->renderAttributeDropDownOnChangeScript($id, $this->getInputsDivId(), $this->ajaxOnChangeUrl));
     $content = ZurmoHtml::dropDownList($name, $this->selectedAttribute, $this->searchableAttributeIndicesAndDerivedTypes, $htmlOptions);
     Yii::app()->clientScript->registerScript('mappingExtraColumnRemoveLink', "\n            \$('.remove-extra-dynamic-search-row-link').unbind('click');\n            \$('.remove-extra-dynamic-search-row-link').bind('click', function()\n                {\n                    formId = \$(this).closest('form').attr('id');\n                    \$(this).parent().remove();\n                    rebuildDynamicSearchRowNumbersAndStructureInput(formId);\n                    resolveClearLinkPrefixLabelAndVisibility(formId);\n                }\n            );");
     return $content;
 }
Ejemplo n.º 13
0
 protected function renderEditableValueTypeContent()
 {
     return ZurmoHtml::dropDownList($this->getValueTypeEditableInputName(), $this->getValueType(), $this->getValueTypeDropDownArray(), $this->getEditableValueTypeHtmlOptions());
 }
 protected function renderAttributeDropDownContent($columnName, $columnType, $attributeIndexOrDerivedType, $ajaxOnChangeUrl)
 {
     assert('is_string($columnName)');
     assert('$columnType == "importColumn" || $columnType == "extraColumn"');
     assert('is_string($attributeIndexOrDerivedType) || $attributeIndexOrDerivedType == null');
     assert('is_string($ajaxOnChangeUrl)');
     $name = $this->mappingFormModelClassName . '[' . $columnName . '][attributeIndexOrDerivedType]';
     $id = $this->mappingFormModelClassName . '_' . $columnName . '_attributeIndexOrDerivedType';
     $htmlOptions = array('id' => $id, 'empty' => Zurmo::t('ImportModule', 'Do not map this field'));
     Yii::app()->clientScript->registerScript('AttributeDropDown' . $id, $this->renderAttributeDropDownOnChangeScript($id, $columnName, $columnType, $ajaxOnChangeUrl));
     if ($columnType == 'importColumn') {
         $mappableAttributeIndicesAndDerivedTypes = $this->mappableAttributeIndicesAndDerivedTypesForImportColumns;
     } else {
         $mappableAttributeIndicesAndDerivedTypes = $this->mappableAttributeIndicesAndDerivedTypesForExtraColumns;
     }
     $content = ZurmoHtml::dropDownList($name, $attributeIndexOrDerivedType, $mappableAttributeIndicesAndDerivedTypes, $htmlOptions);
     if ($columnType == 'extraColumn') {
         $content .= ZurmoHtml::link(Zurmo::t('ImportModule', 'Remove Field'), '#', array('class' => 'remove-extra-column-link z-link'));
         Yii::app()->clientScript->registerScript('mappingExtraColumnRemoveLink', "\n                \$('.remove-extra-column-link').click( function()\n                    {\n                        \$(this).parent().parent().remove();\n                    }\n                );");
     }
     return $content;
 }
 protected function renderEditableSecondRangeContent()
 {
     $htmlOptions = array('empty' => Zurmo::t('Core', '(None)'), 'id' => $this->getSecondRangeEditableInputId());
     $label = $this->form->labelEx($this->model, 'secondRange', array('for' => $this->getSecondRangeEditableInputId()));
     $content = ZurmoHtml::dropDownList($this->getSecondRangeEditableInputName(), $this->model->secondRange, $this->model->getAvailableSecondRangeDataAndLabels(), $htmlOptions);
     $error = $this->form->error($this->model, 'secondRange', array('inputID' => $this->getSecondRangeEditableInputId()));
     return $label . $content . $error;
 }
 protected function renderValuesToParentValuesMappingDropDownContent(DropDownDependencyCustomFieldMapping $parentMapping, $position, $value, $valuePosition, $selectedParentValue)
 {
     assert('is_int($position)');
     assert('is_string($value)');
     assert('is_int($valuePosition)');
     assert('is_string($selectedParentValue) || $selectedParentValue == null');
     $inputName = $this->formName . '[mappingData][' . $position . '][valuesToParentValues][' . $value . ']';
     $inputId = $this->formName . '_mappingData_' . $position . '_valuesToParentValues_' . $valuePosition;
     $htmlOptions = array();
     $htmlOptions['id'] = $inputId;
     $htmlOptions['empty'] = Zurmo::t('Core', '(None)');
     $dataAndLabels = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($parentMapping->getCustomFieldData(), Yii::app()->language);
     $content = ZurmoHtml::dropDownList($inputName, $selectedParentValue, $dataAndLabels, $htmlOptions);
     return $content;
 }
 protected function renderEditableValueTypeContent()
 {
     $content = ZurmoHtml::dropDownList($this->getValueTypeEditableInputName(), $this->getValueType(), $this->getValueTypeDropDownArray(), $this->getEditableValueTypeHtmlOptions());
     $error = $this->form->error($this->model, 'valueType', array('inputID' => $this->getValueTypeEditableInputId()));
     return $content . $error;
 }
 /**
  * @return string
  */
 protected function renderRecipientSelectorContentAndWrapper()
 {
     $content = ZurmoHtml::tag('h3', array(), Zurmo::t('EmailMessagesModule', 'Recipients'));
     $htmlOptions = array('id' => $this->resolveAddRecipientId(), 'class' => self::ADD_RECIPIENT_CLASS_NAME);
     $content .= ZurmoHtml::dropDownList(self::ADD_RECIPIENT_TYPE_NAME, null, $this->resolveRecipientTypeDataAndLabels(), $htmlOptions);
     return ZurmoHtml::tag('div', array('class' => 'email-message-recipient-type-selector-container'), $content);
 }
 /**
  * @return string
  */
 protected function renderAttributeSelectorContentAndWrapper()
 {
     $htmlOptions = array();
     $htmlOptions['empty'] = Zurmo::t('WorkflowsModule', 'Select Action');
     $actionTypeContent = ZurmoHtml::dropDownList(self::ACTION_TYPE_NAME, null, $this->resolveTypeDataAndLabels(), $htmlOptions);
     $content = '';
     $content .= $actionTypeContent;
     $content .= ZurmoHtml::tag('div', array('id' => self::ACTION_TYPE_RELATION_DIV_ID, 'class' => 'related-model-selector', 'style' => "display:none;"), null);
     $content .= ZurmoHtml::tag('div', array('id' => self::ACTION_TYPE_RELATED_MODEL_RELATION_DIV_ID, 'class' => 'related-model-selector', 'style' => "display:none;"), null);
     return ZurmoHtml::tag('div', array('class' => 'action-type-selector-container'), $content);
 }
 protected function renderEditableValueTypeContent()
 {
     $value = $this->model->{$this->attribute};
     return ZurmoHtml::dropDownList($this->getEditableInputName($this->attribute, 'type'), ArrayUtil::getArrayValue($value, 'type'), $this->getValueTypeDropDownArray(), $this->getEditableValueTypeHtmlOptions());
 }