Esempio n. 1
0
 public function init(Website $website, Request $request)
 {
     $isStaff = $website->isLoggedInAsStaff();
     $id = $request->getParamInt(0);
     $this->editLinks = $website->isLoggedInAsStaff(true);
     // Load document
     $documentRepo = new DocumentRepository($website->getDatabase(), $isStaff);
     $this->document = $documentRepo->getDocument($id);
     // Load document widgets
     $this->widgetLoader = $website->getWidgets();
     $widgetRepo = new WidgetRepository($website);
     $this->widgets = $widgetRepo->getWidgetsInDocumentWithId($id);
 }
Esempio n. 2
0
 public function init(Website $website, Request $request)
 {
     $documentId = $request->getParamInt(0, 0);
     $documentRepo = new DocumentRepository($website->getDatabase(), true);
     $this->document = $documentRepo->getDocument($documentId);
     if (Validate::requestToken($request)) {
         $widgetRepo = new WidgetRepository($website);
         $documentRepo->deleteDocument($this->document, $widgetRepo);
         $text = $website->getText();
         $text->addMessage($text->t("main.document") . ' ' . $text->t("editor.is_deleted"));
         $this->deleted = true;
     }
     $this->requestToken = RequestToken::generateNew();
     $this->requestToken->saveToSession();
 }