/**
  * Add new questions.
  *
  * @param string $acronym of user to add.
  *
  * @return void
  */
 public function addAction()
 {
     $this->di->session();
     $form = new \Anax\HTMLForm\CFormQuestionAdd();
     $form->setDI($this->di);
     $form->check();
     $this->di->theme->setTitle("Ny Fråga");
     $this->di->views->add('default/page', ['title' => "Ny fråga", 'content' => $form->getHTML()]);
 }
Beispiel #2
0
 /**
  * Add a question with CForm.
  *
  * @return void
  */
 public function addAction($redirect = 'question')
 {
     $undourl = '<p><a href="' . $this->di->get('url')->create($redirect) . '">Ångra</p>';
     $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect);
     $formundo->setDI($this->di);
     $formundo->check();
     $undourl = $formundo->getHTML();
     $url = $this->url->create('users/login');
     if (isset($_SESSION['user'])) {
         $form = new \Anax\HTMLForm\CFormQuestionAdd($redirect);
         $form->setDI($this->di);
         $form->check();
         $this->theme->setTitle('Skriv en fråga');
         $this->di->views->add('question/addform', ['title' => "Skriv en fråga", 'content' => $form->getHTML() . $undourl]);
     } else {
         $this->di->views->add('default/link', ['anchor' => "Logga in för att ställa en fråga", 'url' => $url]);
     }
 }
Beispiel #3
0
 /**
  * Used to ask a question via CForm subclasses
  *
  * @return void
  */
 public function addAction()
 {
     $tags = $this->tags->findAll();
     $tagArray = array();
     foreach ($tags as $tag) {
         $tagArray[] = $tag->getProperties()['name'];
     }
     if ($this->user->isAuthenticated()) {
         $form = new \Anax\HTMLForm\CFormQuestionAdd($tagArray);
         $form->setDI($this->di);
         $status = $form->check();
         $this->theme->setTitle("Ställ en fråga");
         $this->views->add('questions/form', ['title' => 'Ställ en fråga', 'content' => $form->getHTML()], 'main');
     } else {
         $url = $this->url->create('login');
         $this->response->redirect($url);
     }
 }