当前位置: 首页>>代码示例>>PHP>>正文


PHP Company::loadComp方法代码示例

本文整理汇总了PHP中app\models\Company::loadComp方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::loadComp方法的具体用法?PHP Company::loadComp怎么用?PHP Company::loadComp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Company的用法示例。


在下文中一共展示了Company::loadComp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hasAccess

 private function hasAccess($path)
 {
     //echo file_get_contents('php://input');
     //return true;
     $entityBody = \yii\helpers\Json::decode(file_get_contents('php://input'));
     //\yii\helpers\Json::decode
     Yii::info("input jsond: " . \yii\helpers\Json::encode($entityBody));
     Yii::info("input: " . file_get_contents('php://input'));
     //
     if (isset($entityBody["login_id"])) {
         $model = new \app\models\FormLogin();
         $model->id = $entityBody['login_id'];
         $model->hash = $entityBody['login_hash'];
         //$model->company= $entityBody['login_company'];
         //return true;
         if ($model->apiLogin()) {
             Yii::$app->timezone = Yii::$app->user->getParam('timezone');
             Yii::$app->language = Yii::$app->user->getParam('language');
             if ((int) $entityBody['login_company'] == 0) {
                 return true;
             }
             //no company
             $company = Company::findOne($entityBody['login_company']);
             if ($company !== null) {
                 $this->company = $company->id;
                 Company::loadComp($company);
                 return true;
             }
         } else {
             return false;
         }
     }
     return false;
     //if isGuest() return false
     $arr = explode('/', $path);
     if (!isset($this->translate[$arr[0]])) {
         return false;
     }
     return Yii::$app->user->checkAccess($path);
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:40,代码来源:ApiController.php

示例2: init

 public function init()
 {
     date_default_timezone_set('Asia/Tel_Aviv');
     //\Yii::$app->language = 'he_il';
     //if ($this->company==null) {
     //    Yii::$app->user->Set('Company', 0);
     //}
     if (!Yii::$app->user->isGuest) {
         \app\helpers\Linet3Helper::SetTheme();
         date_default_timezone_set(Yii::$app->user->getParam('timezone'));
         Yii::$app->language = Yii::$app->user->getParam('language');
         Yii::$app->timezone = Yii::$app->user->getParam('timezone');
         //Yii::$app->theme = Yii::$app->user->getParam('theme');
         if (isset(Yii::$app->session['company'])) {
             $this->company = Yii::$app->session['company'];
             //if(Yii::$app->user->getParam('company')!=0){
             //    $this->company = Yii::$app->user->getParam('company');
             //Yii::$app->session['company']=0;
             //}
         }
     } else {
         //default theme
         //Yii::$app->theme = 'admin4';
     }
     Yii::info("Selected Company ID: " . $this->company);
     if ($this->company == 0) {
         if ($this->id != 'company') {
             //print "'".Yii::$app->controller->id."'";
             $this->redirect(\yii\helpers\BaseUrl::base() . '/company/index');
             Yii::$app->end();
         } else {
             //echo $this->id;
             //Yii::$app->end();
             Yii::$app->db->close();
             Yii::$app->db->dsn = Yii::$app->dbMain->dsn;
             Yii::$app->db->tablePrefix = Yii::$app->dbMain->tablePrefix;
             Yii::$app->db->username = Yii::$app->dbMain->username;
             Yii::$app->db->password = Yii::$app->dbMain->password;
             Yii::$app->db->open();
         }
     } else {
         //hasAccess!
         //$this->company = Company::findByPk($this->company);
         $company = Company::findOne($this->company);
         if ($company !== null) {
             Company::loadComp($company);
         } else {
             $this->redirect(\yii\helpers\BaseUrl::base() . '/company/index');
         }
     }
     //*/
     return parent::init();
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:53,代码来源:RightsController.php


注:本文中的app\models\Company::loadComp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。