示例#1
0
 /**
  * @param int $wikiId
  * @param int $id
  */
 public function handleActivate($wikiId, $id)
 {
     $wikiDraft = $this->getItem($id, $this->wikiDraftRepository);
     $this->checkWikiDraft($wikiDraft, $wikiId);
     $this->wikiRepository->updateWithDraft($wikiDraft->wiki, $wikiDraft);
     $this->redirect('Homepage:default');
 }
示例#2
0
 /**
  * @param string $tagSlug
  * @param int    $limit
  * @param string $type
  */
 protected function runActionDefault($tagSlug, $limit, $type)
 {
     $tag = $this->getTag($tagSlug);
     $state = !$this->canAccess();
     $wikis = $tag ? $this->wikiRepository->getAllByTagForPage($this->vp->page, $limit, $tag, $type, $state) : $this->wikiRepository->getAllForPage($this->vp->page, $limit, $type, $state);
     $this->preparePaginator($wikis->count(), $limit);
     $this->throw404IfNoItemsOnPage($wikis, $tag);
     $this->wikis = $wikis;
     $this->tag = $tag;
 }
示例#3
0
 public function renderDefault()
 {
     $this->template->uploadDir = $this->context->parameters['uploadDir'];
     $this->template->videoThumbnail = $this->videoThumbnail;
     $this->template->news = $this->articleRepository->getAllNews();
     $this->template->latestArticles = $this->articleRepository->getLatestArticles();
     $this->template->latestImages = $this->imageRepository->getLatestImages();
     $this->template->latestVideos = $this->videoRepository->getLatestVideos();
     $this->template->latestGames = $this->wikiRepository->getLatestGames();
     $this->template->latestMovies = $this->wikiRepository->getLatestMovies();
     $this->template->latestBooks = $this->wikiRepository->getLatestBooks();
 }
示例#4
0
文件: WikiForm.php 项目: CSHH/website
 public function formSucceeded(Form $form)
 {
     try {
         $p = $this->getPresenter();
         $values = $form->getValues();
         $tag = $this->getSelectedTag($form);
         if ($this->item) {
             $ent = $this->wikiRepository->update($values, $tag, $this->type, $this->item);
             $p->flashMessage($this->translator->translate('locale.item.updated'));
         } else {
             $ent = $this->wikiRepository->create($values, $tag, $this->user, $this->type, new Entities\WikiEntity());
             $p->flashMessage($this->translator->translate('locale.item.created'));
         }
     } catch (Exceptions\MissingTagException $e) {
         $this->addFormError($form, $e);
     } catch (PossibleUniqueKeyDuplicationException $e) {
         $this->addFormError($form, $e);
     } catch (\Exception $e) {
         $this->addFormError($form, $e, $this->translator->translate('locale.error.occurred'));
     }
     if (!empty($ent)) {
         $p->redirect('this');
     }
 }