PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/controllers/system.php

https://github.com/firevic666/v.5
PHP | 62 lines | 47 code | 14 blank | 1 comment | 2 complexity | 17ab919032daebb2315dc21557dae74e MD5 | raw file
  1. <?php
  2. class System extends Controller {
  3. function __construct() {
  4. parent::__construct();
  5. Session::init();
  6. $logged = Session::get('loggedIn');
  7. if ($logged == false) {
  8. Session::destroy();
  9. header('location: ../v.5/login');
  10. exit;
  11. }
  12. $this->view->js = array('system/js/default.js');
  13. }
  14. function index() {
  15. $this->view->pageList = $this->model->pageList();
  16. $this->view->render('system/index');
  17. }
  18. function logout() {
  19. Session::destroy();
  20. header('location: ../login');
  21. exit;
  22. }
  23. function xhrInsert() {
  24. $this->model->xhrInsert();
  25. }
  26. function xhrGetListings() {
  27. $this->model->xhrGetListings();
  28. }
  29. function xhrDeleteListing() {
  30. $this->model->xhrDeleteListing();
  31. }
  32. public function edit($id) {
  33. $this->view->page = $this->model->pageSingleList($id);
  34. $this->view->render('system/edit');
  35. }
  36. public function editSave($id) {
  37. $data = array();
  38. $data['id'] = $id;
  39. $data['heading1'] = $_POST['heading1'];
  40. $data['heading2'] = $_POST['heading2'];
  41. $data['heading3'] = $_POST['heading3'];
  42. $data['heading4'] = $_POST['heading4'];
  43. $data['heading5'] = $_POST['heading5'];
  44. // @TODO: Do your error checking!
  45. $this->model->editSave($data);
  46. header('location: ' . URL . 'system');
  47. }
  48. }