本文整理汇总了PHP中TPropertyValue::ensureInteger方法的典型用法代码示例。如果您正苦于以下问题:PHP TPropertyValue::ensureInteger方法的具体用法?PHP TPropertyValue::ensureInteger怎么用?PHP TPropertyValue::ensureInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPropertyValue
的用法示例。
在下文中一共展示了TPropertyValue::ensureInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPageSize
private function getPageSize()
{
if (($limit = TPropertyValue::ensureInteger($this->Request['limit'])) <= 0) {
$limit = TPropertyValue::ensureInteger($this->Application->Parameters['PostPerPage']);
}
return $limit;
}
示例2: setTimeStamp
public function setTimeStamp($value)
{
$ts = TPropertyValue::ensureInteger($value);
$this->DatePicker->TimeStamp = $ts;
$this->HourPicker->SelectedValue = date('H', $ts);
$this->MinutePicker->SelectedValue = date('i', $ts);
}
示例3: setTotalRowCount
public function setTotalRowCount($value)
{
if (($value = TPropertyValue::ensureInteger($value)) < 0) {
$value = 0;
}
$this->_totalRowCount = $value;
}
示例4: 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));
}
}
示例5: 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}";
}
示例6: changePageSize
public function changePageSize($sender, $param)
{
$this->DataGrid->PageSize = TPropertyValue::ensureInteger($this->PageSize->Text);
$this->DataGrid->CurrentPageIndex = 0;
$this->DataGrid->DataSource = $this->Data;
$this->DataGrid->dataBind();
}
示例7: setHistorySize
/**
* @param integer maximum number of page states that should be kept in session
* @throws TInvalidDataValueException if the number is smaller than 1.
*/
public function setHistorySize($value)
{
if (($value = TPropertyValue::ensureInteger($value)) > 0) {
$this->_historySize = $value;
} else {
throw new TInvalidDataValueException('sessionpagestatepersister_historysize_invalid');
}
}
示例8: getCategoryFilter
private function getCategoryFilter()
{
if (($catID = $this->Request['cat']) !== null) {
$catID = TPropertyValue::ensureInteger($catID);
return "category_id={$catID}";
} else {
return '';
}
}
示例9: onInit
public function onInit($param)
{
parent::onInit($param);
$id = TPropertyValue::ensureInteger($this->Request['id']);
$this->_category = $this->DataAccess->queryCategoryByID($id);
if ($this->_category === null) {
throw new BlogException(500, 'category_id_invalid', $id);
}
}
示例10: saveItem
public function saveItem($sender, $param)
{
$item = $param->Item;
$postID = $this->PostGrid->DataKeys[$item->ItemIndex];
$postRecord = $this->DataAccess->queryPostByID($postID);
$postRecord->Status = TPropertyValue::ensureInteger($item->Cells[2]->PostStatus->SelectedValue);
$this->DataAccess->updatePost($postRecord);
$this->PostGrid->EditItemIndex = -1;
$this->bindData();
}
示例11: saveItem
public function saveItem($sender, $param)
{
$item = $param->Item;
$userID = $this->UserGrid->DataKeys[$item->ItemIndex];
$userRecord = $this->DataAccess->queryUserByID($userID);
$userRecord->Role = TPropertyValue::ensureInteger($item->Cells[1]->UserRole->SelectedValue);
$userRecord->Status = TPropertyValue::ensureInteger($item->Cells[2]->UserStatus->SelectedValue);
$this->DataAccess->updateUser($userRecord);
$this->UserGrid->EditItemIndex = -1;
$this->bindData();
}
示例12: selectLevel
public function selectLevel($sender, $param)
{
if (($selection = $this->LevelSelection->SelectedValue) === '') {
$this->LevelError->Visible = true;
return;
} else {
$this->Level = TPropertyValue::ensureInteger($selection);
}
$this->Word = $this->generateWord();
$this->GuessWord = str_repeat('_', strlen($this->Word));
$this->Misses = 0;
$this->GameMultiView->ActiveView = $this->GuessView;
}
示例13: onInit
public function onInit($param)
{
parent::onInit($param);
if (($id = $this->Request['id']) !== null) {
$id = TPropertyValue::ensureInteger($id);
} else {
$id = $this->User->ID;
}
if (($this->_userRecord = $this->DataAccess->queryUserByID($id)) === null) {
throw new BlogException(500, 'profile_id_invalid', $id);
}
$this->_userRecord->Email = strtr(strtoupper($this->_userRecord->Email), array('@' => ' at ', '.' => ' dot '));
}
示例14: onLoad
public function onLoad($param)
{
parent::onLoad($param);
$commentLimit = TPropertyValue::ensureInteger($this->Application->Parameters['RecentComments']);
$comments = $this->Application->getModule('data')->queryComments('', 'ORDER BY create_time DESC', "LIMIT {$commentLimit}");
foreach ($comments as $comment) {
$comment->ID = $this->Service->constructUrl('Posts.ViewPost', array('id' => $comment->PostID)) . '#c' . $comment->ID;
if (strlen($comment->Content) > 40) {
$comment->Content = substr($comment->Content, 0, 40) . ' ...';
}
}
$this->CommentList->DataSource = $comments;
$this->CommentList->dataBind();
}
示例15: onInit
public function onInit($param)
{
parent::onInit($param);
if (($id = $this->Request['id']) !== null) {
$id = TPropertyValue::ensureInteger($id);
if (!$this->User->IsAdmin && $this->User->ID !== $id) {
throw new BlogException(500, 'profile_edit_disallowed', $id);
}
} else {
$id = $this->User->ID;
}
if (($this->_userRecord = $this->DataAccess->queryUserByID($id)) === null) {
throw new BlogException(500, 'profile_id_invalid', $id);
}
}