コード例 #1
0
 /**
  * Add new user.
  *
  * @param string $acronym of user to add.
  *
  * @return void
  */
 public function answerAction($qid, $cid)
 {
     $this->user = new \Anax\Users\User();
     $this->user->setDI($this->di);
     // Kommentarer
     $q = $this->comments->find($qid);
     $all = $this->comments->query()->where('id = ?')->execute([$cid]);
     $this->theme->setTitle('Svara på en kommentar');
     $this->views->add('comment/list', ['comments' => $all, 'user' => $this->user, 'title' => 'Du vill svara på:']);
     if ($this->session->has("user_loggedin")) {
         // SvarsFormulär
         $form = new \Anax\HTMLForm\FormAddComment($qid, $cid);
         $form->setDI($this->di);
         $status = $form->check();
         $this->di->views->add('users/form', ['title' => "Ditt svar", 'content' => $form->getHTML()]);
         if ($status === true) {
             echo 'true';
             $url = $this->url->create('list');
             $form->response->redirect($url);
         }
     } else {
         $this->dispatcher->forward(['controller' => 'logins', 'action' => 'easy-Login', 'params' => ['title' => 'Logga in för att svara']]);
     }
 }
コード例 #2
0
 /**
  * Add new user.
  *
  * @param string $acronym of user to add.
  *
  * @return void
  */
 public function addAction($acronym = null)
 {
     $form = new \Anax\HTMLForm\FormAddComment($this->pagekey);
     $form->setDI($this->di);
     $status = $form->check();
     if ($this->session->has("user_loggedin")) {
         $this->di->views->add('users/form', ['title' => "Lägg till kommentar", 'content' => $form->getHTML()]);
     }
     if ($status === true) {
         echo 'true';
         $url = $this->url->create('list');
         $form->response->redirect($url);
     }
 }