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;
 }
 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>';
 }
 protected function getDynamicContent()
 {
     $name = $this->getPanelId() . '-checkbox-id';
     $ajaxOptions = array('type' => 'GET', 'url' => Yii::app()->createUrl('zurmo/default/toggleDismissIntroView', array('moduleName' => $this->getModuleName(), 'panelId' => $this->getPanelId())), 'success' => "function()\n                                       {\n                                           var checked = \$('#{$this->getPanelId()}-checkbox-id').attr('checked');\n                                           \$('#{$this->getPanelId()}').slideToggle();\n                                           \$('#{$this->getPanelId()}-checkbox-id').attr('checked', !checked);\n                                           if (checked)\n                                           {\n                                             \$('#{$this->getPanelId()}-checkbox-id').parent().removeClass('c_on');\n                                           }\n                                           else\n                                           {\n                                             \$('#{$this->getPanelId()}-checkbox-id').parent().addClass('c_on');\n                                           }\n                                       }\n            ");
     $htmlOptions = array('id' => $this->getPanelId() . '-checkbox-id', 'ajax' => $ajaxOptions);
     $checkBox = ZurmoHtml::checkBox($name, $this->getChecked(), $htmlOptions);
     return '<div class="screen-options"><h4>' . $this->getLabelForDynamicContent() . '</h4>' . $checkBox . Zurmo::t('ZurmoModule', 'Show intro message') . '</div>';
 }
 /**
  * Render A standard text input.
  * @return The element's content as a string.
  */
 protected function renderControlEditable()
 {
     if ($this->getDisabledValue()) {
         $htmlOptions = array();
         $htmlOptions['id'] = $this->getEditableInputId();
         $htmlOptions['disabled'] = 'disabled';
         return ZurmoHtml::checkBox($this->getEditableInputName(), $this->model->{$this->attribute}, $htmlOptions);
     }
 }
 public static function renderCloseCheckBox($checkboxId, $modelId, $completedValue)
 {
     $htmlOptions = array('class' => 'close-task-checkbox', 'onclick' => "closeOpenTaskByCheckBoxClick('" . $checkboxId . "', '" . $modelId . "')");
     if ($completedValue == true) {
         $htmlOptions['disabled'] = 'disabled';
         $htmlOptions['labelClass'] = 'disabled';
         Yii::app()->clientScript->registerScript('closeTaskCheckBoxScriptStartingState' . $checkboxId, "\n                    \$('#" . $checkboxId . "').parentsUntil('tr').parent().children().css('text-decoration', 'line-through');\n                ", CClientScript::POS_END);
     }
     return ZurmoHtml::checkBox($checkboxId, $completedValue, $htmlOptions);
 }
 public function render()
 {
     if (!RightsUtil::canUserAccessModule('SocialItemsModule', Yii::app()->user->userModel)) {
         return parent::render();
     }
     $postToProfileContent = ZurmoHtml::tag('span', array(), Zurmo::t('ZurmoModule', 'Post to Profile'));
     $postToProfileContent .= static::renderHelpSpan();
     $postToProfileContent .= ZurmoHtml::checkBox('postToProfile', false);
     $content = parent::render();
     $content .= ZurmoHtml::tag('div', array('class' => 'post-to-profile clearfix'), $postToProfileContent);
     return $content;
 }
 /**
  * @return string
  */
 public function render()
 {
     $content = null;
     if ($this->hasRuntimeFilters()) {
         $htmlOptions = array('onClick' => 'js:$(".RuntimeFiltersForPortletView").toggle();');
         $label = ZurmoHtml::label(Zurmo::t('ReportsModule', 'Filters'), Zurmo::t('ReportsModule', 'Filters'), array('class' => 'label-for-report-widgets'));
         $content .= ZurmoHtml::checkBox(Zurmo::t('ReportsModule', 'Filters'), true, $htmlOptions) . $label;
     }
     if ($this->hasChart()) {
         $htmlOptions = array('onClick' => 'js:$(".ReportChartForPortletView").toggle();');
         $label = ZurmoHtml::label(Zurmo::t('ReportsModule', 'Chart'), Zurmo::t('ReportsModule', 'Chart'), array('class' => 'label-for-report-widgets'));
         $content .= ZurmoHtml::checkBox(Zurmo::t('ReportsModule', 'Chart'), true, $htmlOptions) . $label;
     }
     $htmlOptions = array('onClick' => 'js:$(".ReportResultsGridForPortletView").toggle();');
     $label = ZurmoHtml::label(Zurmo::t('ReportsModule', 'Grid'), Zurmo::t('ReportsModule', 'Grid'), array('class' => 'label-for-report-widgets'));
     $content .= ZurmoHtml::checkBox(Zurmo::t('ReportsModule', 'Grid'), true, $htmlOptions) . $label;
     $htmlOptions = array('onClick' => 'js:$(".ReportSQLForPortletView").toggle();');
     $label = ZurmoHtml::label(Zurmo::t('ReportsModule', 'SQL'), Zurmo::t('ReportsModule', 'SQL'), array('class' => 'label-for-report-widgets'));
     $content .= ZurmoHtml::checkBox(Zurmo::t('ReportsModule', 'SQL'), false, $htmlOptions) . $label;
     return ZurmoHtml::tag('div', $this->getHtmlOptions(), $content);
 }
Example #8
0
    protected function renderActiveAttributesCheckBox($elementIds, $elementInformation, $checked)
    {
        $checkBoxHtmlOptions = array();
        $checkBoxHtmlOptions['id'] = "MassEdit_" . $elementInformation['attributeName'];
        $enableInputsScript = "";
        $disableInputsScript = "";
        $disableTagCloudInputsScript = "";
        foreach ($elementIds as $id) {
            if ($elementInformation['type'] == 'DropDown' || $elementInformation['type'] == 'RadioDropDown') {
                $enableInputsScript .= "\$('#" . $id . "').removeAttr('disabled'); \n";
                $enableInputsScript .= "\$('#" . $id . "').prev().removeClass('disabled-select-element'); \n";
                $disableInputsScript .= "\$('#" . $id . "').attr('disabled', 'disabled'); \n";
                $disableInputsScript .= "\$('#" . $id . "').prev().addClass('disabled-select-element'); \n";
            } elseif ($elementInformation['type'] == 'TagCloud') {
                $enableInputsScript .= "\$('#token-input-" . $id . "').parent().parent().removeClass('disabled'); \n";
                $disableInputsScript .= "\$('#token-input-" . $id . "').parent().parent().addClass('disabled'); \n";
            } else {
                $enableInputsScript .= "\$('#" . $id . "').removeAttr('disabled'); \n";
                $enableInputsScript .= "if (\$('#" . $id . "').attr('type') != 'button')\n                    {\n                        if (\$('#" . $id . "').attr('href') != undefined)\n                        {\n                            \$('#" . $id . "').css('display', '');\n                        }\n                    }; \n";
                $disableInputsScript .= "\$('#" . $id . "').attr('disabled', 'disabled'); \n";
                $disableInputsScript .= "if (\$('#" . $id . "').attr('type') != 'button')\n                    {\n                        if (\$('#" . $id . "').attr('href') != undefined)\n                        {\n                            \$('#" . $id . "').css('display', 'none');\n                        }\n                        \$('#" . $id . "').val('');\n                    }; \n";
            }
        }
        $massEditScript = <<<END
\$('#{$checkBoxHtmlOptions['id']}').click(function()
    {
        if (this.checked)
        {
            {$enableInputsScript}
        }
        else
        {
            {$disableInputsScript}
        }
    }
);
END;
        Yii::app()->clientScript->registerScript($checkBoxHtmlOptions['id'], $massEditScript);
        return "<th>" . ZurmoHtml::checkBox("MassEdit[" . $elementInformation['attributeName'] . "]", $checked, $checkBoxHtmlOptions) . "</th>  \n";
    }
 /**
  * Renders check list
  * @return string
  */
 protected function renderCheckListItemsContent()
 {
     $content = null;
     $rows = 0;
     $data = array();
     foreach ($this->checkListItemsData as $checkListItem) {
         if ($checkListItem->completed == null || $checkListItem->completed == 0) {
             $checked = false;
         } else {
             $checked = true;
         }
         $checkboxLabel = ZurmoHtml::label($checkListItem->name, 'TaskCheckListItem_' . $checkListItem->id, array());
         $checkBox = ZurmoHtml::checkBox('TaskCheckListItem_' . $checkListItem->id, $checked, array('class' => 'checkListItem', 'value' => $checkListItem->id));
         $itemContent = ZurmoHtml::tag('div', array('class' => 'editable'), $checkBox . '<p>' . $checkboxLabel . '</p>');
         $itemContent .= $this->renderHiddenEditableTextField($checkListItem->id, $checkListItem->name);
         $itemContent .= $this->attachActionsToCheckListItem();
         $content .= ZurmoHtml::tag('li', array('class' => 'check-list-item clearfix', 'id' => 'SortedTaskCheckListItem_' . $checkListItem->id), $itemContent);
     }
     Yii::app()->clientScript->registerScriptFile(Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('application.modules.tasks.elements.assets')) . '/TaskUtils.js', CClientScript::POS_END);
     $this->registerCheckListItemsScript($checkListItem->id);
     return $content;
 }
 protected function renderCheckboxWithHiddenInput($label, $attribute, $renderHidden = false)
 {
     $checkboxLabelFor = $attribute;
     if ($renderHidden) {
         $attribute = $this->resolveCheckboxInputAttributeName($attribute);
         $checkboxLabelFor = ZurmoHtml::activeId($this->model, $attribute);
     }
     $checkboxLabelHtmlOptions = array();
     $checkboxLabel = ZurmoHtml::label($label, $checkboxLabelFor, $checkboxLabelHtmlOptions);
     $checkboxHtmlOptions = $this->resolveCheckBoxHtmlOptions($renderHidden);
     $content = null;
     if ($renderHidden) {
         $content .= $this->form->checkBox($this->model, $attribute, $checkboxHtmlOptions);
     } else {
         $content .= ZurmoHtml::checkBox($attribute, false, $checkboxHtmlOptions);
     }
     $content .= $checkboxLabel;
     return $content;
 }
 protected function getPanelSettingsDisplay($title, $detailViewOnly, $locked, $panelIdName)
 {
     assert('is_bool($locked) || $locked == null');
     $content = '<div class="panel-settings modal-settings" title="' . Zurmo::t('Core', 'Panel Settings') . '">';
     $content .= '<div class="wide form">';
     $content .= '<table>';
     $content .= TableUtil::getColGroupContent(1);
     $content .= '<tr>';
     $content .= '<th><label>' . Zurmo::t('Core', 'Panel Title') . '</label></th>';
     $content .= '<td>' . ZurmoHtml::textField('title_' . $panelIdName, $title, array('class' => 'panel-title settings-form-field')) . ZurmoHtml::hiddenField('locked_' . $panelIdName, $locked, array('class' => 'panel-title settings-form-field')) . '</td>';
     $content .= '</tr>';
     $content .= '<tr>';
     $content .= '<th><label>' . Zurmo::t('Core', 'Detail View Only') . '</label></th>';
     $content .= '<td>' . ZurmoHtml::checkBox('detailViewOnly_' . $panelIdName, $detailViewOnly, array('class' => 'panel-title settings-form-field')) . '</td>';
     $content .= '</tr>';
     $content .= '</table>';
     $content .= '<div class="view-toolbar-container clearfix"><div class="form-toolbar">';
     $content .= $this->renderSaveModalSettingsButton();
     $content .= '</div></div>';
     $content .= '</div>';
     $content .= '</div>';
     return $content;
 }
 /**
  * Override to support adding the label wrapper on the checkbox
  * (non-PHPdoc)
  * @see CCheckBoxColumn::renderDataCellContent()
  */
 protected function renderDataCellContent($row, $data)
 {
     if ($this->value !== null) {
         $value = $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));
     } elseif ($this->name !== null) {
         $value = ZurmoHtml::value($data, $this->name);
     } else {
         $value = $this->grid->dataProvider->keys[$row];
     }
     $checked = false;
     if ($this->checked !== null) {
         $checked = $this->evaluateExpression($this->checked, array('data' => $data, 'row' => $row));
     }
     $options = $this->checkBoxHtmlOptions;
     $name = $options['name'];
     unset($options['name']);
     $options['value'] = $value;
     $options['id'] = $this->id . '_' . $row;
     echo ZurmoHtml::checkBox($name, $checked, $options);
 }
Example #13
0
 /**
  * Make calendar items list.
  * @param array $data
  * @param string $field
  * @param string $itemClass
  * @param string $type
  * @return string
  */
 public static function makeCalendarItemsList($data, $field, $itemClass, $type)
 {
     assert('is_array($data)');
     assert('is_string($field)');
     assert('is_string($itemClass)');
     assert('is_string($type)');
     $itemsContent = null;
     foreach ($data as $calendarArray) {
         $isChecked = false;
         if ($calendarArray[1] === true) {
             $isChecked = true;
         }
         $input = ZurmoHtml::checkBox($field, $isChecked, array('value' => $calendarArray[0]->id, 'class' => $itemClass));
         $color = ZurmoHtml::tag('span', array('class' => 'cal-color', 'style' => 'background:' . $calendarArray[0]->color), '');
         if ($type == 'saved') {
             $label = $calendarArray[0]->name;
             $options = self::getSavedCalendarOptions($calendarArray[0]->id);
             $subscriptionData = null;
         } else {
             $savedCalendar = $calendarArray[0]->savedcalendar;
             $label = $savedCalendar->name;
             $options = self::getSharedCalendarOptions($calendarArray[0]->id);
             $subscriptionData = CalendarUtil::getCalendarSubscriberData($calendarArray[0]->savedcalendar);
         }
         $label = ZurmoHtml::tag('strong', array('class' => 'cal-name'), $label);
         $itemsContent .= ZurmoHtml::tag('li', array(), $input . $color . $label . $subscriptionData . $options);
     }
     return ZurmoHtml::tag('ul', array('class' => 'calendars-list'), $itemsContent);
 }