Example #1
0
 /**
  * Wrapper for calling the self::$show-method. This wrapper is necessary to call
  *
  * @internal
  *
  * @param string $show
  * @throws \FeM\sPof\exception\NotImplementedException
  * @return mixed content
  */
 public function executeShow($show = null)
 {
     // call show met
     if ($show === null) {
         $show = \FeM\sPof\Router::getShow($show);
     }
     if (!method_exists(get_called_class(), $show)) {
         throw new \FeM\sPof\exception\NotImplementedException(_s('Could not find the show method. "%s::%s"', get_called_class(), $show));
     }
     return $this->{$show}();
 }
Example #2
0
 /**
  * Execute the show method.
  *
  * @internal
  *
  * @param string $show
  * @return string
  */
 public function executeShow($show = null)
 {
     if ($show === null) {
         $show = Router::getShow();
     }
     // by default use the content from the show method or the form
     $content = parent::executeShow($show);
     // if still empty, guess there is a template
     if ($content === null) {
         $templateFile = '';
         if (isset(static::$TEMPLATE_DIR)) {
             $templateFile = static::$TEMPLATE_DIR . '/';
         } else {
             $templateFile = lcfirst(Router::getModule()) . '/';
         }
         $templateFile .= $show . '.tpl';
         try {
             $content = template\HtmlTemplate::getInstance()->fetch($templateFile);
         } catch (\SmartyException $e) {
             Logger::getInstance()->info(_s('Could not find template, next trying form. (%s)', $e->getMessage()));
         }
     }
     // if still empty, try to generate by form
     if (isset($this->form) && $this->form->isActive()) {
         $content .= $this->form->render();
     }
     // call show method
     $this->assign('content', $content);
     return $content;
 }