Example #1
0
 /**
  * @brief renders the index page
  * @param array $urlParams: an array with the values, which were matched in 
  *                          the routes file
  * @return an instance of a Response implementation
  */
 public function index($urlParams = array())
 {
     $response = new TemplateResponse($this->appName, 'main');
     $params = array('somesetting' => $this->api->getSystemValue('somesetting'));
     $response->setParams($params);
     return $response;
 }
 public function fetch($user, $page)
 {
     $pageoffset = $page - 1;
     $template = new TemplateResponse('activity', 'stream.list', ['activity' => $this->data->read($this->helper, $this->settings, self::DEFAULT_PAGE_SIZE * $pageoffset, self::DEFAULT_PAGE_SIZE, 'all', $user), 'displayHelper' => $this->display], '');
     file_put_contents('show_activity', $template->render());
     return $template->render();
 }
Example #3
0
 /**
  * @brief renders the settings page
  * @param array $urlParams: an array with the values, which were matched in 
  *                          the routes file
  */
 public function index($urlParams = array())
 {
     $this->api->addScript('admin');
     $response = new TemplateResponse($this->appName, 'settings');
     $response->renderAs('admin');
     $params = array('url' => $this->api->getSystemValue('somesetting'));
     $response->setParams($params);
     return $response;
 }
Example #4
0
 /**
  * Shortcut for rendering a template
  * @param string $templateName: the name of the template
  * @param array $params: the template parameters in key => value structure
  * @param string $renderAs: user renders a full page, blank only your template
  *                          admin an entry in the admin settings
  * @param array $headers: set additional headers
  * @return a TemplateResponse
  */
 protected function render($templateName, $params = array(), $renderAs = 'user', $headers = array())
 {
     $response = new TemplateResponse($this->appName, $templateName, $renderAs);
     $response->setParams($params);
     $response->renderAs($renderAs);
     foreach ($headers as $header) {
         $response->addHeader($header);
     }
     return $response;
 }
 public static function template2pdf($template, $data)
 {
     return static::html2pdf(TemplateResponse::getSource($template, $data));
 }