Ejemplo n.º 1
0
Archivo: navbar.php Proyecto: zwq/unpei
    }
}
?>
            <div class="clear"></div>
        </ul>
        <div class="clear"></div>
    </div>   
    <div class="clear"></div>
</div>
<?php 
$route = Yii::app()->controller->getRoute();
if ($route == 'jpdata/vehicle/code') {
    $route = 'jpdata/vehicle/index';
}
$rootID = F::getroot();
$activeMenu = FrontMenu::getMenuIDByRoute($route, $rootID);
?>
<script>
     var curid='<?php 
echo $activeMenu['ID'];
?>
';
    $('.second-icon').each(function(){
        var menuid=$(this).attr('key');
        if(curid==menuid){
         var current=$(this).parent().parent();
          current.addClass('sj');
        }
    })

</script>
Ejemplo n.º 2
0
 /**
  * Performs the pre-action filtering.
  * @param CFilterChain $filterChain the filter chain that the filter is on.
  * @return boolean whether the filtering process should continue and the action should be executed.
  * @throws CHttpException if the user is denied access.
  */
 protected function preFilter($filterChain)
 {
     $itemName = '';
     $controller = $filterChain->controller;
     $action = $filterChain->action;
     /* @var $user CWebUser */
     $user = Yii::app()->getUser();
     //未登陆可访问页面:帮助中心
     $controllerId = strtolower($controller->getId());
     $actionId = strtolower($action->getId());
     if (in_array($controllerId, array('page', 'pay'))) {
         return true;
     }
     //判断用户是否过期
     $ExpirationTime = Yii::app()->user->getExpirationTime();
     if ($ExpirationTime && $ExpirationTime < $_SERVER['REQUEST_TIME']) {
         Yii::app()->user->logout();
     }
     // 是否登录
     if ($user->isGuest) {
         $user->loginRequired();
     }
     //用户配额管理
     $this->operatequota();
     if (isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) == "xmlhttprequest") {
         return true;
         // ajax 请求的处理方式
     } else {
         //self::updatelasttime();
         //判断机构是否登记
         $organID = Yii::app()->user->getOrganID();
         $organ = Organ::model()->findByPk($organID);
         if ($organ->Status == 0) {
             Yii::app()->controller->redirect(array('/user/activation/index'));
         } else {
             if ($organ->Status == 2) {
                 Yii::app()->controller->redirect(array('/user/activecompany/index'));
             }
         }
         //            $identityorganID = Commonmodel::getAuthOrgan();
         //            if (empty($identityorganID['ID']) || empty($identityorganID['OrganName']) || empty($identityorganID['Phone']) || empty($identityorganID['Email'])) {
         //                if (!($controllerId == 'company' && $actionId == 'index')) {
         //                    Yii::app()->controller->redirect(array("/member/company/index"));
         //                }
         //                if ($identityorganID['Identity'] == 1) {
         ////                Yii::app()->controller->red("//site/nopower");
         //                    if (!($controllerId == 'makecompany' && ($actionId == 'index' || $actionId == 'Savedealerorgan'))) {
         //                        Yii::app()->controller->redirect(array("/maker/makecompany/index"));
         //                    }
         //                } elseif ($identityorganID['Identity'] == 2) {
         //                    if (!($controllerId == 'dealercompany' && ($actionId == 'index' || $actionId == 'Savedealerorgan'))) {
         //                        Yii::app()->controller->redirect(array("/dealer/dealercompany/index"));
         //                    }
         //                } elseif ($identityorganID['Identity'] == 3) {
         //                    if (!($controllerId == 'servicecompany' && ($actionId == 'index' || $actionId == 'Saveserviceorgan'))) {
         //                        Yii::app()->controller->redirect(array("/servicer/servicecompany/index"));
         //                    }
         //                }
         // }
         $route = $controller->getRoute();
         $rootID = F::getroot();
         $activeMenu = FrontMenu::getMenuIDByRoute($route, $rootID);
         //url参数
         $urlparams = $_GET;
         $urlparams = array_filter($urlparams);
         if ($activeMenu) {
             //用户日志
             $infos = $this->recordlog($activeMenu['Name']);
             //MongoDB用户操作详细日志
             $oper = F::getoperation($activeMenu['Url'], $info == null, $urlparams);
             if (($mod = $controller->getModule()) !== null) {
                 $item .= strtolower($mod->getId());
                 $cont = strtolower($controller->getId());
                 $item .= "-" . $cont;
                 if (!in_array($item, array('maker-default', 'dealer-default', 'servicer-default'))) {
                     if (Yii::app()->user->isEmploye() && !Yii::app()->user->checkAccess($activeMenu['ID'])) {
                         Yii::app()->controller->render("//site/nopower");
                         Yii::app()->end();
                     }
                 }
             }
         } else {
             $route = $controller->getRoute();
             $urlparams = $_GET;
             $oper = F::getoperation($route, $info == null, $urlparams);
             if (Yii::app()->user->isEmploye() && !Yii::app()->user->checkAccess($activeMenu['ID'])) {
                 Yii::app()->controller->render("//site/nopower");
                 Yii::app()->end();
             }
             // 正常请求的处理方式
         }
     }
     // Module
     if (($module = $controller->getModule()) !== null) {
         $itemName .= strtolower($module->getId());
         $controllerId = strtolower($controller->getId());
         if (!in_array($itemName, array('maker', 'dealer', 'servicer', 'mall', 'cim'))) {
             return true;
         } else {
             if (Yii::app()->user->isMaker()) {
                 if (in_array($itemName, array('maker'))) {
                     return true;
                 } else {
                     $itemName .= "-" . $controllerId;
                     if (in_array($itemName, array('mall-makeorder', 'cim-contact', 'mall-makecount'))) {
                         return true;
                     }
                     Yii::app()->controller->redirect(array('/maker'));
                 }
             } else {
                 if (Yii::app()->user->isDealer()) {
                     if (in_array($itemName, array('dealer'))) {
                         return true;
                     } else {
                         $itemName .= "-" . $controllerId;
                         if (in_array($itemName, array('mall-order', 'mall-goods', 'mall-quotationbuy', 'mall-quotationsell', 'mall-myaddress', 'mall-querygoods', 'mall-payment', 'mall-quotations', 'mall-sellcount', 'mall-quotationorder', 'mall-sell', 'mall-jporder', 'dealer-makequery', 'cim-businessshare', 'cim-contact', 'cim-pricemanage', 'cim-logistics', 'cim-discountset'))) {
                             return true;
                         }
                         Yii::app()->controller->redirect(array('/dealer'));
                     }
                 } else {
                     if (Yii::app()->user->isServicer()) {
                         if (in_array($itemName, array('servicer'))) {
                             return true;
                         } else {
                             $itemName .= "-" . $controllerId;
                             if (in_array($itemName, array('mall-quotationbuy', 'mall-payment', 'mall-querygoods', 'mall-jporder', 'mall-buy', 'mall-myaddress', 'mall-inquiry', 'mall-quotation', 'cim-contact'))) {
                                 return true;
                             }
                             Yii::app()->controller->redirect(array('/servicer'));
                         }
                     } else {
                         Yii::app()->controller->redirect(array('/site/index'));
                     }
                 }
             }
         }
     }
     return true;
 }