Exemple #1
0
 public function indexAction()
 {
     $form = new Admin_Form_Blog();
     $section = $this->blogService->getSection($this->user);
     if (empty($section)) {
         $this->_forward('nosection');
         return;
     }
     $request = $this->getRequest();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $blog = $this->blogService->createBlog($form->title->getValue(), $section);
         $this->_helper->flashMessenger("Article created");
         $this->_helper->redirector->gotoUrl($this->_helper->article->getEditLink($blog));
     }
     $blogConfig = \Zend_Registry::get('container')->getParameter('blog');
     $list = new ArticleList();
     $list->setPublication($section->getPublicationId());
     $list->setIssue($section->getIssueNumber());
     $list->setSection($section->getSectionNumber());
     $list->setLanguage($section->getLanguageId());
     $list->setType($blogConfig['article_type']);
     $this->view->list = $list;
     $this->view->form = $form;
 }
Exemple #2
0
 public function testGetSection()
 {
     $user = new User('uname');
     $this->assertNull($this->service->getSection($user));
 }