/** * 打印warning日志,如果是测试环境,则输出追溯调用的文件和代码行 * @param mixed $event * @param integer $errno * @param string $method * @return void */ public static function warning($event, $errno = 0, $method = '') { self::write('warning', $event, $method, $errno); if (DEBUG) { $wfBackTrace = self::getLogger()->getBackTrace() . "\n<br/>"; $wfBackTrace .= 'err_no[' . $errno . "]\n<br/>"; $wfBackTrace .= 'method[' . $method . "]\n<br/>"; $wfBackTrace .= 'msg[' . (is_array($event) ? serialize($event) : $event) . "]\n<br/>"; Registry::set('warning_backtrace', $wfBackTrace); } }
/** * 获取警告栏ID * @return string */ public function getId() { $id = (int) Registry::get('AlertBar_ID') + 1; Registry::set('AlertBar_ID', $id); return 'alert_bar_' . $id; }
/** * 初始化表单ID * @return \tfc\mvc\form\FormBuilder */ public function initId() { if (isset($this->attributes['id'])) { return $this; } $id = (int) Registry::get('FormBuilder_ID') + 1; Registry::set('FormBuilder_ID', $id); $this->attributes['id'] = 'form_id_' . $id; return $this; }
/** * 将常用数据设置到模板变量中 * @return void */ public function assignSystem() { $viw = Mvc::getView(); $viw->assign('app', APP_NAME); $viw->assign('module', Mvc::$module); $viw->assign('controller', Mvc::$controller); $viw->assign('action', Mvc::$action); $viw->assign('sidebar', Mvc::$module . '/' . Mvc::$controller . '_sidebar'); $viw->assign('log_id', Log::getId()); $viw->assign('language', Ap::getLanguageType()); if (($wfBackTrace = Registry::get('warning_backtrace')) !== null) { $viw->assign('warning_backtrace', $wfBackTrace); } }
/** * 将常用数据设置到模板变量中 * @return void */ public function assignSystem() { $viw = Mvc::getView(); $viw->assign('app', APP_NAME); $viw->assign('module', Mvc::$module); $viw->assign('controller', Mvc::$controller); $viw->assign('action', Mvc::$action); $viw->assign('sidebar', Mvc::$module . '/' . Mvc::$action . '_sidebar'); $viw->assign('log_id', Log::getId()); $viw->assign('language', Ap::getLanguageType()); $viw->assign('urlHelper', UrlHelper::getInstance()); $viw->assign('site_name', Options::getSiteName()); if (!isset($viw->meta_title)) { $viw->assign('meta_title', Options::getMetaTitle()); } if (!isset($viw->meta_keywords)) { $viw->assign('meta_keywords', Options::getMetaKeywords()); } if (!isset($viw->meta_description)) { $viw->assign('meta_description', Options::getMetaDescription()); } $viw->assign('powerby', Options::getPowerby()); $viw->assign('stat_code', Options::getStatCode()); if (($wfBackTrace = Registry::get('warning_backtrace')) !== null) { $viw->assign('warning_backtrace', $wfBackTrace); } }