本文整理汇总了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();
}
示例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;
}
}
示例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');
}
示例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"));
}
示例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';
}
示例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();
}
}
示例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;
}
示例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');
}
}
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->check_session();
$this->controllerName = "PuntosVenta";
$this->load->model('common_model');
}
示例10: __construct
/**
* Call the parent constructor
*
* @return void
*/
public function __construct()
{
parent::__construct();
$this->theme->setTheme();
// defaults
$this->user = new User();
}
示例11: __construct
public function __construct($action, $urlValues)
{
parent::__construct($action, $urlValues);
//create the model object
require "models/home.php";
$this->model = new HomeModel();
}
示例12: __construct
public function __construct()
{
parent::__construct();
if (!BEUsersHelper::isAdmin()) {
Redirect::to('/');
}
}
示例13: __construct
/**
* FlightsController constructor.
*/
public function __construct()
{
parent::__construct('Flight');
/* Template & Navbar par default */
$this->dsp->template = 'layouts.templates.manager';
return true;
}
示例14: __construct
public function __construct()
{
parent::__construct();
\View::composer('*', function ($view) {
$view->with('angular_template_base_path', '/angular/templates?tmp=');
});
}
示例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');
}
}