當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FOFModel::onAfterGetItem方法代碼示例

本文整理匯總了PHP中FOFModel::onAfterGetItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP FOFModel::onAfterGetItem方法的具體用法?PHP FOFModel::onAfterGetItem怎麽用?PHP FOFModel::onAfterGetItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FOFModel的用法示例。


在下文中一共展示了FOFModel::onAfterGetItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onAfterGetItem

 /**
  * This method runs after an item has been gotten from the database in a read
  * operation. You can modify it before it's returned to the MVC triad for
  * further processing.
  *
  * @param   FOFTable  &$record  The table instance we fetched
  *
  * @return  void
  */
 protected function onAfterGetItem(&$record)
 {
     parent::onAfterGetItem($record);
     if ($record->sdate == '0000-00-00') {
         $record->sdate = '';
     }
     if ($record->edate == '0000-00-00') {
         $record->edate = '';
     }
     if (strpos($record->sdate, '-') !== false) {
         list($y, $m, $d) = explode('-', $record->sdate);
         $record->sdate = $d . '.' . $m . '.' . $y;
     }
     if (strpos($record->edate, '-') !== false) {
         list($y, $m, $d) = explode('-', $record->edate);
         $record->edate = $d . '.' . $m . '.' . $y;
     }
     if ($record->stimeset == 1) {
         list($stimehh, $stimemm) = explode(":", $record->stime);
         $record->stimehh = (int) $stimehh;
         $record->stimemm = (int) $stimemm;
     }
     if ($record->etimeset == 1) {
         list($etimehh, $etimemm) = explode(":", $record->etime);
         $record->etimehh = (int) $etimehh;
         $record->etimemm = (int) $etimemm;
     }
     $categories = $this->getCategories();
     $record->category_title = '';
     if (array_key_exists($record->catid, $categories)) {
         $record->category_title = $categories[$record->catid]->title;
     }
     // Add some fields to the know fields array; Needed because in the controller NOT know fields are removed
     $record->addKnownField('stimehh');
     $record->addKnownField('stimemm');
     $record->addKnownField('etimehh');
     $record->addKnownField('etimemm');
 }
開發者ID:rdeutz,項目名稱:babioon-event,代碼行數:47,代碼來源:events.php


注:本文中的FOFModel::onAfterGetItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。