App_FrontController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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_rss.php');
  18. require (LIB_PATH . '/lib_simplepie.php');
  19. }
  20. private function loadModels () {
  21. include (APP_PATH . '/models/RSSConfiguration.php');
  22. include (APP_PATH . '/models/Category.php');
  23. include (APP_PATH . '/models/Feed.php');
  24. include (APP_PATH . '/models/Entry.php');
  25. }
  26. private function loadStylesAndScripts () {
  27. View::prependStyle (Url::display ('/theme/base.css'));
  28. View::appendScript ('https://login.persona.org/include.js');
  29. View::appendScript (Url::display ('/scripts/jquery.js'));
  30. View::appendScript (Url::display ('/scripts/notification.js'));
  31. }
  32. private function loadParamsView () {
  33. View::_param ('conf', Session::param ('conf', new RSSConfiguration ()));
  34. $entryDAO = new EntryDAO ();
  35. View::_param ('nb_not_read', $entryDAO->countNotRead ());
  36. }
  37. private function loadNotifications () {
  38. $notif = Session::param ('notification');
  39. if ($notif) {
  40. View::_param ('notification', $notif);
  41. Session::_param ('notification');
  42. }
  43. }
  44. }