ensureBoolean() public static method

Note, string 'true' (case-insensitive) will be converted to true, string 'false' (case-insensitive) will be converted to false. If a string represents a non-zero number, it will be treated as true.
public static ensureBoolean ( $value ) : boolean
return boolean
示例#1
0
 /**
  * Initialize the TTranslate translation components
  */
 public static function init($catalogue = 'messages')
 {
     static $saveEventHandlerAttached = false;
     //initialized the default class wide formatter
     if (!isset(self::$formatters[$catalogue])) {
         $app = Prado::getApplication()->getGlobalization();
         $config = $app->getTranslationConfiguration();
         $source = MessageSource::factory($config['type'], $config['source'], $config['filename']);
         $source->setCulture($app->getCulture());
         if (isset($config['cache'])) {
             $source->setCache(new MessageCache($config['cache']));
         }
         self::$formatters[$catalogue] = new MessageFormat($source, $app->getCharset());
         //mark untranslated text
         if ($ps = $config['marker']) {
             self::$formatters[$catalogue]->setUntranslatedPS(array($ps, $ps));
         }
         //save the message on end request
         // Do it only once !
         if (!$saveEventHandlerAttached && TPropertyValue::ensureBoolean($config['autosave'])) {
             Prado::getApplication()->attachEventHandler('OnEndRequest', array('Translation', 'saveMessages'));
             $saveEventHandlerAttached = true;
         }
     }
 }
示例#2
0
 protected function createBooleanControl($container, $column, $record)
 {
     $value = $this->getRecordPropertyValue($column, $record);
     $control = new TCheckBox();
     $control->setChecked(TPropertyValue::ensureBoolean($value));
     $control->setCssClass('boolean-checkbox');
     $this->setDefaultProperty($container, $control, $column, $record);
     return $control;
 }
 public function __construct($dropParams)
 {
     $this->_dragElementId = $dropParams->DragElementID;
     $this->_screenX = $dropParams->ScreenX;
     $this->_screenY = $dropParams->ScreenY;
     $this->_offsetX = isset($dropParams->OffsetX) ? $dropParams->OffsetX : false;
     $this->_offsetY = isset($dropParams->OffsetY) ? $dropParams->OffsetY : false;
     $this->_clientX = $dropParams->ClientX;
     $this->_clientY = $dropParams->ClientY;
     $this->_shiftKey = TPropertyValue::ensureBoolean($dropParams->ShiftKey);
     $this->_ctrlKey = TPropertyValue::ensureBoolean($dropParams->CtrlKey);
     $this->_altKey = TPropertyValue::ensureBoolean($dropParams->AltKey);
 }
示例#4
0
 /**
  * @param boolean sets whether buffering of output can continue after this point
  */
 public function setContinueBuffering($value)
 {
     $this->_continueBuffering = TPropertyValue::ensureBoolean($value);
 }
 /**
  * @param boolean whether navigation to the next step should be canceled.
  */
 public function setCancelNavigation($value)
 {
     $this->_cancel = TPropertyValue::ensureBoolean($value);
 }
示例#6
0
 /**
  * @param boolean whether the connection is persistent or not
  * Some DBMS (such as sqlite) may not support this feature.
  */
 public function setPersistent($value)
 {
     return $this->setAttribute(PDO::ATTR_PERSISTENT, TPropertyValue::ensureBoolean($value));
 }
示例#7
0
 /**
  * Sets the value indicating whether the text content wraps within a multiline text box.
  * @param boolean whether the text content wraps within a multiline text box.
  */
 public function setWrap($value)
 {
     $this->setViewState('Wrap', TPropertyValue::ensureBoolean($value), true);
 }
 /**
  * @param boolean whether the subdirectories of the directory will also be checked.
  */
 public function setRecursiveCheck($value)
 {
     $this->_recursiveCheck = TPropertyValue::ensureBoolean($value);
 }
示例#9
0
 /**
  * @param boolean whether the item is selected
  */
 public function setSelected($value)
 {
     $this->_selected = TPropertyValue::ensureBoolean($value);
 }
示例#10
0
 /**
  * @param bool wether this control is valid.
  */
 public function setIsValid($value)
 {
     $this->_isValid = TPropertyValue::ensureBoolean($value);
 }
示例#11
0
 /**
  * Sets a value indicating whether cached output will be used on postback requests.
  * By default, this is disabled. Be very cautious when enabling it.
  * If the cached content including interactive user controls such as
  * TTextBox, TDropDownList, your page may fail to render on postbacks.
  * @param boolean whether cached output will be used on postback requests.
  */
 public function setCachingPostBack($value)
 {
     $this->_cachePostBack = TPropertyValue::ensureBoolean($value);
 }
示例#12
0
 /**
  * Sets the value indicating whether the content wraps within the table item.
  * @param boolean whether the content wraps within the panel.
  */
 public function setWrap($value)
 {
     $this->_wrap = TPropertyValue::ensureBoolean($value);
 }
示例#13
0
 /**
  * Set true to cache sqlmap instances.
  * @param boolean true to cache sqlmap instance.
  */
 public function setEnableCache($value)
 {
     $this->_enableCache = TPropertyValue::ensureBoolean($value);
 }
示例#14
0
 /**
  * @param boolean whether postback event trigger by this button will cause input validation
  */
 public function setCausesValidation($value)
 {
     $this->setViewState('CausesValidation', TPropertyValue::ensureBoolean($value), true);
 }
示例#15
0
 /**
  * @param boolean whether the keys are case-sensitive.
  */
 public function setCaseSensitive($value)
 {
     $this->_caseSensitive = TPropertyValue::ensureBoolean($value);
 }
示例#16
0
 /**
  * @param boolean whether the pager is visible.
  */
 public function setVisible($value)
 {
     $this->_visible = TPropertyValue::ensureBoolean($value);
 }
示例#17
0
 /**
  * Sets a value indicating whether a databind call is required by the data bound control.
  * If true and the control has been prerendered while it uses the data source
  * specified by {@link setDataSourceID}, a databind call will be called by this method.
  * @param boolean whether a databind call is required.
  */
 protected function setRequiresDataBinding($value)
 {
     $value = TPropertyValue::ensureBoolean($value);
     if ($value && $this->_prerendered) {
         $this->_requiresDataBinding = true;
         $this->ensureDataBound();
     } else {
         $this->_requiresDataBinding = $value;
     }
 }
示例#18
0
 /**
  * @param boolean whether there should be a visual separator between the frames.
  */
 public function setShowBorder($value)
 {
     $this->setViewState('ShowBorder', TPropertyValue::ensureBoolean($value), true);
 }
示例#19
0
 /**
  * Wrapper for {@link setReadOnly ReadOnly} property.
  * @param boolean whether the rating list can be edited
  */
 public function setEnabled($value)
 {
     $this->setReadOnly(!TPropertyValue::ensureBoolean($value));
 }
示例#20
0
 /**
  * @param boolean whether this tab view is active.
  */
 public function setActive($value)
 {
     $this->_active = TPropertyValue::ensureBoolean($value);
 }
示例#21
0
文件: TPage.php 项目: pradosoft/prado
 /**
  * @param boolean whether page state should be compressed.
  * @since 3.1.6
  */
 public function setEnableStateCompression($value)
 {
     $this->_enableStateCompression = TPropertyValue::ensureBoolean($value);
 }
示例#22
0
 /**
  * @param boolean true to allow fine grain callback updates.
  */
 public function setEnableUpdate($value)
 {
     $this->setOption('EnableUpdate', TPropertyValue::ensureBoolean($value), true);
 }
示例#23
0
 /**
  * @param bool whether to flush script files using TClientScriptManager::flushScriptFiles() before rendering the script block
  */
 public function setFlushScriptFiles($value)
 {
     $this->setViewState('FlushScriptFiles', TPropertyValue::ensureBoolean($value));
 }
示例#24
0
 /**
  * Set the option to trim the contents.
  * @param boolean trim or not.
  */
 public function setTrim($value)
 {
     $this->setViewState('Trim', TPropertyValue::ensureBoolean($value), true);
 }
示例#25
0
 /**
  * @param boolean whether this list is read-only or not
  */
 protected function setReadOnly($value)
 {
     $this->_r = TPropertyValue::ensureBoolean($value);
 }
示例#26
0
 /**
  * @param boolean whether the items in the column can be edited
  */
 public function setReadOnly($value)
 {
     $this->setViewState('ReadOnly', TPropertyValue::ensureBoolean($value), false);
 }
示例#27
0
 /**
  * @param boolean whether to render javascript.
  */
 public function setEnableClientScript($value)
 {
     $this->setViewState('EnableClientScript', TPropertyValue::ensureBoolean($value), true);
 }
示例#28
0
 /**
  * @param boolean true to start the timer when page loads.
  */
 public function setStartTimerOnLoad($value)
 {
     $this->setViewState('StartTimerOnLoad', TPropertyValue::ensureBoolean($value), false);
 }
示例#29
0
 /**
  * @param boolean  whether the rendered text should be HTML-encoded.
  */
 public function setEncode($value)
 {
     $this->setViewState('Encode', TPropertyValue::ensureBoolean($value), false);
 }
示例#30
0
 /**
  * @param boolean whether this step can be re-visited.
  */
 public function setAllowReturn($value)
 {
     $this->setViewState('AllowReturn', TPropertyValue::ensureBoolean($value), true);
 }