]> dev.renevier.net Git - syj.git/blob - application/views/scripts/list/index.phtml
interface to manage list of created routes
[syj.git] / application / views / scripts / list / index.phtml
1     <noscript>
2         <style type="text/css">
3             #container, #navigation, #message {
4                 display: none;
5             }
6         </style>
7
8         <p><?php echo $this->translate('SYJ needs javascript. Please activate scripts in your browser.');?></p>
9     </noscript>
10
11     <div id="message"></div>
12
13
14 <?php
15     print $this->localeSwitcher();
16     if ($this->paginator->count() == 0) {
17         $link = $this->Anchor($this->baseUrl(), $this->translate ("create a route"), array(), false);
18         $noroutecontent = $this->translate("you have created no route yet, you may want to %s", $link);
19
20         printf ('<div class="warn noroute">%s</div>', $noroutecontent);
21         return;
22     }
23
24     $pages = $this->paginator->getPages();
25     if (isset($pages->previous) or isset($pages->next)) {
26         print '<div id="navigation">';
27
28         if (isset($pages->previous)) {
29             $title = $this->translate("first page");
30             $href = $this->addParamToUrl($this->url(), 'page', (string)$pages->first, true);
31             printf ('<a class="page-link" title="%s" href="%s">«</a>', $title, $href);
32
33             $title = $this->translate("previous page");
34             $href = $this->addParamToUrl($this->url(), 'page', (string)$pages->previous, true);
35             printf ('<a class="page-link" title="%s" href="%s">&lt;</a>', $title, $href);
36         } else {
37             print '<span class="page-link">«</span>';
38             print '<span class="page-link">&lt;</span>';
39         }
40
41         if (isset($pages->next)) {
42             $title = $this->translate("next page");
43             $href = $this->addParamToUrl($this->url(), 'page', (string)$pages->next, true);
44             printf ('<a class="page-link" title="%s" href="%s">&gt;</a>', $title, $href);
45
46             $title = $this->translate("last page");
47             $href = $this->addParamToUrl($this->url(), 'page', (string)$pages->last, true);
48             printf ('<a class="page-link" title="%s" href="%s">»</a>', $title, $href);
49         } else {
50             print '<span class="page-link">&gt;</span>';
51             print '<span class="page-link">»</span>';
52         }
53
54         print '</div>';
55     }
56
57     print '<div id="container">';
58     foreach ($this->paginator as $item) {
59
60         $map = sprintf('<div class="map" data-geom="%s"></div>', $this->escape($item->geom));
61         $href = $this->url(array(
62             'controller' => 'idx',
63             'action' => 'index',
64             'url' => $item->id
65         ), 'idx');
66         $maplink = $this->Anchor($href, $map, array(), false);
67         $modifylink = $this->Anchor($href, $this->translate("modify"));
68         $duplicatelink = sprintf('<a href="#" class="duplicate-link">%s</a>', $this->translate("duplicate"));
69         $deletelink = sprintf('<a href="#" class="delete-link">%s</a>', $this->translate("delete"));
70
71         printf ('<div class="item" data-id="%d">
72                 <div class="geom">%s</div>
73                 <div class="controls">%s<br>%s<br>%s</div>
74                 <div class="title">%s</div>
75                 </div>
76                 ',
77                 (int)$item->id, $maplink, $modifylink, $duplicatelink, $deletelink, $this->escape($item->displayTitle));
78
79     }
80     print '</div>';
81 ?>