]> dev.renevier.net Git - syj.git/blob - application/controllers/ListController.php
ask a confirmation when users leaves with unsaved route
[syj.git] / application / controllers / ListController.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5 class ListController extends Zend_Controller_Action
6 {
7
8     public function init() {
9         $this->_helper->SyjSession->needsLogin();
10
11         $this->view->headScript()->appendFile('js/OpenLayers.js');
12         $this->view->headScript()->appendFile('js/prototype.js');
13         $this->view->headScript()->appendFile('js/utils.js');
14         $this->view->headScript()->appendFile('js/list.js');
15
16         $this->view->headLink()->appendStylesheet('css/generic.css');
17         $this->view->headLink()->appendStylesheet('css/list.css');
18         $this->view->headTitle($this->view->translate("my routes"));
19     }
20
21     public function indexAction() {
22         $user = $this->_helper->SyjSession->user();
23         $pathMapper = new Syj_Model_PathMapper();
24         $list = $pathMapper->fetchByCreator($user);
25         $paginator = Zend_Paginator::factory($list);
26
27         $paginator->setDefaultItemCountPerPage(20);
28         $paginator->setCurrentPageNumber($this->_getParam('page', 1));
29         $this->view->paginator = $paginator;
30         $this->_jsLocaleStrings();
31     }
32
33     protected function _jsLocaleStrings() {
34         $this->view->jslocales = array(
35             'confirmDelete' => __("There is no undo. Delete this route definitively ?"),
36             'notReachedError' => __("server could not be reached"),
37             'requestError' => __("server did not understood request. That's probably caused by a bug in SYJ"),
38             'gonePathError' => __("route not referenced on the server. It has probably been deleted."),
39             'serverError' => __("there was a server error"),
40             'unknownError' => __("there was an unknown error"),
41             'deleteSuccess' => __("route was successfully deleted"),
42             );
43     }
44
45 }