+ $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $pdfContent = $this->exportService->pageToPdf($page);
+ return response()->make($pdfContent, 200, [
+ 'Content-Type' => 'application/octet-stream',
+ 'Content-Disposition' => 'attachment; filename="' . $pageSlug . '.pdf'
+ ]);
+ }
+
+ /**
+ * Export a page to a self-contained HTML file.
+ * @param string $bookSlug
+ * @param string $pageSlug
+ * @return \Illuminate\Http\Response
+ */
+ public function exportHtml($bookSlug, $pageSlug)
+ {
+ $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $containedHtml = $this->exportService->pageToContainedHtml($page);
+ return response()->make($containedHtml, 200, [
+ 'Content-Type' => 'application/octet-stream',
+ 'Content-Disposition' => 'attachment; filename="' . $pageSlug . '.html'
+ ]);
+ }
+
+ /**
+ * Export a page to a simple plaintext .txt file.
+ * @param string $bookSlug
+ * @param string $pageSlug
+ * @return \Illuminate\Http\Response
+ */
+ public function exportPlainText($bookSlug, $pageSlug)
+ {
+ $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $containedHtml = $this->exportService->pageToPlainText($page);
+ return response()->make($containedHtml, 200, [
+ 'Content-Type' => 'application/octet-stream',
+ 'Content-Disposition' => 'attachment; filename="' . $pageSlug . '.txt'
+ ]);
+ }
+
+ /**
+ * Show a listing of recently created pages
+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+ */
+ public function showRecentlyCreated()
+ {
+ $pages = $this->entityRepo->getRecentlyCreatedPaginated('page', 20)->setPath(baseUrl('/pages/recently-created'));
+ return view('pages/detailed-listing', [
+ 'title' => trans('entities.recently_created_pages'),
+ 'pages' => $pages
+ ]);
+ }
+
+ /**
+ * Show a listing of recently created pages
+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+ */
+ public function showRecentlyUpdated()
+ {
+ $pages = $this->entityRepo->getRecentlyUpdatedPaginated('page', 20)->setPath(baseUrl('/pages/recently-updated'));
+ return view('pages/detailed-listing', [
+ 'title' => trans('entities.recently_updated_pages'),
+ 'pages' => $pages
+ ]);
+ }
+
+ /**
+ * Show the Restrictions view.
+ * @param string $bookSlug
+ * @param string $pageSlug
+ * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
+ */
+ public function showRestrict($bookSlug, $pageSlug)
+ {
+ $page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $this->checkOwnablePermission('restrictions-manage', $page);
+ $roles = $this->userRepo->getRestrictableRoles();
+ return view('pages/restrictions', [
+ 'page' => $page,
+ 'roles' => $roles
+ ]);