Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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);
     }
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     $this->person = new PersonModel();
 }
Ejemplo n.º 4
0
 public function __construct()
 {
     parent::__construct();
     $this->assign("title", "Dashboard");
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     parent::__construct();
     $this->e = new EmployeeModel();
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     parent::__construct();
     $this->c = new CustomerData();
 }
Ejemplo n.º 8
0
 /**
  * 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);
 }
Ejemplo n.º 9
0
 public function __construct()
 {
     parent::__construct();
     $this->assign("title", "Rechnungen");
     $this->i = new InvoiceModel();
 }
Ejemplo n.º 10
0
 public function __construct()
 {
     parent::__construct();
 }
Ejemplo n.º 11
0
/**
 * 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';
*/
Ejemplo n.º 12
0
 /**
  * 读取配置信息
  * @param array $key 键名
  * @return array|string
  */
 protected final function getConfig($key)
 {
     $result = Application::app()->getConfig()->get($key);
     return is_string($result) ? $result : $result->toArray();
 }
Ejemplo n.º 13
0
 public function __construct()
 {
     parent::__construct();
     $this->assign("title", "Rechnungen");
 }
Ejemplo n.º 14
0
 public function __construct()
 {
     parent::__construct();
     $this->p = new ProjectModel();
 }
Ejemplo n.º 15
0
 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"]));
 }