/**
  * Render the link or ajax link
  * @param string $id the ID of the button
  * @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
  * See {@link buttons} for more details.
  * @param integer $row the row number (zero-based)
  * @param mixed $data the data object associated with the row
  */
 protected function renderButton($id, $button, $row, $data)
 {
     if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
         return;
     }
     $label = isset($button['label']) ? $button['label'] : $id;
     if (isset($button['url'])) {
         $url = $this->evaluateExpression($button['url'], array('data' => $data, 'row' => $row));
         // Not Coding Standard
     } else {
         $url = '#';
     }
     $options = isset($button['options']) ? $button['options'] : array();
     if (!isset($options['title'])) {
         $options['title'] = $label;
     }
     if (isset($button['ajaxOptions'])) {
         unset($options['ajaxOptions']);
         echo ZurmoHtml::ajaxLink($label, $url, $button['ajaxOptions'], $options);
     } else {
         if (isset($button['imageUrl']) && is_string($button['imageUrl'])) {
             echo ZurmoHtml::link(CHtml::image($button['imageUrl'], $label), $url, $options);
         } else {
             echo ZurmoHtml::link($label, $url, $options);
         }
     }
 }
 /**
  * Renders amount
  * @return string
  */
 protected function renderAmountContent()
 {
     $model = $this->model;
     $amount = Yii::app()->numberFormatter->formatCurrency((double) $model->amount->value, $model->amount->currency->code);
     $content = ZurmoHtml::tag('p', array('class' => static::DESCRIPTION_CLASS), Zurmo::t('OpportunitiesModule', 'Amount') . $this->overlayKeyValueSeparator . $amount);
     return $content;
 }
 /**
  * @return string
  */
 protected function renderEditableSecondValueContent()
 {
     $htmlOptions = $this->getHtmlOptionsForSecondValue();
     $inputContent = $this->form->textField($this->model, 'value', $htmlOptions);
     $error = $this->form->error($this->model, 'value', array('inputID' => $this->getSecondValueEditableInputId()), true, true, $this->getSecondValueEditableInputId());
     return $inputContent . $error . ZurmoHtml::tag('span', array(), ' ' . Zurmo::t('WorkflowsModule', 'value(s)'));
 }
 /**
  * Renders the setting as a radio list.
  * @return A string containing the element's content.
  */
 protected function renderThemeContent()
 {
     $gameLevel = GameLevel::resolveByTypeAndPerson(GameLevel::TYPE_GENERAL, Yii::app()->user->userModel);
     $content = ZurmoHtml::tag('h3', array(), Zurmo::t('Core', 'Theme'));
     $content .= ZurmoHtml::radioButtonList($this->getEditableInputName(KanbanBoard::SELECTED_THEME), $this->model->getKanbanBoard()->getSelectedTheme(), $this->resolveThemeColorNamesAndLabelsForLocking($gameLevel), $this->getEditableThemeHtmlOptions(), array(), $this->resolveDataHtmlOptions($gameLevel));
     return $content;
 }
 /**
  * Renders the attribute from the model.
  * @return The element's content.
  */
 protected function renderControlNonEditable()
 {
     if ($this->model->{$this->attribute} != null) {
         $content = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($this->model->{$this->attribute});
         return ZurmoHtml::encode($content);
     }
 }
 /**
  * Override to change the editableTemplate to place the label above the input.
  * @see DetailsView::resolveElementDuringFormLayoutRender()
  */
 protected function resolveElementDuringFormLayoutRender(&$element)
 {
     if ($element->getAttribute() == 'name') {
         $notification = ZurmoHtml::tag('span', array('class' => 'row-description'), Zurmo::t('MarketingListsModule', 'Name will be publicly viewable by Contacts/Leads to manage their subscriptions'));
         $element->editableTemplate = '<th>{label}</th><td colspan="{colspan}">{content}' . $notification . '{error}</td>';
     }
 }
 public function run()
 {
     $id = $this->getId();
     $this->htmlOptions['id'] = $id;
     if (isset($this->htmlOptions['disabled']) && $this->htmlOptions['disabled'] == 'disabled') {
         $tokenListClassSuffix = ' disabled';
     } else {
         $tokenListClassSuffix = '';
     }
     echo ZurmoHtml::textField($this->name, null, $this->htmlOptions);
     $javaScript = "\$(document).ready(function () { ";
     $javaScript .= "\$('#{$id}').tokenInput('{$this->sourceUrl}', { ";
     $javaScript .= "queryParam: 'term',";
     // Not Coding Standard
     if ($this->hintText != null) {
         $javaScript .= "hintText: '" . Yii::app()->format->text($this->hintText) . "',";
         // Not Coding Standard
     }
     if ($this->onAdd != null) {
         $javaScript .= "onAdd: " . $this->onAdd . ",";
         // Not Coding Standard
     }
     if ($this->onDelete != null) {
         $javaScript .= "onDelete: " . $this->onDelete . ",";
         // Not Coding Standard
     }
     if ($this->jsonEncodedIdsAndLabels != null) {
         $javaScript .= "prePopulate: " . $this->jsonEncodedIdsAndLabels . ",";
         // Not Coding Standard
     }
     $javaScript .= "preventDuplicates: 'true', classes: {tokenList: 'token-input-list" . $tokenListClassSuffix . "'}";
     $javaScript .= "});";
     $javaScript .= "});";
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, $javaScript);
 }
 /**
  * Render a hidden input, a text input with an auto-complete
  * event, and a select button. These three items together
  * form the Opportunity Editable Element
  * @return The element's content as a string.
  */
 protected function renderControlEditable()
 {
     $content = null;
     $content .= ZurmoHtml::textField('stageToProbabilityMapping_notUsed', null, array('id' => $this->getEditableInputId(), 'style' => "display:none;"));
     $fieldData = CustomFieldData::getByName('SalesStages');
     if ($fieldData->serializedData != null) {
         $values = unserialize($fieldData->serializedData);
         if (!is_array($values)) {
             $values = array();
         }
     } else {
         $values = array();
     }
     $stagesToProbabilities = OpportunitiesModule::getStageToProbabilityMappingData();
     foreach ($values as $value) {
         if (isset($stagesToProbabilities[$value])) {
             $probability = $stagesToProbabilities[$value];
         } else {
             $probability = 0;
         }
         $htmlOptions = array('name' => $this->getNameForInputField($value), 'value' => $probability);
         $element = $this->form->textField($this->model, $this->attribute, $htmlOptions);
         $element .= ZurmoHtml::tag('span', array(), $value);
         $content .= ZurmoHtml::tag('div', array('class' => 'has-lang-label'), $element);
     }
     return $content;
 }
 protected function renderContent()
 {
     $content = $this->renderTitleContent();
     $content .= '<ul class="configuration-list">';
     $modules = Module::getModuleObjects();
     $moduleClassNamesAndLabels = array();
     foreach ($modules as $module) {
         $moduleTreeMenuItems = $module->getDesignerMenuItems();
         if ($module->isEnabled() && !empty($moduleTreeMenuItems)) {
             $moduleClassNamesAndLabels[get_class($module)] = $module::getModuleLabelByTypeAndLanguage('Plural');
         }
     }
     asort($moduleClassNamesAndLabels);
     foreach ($moduleClassNamesAndLabels as $moduleClassName => $label) {
         if (RightsUtil::canUserAccessModule($moduleClassName, Yii::app()->user->userModel)) {
             $route = $this->moduleId . '/' . $this->controllerId . '/modulesMenu/';
             $content .= ZurmoHtml::openTag('li');
             $content .= '<h4>' . $label . '</h4>';
             $content .= ZurmoHtml::link(ZurmoHtml::wrapLabel(Zurmo::t('Core', 'Configure')), Yii::app()->createUrl($route, array('moduleClassName' => $moduleClassName)), array('class' => 'white-button'));
             $content .= ZurmoHtml::closeTag('li');
         }
     }
     $content .= '</ul>';
     return $content;
 }
 protected function renderTabs()
 {
     $content = ZurmoHtml::link(Zurmo::t('ZurmoModule', 'Library'), '#', array('class' => 'choose-tab active', 'data-view' => 'ImageModalSearchAndListView'));
     $content .= ZurmoHtml::link(Zurmo::t('ZurmoModule', 'Upload'), '#', array('class' => 'upload-tab', 'data-view' => 'ImageFilesUploadView'));
     $content .= ZurmoHtml::link(Zurmo::t('ZurmoModule', 'Import From Url'), '#', array('class' => 'upload-tab', 'data-view' => 'ImageFilesImportFromUrlView'));
     return ZurmoHtml::tag('div', array('class' => 'image-tabs clearfix'), $content);
 }
 protected function renderContent()
 {
     $imagePath = Yii::app()->themeManager->baseUrl . '/default/images/ajax-loader.gif';
     $progressBarImageContent = ZurmoHtml::image($imagePath, 'Progress Bar');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($cs->getCoreScriptUrl() . '/jquery.min.js', CClientScript::POS_END);
     $zurmoUpgradeStepTwoUrl = Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/stepTwo/');
     $loginUrl = Yii::app()->createUrl('zurmo/default');
     $content = '<div class="MetadataView">';
     $content .= '<table><tr><td>';
     $content .= '<div id="upgrade-step-two" style="display:none;">';
     $content .= '<table><tr><td>';
     $content .= Zurmo::t('InstallModule', 'The next step is to reload the application and upgrade the schema.');
     $content .= '<br/><br/>';
     $content .= ZurmoHtml::link(Zurmo::t('InstallModule', 'Click Here to continue with next step'), $zurmoUpgradeStepTwoUrl);
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= '<div id="progress-table">';
     $content .= '<table><tr><td class="progress-bar">';
     $content .= Zurmo::t('InstallModule', 'Upgrade in progress. Please wait.');
     $content .= '<br/>';
     $content .= $progressBarImageContent;
     $content .= '<br/>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= Zurmo::t('InstallModule', 'Upgrade Output:');
     $content .= '<div id="logging-table">';
     $content .= '</div>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     return $content;
 }
 public function render()
 {
     $htmlOptions = $this->getHtmlOptions();
     $request = Yii::app()->getRequest();
     if ($request->enableCsrfValidation && isset($htmlOptions['csrf']) && $htmlOptions['csrf']) {
         $htmlOptions['params'][$request->csrfTokenName] = $request->getCsrfToken();
     }
     if (isset($htmlOptions['params'])) {
         $params = CJavaScript::encode($htmlOptions['params']);
         unset($htmlOptions['params']);
     } else {
         $params = '{}';
     }
     if (isset($htmlOptions['class'])) {
         $htmlOptions['class'] .= ' z-button';
     } else {
         $htmlOptions['class'] = 'z-button';
     }
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('jquery');
     $cs->registerCoreScript('yii');
     $handler = "jQuery.yii.submitForm(this, '', {$params}); return false;";
     if (isset($htmlOptions['onclick'])) {
         $htmlOptions['onclick'] = $htmlOptions['onclick'] . $handler;
     } else {
         $htmlOptions['onclick'] = $handler;
     }
     $aContent = ZurmoHtml::tag('span', array('class' => 'z-spinner'), null);
     $aContent .= ZurmoHtml::tag('span', array('class' => 'z-icon'), null);
     $aContent .= ZurmoHtml::tag('span', array('class' => 'z-label'), $this->getLabel());
     return ZurmoHtml::link($aContent, '#', $htmlOptions);
 }
 protected function resolveLabelAndWrap()
 {
     if ($this->wrapLabel()) {
         return ZurmoHtml::wrapLabel($this->getLabel(), 'button-label');
     }
     return $this->getLabel();
 }
 protected function renderMergeTagsContent()
 {
     $title = ZurmoHtml::tag('h3', array(), Zurmo::t('Default', 'Merge Tags'));
     $view = new MergeTagsView('Campaign', Element::resolveInputIdPrefixIntoString(array(get_class($this->model), 'textContent')), Element::resolveInputIdPrefixIntoString(array(get_class($this->model), 'htmlContent')), false);
     $content = $view->render();
     return $title . $content;
 }
 /**
  * Render a test button. This link calls a modal
  * popup.
  * @return The element's content as a string.
  */
 protected function renderTestButton()
 {
     $content = '<span>';
     $content .= ZurmoHtml::ajaxLink(ZurmoHtml::wrapLabel(Zurmo::t('EmailMessagesModule', 'Send Test Email')), Yii::app()->createUrl('emailMessages/default/sendTestMessage/', array()), static::resolveAjaxOptionsForTestEmailSettings($this->form->getId()), array('id' => 'SendATestEmailToButton', 'class' => 'EmailTestingButton z-button'));
     $content .= '</span>';
     return $content;
 }
 protected function renderContent()
 {
     $imagePath = Yii::app()->themeManager->baseUrl . '/default/images/ajax-loader.gif';
     $progressBarImageContent = ZurmoHtml::image($imagePath, 'Progress Bar');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($cs->getCoreScriptUrl() . '/jquery.min.js', CClientScript::POS_END);
     $loginUrl = Yii::app()->createUrl('zurmo/default');
     $content = '<div class="MetadataView">';
     $content .= '<table><tr><td>';
     $content .= '<div id="upgrade-step-two" style="display:none;">';
     $content .= '<table><tr><td>';
     $content .= Zurmo::t('InstallModule', 'Upgrade process is completed. Please edit perInstance.php file, and disable maintenance mode.');
     $content .= '<br/><br/>';
     $content .= ZurmoHtml::link(Zurmo::t('InstallModule', 'Click here to access index page, after you disable maintenance mode.'), $loginUrl);
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= '<div id="progress-table">';
     $content .= '<table><tr><td class="progress-bar">';
     $content .= Zurmo::t('InstallModule', 'Upgrade in progress. Please wait.');
     $content .= '<br/>';
     $content .= $progressBarImageContent;
     $content .= '<br/>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= Zurmo::t('InstallModule', 'Upgrade Output:');
     $content .= '<div id="logging-table">';
     $content .= '</div>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     return $content;
 }
 protected function renderContent()
 {
     $imagePath = Yii::app()->themeManager->baseUrl . '/default/images/ajax-loader.gif';
     $progressBarImageContent = ZurmoHtml::image($imagePath, 'Progress Bar');
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile($cs->getCoreScriptUrl() . '/jquery.min.js', CClientScript::POS_END);
     $loginUrl = Yii::app()->createUrl('zurmo/default');
     $content = '<div class="MetadataView">';
     $content .= '<table><tr><td>';
     $content .= '<div id="complete-table" style="display:none;">';
     $content .= '<table><tr><td>';
     $content .= Zurmo::t('InstallModule', 'Congratulations! The demo data has been successfully loaded.');
     $content .= '<br/>';
     $content .= '<br/>';
     $content .= Zurmo::t('InstallModule', 'Click below to go to the login page. The username is <b>super</b>');
     $content .= '<br/><br/>';
     $content .= ZurmoHtml::link(Zurmo::t('ZurmoModule', 'Sign in'), $loginUrl);
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= '<div id="progress-table">';
     $content .= '<table><tr><td class="progress-bar">';
     $content .= Zurmo::t('InstallModule', 'Loading demo data. Please wait.');
     $content .= '<br/>';
     $content .= $progressBarImageContent;
     $content .= '<br/>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     $content .= Zurmo::t('InstallModule', 'Installation Output:');
     $content .= '<div id="logging-table">';
     $content .= '</div>';
     $content .= '</td></tr></table>';
     $content .= '</div>';
     return $content;
 }
 protected function resolveWrapperTdNonEditableByContent($content, array $properties = array())
 {
     $this->resolveContentWhenColumnIsEmpty($content);
     $content = parent::resolveWrapperTdNonEditableByContent($content, $properties);
     $content .= ZurmoHtml::tag('td', $this->resolveNonEditableExpanderTdHtmlOptions(), '');
     return $content;
 }
 protected function renderAfterFormLayout($form)
 {
     $element = new SortableContactWebFormAttributesElement($this->model, 'serializedData', $form);
     $content = $element->render();
     $content .= ZurmoHtml::hiddenField('getPlacedAttributeAction', Yii::app()->createUrl('contactWebForms/default/getPlacedAttributeByName'));
     return $content;
 }
 protected function getCheckboxContent($translatedLabel, $class)
 {
     $htmlOptions = array('onClick' => 'js:$(".' . $class . '").parentsUntil("li").parent().toggle();');
     $label = ZurmoHtml::label($translatedLabel, $translatedLabel, array('class' => 'label-for-marketing-list-widgets'));
     $content = ZurmoHtml::checkBox($translatedLabel, true, $htmlOptions) . $label;
     return $content;
 }
 /**
  * Override to ensure label is pointing to the right input id
  * @return A string containing the element's label
  */
 protected function renderLabel()
 {
     if ($this->form === null) {
         throw new NotImplementedException();
     }
     return ZurmoHtml::tag('h3', array(), Zurmo::t('ImportModule', 'Please select the module you would like to import to:'));
 }
 protected function renderContent()
 {
     $this->resolveContentForFooter();
     $this->resolveContentForMergeTags();
     $content = ZurmoHtml::tag('div', array('id' => 'footer-preview-modal-content', 'class' => 'footer-preview-modal'), $this->placeholderContent);
     return $content;
 }
 protected function renderCustomThemeColorChooser()
 {
     $attribute = 'customThemeColor1';
     $inputId = $this->getEditableInputId($attribute);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip($attribute);
     // Begin Not Coding Standard
     $cClipWidget->widget('application.core.widgets.ZurmoColorPicker', array('inputName' => $this->getEditableInputName($attribute), 'inputId' => $this->getEditableInputId($attribute), 'inputValue' => $this->model->{$attribute}, 'htmlOptions' => array('class' => 'color-picker'), 'change' => "function(event, ui) {\n                                                    \$('#{$inputId}').css('border-color', ui.color.toString());\n                                                    \$('div.custom .theme-color-1').css('background-color', ui.color.toString());\n                                          }"));
     // End Not Coding Standard
     $cClipWidget->endClip();
     $content = ZurmoHtml::tag('div', array(), $cClipWidget->getController()->clips[$attribute]);
     $attribute = 'customThemeColor2';
     $inputId = $this->getEditableInputId($attribute);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip($attribute);
     // Begin Not Coding Standard
     $cClipWidget->widget('application.core.widgets.ZurmoColorPicker', array('inputName' => $this->getEditableInputName($attribute), 'inputId' => $inputId, 'inputValue' => $this->model->{$attribute}, 'htmlOptions' => array('class' => 'color-picker'), 'change' => "function(event, ui) {\n                                                    \$('#{$inputId}').css('border-color', ui.color.toString());\n                                                    \$('div.custom .theme-color-2').css('background-color', ui.color.toString());\n                                          }"));
     // End Not Coding Standard
     $cClipWidget->endClip();
     $content .= ZurmoHtml::tag('div', array(), $cClipWidget->getController()->clips[$attribute]);
     $attribute = 'customThemeColor3';
     $inputId = $this->getEditableInputId($attribute);
     $cClipWidget = new CClipWidget();
     $cClipWidget->beginClip($attribute);
     // Begin Not Coding Standard
     $cClipWidget->widget('application.core.widgets.ZurmoColorPicker', array('inputName' => $this->getEditableInputName($attribute), 'inputId' => $this->getEditableInputId($attribute), 'inputValue' => $this->model->{$attribute}, 'htmlOptions' => array('class' => 'color-picker'), 'change' => "function(event, ui) {\n                                                    \$('#{$inputId}').css('border-color', ui.color.toString());\n                                                    \$('div.custom .theme-color-3').css('background-color', ui.color.toString());\n                                          }"));
     // End Not Coding Standard
     $cClipWidget->endClip();
     $content .= ZurmoHtml::tag('div', array(), $cClipWidget->getController()->clips[$attribute]);
     return ZurmoHtml::tag('div', array('id' => 'customThemeColorPicker', 'class' => 'clearfix'), $content);
 }
Exemple #24
0
 /**
  * Run this widget.
  * This method registers necessary javascript and renders the needed HTML code.
  */
 public function run()
 {
     $id = $this->getId();
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     if (empty($this->options)) {
         $options = '';
     } else {
         $options = CJavaScript::encode($this->options);
     }
     if ($this->baseInputNameForSortableCollection != null) {
         echo ZurmoHtml::hiddenField($this->baseInputNameForSortableCollection);
     }
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').sortable({$options});");
     echo ZurmoHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     if (empty($this->items)) {
         echo '<li></li>' . "\n";
     }
     foreach ($this->items as $id => $data) {
         echo strtr($this->itemTemplate, array_merge(array('{id}' => $id), $data)) . "\n";
     }
     echo ZurmoHtml::closeTag($this->tagName);
 }
 protected function renderActionBarContent()
 {
     $currentPageUrl = Yii::app()->createUrl($this->moduleId . '/' . $this->controllerId . '/runDiagnostic/');
     $content = '<br/><br/>';
     $content .= ZurmoHtml::link(ZurmoHtml::wrapLabel(Zurmo::t('InstallModule', 'Recheck System')), $currentPageUrl, array('class' => 'z-button'));
     return $content;
 }
 /**
  * @return string
  */
 protected function getLabel()
 {
     $content = ZurmoHtml::tag('span', array('class' => 'z-spinner'), null);
     $content .= ZurmoHtml::tag('span', array('class' => 'z-icon'), null);
     $content .= ZurmoHtml::tag('span', array('class' => 'z-label'), $this->getDefaultLabel());
     return $content;
 }
 protected function getMessageContent()
 {
     $message = Zurmo::t('Core', 'There are no more portlets to add');
     $content = ZurmoHtml::tag('span', array('class' => 'icon-notice'), '');
     $content .= ZurmoHtml::tag('p', array(), $message);
     return $content;
 }
 public static function getLinkStringForActivityItem($model, $linkRoute, $moduleClassName)
 {
     $modelClassName = get_class($model);
     $linkString = ActionSecurityUtil::resolveLinkToEditModelForCurrentUser(strval($model), $model, $moduleClassName, $linkRoute) . ' (' . $modelClassName . ')';
     $text = ZurmoHtml::tag('div', array(), $linkString);
     return $text;
 }
 /**
  * Render a test button. This link calls a modal
  * popup.
  * @return The element's content as a string.
  */
 protected function renderTestButton()
 {
     $content = '<span>';
     $content .= ZurmoHtml::ajaxLink(ZurmoHtml::tag('span', array('class' => 'z-label'), Zurmo::t('ZurmoModule', 'Test Connection')), Yii::app()->createUrl('zurmo/ldap/testConnection/', array()), static::resolveAjaxOptionsForTestLdapConnection($this->form->getId()), array('id' => 'TestLdapConnectionButton', 'class' => 'LdapTestingButton z-button'));
     $content .= '</span>';
     return $content;
 }
 protected function renderHideOrShowContent()
 {
     $name = MarketingDashboardIntroView::PANEL_ID . '-checkbox-id';
     $htmlOptions = array('id' => MarketingDashboardIntroView::PANEL_ID . '-checkbox-id');
     $checkBox = ZurmoHtml::checkBox($name, $this->resolveChecked(), $htmlOptions);
     return '<div class="screen-options"><h4>Screen Options</h4>' . $checkBox . Zurmo::t('MarketingModule', 'Show intro message') . '</div>';
 }