• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP BaseController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了BaseController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: index

 public static function index()
 {
     self::check_logged_in();
     $ryhmemos = Memo::all_groupmemos(BaseController::get_user_logged_in());
     $memos = Memo::all(BaseController::get_user_logged_in());
     View::make('memo/index.html', array('memos' => $memos, 'ryhmemos' => $ryhmemos));
 }
开发者ID:Hecarrah,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:memoController.php


示例10: postContent

 public function postContent($type_id, $id = 'add')
 {
     $all = Input::all();
     if (!$all['slug']) {
         $all['slug'] = BaseController::ru2Lat($all['title']);
     }
     $rules = array('name' => 'required|min:2|max:255', 'title' => 'required|min:3|max:255', 'slug' => 'required|min:4|max:255|alpha_dash');
     $validator = Validator::make($all, $rules);
     if ($validator->fails()) {
         return Redirect::to('/admin/content/' . $type_id . '/' . $id)->withErrors($validator)->withInput()->with('error', 'Ошибка');
     }
     if (is_numeric($id)) {
         $post = Post::find($id);
     } else {
         $post = new Post();
     }
     $post->type_id = $all['type_id'];
     $post->name = $all['name'];
     $post->title = $all['title'];
     $post->slug = $all['slug'];
     $post->text = $all['text'];
     $post->parent = $all['parent'];
     $post->status = isset($all['status']) ? true : false;
     $post->order = $all['order'];
     $post->description = $all['description'];
     $post->keywords = $all['keywords'];
     if (isset($all['image'])) {
         $post->image = AdminController::saveImage($all['image'], 'upload/image/', 250);
     }
     $post->save();
     return Redirect::to('/admin/content/' . $all['type_id'] . '/' . $id)->with('success', 'Изменения сохранены');
 }
开发者ID:ldin,项目名称:project_kartinki,代码行数:32,代码来源:AdminController.php


示例11: __construct

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


示例12: __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


示例13: __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


示例14: __construct

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


示例15: __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


示例16: __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


示例17: 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


示例18: common

 public function common()
 {
     // Get the generic stuff from parent
     parent::common();
     // Add my own things
     $this->view->headTitle($this->getPageTitle());
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:7,代码来源:BaseController.php


示例19: __construct

 public function __construct(Registry $registry)
 {
     parent::__construct($registry, 'A_Publishers');
     $this->_template->publisherTitles = ['Publishers', 'New Publisher', 'Publisher Details', 'Update Publisher'];
     if (isset($this->_urlBits[1]) && $this->_urlBits[1] == 'publishers') {
         if (isset($this->_urlBits[2]) && $this->_urlBits[2] == 'create') {
             $this->createNewPublisher();
         } elseif (isset($this->_urlBits[2]) && isset($this->_urlBits[3])) {
             $publisherId = filter_var($this->_urlBits[3], FILTER_VALIDATE_INT);
             switch ($this->_urlBits[2]) {
                 case 'view':
                     $this->viewPublisher($publisherId);
                     break;
                 case 'update':
                     $this->updatePublisher($publisherId);
                     break;
                 default:
                     $this->showAuthors();
                     break;
             }
         } else {
             $this->showPublishers();
         }
     } else {
         $this->_registry->redirectTo();
     }
 }
开发者ID:BorisMatonickin,项目名称:bookstore,代码行数:27,代码来源:PublishersController.php


示例20: beforeAction

 public function beforeAction($action)
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect('/');
     }
     return parent::beforeAction($action);
 }
开发者ID:Alamast,项目名称:pravoved,代码行数:7,代码来源:FaqController.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP BaseCustomFieldValue类代码示例发布时间:2022-05-23
下一篇:
PHP BaseClass类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap