Example #1
0
 /**
  * 检查用户是否登录,如果没有登录,跳转到登录页面
  * @return void
  */
 protected function _isLogin()
 {
     if (!$this->_validLogin) {
         return;
     }
     if (Identity::isLogin()) {
         return;
     }
     $this->display(array('err_no' => ErrorNo::ERROR_NO_LOGIN, 'err_msg' => libapp\Lang::_('ERROR_MSG_ERROR_NO_LOGIN')));
 }
Example #2
0
 /**
  * 检查用户是否登录,如果没有登录,跳转到登录页面
  * @return void
  */
 protected function _isLogin()
 {
     if (!$this->_validLogin) {
         return;
     }
     if (Identity::isLogin()) {
         return;
     }
     $this->toLogin();
 }
Example #3
0
 /**
  * (non-PHPdoc)
  * @see \tfc\mvc\Widget::run()
  */
 public function run()
 {
     $output = '';
     $html = $this->getHtml();
     $config = Cfg::getApp('navbar');
     foreach ($config as $menus) {
         $main = array_shift($menus);
         if (!is_array($main)) {
             continue;
         }
         // 主菜单
         if (!$menus) {
             $output .= $html->tag('li', $this->getAttributes($main, false), $this->a($main)) . "\n";
             continue;
         }
         // 主菜单外开始标签
         $output .= $html->openTag('li', $this->getAttributes($main, true)) . "\n";
         $output .= $this->a($main, true) . "\n";
         // 下拉子菜单外开始标签
         $output .= $html->openTag('ul', array('class' => 'dropdown-menu')) . "\n";
         // 下拉子菜单列表
         $total = count($menus);
         $curr = 0;
         foreach ($menus as $menu) {
             $output .= $html->tag('li', array(), $this->a($menu)) . "\n";
             if (++$curr < $total) {
                 $output .= $html->tag('li', array('class' => 'divider'), '') . "\n";
             }
         }
         // 下拉子菜单外结束标签
         $output .= $html->closeTag('ul') . "\n";
         // 主菜单外结束标签
         $output .= $html->closeTag('li') . "\n";
     }
     $this->assign('is_login', Identity::isLogin());
     $this->assign('user_id', Identity::getUserId());
     $this->assign('login_name', Identity::getLoginName());
     $this->assign('user_name', Identity::getNickname());
     $this->assign('app_names', Identity::getAppNames());
     $this->assign('menus', $output);
     $this->assign('logout', $this->getView()->CFG_SYSTEM_GLOBAL_LOGOUT);
     $this->display();
 }
Example #4
0
 /**
  * 递归获取指定类型下的所有菜单
  * @param string $typeKey
  * @param integer $menuPid
  * @return array
  */
 public static function findRows($typeKey, $menuPid = 0)
 {
     $allowUnregistered = Identity::isLogin() ? true : false;
     $rows = self::getService()->findRows($typeKey, $menuPid, $allowUnregistered);
     return $rows;
 }
Example #5
0
 /**
  * 将会员账户信息设置到模板变量中
  * @return void
  */
 public function assignAccount()
 {
     $viw = Mvc::getView();
     $viw->assign('is_login', Identity::isLogin());
     $viw->assign('member_id', Identity::getUserId());
     $viw->assign('login_name', Identity::getLoginName());
     $viw->assign('member_name', Identity::getNickname());
     $viw->assign('type_id', Identity::getTypeId());
     $viw->assign('rank_id', Identity::getRankId());
 }