コード例 #1
0
ファイル: WNavbar.php プロジェクト: zwq/unpei
 public function run()
 {
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     $this->render('navbar', array('nav' => $navarr));
 }
コード例 #2
0
ファイル: TopNews.php プロジェクト: zwq/unpei
 public function run()
 {
     //获取
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     $service_arr = array('orders' => '订单管理', 'quos' => '查看报价单', 'returns' => '退货管理');
     $dealer_arr = array('orders' => '订单管理', 'quos' => '管理报价单', 'returns' => '退货管理');
     foreach ($navarr as $key => $val) {
         if (Yii::app()->user->isServicer()) {
             if ($val['name'] != '采购管理') {
                 unset($navarr[$key]);
                 continue;
             }
             foreach ($navarr[$key]['children'] as $k => $v) {
                 if ($v['name'] == $service_arr['orders']) {
                     $data['order'] = $v['name'];
                 } else {
                     if ($v['name'] == $service_arr['quos']) {
                         $data['quo'] = $v['name'];
                     } else {
                         if ($v['name'] == $service_arr['returns']) {
                             $data['return'] = $v['name'];
                         }
                     }
                 }
             }
         }
         if (Yii::app()->user->isDealer()) {
             if ($val['name'] != '销售管理') {
                 unset($navarr[$key]);
                 continue;
             }
             foreach ($navarr[$key]['children'] as $k => $v) {
                 if ($v['name'] == $dealer_arr['orders']) {
                     $data['order'] = $v['name'];
                 } else {
                     if ($v['name'] == $dealer_arr['quos']) {
                         $data['quo'] = $v['name'];
                     } else {
                         if ($v['name'] == $dealer_arr['returns']) {
                             $data['return'] = $v['name'];
                         }
                     }
                 }
             }
         }
     }
     $this->render('topnews', array('mesmenu' => $data));
 }
コード例 #3
0
ファイル: WTopNav.php プロジェクト: zwq/unpei
 public function run()
 {
     //获取是经销商还是服务店菜单
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     foreach ($navarr as $key => $val) {
         if ($val['name'] != '信息管理') {
             unset($navarr[$key]);
             continue;
         }
     }
     $this->render('topNav', array('permenu' => $navarr));
 }
コード例 #4
0
ファイル: HomeController.php プロジェクト: zwq/unpei
 public function actionIndex()
 {
     $this->pageTitle = Yii::app()->name . '-商城首页';
     if (Yii::app()->user->isServicer()) {
         $menu = DefaultService::getmenu('修理厂菜单');
         $params['rootID'] = $menu['ID'];
         $navparams['rootID'] = $menu['ID'];
     } else {
         $this->redirect(array('/pap/sellerorder/index'));
     }
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $menuArr = FrontMenu::getChildMenu($params);
     //        $navparams['scope']='sliderbar';
     //        $navArr = FrontMenu::getChildMenu($navparams);
     $this->render("index", array('menuArr' => $menuArr));
 }
コード例 #5
0
ファイル: MTopNav.php プロジェクト: zwq/unpei
 public function run()
 {
     //大类子类数据源
     $main = DefaultService::getMainCategorys(0);
     $main = DefaultService::findChild($main, 0);
     $maincate = DefaultService::findsub($main);
     //获取是经销商还是服务店菜单
     $params = M::getRoot();
     //组装参数
     $params["scope"] = "sliderbar";
     //指定定查询范围
     //获取菜单数组
     $navarr = FrontMenu::getChildMenu($params);
     foreach ($navarr as $key => $val) {
         if ($val['name'] != '信息管理') {
             unset($navarr[$key]);
             continue;
         }
     }
     $this->render('topNav', array('MainCategory' => $maincate, 'permenu' => $navarr));
 }
コード例 #6
0
ファイル: WStage.php プロジェクト: zwq/unpei
 public function run()
 {
     //定义参数数组
     $params = array("rootID" => 0);
     //根据用户的角色选择根节点
     if (Yii::app()->user->isMaker()) {
         $params["rootID"] = 1;
     } else {
         if (Yii::app()->user->isDealer()) {
             $params["rootID"] = 2;
         } else {
             if (Yii::app()->user->isServicer()) {
                 $params["rootID"] = 3;
             }
         }
     }
     //组装参数
     $params["scope"] = "stage";
     //制定查询范围
     //获取菜单数组
     $menuArr = FrontMenu::getChildMenu($params);
     $this->render('stage', array("menu" => $menuArr));
 }
コード例 #7
0
ファイル: FrontmenuController.php プロジェクト: zwq/unpei
 public function actionGetChildMenu()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         exit;
     }
     $parentId = 'null';
     if (isset($_POST['ID'])) {
         $parentId = (int) $_POST['ID'];
         $children = FrontMenu::model()->findAllByAttributes(array("ParentID" => $parentId));
     }
     $dropDownCities = "<option value=''>选择菜单</option>";
     if (is_array($children)) {
         foreach ($children as $key => $val) {
             $dropDownCities .= CHtml::tag('option', array('value' => $val->ID), CHtml::encode($val->Name), true);
         }
     }
     echo $dropDownCities;
     exit;
 }
コード例 #8
0
ファイル: WSliderbar.php プロジェクト: zwq/unpei
 protected static function getmenu($name)
 {
     return FrontMenu::model()->find('Name=:name', array(":name" => $name));
 }
コード例 #9
0
ファイル: _form.php プロジェクト: zwq/unpei
$menuurl = F::uploadUrl() . 'common/frontmenu/';
?>

<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php 
echo $form->errorSummary($model);
?>

<?php 
echo CHtml::dropDownList('mainMenu', $model->RootID, CHtml::listData(CActiveRecord::model('FrontMenu')->findAllByAttributes(array("ParentID" => 0)), 'ID', 'Name'), array('prompt' => '选择主菜单', 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('getChildMenu'), 'data' => array('ID' => 'js:this.value', 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken), 'success' => 'function(data) {
                            $("#secondMenu").html(data);
                            $("#secondMenu").show();
                        }')));
if ($model->RootID && $model->ParentID != $model->RootID) {
    $sonmenu = FrontMenu::model()->findAllByAttributes(array("ParentID" => $model->RootID));
    $sonmenu = CHtml::listData($sonmenu, 'ID', 'Name');
} else {
    $sonmenu = array();
}
echo CHtml::dropDownList('secondMenu', $model->ParentID, $sonmenu, array('prompt' => '选择菜单', 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('getChildMenu'), 'update' => '#thirdMenu', 'data' => array('ID' => 'js:this.value', 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken), 'success' => 'function(data) {
                            $("#thirdMenu").html(data);
                            $("#thirdMenu").show();
                        }')));
echo CHtml::dropDownList('thirdMenu', '', array(), array('prompt' => '选择菜单'));
?>

<?php 
echo $form->textFieldRow($model, 'Name', array('class' => 'span5', 'maxlength' => 100));
?>
コード例 #10
0
ファイル: navbar.php プロジェクト: 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>
コード例 #11
0
ファイル: AuthFilter.php プロジェクト: zwq/unpei
 /**
  * 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;
 }
コード例 #12
0
ファイル: PermissionController.php プロジェクト: zwq/unpei
 public function actionUserinfo()
 {
     $data = array();
     $empid = Yii::app()->request->getParam('empid');
     $emp = JpdOrganEmployees::model()->findByPk($empid)->attributes;
     if ($emp) {
         $per = JpdOrganRoleEmployees::model()->findAll('EmployeeID=:emp and Status=:sta ', array(':emp' => $emp['ID'], ':sta' => '0'));
         if ($per) {
             foreach ($per as $k => $v) {
                 $data[$k] = $v->attributes;
                 $data[$k]['empname'] = $emp['Name'];
                 $data[$k]['empID'] = $emp['ID'];
                 $data[$k]['role'] = JpdOrganRoles::model()->findByPk($v['RoleID'])->attributes;
                 $ress = JpdOrganRoles::model()->findByPk($v['RoleID']);
                 $rootID = F::getroot();
                 $per = $ress->attributes;
                 if ($per['Jurisdiction']) {
                     $params['role'] = $per['Jurisdiction'];
                     $params["scope"] = "stage";
                     //制定查询范围
                     $params["scope"] = "sliderbar";
                     $params['rootID'] = $rootID;
                     if ($params["rootID"]) {
                         //获取菜单模型
                         $criteria = new CDbCriteria();
                         $criteria->addCondition('ID=' . $params["rootID"]);
                         //                            $criteria->addCondition('IsRoot=1');
                         $criteria->addCondition('IsShow=1');
                         $firstmenu = FrontMenu::model()->find($criteria);
                     }
                     $data[$k]['root'] = $firstmenu['Name'];
                     $res = FrontMenu::getChildMenu($params);
                     $rs = array();
                     $data[$k]['per'] = $res;
                 }
             }
         } else {
             $data['empname'] = $emp['Name'];
             $data['empID'] = $emp['ID'];
         }
     }
     echo json_encode($data);
 }
コード例 #13
0
ファイル: FrontMenu.php プロジェクト: zwq/unpei
 /**
  * 根据当前url查询menuID
  * @param type $params
  * @return boolean
  */
 public static function getMenuIDByRoute($route, $rootID)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition("(Url ='{$route}' Or ExtraUrl like '%{$route}%') and RootID={$rootID}");
     return FrontMenu::model()->find($criteria);
 }
コード例 #14
0
ファイル: WFootMenu.php プロジェクト: zwq/unpei
 public function getFootMenu()
 {
     return FrontMenu::getChild(array("rootID" => 73, "scope" => "sliderbar"));
 }