load->model('page_model'); $this->load->model('alsosee_model'); } private $view = 'main'; public function index() { $this->logPage(); $this->view(); } public function view() { $this->logPage(); $url_segments = $this->uri->rsegment_array(); $url_segments = array_slice($url_segments, 2); $rootline = array(); $pid = 0; foreach($url_segments as $url_segment) { $page = $this->page_model->getOnUrlSegment($url_segment, $pid); if ($page !== FALSE) { $rootline[] = $page; $pid = $page->uid; } else { show_404(); } } $uid = $rootline[sizeof($rootline)-1]->uid; $page = $this->page_model->get($uid); //ophalen contentelementen html $result_StaticPage = $this->page_model->getStaticPage($uid); $pageData = array(); $html = array(); $paginakop = ""; foreach ( $result_StaticPage->result() as $row) { $pagetype = $row->type; if ($row->kop) { $html[$row->uid] = "

" . $row->kop . "

"; } else { $html[$row->uid] = "
"; } if ($pagetype == 'list') { $type = $row->data; // ophalen lijstje met universiteiten ahv opgegeven brincodes in veld data van tabel content (type:list) $result_UniversityList = $this->page_model->getUniversityList($type); // anchor maken //$html[$row->uid] .= " "; foreach ( $result_UniversityList->result() as $row_list) { $html[$row->uid] .= '' .$row_list->name . '
'; } } else { $html[$row->uid] .= $row->bodytext; } $html[$row->uid] .= "

"; } $pageData['paginakop'] = $page->title; $pageData['html'] = implode("\n", $html); //laden alsosee $alsosees = array(); if ($this->session->userdata('lastSeenProgram') != '') $alsosees[] = 7; else $alsosees[] = 1; $alsosees[] = 2; $alsosees[] = 3; $alsosees[] = 4; $pageData['alsosees'] = $alsosees; //ophalen $pageData['page_title'] = $page->title . " - educationfair.nl"; $pageData['page_description'] = $page->description; $pageData['page_keywords'] = $page->keywords; $this->template->set('rootline', $rootline); //$parentid = get_webTrail(); $this->template->set('row', get_ParentPage()); //template laden met sidebar $this->makeAdminMenu($uid); $this->template->set('show_sidebar', true); $this->template->load('standard', 'page/index', $pageData); } public function add() { $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('
', '
'); if ($this->input->post('action') == 'save') { if ($this->validatePageEdit()) { $uid = $this->savePageEdit(); $page_url = get_pageUrl($uid); redirect_parent($page_url); } } $pageRecord = array( 'uid' => 'new', 'pid' => 0, 'showorder' => 0, 'title_en' => NULL, 'url_path_segment_en' => NULL, 'description' => NULL, 'keywords' => NULL, 'pagetype' => NULL, 'hide_in_menu' => NULL, 'background_image' => '', 'url' => '', ); $data = $pageRecord; $data['pageTree'] = array(0 => 'Homepage') + $this->pageTreeToList($this->page_model->getPageTree(0, TRUE), 1); $data['pageOrder'] = array(0 => 'First position') + $this->pageTreeToList($this->page_model->getPageTree(0, FALSE), 0, 'showOrder'); $this->template->addExtraJs('/template/js/page_edit.js'); $this->template->load('overlay', 'page/edit', $data); } public function edit() { $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('
', '
'); if ($this->input->post('action') == 'save') { if ($this->validatePageEdit()) { $pageRecord = $this->page_model->get(set_value('uid'), FALSE); if ($pageRecord->pid == set_value('pid') && $pageRecord->showorder == set_value('showorder')) { $uid = $this->savePageEdit(FALSE); } else { $uid = $this->savePageEdit(TRUE); } $page_url = get_pageUrl($uid); redirect_parent($page_url); } } $pageRecord = $this->page_model->get($this->uri->rsegment(3), FALSE, 'array'); if ($pageRecord === FALSE) { show_404(); } $data = $pageRecord; $data['pageTree'] = array(0 => 'Homepage') + $this->pageTreeToList($this->page_model->getPageTree(0, TRUE), 1); $data['pageOrder'] = array(0 => 'First position') + $this->pageTreeToList($this->page_model->getPageTree($pageRecord['pid'], FALSE), 0, 'showOrder'); $this->template->addExtraJs('/template/js/page_edit.js'); $this->template->addExtraJs('/template/ckfinder/ckfinder.js'); $this->template->load('overlay', 'page/edit', $data); } public function delete() { $page = $this->page_model->get($this->uri->segment(3)); if (isset($_POST['submit'])) { $uid = set_value('uid'); $this->db->where('uid', $uid); $this->db->delete('pages'); $data['redirect_url'] = '/'; if ($page->pid != 0) { $data['redirect_url'] = get_pageUrl($page->pid); } $this->load->view('overlay/redirectparent', $data); } else { $this->template->load('overlay', 'page/delete', array('page' => $page)); } } public function editcontent() { $page_uid = $this->uri->rsegment(3); if ($this->input->post('action') == 'save') { $position = $this->input->post('position'); $uid = $this->input->post('uid'); $deleted = $this->input->post('deleted'); $type = $this->input->post('type'); $kop = $this->input->post('kop'); $bodytext = $this->input->post('bodytext'); for ($pos = 1; $pos <= sizeof($position); $pos++) { $unique_id = $position[$pos]; $data = array( 'pid' => $page_uid, 'showorder' => $pos, 'type' => $type[$unique_id], 'kop' => $kop[$unique_id], 'deleted' => $deleted[$unique_id], 'bodytext' => $bodytext[$unique_id], ); if ($data['deleted'] == 1) { $this->db->where('uid', $uid[$unique_id]); $this->db->delete('content'); } else if ($uid[$unique_id] == 'new') { $this->db->insert('content', $data); } else { $this->db->where('uid', $uid[$unique_id]); $this->db->update('content', $data); } } $page_url = get_pageUrl($page_uid); redirect_parent($page_url); } $elements = $this->page_model->getContent($this->uri->rsegment(3)); $data['page_uid'] = $this->uri->rsegment(3); $data['elements'] = $elements; $this->template->addExtraJs('/template/ckeditor/ckeditor.js'); $this->template->addExtraJs('/template/ckeditor/adapters/jquery.js'); $this->template->addExtraJs('/template/ckfinder/ckfinder.js'); $this->template->load('overlay', 'page/editcontent', $data); } private function validatePageEdit() { $rules = array( array( 'field' => 'pagetype', 'label' => 'Page type', 'rules' => 'required' ), array( 'field' => 'uid', 'label' => 'Unique ID', 'rules' => 'required' ), array( 'field' => 'pid', 'label' => 'Parent page', 'rules' => 'required' ), array( 'field' => 'showorder', 'label' => 'After', 'rules' => 'required' ), array( 'field' => 'title_en', 'label' => 'Title', 'rules' => 'required' ), array( 'field' => 'url_path_segment_en', 'label' => 'URL path segment', 'rules' => 'trim' ), array( 'field' => 'description', 'label' => 'Description', 'rules' => 'trim' ), array( 'field' => 'keywords', 'label' => 'Keywords', 'rules' => 'trim' ), array( 'field' => 'background', 'label' => 'background', 'rules' => 'trim' ), array( 'field' => 'url', 'label' => 'URL', 'rules' => 'trim' ), array( 'field' => 'hide_in_menu', 'label' => 'Hide in menu', 'rules' => '' ), ); $this->form_validation->set_rules($rules); return $this->form_validation->run(); } private function savePageEdit($increaseShoworder = TRUE) { // var_dump($_POST); // Prep data $uid = set_value('uid'); $data = array( 'pid' => set_value('pid'), 'showorder' => set_value('showorder'), 'title_en' => set_value('title_en'), 'url_path_segment_en' => set_value('url_path_segment_en'), 'description' => set_value('description'), 'keywords' => set_value('keywords'), 'background_image' => set_value('background'), 'hide_in_menu' => set_value('hide_in_menu', 0), 'url' => set_value('url'), 'pagetype' => set_value('pagetype'), ); if ($increaseShoworder === TRUE) { $data['showorder'] = $data['showorder'] + 1; } if ($data['url_path_segment_en'] == NULL || $data['url_path_segment_en'] == "") { $data['url_path_segment_en'] = url_title(strtolower($data['title_en'])); } // Check if pages have to move if ($this->page_model->getPageOnLocation($data['pid'], $data['showorder']) !== FALSE) { $this->page_model->movePagesOnLocation($data['pid'], $data['showorder'], 1); } if ($uid == 'new') { $this->db->insert('pages', $data); $uid = $this->db->insert_id(); } else { $this->db->where('uid', $uid); $this->db->update('pages', $data); } // die($this->db->last_query()); return $uid; } private function pageTreeToList($pageTree, $depth = 0, $key = 'uid') { $list = array(); foreach ($pageTree as $page) { $list[$page[$key]] = str_repeat(' ', $depth * 2) . $page['title']; if (isset($page['subPages'])) { $list = $list + $this->pageTreeToList($page['subPages'], $depth +1); } } return $list; } private function makeAdminMenu($uid = NULL) { if ($this->user->hasPermission('page', 'edit') && $uid != NULL) { $this->template->addAdminMenu('edit', site_url('page/edit/'.$uid)); } if ($this->user->hasPermission('page', 'editcontent') && $uid != NULL) { $this->template->addAdminMenu('edit_content', site_url('page/editcontent/'.$uid)); } if ($this->user->hasPermission('page', 'delete') && $uid != NULL) { $this->template->addAdminMenu('delete', site_url('page/delete/'.$uid)); } if ($this->user->hasPermission('page', 'add')) { $this->template->addAdminMenu('add', site_url('page/add/')); } } }

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/public/sites/www.educationfair.nl/educationfair/controllers/page.php:368)

Filename: core/Common.php

Line Number: 443

Page not found!

Page not found!

OOPS, the page you are looking for does not seem to exist.