Ejemplo n.º 1
0
 public function handleRemoveTag()
 {
     if (!$this->authorizator->isAllowed($this->user, 'page_tag', 'remove')) {
         $this->flashMessage('authorization.noPermission', FlashMessage::WARNING);
         if ($this->presenter->isAjax()) {
             $this->presenter->payload->errorEl = 'no permission';
             $this->redrawControl('tag');
             return;
         } else {
             $this->redirect('this');
         }
     }
     try {
         $this->tagFacade->removeTag($this->tag->getId());
         if ($this->presenter->isAjax()) {
             $this->redrawControl('tag');
         } else {
             $this->redirect('this');
         }
     } catch (DBALException $e) {
         $this->flashMessage('tags.overview.actions.remove.messages.removeError', FlashMessage::ERROR);
         if ($this->presenter->isAjax()) {
             // value does not matter, in JS we just check existence of this variable
             $this->presenter->payload->errorEl = true;
             $this->redrawControl('flashes');
         } else {
             $this->redirect('this');
         }
     }
 }
Ejemplo n.º 2
0
 public function onSuccessTagRemoval(Tag $tag, $id)
 {
     $this->appEventLogger->saveLog(sprintf('User [%s#%s] <b>has REMOVED</b> Tag [%s#%s]', $this->user->getId(), $this->user->getUsername(), $id, $tag->getName()), 'page_tag_removal', $this->user->getId());
 }
Ejemplo n.º 3
0
 public function onSuccessTagSaving(Tag $tag, TagFormControl $control)
 {
     $control->flashMessage('tags.tagForm.messages.success', FlashMessage::SUCCESS, ['name' => $tag->getName()]);
     $control->redirect('this');
 }
Ejemplo n.º 4
0
 /**
  * @param Tag $tag
  */
 private function createUrl(Tag $tag)
 {
     $url = UrlGenerator::create(sprintf('search/%s', $tag->getName()), 'Pages:Front:Search', 'tag', $tag->getId());
     $this->urlFacade->saveUrl($url);
 }