Esempio n. 1
0
 /**
  * Renders the filter cell content. Here we can provide HTML options for actual filter input
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         echo $this->filter;
     } else {
         if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
             if ($this->filterInputOptions) {
                 $filterInputOptions = $this->filterInputOptions;
                 if (empty($filterInputOptions['id'])) {
                     $filterInputOptions['id'] = false;
                 }
             } else {
                 $filterInputOptions = array();
             }
             if (is_array($this->filter)) {
                 $filterInputOptions['prompt'] = '';
                 echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
             } else {
                 if ($this->filter === null) {
                     echo CHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
                 }
             }
         } else {
             parent::renderFilterCellContent();
         }
     }
 }
Esempio n. 2
0
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         echo $this->filter;
     } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
         if (is_array($this->filter)) {
             echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => ''));
         } elseif ($this->filter === null) {
             echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false, 'accesskey' => $this->accesskey));
         }
         // 'placeholder' => '[Alt]+['.$this->accesskey.']'));
     } else {
         parent::renderFilterCellContent();
     }
 }
Esempio n. 3
0
 public function renderFilterCellContent()
 {
     if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && is_int(strpos($this->name, '.'))) {
         if (isset($this->filter['type'])) {
             $type = $this->filter['type'];
             unset($this->filter['type']);
             $attributes = $this->filter;
             //                              $attributes['model']=$this->getParent()->getModel();
             //                              $attributes['attribute']=$this->name;
             ob_start();
             $this->grid->owner->widget($type, $attributes);
             echo ob_get_clean();
         }
         //                      else
         //                              echo $this->filter;
     } else {
         parent::renderFilterCellContent();
     }
 }
Esempio n. 4
0
 /**
  * Renders the filter cell content.
  * This method will render the {@link filter} as is if it is a string.
  * If {@link filter} is an array, it is assumed to be a list of options, and a dropdown selector will be rendered.
  * Otherwise if {@link filter} is not false, a text field is rendered.
  * @since 1.1.1
  * This method is Copyright (c) 2008-2014 by Yii Software LLC
  * http://www.yiiframework.com/license/ 
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         echo $this->filter;
     } elseif ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
         /* x2modstart */
         if (isset($this->filterType)) {
             echo $this->renderFilterCellByType();
             /* x2modend */
         } elseif (is_array($this->filter)) {
             /* x2modstart */
             // removed prompt
             echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false));
             /* x2modend */
         } elseif ($this->filter === null) {
             echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false));
         }
     } else {
         parent::renderFilterCellContent();
     }
 }
Esempio n. 5
0
 /**
  * Renders the filter cell content.
  * This method will render the {@link filter} as is if it is a string.
  * If {@link filter} is an array, it is assumed to be a list of options, and a dropdown selector will be rendered.
  * Otherwise if {@link filter} is not false, a text field is rendered.
  * @since 1.1.1
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         echo $this->filter;
     } else {
         if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
             if (is_array($this->filter)) {
                 echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, array('id' => false, 'prompt' => ''));
             } else {
                 if ($this->filter === null) {
                     echo CHtml::activeTextField($this->grid->filter, $this->name, array('id' => false));
                 }
             }
         } else {
             if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strstr($this->name, '.') != false) {
                 $relation = explode('.', $this->name);
                 echo $this->grid->widget('Relation', array('model' => $this->grid->filter, 'relation' => $relation[0], 'fields' => $relation[1], 'hideAddButton' => true), true);
             } else {
                 parent::renderFilterCellContent();
             }
         }
     }
 }
Esempio n. 6
0
 public function renderFilterCellContent()
 {
     switch ($this->fieldType) {
         case 'boolean':
             echo CHtml::activeDropdownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', '1' => Yii::t('app', 'Yes'), 'false' => Yii::t('app', "No")), array('class' => 'x2-minimal-select-filtercol'));
             break;
         case 'dropdown':
             $dropdown = Dropdowns::model()->findByPk($this->fieldModel['linkType']);
             if ($dropdown instanceof Dropdowns) {
                 $options = json_decode($dropdown->options, 1);
                 if (!$dropdown->multi) {
                     $defaultOption = array('' => '- ' . Yii::t('app', 'Select') . ' -');
                     $options = is_array($options) ? array_merge($defaultOption, $options) : $defaultOption;
                 }
                 //$selected = isset($options[$this->grid->filter->{$this->name}]) ?
                 //$this->grid->filter->{$this->name} : '';
                 echo CHtml::activeDropdownList($this->grid->filter, $this->name, $options, array('class' => 'x2-minimal-select-filtercol' . ($dropdown->multi ? ' x2-multiselect-dropdown x2-datacolumn-multiselect' : ''), 'multiple' => $dropdown->multi ? 'multiple' : '', 'data-selected-text' => $dropdown->multi ? 'option(s)' : ''));
             } else {
                 parent::renderFilterCellContent();
             }
             break;
         case 'visibility':
             echo CHtml::activeDropDownList($this->grid->filter, $this->name, array('' => '- ' . Yii::t('app', 'Select') . ' -', 1 => Yii::t('app', 'Public'), 0 => Yii::t('app', 'Private'), 2 => Yii::t('app', 'User\'s Groups')), array('class' => 'x2-minimal-select-filtercol'));
             break;
         case 'dateTime':
         case 'date':
             Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
             $that = $this;
             $renderWidget = function () use($that) {
                 echo Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $that->grid->filter, 'attribute' => $that->name, 'mode' => 'date', 'options' => array('dateFormat' => Formatter::formatDatePicker('medium')), 'htmlOptions' => array('id' => 'datePicker' . $that->name, 'class' => 'datePicker x2-gridview-filter-datepicker'), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
             };
             if ($this->grid->ajax) {
                 X2Widget::ajaxRender($renderWidget);
             } else {
                 $renderWidget();
             }
             break;
         default:
             parent::renderFilterCellContent();
     }
 }