Пример #1
0
 /**
  * Initialize the form property.
  *
  * @api
  */
 protected function initializeForm($namespace = null)
 {
     if ($namespace !== null) {
         $classname = $namespace . '\\';
     } else {
         $classname = Application::$NAMESPACE . 'form\\';
     }
     $classname .= Router::getModule() . 'Form';
     $show = Request::getStrParam('show');
     $this->form = new $classname();
     if (method_exists($classname, $show)) {
         $this->form->{$show}();
         $this->form->setActive(true);
     }
 }
Пример #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;
 }
Пример #3
0
 /**
  * Log the session. Module and session id are already there
  *
  * @internal
  *
  * @param array $reference other reference parameters, e.g. new generated ids
  * @param array $parameters url parameters, e.g. from $_GET
  */
 protected final function trackSession(array $reference, array $parameters)
 {
     \FeM\sPof\model\LogSession::add(['session_id' => session_id(), 'view' => Router::getModule(), 'reference_parameters' => serialize($reference), 'other_parameters' => serialize($parameters)]);
 }
Пример #4
0
 /**
  *
  * @internal
  *
  * @param array $reference reference ids
  * @param string $description (optional) additional information
  * @param bool $success (optional)
  */
 protected final function logEvent(array $reference, $description = null, $success = false)
 {
     LogEvent::add(['event' => Router::getModule() . '.' . $this->command . '.' . ($success ? 'Success' : 'Fail'), 'user_id' => Session::getUserId(), 'reference_parameters' => json_encode($reference), 'description' => $description]);
 }