Exemplo n.º 1
0
 public static function getSortLinks($order = null)
 {
     $ret = X2Html::link(Yii::t('topics', 'Sorting'), '#', array('id' => 'topics-sort-toggle', 'class' => 'x2-button', 'style' => 'vertical-align:top;'));
     $links = array(X2Html::link(Yii::t('topics', 'Most Recent'), Yii::app()->controller->createUrl('/topics/topics/index', array('order' => 'mostRecent')), array('class' => 'x2-button' . ($order == 'mostRecent' || is_null($order) ? ' disabled disabled-link' : ''), 'style' => 'vertical-align:top;')), X2Html::link(Yii::t('topics', 'Alphabetical'), Yii::app()->controller->createUrl('/topics/topics/index', array('order' => 'alphabetical')), array('class' => 'x2-button' . ($order == 'alphabetical' ? ' disabled disabled-link' : ''), 'style' => 'vertical-align:top;')), X2Html::link(Yii::t('topics', 'Create Date'), Yii::app()->controller->createUrl('/topics/topics/index', array('order' => 'firstCreated')), array('class' => 'x2-button' . ($order == 'firstCreated' ? ' disabled disabled-link' : ''), 'style' => 'vertical-align:top;')), X2Html::link(Yii::t('topics', 'Most Popular'), Yii::app()->controller->createUrl('/topics/topics/index', array('order' => 'mostPopular')), array('class' => 'x2-button' . ($order == 'mostPopular' ? ' disabled disabled-link' : ''), 'style' => 'vertical-align:top;')));
     $ret .= X2Html::tag('div', array('id' => 'topics-sort-buttons', 'style' => 'display:none;'), implode(' ', $links));
     return $ret;
 }
Exemplo n.º 2
0
 public static function getViewActionMenuListItem($modelId)
 {
     if (Yii::app()->controller->action->getId() === 'view') {
         return array('name' => 'view', 'label' => Yii::t('app', 'View') . X2Html::minimizeButton(array('class' => 'record-view-type-menu-toggle'), '#record-view-type-menu', true, Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen']), 'encodeLabel' => false, 'url' => array('view', 'id' => $modelId), 'linkOptions' => array('onClick' => '$(this).find ("i:visible").click ();'), 'itemOptions' => array('id' => 'view-record-action-menu-item'), 'submenuOptions' => array('id' => 'record-view-type-menu', 'style' => Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen'] ? '' : 'display: none;'), 'items' => array(array('encodeLabel' => false, 'name' => 'journalView', 'label' => CHtml::checkBox('journalView', Yii::app()->params->profile->miscLayoutSettings['enableJournalView'], array('class' => 'journal-view-checkbox')) . CHtml::label(Yii::t('app', 'Journal View'), 'journalView')), array('encodeLabel' => false, 'name' => 'transactionalView', 'label' => CHtml::checkBox('transactionalView', Yii::app()->params->profile->miscLayoutSettings['enableTransactionalView'], array('class' => 'transactional-view-checkbox')) . CHtml::label(Yii::t('app', 'List View'), 'transactionalView'))));
     } else {
         return array('name' => 'view', 'label' => Yii::t('app', 'View'), 'encodeLabel' => true, 'url' => array('view', 'id' => $modelId));
     }
 }
Exemplo n.º 3
0
 public function renderInput(CModel $model, $attribute, array $htmlOptions = array())
 {
     $action = new Actions();
     $action->setAttributes($model->getAttributes(), false);
     $defaultOptions = array('id' => $this->resolveId($attribute));
     $htmlOptions = X2Html::mergeHtmlOptions($defaultOptions, $htmlOptions);
     return preg_replace('/Actions(\\[[^\\]]*\\])/', get_class($this->formModel) . '$1', $action->renderInput($attribute, $htmlOptions));
 }
Exemplo n.º 4
0
 public function getLink()
 {
     if ($this->type === 'folder') {
         return X2Html::link($this->name, '#', array('class' => 'folder-link pseudo-link', 'data-id' => $this->objId));
     } else {
         return X2Html::link($this->name, Yii::app()->controller->createUrl('/docs/view', array('id' => $this->objId)));
     }
 }
Exemplo n.º 5
0
 public function run()
 {
     $this->htmlOptions = X2Html::mergeHtmlOptions($this->htmlOptions, array('id' => $this->namespace . "-multi-type-autocomplete-container"));
     if (isset($this->model)) {
         $selectAttr = $this->selectName;
         $this->selectValue = $this->model->{$selectAttr};
     }
     $this->render('_multiTypeAutocomplete');
 }
 /**
  * @return array the config array passed to widget ()
  */
 public function getGridViewConfig()
 {
     if (!isset($this->_gridViewConfig)) {
         $this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'defaultGvSettings' => array('isActive' => 65, 'fullName' => 125, 'lastLogin' => 80, 'emailAddress' => 100), 'template' => CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => 'page-title'), array('style' => !CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')) && !CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')) ? 'display: none;' : ''))) . '<h2 class="grid-widget-title-bar-dummy-element">' . '</h2>{buttons}{filterHint}' . '{summary}{topPager}</div>{items}{pager}', 'includedFields' => array('tagLine', 'username', 'officePhone', 'cellPhone', 'emailAddress', 'googleId', 'isActive', 'leadRoutingAvailability'), 'specialColumns' => array('fullName' => array('name' => 'fullName', 'header' => Yii::t('profile', 'Full Name'), 'value' => 'CHtml::link(CHtml::encode($data->fullName),array("view","id"=>$data->id))', 'type' => 'raw'), 'lastLogin' => array('name' => 'lastLogin', 'header' => Yii::t('profile', 'Last Login'), 'value' => '$data->user ? ($data->user->lastLogin == 0 ? "" : ' . 'Formatter::formatDateDynamic ($data->user->lastLogin)) : ""', 'type' => 'raw'), 'isActive' => array('name' => 'isActive', 'header' => Yii::t('profile', 'Active'), 'value' => '"<span title=\'' . '".(Session::isOnline ($data->username) ? ' . '"' . Yii::t('profile', 'Active User') . '" : "' . Yii::t('profile', 'Inactive User') . '")."\'' . ' class=\'".(Session::isOnline ($data->username) ? ' . '"active-indicator" : "inactive-indicator")."\'></span>"', 'type' => 'raw'), 'username' => array('name' => 'username', 'header' => Yii::t('profile', 'Username'), 'value' => '$data->user ? CHtml::encode($data->user->alias) : ""', 'type' => 'raw'), 'leadRoutingAvailability' => array('name' => 'leadRoutingAvailability', 'header' => Yii::t('profile', 'Lead Routing Availability'), 'value' => 'CHtml::encode($data->leadRoutingAvailability ? 
                             Yii::t("profile", "Available") :
                             Yii::t("profile", "Unavailable"))', 'type' => 'raw')), 'enableControls' => false));
     }
     return $this->_gridViewConfig;
 }
Exemplo n.º 7
0
 public function quickNoteSelector(CFormModel $formModel)
 {
     ob_start();
     ob_implicit_flush(false);
     echo CHtml::label(Yii::t('app', 'Quick Note'), 'quickNote', array('style' => 'display:inline-block; margin-right: 10px;'));
     echo X2Html::dropDownList('quickNote', '', array_merge(array('' => '-'), Dropdowns::getItems(117)), array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{"val":$(this).val(),"dropdownId":"117"}', 'update' => $this->resolveIds('#quickNote2')), 'id' => $this->resolveId('quickNote'), 'class' => 'quick-note'));
     echo X2Html::dropDownList('quickNote2', '', array('' => '-'), array('id' => $this->resolveId('quickNote2'), 'class' => 'quick-note'));
     Yii::app()->clientScript->registerScript('quickNoteSelector', "\n            \$('#{$this->resolveId('quickNote2')}').change (function () {\n                \$(this).next ().val (\$(this).val ());\n            });\n        ");
     return ob_get_clean();
 }
Exemplo n.º 8
0
 public function renderInput($attr)
 {
     switch ($attr) {
         case 'password':
             echo X2Html::x2ActivePasswordField($this, $attr, $this->htmlOptions($attr), true);
             break;
         default:
             parent::renderInput($attr);
     }
 }
Exemplo n.º 9
0
 protected function generateColumns()
 {
     $unsortedColumns = array();
     foreach ($this->columns as &$column) {
         $name = isset($column['name']) ? $column['name'] : '';
         if (!isset($column['id'])) {
             if (isset($column['class']) && is_subclass_of($column['class'], 'CCheckboxColumn')) {
                 $column['id'] = $this->namespacePrefix . 'C_gvCheckbox' . $name;
             } else {
                 $column['id'] = $this->namespacePrefix . 'C_' . $name;
             }
         } else {
             $column['id'] = $this->namespacePrefix . $column['id'];
         }
         if (!isset($this->gvSettings[$name])) {
             if ($name === 'gvCheckbox') {
                 $column = $this->getGvCheckboxColumn(null, $column);
             }
             $unsortedColumns[] = $column;
             continue;
         }
         $width = $this->gvSettings[$name];
         $width = $this->formatWidth($width);
         if ($width) {
             $column['headerHtmlOptions'] = array_merge(isset($column['headerHtmlOptions']) ? $column['headerHtmlOptions'] : array(), array('style' => 'width:' . $width . ';'));
             $column['htmlOptions'] = X2Html::mergeHtmlOptions(isset($column['htmlOptions']) ? $column['htmlOptions'] : array(), array('width' => $width));
         }
     }
     unset($column);
     // unset lingering reference
     if (isset($this->gvSettings['gvControls']) && $this->enableControls) {
         $width = $this->gvSettings['gvControls'];
         $width = !empty($width) && is_numeric($width) ? $width : null;
         $this->columns[] = $this->getGvControlsColumn($width);
     }
     if (isset($this->gvSettings['gvCheckBox'])) {
         $width = $this->gvSettings['gvCheckBox'];
         $width = !empty($width) && is_numeric($width) ? $width : null;
         $this->columns[] = $this->getGvCheckboxColumn($width);
     }
     if ($this->rememberColumnSort) {
         $sortedColumns = array();
         foreach ($this->gvSettings as $columnName => $width) {
             foreach ($this->columns as $column) {
                 $name = isset($column['name']) ? $column['name'] : '';
                 if ($name === $columnName) {
                     $sortedColumns[] = $column;
                     break;
                 }
             }
         }
         $this->columns = array_merge($sortedColumns, $unsortedColumns);
     }
 }
 protected function renderDateTime($field, $makeLinks, $textOnly, $encode)
 {
     $fieldName = $field->fieldName;
     if (empty($this->owner->{$fieldName})) {
         return ' ';
     } elseif (is_numeric($this->owner->{$fieldName})) {
         return X2Html::dynamicDate($this->owner->{$fieldName});
     } else {
         return $this->render($this->owner->{$fieldName}, $encode);
     }
 }
Exemplo n.º 11
0
 public function renderFilterCellByType()
 {
     $model = $this->grid->filter;
     switch ($this->filterType) {
         case 'date':
             return X2Html::activeDatePicker($model, $this->name);
             break;
         case 'dateTime':
             return X2Html::activeDatePicker($model, $this->name, array(), 'datetime');
             break;
     }
 }
Exemplo n.º 12
0
 public function renderInput($attr)
 {
     switch ($attr) {
         case 'password':
             echo X2Html::x2ActivePasswordField($this, $attr, $this->htmlOptions($attr), true);
             break;
         case 'server':
             echo CHtml::activeDropDownList($this, 'server', $this->sesEndpoints, $this->htmlOptions($attr));
             break;
         default:
             parent::renderInput($attr);
     }
 }
Exemplo n.º 13
0
 public function render()
 {
     if ($this->isSelected) {
         $this->htmlOptions = X2Html::mergeHtmlOptions($this->htmlOptions, array('class' => 'selected'));
     }
     $html = CHtml::openTag('li', $this->htmlOptions);
     $html .= CHtml::openTag('a', X2Html::mergeHtmlOptions(array('href' => $this->getHref()), $this->linkHtmlOptions));
     $html .= "<i class='icon " . lcfirst($this->getId()) . "'></i>";
     $html .= CHtml::encode($this->getTitle());
     $html .= '</a>';
     $html .= '</li>';
     return $html;
 }
Exemplo n.º 14
0
 public function renderInput($attr)
 {
     switch ($attr) {
         case 'email':
             echo '<p class="fieldhelp-thin-small">' . Yii::t('app', '(example@gmail.com)') . '</p>';
             echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr));
             break;
         case 'password':
             echo X2Html::x2ActivePasswordField($this, $attr, $this->htmlOptions($attr), true);
             break;
         default:
             parent::renderInput($attr);
     }
 }
Exemplo n.º 15
0
 public function renderMoreButton()
 {
     $pager = Yii::createComponent(array('class' => Yii::app()->controller->pathAliasBase . 'components.MobileRecordIndexPager', 'pages' => $this->dataProvider->getPagination()));
     $currentPage = $pager->getCurrentPage(false);
     $pageCount = $pager->getPageCount();
     //$href = $pager->createPageUrl ($currentPage + 1),
     //$href = UrlUtil::mergeParams (Yii::app()->request->url, array (
     //));
     if ($currentPage + 1 < $pageCount) {
         $html = CHtml::openTag('a', array('href' => $pager->createPageUrl($currentPage + 1), 'class' => 'more-button record-list-item'));
         $html .= X2Html::fa('ellipsis-h');
         $html .= '<span>' . CHtml::encode(Yii::t('app', 'More')) . '</span>';
         $html .= "</a>";
         echo $html;
     }
 }
Exemplo n.º 16
0
 public function renderLayout()
 {
     $html = '';
     //$html .= $this->renderName ();
     foreach ($this->layoutData as $fieldName) {
         $field = $this->model->getField($fieldName);
         if (!$this->canView($field)) {
             continue;
         }
         if (!$field) {
             continue;
         }
         $html .= $this->renderField($field, $this->renderLabel($field->attributeLabel) . $this->renderValue($fieldName, array()), array('data-x2-field-type' => X2Html::sanitizeAttribute($field->type)));
     }
     return $html;
 }
Exemplo n.º 17
0
 public function renderButtons()
 {
     $stickyButton = '';
     if (Yii::app()->user->checkAccess('TopicsPinUnpinTopic')) {
         $stickyButton = X2Html::link($this->model->sticky ? Yii::t('topics', 'Unpin Topic') : Yii::t('topics', 'Pin Topic'), '#', array('id' => 'sticky-topic', 'data-id' => $this->model->id, 'class' => 'x2-button', 'style' => 'vertical-align:top;'));
         Yii::app()->clientScript->registerScript('pin-topic', '
             $(document).on("click","#sticky-topic",function(){
                 $.ajax({
                     url:"' . Yii::app()->controller->createUrl('/topics/topics/pinUnpinTopic') . '",
                     data:{id:$(this).attr("data-id")},
                     beforeSend:function(){
                         x2.forms.inputLoading($("#sticky-topic"));
                     },
                     success:function(data){
                         $("#sticky-topic").html(data);
                         x2.forms.inputLoadingStop($("#sticky-topic"));
                     }
                 });
                 return false;
             });
         ', CClientScript::POS_READY);
     }
     echo "<span class='list-view-title-bar-buttons'>\n                {$stickyButton}\n                <div id='show-topics-relationships-button' class='x2-button'>Relationships</div>\n                <div id='show-topics-tags-button' class='x2-button'>Tags</div>\n            </span>";
 }
Exemplo n.º 18
0
 protected function getSettingsMenuContentDialogs()
 {
     return '<div id="grid-settings-dialog-' . $this->widgetKey . '" 
           style="display: none;">' . '<div>' . Yii::t('profile', 'Use persistent filter and sort settings?') . '</div>' . CHtml::checkbox('dbPersistentGridSettings', self::getJSONProperty($this->profile, 'dbPersistentGridSettings', $this->widgetType, $this->widgetUID), array('id' => 'dbPersistentGridSettings-' . $this->widgetKey)) . X2Html::hint(Yii::t('profile', 'Leaving this box checked will prevent your grid filter and ' . 'sort settings from being reset when you log out of the app.'), false, null, true, true) . '</div>' . parent::getSettingsMenuContentDialogs();
 }
Exemplo n.º 19
0
    public static function renderModelInput(CModel $model, $field, $htmlOptions = array())
    {
        if (!$field->asa('CommonFieldsBehavior')) {
            throw new Exception('$field must have CommonFieldsBehavior');
        }
        if ($field->required) {
            if (isset($htmlOptions['class'])) {
                $htmlOptions['class'] .= ' x2-required';
            } else {
                $htmlOptions = array_merge(array('class' => 'x2-required'), $htmlOptions);
            }
        }
        $fieldName = $field->fieldName;
        if (!isset($field)) {
            return null;
        }
        switch ($field->type) {
            case 'text':
                return CHtml::activeTextArea($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), array_merge(array('encode' => false), $htmlOptions)));
            case 'date':
                $oldDateVal = $model->{$fieldName};
                $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium');
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateVal;
                return $input;
            case 'dateTime':
                $oldDateTimeVal = $model->{$fieldName};
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => true, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $model->{$fieldName} = Formatter::formatDateTime($model->{$fieldName});
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'datetime', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateTimeVal;
                return $input;
            case 'dropdown':
                // Note: if desired to translate dropdown options, change the seecond argument to
                // $model->module
                $om = $field->getDropdownOptions();
                $multi = (bool) $om['multi'];
                $dropdowns = $om['options'];
                $curVal = $multi ? CJSON::decode($model->{$field->fieldName}) : $model->{$field->fieldName};
                $ajaxArray = array();
                if ($field instanceof Fields) {
                    $dependencyCount = X2Model::model('Dropdowns')->countByAttributes(array('parent' => $field->linkType));
                    $fieldDependencyCount = X2Model::model('Fields')->countByAttributes(array('modelName' => $field->modelName, 'type' => 'dependentDropdown', 'linkType' => $field->linkType));
                    if ($dependencyCount > 0 && $fieldDependencyCount > 0) {
                        $ajaxArray = array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{
                                "val":$(this).val(),
                                "dropdownId":"' . $field->linkType . '",
                                "field":true, "module":"' . $field->modelName . '"
                            }', 'success' => '
                                function(data){
                                    if(data){
                                        data=JSON.parse(data);
                                        if(data[0] && data[1]){
                                            $("#' . $field->modelName . '_"+data[0]).html(data[1]);
                                        }
                                    }
                                }'));
                    }
                }
                $htmlOptions = array_merge($htmlOptions, $ajaxArray, array('title' => $field->attributeLabel));
                if ($multi) {
                    $multiSelectOptions = array();
                    if (!is_array($curVal)) {
                        $curVal = array();
                    }
                    foreach ($curVal as $option) {
                        $multiSelectOptions[$option] = array('selected' => 'selected');
                    }
                    $htmlOptions = array_merge($htmlOptions, array('options' => $multiSelectOptions, 'multiple' => 'multiple'));
                } elseif ($field->includeEmpty) {
                    $htmlOptions = array_merge($htmlOptions, array('empty' => Yii::t('app', "Select an option")));
                }
                return CHtml::activeDropDownList($model, $field->fieldName, $dropdowns, $htmlOptions);
            case 'dependentDropdown':
                return CHtml::activeDropDownList($model, $field->fieldName, array('' => '-'), array_merge(array('title' => $field->attributeLabel), $htmlOptions));
            case 'link':
                $linkSource = null;
                $linkId = '';
                $name = '';
                if (class_exists($field->linkType)) {
                    // Create a model for autocompletion:
                    if (!empty($model->{$fieldName})) {
                        list($name, $linkId) = Fields::nameAndId($model->{$fieldName});
                        $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true);
                    } else {
                        $linkModel = X2Model::model($field->linkType);
                    }
                    if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
                        $linkSource = Yii::app()->controller->createUrl($linkModel->autoCompleteSource);
                        $linkId = $linkModel->id;
                        $oldLinkFieldVal = $model->{$fieldName};
                        $model->{$fieldName} = $name;
                    }
                }
                static $linkInputCounter = 0;
                $hiddenInputId = $field->modelName . '_' . $fieldName . "_id" . $linkInputCounter++;
                $input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array('id' => $hiddenInputId)) . Yii::app()->controller->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'attribute' => $fieldName, 'source' => $linkSource, 'value' => $name, 'options' => array('minLength' => '1', 'select' => 'js:function( event, ui ) {
                                    $("#' . $hiddenInputId . '").
                                        val(ui.item.id);
                                    $(this).val(ui.item.value);
                                    return false;
                            }', 'create' => $field->linkType == 'Contacts' ? 'js:function(event, ui) {
                                    $(this).data( "uiAutocomplete" )._renderItem = 
                                        function(ul,item) {
                                            return $("<li>").data("item.autocomplete",item).
                                                append(x2.forms.renderContactLookup(item)).
                                                appendTo(ul);
                                        };
                            }' : ($field->linkType == 'BugReports' ? 'js:function(event, ui) {
                                $(this).data( "uiAutocomplete" )._renderItem = 
                                    function( ul, item ) {

                                    var label = "<a style=\\"line-height: 1;\\">" + item.label;

                                    label += "<span style=\\"font-size: 0.6em;\\">";

                                    // add email if defined
                                    if(item.subject) {
                                        label += "<br>";
                                        label += item.subject;
                                    }

                                    label += "</span>";
                                    label += "</a>";

                                    return $( "<li>" )
                                        .data( "item.autocomplete", item )
                                        .append( label )
                                        .appendTo( ul );
                                };
                            }' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true);
                if (isset($oldLinkFieldVal)) {
                    $model->{$fieldName} = $oldLinkFieldVal;
                }
                return $input;
            case 'rating':
                return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){
                        if (typeof x2 !== "undefined" &&
                            typeof x2.InlineEditor !== "undefined" &&
                            typeof x2.InlineEditor.ratingFields !== "undefined") {

                            x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value;
                        }
                    }'), true);
            case 'boolean':
                $checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper')));
                $checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions));
                $checkbox .= CHtml::closeTag('div');
                return $checkbox;
            case 'assignment':
                $oldAssignmentVal = $model->{$fieldName};
                $model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment();
                $dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions));
                $model->{$fieldName} = $oldAssignmentVal;
                return $dropdownList;
            case 'optionalAssignment':
                // optional assignment for users (can be left blank)
                $users = User::getNames();
                unset($users['Anyone']);
                return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions));
            case 'visibility':
                $permissionsBehavior = Yii::app()->params->modelPermissions;
                return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions));
                // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
                // case 'int':
                // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
                // 'title' => $field->attributeLabel,
                // ), $htmlOptions));
            // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
            // case 'int':
            // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
            // 'title' => $field->attributeLabel,
            // ), $htmlOptions));
            case 'percentage':
                $htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage';
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
            case 'currency':
                $fieldName = $field->fieldName;
                $elementId = isset($htmlOptions['id']) ? '#' . $htmlOptions['id'] : '#' . $field->modelName . '_' . $field->fieldName;
                Yii::app()->controller->widget('application.extensions.moneymask.MMask', array('element' => $elementId, 'currency' => Yii::app()->params['currency'], 'config' => array('affixStay' => true, 'decimal' => Yii::app()->locale->getNumberSymbol('decimal'), 'thousands' => Yii::app()->locale->getNumberSymbol('group'))));
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'class' => 'currency-field'), $htmlOptions));
            case 'credentials':
                $typeAlias = explode(':', $field->linkType);
                $type = $typeAlias[0];
                if (count($typeAlias) > 1) {
                    $uid = Credentials::$sysUseId[$typeAlias[1]];
                } else {
                    $uid = Yii::app()->user->id;
                }
                return Credentials::selectorField($model, $field->fieldName, $type, $uid);
            case 'timerSum':
                // Sorry, no-can-do. This is field derives its value from a sum over timer records.
                return $model->renderAttribute($field->fieldName);
            case 'float':
            case 'int':
                if (isset($model->{$fieldName})) {
                    $oldNumVal = $model->{$fieldName};
                    $model->{$fieldName} = Yii::app()->locale->numberFormatter->formatDecimal($model->{$fieldName});
                }
                $input = CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
                if (isset($oldNumVal)) {
                    $model->{$fieldName} = $oldNumVal;
                }
                return $input;
            default:
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
                // array(
                // 'tabindex'=>isset($item['tabindex'])? $item['tabindex'] : null,
                // 'disabled'=>$item['readOnly']? 'disabled' : null,
                // 'title'=>$field->attributeLabel,
                // 'style'=>$default?'color:#aaa;':null,
                // ));
        }
    }
Exemplo n.º 20
0
 /**
  * renders boolean fields in view layouts as icons, instead of as unchecked checkboxes.
  */
 protected function renderBoolean($field, $makeLinks, $textOnly, $encode)
 {
     $fieldName = $field->fieldName;
     $bool = $this->owner->{$fieldName};
     if ($textOnly) {
         $text = $bool ? Yii::t('app', 'Yes') : Yii::t('app', 'No');
         return $this->render($text, $encode);
     }
     $html = $bool ? X2Html::fa('check', array('class' => 'field-checked')) : X2Html::fa('times', array('class' => 'field-unchecked'));
     return $html;
 }
Exemplo n.º 21
0
    ?>
    <?php 
    echo Yii::t('admin', 'Please click the button below to begin the export. Do not close this page until the export is finished, which may take some time if you have a large number of records. A counter will keep you updated on how many records have been successfully updated.');
    ?>
<br><br>
    <?php 
    echo isset($listName) ? Yii::t('admin', 'You are currently exporting: ') . "<b>{$listName}</b>" : '';
    ?>
    </div>
    <br>
    <div class="exportOption">
        <?php 
    if (Yii::app()->params->isAdmin) {
        echo CHtml::label(Yii::t('admin', 'Include Hidden Records?'), 'includeHidden');
        echo CHtml::checkbox('includeHidden', false);
        echo X2Html::hint2(Yii::t('admin', 'Include records that were hidden by the duplicate checker.'));
    }
    ?>
    </div>

    <div class="exportOption">
        <?php 
    echo CHtml::label(Yii::t('admin', 'Include Tags?'), 'includeTags');
    echo CHtml::checkbox('includeTags', false);
    ?>
    </div>

    <?php 
    echo CHtml::button(Yii::t('app', 'Export'), array('class' => 'x2-button', 'id' => 'export-button'));
    ?>
Exemplo n.º 22
0
 /**
  * Generates a link to the view of the object.
  *
  * @return string a link to the model
  */
 public function getUrlLink($htmlOptions = array())
 {
     $name = $this->owner->hasAttribute('name') || $this->owner->canGetProperty('name') || property_exists($this->owner, 'name') ? $this->owner->name : '';
     if (trim($name) == '') {
         if ($this->owner->hasAttribute('fileName')) {
             // for media models
             $name = $this->owner->fileName;
         }
         if (trim($name) == '') {
             $name = $this->owner->hasAttribute('id') ? '#' . $this->owner->id : '';
         }
     }
     $url = $this->url;
     if ($this->owner instanceof Contacts) {
         return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, array_merge(array('class' => 'contact-name'), $htmlOptions));
     } else {
         return CHtml::link('<span>' . X2Html::encode($name) . '</span>', $url, $htmlOptions);
     }
 }
Exemplo n.º 23
0
                    <i class='fa fa-bars'></i>
                </div>
                <a href="<?php 
echo $isGuest ? $this->createUrl('/site/login') : $this->createUrl('/profile/view', array('id' => Yii::app()->user->getId()));
?>
"
                 id='search-bar-title' class='special'>
                <?php 
$custom = Yii::app()->params->logo !== 'uploads/protected/logos/yourlogohere.png';
if ($custom) {
    $media = Media::model()->findByAttributes(array('associationType' => 'logo'));
    if ($media) {
        echo CHtml::image($media->getPublicUrl(), Yii::app()->settings->appName, array('id' => 'your-logo', 'class' => 'custom-logo'));
    }
} else {
    echo X2Html::logo('menu', array('id' => 'your-logo', 'class' => 'default-logo'));
}
?>
                </a>
                <div id='top-menus-container'>
                <div id='top-menus-container-inner'>
                <?php 
//render main menu items
$this->widget('zii.widgets.CMenu', array('id' => 'main-menu', 'encodeLabel' => false, 'htmlOptions' => array('class' => 'main-menu'), 'items' => $menuItems));
//render user menu items if logged in
if (!$isGuest) {
    ?>
                    <div id='user-menus-container'>
                    <?php 
    $this->widget('zii.widgets.CMenu', array('id' => 'user-menu-2', 'items' => $userMenu2, 'htmlOptions' => array('class' => 'main-menu'), 'encodeLabel' => false));
    $this->widget('zii.widgets.CMenu', array('id' => 'user-menu', 'items' => $userMenu, 'htmlOptions' => array('class' => 'main-menu ' . ($isAdmin ? 'three-user-menu-links' : 'two-user-menu-links')), 'encodeLabel' => false));
Exemplo n.º 24
0
        <div class="buttons">
        <?php 
if (!Yii::app()->user->isGuest) {
    if (empty($data->type) || $data->type == 'weblead') {
        if ($data->complete == 'Yes' && Yii::app()->user->checkAccess('ActionsUncomplete', array('assignedTo' => $data->assignedTo))) {
            echo CHtml::link(X2Html::fa('fa-undo'), '#', array('class' => 'uncomplete-button', 'title' => Yii::t('app', 'uncomplete'), 'data-action-id' => $data->id));
        } elseif (Yii::app()->user->checkAccess('ActionsComplete', array('assignedTo' => $data->assignedTo))) {
            echo CHtml::link(X2Html::fa('fa-check-circle'), '#', array('class' => 'complete-button', 'title' => Yii::t('app', 'complete'), 'data-action-id' => $data->id));
        }
    }
    if ($data->type != 'workflow') {
        if (Yii::app()->user->checkAccess('ActionsUpdate', array('assignedTo' => $data->assignedTo))) {
            echo $data->type != 'attachment' && $data->type != 'email' ? ' ' . CHtml::link(X2Html::fa('fa-edit'), '#', array('class' => 'update-button', 'title' => Yii::t('app', 'edit'), 'data-action-id' => $data->id)) : '';
        }
        if (Yii::app()->user->checkAccess('ActionsDelete', array('assignedTo' => $data->assignedTo))) {
            echo ' ' . CHtml::link(X2Html::fa('fa-times'), '#', array('onclick' => 'deleteAction(' . $data->id . ', "' . $data->type . '"); return false', 'title' => Yii::t('app', 'delete')));
        }
    }
}
?>
        </div>
    </div>
    <div class="description">
<?php 
if ($type == 'attachment' && $data->completedBy != 'Email') {
    echo Media::attachmentActionText(Yii::app()->controller->convertUrls($data->actionDescription), true, true);
} else {
    if ($type == 'workflow') {
        if ($data->complete == 'Yes') {
            echo ' <b>' . Yii::t('workflow', 'Completed') . '</b> ' . Formatter::formatLongDateTime($data->completeDate);
        } else {
Exemplo n.º 25
0
    echo "<div id='inline-relationships-autocomplete-container'>";
    X2Model::renderModelAutocomplete('Contacts');
    echo CHtml::hiddenField('RelationshipModelId');
    echo "</div>";
    echo CHtml::textField('myName', $model->name, array('disabled' => 'disabled'));
    ?>
        <!-- <input type="hidden" id='RelationshipModelId' name="RelationshipModelId"> -->
    </div>

    <div class='row'>
        <?php 
    echo X2Html::label(Yii::t('app', 'Label:'), 'RelationshipLabelButton');
    echo X2Html::textField('secondLabel');
    echo X2Html::textField('firstLabel', '', array('title' => Yii::t('app', 'Create a different label for ') . $model->name));
    echo X2Html::hiddenField('mutual', 'true');
    echo X2Html::link('', '', array('id' => 'RelationshipLabelButton', 'class' => 'pseudo-link fa fa-long-arrow-right', 'title' => Yii::t('app', 'Create a different label for ') . $model->name));
    ?>
    </div>
    
    <?php 
    echo X2Html::csrfToken();
    echo CHtml::button(Yii::t('app', 'Create Relationship'), array('id' => 'add-relationship-button', 'class' => 'x2-button'));
    ?>
    
</form>

<?php 
}
?>

Exemplo n.º 26
0
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
?>
<div class='widget-error-summary'>
<?php 
if (count($errors) === 1) {
    ?>
<span class='widget-error-message'><?php 
    echo CHtml::encode($errors[0]);
    ?>
</span>
<?php 
} else {
    echo X2Html::unorderedList(X2Html::encodeArray($errors), array('style' => 'display: inline-block;'));
}
?>
</div>
Exemplo n.º 27
0
 /**
  * @param type $fieldName
  * @param type $htmlOptions
  */
 public function renderInput($fieldName, $htmlOptions = array())
 {
     switch ($fieldName) {
         case 'color':
             $field = $this->getField($fieldName);
             $options = Dropdowns::getItems($field->linkType, null, false);
             $enableDropdownLegend = Yii::app()->settings->enableColorDropdownLegend;
             if ($enableDropdownLegend) {
                 $htmlOptions['options'] = array();
                 foreach ($options as $value => $label) {
                     $brightness = X2Color::getColorBrightness($value);
                     $fontColor = $brightness > 127.5 ? 'black' : 'white';
                     $htmlOptions['options'][$value] = array('style' => 'background-color: ' . $value . ';
                              color: ' . $fontColor);
                 }
             }
             return CHtml::activeDropDownList($this, $field->fieldName, $options, $htmlOptions);
         case 'priority':
             return CHtml::activeDropdownList($this, 'priority', self::getPriorityLabels());
         case 'associationType':
             return X2Html::activeMultiTypeAutocomplete($this, 'associationType', 'associationId', array('calendar' => Yii::t('app', 'Select an option')) + X2Model::getAssociationTypeOptions());
         case 'reminder':
             $reminderInput = parent::renderInput($fieldName, array('class' => 'reminder-checkbox'));
             $reminderInput .= X2Html::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'reminder-config'))) . Yii::t('actions', 'Create a notification reminder for {user} {time} before this {action} ' . 'is due', array('{user}' => CHtml::activeDropDownList($this, 'notificationUsers', array('me' => Yii::t('actions', 'me'), 'assigned' => Yii::t('actions', 'the assigned user'), 'both' => Yii::t('actions', 'me and the assigned user'))), '{time}' => CHtml::activeDropDownList($this, 'notificationTime', array(1 => Yii::t('actions', '1 minute'), 5 => Yii::t('actions', '5 minutes'), 10 => Yii::t('actions', '10 minutes'), 15 => Yii::t('actions', '15 minutes'), 30 => Yii::t('actions', '30 minutes'), 60 => Yii::t('actions', '1 hour'), 1440 => Yii::t('actions', '1 day'), 10080 => Yii::t('actions', '1 week'))), '{action}' => lcfirst(Modules::displayName(false, 'Actions')))) . '</div>';
             return $reminderInput;
         default:
             return parent::renderInput($fieldName, $htmlOptions);
     }
 }
Exemplo n.º 28
0
 public function renderAttribute($fieldName, $makeLinks = true, $textOnly = true, $encode = true)
 {
     switch ($fieldName) {
         case 'image':
             $imageLink = $this->getImage(true);
             return '<div class="media-image">
                     <div class="full-size-screen">' . X2Html::fa('expand') . Yii::t('media', 'View Full Size') . '
                     </div>
                     ' . $imageLink . '
                 </div>';
             break;
     }
     return call_user_func_array('parent::' . __FUNCTION__, func_get_args());
 }
Exemplo n.º 29
0
 /**
  * @return string HTML string containing settings menu options
  */
 protected function getSettingsMenuContentEntries()
 {
     return ($this->relabelingEnabled ? '<li class="relabel-widget-button">' . X2Html::fa('fa-edit') . Yii::t('app', 'Rename Widget') . '</li>' : '') . ($this->canBeDeleted ? '<li class="delete-widget-button">' . X2Html::fa('fa-trash') . Yii::t('app', 'Delete Widget') . '</li>' : '');
 }
Exemplo n.º 30
0
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
echo X2Html::logo('mobile', array('id' => 'about-logo'));
?>
<div class='mobile-list-view'>
    <div class='list-view-section-title'><?php 
echo CHtml::encode(Yii::t('mobile', 'Version'));
?>
</div>
    <div class='mobile-list-view-item'>
    <?php 
echo CHtml::encode(Yii::app()->getEditionLabel(true) . ': ' . Yii::app()->params->version);
?>
    </div>
    <?php 
?>

    <div class='list-view-section-title'><?php