예제 #1
0
 public function __construct($slim)
 {
     parent::__construct($slim);
     $this->container = $this->app->container;
     $this->request = $this->app->request;
     $this->template = $this->app->container->get('plates.template');
 }
예제 #2
0
 /**
  * Renders output with given template
  *
  * @param string $template Name of the template to be rendererd
  * @param array $args Args for view
  */
 protected function render($template, $args = array())
 {
     if (isset($_SESSION['formData'])) {
         $args = array_merge($_SESSION['formData'], $args);
         unset($_SESSION['formData']);
     }
     parent::render($template, $args);
 }
예제 #3
0
 function __construct()
 {
     $this->app = $app = \Slim\Slim::getInstance();
     parent::__construct($app);
     if (isset($_SESSION['userInfo'])) {
         $this->currentUser = $_SESSION['userInfo'];
     } else {
         $this->currentUser = null;
     }
 }
 public function __construct(Slim $app, Command $command = null, CLImate $climate = null)
 {
     parent::__construct($app);
     $this->cliReader = $command ?: new Command();
     $this->cliWriter = $climate ?: new CLImate();
     // Define the first mandatory command
     $currentCommand = $this->app->router()->getCurrentRoute()->getPattern();
     $this->cliReader->option()->require()->describedAs('The command to execute')->must(function ($command) use($currentCommand) {
         return $currentCommand === $command;
     });
     $this->initCommand();
 }