本文整理汇总了PHP中CMbArray::defaultValue方法的典型用法代码示例。如果您正苦于以下问题:PHP CMbArray::defaultValue方法的具体用法?PHP CMbArray::defaultValue怎么用?PHP CMbArray::defaultValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMbArray
的用法示例。
在下文中一共展示了CMbArray::defaultValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultValue
public function testDefaultValue()
{
$array = array("key" => "val");
$this->stub->defaultValue($array, "key2", "val2");
$this->assertArrayHasKey("key2", $array);
$this->assertEquals("val2", $array["key2"]);
}
示例2: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$maxLength = 10;
CMbArray::defaultValue($params, "size", $maxLength);
CMbArray::defaultValue($params, "maxlength", $maxLength);
return $this->getFormElementText($object, $params, $value, $className);
}
示例3: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$form = CMbArray::extract($params, "form");
$increment = CMbArray::extract($params, "increment");
$showPlus = CMbArray::extract($params, "showPlus");
$fraction = CMbArray::extract($params, "fraction");
$showFraction = CMbArray::extract($params, "showFraction");
$deferEvent = CMbArray::extract($params, "deferEvent");
$bigButtons = CMbArray::extract($params, "bigButtons");
$readonly = CMbArray::get($params, "readonly");
$field = CMbString::htmlSpecialChars($this->fieldName);
$min = CMbArray::extract($params, "min");
if ($min === null) {
$min = CMbFieldSpec::checkNumeric($this->min, false);
}
$max = CMbArray::extract($params, "max");
if ($max === null) {
$max = CMbFieldSpec::checkNumeric($this->max, false);
}
$new_value = CMbArray::extract($params, "value");
if ($new_value !== null) {
$value = $new_value;
}
$decimals = CMbArray::extract($params, "decimals", $this->decimals);
if ($decimals == null) {
$decimals = isset($this->precise) ? 4 : 2;
}
$step = CMbArray::extract($params, "step");
$step = CMbFieldSpec::checkNumeric($step, false);
CMbArray::defaultValue($params, "size", 4);
if ($form && $increment && !$readonly) {
$sHtml = $this->getFormElementText($object, $params, ($value >= 0 && $showPlus ? '+' : '') . ($value == 0 && $showPlus ? '0' : $value), $className, "number");
$sHtml .= '
<script type="text/javascript">
Main.add(function(){
var element = $(document.forms["' . $form . '"]["' . $field . '"]);
if ($(element.form).isReadonly()) return;
element.addSpinner({';
if ($step) {
$sHtml .= "step: {$step},";
}
if ($decimals) {
$sHtml .= "decimals: {$decimals},";
}
if ($this->pos) {
$sHtml .= "min: 0,";
} elseif (isset($min)) {
$sHtml .= "min: {$min},";
}
if (isset($max)) {
$sHtml .= "max: {$max},";
}
if ($deferEvent) {
$sHtml .= "deferEvent: true,";
}
if ($bigButtons) {
$sHtml .= "bigButtons: true,";
}
if ($showPlus) {
$sHtml .= "showPlus: true,";
}
if ($fraction) {
$sHtml .= "fraction: true,";
}
if ($showFraction) {
$sHtml .= "showFraction: true,";
}
$sHtml .= '_:0 // IE rules
});
});
</script>';
} else {
$sHtml = $this->getFormElementText($object, $params, $value, $className, "number");
}
return $sHtml;
}
示例4: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
$maxLength = CValue::first($this->length, $this->maxLength, 255);
CMbArray::defaultValue($params, "size", min($maxLength, 25));
CMbArray::defaultValue($params, "maxlength", $maxLength);
return $this->getFormElementText($object, $params, $value, $className);
}
示例5: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
CMbArray::defaultValue($params, "size", 6);
return parent::getFormHtmlElement($object, $params, $value, $className) . CAppUI::conf("currency_symbol");
}
示例6: getFormHtmlElement
/**
* @param array $params Template params:
* - options : array of objects with IDs
* - choose : string alternative for Choose default option
* - size : interger for size of text input
* @see classes/CMbFieldSpec#getFormHtmlElement($object, $params, $value, $className)
*
* @return string
*/
function getFormHtmlElement($object, $params, $value, $className)
{
if ($options = CMbArray::extract($params, "options")) {
$field = CMbString::htmlSpecialChars($this->fieldName);
$className = CMbString::htmlSpecialChars(trim("{$className} {$this->prop}"));
$extra = CMbArray::makeXmlAttributes($params);
$choose = CMbArray::extract($params, "choose", "Choose");
$choose = CAppUI::tr($choose);
$html = "\n<select name=\"{$field}\" class=\"{$className}\" {$extra}>";
$html .= "\n<option value=\"\">— {$choose}</option>";
foreach ($options as $_option) {
$selected = $value == $_option->_id ? "selected=\"selected\"" : "";
$html .= "\n<option value=\"{$_option->_id}\" {$selected}>{$_option->_view}</option>";
}
$html .= "\n</select>";
return $html;
}
CMbArray::defaultValue($params, "size", 25);
return $this->getFormElementText($object, $params, $value, $className);
}
示例7: getFormHtmlElement
/**
* @see parent::getFormHtmlElement()
*/
function getFormHtmlElement($object, $params, $value, $className)
{
CMbArray::defaultValue($params, "size", 6);
return parent::getFormHtmlElement($object, $params, $value, $className) . "%";
}