ensureInteger() публичный статический Метод

Converts a value to integer type.
public static ensureInteger ( $value ) : integer
Результат integer
 public function setTotalRowCount($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 0) {
         $value = 0;
     }
     $this->_totalRowCount = $value;
 }
 /**
  * @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');
     }
 }
Пример #3
0
 /**
  * Sets the zero-based index for the item.
  * If the item is not in the item collection (e.g. it is a header item), -1 should be used.
  * @param integer zero-based index of the item.
  */
 public function setItemIndex($value)
 {
     $this->_itemIndex = TPropertyValue::ensureInteger($value);
 }
Пример #4
0
 /**
  * @return integer the number of seconds after which data will be seen as 'garbage' and cleaned up, defaults to 1440 seconds.
  */
 public function getTimeout()
 {
     return TPropertyValue::ensureInteger(ini_get('session.gc_maxlifetime'));
 }
Пример #5
0
 /**
  * @param integer max number of selections.
  */
 public function setMaxSelection($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 0) {
         $value = -1;
     }
     $this->setViewState('MaxSelection', $value, -1);
 }
Пример #6
0
 /**
  * @param integer the line number at which the template has error
  */
 public function setLineNumber($value)
 {
     $this->_lineNumber = TPropertyValue::ensureInteger($value);
 }
Пример #7
0
 /**
  * Sets the number of rows displayed in a multiline text box.
  * @param integer the number of rows
  */
 public function setRows($value)
 {
     $this->setViewState('Rows', TPropertyValue::ensureInteger($value), self::DEFAULT_ROWS);
 }
Пример #8
0
 /**
  * @param integer virtual number of data items in the data source.
  * @throws TInvalidDataValueException if the value is less than 0
  * @see setAllowCustomPaging
  */
 public function setVirtualItemCount($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 0) {
         throw new TInvalidDataValueException('databoundcontrol_virtualitemcount_invalid', get_class($this));
     }
     $this->setViewState('VirtualItemCount', $value, 0);
 }
Пример #9
0
 /**
  * @param integer the Y coordinate of the top side of the rectangle HotSpot region.
  */
 public function setTop($value)
 {
     $this->setViewState('Top', TPropertyValue::ensureInteger($value), 0);
 }
Пример #10
0
 /**
  * Sets the rowspan for the table cell.
  * @param integer the rowspan for the table cell, 0 if not set.
  */
 public function setRowSpan($value)
 {
     $this->setViewState('RowSpan', TPropertyValue::ensureInteger($value), 0);
 }
Пример #11
0
 /**
  * @param integer tab size
  */
 public function setTabSize($value)
 {
     $this->setViewState('TabSize', TPropertyValue::ensureInteger($value));
 }
Пример #12
0
 /**
  * This method overrides parent's implementation to handle
  * {@link onItemCommand OnItemCommand} event which is bubbled from
  * {@link TDataGridItem} child controls.
  * If the event parameter is {@link TDataGridCommandEventParameter} and
  * the command name is a recognized one, which includes 'select', 'edit',
  * 'delete', 'update', and 'cancel' (case-insensitive), then a
  * corresponding command event is also raised (such as {@link onEditCommand OnEditCommand}).
  * This method should only be used by control developers.
  * @param TControl the sender of the event
  * @param TEventParameter event parameter
  * @return boolean whether the event bubbling should stop here.
  */
 public function bubbleEvent($sender, $param)
 {
     if ($param instanceof TDataGridCommandEventParameter) {
         $this->onItemCommand($param);
         $command = $param->getCommandName();
         if (strcasecmp($command, self::CMD_SELECT) === 0) {
             $this->setSelectedItemIndex($param->getItem()->getItemIndex());
             $this->onSelectedIndexChanged($param);
             return true;
         } else {
             if (strcasecmp($command, self::CMD_EDIT) === 0) {
                 $this->onEditCommand($param);
                 return true;
             } else {
                 if (strcasecmp($command, self::CMD_DELETE) === 0) {
                     $this->onDeleteCommand($param);
                     return true;
                 } else {
                     if (strcasecmp($command, self::CMD_UPDATE) === 0) {
                         $this->onUpdateCommand($param);
                         return true;
                     } else {
                         if (strcasecmp($command, self::CMD_CANCEL) === 0) {
                             $this->onCancelCommand($param);
                             return true;
                         } else {
                             if (strcasecmp($command, self::CMD_SORT) === 0) {
                                 $this->onSortCommand(new TDataGridSortCommandEventParameter($sender, $param));
                                 return true;
                             } else {
                                 if (strcasecmp($command, self::CMD_PAGE) === 0) {
                                     $p = $param->getCommandParameter();
                                     if (strcasecmp($p, self::CMD_PAGE_NEXT) === 0) {
                                         $pageIndex = $this->getCurrentPageIndex() + 1;
                                     } else {
                                         if (strcasecmp($p, self::CMD_PAGE_PREV) === 0) {
                                             $pageIndex = $this->getCurrentPageIndex() - 1;
                                         } else {
                                             if (strcasecmp($p, self::CMD_PAGE_FIRST) === 0) {
                                                 $pageIndex = 0;
                                             } else {
                                                 if (strcasecmp($p, self::CMD_PAGE_LAST) === 0) {
                                                     $pageIndex = $this->getPageCount() - 1;
                                                 } else {
                                                     $pageIndex = TPropertyValue::ensureInteger($p) - 1;
                                                 }
                                             }
                                         }
                                     }
                                     $this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender, $pageIndex));
                                     return true;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
Пример #13
0
 /**
  * @param integer callback request timeout
  */
 public function setRequestTimeOut($value)
 {
     $this->setOption('RequestTimeOut', TPropertyValue::ensureInteger($value));
 }
Пример #14
0
 /**
  * @param integer the zero-based index of the current view in the view collection. -1 if no active view.
  * @throws TInvalidDataValueException if the view index is invalid
  */
 public function setActiveViewIndex($value)
 {
     $this->setViewState('ActiveViewIndex', TPropertyValue::ensureInteger($value), 0);
 }
Пример #15
0
 /**
  * @param integer how many times a generated token can be tested. For unlimited tests, set it to 0.
  */
 public function setTestLimit($value)
 {
     $this->setViewState('TestLimit', TPropertyValue::ensureInteger($value), 5);
 }
Пример #16
0
 /**
  * @param integer user-assigned number of items in data source
  */
 public function setVirtualItemCount($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) >= 0) {
         $this->_virtualCount = $value;
     } else {
         throw new TInvalidDataValueException('pageddatasource_virtualitemcount_invalid');
     }
 }
Пример #17
0
 /**
  * @param integer minimum number of characters before requesting a suggestion.
  */
 public function setMinChars($value)
 {
     $this->setViewState('minChars', TPropertyValue::ensureInteger($value), '');
 }
Пример #18
0
 /**
  * @param integer the number of columns that the repeated items should be displayed in.
  */
 public function setRepeatColumns($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 0) {
         throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid');
     }
     $this->_repeatColumns = $value;
 }
 /**
  * @param integer the zero-based index of the next step.
  */
 public function setNextStepIndex($index)
 {
     $this->_nextStep = TPropertyValue::ensureInteger($index);
 }
Пример #20
0
 /**
  * Processes the events bubbled from child controls.
  * The method handles view-related command events.
  * @param TControl sender of the event
  * @param mixed event parameter
  * @return boolean whether this event is handled
  */
 public function bubbleEvent($sender, $param)
 {
     if (!$this->_ignoreBubbleEvents && $param instanceof \Prado\Web\UI\TCommandEventParameter) {
         switch ($param->getCommandName()) {
             case self::CMD_NEXTVIEW:
                 if (($index = $this->getActiveViewIndex()) < $this->getViews()->getCount() - 1) {
                     $this->setActiveViewIndex($index + 1);
                 } else {
                     $this->setActiveViewIndex(-1);
                 }
                 return true;
             case self::CMD_PREVIOUSVIEW:
                 if (($index = $this->getActiveViewIndex()) >= 0) {
                     $this->setActiveViewIndex($index - 1);
                 }
                 return true;
             case self::CMD_SWITCHVIEWID:
                 $view = $this->findControl($viewID = $param->getCommandParameter());
                 if ($view !== null && $view->getParent() === $this) {
                     $this->setActiveView($view);
                     return true;
                 } else {
                     throw new TInvalidDataValueException('multiview_viewid_invalid', $viewID);
                 }
             case self::CMD_SWITCHVIEWINDEX:
                 $index = TPropertyValue::ensureInteger($param->getCommandParameter());
                 $this->setActiveViewIndex($index);
                 return true;
         }
     }
     return false;
 }
Пример #21
0
 /**
  * @param int change the rating selection index
  */
 public function onSelectedIndexChanged($param)
 {
     $value = $this->getRating();
     $value = TPropertyValue::ensureInteger($value);
     $this->setRating($value);
     parent::onSelectedIndexChanged($param);
 }
Пример #22
0
 /**
  * Processes a bubbled event.
  * This method overrides parent's implementation by wrapping event parameter
  * for <b>OnCommand</b> event with item information.
  * @param TControl the sender of the event
  * @param TEventParameter event parameter
  * @return boolean whether the event bubbling should stop here.
  */
 public function bubbleEvent($sender, $param)
 {
     if ($param instanceof \Prado\Web\UI\TCommandEventParameter) {
         $command = $param->getCommandName();
         if (strcasecmp($command, self::CMD_PAGE) === 0) {
             $pageIndex = TPropertyValue::ensureInteger($param->getCommandParameter()) - 1;
             $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
             return true;
         } else {
             if (strcasecmp($command, self::CMD_PAGE_NEXT) === 0) {
                 $pageIndex = $this->getCurrentPageIndex() + 1;
                 $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
                 return true;
             } else {
                 if (strcasecmp($command, self::CMD_PAGE_PREV) === 0) {
                     $pageIndex = $this->getCurrentPageIndex() - 1;
                     $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $pageIndex));
                     return true;
                 } else {
                     if (strcasecmp($command, self::CMD_PAGE_FIRST) === 0) {
                         $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, 0));
                         return true;
                     } else {
                         if (strcasecmp($command, self::CMD_PAGE_LAST) === 0) {
                             $this->onPageIndexChanged(new TPagerPageChangedEventParameter($sender, $this->getPageCount() - 1));
                             return true;
                         }
                     }
                 }
             }
         }
         return false;
     } else {
         return false;
     }
 }
Пример #23
0
 /**
  * @param integer number of seconds that the data can remain in cache. If 0, it means data is not cached.
  * @throws TInvalidDataValueException if the value is smaller than 0.
  */
 public function setDuration($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 0) {
         throw new TInvalidDataValueException('outputcache_duration_invalid', get_class($this));
     }
     $this->_duration = $value;
 }
Пример #24
0
 /**
  * Raises the postback event.
  * This method is required by {@link IPostBackEventHandler} interface.
  * This method is mainly used by framework and control developers.
  * @param TEventParameter the event parameter
  */
 public function raisePostBackEvent($param)
 {
     $postBackValue = null;
     if ($param !== '') {
         $index = TPropertyValue::ensureInteger($param);
         $hotspots = $this->getHotSpots();
         if ($index >= 0 && $index < $hotspots->getCount()) {
             $hotspot = $hotspots->itemAt($index);
             if (($mode = $hotspot->getHotSpotMode()) === THotSpotMode::NotSet) {
                 $mode = $this->getHotSpotMode();
             }
             if ($mode === THotSpotMode::PostBack) {
                 $postBackValue = $hotspot->getPostBackValue();
                 if ($hotspot->getCausesValidation()) {
                     $this->getPage()->validate($hotspot->getValidationGroup());
                 }
             }
         }
     }
     if ($postBackValue !== null) {
         $this->onClick(new TImageMapEventParameter($postBackValue));
     }
 }
Пример #25
0
 /**
  * Sets a value indicating the depth of the subdirectories to be checked.
  * This is meaningful only when {@link getRecursiveCheck RecursiveCheck}
  * is true.
  * @param int the depth of the subdirectories to be checked.
  * If the value is less than 0, it means unlimited depth.
  * If the value is 0, it means checking the files directly under the specified directory.
  */
 public function setRecursiveLevel($value)
 {
     $this->_recursiveLevel = TPropertyValue::ensureInteger($value);
 }
Пример #26
0
 /**
  * @param integer maximum number of pager buttons to be displayed
  * @throws TInvalidDataValueException if the value is less than 1.
  */
 public function setPageButtonCount($value)
 {
     if (($value = TPropertyValue::ensureInteger($value)) < 1) {
         throw new TInvalidDataValueException('datagridpagerstyle_pagebuttoncount_invalid');
     }
     $this->_buttonCount = $value;
 }
Пример #27
0
 /**
  * This must be called internally or when instantiated.
  * @param integer The precision of numeric priorities.
  */
 protected function setPrecision($value)
 {
     $this->_p = TPropertyValue::ensureInteger($value);
 }
Пример #28
0
 /**
  * @param integer Y coordinate of the clicking point
  */
 public function setY($value)
 {
     $this->_y = TPropertyValue::ensureInteger($value);
 }
Пример #29
0
 /**
  * The columnIndex attribute value is the index of the column in the
  * ResultSet from which the value will be used to populate the object property.
  * @param int index of the column in the ResultSet
  */
 public function setColumnIndex($value)
 {
     $this->_columnIndex = TPropertyValue::ensureInteger($value);
 }
Пример #30
0
 /**
  * @param integer the number of rows to be displayed in the list control
  */
 public function setRows($value)
 {
     $value = TPropertyValue::ensureInteger($value);
     if ($value <= 0) {
         $value = 4;
     }
     $this->setViewState('Rows', $value, 4);
 }