control.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. class log extends control
  3. {
  4. /**
  5. * The construct method.
  6. *
  7. * @access public
  8. * @return void
  9. */
  10. public function __construct($moduleName = '', $methodName = '', $appName = '')
  11. {
  12. parent::__construct($moduleName, $methodName, $appName);
  13. }
  14. /**
  15. * Log browse page.
  16. *
  17. * @access public
  18. * @param string $orderBy
  19. * @param string $objectType
  20. * @param string $search
  21. * @param string $date
  22. * @param int $recTotal
  23. * @param int $recPerPage
  24. * @param int $pageID
  25. * @return void
  26. */
  27. public function browse($orderBy = 'date_desc', $objectType = 'all', $search = '', $date = '', $recTotal = 0, $recPerPage = 10, $pageID = 1)
  28. {
  29. if($this->post->objectType || $this->post->date)
  30. {
  31. $search = $this->post->search;
  32. if ($this->post->objectType) $objectType = $this->post->objectType;
  33. if ($this->post->date) $date = $this->post->date;
  34. die($this->locate(inlink('browse', "orderBy=$orderBy&objectType=$objectType&search=$search&date=$date&recTotal=0&recPerPage=$recPerPage&pageID=1")));
  35. }
  36. $this->app->loadClass('pager', $static = true);
  37. $pager = new pager($recTotal, $recPerPage, $pageID);
  38. $userPairs = $this->loadModel('user')->getRealNamePairs();
  39. $userPairs['guest'] = $this->lang->log->guest;
  40. $this->view->records = $this->log->getActionRecords($orderBy, $objectType, $search, $date, $pager, false);
  41. $this->view->pager = $pager;
  42. $this->view->orderBy = $orderBy;
  43. $this->view->objectType = $objectType;
  44. $this->view->search = $search;
  45. $this->view->date = $date;
  46. $this->view->userPairs = $userPairs;
  47. $this->view->logTitle = $this->lang->log->name;
  48. $this->display();
  49. }
  50. /**
  51. * Page for browsing admin log.
  52. *
  53. * @access public
  54. * @param string $orderBy
  55. * @param string $objectType
  56. * @param string $search
  57. * @param string $date
  58. * @param int $recTotal
  59. * @param int $recPerPage
  60. * @param int $pageID
  61. * @return void
  62. */
  63. public function admin($orderBy = 'date_desc', $objectType = 'all', $search = '', $date = '', $recTotal = 0, $recPerPage = 10, $pageID = 1)
  64. {
  65. if($this->post->objectType || $this->post->date)
  66. {
  67. $search = $this->post->search;
  68. if ($this->post->objectType) $objectType = $this->post->objectType;
  69. if ($this->post->date) $date = $this->post->date;
  70. die($this->locate(inlink('admin', "orderBy=$orderBy&objectType=$objectType&search=$search&date=$date&recTotal=0&recPerPage=$recPerPage&pageID=1")));
  71. }
  72. $this->app->loadClass('pager', $static = true);
  73. $pager = new pager($recTotal, $recPerPage, $pageID);
  74. $this->view->records = $this->log->getActionRecords($orderBy, $objectType, $search, $date, $pager, true);
  75. $this->view->pager = $pager;
  76. $this->view->orderBy = $orderBy;
  77. $this->view->objectType = $objectType;
  78. $this->view->search = $search;
  79. $this->view->date = $date;
  80. $this->view->logTitle = $this->lang->log->admin;
  81. $this->display('log', 'browse');
  82. }
  83. }