本文整理汇总了PHP中TbArray::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TbArray::getValue方法的具体用法?PHP TbArray::getValue怎么用?PHP TbArray::getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TbArray
的用法示例。
在下文中一共展示了TbArray::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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']);
}
示例3: 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));
}
示例4: 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');
}
示例5: 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);
}
示例6: error
/**
* Displays the first validation error for a model attribute.
* @param CModel $model the data model
* @param string $attribute the attribute name
* @param array $htmlOptions additional HTML attributes to be rendered in the container div tag.
* @param boolean $enableAjaxValidation whether to enable AJAX validation for the specified attribute.
* @param boolean $enableClientValidation whether to enable client-side validation for the specified attribute.
* @return string the validation result (error display or success message).
*/
public function error($model, $attribute, $htmlOptions = array(), $enableAjaxValidation = true, $enableClientValidation = true)
{
if (!$this->enableAjaxValidation) {
$enableAjaxValidation = false;
}
if (!$this->enableClientValidation) {
$enableClientValidation = false;
}
if (!$enableAjaxValidation && !$enableClientValidation) {
return TbHtml::error($model, $attribute, $htmlOptions);
}
$id = CHtml::activeId($model, $attribute);
$inputID = TbArray::getValue('inputID', $htmlOptions, $id);
unset($htmlOptions['inputID']);
TbArray::defaultValue('id', $inputID . '_em_', $htmlOptions);
$option = array('id' => $id, 'inputID' => $inputID, 'errorID' => $htmlOptions['id'], 'model' => get_class($model), 'name' => $attribute, 'enableAjaxValidation' => $enableAjaxValidation, 'inputContainer' => 'div.control-group');
$optionNames = array('validationDelay', 'validateOnChange', 'validateOnType', 'hideErrorMessage', 'inputContainer', 'errorCssClass', 'successCssClass', 'validatingCssClass', 'beforeValidateAttribute', 'afterValidateAttribute');
foreach ($optionNames as $name) {
if (isset($htmlOptions[$name])) {
$option[$name] = TbArray::popValue($name, $htmlOptions);
}
}
if ($model instanceof CActiveRecord && !$model->isNewRecord) {
$option['status'] = 1;
}
if ($enableClientValidation) {
$validators = TbArray::getValue('clientValidation', $htmlOptions, array());
$attributeName = $attribute;
if (($pos = strrpos($attribute, ']')) !== false && $pos !== strlen($attribute) - 1) {
$attributeName = substr($attribute, $pos + 1);
}
foreach ($model->getValidators($attributeName) as $validator) {
if ($validator->enableClientValidation) {
if (($js = $validator->clientValidateAttribute($model, $attributeName)) != '') {
$validators[] = $js;
}
}
}
if ($validators !== array()) {
$option['clientValidation'] = "js:function(value, messages, attribute) {\n" . implode("\n", $validators) . "\n}";
}
}
$html = TbHtml::error($model, $attribute, $htmlOptions);
if ($html === '') {
$htmlOptions['type'] = $this->helpType;
TbHtml::addCssStyle('display:none', $htmlOptions);
$html = TbHtml::help('', $htmlOptions);
}
$this->attributes[$inputID] = $option;
return $html;
}
示例7: 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);
}
示例8: registerClientScript
/**
* Registers required client script for bootstrap multiselect. 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();
$cs->registerCssFile($assetsUrl . '/css/bootstrap-multiselect.css');
$cs->registerScriptFile($assetsUrl . '/js/bootstrap-multiselect.js');
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('multiselect', $selector, $this->pluginOptions);
$this->getApi()->registerEvents($selector, $this->events);
}
示例9: 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);
}
示例10: registerClientScript
/**
* Registers client script
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$cs->registerCssFile($assetsUrl . '/css/jquery.fileupload-ui.css');
$cs->registerScriptFile($assetsUrl . '/js/vendor/jquery.ui.widget.js');
$cs->registerScriptFile($assetsUrl . '/js/jquery.iframe-transport.js');
$cs->registerScriptFile($assetsUrl . '/js/jquery.fileupload.js');
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('fileupload', $selector, $this->pluginOptions);
}
示例11: registerClientScript
/**
* Registers required client script for sparklines
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$script = $this->debugMode ? 'jquery.sparkline.js' : 'jquery.sparkline.min.js';
$cs->registerScriptFile($assetsUrl . '/js/' . $script);
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$data = CJavaScript::encode($this->data);
$options = CJavaScript::encode($this->pluginOptions);
$cs->registerScript(__CLASS__ . '#' . $selector, "jQuery('{$selector}').sparkline({$data}, {$options});");
}
示例12: registerClientScript
/**
* Registers required client script for finuploader
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$script = YII_DEBUG ? 'jquery.fineuploader-3.2.js' : 'jquery.fineuploader-3.2.min.js';
$cs->registerCssFile($assetsUrl . '/css/fineuploader.css');
$cs->registerScriptFile($assetsUrl . '/js/' . $script);
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('fineUploader', $selector, CMap::mergeArray($this->defaultOptions, $this->pluginOptions));
$this->getApi()->registerEvents($selector, $this->events);
}
示例13: registerClientScript
/**
* Registers client script
*/
public function registerClientScript()
{
/* publish assets dir */
$path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets';
$assetsUrl = $this->getAssetsUrl($path);
/* @var $cs CClientScript */
$cs = Yii::app()->getClientScript();
$cs->registerCssFile($assetsUrl . '/css/bootstrap-formhelpers.css');
$cs->registerScriptFile($assetsUrl . '/js/bootstrap-formhelpers-timezones.codes.js');
$cs->registerScriptFile($assetsUrl . '/js/bootstrap-formhelpers-timezones.js');
/* initialize plugin */
if (!$this->useHelperSelectBox) {
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('bfhtimezones', $selector, $this->pluginOptions);
}
}
示例14: registerClientScript
/**
* Registers required client script for bootstrap select2. 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();
$cs->registerCssFile($assetsUrl . '/css/select2.css');
$cs->registerScriptFile($assetsUrl . '/js/select2.js');
if ($this->language) {
$cs->registerScriptFile($assetsUrl . '/js/locale/select2_locale_' . $this->language . '.js', CClientScript::POS_END);
}
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('select2', $selector, $this->pluginOptions, CClientScript::POS_READY);
$this->getApi()->registerEvents($selector, $this->events, CClientScript::POS_READY);
}
示例15: registerClientScript
/**
* Registers required client script for bootstrap select2. 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();
$script = $this->debugMode ? 'redactor.js' : 'redactor.min.js';
$cs->registerCssFile($assetsUrl . '/css/redactor.css');
$cs->registerScriptFile($assetsUrl . '/js/' . $script, CClientScript::POS_END);
/* register language */
$language = TbArray::getValue('lang', $this->pluginOptions);
if (!empty($language) && $language != 'en') {
$cs->registerScriptFile($assetsUrl . '/js/langs/' . $language . '.js', CClientScript::POS_END);
}
/* register plugins (if any) */
$this->registerPlugins($assetsUrl);
/* initialize plugin */
$selector = '#' . TbArray::getValue('id', $this->htmlOptions, $this->getId());
$this->getApi()->registerPlugin('redactor', $selector, $this->pluginOptions);
}