当前位置: 首页>>代码示例>>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;未经允许,请勿转载。