Start working on the new fields v2 system.
[bugdar.git] / includes / class_admin_navigation.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar
5 || # Copyright (c)2002-2007 Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version 2 of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Navigation Link System
24 *
25 * A static class whose methods are called to generate the common navigation
26 * links for the Admin CP.
27 *
28 * @author Blue Static
29 * @copyright Copyright (c)2002 - 2007, Blue Static
30 * @version $Revision$
31 * @package Bugdar
32 *
33 */
34 class NavLinks
35 {
36 // ###################################################################
37 /**
38 * All the different locations under the "Options" tab
39 *
40 * @access public
41 */
42 function optionsPages()
43 {
44 global $navigator;
45
46 $navigator->add_component('section', 'options-pages', 'options', T('Options'), null);
47 $navigator->add_component('link', 'options-pages-home', 'options-pages', T('Home'), 'index.php');
48 $navigator->add_component('link', 'options-pages-settings', 'options-pages', T('Bugdar Settings'), 'setting.php');
49 $navigator->add_component('link', 'options-pages-languages', 'options-pages', T('Languages'), 'language.php');
50 $navigator->add_component('link', 'options-pages-userhelp', 'options-pages', T('User Help Items'), 'userhelp.php');
51 }
52
53 // ###################################################################
54 /**
55 * Adding a new language
56 *
57 * @access public
58 */
59 function languagesAdd()
60 {
61 global $navigator;
62
63 $navigator->add_component('section', 'options-languages', 'options', T('Languages'), null);
64 $navigator->add_component('link', 'options-languages-add', 'options-languages', T('Add New Language'), 'language.php?do=add');
65 }
66
67 // ###################################################################
68 /**
69 * Edit a language
70 *
71 * @access public
72 *
73 * @param integer Language ID
74 */
75 function languagesEdit($id)
76 {
77 global $navigator;
78
79 NavLinks::languagesAdd();
80 $navigator->add_component('link', 'options-languages-edit', 'options-languages', T('Edit Language'), 'language.php?do=edit&amp;languageid=' . $id);
81 $navigator->add_component('link', 'options-languages-delete', 'options-languages', T('Delete'), 'language.php?do=delete&amp;languageid=' . $id);
82 }
83
84 // ###################################################################
85 /**
86 * Adding a new user help item
87 *
88 * @access public
89 */
90 function userhelpAdd()
91 {
92 global $navigator;
93
94 $navigator->add_component('section', 'options-userhelp', 'options', T('User Help Items'), null);
95 $navigator->add_component('link', 'options-userhelp-add', 'options-userhelp', T('Add New Item'), 'userhelp.php?do=add');
96 }
97
98 // ###################################################################
99 /**
100 * Adding a new product
101 *
102 * @access public
103 */
104 function productsAdd()
105 {
106 global $navigator;
107
108 $navigator->add_component('section', 'products', 'products', T('Products'), null);
109 $navigator->add_component('link', 'products-manage', 'products', T('Manage Products'), 'product.php');
110 $navigator->add_component('link', 'products-add', 'products', T('Add New Product'), 'product.php?do=addproduct');
111 }
112
113 // ###################################################################
114 /**
115 * Editing a product
116 *
117 * @access public
118 *
119 * @param integer Product ID
120 */
121 function productsEdit($id)
122 {
123 global $navigator;
124
125 NavLinks::productsAdd();
126 $navigator->add_component('section', 'products-edit', 'products', T('Edit Product'), null);
127 $navigator->add_component('link', 'products-edit', 'products-edit', T('Edit Product'), 'product.php?do=editproduct&amp;productid=' . $id);
128 $navigator->add_component('link', 'products-edit-version', 'products-edit', T('Add New Version'), 'product.php?do=addversion&amp;productid=' . $id);
129 $navigator->add_component('link', 'products-edit-delete', 'products-edit', T('Delete Product'), 'product.php?do=deleteproduct&amp;productid=' . $id);
130 }
131
132 // ###################################################################
133 /**
134 * Fields tab pages
135 *
136 * @access public
137 */
138 function fieldsPages()
139 {
140 global $navigator;
141
142 $navigator->add_component('section', 'fields-pages', 'fields', T('Fields'), null);
143 $navigator->add_component('link', 'fields-pages-fields', 'fields-pages', T('Custom Fields'), 'field.php');
144 $navigator->add_component('link', 'fields-pages-priorities', 'fields-pages', T('Priorities'), 'priority.php');
145 $navigator->add_component('link', 'fields-pages-resolutions', 'fields-pages', T('Resolutions'), 'resolution.php');
146 $navigator->add_component('link', 'fields-pages-severities', 'fields-pages', T('Severities'), 'severity.php');
147 $navigator->add_component('link', 'fields-pages-statuses', 'fields-pages', T('Statuses'), 'status.php');
148 $navigator->add_component('link', 'fields-pages-automations', 'fields-pages', T('Automations'), 'automation.php');
149
150 // TODO(port): remove this.
151 $navigator->add_component('link', 'fields-pages-v2', 'fields-pages', 'FIELDS - V2', 'field2.php');
152 }
153
154 // ###################################################################
155 /**
156 * Adding an new custom field
157 *
158 * @access public
159 */
160 function fieldsAdd()
161 {
162 global $navigator;
163
164 $navigator->add_component('section', 'fields', 'fields', T('Custom Fields'), null);
165 $navigator->add_component('link', 'fields-add', 'fields', T('Add New Custom Field'), 'field.php?do=add');
166 }
167
168 // ###################################################################
169 /**
170 * Edit a custom field
171 *
172 * @access public
173 *
174 * @param integer Field ID
175 */
176 function fieldsEdit($id)
177 {
178 global $navigator;
179
180 NavLinks::fieldsAdd();
181 $navigator->add_component('link', 'fields-delete', 'fields', T('Delete'), 'field.php?do=delete&amp;fieldid=' . $id);
182 }
183
184 // ###################################################################
185 /**
186 * Adding an new priority
187 *
188 * @access public
189 */
190 function prioritiesAdd()
191 {
192 global $navigator;
193
194 $navigator->add_component('section', 'priorities', 'fields', T('Priorities'), null);
195 $navigator->add_component('link', 'priorities-add', 'priorities', T('Add New Priority'), 'priority.php?do=add');
196 }
197
198 // ###################################################################
199 /**
200 * Edit a priority
201 *
202 * @access public
203 *
204 * @param integer Priority ID
205 */
206 function prioritiesEdit($id)
207 {
208 global $navigator;
209
210 NavLinks::prioritiesAdd();
211 $navigator->add_component('link', 'priorities-delete', 'priorities', T('Delete'), 'priority.php?do=delete&amp;priorityid=' . $id);
212 }
213
214 // ###################################################################
215 /**
216 * Adding an new resolution
217 *
218 * @access public
219 */
220 function resolutionsAdd()
221 {
222 global $navigator;
223
224 $navigator->add_component('section', 'resolutions', 'fields', T('Resolutions'), null);
225 $navigator->add_component('link', 'resolutions-add', 'resolutions', T('Add New Resolution'), 'resolution.php?do=add');
226 }
227
228 // ###################################################################
229 /**
230 * Edit a resolution
231 *
232 * @access public
233 *
234 * @param integer Resolution ID
235 */
236 function resolutionsEdit($id)
237 {
238 global $navigator;
239
240 NavLinks::resolutionsAdd();
241 $navigator->add_component('link', 'resolutions-delete', 'resolutions', T('Delete'), 'resolution.php?do=delete&amp;resolutionid=' . $id);
242 }
243
244 // ###################################################################
245 /**
246 * Adding an new severity
247 *
248 * @access public
249 */
250 function severitiesAdd()
251 {
252 global $navigator;
253
254 $navigator->add_component('section', 'severities', 'fields', T('Severities'), null);
255 $navigator->add_component('link', 'severities-add', 'severities', T('Add New Severity'), 'severity.php?do=add');
256 }
257
258 // ###################################################################
259 /**
260 * Edit a severity
261 *
262 * @access public
263 *
264 * @param integer Severity ID
265 */
266 function severitiesEdit($id)
267 {
268 global $navigator;
269
270 NavLinks::severitiesAdd();
271 $navigator->add_component('link', 'severities-delete', 'severities', T('Delete'), 'severity.php?do=delete&amp;severityid=' . $id);
272 }
273
274 // ###################################################################
275 /**
276 * Adding an new status
277 *
278 * @access public
279 */
280 function statusesAdd()
281 {
282 global $navigator;
283
284 $navigator->add_component('section', 'statuses', 'fields', T('Severities'), null);
285 $navigator->add_component('link', 'statuses-add', 'statuses', T('Add New Status'), 'status.php?do=add');
286 }
287
288 // ###################################################################
289 /**
290 * Edit a status
291 *
292 * @access public
293 *
294 * @param integer Status ID
295 */
296 function statusesEdit($id)
297 {
298 global $navigator;
299
300 NavLinks::statusesAdd();
301 $navigator->add_component('link', 'statuses-delete', 'statuses', T('Delete'), 'status.php?do=delete&amp;statusid=' . $id);
302 }
303
304 // ###################################################################
305 /**
306 * Adding an new automation
307 *
308 * @access public
309 */
310 function automationsAdd()
311 {
312 global $navigator;
313
314 $navigator->add_component('section', 'automations', 'fields', T('Automations'), null);
315 $navigator->add_component('link', 'automations-add', 'automations', T('Add New Automation'), 'automation.php?do=add');
316 }
317
318 // ###################################################################
319 /**
320 * Edit an automation
321 *
322 * @access public
323 *
324 * @param integer Action ID
325 */
326 function automationsEdit($id)
327 {
328 global $navigator;
329
330 NavLinks::automationsAdd();
331 $navigator->add_component('link', 'automations-delete', 'automations', T('Delete'), 'automation.php?do=delete&amp;actionid=' . $id);
332 }
333
334 // ###################################################################
335 /**
336 * User tab pages
337 *
338 * @access public
339 */
340 function usersPages()
341 {
342 global $navigator;
343
344 $navigator->add_component('section', 'users-pages', 'users', T('Users &amp; Permissions'), null);
345 $navigator->add_component('link', 'users-pages-users', 'users-pages', T('Users'), 'user.php');
346 $navigator->add_component('link', 'users-pages-usergroups', 'users-pages', T('Usergroups'), 'usergroup.php');
347 $navigator->add_component('link', 'users-pages-permissions', 'users-pages', T('Product-Level Permissions'), 'permission.php');
348 }
349
350 // ###################################################################
351 /**
352 * Add a new user
353 *
354 * @access public
355 */
356 function usersAdd()
357 {
358 global $navigator;
359
360 $navigator->add_component('section', 'users', 'users', T('Users'), null);
361 $navigator->add_component('link', 'users-showall', 'users', T('Show All Users'), 'user.php?do=showall');
362 $navigator->add_component('link', 'users-add', 'users', T('Add New User'), 'user.php?do=add');
363 }
364
365 // ###################################################################
366 /**
367 * Edit a user
368 *
369 * @access public
370 *
371 * @param integer User ID
372 */
373 function usersEdit($id)
374 {
375 global $navigator;
376
377 NavLinks::usersAdd();
378 $navigator->add_component('link', 'users-delete', 'users', T('Delete'), 'user.php?do=delete&amp;userid=' . $id);
379 }
380
381 // ###################################################################
382 /**
383 * Add a new usergroup
384 *
385 * @access public
386 */
387 function usergroupsAdd()
388 {
389 global $navigator;
390
391 $navigator->add_component('section', 'usergroups', 'users', T('Usergroups'), null);
392 $navigator->add_component('link', 'usergroups-add', 'usergroups', T('Add New Usergroup'), 'usergroup.php?do=add');
393 $navigator->add_component('link', 'usergroups-approve', 'usergroups', T('Moderate Awaiting Users'), 'usergroup.php?do=approve');
394 }
395
396 // ###################################################################
397 /**
398 * Edit a usergroup
399 *
400 * @access public
401 *
402 * @param integer User ID
403 */
404 function usergroupsEdit($id)
405 {
406 global $navigator;
407
408 NavLinks::usergroupsAdd();
409 $navigator->add_component('link', 'usergroups-delete', 'usergroups', T('Delete'), 'usergroup.php?do=delete&amp;userid=' . $id);
410 }
411 }
412