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


PHP BaseController类代码示例

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


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

示例1: __construct

 public function __construct(BaseController $controller)
 {
     // 配置文件中检测安装设置
     $this->controller = $controller;
     $this->installed = $controller->getAppConfig()->get('appinit', false);
     $this->dbType = $controller->getDbType();
 }
开发者ID:kingstudio,项目名称:pv2ex,代码行数:7,代码来源:Install.class.php

示例2: raise

 public static function raise($exception)
 {
     getLogger()->warn($exception->getMessage());
     $class = get_class($exception);
     $baseController = new BaseController();
     switch ($class) {
         case 'OPAuthorizationException':
         case 'OPAuthorizationSessionException':
             if (isset($_GET['__route__']) && substr($_GET['__route__'], -5) == '.json') {
                 echo json_encode($baseController->forbidden('You do not have sufficient permissions to access this page.'));
             } else {
                 getRoute()->run('/error/403', EpiRoute::httpGet);
             }
             die;
             break;
         case 'OPAuthorizationOAuthException':
             echo json_encode($baseController->forbidden($exception->getMessage()));
             die;
             break;
         default:
             getLogger()->warn(sprintf('Uncaught exception (%s:%s): %s', $exception->getFile(), $exception->getLine(), $exception->getMessage()));
             throw $exception;
             break;
     }
 }
开发者ID:gg1977,项目名称:frontend,代码行数:25,代码来源:exceptions.php

示例3: getPostPage

 public function getPostPage()
 {
     $obj = new BaseController();
     $campusid = $this->getDevice();
     if ($campusid == 0) {
         $countryname = $obj->getCountryName();
         if ($countryname == 'NONE') {
             return Redirect::route('selectcampus-get');
         } else {
             //check whether the country name exists inthe db
             $locationcountry = Country::where('name', '=', $countryname);
             if ($locationcountry->count()) {
                 $locationcountrycode = $locationcountry->first()->code;
                 $locationcountrycode = strtolower($locationcountrycode);
                 return Redirect::route('selectcountryid', $locationcountrycode);
             } else {
                 return Redirect::route('selectcampus-get');
             }
         }
     }
     $college = Institution::whereHas('Branch', function ($query) use($campusid) {
         $query->where('id', '=', $campusid);
     })->first();
     View::share('college', $college);
     $mycampus = Branch::where('id', '=', $campusid)->first();
     View::share('mycampus', $mycampus);
     if (Auth::user()) {
         return View::make('member.post');
     }
     return View::make('guest.post');
 }
开发者ID:franqq,项目名称:squeeber,代码行数:31,代码来源:PostController.php

示例4: __construct

 /**
  * @notice Not using hierachical inheriting [extends] classes, but using DI via constructor.
  * Building tree-like sytems will lead to Diamond Problems @see https://en.wikipedia.org/wiki/Multiple_inheritance
  * Besides invoking via extends re-instances the parent objects, whild DI keeps intact.
  * DI is also not perfect, but a better way.
  *
  * @param Symfony\Component\HttpFoundation\Request $request
  * @param App\BaseController $baseController
  */
 public function __construct($request, $baseController)
 {
     $this->request = $request;
     $this->base = $baseController;
     $authService = $this->base->getAuthorizationService();
     $this->isGranted = $authService->isGranted($this->request->get("user"));
 }
开发者ID:Webist,项目名称:CurrencyConverter,代码行数:16,代码来源:ValutaController.php

示例5: dispatch

 public static function dispatch(&$request)
 {
     session_start();
     if (isset($request["page"])) {
         switch ($request["page"]) {
             case "login":
                 $controller = new BaseController();
                 $controller->handle_input($request);
                 break;
             case "cliente":
                 $controller = new ClienteController();
                 if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Cliente) {
                     self::write403();
                 }
                 $controller->handle_input($request);
                 break;
             case "admin":
                 $controller = new AdminController();
                 if (isset($_SESSION[BaseController::role]) && $_SESSION[BaseController::role] != User::Admin) {
                     self::write403();
                 }
                 $controller->handle_input($request);
                 break;
             default:
                 self::write404();
                 break;
         }
     } else {
         self::write404();
     }
     //        include 'php/view/master.php';
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:32,代码来源:index.php

示例6: __construct

 public function __construct(BaseController $controller)
 {
     $this->dbType = $controller->getDbType();
     $this->tablePre = $controller->getTablePre();
     if ($this->dbType == BaseController::DB_MYSQL) {
         $this->conn = $controller->getConn();
     } elseif ($this->dbType == BaseController::DB_REDIS) {
         $this->redis = $controller->getRedis();
     }
 }
开发者ID:kingstudio,项目名称:pv2ex,代码行数:10,代码来源:BkModel.class.php

示例7: __construct

 /**
  * @param                $viewName
  * @param BaseController $controller
  *
  * @throws \Exception
  */
 public function __construct($viewName, BaseController $controller)
 {
     $viewDir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views');
     $layoutPath = $viewDir . DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . 'layout.php';
     $viewPath = $viewDir . DIRECTORY_SEPARATOR . $controller->className() . DIRECTORY_SEPARATOR . $viewName . '.php';
     if (!file_exists($layoutPath)) {
         throw new \Exception('Layout file not found!');
     }
     $this->layoutFileName = $layoutPath;
     if (!file_exists($viewPath)) {
         throw new \Exception('View file "' . $viewName . '" not found!');
     }
     $this->viewFileName = $viewPath;
 }
开发者ID:VlPetukhov,项目名称:summa.local,代码行数:20,代码来源:View.php

示例8: postSelectPackage

 public function postSelectPackage()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Package' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('advanced_squeeb-get')->withInput()->with('global', 'Please select a package.');
     } else {
         $package = Input::get('Package');
         View::share('package', $package);
         //check for the world package
         if ($package == 'pkg1') {
             $countries = Country::all();
             View::share('countries', $countries);
             $obj = new BaseController();
             $countryid = 0;
             $countryname = $obj->getCountryName();
             if ($countryname != 'NONE') {
                 $locationcountry = Country::where('name', '=', $countryname);
                 if ($locationcountry->count()) {
                     $countryid = $locationcountry->first()->id;
                     $colleges = Institution::where('country_id', '=', $countryid)->get();
                     View::share('colleges', $colleges);
                 }
             }
             View::share('countryid', $countryid);
             return View::make('guest.advancedselectcollege');
         } else {
             if ($package == 'pkg2') {
                 $countries = Country::all();
                 View::share('countries', $countries);
                 $obj = new BaseController();
                 $countryid = 0;
                 $countryname = $obj->getCountryName();
                 if ($countryname != 'NONE') {
                     $locationcountry = Country::where('name', '=', $countryname);
                     if ($locationcountry->count()) {
                         $countryid = $locationcountry->first()->id;
                     }
                 }
                 View::share('countryid', $countryid);
                 return View::make('guest.advancedpostcountry')->with('msg', 'Country Squeeb Package');
             }
         }
         if ($package == 'pkg3') {
             return View::make('guest.advancedpost')->with('msg', 'World Squeeb Package');
         }
     }
 }
开发者ID:franqq,项目名称:squeeber,代码行数:48,代码来源:AdvancedPostController.php

示例9: __construct

 public function __construct()
 {
     parent::__construct();
     $this->check_session();
     $this->controllerName = "PuntosVenta";
     $this->load->model('common_model');
 }
开发者ID:jgarceso,项目名称:convivir,代码行数:7,代码来源:PuntosVenta.php

示例10: __construct

 /**
  * Call the parent constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->theme->setTheme();
     // defaults
     $this->user = new User();
 }
开发者ID:nicolargo,项目名称:frontend,代码行数:12,代码来源:SetupController.php

示例11: __construct

 public function __construct($action, $urlValues)
 {
     parent::__construct($action, $urlValues);
     //create the model object
     require "models/home.php";
     $this->model = new HomeModel();
 }
开发者ID:AndreaScn,项目名称:csCMS,代码行数:7,代码来源:home.php

示例12: __construct

 public function __construct()
 {
     parent::__construct();
     if (!BEUsersHelper::isAdmin()) {
         Redirect::to('/');
     }
 }
开发者ID:huuson94,项目名称:btlltct,代码行数:7,代码来源:BEBaseController.php

示例13: __construct

 /**
  * FlightsController constructor.
  */
 public function __construct()
 {
     parent::__construct('Flight');
     /* Template & Navbar par default */
     $this->dsp->template = 'layouts.templates.manager';
     return true;
 }
开发者ID:birdiebel,项目名称:G2016,代码行数:10,代码来源:FlightsController.php

示例14: __construct

 public function __construct()
 {
     parent::__construct();
     \View::composer('*', function ($view) {
         $view->with('angular_template_base_path', '/angular/templates?tmp=');
     });
 }
开发者ID:rbmowatt,项目名称:alohalbi.surf,代码行数:7,代码来源:SiteController.php

示例15: handle

 public function handle($request)
 {
     parent::handle($request);
     $this->initTracker();
     $date = date('Y-m-d');
     $number = 1;
     $last_migration = $this->getLastMigrationParsedId();
     if ($last_migration) {
         if ($date == $last_migration['date']) {
             $number = $last_migration['number'] + 1;
         }
     }
     $migration_filename = sprintf('%s-%s', $date, str_pad($number, 3, '0', STR_PAD_LEFT));
     $words = $this->app->parameters['_words_'];
     $name = false;
     if (isset($words[2])) {
         $name = $words[2];
     }
     if ($name !== false) {
         $name = preg_replace('/[^\\w]/', '-', $name);
         $migration_filename .= '-' . $name;
     }
     $migration_filename .= '.' . $this->app->parameters['migration-file-extention'];
     $migration_fullname = $this->app->parameters['pwd'] . $this->app->parameters['migrations'][0] . $migration_filename;
     if (file_put_contents($migration_fullname, '') !== false) {
         echo "Created empty migration file {$migration_filename}\n";
     } else {
         throw new \Exception('Can\'t create new migration file');
     }
 }
开发者ID:webreactor,项目名称:db-migration,代码行数:30,代码来源:CreateController.php


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