本文整理汇总了PHP中TPropertyValue::ensureBoolean方法的典型用法代码示例。如果您正苦于以下问题:PHP TPropertyValue::ensureBoolean方法的具体用法?PHP TPropertyValue::ensureBoolean怎么用?PHP TPropertyValue::ensureBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPropertyValue
的用法示例。
在下文中一共展示了TPropertyValue::ensureBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveButtonClicked
public function saveButtonClicked($sender, $param)
{
if ($this->IsValid) {
$postRecord = new PostRecord();
$postRecord->Title = $this->Title->SafeText;
$postRecord->Content = $this->Content->SafeText;
if ($this->DraftMode->Checked) {
$postRecord->Status = PostRecord::STATUS_DRAFT;
} else {
if (!$this->User->IsAdmin && TPropertyValue::ensureBoolean($this->Application->Parameters['PostApproval'])) {
$postRecord->Status = PostRecord::STATUS_PENDING;
} else {
$postRecord->Status = PostRecord::STATUS_PUBLISHED;
}
}
$postRecord->CreateTime = time();
$postRecord->ModifyTime = $postRecord->CreateTime;
$postRecord->AuthorID = $this->User->ID;
$cats = array();
foreach ($this->Categories->SelectedValues as $value) {
$cats[] = TPropertyValue::ensureInteger($value);
}
$this->DataAccess->insertPost($postRecord, $cats);
$this->gotoPage('Posts.ViewPost', array('id' => $postRecord->ID));
}
}
示例2: init
/**
* 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 (TPropertyValue::ensureBoolean($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;
}
}
}
示例3: createBooleanControl
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;
}
示例4: 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();
}
}
示例5: onLoad
public function onLoad($param)
{
parent::onLoad($param);
if (!$this->IsPostBack) {
$parameters = $this->Application->Parameters;
$this->SiteTitle->Text = $parameters['SiteTitle'];
$this->SiteSubtitle->Text = $parameters['SiteSubtitle'];
$this->SiteOwner->Text = $parameters['SiteOwner'];
$this->AdminEmail->Text = $parameters['AdminEmail'];
$this->MultipleUser->Checked = TPropertyValue::ensureBoolean($parameters['MultipleUser']);
$this->AccountApproval->Checked = TPropertyValue::ensureBoolean($parameters['AccountApproval']);
$this->PostPerPage->Text = $parameters['PostPerPage'];
$this->RecentComments->Text = $parameters['RecentComments'];
$this->PostApproval->Checked = TPropertyValue::ensureBoolean($parameters['PostApproval']);
$themes = $this->Service->ThemeManager->AvailableThemes;
$this->ThemeName->DataSource = $themes;
$this->ThemeName->dataBind();
$this->ThemeName->SelectedValue = array_search($parameters['ThemeName'], $themes);
}
}
示例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: createUser
public function createUser($sender, $param)
{
if ($this->IsValid) {
$userRecord = new UserRecord();
$userRecord->Name = strtolower($this->Username->Text);
$userRecord->FullName = $this->FullName->Text;
$userRecord->Role = 0;
$userRecord->Password = md5($this->Password->Text);
$userRecord->Email = $this->Email->Text;
$userRecord->CreateTime = time();
$userRecord->Website = $this->Website->Text;
if (TPropertyValue::ensureBoolean($this->Application->Parameters['AccountApproval'])) {
$userRecord->Status = UserRecord::STATUS_PENDING;
} else {
$userRecord->Status = UserRecord::STATUS_NORMAL;
}
$this->DataAccess->insertUser($userRecord);
$authManager = $this->Application->getModule('auth');
$authManager->login($this->Username->Text, $this->Password->Text);
$this->gotoDefaultPage();
}
}
示例8: setTrim
/**
* Set the option to trim the contents.
* @param boolean trim or not.
*/
public function setTrim($value)
{
$this->setViewState('Trim', TPropertyValue::ensureBoolean($value), true);
}
示例9: setActive
/**
* @param boolean whether this accordion view is active.
*/
public function setActive($value)
{
$this->_active = TPropertyValue::ensureBoolean($value);
}
示例10: setEnablePageStateUpdate
/**
* Set to true to enable the callback response to enable the viewstate
* update. This will automatically set HasPrority to true.
* @param boolean true enables the callback response to update the
* viewstate.
*/
public function setEnablePageStateUpdate($value)
{
$enabled = TPropertyValue::ensureBoolean($value);
$this->setOption('EnablePageStateUpdate', $enabled);
if ($enabled) {
$this->setHasPriority(true);
}
}
示例11: setRecursiveCheck
/**
* @param boolean whether the subdirectories of the directory will also be checked.
*/
public function setRecursiveCheck($value)
{
$this->_recursiveCheck = TPropertyValue::ensureBoolean($value);
}
示例12: setCustomPaging
/**
* @param boolean whether to allow custom paging
*/
public function setCustomPaging($value)
{
$this->_customPaging = TPropertyValue::ensureBoolean($value);
}
示例13: setTranslateDefaultCulture
public function setTranslateDefaultCulture($value)
{
$this->_translateDefaultCulture = TPropertyValue::ensureBoolean($value);
}
示例14: setAutoCreateCacheTable
/**
* @param boolean whether the cache DB table should be automatically created if not exists.
* @see setCacheTableName
*/
public function setAutoCreateCacheTable($value)
{
$this->_autoCreate = TPropertyValue::ensureBoolean($value);
}
示例15: setEnableStateCompression
/**
* @param boolean whether page state should be compressed.
* @since 3.1.6
*/
public function setEnableStateCompression($value)
{
$this->_enableStateCompression = TPropertyValue::ensureBoolean($value);
}