/** * Runs an action within this controller with the specified action ID and parameters. * If the action ID is empty, the method will use [[defaultAction]]. * @param string $id the ID of the action to be executed. * @param array $params the parameters (name-value pairs) to be passed to the action. * @return mixed the result of the action. * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully. * @see createAction() */ public function runAction($id, $params = []) { $action = $this->createAction($id); if ($action === null) { throw new InvalidRouteException('Unable to resolve the request: ' . $id); } Application::trace('Route to run: ' . $id, __METHOD__); if (Application::$app->requestedAction === null) { Application::$app->requestedAction = $action; } $this->action = $action; $result = null; // run the action $result = $action->runWithParams($params); return $result; }
/** * Handles the specified request. * @param Request $request the request to be handled * @return Response the resulting response * @throws NotFoundHttpException if the requested route is invalid */ public function handleRequest($request) { list($route, $params) = $request->resolve(); try { Application::trace("Route requested: '{$route}'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $result; } return $response; } } catch (InvalidRouteException $e) { throw new NotFoundHttpException('Page not found.', $e->getCode(), $e); } }
public function __construct() { parent::__construct(); $this->person = new PersonModel(); }
public function __construct() { parent::__construct(); $this->assign("title", "Dashboard"); }
public function __construct() { parent::__construct(); $this->e = new EmployeeModel(); }
public function logout($destroySession = true) { $identity = $this->getIdentity(); if ($identity !== null) { $this->switchIdentity(null); $id = $identity->getId(); //$this->unsetIdentityCookie(); Application::info("User '{$id}' logged out.", __METHOD__); if ($destroySession) { Application::$app->getSession()->destroy(); } } return $this->getIsGuest(); }
public function __construct() { parent::__construct(); $this->c = new CustomerData(); }
/** * Logs the given exception * @param \Exception $exception the exception to be logged */ public function logException($exception) { $category = get_class($exception); if ($exception instanceof HttpException) { $category = 'base\\HttpException:' . $exception->statusCode; } elseif ($exception instanceof \ErrorException) { $category .= ':' . $exception->getSeverity(); } Application::error($exception, $category); }
public function __construct() { parent::__construct(); $this->assign("title", "Rechnungen"); $this->i = new InvoiceModel(); }
public function __construct() { parent::__construct(); }
/** * Error Handling */ ini_set('display_errors', 'On'); ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE); error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE); /** * Constants and Config */ define("DEBUG_MODE", 1); define("ROOT_DIR", __DIR__); /** * Initialize Framework Class-Loader */ require ROOT_DIR . "/framework/bootstrap.php"; /** * Initialize custom error handler */ use Base\ErrorHandler; set_error_handler(array(new ErrorHandler(), "log_error"), E_ALL ^ E_NOTICE ^ E_WARNING); set_exception_handler(array(new ErrorHandler(), "log_exception")); register_shutdown_function(array(new ErrorHandler(), "check_for_fatal")); /** * Activate Stargate */ use Base\Application; $application = new Application(); $application->run(); /* print (microtime(true)-$time). ' seconds and '. (memory_get_usage()-$memory). ' bytes'; */
/** * 读取配置信息 * @param array $key 键名 * @return array|string */ protected final function getConfig($key) { $result = Application::app()->getConfig()->get($key); return is_string($result) ? $result : $result->toArray(); }
public function __construct() { parent::__construct(); $this->assign("title", "Rechnungen"); }
public function __construct() { parent::__construct(); $this->p = new ProjectModel(); }
public function __construct() { parent::__construct(); $this->form = array("email" => array("error" => false, "value" => $_POST["email"]), "password" => array("error" => false, "value" => ""), "password_verify" => array("error" => false, "value" => ""), "company" => array("error" => false, "value" => $_POST["company"]), "firstname" => array("error" => false, "value" => $_POST["firstname"]), "lastname" => array("error" => false, "value" => $_POST["lastname"]), "street" => array("error" => false, "value" => $_POST["street"]), "zip" => array("error" => false, "value" => $_POST["zip"]), "city" => array("error" => false, "value" => $_POST["city"]), "country" => array("error" => false, "value" => $_POST["country"])); }