public function show($id = null) { $filename = get('filename'); $page = $this->page($id); $file = $this->file($page, $filename); $blueprint = blueprint::find($page); $fields = $blueprint->files()->fields($page); $meta = $file->meta()->toArray(); $files = api::files($page, $blueprint); $index = $files->indexOf($file); $next = $files->nth($index + 1); $prev = $files->nth($index - 1); // breadcrumb items if ($page->isSite()) { $items = array(array('url' => purl('metatags'), 'title' => l('metatags')), array('url' => purl('files/index'), 'title' => l('metatags.files')), array('url' => purl($file, 'show'), 'title' => $file->filename())); } else { $items = array(array('url' => purl('files/index/' . $page->id()), 'title' => l('files')), array('url' => purl($file, 'show'), 'title' => $file->filename())); } // file info display $info = array(); $info[] = $file->type(); $info[] = $file->niceSize(); if ((string) $file->dimensions() != '0 x 0') { $info[] = $file->dimensions(); } return view('files/show', array('topbar' => new Snippet('pages/topbar', array('menu' => new Snippet('menu'), 'breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page, 'items' => $items)), 'search' => purl($page, 'search'))), 'form' => new Form($fields->toArray(), $meta), 'p' => $page, 'f' => $file, 'next' => $next, 'prev' => $prev, 'info' => implode(' / ', $info))); }
public function show($id) { $page = $this->page($id); $blueprint = blueprint::find($page); $fields = $blueprint->fields($page); $content = $page->content()->toArray(); $files = null; $subpages = null; $preview = null; // create the preview link if ($previewSetting = $blueprint->preview()) { switch ($previewSetting) { case 'parent': $preview = $page->parent() ? $page->parent()->url() : $page->url(); break; case 'first-child': $preview = $page->children()->first() ? $page->children()->first()->url() : false; break; case 'last-child': $preview = $page->children()->last() ? $page->children()->last()->url() : false; break; default: $preview = $page->url(); break; } } // make sure the title is always there $content['title'] = $page->title(); // create the form $form = new Form($fields->toArray(), $content); // check for untranslatable fields if (site()->language() != site()->defaultLanguage()) { foreach ($form->fields() as $field) { if ($field->translate() == false) { $field->readonly = true; $field->disabled = true; } } } // create the subpages if they exist if ($blueprint->pages()->max() !== 0 and $blueprint->pages()->hide() == false) { // fetch all subpages in the right order $children = api::subpages($page->children(), $blueprint); // add pagination to the subpages if ($limit = $blueprint->pages()->limit()) { $children = $children->paginate($limit, array('page' => get('page'))); } // create the snippet and fill it with all data $subpages = new Snippet('pages/sidebar/subpages', array('title' => l('pages.show.subpages.title'), 'page' => $page, 'subpages' => $children, 'addbutton' => !api::maxPages($page, $blueprint->pages()->max()), 'pagination' => $children->pagination())); } // create the files if ($blueprint->files()->max() !== 0 and $blueprint->files()->hide() == false) { $files = new Snippet('pages/sidebar/files', array('page' => $page, 'files' => api::files($page, $blueprint))); } // create the monster sidebar $sidebar = new Snippet('pages/sidebar', array('page' => $page, 'preview' => $preview, 'deletable' => !$page->hasChildren() and $page->isDeletable() and $blueprint->deletable(), 'subpages' => $subpages, 'files' => $files)); return view('pages/show', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page)), 'search' => purl($page, 'search'))), 'sidebar' => $sidebar, 'form' => $form, 'page' => $page, 'notitle' => !$form->fields()->get('title'))); }
public function index() { $site = site(); $blueprint = blueprint::find($site); $fields = $blueprint->fields($site)->toArray(); $content = $site->content()->toArray(); $files = null; // create the files if ($blueprint->files()->max() !== 0 and $blueprint->files()->hide() == false) { $files = new Snippet('pages/sidebar/files', array('page' => $site, 'files' => api::files($site, $blueprint))); } return view('metatags/index', array('topbar' => new Snippet('pages/topbar', array('breadcrumb' => new Snippet('breadcrumb', array('items' => array(array('title' => l('metatags'), 'url' => purl('metatags/'))))), 'search' => purl('pages/search/'))), 'form' => new Form($fields, $content), 's' => $site, 'files' => $files, 'license' => panel()->license())); }
public function show($id) { $filename = get('filename'); $page = $this->page($id); $file = $this->file($page, $filename); $blueprint = blueprint::find($page); $fields = $blueprint->files()->fields($page); $meta = $file->meta()->toArray(); $files = api::files($page, $blueprint); $index = $files->indexOf($file); $next = $files->nth($index + 1); $prev = $files->nth($index - 1); return view('files/show', array('topbar' => new Snippet('pages/topbar', array('menu' => new Snippet('menu'), 'breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page, 'items' => array(array('url' => purl('files/index/' . $page->id()), 'title' => l('files')), array('url' => purl($file, 'show'), 'title' => $file->filename())))), 'search' => purl($page, 'search'))), 'form' => new Form($fields->toArray(), $meta), 'p' => $page, 'f' => $file, 'next' => $next, 'prev' => $prev)); }