本文整理汇总了PHP中TbArray类的典型用法代码示例。如果您正苦于以下问题:PHP TbArray类的具体用法?PHP TbArray怎么用?PHP TbArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TbArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
Yii::import('bootstrap.behaviors.TbWidget');
$this->attachBehavior('tbWidget', new TbWidget());
if (!isset($this->assetPath)) {
$this->assetPath = realpath(dirname(__FILE__) . '/../assets');
}
if (!$this->asDropDownList && !isset($this->pluginOptions['data'])) {
$this->pluginOptions['data'] = $this->normalizeData($this->data);
}
if (isset($this->htmlOptions['placeholder'])) {
if ($this->asDropDownList) {
$this->htmlOptions['prompt'] = $this->htmlOptions['placeholder'];
} else {
$this->pluginOptions['placeholder'] = $this->htmlOptions['placeholder'];
}
unset($this->htmlOptions['placeholder']);
}
if (!$this->bindPlugin) {
$this->htmlOptions['data-plugin'] = 'select2';
$this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
}
if (TbArray::popValue('block', $this->htmlOptions, false)) {
TbHtml::addCssClass('input-block-level', $this->htmlOptions);
}
}
示例2: 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');
}
示例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);
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');
}
示例4: init
/**
* Initializes the widget.
*/
public function init()
{
$this->attachBehavior('TbWidget', new TbWidget());
$this->copyId();
if (isset($this->size)) {
TbArray::defaultValue('size', $this->size, $this->htmlOptions);
}
}
示例5: init
/**
* Widget's initialization method
*/
public function init()
{
$this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
$this->htmlOptions['id'] = TbArray::getValue('id', $this->htmlOptions, $this->getId());
if (!$this->selector) {
$this->selector = '#' . TbArray::getValue('id', $this->htmlOptions);
}
}
示例6: 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']);
}
示例7: 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']);
}
示例8: testMerge
public function testMerge()
{
$a = array('this' => 'is', 'array' => 'a');
$b = array('is' => 'this', 'b' => 'array');
$array = TbArray::merge($a, $b);
$this->assertEquals('is', TbArray::getValue('this', $array));
$this->assertEquals('a', TbArray::getValue('array', $array));
$this->assertEquals('this', TbArray::getValue('is', $array));
$this->assertEquals('array', TbArray::getValue('b', $array));
}
示例9: renderField
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
if ($this->hasModel()) {
echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
} else {
echo TbHtml::textField($name, $this->value, $this->htmlOptions);
}
}
示例10: renderLinks
/**
* Renders links
*/
public function renderLinks()
{
echo CHtml::openTag('div', $this->htmlOptions);
foreach ($this->items as $item) {
$url = TbArray::getValue('url', $item, '#');
$src = TbArray::getValue('src', $item, '#');
$options = TbArray::getValue('options', $item);
echo CHtml::link(CHtml::image($src), $url, $options);
}
echo CHtml::closeTag('div');
}
示例11: registerClientScript
/**
* Registers required client script for maskmoney plugin.
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($assetsUrl . '/js/jquery.maskmoney.js');
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('maskMoney', $selector, $this->pluginOptions);
}
示例12: init
/**
* Initializes the widget.
*/
public function init()
{
TbArray::defaultValue('successClass', 'success', $this->pluginOptions);
TbArray::defaultValue('errorClass', 'error', $this->pluginOptions);
if (!isset($this->assetPath)) {
$this->assetPath = Yii::getPathOfAlias('vendor.guillaumepotier.parsleyjs.dist');
}
if (!$this->bindPlugin) {
$this->htmlOptions['data-plugin'] = 'parsley';
$this->htmlOptions['data-plugin-options'] = CJSON::encode($this->pluginOptions);
}
parent::init();
}
示例13: init
public function init()
{
if (empty($this->country)) {
throw new CException('"$country" cannot be empty.');
}
$this->pluginOptions['country'] = $this->country;
parent::init();
TbHtml::addCssClass('bfh-states', $this->htmlOptions);
if (!isset($this->htmlOptions['data-state'])) {
$this->htmlOptions['data-state'] = TbArray::popValue('data-value', $this->htmlOptions);
}
unset($this->htmlOptions['data-name'], $this->htmlOptions['data-value']);
}
示例14: registerClientScript
/**
* Registers required client script for bootstrap typeahead. It is not used through bootstrap->registerPlugin
* in order to attach events if any
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$min = $this->debugMode ? '.min' : '';
$cs->registerCssFile($assetsUrl . '/css/typeahead' . $min . '.css');
$cs->registerScriptFile($assetsUrl . '/js/typeahead' . $min . '.js', CClientScript::POS_END);
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('typeahead', $selector, $this->pluginOptions);
}
示例15: registerClientScript
/**
* Registers required client script for jquery mask plugin. It doesn't use bootstrap->registerPlugin.
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($assetsUrl . '/js/jquery.mask.js');
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '{}';
$script = "jQuery('{$selector}').mask('{$this->mask}',{$options});";
Yii::app()->clientScript->registerScript(uniqid(__CLASS__ . '#', true), $script, CClientScript::POS_END);
}