public function avatar($username) { $user = $this->user($username); $back = array('users' => purl('users'), 'user' => purl($user, 'edit'), 'dashboard' => purl('')); if (!site()->user()->isAdmin() and !$user->isCurrent()) { goToErrorView('modal'); } return view('users/avatar', array('user' => $user, 'uploadable' => is_writable(kirby()->roots()->avatars()), 'back' => a::get($back, get('to')))); }
public function index($id) { $page = $this->page($id); $blueprint = blueprint::find($page); $files = api::files($page, $blueprint); // don't create the view if the page is not allowed to have files if ($blueprint->files()->max() === 0) { goToErrorView(); } return view('files/index', 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'))))), 'search' => purl($page, 'search'))), 'page' => $page, 'files' => $files, 'sortable' => $blueprint->files()->sortable())); }
public function index($id = null) { $page = $this->page($id); $blueprint = blueprint::find($page); $visible = api::subpages($page->children()->visible(), $blueprint); $invisible = api::subpages($page->children()->invisible(), $blueprint); $baseUrl = rtrim(purl('subpages/index/' . $page->id()), '/'); // don't create the view if the page is not allowed to have subpages if ($blueprint->pages()->max() === 0) { goToErrorView(); } if ($limit = $blueprint->pages()->limit()) { $visible = $visible->paginate($limit, array('page' => get('visible'))); $invisible = $invisible->paginate($limit, array('page' => get('invisible'))); $visiblePagination = new Snippet('subpages/pagination', array('pagination' => $visible->pagination(), 'nextUrl' => $baseUrl . '/visible:' . $visible->pagination()->nextPage() . '/invisible:' . $invisible->pagination()->page(), 'prevUrl' => $baseUrl . '/visible:' . $visible->pagination()->prevPage() . '/invisible:' . $invisible->pagination()->page())); $invisiblePagination = new Snippet('subpages/pagination', array('pagination' => $invisible->pagination(), 'nextUrl' => $baseUrl . '/visible:' . $visible->pagination()->page() . '/invisible:' . $invisible->pagination()->nextPage(), 'prevUrl' => $baseUrl . '/visible:' . $visible->pagination()->page() . '/invisible:' . $invisible->pagination()->prevPage())); } return view('subpages/index', array('page' => $page, 'topbar' => new Snippet('pages/topbar', array('menu' => new Snippet('menu'), 'breadcrumb' => new Snippet('pages/breadcrumb', array('page' => $page, 'items' => array(array('url' => purl('subpages/index/' . $id), 'title' => l('subpages'))))), 'search' => purl($page, 'search'))), 'baseurl' => $baseUrl, 'addbutton' => !api::maxPages($page, $blueprint->pages()->max()) and $page->hasChildren(), 'sortable' => $blueprint->pages()->sortable(), 'visible' => $visible, 'flip' => $blueprint->pages()->sort() == 'flip', 'visiblePagination' => $visiblePagination, 'invisible' => $invisible, 'invisiblePagination' => $invisiblePagination)); }
public function index($id = null) { $page = $this->page($id); $blueprint = blueprint::find($page); $files = api::files($page, $blueprint); $back = purl($page, 'show'); // don't create the view if the page is not allowed to have files if ($blueprint->files()->max() === 0) { goToErrorView(); } if ($page->isSite()) { // breadcrumb items $items = array(array('url' => purl('metatags'), 'title' => l('metatags')), array('url' => purl('files/index'), 'title' => l('metatags.files'))); // modify the back url $back = purl('metatags'); } else { // breadcrumb items $items = array(array('url' => purl('files/index/' . $page->id()), 'title' => l('files'))); } return view('files/index', 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'))), 'page' => $page, 'files' => $files, 'back' => $back, 'sortable' => $blueprint->files()->sortable())); }
public function url($id) { $page = $this->page($id); if ($page->isHomePage() or $page->isErrorPage()) { goToErrorView('modal'); } return view('pages/url', array('page' => $page)); }
public function toggle($id) { $page = $this->page($id); if ($page->isErrorPage()) { goToErrorView('modal'); } $form = panel()->form('pages.toggle'); $form->save = l('change'); $form->back = purl($page, 'show'); if ($page->isVisible()) { $form->fields->confirmation->text = l('pages.toggle.hide'); } else { $form->fields->confirmation->text = l('pages.toggle.publish'); } return view('pages/toggle', array('page' => $page, 'form' => $form)); }