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


PHP helpers\BaseUrl类代码示例

本文整理汇总了PHP中yii\helpers\BaseUrl的典型用法代码示例。如果您正苦于以下问题:PHP BaseUrl类的具体用法?PHP BaseUrl怎么用?PHP BaseUrl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: beforeAction

 /**
  * @inheritdoc
  */
 public function beforeAction()
 {
     $current_route = $this->getModules()[0]->requestedRoute;
     if (!Yii::$app->request->isAjax && !in_array($current_route, Yii::$app->params['route_keep_cookie'])) {
         utilities::deleteCookie('cus_info');
         //Delete coolkie cus_info
     }
     $session = \Yii::$app->session;
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/login');
         return false;
     }
     if ($login_info = $session->get('login_info') and $login_info['expired'] < time()) {
         $session->remove('login_info');
         unset($session['login_info']);
     }
     if (!$session->get('login_info')) {
         $this->redirect(BaseUrl::base(true) . '/timeout');
         return false;
     }
     if ($loginInfo = $session->get('login_info')) {
         $login_info['expired'] = time() + Yii::$app->params['timeOutLogin'];
         $session->set('login_info', $login_info);
     }
     return true;
 }
开发者ID:huylv-hust,项目名称:ws,代码行数:29,代码来源:WsController.php

示例2: actionRestore

 public function actionRestore($id = null)
 {
     $model = new FormBackupFile();
     $comp = $this->loadModel($this->company);
     if (isset($_POST['FormBackupFile'])) {
         $bkup = Company::getFilePath() . "tmp.zip";
         $model->file = $_POST['FormBackupFile']['file'];
         $model->file = \yii\web\UploadedFile::getInstance($model, 'file');
         if ($model->file->saveAs($bkup)) {
             $comp->restore($bkup);
             return $this->redirect(\yii\helpers\BaseUrl::base() . '/settings/dashboard');
         }
     }
     if ($id != null) {
         $file = Files::findOne($id);
         if ($file != null) {
             $comp->restore($file->getFullFilePath());
             $this->redirect(\yii\helpers\BaseUrl::base() . '/settings/dashboard');
         } else {
             throw new \yii\web\HttpException(500, 'The backup file does not exist.');
         }
     }
     //read file
     //if DROP TABLE IF EXISTS `
     //if CREATE TABLE `
     //INSERT INTO `
     return $this->render('backupRestore', array('model' => $model));
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:28,代码来源:DataController.php

示例3: init

 public function init()
 {
     //$accHist = new AccHist('search');
     //$accHist->dt=today 00:00:00 > now > today 23:59:59
     $this->content = \app\widgets\GridView::widget(array('id' => 'acchist-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\Html::a(\yii\helpers\Html::encode(isset($data->account) ? $data->account->name : $data->account_id), \yii\helpers\BaseUrl::base() . ("/accounts/view/" . $data->account_id));
     }, 'format' => 'raw'), 'dt', array('attribute' => 'details', 'format' => 'raw', 'value' => function ($data) {
         return $data->brief();
     }))), true);
     //parent::init();
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:11,代码来源:accReport.php

示例4: init

 public function init()
 {
     //$docs->=status=?? open??
     $this->content = \app\widgets\GridView::widget(array('id' => 'docs-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'doctype', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode((isset($data->docType) ? Yii::t("app", $data->docType->name) : "") . " #" . $data->docnum), \yii\helpers\BaseUrl::base() . ("/docs/view/" . $data->id));
     }, 'format' => 'raw'), array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\html::a(yii\helpers\html::encode($data->company), \yii\helpers\BaseUrl::base() . ("/accounts/transaction/" . $data->account_id));
     }, 'format' => 'raw'), 'total', array('attribute' => 'status', 'value' => function ($data) {
         return isset($data->docStatus) ? $data->docStatus->name : "";
     }))), true);
     //parent::init();
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:12,代码来源:docReport.php

示例5: init

 public function init()
 {
     //$docs = new Docs('search');
     $this->content = \app\widgets\GridView::widget(array('id' => 'sales-grid', 'dataProvider' => $this->search(), 'layout' => '{items}{pager}', 'panel' => false, 'columns' => array(array('attribute' => 'account_id', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode($data->company), \yii\helpers\BaseUrl::base() . ("/accounts/view/" . $data->account_id));
     }, 'format' => 'raw'), array('attribute' => 'docnum', 'value' => function ($data) {
         return \yii\helpers\html::a(\yii\helpers\html::encode($data->total), \yii\helpers\BaseUrl::base() . ("/docs/view/" . $data->id));
     }, 'format' => 'raw'), array('attribute' => 'due_date', 'value' => function ($data) {
         return $data->due_date;
     }))), true);
     //parent::init();
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:12,代码来源:salesReport.php

示例6: renderMenu

 protected function renderMenu()
 {
     $html = [];
     $html[] = '<div class="list-group">';
     foreach ($this->items as $item) {
         if (BaseUrl::current() == $item['url']) {
             $html[] = $this->renderActiveItem($item);
         } else {
             $html[] = $this->renderItem($item);
         }
     }
     $html[] = '</div>';
     return implode($html);
 }
开发者ID:supostat,项目名称:yii2-listgroup-menu,代码行数:14,代码来源:ListGroupMenu.php

示例7: beforeAction

 /**
  * @inheritdoc
  */
 public function beforeAction()
 {
     $session = \Yii::$app->session;
     if (!$session->get('login_admin_info')) {
         Yii::$app->response->redirect(BaseUrl::base(true) . '/operator/login');
         return false;
     }
     if ($login_info = $session->get('login_admin_info') and $login_info['expired'] < time()) {
         $session->remove('login_admin_info');
         unset($session['login_admin_info']);
     }
     if ($loginInfo = $session->get('login_admin_info')) {
         $login_info['expired'] = time() + Yii::$app->params['timeOutLogin'];
         $session->set('login_admin_info', $login_info);
     }
     return true;
 }
开发者ID:huylv-hust,项目名称:ws,代码行数:20,代码来源:ZipfileController.php

示例8: actionSet

 public function actionSet($lang)
 {
     if (!Yii::$app->user->isGuest) {
         Yii::$app->user->identity->scenario = 'language';
         Yii::$app->user->identity->lang = $lang;
         Yii::$app->user->identity->save();
     }
     Yii::$app->session->set('lang', $lang);
     $redirectUrl = Yii::$app->request->get('redirect', false);
     if (!$redirectUrl) {
         $redirectUrl = Yii::$app->request->referrer;
     }
     if (!$redirectUrl) {
         $redirectUrl = \yii\helpers\BaseUrl::home(true);
     }
     return $this->redirect($redirectUrl);
 }
开发者ID:jarrus90,项目名称:yii2-multilang,代码行数:17,代码来源:ChangeController.php

示例9: actionIndex

 /**
  * list order
  * @return string
  */
 public function actionIndex()
 {
     $all = new utilities();
     $branch = $all->getAllBranch();
     $data['all_ss'] = $branch['all_ss'];
     $obj = new Sdptd03denpyo();
     $obj_job = new Sdptm01sagyo();
     $filters = Yii::$app->request->get();
     $query_string = empty($filters) ? '' : '?' . http_build_query($filters);
     Yii::$app->session->set('url_list_workslip', BaseUrl::base() . '/list-workslip' . $query_string);
     if (empty($filters)) {
         $filters['start_time'] = date('Ymd');
         $filters['end_time'] = date('Ymd');
     }
     $data['filters'] = $filters;
     /*
      * Get login info
      * */
     $login_info = Yii::$app->session->get('login_info');
     if (isset($login_info['M50_SS_CD']) && $login_info['M50_SS_CD'] != '') {
         $data['filters']['m50_ss_cd'] = $login_info['M50_SS_CD'];
     }
     $count = $obj->countDataSearch($data['filters']);
     $data['pagination'] = new Pagination(['totalCount' => $count, 'defaultPageSize' => Yii::$app->params['defaultPageSize']]);
     $data['page'] = $filters = Yii::$app->request->get('page');
     $data['filters']['limit'] = $data['pagination']->limit;
     $data['filters']['offset'] = $data['pagination']->offset;
     $data['list'] = $obj->getDataSearch($data['filters']);
     if (empty($data['list'])) {
         Yii::$app->session->setFlash('empty', '入力条件に該当する作業伝票が存在しません');
     }
     $data['job'] = [];
     $all_job = $obj_job->getData();
     foreach ($all_job as $k => $v) {
         $data['job'][''] = '';
         $data['job'][$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
     }
     $data['status'] = Yii::$app->params['status'];
     Yii::$app->params['titlePage'] = '作業伝票一覧';
     Yii::$app->view->title = '情報検索';
     return $this->render('index', $data);
 }
开发者ID:huylv-hust,项目名称:ws,代码行数:46,代码来源:DefaultController.php

示例10: run

 /**
  * Display the widget
  * @see CWidget::run()
  */
 public function run()
 {
     //style="width:'.($this->width-$this->titlewidth-28).'px;"
     if ($this->content == '') {
         $this->content = ob_get_clean();
     }
     $helper = new \app\models\Help();
     $this->help = $helper->getHelp(str_replace(\yii\helpers\BaseUrl::base(), "", \Yii::$app->request->url));
     if ($this->help) {
         //' . \Yii::t("app", 'Help') . '
         $this->help = '<a class="btn btn-default" href="' . $this->help . '" target="_blank"><i class="glyphicon glyphicon-question-sign"></i></a>';
     } else {
         $this->help = '';
     }
     if ($this->collapse) {
         $this->collapse = '<a href="javascript:;" class="btn btn-default btn-xs collapse-box"  data-toggle="collapse">
                       <i class="fa fa-minus"></i>
                     </a> ';
         $this->collapse = '';
     } else {
         $this->collapse = '';
     }
     if ($this->height) {
         $this->height = 'style="height:' . $this->height . 'px"';
     } else {
         $this->height = '';
     }
     if ($this->fullscreen) {
         $this->fullscreen = '<a href="javascript:;" class="btn btn-default btn-xs full-box">
                       <i class="fa fa-expand"></i>
                     </a> ';
         $this->fullscreen = '';
     } else {
         $this->fullscreen = '';
     }
     //echo $this->getViewPath();
     //    exit;
     //CWidget::render();
     return $this->render("MiniForm", ["class" => $this->class, "logo" => $this->logo, "header" => $this->header, "help" => $this->help, "collapse" => $this->collapse, "fullscreen" => $this->fullscreen, "height" => $this->height, "content" => $this->content]);
     //$newform = '';
     //echo $newform;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:46,代码来源:MiniForm.php

示例11: actionImport

 /**
  * action import
  * @return \yii\web\Response
  */
 public function actionImport()
 {
     $request = Yii::$app->request;
     if ($request->isPost && isset($_FILES['commodity'])) {
         $obj = new Sdptm05com();
         if (substr($_FILES['commodity']['name'], -4) == '.csv') {
             $file = utilities::convertUtf8($_FILES['commodity']['tmp_name']);
             $result = $obj->saveImport($file);
             $error = $result['error'];
         } else {
             $error[] = 'CSVのフォーマットが正しくありません';
         }
         if (empty($error) && $result['insert']) {
             Yii::$app->session->setFlash('success', 'success');
         } else {
             Yii::$app->session->setFlash('error', $error);
         }
         return $this->redirect(BaseUrl::base(true) . '/update-commodity');
     }
 }
开发者ID:huylv-hust,项目名称:ws,代码行数:24,代码来源:CommodityController.php

示例12: init

 public function init()
 {
     date_default_timezone_set('Asia/Tel_Aviv');
     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');
     }
     if (Yii::$app->params['newInstall']) {
         if ($this->id != 'install') {
             //print "'".Yii::$app->controller->id."'";
             $this->redirect(\yii\helpers\BaseUrl::base() . '/install/index');
             Yii::$app->end();
         }
     } else {
         //include('upgrade.php');
     }
     //Yii::app()->clientScript->registerScriptFile($baseUrl.'/js/yourscript.js');
     return parent::init();
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:20,代码来源:LitController.php

示例13: actionIndex

 public function actionIndex()
 {
     $data['post'] = \Yii::$app->request->post();
     if (isset($data['post']['D01_SS_CD'])) {
         $branch = utilities::getAllBranch();
         $ss = $branch['all_ss'];
         $address = $branch['ss_address'];
         $tel = $branch['ss_tel'];
         $obj_job = new Sdptm01sagyo();
         $job[''] = '';
         $all_job = $obj_job->getData();
         foreach ($all_job as $k => $v) {
             $job[$v['M01_SAGYO_NO']] = $v['M01_SAGYO_NAMEN'];
         }
         $data['ss'] = isset($ss[$data['post']['D01_SS_CD']]) ? $ss[$data['post']['D01_SS_CD']] : '';
         $data['address'] = isset($address[$data['post']['D01_SS_CD']]) ? $address[$data['post']['D01_SS_CD']] : '';
         $data['tel'] = isset($tel[$data['post']['D01_SS_CD']]) ? $tel[$data['post']['D01_SS_CD']] : '';
         foreach ($data['post']['LIST_NAME'] as $k => $v) {
             $data['post']['M05_COM_NAMEN' . $k] = $v;
         }
         $data['job'] = $job;
         $data['status'] = \Yii::$app->params['status'];
         $tanto = explode('[]', $data['post']['D03_TANTO_MEI_D03_TANTO_SEI']);
         if (!empty($tanto[0]) && !empty($tanto[1])) {
             $data['post']['tanto'] = $tanto[0] . $tanto[1];
         }
         $kakunin = explode('[]', $data['post']['D03_KAKUNIN_MEI_D03_KAKUNIN_SEI']);
         if (!empty($kakunin[0]) && !empty($kakunin[1])) {
             $data['post']['kakunin'] = $kakunin[0] . $kakunin[1];
         }
         $data['post']['ss_user'] = $this->getssUser($data['post']['D01_SS_CD']);
         $data['ss_user'] = $data['post']['M08_NAME_MEI_M08_NAME_SEI'] ? $data['post']['ss_user'][$data['post']['M08_NAME_MEI_M08_NAME_SEI']] : '';
         $this->layout = '@app/views/layouts/print';
         \Yii::$app->view->title = '作業確認書';
         \Yii::$app->params['titlePage'] = '作業確認書';
         return $this->render('index', $data);
     }
     return $this->redirect(BaseUrl::base(true) . '/regist-workslip');
 }
开发者ID:huylv-hust,项目名称:ws,代码行数:39,代码来源:PreviewController.php

示例14: actionLogin

 public function actionLogin()
 {
     $model = new Users();
     // $username = "multitenance";
     // $password = "multitenance";
     $username = $_POST['username'];
     $password = $this->encrypt($_POST['password']);
     $detail_login = $model->find()->where(['FIELD3' => $username, 'FIELD4' => $password])->all();
     if ($detail_login) {
         $session = Yii::$app->session;
         foreach ($detail_login as $row) {
             $session->set('nama', $row['FIELD2']);
             $session->set('handphone', $row['FIELD6']);
             $session->set('email', $row['FIELD7']);
             $session->set('level', $row['FIELD8']);
             $session->set('company', $row['FIELD9']);
         }
         // $this->redirect(''.BaseUrl::base().'/dashboard/',302);
         echo BaseUrl::base() . "/dashboard";
     } else {
         echo "error";
     }
 }
开发者ID:agungsuprayitno,项目名称:sme,代码行数:23,代码来源:LoginController.php

示例15: run

 /**
  * Display the widget
  * @see CWidget::run()
  */
 public function run()
 {
     //style="width:'.($this->width-$this->titlewidth-28).'px;"
     $arr = explode('\\', get_class($this->model));
     $name = array_pop($arr);
     $id = $name . "_" . $this->attribute;
     $ids = $this->attribute . "_ids";
     //if (!($this->model->hasAttribute($this->attribute)))
     //if (!($this->model->{$this->attribute}))
     //throw new CHttpException(500, Yii::t('app', 'Did not set attr or model for refnum'));
     //Yii::$app->end();
     //$baseUrl = Yii::$app->request->baseUrl;
     $text = '';
     //if(function_exists(getRef())){
     //$this->model->getRef();
     if ($this->model->Docs !== null) {
         foreach ($this->model->Docs as $doc) {
             //echo \yii\helpers\Html::link($doc->docType->name . " #" . $doc->docnum, array('docs/view', "id" => $doc->id)) . "<br />";
             $text .= "<a href='" . \yii\helpers\BaseUrl::base() . "docs/view/{$doc->id}" . "' >" . $doc->docType->name . ' #' . $doc->docnum . "</a><br />";
         }
     }
     // }
     return $this->render("Refnum", ["name" => $name, "id" => $id, "ids" => $ids, "value" => $this->model->{$ids}, "text" => $text, "label" => $this->model->getAttributeLabel($this->attribute)]);
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:28,代码来源:Refnum.php


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