f9e60dba5079e83945383fb2bb84865f9113aa54
[acontent.git] / docs / themes / default / user / index.tmpl.php
1 <?php\r
2 /************************************************************************/\r
3 /* AContent                                                             */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2010                                                   */\r
6 /* Inclusive Design Institute                                           */\r
7 /*                                                                      */\r
8 /* This program is free software. You can redistribute it and/or        */\r
9 /* modify it under the terms of the GNU General Public License          */\r
10 /* as published by the Free Software Foundation.                        */\r
11 /************************************************************************/\r
12 \r
13 global $_custom_css;\r
14 $_custom_css = TR_BASE_HREF."include/jscripts/infusion/components/inlineEdit/css/InlineEdit.css";\r
15 \r
16 include(TR_INCLUDE_PATH.'header.inc.php');\r
17 ?>\r
18 \r
19 <div class="input-form">\r
20         <form name="filter_form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" >\r
21         <fieldset class="group_form"><legend class="group_form"><?php echo _AT("filter"); ?></legend>\r
22                 <table class="filter">\r
23                 <tr>\r
24                         <td colspan="2"><h2><?php echo _AT('results_found', $this->num_results); ?></h2></td>\r
25                 </tr>\r
26 \r
27                 <tr>\r
28                         <th><?php echo _AT('user_status'); ?>:</th>\r
29                         <td>\r
30                         <input type="radio" name="status" value="0" id="s0" <?php if ($_GET['status'] == TR_STATUS_DISABLED) { echo 'checked="checked"'; } ?> /><label for="s0"><?php echo _AT('disabled'); ?></label> \r
31                         <input type="radio" name="status" value="1" id="s1" <?php if ($_GET['status'] == TR_STATUS_ENABLED) { echo 'checked="checked"'; } ?> /><label for="s1"><?php echo _AT('enabled'); ?></label> \r
32                         <input type="radio" name="status" value="" id="s" <?php if ($_GET['status'] === '') { echo 'checked="checked"'; } ?> /><label for="s"><?php echo _AT('all'); ?></label>\r
33                         </td>\r
34                 </tr>\r
35 \r
36                 <?php if (is_array($this->all_user_groups)) { ?>\r
37                 <tr>\r
38                         <th><label for="user_group_id"><?php echo _AT('user_group'); ?></label>:</th>\r
39                         <td>\r
40                         <select name="user_group_id" id="user_group_id">\r
41                                 <option value="-1">- <?php echo _AT('select'); ?> -</option>\r
42                                 <?php foreach ($this->all_user_groups as $user_group) {?>\r
43                                 <option value="<?php echo $user_group['user_group_id']; ?>" <?php if($_GET['user_group_id']==$user_group['user_group_id']) { echo 'selected="selected"';}?>><?php echo $user_group['title']; ?></option>\r
44                                 <?php } ?>\r
45                         </select>\r
46                         </td>\r
47                 </tr>\r
48                 <?php } ?>\r
49 \r
50                 <tr>\r
51                         <th><label for="search"><?php echo _AT('search'); ?>:</label></th>\r
52                         <td><input type="text" name="search" id="search" size="40" value="<?php echo htmlspecialchars($_GET['search']); ?>" /><br /><small>&middot; <?php echo _AT('login_name').', '._AT('first_name').', '._AT('last_name') .', '._AT('email'); ?></small></td>\r
53                 </tr>\r
54 \r
55                 <tr>\r
56                         <td colspan="2" align="center">\r
57                         <input type="radio" name="include" value="all" id="match_all" <?php echo $this->checked_include_all; ?> /><label for="match_all"><?php echo _AT('match_all_words'); ?></label> \r
58                         <input type="radio" name="include" value="one" id="match_one" <?php echo $this->checked_include_one; ?> /><label for="match_one"><?php echo _AT('match_any_word'); ?></label>\r
59                         </td>\r
60                 </tr>\r
61 \r
62                 <tr>\r
63                         <td colspan="2"><p class="submit_button">\r
64                         <input type="submit" name="filter" value="<?php echo _AT('filter'); ?>" />\r
65                         <input type="submit" name="reset_filter" value="<?php echo _AT('reset_filter'); ?>" />\r
66                         </p></td>\r
67                 </tr>\r
68                 </table>\r
69         </fieldset>\r
70 </form>\r
71 </div>\r
72         \r
73 <div id="output_div" class="input-form">\r
74 <fieldset class="group_form"><legend class="group_form"><?php echo _AT("users"); ?></legend>\r
75 <?php print_paginator($this->page, $this->num_results, $this->page_string . htmlspecialchars(SEP) . $this->order .'='. $this->col, $this->results_per_page); ?>\r
76 \r
77 <form name="form" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">\r
78 <input type="hidden" name="status" value="<?php echo $_GET['status']; ?>" />\r
79 <input type="hidden" name="search" value="<?php echo htmlspecialchars($_GET['search']); ?>" />\r
80 <input type="hidden" name="include" value="<?php echo htmlspecialchars($_GET['include']); ?>" />\r
81 \r
82 <table summary="<?php echo _AT('user_table_summary'); ?>" class="data" rules="rows" id="editable_table">\r
83 <colgroup>\r
84         <?php if ($this->col == 'login'): ?>\r
85                 <col />\r
86                 <col class="sort" />\r
87                 <col span="<?php echo 5 + $this->col_counts; ?>" />\r
88         <?php elseif($this->col == 'public_field'): ?>\r
89                 <col span="<?php echo 1 + $this->col_counts; ?>" />\r
90                 <col class="sort" />\r
91                 <col span="6" />\r
92         <?php elseif($this->col == 'first_name'): ?>\r
93                 <col span="<?php echo 2 + $this->col_counts; ?>" />\r
94                 <col class="sort" />\r
95                 <col span="5" />\r
96         <?php elseif($this->col == 'last_name'): ?>\r
97                 <col span="<?php echo 3 + $this->col_counts; ?>" />\r
98                 <col class="sort" />\r
99                 <col span="4" />\r
100         <?php elseif($this->col == 'user_group'): ?>\r
101                 <col span="<?php echo 4 + $this->col_counts; ?>" />\r
102                 <col class="sort" />\r
103                 <col span="3" />\r
104         <?php elseif($this->col == 'email'): ?>\r
105                 <col span="<?php echo 5 + $this->col_counts; ?>" />\r
106                 <col class="sort" />\r
107                 <col span="2" />\r
108         <?php elseif($this->col == 'status'): ?>\r
109                 <col span="<?php echo 6 + $this->col_counts; ?>" />\r
110                 <col class="sort" />\r
111                 <col />\r
112         <?php elseif($this->col == 'last_login'): ?>\r
113                 <col span="<?php echo 7 + $this->col_counts; ?>" />\r
114                 <col class="sort" />\r
115         <?php endif; ?>\r
116 </colgroup>\r
117 <thead>\r
118 <tr>\r
119         <th scope="col" align="left" width="5%"><input type="checkbox" value="<?php echo _AT('select_all'); ?>" id="all" title="<?php echo _AT('select_all'); ?>" name="selectall" onclick="CheckAll();" /></th>\r
120 \r
121         <th scope="col" width="15%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=login<?php echo $page_string; ?>"><?php echo _AT('login_name');      ?></a></th>\r
122         <th scope="col" width="15%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=first_name<?php echo $page_string; ?>"><?php echo _AT('first_name'); ?></a></th>\r
123         <th scope="col" width="10%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=last_name<?php echo $page_string; ?>"><?php echo _AT('last_name');   ?></a></th>\r
124         <th scope="col" width="10%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=user_group<?php echo $page_string; ?>"><?php echo _AT('user_group'); ?></a></th>\r
125         <th scope="col" width="15%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=email<?php echo $page_string; ?>"><?php echo _AT('email');           ?></a></th>\r
126         <th scope="col" width="10%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=status<?php echo $page_string; ?>"><?php echo _AT('user_status'); ?></a></th>\r
127         <th scope="col" width="20%"><a href="user/index.php?<?php echo $this->orders[$this->order]; ?>=last_login<?php echo $page_string; ?>"><?php echo _AT('last_login'); ?></a></th>\r
128 </tr>\r
129 \r
130 </thead>\r
131 <?php if ($this->num_results > 0): ?>\r
132         <tfoot>\r
133         <tr>\r
134                 <td colspan="<?php echo 8 + $this->col_counts; ?>">\r
135                         <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> \r
136                         <input type="submit" name="password" value="<?php echo _AT('password'); ?>" />\r
137                         <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />\r
138                 </td>\r
139         </tr>\r
140         </tfoot>\r
141         <tbody>\r
142                 <?php if (is_array($this->user_rows)){ foreach ($this->user_rows as $row) {?>\r
143                         <tr onmousedown="document.form['m<?php echo $row['user_id']; ?>'].checked = !document.form['m<?php echo $row['user_id']; ?>'].checked; togglerowhighlight(this, 'm<?php echo $row['user_id']; ?>');" \r
144                             onkeydown="document.form['m<?php echo $row['user_id']; ?>'].checked = !document.form['m<?php echo $row['user_id']; ?>'].checked; togglerowhighlight(this, 'm<?php echo $row['user_id']; ?>');"\r
145                             id="rm<?php echo $row['user_id']; ?>">\r
146                                 <td><input type="checkbox" name="id[]" value="<?php echo $row['user_id']; ?>" id="m<?php echo $row['user_id']; ?>" \r
147                                            onmouseup="this.checked=!this.checked" onkeyup="this.checked=!this.checked" /></td>\r
148                                 <td><label for="m<?php echo $row['user_id']; ?>"><span class="inlineEdits" id="<?php echo "login-".$row['user_id']; ?>"><?php echo $row['login']; ?></span></label></td>\r
149                                 <td><span class="inlineEdits" id="<?php echo "first_name-".$row['user_id']; ?>"><?php echo $row['first_name']; ?></span></td>\r
150                                 <td><span class="inlineEdits" id="<?php echo "last_name-".$row['user_id']; ?>"><?php echo $row['last_name']; ?></span></td>\r
151                                 <td><?php echo $row['user_group']; ?></td>\r
152                                 <td><span class="inlineEdits" id="<?php echo "email-".$row['user_id']; ?>"><?php echo $row['email']; ?></span></td>\r
153                                 <td><?php echo get_status_by_code($row['status']); ?></td>\r
154                                 <td nowrap="nowrap">\r
155                                         <?php if ($row['last_login'] == 0): ?>\r
156                                                 <?php echo _AT('never'); ?>\r
157                                         <?php else: ?>\r
158                                                 <?php \r
159                                                 echo $row['last_login'];\r
160                                         ?>\r
161                                         <?php endif; ?>\r
162                                 </td>\r
163                         </tr>\r
164                 <?php }} ?>\r
165         </tbody>\r
166 <?php else: ?>\r
167         <tr>\r
168                 <td colspan="<?php echo 8 + $this->col_counts; ?>"><?php echo _AT('none_found'); ?></td>\r
169         </tr>\r
170 <?php endif; ?>\r
171 </table><br />\r
172 <small class="data-table-tip"><?php echo _AT('inline_editor_tip'); ?></small>\r
173 \r
174 </form>\r
175 </fieldset>\r
176 </div>\r
177 \r
178 <script language="JavaScript" type="text/javascript">\r
179 //<!--\r
180 function CheckAll() {\r
181         for (var i=0;i<document.form.elements.length;i++)       {\r
182                 var e = document.form.elements[i];\r
183                 if ((e.name == 'id[]') && (e.type=='checkbox')) {\r
184                         e.checked = document.form.selectall.checked;\r
185                         togglerowhighlight(document.getElementById("r" + e.id), e.id);\r
186                 }\r
187         }\r
188 }\r
189 \r
190 function togglerowhighlight(obj, boxid) {\r
191         if (document.getElementById(boxid).checked) {\r
192                 obj.className = 'selected';\r
193         } else {\r
194                 obj.className = '';\r
195         }\r
196 }\r
197 \r
198 jQuery(document).ready(function () {\r
199         var tableEdit = fluid.inlineEdits("#editable_table", {\r
200                 selectors : {\r
201                         text : "span",\r
202                         editables : "td:has(span.inlineEdits)"\r
203                 },\r
204                 defaultViewText: "",\r
205                 useTooltip: true,\r
206                 listeners: {\r
207                         afterFinishEdit : function (newValue, oldValue, editNode, viewNode) {\r
208                                 if (newValue != oldValue)\r
209                                         rtn = jQuery.post("<?php echo TR_BASE_HREF; ?>user/index_inline_editor_submit.php", { "field":viewNode.id, "value":newValue }, \r
210                                           function(data) { handleAjaxResponse(data, viewNode, oldValue); }, "json");\r
211                         }\r
212                 }\r
213         });\r
214 });\r
215 \r
216 //-->\r
217 </script>\r
218 <?php require(TR_INCLUDE_PATH.'footer.inc.php'); ?>