public static function loadPublishedModel($id)
{
$model = Object::model()->findByPk((int) $id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
} else {
if ($model->object_status == ConstantDefine::OBJECT_STATUS_PUBLISHED && $model->object_date <= time()) {
return $model;
} else {
throw new CHttpException(404, 'The requested page does not exist.');
}
}
}