/** * 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); }
/** * @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()); } if ($this->getInterval() === $value) { return; } $this->setViewState('Interval', $interval, 1); if ($this->getActiveControl()->canUpdateClientSide()) { $client = $this->getPage()->getCallbackClient(); $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', array($this, $interval)); } }
/** * Removes an item from the map by its key. If no priority, or false, is specified * then priority is irrelevant. If null is used as a parameter for priority, then * the priority will be the default priority. If a priority is specified, or * the default priority is specified, only key-value pairs in that priority * will be affected. * @param mixed the key of the item to be removed * @param numeric|false|null priority. False is any priority, null is the * default priority, and numeric is a specific priority * @return mixed the removed value, null if no such key exists. * @throws TInvalidOperationException if the map is read-only */ 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)); } }
/** * 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)); }
/** * @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); }
/** * @param float maximum delay (in seconds) before requesting a suggestion. * Default is 0.4. */ public function setFrequency($value) { $this->setViewState('frequency', TPropertyValue::ensureFloat($value), ''); }
/** * 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 = new TSimpleDateFormatter($this->getDateFormat()); $this->setText($formatter->format($date)); } }
/** * 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; }
/** * @param float current value of slider */ public function setValue($value) { $this->setViewState('Value', TPropertyValue::ensureFloat($value), 0.0); }
/** * @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); } }