1 | <?php |
---|
2 | |
---|
3 | class adminMyGmapsList extends adminGenericList |
---|
4 | { |
---|
5 | public function display($page,$nb_per_page,$p_url,$enclose_block='') |
---|
6 | { |
---|
7 | if ($this->rs->isEmpty()) |
---|
8 | { |
---|
9 | echo '<p><strong>'.__('No element').'</strong></p>'; |
---|
10 | } |
---|
11 | else |
---|
12 | { |
---|
13 | $pager = new pager($page,$this->rs_count,$nb_per_page,10); |
---|
14 | $pager->html_prev = $this->html_prev; |
---|
15 | $pager->html_next = $this->html_next; |
---|
16 | $pager->var_page = 'page'; |
---|
17 | |
---|
18 | $html_block = |
---|
19 | '<table class="clear"><tr>'. |
---|
20 | '<th colspan="2">'.__('Title').'</th>'. |
---|
21 | '<th>'.__('Date').'</th>'. |
---|
22 | '<th>'.__('Category').'</th>'. |
---|
23 | '<th>'.__('Author').'</th>'. |
---|
24 | '<th class="nowrap">'.__('Map element type').'</th>'. |
---|
25 | '<th>'.__('Status').'</th>'. |
---|
26 | '</tr>%s</table>'; |
---|
27 | |
---|
28 | if ($enclose_block) { |
---|
29 | $html_block = sprintf($enclose_block,$html_block); |
---|
30 | } |
---|
31 | |
---|
32 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
33 | |
---|
34 | $blocks = explode('%s',$html_block); |
---|
35 | |
---|
36 | echo $blocks[0]; |
---|
37 | |
---|
38 | while ($this->rs->fetch()) |
---|
39 | { |
---|
40 | echo $this->postLine($p_url); |
---|
41 | } |
---|
42 | |
---|
43 | echo $blocks[1]; |
---|
44 | |
---|
45 | echo '<p>'.__('Page(s)').' : '.$pager->getLinks().'</p>'; |
---|
46 | } |
---|
47 | } |
---|
48 | |
---|
49 | private function postLine($p_url) |
---|
50 | { |
---|
51 | if ($this->core->auth->check('categories',$this->core->blog->id)) { |
---|
52 | $cat_link = '<a href="category.php?id=%s">%s</a>'; |
---|
53 | } else { |
---|
54 | $cat_link = '%2$s'; |
---|
55 | } |
---|
56 | $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; |
---|
57 | switch ($this->rs->post_status) { |
---|
58 | case 1: |
---|
59 | $img_status = sprintf($img,__('published'),'check-on.png'); |
---|
60 | break; |
---|
61 | case -2: |
---|
62 | $img_status = sprintf($img,__('pending'),'check-wrn.png'); |
---|
63 | break; |
---|
64 | } |
---|
65 | if ($this->rs->cat_title) { |
---|
66 | $cat_title = sprintf($cat_link,$this->rs->cat_id, |
---|
67 | html::escapeHTML($this->rs->cat_title)); |
---|
68 | } else { |
---|
69 | $cat_title = __('None'); |
---|
70 | } |
---|
71 | |
---|
72 | $res = '<tr class="line'.($this->rs->post_status != 1 ? ' offline' : '').'"'. |
---|
73 | ' id="p'.$this->rs->post_id.'">'; |
---|
74 | |
---|
75 | $meta =& $GLOBALS['core']->meta; |
---|
76 | $meta_rs = $meta->getMetaStr($this->rs->post_meta,'map'); |
---|
77 | |
---|
78 | $res .= |
---|
79 | '<td class="nowrap">'. |
---|
80 | form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable()).'</td>'. |
---|
81 | '<td class="maximal"><a href="'.$p_url.'&go=map&id='.$this->rs->post_id.'">'. |
---|
82 | html::escapeHTML($this->rs->post_title).'</a></td>'. |
---|
83 | '<td class="nowrap">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. |
---|
84 | '<td class="nowrap">'.$cat_title.'</td>'. |
---|
85 | '<td class="nowrap">'.$this->rs->user_id.'</td>'. |
---|
86 | '<td class="nowrap">'.__($meta_rs).'</td>'. |
---|
87 | '<td class="nowrap status">'.$img_status.'</td>'. |
---|
88 | '</tr>'; |
---|
89 | |
---|
90 | return $res; |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | ?> |
---|