本文整理汇总了PHP中TbArray::defaultValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TbArray::defaultValue方法的具体用法?PHP TbArray::defaultValue怎么用?PHP TbArray::defaultValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbArray
的用法示例。
在下文中一共展示了TbArray::defaultValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Widget's initialization method
*/
public function init()
{
$this->attachBehavior('TbWidget', new TbWidget());
$this->copyId();
TbArray::defaultValue('placement', $this->placement, $this->htmlOptions);
$this->initEvents();
}
示例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: testDefaultValue
public function testDefaultValue()
{
$array = array();
TbArray::defaultValue('key', 'default', $array);
$this->assertEquals('default', TbArray::getValue('key', $array));
TbArray::defaultValue('key', 'value', $array);
$this->assertEquals('default', TbArray::getValue('key', $array));
}
示例6: renderField
/**
* Renders the select2 field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
if ($this->hasModel()) {
echo $this->asDropDownList ? TbHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) : TbHtml::activeHiddenField($this->model, $this->attribute);
} else {
echo $this->asDropDownList ? TbHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions) : TbHtml::hiddenField($this->name, $this->value);
}
}
示例7: renderField
/**
* Renders field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
if ($this->hasModel()) {
echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::textArea($name, $this->value, $this->htmlOptions);
}
}
示例8: 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);
$this->htmlOptions['data-url'] = $this->uploadAction;
$this->pluginOptions['url'] = $this->uploadAction;
if ($this->hasModel()) {
echo CHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::fileField($name, $this->value, $this->htmlOptions);
}
}
示例9: 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();
}
示例10: renderField
/**
* Renders the field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
echo '<span class="bootstrap-timepicker">';
if ($this->hasModel()) {
echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::textField($name, $this->value, $this->htmlOptions, array('style' => 'width:100%'));
}
echo '</span>';
}
示例11: renderField
/**
* Renders the multiselect field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
// fixes #32: 'multiple' will be forced later in jQuery plugin
$this->htmlOptions['multiple'] = 'multiple';
if ($this->hasModel()) {
echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
} else {
echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions);
}
}
示例12: renderField
/**
* Renders the field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
echo '<div class="input-group">';
echo '<div class="input-group-addon"><span class="glyphicon glyphicon-time"></span></div>';
if ($this->hasModel()) {
echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::textField($name, $this->value, $this->htmlOptions, array('style' => 'width:100%'));
}
echo '</div>';
}
示例13: init
/**
* Initializes the widget.
*/
public function init()
{
if ($this->brandLabel !== false) {
if (!isset($this->brandLabel)) {
$this->brandLabel = CHtml::encode(Yii::app()->name);
}
if (!isset($this->brandUrl)) {
$this->brandUrl = Yii::app()->homeUrl;
}
}
if (isset($this->color)) {
TbArray::defaultValue('color', $this->color, $this->htmlOptions);
}
if (isset($this->display) && $this->display !== TbHtml::NAVBAR_DISPLAY_NONE) {
TbArray::defaultValue('display', $this->display, $this->htmlOptions);
}
}
示例14: renderField
/**
* Renders field
*/
public function renderField()
{
list($name, $id) = $this->resolveNameID();
TbArray::defaultValue('id', $id, $this->htmlOptions);
TbArray::defaultValue('name', $name, $this->htmlOptions);
$tagOptions = $this->htmlOptions;
$tagOptions['id'] = 'aceEditor_' . $tagOptions['id'];
echo CHtml::openTag('div', $tagOptions);
echo CHtml::closeTag('div');
$this->htmlOptions['style'] = 'display:none';
if ($this->hasModel()) {
echo CHtml::activeTextArea($this->model, $this->attribute, $this->htmlOptions);
} else {
echo CHtml::textArea($name, $this->value, $this->htmlOptions);
}
$this->htmlOptions = $tagOptions;
}
示例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);
if ($this->useHelperSelectBox) {
$select = Yii::createComponent(CMap::mergeArray($this->helperOptions, array('class' => 'yiiwheels.widgets.formhelpers.WhSelectBox', 'htmlOptions' => $this->htmlOptions, 'model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'wrapperOptions' => array('class' => 'bfh-fonts', 'data-family' => $this->hasModel() ? $this->model->{$this->attribute} : $this->value))));
$select->init();
$select->run();
} else {
$this->htmlOptions['data-family'] = $this->hasModel() ? $this->model->{$this->attribute} : $this->value;
if ($this->hasModel()) {
echo CHtml::activeDropDownList($this->model, $this->attribute, array(), $this->htmlOptions);
} else {
echo CHtml::dropDownList($name, $this->value, array(), $this->htmlOptions);
}
}
}