public function page($slug = '') { // allow admin to view unpublished posts if (Users::authed() === false) { $params['status'] = 'published'; } // if no slug is set we will use our default page if (empty($slug)) { $params['id'] = Config::get('metadata.home_page'); } else { $params['slug'] = $slug; } // if we cant find either it looks like we're barney rubble (in trouble) if (($page = Pages::find($params)) === false) { return Response::error(404); } // store our page for template functions IoC::instance('page', $page, true); // does the current page host our posts? if ($page->id == Config::get('metadata.posts_page')) { // render our posts template return Template::render('posts'); } // render our page template Template::render('page'); }
public function edit($id) { // find article if (($article = Posts::find(array('id' => $id))) === false) { return Response::redirect($this->admin_url . '/posts'); } // process post request if (Input::method() == 'POST') { if (Posts::update($id)) { // redirect path return Response::redirect($this->admin_url . '/posts/edit/' . $id); } } // get comments $comments = Comments::list_all(array('post' => $id)); $pending = array(); foreach ($comments as $comment) { if ($comment->status == 'pending') { $pending[] = $comment->id; } } $pending = count($pending); // get posts page $page = Pages::find(array('id' => Config::get('metadata.posts_page'))); Template::render('posts/edit', array('article' => $article, 'comments' => $comments, 'page' => $page, 'pending' => $pending)); }
private static function setup() { // Query metadata and store into our config $sql = "select `key`, `value` from meta"; Config::set('metadata', Db::pairs($sql)); // look up which page has our posts $page = Pages::find(array('id' => Config::get('metadata.posts_page'))); IoC::instance('posts_page', $page, true); }
function szczegolyAction() { $oRequest = $this->getRequest(); $iPages = $oRequest->getParam('id'); $oPages = new Pages(); $this->view->oPages = $oPages->find($iPages)->current(); $strony = new Strony(); $this->view->strony = $strony->fetchAll(); }
private static function setup() { // Query metadata and store into our config $sql = "select `key`, `value` from meta"; $meta = array(); foreach (Db::results($sql) as $row) { $meta[$row->key] = $row->value; } Config::set('metadata', $meta); // look up which page has our posts $page = Pages::find(array('id' => Config::get('metadata.posts_page'))); IoC::instance('posts_page', $page, true); }
public function edit($id) { // find page if (($page = Pages::find(array('id' => $id))) === false) { return Response::redirect($this->admin_url . '/pages'); } // process post request if (Input::method() == 'POST') { if (Pages::update($id)) { // redirect path return Response::redirect($this->admin_url . '/pages/edit/' . $id); } } Template::render('pages/edit', array('page' => $page)); }
public function savepage() { if (Input::get('pageid')) { $page = Pages::find(Input::get('pageid')); } else { $page = new Pages(); } $page->slug = Input::get('page_slug'); $page->title = Input::get('title'); $page->subtitle = Input::get('subtitle'); $page->content = Input::get('content'); $page->status = Input::get('status'); $page->save(); if (Input::get('saveclose')) { return Redirect::to('backend/pages/')->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved'))); } else { return Redirect::to('backend/editpage/' . $page->id)->withMessage($this->notifyView(Lang::get('laracms::messages.page_saved'))); } }
public function setOrderPosition($item, $parent = 0) { $page = Pages::find($item['id']); $page->order = $this->position++; $page->id_parent = $parent; $page->save(); if (isset($item['children'])) { foreach ($item['children'] as $subitem) { # code... $this->setOrderPosition($subitem, $item['id']); } } }
static function page($slug) { $page = Pages::where('slug', '=', $slug)->first(); $page = Pages::find($page->id); return $page; }
public function postViewPage($id) { if (Session::get('group_id') == '100') { Auth::logout(); Session::flush(); header("HTTP/1.1 404 Page Not Found", true, 404); exit("You cannot do this."); } else { $result = Pages::find($id); $name = time() . '_faxpage.pdf'; $data['filepath'] = __DIR__ . '/../../public/temp/' . $name; copy($result->file, $data['filepath']); $data['html'] = '<iframe src="' . asset('temp/' . $name) . '" width="770" height="425" style="border: none;"></iframe>'; echo json_encode($data); } }
public function postDestroy() { if ($this->access['is_remove'] == 0) { return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page ')); } $ids = Input::get('id'); for ($i = 0; $i < count($ids); $i++) { $row = Pages::find($ids[$i]); $filename = public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php"; if (file_exists($filename) && $row->filename != '') { unlink(public_path() . "protected/app/views/pages/template/" . $row->filename . ".blade.php"); } } // delete multipe rows $data = $this->model->destroy(Input::get('id')); self::createRouters(); Session::flash('message', SiteHelpers::alert('success', 'Successfully deleted row!')); return Redirect::to('pages'); }
public function actionIndex() { return Pages::find(); }
/** * Return subpages * * @param Page $page * @param integer $min_state * @param integer $min_visibility * @return array */ function findSubpages($page, $min_state = STATE_VISIBLE, $min_visibility = VISIBILITY_NORMAL) { return Pages::find(array('conditions' => array('parent_id = ? AND type = ? AND state >= ? AND visibility >= ?', $page->getId(), 'Page', $min_state, $min_visibility, false), 'order' => 'ISNULL(position) ASC, position')); }
public function page($id) { $mdPage = new Pages(); $item = $mdPage->find($id); $data['page'] = $item; $this->data['pageTitle'] = $item->title; $this->data['pageNote'] = CNF_APPNAME; //$this->data['breadcrumb'] = 'inactive'; $page = 'pages.template.index'; $page = SiteHelpers::renderHtml($page); $this->layout->nest('content', $page, $data)->with('page', $this->data); }