本文整理汇总了PHP中TPropertyValue::ensureFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP TPropertyValue::ensureFloat方法的具体用法?PHP TPropertyValue::ensureFloat怎么用?PHP TPropertyValue::ensureFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPropertyValue
的用法示例。
在下文中一共展示了TPropertyValue::ensureFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValueAsString
private function getValueAsString($value, $type)
{
switch ($type) {
case 'integer':
$value = TPropertyValue::ensureInteger($value);
break;
case 'float':
$value = TPropertyValue::ensureFloat($value);
break;
case 'boolean':
if (TPropertyValue::ensureBoolean($value)) {
$value = 'true';
} else {
$value = 'false';
}
break;
case 'enumerable':
$value = "'{$value}'";
break;
case 'mixed':
$value = 'null';
break;
case 'string':
$value = "'{$value}'";
break;
}
return "{$value}";
}
示例2: setDecayRate
/**
* Sets the decay rate between callback. Default is 0;
* @param float decay rate between callbacks.
*/
public function setDecayRate($value)
{
$decay = TPropertyValue::ensureFloat($value);
if ($decay < 0) {
throw new TConfigurationException('callback_decay_be_not_negative', $this->getID());
}
$this->setViewState('Decay', $decay);
}
示例3: setInterval
/**
* @param float seconds between callback requests, must be a positive number, default is 1 second.
*/
public function setInterval($value)
{
$interval = TPropertyValue::ensureFloat($value);
if ($interval <= 0) {
throw new TConfigurationException('callback_interval_be_positive', $this->getID());
}
$this->setViewState('Interval', $interval, 1);
if ($this->getActiveControl()->canUpdateClientSide()) {
$client = $this->getPage()->getCallbackClient();
$client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', array($this, $interval));
}
}
示例4: saveInput
public function saveInput($sender, $param)
{
if ($this->IsValid) {
$index = 0;
$products = $this->Products;
$data = array();
foreach ($this->Repeater->Items as $item) {
$item = array('id' => $products[$index]['id'], 'name' => $item->ProductName->Text, 'category' => $item->ProductCategory->SelectedItem->Text, 'price' => TPropertyValue::ensureFloat($item->ProductPrice->Text), 'imported' => $item->ProductImported->Checked);
$data[] = $item;
$index++;
}
$this->Repeater2->DataSource = $data;
$this->Repeater2->dataBind();
}
}
示例5: updateProduct
protected function updateProduct($id, $name, $quantity, $price, $imported)
{
// In real applications, data should be saved to database using an SQL UPDATE statement
if ($this->_data === null) {
$this->loadData();
}
$updateRow = null;
foreach ($this->_data as $index => $row) {
if ($row['id'] === $id) {
$updateRow =& $this->_data[$index];
}
}
if ($updateRow !== null) {
$updateRow['name'] = $name;
$updateRow['quantity'] = TPropertyValue::ensureInteger($quantity);
$updateRow['price'] = TPropertyValue::ensureFloat($price);
$updateRow['imported'] = TPropertyValue::ensureBoolean($imported);
$this->saveData();
}
}
示例6: updateBook
protected function updateBook($isbn, $title, $publisher, $price, $instock, $rating)
{
// In real applications, data should be saved to database using an SQL UPDATE statement
if ($this->_data === null) {
$this->loadData();
}
$updateRow = null;
foreach ($this->_data as $index => $row) {
if ($row['ISBN'] === $isbn) {
$updateRow =& $this->_data[$index];
}
}
if ($updateRow !== null) {
$updateRow['title'] = $title;
$updateRow['publisher'] = $publisher;
$updateRow['price'] = TPropertyValue::ensureFloat(ltrim($price, '$'));
$updateRow['instock'] = TPropertyValue::ensureBoolean($instock);
$updateRow['rating'] = TPropertyValue::ensureInteger($rating);
$this->saveData();
}
}
示例7: remove
public function remove($key, $priority = false)
{
if (!$this->_r) {
if ($priority === null) {
$priority = $this->getDefaultPriority();
}
if ($priority === false) {
$this->sortPriorities();
foreach ($this->_d as $priority => $items) {
if (array_key_exists($key, $items)) {
$value = $this->_d[$priority][$key];
unset($this->_d[$priority][$key]);
$this->_c--;
if (count($this->_d[$priority]) === 0) {
unset($this->_d[$priority]);
$this->_o = false;
}
$this->_fd = null;
return $value;
}
}
return null;
} else {
$priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p);
if (isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority]))) {
$value = $this->_d[$priority][$key];
unset($this->_d[$priority][$key]);
$this->_c--;
if (count($this->_d[$priority]) === 0) {
unset($this->_d[$priority]);
$this->_o = false;
}
$this->_fd = null;
return $value;
} else {
return null;
}
}
} else {
throw new TInvalidOperationException('map_readonly', get_class($this));
}
}
示例8: setTimeStamp
/**
* Sets the date for the date picker using timestamp.
* @param float time stamp for the date picker
*/
public function setTimeStamp($value)
{
if ($value === null || is_string($value) && trim($value) === '') {
$this->setText('');
} else {
$date = TPropertyValue::ensureFloat($value);
$formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $this->getDateFormat());
$this->setText($formatter->format($date));
}
}
示例9: removeAtIndexInPriority
/**
* Removes the item at a specific index within a priority. Override
* and call this method to insert your own functionality.
* @param integer index of item to remove within the priority.
* @param numeric priority of the item to remove, defaults to null, or left blank, it is then set to the default priority
* @return mixed the removed item.
* @throws TInvalidDataValueException If the item does not exist
*/
public function removeAtIndexInPriority($index, $priority = null)
{
if ($this->getReadOnly()) {
throw new TInvalidOperationException('list_readonly', get_class($this));
}
if ($priority === null) {
$priority = $this->getDefaultPriority();
}
$priority = (string) round(TPropertyValue::ensureFloat($priority), $this->_p);
if (!isset($this->_d[$priority]) || $index < 0 || $index >= count($this->_d[$priority])) {
throw new TInvalidDataValueException('list_item_inexistent');
}
// $value is an array of elements removed, only one
$value = array_splice($this->_d[$priority], $index, 1);
$value = $value[0];
if (!count($this->_d[$priority])) {
unset($this->_d[$priority]);
}
$this->_c--;
$this->_fd = null;
return $value;
}
示例10: setRating
/**
* @param float rating value, also sets the selected Index
*/
public function setRating($value)
{
$value = TPropertyValue::ensureFloat($value);
$this->setViewState('Rating', $value, null);
$index = $this->getRatingIndex($value);
parent::setSelectedIndex($index);
}
示例11: setFrequency
/**
* @param float maximum delay (in seconds) before requesting a suggestion.
* Default is 0.4.
*/
public function setFrequency($value)
{
$this->setViewState('frequency', TPropertyValue::ensureFloat($value), '');
}
示例12: setMinSavings
/**
* @param float minimum amount of savings to actually store the value compressed
* @throws TInvalidOperationException if the module is already initialized
*/
public function setMinSavings($value)
{
if ($this->_initialized) {
throw new TInvalidOperationException('memcache_min_savings_unchangeable');
} else {
$this->_minSavings = TPropertyValue::ensureFloat($value);
}
}
示例13: setValue
/**
* @param float current value of slider
*/
public function setValue($value)
{
$this->setViewState('Value', TPropertyValue::ensureFloat($value), 0.0);
}
示例14: setOpacity
/**
* Set the opacity on a html element or control.
* @param TControl control element or element id
* @param float opacity value between 1 and 0
*/
public function setOpacity($element, $value)
{
if ($element instanceof ISurroundable) {
$element = $element->getSurroundingTagID();
}
$value = TPropertyValue::ensureFloat($value);
$this->callClientFunction('Element.setOpacity', array($element, $value));
}
示例15: fadeTo
/**
* Set the opacity on a html element or control.
* This effect doesn't need jQueryUI.
* @param TControl control element or element id
* @param float opacity value between 1 and 0
*/
public function fadeTo($element, $value, $duration = 500)
{
$value = TPropertyValue::ensureFloat($value);
$this->visualEffect('fadeTo', $element, array($duration, $value));
}