/** * Add new tips or questions. */ public function newAction() { $usersId = $this->auth->getAuth()['id']; if (!$usersId) { $this->flashSession->error('You must be logged first'); return $this->indexRedirect(); } $firstTime = Posts::countByUsersId($usersId) == 0; $this->view->setVars(['form' => new QuestionsForm(), 'firstTime' => $firstTime, 'tab' => 'new', 'type' => Posts::POST_QUESTIONS]); $this->assets->addJs('core/assets/js/tags-suggest.js'); $this->tag->setTitle($this->escaper->escapeHtml(t('Create Questions'))); return $this->view->pick('edit'); }
/** * Form add link hackernew @hackernew/submit * * @return mixed */ public function hackernewAction() { $usersId = $this->auth->getAuth()['id']; if (!$usersId) { $this->flashSession->error('You must be logged first'); return $this->indexRedirect(); } $firstTime = Posts::countByUsersId($usersId) == 0; $this->view->setVars(['form' => new HackernewForm(), 'firstTime' => $firstTime, 'currentOrder' => 'hackernew']); $this->tag->setTitle($this->escaper->escapeHtml(t('Hackernews or Versions'))); return $this->view->pickCustom('posts/hackernew'); }