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


PHP CHtml::openTag方法代码示例

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


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

示例1: renderTableRow

 public function renderTableRow($row)
 {
     $data = $this->dataProvider->data[$row];
     $value = CHtml::value($data, $this->rankKey);
     $this->count++;
     if ($this->lastRankValue != $value) {
         $this->lastRankValue = $value;
         $this->lastRank = $this->rank;
         $this->rank = $this->count;
     }
     $htmlOptions = array();
     if ($this->rowHtmlOptionsExpression !== null) {
         $options = $this->evaluateExpression($this->rowHtmlOptionsExpression, array('row' => $row, 'data' => $data, 'rank' => $this->rank));
         if (is_array($options)) {
             $htmlOptions = $options;
         }
     }
     if ($this->rowCssClassExpression !== null) {
         $class = $this->evaluateExpression($this->rowCssClassExpression, array('row' => $row, 'data' => $data, 'rank' => $this->rank));
     } elseif (is_array($this->rowCssClass) && ($n = count($this->rowCssClass)) > 0) {
         $class = $this->rowCssClass[$row % $n];
     }
     if (!empty($class)) {
         if (isset($htmlOptions['class'])) {
             $htmlOptions['class'] .= ' ' . $class;
         } else {
             $htmlOptions['class'] = $class;
         }
     }
     echo CHtml::openTag('tr', $htmlOptions) . "\n";
     foreach ($this->columns as $column) {
         $column->renderDataCell($row);
     }
     echo "</tr>\n";
 }
开发者ID:Baiqiang,项目名称:fewestmov.es,代码行数:35,代码来源:RankGridView.php

示例2: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     parent::init();
     $this->initOptions();
     echo \CHtml::openTag('div', $this->options) . "\n";
     echo $this->renderBodyBegin() . "\n";
 }
开发者ID:abudayah,项目名称:yiiwheels-custom,代码行数:10,代码来源:Alert.php

示例3: run

 /**
  * Run this widget.
  * This method registers necessary javascript and renders the needed HTML code.
  */
 public function run()
 {
     $themeURL = Yii::app()->theme->getBaseUrl();
     Yii::app()->clientScript->registerScript('logos', "\n\t\t\$(window).load(function(){\n\t\t\tif((!\$('#main-menu-icon').length) || (!\$('#x2touch-logo').length) || (!\$('#x2crm-logo').length)){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t\tvar touchlogosrc = \$('#x2touch-logo').attr('src');\n\t\t\tvar logosrc=\$('#x2crm-logo').attr('src');\n\t\t\tif(logosrc!='{$themeURL}/images/x2footer.png'|| touchlogosrc!='{$themeURL}/images/x2touch.png'){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t});    \n\t\t");
     Yii::app()->clientScript->registerScript('toggleWidgetState', "\n\t\t\tfunction toggleWidgetState(widget,state) {\n\t\t\t\t\$.ajax({\n\t\t\t\t\turl: '" . CHtml::normalizeUrl(array('/site/widgetState')) . "',\n\t\t\t\t\ttype: 'GET',\n\t\t\t\t\tdata: 'widget='+widget+'&state='+state,\n\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\tif(response=='success') {\n\t\t\t\t\t\t\tvar link = \$('#widget_'+widget+' .portlet-minimize a');\n\t\t\t\t\t\t\tvar newLink = (link.html()=='[+]')? '[&ndash;]' : '[+]';\t\t\t// toggle link between [+] and [-]\n\t\t\t\t\t\t\tlink.html(newLink);\n\t\t\t\t\t\t\t\$('#widget_'+widget+' .portlet-content').toggle('blind',{},200);\t// slide widget open or closed\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t", CClientScript::POS_HEAD);
     $id = $this->getId();
     //get generated id
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $this->htmlOptions['id'] = $id;
     }
     $options = empty($this->jQueryOptions) ? '' : CJavaScript::encode($this->jQueryOptions);
     Yii::app()->getClientScript()->registerScript('SortableWidgets' . '#' . $id, "jQuery('#{$id}').sortable({$options});");
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $hideWidgetJs = '';
     foreach ($this->portlets as $class => $properties) {
         $visible = $properties['visibility'] == '1';
         if (!$visible) {
             $hideWidgetJs .= "\$('#widget_" . $class . " .portlet-content').hide();\n";
         }
         $minimizeLink = CHtml::link($visible ? '[&ndash;]' : '[+]', '#', array('onclick' => "toggleWidgetState('{$class}'," . ($visible ? 0 : 1) . "); return false;"));
         // $t0 = microtime(true);
         $this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('app', Yii::app()->params->registeredWidgets[$class]) . '<div class="portlet-minimize">' . $minimizeLink . '</div>', 'id' => $properties['id']));
         $this->widget($class);
         $this->endWidget();
         // echo (round(microtime(true)-$t0,3)*1000).'ms';
     }
     Yii::app()->clientScript->registerScript('setWidgetState', "\n\t\t\t\$(document).ready(function() {\n\t\t\t\t" . $hideWidgetJs . "\n\t\t\t});", CClientScript::POS_HEAD);
     echo CHtml::closeTag($this->tagName);
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:35,代码来源:SortableWidgets.php

示例4: renderItems

 /**
  * Renders the data item list.
  */
 public function renderItems()
 {
     echo CHtml::openTag('table', array('class' => 'po-table mind-list')) . "\n";
     echo CHtml::openTag('thead') . "\n";
     echo CHtml::tag('th', array('width' => 20), '&nbsp;') . "\n";
     echo CHtml::tag('th', array(), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 30), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 100), '&nbsp;') . "\n";
     echo CHtml::tag('th', array('width' => 150), '<span class="mind-list__clear-all">удалить все</span>') . "\n";
     echo CHtml::closeTag('thead');
     echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
     $data = $this->dataProvider->getData();
     if (($n = count($data)) > 0) {
         $owner = $this->getOwner();
         $viewFile = $owner->getViewFile($this->itemView);
         $j = 0;
         foreach ($data as $i => $item) {
             $data = $this->viewData;
             $data['index'] = $i;
             $data['data'] = $item;
             $data['widget'] = $this;
             $owner->renderFile($viewFile, $data);
             if ($j++ < $n - 1) {
                 echo $this->separator;
             }
         }
     }
     echo CHtml::closeTag($this->itemsTagName);
     echo CHtml::closeTag('table');
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:33,代码来源:ListView.php

示例5: run

 /**
  * ### .run()
  *
  * Runs the widget.
  */
 public function run()
 {
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     $id = !empty($this->htmlOptions['id']) ? $this->htmlOptions['id'] : $this->getId();
     $elementId = !empty($this->options['elementId']) ? $this->options['elementId'] : 'null';
     $elementUrl = !empty($this->options['elementUrl']) ? $this->options['elementUrl'] : 'null';
     echo CHtml::openTag('div', $this->htmlOptions);
     echo CHtml::openTag('table');
     echo '<thead><tr class="head"><th id="prev" style="visibility: visible;"><i class="icon-arrow-left"></i></th><th colspan="5" class="switch" style="text-align:center;">' . date("Y") . "年" . date("n") . "月" . '</th><th id="next" style="visibility: visible;"><i class="icon-arrow-right-2"></i></th></thead>';
     echo '<tbody></tbody>';
     echo CHtml::closeTag('table');
     echo CHtml::closeTag('div');
     ob_start();
     Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
     if (isset($_GET['date'])) {
         $year = date("Y", strtotime($_GET['date']));
         $month = date("n", strtotime($_GET['date']));
         $day = date("j", strtotime($_GET['date']));
     } else {
         $year = date("Y");
         $month = date("n");
         $day = date("j");
     }
     $this->registerJs($id, $year, $month, $day, $elementId, $elementUrl);
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:30,代码来源:TCalendar.php

示例6: run

 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     if ($this->homeLink === null) {
         $links[] = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->homeLink;
         }
     }
     $i = 1;
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             if (count($this->links) == $i) {
                 $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url, array('class' => $this->lastCssClass));
             } else {
                 $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
             }
         } else {
             if (count($this->links) == $i) {
                 $links[] = '<span class="' . $this->lastCssClass . '">' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
             } else {
                 $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
             }
         }
         $i++;
     }
     echo implode($this->separator, $links);
     echo CHtml::closeTag($this->tagName);
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:34,代码来源:DBreadcrumbs.php

示例7: run

 /**
  * ### .
  * run()
  *
  * Renders the content of the widget.
  */
 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions);
     if ($this->homeLink === null) {
         $this->homeLink = CHtml::link(Yii::t('zii', 'Home'), Yii::app()->homeUrl);
     }
     if ($this->homeLink !== false) {
         // check whether home link is not a link
         $active = stripos($this->homeLink, '<a') === false ? ' class="active"' : '';
         echo '<li' . $active . '>' . $this->homeLink . '</li>';
     }
     end($this->links);
     $lastLink = key($this->links);
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             echo '<li>';
             echo strtr($this->activeLinkTemplate, array('{url}' => CHtml::normalizeUrl($url), '{label}' => $this->encodeLabel ? CHtml::encode($label) : $label));
         } else {
             echo '<li class="active">';
             echo str_replace('{label}', $this->encodeLabel ? CHtml::encode($url) : $url, $this->inactiveLinkTemplate);
         }
         echo '</li>';
     }
     echo CHtml::closeTag($this->tagName);
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:34,代码来源:TbBreadcrumbs.php

示例8: run

 public function run()
 {
     $moduleModel = SiteModule::model()->findByPk(4);
     if (!empty($moduleModel)) {
         $root = CatalogRubrics::getRoot();
         $categories = $root->descendants()->findAll($root->id);
         $tree = '';
         $level = 0;
         foreach ($categories as $n => $category) {
             if ($category->status == 1) {
                 if ($category->level == $level) {
                     $tree .= CHtml::closeTag('li') . "\r\n";
                 } else {
                     if ($category->level > $level) {
                         $tree .= CHtml::openTag('ul') . "\r\n";
                     } else {
                         $tree .= CHtml::closeTag('li') . "\r\n";
                         for ($i = $level - $category->level; $i; $i--) {
                             $tree .= CHtml::closeTag('ul') . "\r\n";
                             $tree .= CHtml::closeTag('li') . "\r\n";
                         }
                     }
                 }
                 $tree .= CHtml::openTag('li');
                 $tree .= CHtml::link($category->name, Yii::app()->urlManager->createUrl($moduleModel->url_to_controller . '/element', array('param' => $category->url)));
                 $level = $category->level;
             }
         }
         $tree .= CHtml::closeTag('li') . "\r\n";
         $tree .= CHtml::closeTag('ul') . "\r\n";
         $data['tree'] = $tree;
         $this->render('view_Categories', $data);
     }
 }
开发者ID:Diakonrus,项目名称:fastweb-yii,代码行数:34,代码来源:Categories.php

示例9: run

 /**
  * Renders the widget. If there are no items, nothing will be rendered.
  * TODO: Reuse TbCollapse somehow
  */
 public function run()
 {
     $itemCount = count($this->items);
     if ($itemCount === 0) {
         return;
     }
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->items as $k => $item) {
         $id = __CLASS__ . '_' . $this->id . '_' . $k;
         $contentId = $id . '_content';
         $linkOptions = array('class' => 'accordion-toggle episode-toggle', 'data-content-id' => $contentId, 'data-toggle' => 'collapse', 'data-parent' => $this->id);
         // Add content-url data attributes to the link when available
         if (isset($item['contentUrl'])) {
             $linkOptions['data-content-url'] = $item['contentUrl'];
         }
         // Render the contents of the heading
         $heading = $this->render('_seasonAccordionHeading', array('linkUrl' => '#' . $id, 'linkOptions' => $linkOptions, 'season' => $item['season']), true);
         $bodyOptions = array('class' => 'accordion-body collapse', 'id' => $id);
         if ($itemCount === 1) {
             TbHtml::addCssClass('in', $bodyOptions);
         }
         echo CHtml::openTag('div', array('class' => 'accordion-group'));
         echo CHtml::tag('div', array('class' => 'accordion-heading'), $heading);
         echo CHtml::openTag('div', $bodyOptions);
         echo CHtml::tag('div', array('id' => $contentId, 'class' => 'accordion-inner'), $item['content']);
         echo CHtml::closeTag('div');
         echo CHtml::closeTag('div');
     }
     echo CHtml::closeTag('div');
 }
开发者ID:pweisenburger,项目名称:xbmc-video-server,代码行数:34,代码来源:SeasonAccordion.php

示例10: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     if (is_string($this->keys)) {
         $this->keys = array($this->keys);
     }
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->keys as $key) {
         if (Yii::app()->user->hasFlash($key)) {
             echo strtr($this->template, array('{class}' => ' fade in', '{key}' => $key, '{message}' => Yii::app()->user->getFlash($key)));
         }
     }
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $selector = "#{$id} .alert";
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('{$selector}').alert();");
     // Register the "close" event-handler.
     if (isset($this->events['close'])) {
         $fn = CJavaScript::encode($this->events['close']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.close', "jQuery('{$selector}').bind('close', {$fn});");
     }
     // Register the "closed" event-handler.
     if (isset($this->events['closed'])) {
         $fn = CJavaScript::encode($this->events['closed']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.closed', "jQuery('{$selector}').bind('closed', {$fn});");
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:BootAlert.php

示例11: run

 public function run()
 {
     if (empty($this->links)) {
         return;
     }
     echo CHtml::openTag($this->tagName, $this->htmlOptions) . "\n";
     $links = array();
     echo '<span class="m_left20">当前位置:</span>';
     if ($this->homeLink === null) {
         $links[] = CHtml::link("工作台", Yii::app()->homeUrl);
     } else {
         if ($this->homeLink !== false) {
             $links[] = $this->homeLink;
         }
     }
     foreach ($this->links as $label => $url) {
         if (is_string($label) || is_array($url)) {
             $links[] = CHtml::link($this->encodeLabel ? CHtml::encode($label) : $label, $url);
         } else {
             $links[] = '<span>' . ($this->encodeLabel ? CHtml::encode($url) : $url) . '</span>';
         }
     }
     echo implode($this->separator, $links);
     echo CHtml::closeTag($this->tagName);
 }
开发者ID:zwq,项目名称:unpei,代码行数:25,代码来源:WBreadcrumbs.php

示例12: init

 /**
  * Initializes the widget.
  */
 public function init()
 {
     if (isset($this->htmlOptions['top'])) {
         $this->top = $this->htmlOptions['top'];
         unset($this->htmlOptions['top']);
     }
     if (isset($this->htmlOptions['parentClass'])) {
         $this->parentClass = $this->htmlOptions['parentClass'];
         unset($this->htmlOptions['parentClass']);
     }
     if (isset($this->htmlOptions['offsetBottom'])) {
         $this->offsetBottom = $this->htmlOptions['offsetBottom'];
         unset($this->htmlOptions['offsetBottom']);
     }
     if (isset($this->htmlOptions['offsetTop'])) {
         $this->offsetTop = $this->htmlOptions['offsetTop'];
         unset($this->htmlOptions['offsetTop']);
     }
     if (isset($this->htmlOptions['offtop'])) {
         $this->offtop = $this->htmlOptions['offtop'];
         unset($this->htmlOptions['offtop']);
     }
     isset($this->htmlOptions['class']) ? $this->htmlOptions['class'] .= $this->parentClass : ($this->htmlOptions['class'] = $this->parentClass);
     $this->htmlOptions['role'] = "complementary";
     echo CHtml::openTag($this->tagName, $this->htmlOptions);
 }
开发者ID:piond,项目名称:new_rsud,代码行数:29,代码来源:TbAffix.php

示例13: renderContent

 protected function renderContent()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status=1');
     $criteria->order = 'create_time DESC';
     $criteria->limit = 20;
     $hopam = Hopam::model()->findAll($criteria);
     /*$dataProvider = new CActiveDataProvider('Song', array(
           'pagination' => array(
               'pageSize' => Yii::app()->params['postsPerPage'],
           ),
           'criteria' => $criteria,
       ));
       $this->render('newest_song',array('songs'=>$dataProvider));*/
     echo CHtml::openTag("div", array('class' => 'title'));
     echo "Hợp Âm Mới";
     echo CHtml::closeTag("div");
     if ($hopam) {
         echo CHtml::openTag("ul");
         foreach ($hopam as $hp) {
             echo CHtml::openTag('li');
             echo CHtml::link($hp->title, array('/hopam/view', 'id' => $hp->id, "title" => Lnt::safeTitle($hp->title))) . " <span style='color:#a7a7a7'>({$hp->view})</span>";
             echo CHtml::closeTag('li');
         }
         echo CHtml::closeTag("ul");
     }
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:27,代码来源:NewestHopam.php

示例14: renderItems

 public function renderItems()
 {
     echo CHtml::openTag($this->itemsTagName, array('class' => $this->itemsCssClass)) . "\n";
     $data = $this->dataProvider->getData();
     if (($n = count($data)) > 0) {
         $owner = $this->getOwner();
         $render = $owner instanceof CController ? 'renderPartial' : 'render';
         $j = 0;
         $bandera = true;
         foreach ($data as $i => $item) {
             $data = $this->viewData;
             $data['index'] = $i;
             $data['data'] = $item;
             $data['widget'] = $this;
             if ($bandera == true) {
                 $owner->{$render}($this->headersview, $data);
                 $bandera = false;
             }
             $owner->{$render}($this->itemView, $data);
             if ($j++ < $n - 1) {
                 echo $this->separator;
             }
         }
         $owner->{$render}($this->footersview, $data);
     } else {
         $this->renderEmptyText();
     }
     echo CHtml::closeTag($this->itemsTagName);
 }
开发者ID:rzamarripa,项目名称:masoftproyectos,代码行数:29,代码来源:TbListView.php

示例15: renderField

    /**
     * Renders the input file field
     */
    public function renderField()
    {
        list($name, $id) = $this->resolveNameID();
        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);
        echo CHtml::openTag('div', $this->htmlOptions);
        echo CHtml::openTag('div', array('class' => 'input-prepend bfh-timepicker-toggle', 'data-toggle' => 'bfh-timepicker'));
        echo CHtml::tag('span', array('class' => 'add-on'), TbHtml::icon(TbHtml::ICON_TIME));
        if ($this->hasModel()) {
            echo CHtml::activeTextField($this->model, $this->attribute, $this->inputOptions);
        } else {
            echo CHtml::textField($name, $this->value, $this->inputOptions);
        }
        echo CHtml::closeTag('div');
        echo '<div class="bfh-timepicker-popover">
				<table class="table">
				<tbody>
					<tr>
						<td class="hour">
						<a class="next" href="#"><i class="icon-chevron-up"></i></a><br>
						<input type="text" class="input-mini" readonly><br>
						<a class="previous" href="#"><i class="icon-chevron-down"></i></a>
						</td>
						<td class="separator">:</td>
						<td class="minute">
						<a class="next" href="#"><i class="icon-chevron-up"></i></a><br>
						<input type="text" class="input-mini" readonly><br>
						<a class="previous" href="#"><i class="icon-chevron-down"></i></a>
						</td>
					</tr>
				</tbody>
				</table>
			</div>';
        echo CHtml::closeTag('div');
    }
开发者ID:2amigos,项目名称:yiiwheels,代码行数:38,代码来源:WhTimePickerHelper.php


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