/** * * Edit an answer * * @param string $pagekey selects the array with the page-id. * @param $id selects the answer to edit. * */ public function editAction($id, $redirect = '') { $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect); $formundo->setDI($this->di); $formundo->check(); $undourl = $formundo->getHTML(); $answers = new \Anax\Answer\Answer(); $controller = 'answer'; $answers->setDI($this->di); $answer = $answers->findAnswer(null, $id); $answer = is_object($answer[0]) ? get_object_vars($answer[0]) : $answer; if ($_SESSION['user']->name != ($answer['name'] || 'Administratör')) { header('Location: ' . $this->url->create('users/message/wronguser')); die("Du har inte tillstånd att gå in på den här sidan!"); } $form = new \Anax\HTMLForm\CFormAnswerEdit($id, $answer['content'], $answer['name'], $answer['web'], $answer['mail'], $answer['pagekey'], $redirect); $form->setDI($this->di); $form->check(); $this->theme->setTitle("Redigera svar"); $this->di->views->add('default/page', ['title' => "Redigera svar", 'content' => '<h4>Svar #' . $id . '</h4>' . $form->getHTML() . $undourl], 'main'); }
/** * * Edit an answer * * @param string $pagekey selects the array with the page-id. * @param $id selects the answer to edit. * */ public function editAction($id, $redirect = '') { //$redirect = '/view/'.$redirect; $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect); $formundo->setDI($this->di); $formundo->check(); $undourl = $formundo->getHTML(); $answers = new \Anax\Answer\Answer(); $controller = 'answer'; $answers->setDI($this->di); $answer = $answers->findAnswer(null, $id); $answer = is_object($answer[0]) ? get_object_vars($answer[0]) : $answer; if ($_SESSION['user']->acronym != ($answer['acronym'] || 'admin')) { header('Location: ' . $this->url->create('users/message/wronguser')); die("You don't have permission to enter this page!"); } $form = new \Anax\HTMLForm\CFormAnswerEdit($id, $answer['content'], $answer['acronym'], $answer['web'], $answer['mail'], $answer['pagekey'], $redirect); $form->setDI($this->di); $form->check(); $this->theme->setTitle("Edit answer"); $this->di->views->add('default/page', ['title' => "Edit answer", 'content' => '<h4>Answer #' . $id . '</h4>' . $form->getHTML() . $undourl], 'main'); }
/** * * Edit a question * * @param $id selects the question to edit. * */ public function editAction($id, $redirect = '') { $redirect = $this->url->create('question/view/' . $id); $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect); $formundo->setDI($this->di); $formundo->check(); $undourl = $formundo->getHTML(); $controller = 'question'; $question = $this->question->findQuestion(null, $id); $question = is_object($question[0]) ? get_object_vars($question[0]) : $question; if ($_SESSION['user']->name != $question['name']) { header('Location: ' . $this->url->create('users/message/wronguser')); die("Du har inte tillstånd att gå in på den här sidan!"); } $form = new \Anax\HTMLForm\CFormQuestionEdit($id, $question['tag'], $question['tagslug'], $question['title'], $question['userid'], $question['content'], $redirect); $form->setDI($this->di); $form->check(); $this->theme->setTitle("Redigera fråga"); $this->di->views->add('default/page', ['title' => "Redigera fråga", 'content' => '<h4>Fråga #' . $id . '</h4>' . $form->getHTML() . $undourl], 'main'); }
/** * * Edit a question * * @param $id selects the question to edit. * */ public function editAction($id, $slug, $redirect = '') { $redirect = 'news/view/' . $id . '/' . $slug; //test $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect); $formundo->setDI($this->di); $formundo->check(); $undourl = $formundo->getHTML(); $controller = 'news'; $news = $this->news->findNews(null, $id); $news = is_object($news[0]) ? get_object_vars($news[0]) : $news; /*if($_SESSION['user']->acronym != $news['acronym']) { header('Location: ' . $this->url->create('users/message/wronguser')); die("You don't have permission to enter this page!"); }*/ $form = new \Anax\HTMLForm\CFormNewsEdit($id, $news['tag'], $news['tagslug'], $news['title'], $news['userid'], $news['author'], $news['content'], $news['image'], $news['imagewidth'], $news['imageheight'], $redirect); $form->setDI($this->di); $form->check(); $this->theme->setTitle("Edit news"); $this->di->views->add('default/page', ['title' => "Edit news", 'content' => '<h4>Article #' . $id . '</h4>' . $form->getHTML() . $undourl], 'main'); }
/** * * Edit a question * * @param $id selects the question to edit. * */ public function editAction($id, $redirect = '') { $redirect = 'question/view/' . $id; $formundo = new \Anax\HTMLForm\CFormCommentUndo($redirect); $formundo->setDI($this->di); $formundo->check(); $undourl = $formundo->getHTML(); $controller = 'question'; $question = $this->question->findQuestion(null, $id); $question = is_object($question[0]) ? get_object_vars($question[0]) : $question; if ($_SESSION['user']->acronym != $question['acronym']) { header('Location: ' . $this->url->create('users/message/wronguser')); die("You don't have permission to enter this page!"); } $form = new \Anax\HTMLForm\CFormQuestionEdit($id, $question['tag'], $question['tagslug'], $question['title'], $question['userid'], $question['content'], $redirect); $form->setDI($this->di); $form->check(); $this->theme->setTitle("Edit question"); $this->di->views->add('default/page', ['title' => "Edit question", 'content' => '<h4>Question #' . $id . '</h4>' . $form->getHTML() . $undourl], 'main'); }