/** *### .init() * * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (isset($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } $validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED); if (!empty($this->type)) { foreach ($this->type as $type) { if (in_array($type, $validTypes)) { $classes[] = 'table-' . $type; } } } } if (!empty($classes)) { $classes = implode(' ', $classes); if (isset($this->htmlOptions['class'])) { $this->htmlOptions['class'] .= ' ' . $classes; } else { $this->htmlOptions['class'] = $classes; } } }
protected function renderItem($options, $templateData) { //apply editable if not set 'editable' params or set and not false $apply = !empty($options['name']) && (!isset($options['editable']) || $options['editable'] !== false); if ($apply) { //ensure $options['editable'] is array if (!isset($options['editable'])) { $options['editable'] = array(); } //take common url if not defined for particular item and not related model if (!isset($options['editable']['url']) && strpos($options['name'], '.') === false) { $options['editable']['url'] = $this->url; } //take common params if not defined for particular item if (!isset($options['editable']['params'])) { $options['editable']['params'] = $this->params; } $editableOptions = CMap::mergeArray($options['editable'], array('model' => $this->data, 'attribute' => $options['name'], 'emptytext' => $this->nullDisplay === null ? Yii::t('zii', 'Not set') : strip_tags($this->nullDisplay))); //if value in detailview options provided, set text directly (as value means text) if (isset($options['value']) && $options['value'] !== null) { $editableOptions['text'] = $templateData['{value}']; $editableOptions['encode'] = false; } $widget = $this->controller->createWidget('EditableField', $editableOptions); //'apply' can be changed during init of widget (e.g. if related model and unsafe attribute) if ($widget->apply) { ob_start(); $widget->run(); $templateData['{value}'] = ob_get_clean(); } } parent::renderItem($options, $templateData); }
protected function renderItem($options, $templateData) { //if editable set to false --> not editable $isEditable = array_key_exists('editable', $options) && $options['editable'] !== false; //if name not defined or it is not safe --> not editable $isEditable = !empty($options['name']) && $this->data->isAttributeSafe($options['name']); if ($isEditable) { //ensure $options['editable'] is array if (!array_key_exists('editable', $options) || !is_array($options['editable'])) { $options['editable'] = array(); } //take common url if (!array_key_exists('url', $options['editable'])) { $options['editable']['url'] = $this->url; } $editableOptions = CMap::mergeArray($options['editable'], array('model' => $this->data, 'attribute' => $options['name'], 'emptytext' => $this->nullDisplay === null ? Yii::t('zii', 'Not set') : strip_tags($this->nullDisplay))); //if value in detailview options provided, set text directly if (array_key_exists('value', $options) && $options['value'] !== null) { $editableOptions['text'] = $templateData['{value}']; $editableOptions['encode'] = false; } $templateData['{value}'] = $this->controller->widget('EditableField', $editableOptions, true); } parent::renderItem($options, $templateData); }
/** * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (isset($this->type) && !empty($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } } $this->addCssClass(implode(' ', $classes)); }
/** * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (!empty($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } foreach ($this->type as $type) { $classes[] = 'table-' . $type; } } TbHtml::addCssClass($classes, $this->htmlOptions); }
/** * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (isset($this->type) && !empty($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } foreach ($this->type as $type) { $classes[] = 'table-' . $type; } } $this->htmlOptions = TbHtml::addClassName(implode(' ', $classes), $this->htmlOptions); }
/** * Init the widget */ public function init() { parent::init(); $classes = array('table'); if ($this->bordered) { $classes[] = 'table-bordered'; } if ($this->striped) { $classes[] = 'table-striped'; } if ($this->condensed) { $classes[] = 'table-condensed'; } EBootstrap::mergeClass($this->htmlOptions, $classes); }
public function init() { parent::init(); Yii::app()->clientScript->registerCss($this->id . 'fix_detail_view', ' #' . $this->id . ' .profile-info-name {width: ' . $this->label_width . 'px;} #' . $this->id . ' .profile-info-value {margin-left: ' . $this->label_width . 'px;min-height: 20px;} '); foreach ($this->attributes as $k => $attribute) { if (!isset($attribute['external_link'])) { continue; } if (empty($attribute['value_id'])) { continue; } $this->attributes[$k]['value'] .= ' ' . CHtml::link('<i class="icon-external-link"></i>', $attribute['external_link'], array('target' => '_blank', 'title' => $attribute['external_title'], 'data-toggle' => 'tooltip')); } }
/** * Initializes the widget. */ public function init() { parent::init(); $classes = array('table'); if (isset($this->type) && !empty($this->type)) { if (is_string($this->type)) { $this->type = explode(' ', $this->type); } $validTypes = array(TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_CONDENSED, TbHtml::GRID_TYPE_STRIPED, TbHtml::GRID_TYPE_HOVER); foreach ($this->type as $type) { if (in_array($type, $validTypes)) { $classes[] = 'table-' . $type; } } } $this->htmlOptions = TbHtml::addClassName(implode(' ', $classes), $this->htmlOptions); }
/** * Initializes the widget. */ public function init() { // Don't let Yii include its default stylesheet if ($this->cssFile === null) { $this->cssFile = false; } parent::init(); if (is_string($this->type)) { $types = explode(' ', $this->type); } else { $types = $this->type; } $validTypes = array(TbHtml::DETAIL_TYPE_BORDERED, TbHtml::DETAIL_TYPE_CONDENSED, TbHtml::DETAIL_TYPE_HOVER, TbHtml::DETAIL_TYPE_STRIPED); // Set class names foreach ($types as $type) { if (in_array($type, $validTypes)) { $this->htmlOptions = TbHtml::addClassName('table-' . $type, $this->htmlOptions); } } $this->htmlOptions = TbHtml::addClassName('table', $this->htmlOptions); }
public function init() { $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('application.widgets._base.assets.detailview'), false, -1, YII_DEBUG); $this->cssFile = $this->baseScriptUrl . '/detailview.css'; parent::init(); }
/** * (non-PHPdoc) * @see CComponent::__isset() */ public function __isset($name) { return array_key_exists($name, $this->_data) || parent::__isset($name); }
public function run() { return parent::run(); }
/** * Initializes the detail view. * This method will initialize required property values. */ public function init() { //$this->_aryColumns = array_fill(1, $this->ItemColumns, $this->itemTemplate); $this->_init(); return parent::init(); }
public function init() { $this->htmlOptions = array_merge($this->htmlOptions, array('class' => 'ui-widget ui-widget-content detail-view')); $this->baseScriptUrl = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets/detailviewui'); parent::init(); }
/** * Init the widget */ public function init() { parent::init(); EBootstrap::mergeClass($this->htmlOptions, array('bootstrap-list-view-item')); }