当前位置: 首页>>代码示例>>PHP>>正文


PHP TbHtml::addClassName方法代码示例

本文整理汇总了PHP中TbHtml::addClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml::addClassName方法的具体用法?PHP TbHtml::addClassName怎么用?PHP TbHtml::addClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TbHtml的用法示例。


在下文中一共展示了TbHtml::addClassName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * Initializes the widget
  */
 public function init()
 {
     parent::init();
     if (isset($this->itemsCssClass)) {
         $this->htmlOptions = TbHtml::addClassName($this->itemsCssClass, $this->htmlOptions);
     }
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:10,代码来源:TbThumbnails.php

示例2: init

 /**
  * 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);
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:17,代码来源:TbDetailView.php

示例3: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     $route = $this->controller->getRoute();
     if ($this->stacked) {
         $this->htmlOptions = TbHtml::addClassName('nav-stacked', $this->htmlOptions);
     }
     if (isset($this->scrollspy)) {
         if (is_string($this->scrollspy)) {
             $this->scrollspy = array('target' => $this->scrollspy);
         }
         $this->widget('bootstrap.widgets.TbScrollspy', $this->scrollspy);
     }
     $this->items = $this->normalizeItems($this->items, $route, $hasActiveChild);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:18,代码来源:TbNav.php

示例4: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     $this->htmlOptions = TbHtml::addClassName('collapse', $this->htmlOptions);
     $this->htmlOptions['data-toggle'] = 'collapse';
     if (isset($this->parent)) {
         $this->htmlOptions = TbHtml::defaultOption('data-parent', $this->parent, $this->htmlOptions);
     }
     if (isset($this->toggle) && $this->toggle) {
         $this->htmlOptions = TbHtml::addClassName('in', $this->htmlOptions);
     }
     $controller = $this->getController();
     if (isset($controller) && $controller->getViewFile($this->content) !== false) {
         $this->content = $this->controller->renderPartial($this->content, $this->viewData, true);
     }
     echo CHtml::tag($this->tagName, $this->htmlOptions, $this->content);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:20,代码来源:TbCollapse.php

示例5: init

 /**
  * 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);
 }
开发者ID:crisu83,项目名称:yiiwheels,代码行数:20,代码来源:WhDetailView.php

示例6: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->copyId();
     $this->htmlOptions = TbHtml::addClassName('collapse', $this->htmlOptions);
     if (isset($this->parent)) {
         $this->htmlOptions = TbHtml::defaultOption('data-parent', $this->parent, $this->htmlOptions);
     }
     if (isset($this->toggle) && $this->toggle) {
         $this->htmlOptions = TbHtml::addClassName('in', $this->htmlOptions);
     }
     if (isset($this->view)) {
         $controller = $this->getController();
         if (isset($controller) && $controller->getViewFile($this->view) !== false) {
             $this->content = $this->controller->renderPartial($this->view, $this->viewData, true);
         }
     }
     echo TbHtml::openTag($this->tagName, $this->htmlOptions);
     echo $this->content;
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:23,代码来源:TbCollapse.php

示例7: init

 /**
  * 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);
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:24,代码来源:TbDetailView.php

示例8: init

 /**
  * Widget's initialization method
  */
 public function init()
 {
     $this->attachBehavior('TbWidget', new TbWidget());
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     $this->htmlOptions = TbHtml::defaultOption('role', 'dialog', $this->htmlOptions);
     $this->htmlOptions = TbHtml::defaultOption('tabindex', '-1', $this->htmlOptions);
     $this->htmlOptions = TbHtml::addClassName('modal hide', $this->htmlOptions);
     if ($this->fade) {
         $this->htmlOptions = TbHtml::addClassName('fade', $this->htmlOptions);
     }
     if (is_array($this->footer)) {
         $this->footer = implode(' ', $this->footer);
     }
     $this->initOptions();
     $this->initEvents();
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:19,代码来源:TbModal.php

示例9: normalizeTabs

 /**
  * Normalizes the tab configuration.
  * @param array $tabs the tab configuration
  * @param array $panes a reference to the panes array
  * @param integer $i the current index
  * @return array the items
  */
 protected function normalizeTabs($tabs, &$panes, &$i = 0)
 {
     $id = TbHtml::getOption('id', $this->htmlOptions, $this->getId());
     $items = array();
     //Check if has an active item
     $hasActiveItem = false;
     foreach ($tabs as $tab) {
         if ($hasActiveItem = TbHtml::getOption('active', $tab, false) === true) {
             break;
         }
     }
     foreach ($tabs as $tab) {
         $item = $tab;
         if (isset($item['visible']) && $item['visible'] === false) {
             continue;
         }
         // if no tab should be active, activate first
         if (!$hasActiveItem && $i == 0) {
             $item['active'] = true;
         }
         // set the label to the title if any
         if (isset($item['title'])) {
             $item['label'] = TbHtml::defaultOption('label', TbHtml::popOption('title', $item), $item);
         }
         $item = TbHtml::defaultOption('itemOptions', array(), $item);
         if (isset($tab['items'])) {
             $item['linkOptions']['data-toggle'] = 'dropdown';
             $item['items'] = $this->normalizeTabs($item['items'], $panes, $i);
         } else {
             $item['linkOptions']['data-toggle'] = 'tab';
             $item = TbHtml::defaultOption('id', $id . '_tab_' . ($i + 1), $item);
             $item['url'] = '#' . $item['id'];
             // no content and we have a view?
             if (!isset($item['content']) && isset($item['view'])) {
                 $view = TbHtml::popOption('view', $item, '');
                 $data = TbHtml::popOption('data', $item, array());
                 if (is_array($this->viewData)) {
                     $data = TbHtml::mergeOptions($this->viewData, $data);
                 }
                 $process = TbHtml::popOption('processOutput', $item, false);
                 $item['content'] = !empty($view) ? $this->getController()->renderPartial($view, $data, true, $process) : '';
             }
             $content = TbHtml::popOption('content', $item, '');
             $paneOptions = TbHtml::popOption('paneOptions', $item, array());
             $paneOptions['id'] = TbHtml::popOption('id', $item);
             $classes = array('tab-pane fade');
             if (isset($item['active']) && $item['active']) {
                 $classes[] = 'active in';
             }
             $paneOptions = TbHtml::addClassName(implode(' ', $classes), $paneOptions);
             $panes[] = CHtml::tag('div', $paneOptions, $content);
             $i++;
             // increment the tab-index
         }
         $items[] = $item;
     }
     return $items;
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:65,代码来源:TbTabs.php

示例10: errorSummary

 /**
  * Displays a summary of validation errors for one or several models.
  * @param mixed $model the models whose input errors are to be displayed. This can be either
  * a single model or an array of models.
  * @param string $header a piece of HTML code that appears in front of the errors
  * @param string $footer a piece of HTML code that appears at the end of the errors
  * @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
  * A special option named 'firstError' is recognized, which when set true, will
  * make the error summary to show only the first error message of each attribute.
  * If this is not set or is false, all error messages will be displayed.
  * This option has been available since version 1.1.3.
  * @return string the error summary. Empty if no errors are found.
  * @see CModel::getErrors
  * @see errorSummaryCss
  */
 public static function errorSummary($model, $header = null, $footer = null, $htmlOptions = array())
 {
     $htmlOptions = TbHtml::addClassName('alert alert-block alert-error', $htmlOptions);
     return CHtml::errorSummary($model, $header, $footer, $htmlOptions);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:20,代码来源:TbHtml.php

示例11: errorSummary

 /**
  * Displays a summary of validation errors for one or several models.
  * @param mixed $models the models whose input errors are to be displayed.
  * @param string $header a piece of HTML code that appears in front of the errors
  * @param string $footer a piece of HTML code that appears at the end of the errors
  * @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
  * @return string the error summary. Empty if no errors are found.
  */
 public function errorSummary($models, $header = null, $footer = null, $htmlOptions = array())
 {
     if (!$this->enableAjaxValidation && !$this->enableClientValidation) {
         return TbHtml::errorSummary($models, $header, $footer, $htmlOptions);
     }
     $htmlOptions = TbHtml::defaultOption('id', $this->id . '_es_', $htmlOptions);
     $html = TbHtml::errorSummary($models, $header, $footer, $htmlOptions);
     if ($html === '') {
         if ($header === null) {
             $header = '<p>' . Yii::t('yii', 'Please fix the following input errors:') . '</p>';
         }
         $htmlOptions = TbHtml::addClassName(TbHtml::$errorSummaryCss, $htmlOptions);
         $htmlOptions = TbHtml::addStyles('display:none', $htmlOptions);
         $html = CHtml::tag('div', $htmlOptions, $header . '<ul><li>dummy</li></ul>' . $footer);
     }
     $this->summaryID = $htmlOptions['id'];
     return $html;
 }
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:26,代码来源:TbActiveForm.php

示例12: row

 /**
  * Helper method to display different input types for the different complain bootstrap forms wrapped with their
  * labels, help and error messages. This method is a replacement of the old 'typeRow' methods from Yii-Bootstrap
  * extension. Example:
  * <pre>
  * 	$form->row(TbHtml::INPUT_TEXT, $model, 'attribute', array('style'=>'width:125px'));
  *	$form->row(TbHtml::INPUT_DROPDOWN, $model, 'attribute', array('a'=>'A','b'=>'B'), array());
  * </pre>
  * @param $type
  * @param $model
  * @param $attribute
  * @param $data
  * @param array $htmlOptions
  * @return string
  * @throws CException
  */
 public function row($type, $model, $attribute, $data = array(), $htmlOptions = array())
 {
     if (!in_array($type, TbHtml::$inputs)) {
         throw new CException(Yii::t('tb', 'Unrecognized input type'));
     }
     $labelOptions = TbHtml::popOption('labelOptions', $htmlOptions, array());
     $errorOptions = TbHtml::popOption('errorOptions', $htmlOptions, array());
     $containerOptions = TbHtml::popOption('containerOptions', $htmlOptions, array());
     $labelOptions = TbHtml::defaultOption('formType', $this->type, $labelOptions);
     ob_start();
     // make sure it holds the class control-label
     if ($this->type === TbHtml::FORM_HORIZONTAL) {
         echo CHtml::openTag('div', TbHtml::addClassName('control-group', $containerOptions));
     }
     // form's inline do not render labels and radio|checkbox input types render label's differently
     if ($this->type !== TbHtml::FORM_INLINE && !preg_match('/radio|checkbox/i', $type) && TbHtml::popOption('label', $htmlOptions, true)) {
         echo TbHtml::activeLabel($model, $attribute, $labelOptions);
     } elseif (preg_match('/radio|checkbox/i', $type)) {
         $htmlOptions['labelOptions'] = $labelOptions;
     }
     if (TbHtml::popOption('block', $htmlOptions, false)) {
         $htmlOptions = TbHtml::addClassName('input-block-level', $htmlOptions);
     }
     $params = in_array($type, TbHtml::$dataInputs) ? array($model, $attribute, $data, $htmlOptions) : array($model, $attribute, $htmlOptions);
     $errorSpan = $this->error($model, $attribute, $errorOptions);
     echo $this->wrapControl(call_user_func_array('TbHtml::active' . ucfirst($type), $params), $errorSpan);
     /* since PHP 5.3 */
     if ($this->type === TbHtml::FORM_VERTICAL && TbHtml::popOption('error', $htmlOptions, true)) {
         echo $errorSpan;
     }
     if ($this->type == TbHtml::FORM_HORIZONTAL) {
         echo '</div>';
     }
     return ob_get_clean();
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:51,代码来源:TbActiveForm.php

示例13: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
     ob_start();
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             $widgetClassName = TbHtml::popOption('class', $item);
             if ($widgetClassName !== null) {
                 $this->controller->widget($widgetClassName, $item);
             }
         }
     }
     $items = ob_get_clean();
     ob_start();
     if ($this->collapse !== false) {
         $this->collapseOptions = TbHtml::addClassName('nav-collapse', $this->collapseOptions);
         // todo: fix collapse, currently it cannot be clicked when within a navbar
         ob_start();
         /* @var TbCollapse $collapseWidget */
         $collapseWidget = $this->controller->widget('bootstrap.widgets.TbCollapse', array('toggle' => false, 'content' => $items, 'htmlOptions' => $this->collapseOptions));
         $collapseContent = ob_get_clean();
         echo TbHtml::collapseIcon('#' . $collapseWidget->getId());
         echo $brand . $collapseContent;
     } else {
         echo $brand . $items;
     }
     $containerContent = ob_get_clean();
     $containerOptions = TbHtml::popOption('containerOptions', $this->htmlOptions, array());
     $containerOptions = TbHtml::addClassName($this->fluid ? 'container-fluid' : 'container', $containerOptions);
     ob_start();
     echo TbHtml::openTag('div', $containerOptions);
     echo $containerContent;
     echo '</div>';
     $content = ob_get_clean();
     echo TbHtml::navbar($content, $this->htmlOptions);
 }
开发者ID:jackycgq,项目名称:advanced,代码行数:41,代码来源:TbNavbar.php

示例14: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $brand = $this->brandLabel !== false ? TbHtml::navbarBrandLink($this->brandLabel, $this->brandUrl, $this->brandOptions) : '';
     ob_start();
     foreach ($this->items as $item) {
         if (is_string($item)) {
             echo $item;
         } else {
             $widgetClassName = TbHtml::popOption('class', $item);
             if ($widgetClassName !== null) {
                 $this->controller->widget($widgetClassName, $item);
             }
         }
     }
     $items = ob_get_clean();
     ob_start();
     echo CHtml::openTag('div', array('class' => $this->fluid ? 'container-fluid' : 'container'));
     if ($this->collapse !== false) {
         $collapseId = TbHtml::getNextId();
         $this->collapseOptions = TbHtml::addClassName('nav-collapse', $this->collapseOptions);
         echo TbHtml::collapseIcon('#' . $collapseId) . PHP_EOL;
         echo $brand . PHP_EOL;
         $this->controller->beginWidget('bootstrap.widgets.TbCollapse', array('id' => $collapseId, 'toggle' => false, 'htmlOptions' => $this->collapseOptions));
         echo $items;
         $this->controller->endWidget();
     } else {
         echo $brand . PHP_EOL;
         echo $items . PHP_EOL;
     }
     echo '</div>';
     $content = ob_get_clean();
     echo TbHtml::navbar($content, $this->htmlOptions);
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:36,代码来源:TbNavbar.php

示例15: init

 /**
  * Widget's initialization method
  */
 public function init()
 {
     $this->htmlOptions = TbHtml::defaultOption('id', $this->getId(), $this->htmlOptions);
     $this->htmlOptions = TbHtml::defaultOption('role', 'dialog', $this->htmlOptions);
     $this->htmlOptions = TbHtml::defaultOption('tabindex', '-1', $this->htmlOptions);
     $this->htmlOptions = TbHtml::addClassName('modal hide', $this->htmlOptions);
     if ($this->fade) {
         $this->htmlOptions = TbHtml::addClassName('fade', $this->htmlOptions);
     }
     $this->initOptions();
     $this->initEvents();
 }
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:15,代码来源:TbModal.php


注:本文中的TbHtml::addClassName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。