App_FrontController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * MINZ - Copyright 2011 Marien Fressinaud
  4. * Sous licence AGPL3 <http://www.gnu.org/licenses/>
  5. */
  6. require ('FrontController.php');
  7. class App_FrontController extends FrontController {
  8. public function init () {
  9. $this->loadLibs ();
  10. $this->loadModels ();
  11. Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?)
  12. $this->loadParamsView ();
  13. $this->loadStylesAndScripts ();
  14. $this->loadNotifications ();
  15. }
  16. private function loadLibs () {
  17. require (LIB_PATH . '/lib_phpQuery.php');
  18. require (LIB_PATH . '/lib_rss.php');
  19. require (LIB_PATH . '/SimplePie_autoloader.php');
  20. require (LIB_PATH . '/lib_text.php');
  21. }
  22. private function loadModels () {
  23. include (APP_PATH . '/models/RSSConfiguration.php');
  24. include (APP_PATH . '/models/Days.php');
  25. include (APP_PATH . '/models/Category.php');
  26. include (APP_PATH . '/models/Feed.php');
  27. include (APP_PATH . '/models/Entry.php');
  28. }
  29. private function loadStylesAndScripts () {
  30. View::prependStyle (Url::display ('/theme/base.css'));
  31. View::appendScript ('https://login.persona.org/include.js');
  32. View::appendScript (Url::display ('/scripts/jquery.js'));
  33. View::appendScript (Url::display ('/scripts/notification.js'));
  34. }
  35. private function loadParamsView () {
  36. View::_param ('conf', Session::param ('conf', new RSSConfiguration ()));
  37. $entryDAO = new EntryDAO ();
  38. View::_param ('nb_not_read', $entryDAO->countNotRead ());
  39. }
  40. private function loadNotifications () {
  41. $notif = Session::param ('notification');
  42. if ($notif) {
  43. View::_param ('notification', $notif);
  44. Session::_param ('notification');
  45. }
  46. }
  47. }