本文整理汇总了PHP中TbHtml类的典型用法代码示例。如果您正苦于以下问题:PHP TbHtml类的具体用法?PHP TbHtml怎么用?PHP TbHtml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TbHtml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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});");
}
}
示例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');
}
示例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');
}
示例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');
}
示例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));
}
示例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();
}
}
示例8: run
/**
* Runs the widget.
*/
public function run()
{
$links = $this->createPageLinks();
if (!empty($links)) {
echo TbHtml::pagination($links, $this->htmlOptions);
}
}
示例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();
}
示例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']);
}
示例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();
}
}
}
示例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)));
}
示例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);
}
}
}
示例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
}
}
示例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)) : '';
}