public function _initialize() { parent::_initialize(); $this->_name = $this->getActionName(); $priv_array = array('index', 'add', 'edit', 'delete'); if (in_array(ACTION_NAME, $priv_array)) { $this->check_priv(); } $this->menuid = input('request.menuid', 'trim', 0); if ($this->menuid) { $sub_menu = D('Menu')->sub_menu($this->menuid, $this->big_menu); $selected = ''; foreach ((array) $sub_menu as $key => $val) { $sub_menu[$key]['class'] = ''; if (MODULE_NAME == $val['module_name'] && ACTION_NAME == $val['action_name'] && strpos(__SELF__, $val['data'])) { $sub_menu[$key]['class'] = $selected = 'on'; } } if (empty($selected)) { foreach ((array) $sub_menu as $key => $val) { if (MODULE_NAME == $val['module_name'] && ACTION_NAME == $val['action_name']) { $sub_menu[$key]['class'] = 'on'; break; } } } $this->assign('sub_menu', (array) $sub_menu); } $this->assign('menuid', $this->menuid); }
public function _initialize() { parent::_initialize(); //网站状态 if (!C('pin_site_status')) { header('Content-Type:text/html; charset=utf-8'); exit(C('pin_closed_reason')); } //初始化访问者 $this->_init_visitor(); //第三方登陆模块 $this->_assign_oauth(); //网站导航选中 $this->assign('nav_curr', ''); // $this->_index_cate(); }