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