本文整理汇总了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');
}