本文整理汇总了PHP中TbHtml类的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml类的具体用法?PHP TbHtml怎么用?PHP TbHtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TbHtml类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: renderDataCellContent
/**
* Renders the data cell content.
*
* @param integer $row the row number (zero-based)
* @param YdActiveRecord $data the data associated with the row
*/
protected function renderDataCellContent($row, $data)
{
ob_start();
parent::renderDataCellContent($row, $data);
$parentContents = ob_get_clean();
if ($data instanceof CActiveRecord) {
$links = is_callable(array($data, 'getMenuLinks')) ? call_user_func(array($data, 'getMenuLinks')) : array();
if ($links) {
if (is_callable(array($data, 'getUrl'))) {
$this->buttonOptions['type'] = TbHtml::BUTTON_TYPE_LINK;
$this->buttonOptions['url'] = call_user_func(array($data, 'getUrl'));
}
echo '<div class="filter-container">';
$this->buttonOptions['split'] = true;
echo TbHtml::buttonDropdown($parentContents, $links, $this->buttonOptions);
echo '</div>';
} else {
$url = is_callable(array($data, 'getUrl')) ? call_user_func(array($data, 'getUrl')) : false;
if ($url) {
$this->buttonOptions['class'] = isset($this->buttonOptions['class']) ? $this->buttonOptions['class'] . ' btn' : 'btn';
echo TbHtml::link($parentContents, $url, $this->buttonOptions);
} else {
echo TbHtml::button($parentContents, $this->buttonOptions);
}
}
} else {
echo TbHtml::button($parentContents, $this->buttonOptions);
}
}
开发者ID:cornernote,项目名称:yii-dressing,代码行数:35,代码来源:YdDropdownColumn.php
示例2: run
/**
* Runs the widget.
*/
public function run()
{
list($name, $id) = $this->resolveNameID();
$id = $this->resolveId($id);
if ($this->hasModel()) {
echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
} else {
echo TbHtml::textField($name, $this->value, $this->htmlOptions);
}
if ($this->assetPath !== false) {
$this->publishAssets($this->assetPath);
$this->registerCssFile('/css/bootstrap-datetimepicker.css');
if ($this->registerJs) {
$this->registerScriptFile('/js/' . $this->resolveScriptVersion('bootstrap-datetimepicker.js'), CClientScript::POS_END);
if (isset($this->locale)) {
$this->locale = str_replace('_', '-', $this->locale);
$this->registerScriptFile("/js/locales/bootstrap-datetimepicker.{$this->locale}.js", CClientScript::POS_END);
}
}
}
if ($this->bindPlugin) {
$options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
$this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').datetimepicker({$options});");
}
}
开发者ID:juanprua,项目名称:yiistrap-widgets,代码行数:28,代码来源:TbDateTimePicker.php
示例3: 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);
TbHtml::addCssClass('bfh-selectbox', $this->wrapperOptions);
echo CHtml::openTag('div', $this->wrapperOptions);
if ($this->hasModel()) {
echo CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
$value = $this->model->{$this->attribute};
$valueText = $value && isset($this->data[$value]) ? $this->data[$value] : ' ';
} else {
echo CHtml::hiddenField($name, $this->value, $this->htmlOptions);
$value = $this->value;
$valueText = $value && isset($this->data[$value]) ? $this->data[$value] : ' ';
}
echo CHtml::openTag('a', array('class' => 'bfh-selectbox-toggle', 'role' => 'button', 'data-toggle' => 'bfh-selectbox', 'href' => '#'));
echo CHtml::tag('span', array('class' => 'bfh-selectbox-option ' . $this->size, 'data-option' => $value), $valueText);
echo CHtml::tag('b', array('class' => 'caret'), ' ');
echo CHtml::closeTag('a');
echo CHtml::openTag('div', array('class' => 'bfh-selectbox-options'));
if ($this->displayFilter) {
echo '<input type="text" class="bfh-selectbox-filter">';
}
$items = array();
foreach ($this->data as $key => $item) {
$items[] = CHtml::tag('a', array('tabindex' => '-1', 'href' => '#', 'data-option' => $key), $item);
}
echo CHtml::tag('ul', array('role' => 'options'), '<li>' . implode('</li><li>', $items) . '</li>');
echo CHtml::closeTag('div');
echo CHtml::closeTag('div');
}
开发者ID:2amigos,项目名称:yiiwheels,代码行数:35,代码来源:WhSelectBox.php
示例4: 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
示例5: 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
示例6: getSubmitButtonRow
/**
* @param null $label
* @param array $options
* @return string
*/
public function getSubmitButtonRow($label = null, $options = array())
{
if (!isset($options['color'])) {
$options['color'] = TbHtml::BUTTON_COLOR_PRIMARY;
}
return CHtml::tag('div', array('class' => 'form-actions'), TbHtml::submitButton($label, $options));
}
开发者ID:rizaldi-github,项目名称:yii-menu-module,代码行数:12,代码来源:MenuActiveForm.php
示例7: renderItems
/**
* Renders the data items for the view.
* Each item is corresponding to a single data model instance.
*/
public function renderItems()
{
$thumbnails = array();
$data = $this->dataProvider->getData();
if (!empty($data)) {
$owner = $this->getOwner();
$render = $owner instanceof CController ? 'renderPartial' : 'render';
foreach ($data as $i => $row) {
$thumbnail = array();
$d = $this->viewData;
$d['index'] = $i;
$d['data'] = $row;
$d['widget'] = $this;
$thumbnail['content'] = $owner->{$render}($this->itemView, $d, true);
if (isset($this->url)) {
$thumbnail['url'] = $this->evaluateExpression($this->url, array('data' => $row));
}
if (isset($this->span)) {
$thumbnail['span'] = $this->span;
}
$thumbnails[] = $thumbnail;
}
echo TbHtml::thumbnails($thumbnails, $this->htmlOptions);
} else {
$this->renderEmptyText();
}
}
开发者ID:yii-twbs,项目名称:yiistrap,代码行数:31,代码来源:TbThumbnails.php
示例8: run
/**
* Runs the widget.
*/
public function run()
{
$links = $this->createPageLinks();
if (!empty($links)) {
echo TbHtml::pagination($links, $this->htmlOptions);
}
}
开发者ID:jackycgq,项目名称:advanced,代码行数:10,代码来源:TbPager.php
示例9: init
/**
* Initializes the widget.
*/
public function init()
{
$this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
TbArray::defaultValue('autocomplete', 'off', $this->htmlOptions);
TbHtml::addCssClass('grd-white', $this->htmlOptions);
$this->initOptions();
}
开发者ID:nicovicz,项目名称:reward-point,代码行数:10,代码来源:WhDatePicker.php
示例10: init
public function init()
{
parent::init();
TbHtml::addCssClass('bfh-phone', $this->htmlOptions);
$this->htmlOptions['data-format'] = $this->format;
unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:7,代码来源:WhPhone.php
示例11: renderFilterCellContent
/**
* 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 TbHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
} else {
if ($this->filter === null) {
echo TbHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
}
}
} else {
parent::renderFilterCellContent();
}
}
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:30,代码来源:TbDataColumn.php
示例12: renderButtons
/**
* Renders the form buttons
*/
protected function renderButtons()
{
echo TbHtml::submitButton(Yii::t('FilterForm', 'Apply filter'), array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
$controller = Yii::app()->controller;
// Disable when no filter is defined
echo TbHtml::linkButton(Yii::t('FilterForm', 'Clear filter'), array('color' => TbHtml::BUTTON_COLOR_INFO, 'disabled' => $this->model->isEmpty(), 'url' => $controller->createUrl($controller->route)));
}
开发者ID:pweisenburger,项目名称:xbmc-video-server,代码行数:10,代码来源:VideoFilter.php
示例13: renderButton
/**
* Renders a link button.
* @param string $id the ID of the button
* @param array $button the button configuration which may contain 'label', 'url', 'imageUrl' and 'options' elements.
* @param integer $row the row number (zero-based)
* @param mixed $data the data object associated with the row
*/
protected function renderButton($id, $button, $row, $data)
{
if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data))) {
return;
}
$url = TbHtml::popOption('url', $button, '#');
if (strcmp($url, '#') !== 0) {
$url = $this->evaluateExpression($url, array('data' => $data, 'row' => $row));
}
$imageUrl = TbHtml::popOption('imageUrl', $button, false);
$label = TbHtml::popOption('label', $button, $id);
$options = TbHtml::popOption('options', $button, array());
$options = TbHtml::defaultOption('title', $label, $options);
$options = TbHtml::defaultOption('rel', 'tooltip', $options);
if ($icon = TbHtml::popOption('icon', $button, false)) {
/* todo: not sure if we require this anymore */
if (strpos($icon, 'icon') === false) {
$icon = 'icon-' . implode(' icon-', explode(' ', $icon));
}
echo CHtml::link('<i class="' . $icon . '"></i>', $url, $options);
} else {
if ($imageUrl && is_string($imageUrl)) {
echo CHtml::link(CHtml::image($imageUrl, $label), $url, $options);
} else {
echo CHtml::link($label, $url, $options);
}
}
}
开发者ID:tatyanayavkina,项目名称:yii_city_game,代码行数:35,代码来源:TbButtonColumn.php
示例14: run
/**
* Runs the widget.
*/
public function run()
{
if (!empty($this->items)) {
//echo TbHtml::nav($this->type, $this->items, $this->htmlOptions);
echo TbHtml::nav($this->type, $this->items, $this->htmlOptions, $this->submenuHtmlOptions);
//add submenuHtmlOptions parameter
}
}
开发者ID:noonnightcoder,项目名称:bakou-pos-apsara,代码行数:11,代码来源:TbNav.php
示例15: renderButtons
/**
* Renders the buttons in this form.
* @return string the rendering result.
*/
public function renderButtons()
{
$buttons = array();
foreach ($this->getButtons() as $button) {
$buttons[] = $this->renderElement($button);
}
return !empty($buttons) ? TbHtml::tag('div', array('class' => 'form-actions'), implode("\n", $buttons)) : '';
}
开发者ID:nicovicz,项目名称:reward-point,代码行数:12,代码来源:TbForm.php
示例16: init
/**
* Widget's initialization method
* @throws CException
*/
public function init()
{
if (!isset($this->pluginOptions['country'])) {
throw new CException(Yii::t('zii', '$pluginOptions["country"] cannot be blank.'));
}
$this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
TbHtml::addCssClass('bfh-states', $this->htmlOptions);
}
开发者ID:nicovicz,项目名称:reward-point,代码行数:12,代码来源:WhStates.php
示例17: init
public function init()
{
parent::init();
TbHtml::addCssClass('bfh-fonts', $this->htmlOptions);
if (!isset($this->htmlOptions['data-font'])) {
$this->htmlOptions['data-font'] = TbArray::popValue('data-value', $this->htmlOptions);
}
unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:9,代码来源:WhFonts.php
示例18: renderDataCellContent
/**
* Renders the data cell content.
* @param integer $row the row number (zero-based).
* @param mixed $data the data associated with the row.
*/
protected function renderDataCellContent($row, $data)
{
/* @var $am CAuthManager|AuthBehavior */
$am = Yii::app()->getAuthManager();
$labelType = $this->active || $am->hasParent($this->itemName, $data['name']) || $am->hasChild($this->itemName, $data['name']) ? 'info' : '';
/* @var $controller AuthItemController */
$controller = $this->grid->getController();
echo TbHtml::labelTb($controller->getItemTypeText($data['item']->type), array('color' => $labelType));
}
开发者ID:ivko,项目名称:yii-auth,代码行数:14,代码来源:AuthItemTypeColumn.php
示例19: typeaheadFieldControlGroup
/**
* Renders a text field with typeahead functionality based on the specified
* data.
* @param CModel $model the model
* @param string $attribute the attribute name
* @param string $data JavaScript-encoded array containing the data for the
* typeahead
* @param array $htmlOptions options to pass to the control group
* @return string the HTML for the input
*/
public function typeaheadFieldControlGroup($model, $attribute, $data, $htmlOptions = array())
{
// Generate a unique ID for this element
CHtml::resolveNameID($model, $attribute, $htmlOptions);
TbHtml::addCssClass('twitter-typeahead-input', $htmlOptions);
$id = $htmlOptions['id'];
Yii::app()->clientScript->registerScript($id, "\n\t\t\t\$('#{$id}').typeahead({name: '{$id}',local: {$data},limit: 10});\n\t\t", CClientScript::POS_READY);
return $this->textFieldControlGroup($model, $attribute, $htmlOptions);
}
开发者ID:pweisenburger,项目名称:xbmc-video-server,代码行数:19,代码来源:FilterActiveForm.php
示例20: init
public function init()
{
if (empty($this->country) && !isset($this->pluginOptions['country'])) {
throw new CException('"$country" cannot be empty.');
}
$this->pluginOptions['country'] = TbArray::getValue('country', $this->pluginOptions, $this->country);
parent::init();
TbHtml::addCssClass('bfh-timezones', $this->htmlOptions);
unset($this->htmlOptions['data-name']);
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:10,代码来源:WhTimezones.php
注:本文中的TbHtml类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论