1 | <?php |
---|
2 | /** |
---|
3 | * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana |
---|
4 | * @file entes_planificadores_toolbar.module |
---|
5 | * Drupal part Module to code ente planificador module |
---|
6 | * Copyright 2011 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL) |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or modify |
---|
9 | * it under the terms of the GNU General Public License as published by |
---|
10 | * the Free Software Foundation; either version 2 of the License, or |
---|
11 | * (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
21 | * |
---|
22 | * @author Cenditel Merida - Msc. Juan Vizcarrondo |
---|
23 | * @date 2012-03-07 // (año-mes-dia) |
---|
24 | * @version 0.2 // (0.2) |
---|
25 | * |
---|
26 | */ |
---|
27 | |
---|
28 | /* |
---|
29 | * hook_form_alter |
---|
30 | */ |
---|
31 | function entes_planificadores_toolbar_form_alter(&$form, $form_state, $form_id) { |
---|
32 | if ($form_id == 'ente_planificador_admin_settings') { |
---|
33 | $iconsets = entes_planificadores_toolbar_get_iconsets(); |
---|
34 | foreach($iconsets as $id => $value) { |
---|
35 | $icons[$id] = $value->name; |
---|
36 | } |
---|
37 | $form['entes_planificadores_toolbar'] = array( |
---|
38 | '#type' => 'fieldset', |
---|
39 | '#title' => t('Configurar el Toolbar'), |
---|
40 | '#collapsible' => FALSE, |
---|
41 | '#collapsed' => 0, |
---|
42 | '#tree' => FALSE, |
---|
43 | '#weight' => 0, |
---|
44 | ); |
---|
45 | $form['entes_planificadores_toolbar']['entes_planificadores_toolbar_handler_icons_users'] = array( |
---|
46 | '#type' => 'select', |
---|
47 | '#title' => t('Iconos de usuarios'), |
---|
48 | '#default_value' => variable_get('entes_planificadores_toolbar_handler_icons_users', 'entes_planificadores_normal'), |
---|
49 | '#options' => $icons, |
---|
50 | '#description' => t('Seleccione los iconos a utilizar para motrar en el toolbar de usuarios'), |
---|
51 | ); |
---|
52 | $form['entes_planificadores_toolbar']['entes_planificadores_toolbar_handler_icons_admin'] = array( |
---|
53 | '#type' => 'select', |
---|
54 | '#title' => t('Iconos de Administración'), |
---|
55 | '#default_value' => variable_get('entes_planificadores_toolbar_handler_icons_admin', 'entes_planificadores_normal'), |
---|
56 | '#options' => $icons, |
---|
57 | '#description' => t('Seleccione los iconos a utilizar para motrar en el toolbar de administración'), |
---|
58 | ); |
---|
59 | $form['entes_planificadores_toolbar']['entes_planificadores_toolbar_handler_icons_planner'] = array( |
---|
60 | '#type' => 'select', |
---|
61 | '#title' => t('Iconos de entes planificadores'), |
---|
62 | '#default_value' => variable_get('entes_planificadores_toolbar_handler_icons_planner', 'entes_planificadores_normal'), |
---|
63 | '#options' => $icons, |
---|
64 | '#description' => t('Seleccione los iconos a utilizar para motrar en el toolbar de entes planificadores'), |
---|
65 | ); |
---|
66 | } |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * Implementation of hook_theme(). |
---|
71 | */ |
---|
72 | function entes_planificadores_toolbar_theme() { |
---|
73 | $entes_planificadores_toolbar_path = drupal_get_path('module', 'entes_planificadores_toolbar') . '/templates'; |
---|
74 | return array( |
---|
75 | 'entes_planificadores_toolbar_usuarios' => array( |
---|
76 | 'arguments' => array( |
---|
77 | 'links' => array(), |
---|
78 | ), |
---|
79 | 'template' => 'entes-planificadores-toolbar-usuarios', |
---|
80 | 'path' => $entes_planificadores_toolbar_path, |
---|
81 | ), |
---|
82 | 'entes_planificadores_toolbar_admin' => array( |
---|
83 | 'arguments' => array( |
---|
84 | 'links' => array(), |
---|
85 | ), |
---|
86 | 'template' => 'entes-planificadores-toolbar-admin', |
---|
87 | 'path' => $entes_planificadores_toolbar_path, |
---|
88 | ), |
---|
89 | 'entes_planificadores_toolbar_planner' => array( |
---|
90 | 'arguments' => array( |
---|
91 | 'links' => array(), |
---|
92 | ), |
---|
93 | 'template' => 'entes-planificadores-toolbar-planner', |
---|
94 | 'path' => $entes_planificadores_toolbar_path, |
---|
95 | ), |
---|
96 | 'entes_planificadores_toolbar_myplanner' => array( |
---|
97 | 'arguments' => array( |
---|
98 | 'links' => array(), |
---|
99 | ), |
---|
100 | 'template' => 'entes-planificadores-toolbar-myplanner', |
---|
101 | 'path' => $entes_planificadores_toolbar_path, |
---|
102 | ), |
---|
103 | ); |
---|
104 | } |
---|
105 | |
---|
106 | /* |
---|
107 | * Implementation of hook_block() |
---|
108 | */ |
---|
109 | function entes_planificadores_toolbar_block($op = 'list', $delta = 0, $edit = array()) { |
---|
110 | if ($op == 'list') { |
---|
111 | $blocks[0] = array( |
---|
112 | 'info' => t('Administrar planificación toolbar'), |
---|
113 | ); |
---|
114 | $blocks[1] = array( |
---|
115 | 'info' => t('Usuarios toolbar'), |
---|
116 | ); |
---|
117 | $blocks[2] = array( |
---|
118 | 'info' => t('Entes planificadores toolbar'), |
---|
119 | ); |
---|
120 | $blocks[3] = array( |
---|
121 | 'info' => t('Mi ente planificador toolbar'), |
---|
122 | ); |
---|
123 | return $blocks; |
---|
124 | } |
---|
125 | else if ($op == 'view') { |
---|
126 | switch ($delta) { |
---|
127 | case 0: |
---|
128 | if (user_access('admin planificador')) { |
---|
129 | $links = _entes_planificadores_toolbar_admin_items(); |
---|
130 | if (is_array($links) && count($links)) { |
---|
131 | $entes_planificadores_toolbar_path = drupal_get_path('module', 'entes_planificadores_toolbar'); |
---|
132 | //drupal_add_js($entes_planificadores_toolbar_path . '/js/entes_planificadores_toolbar.js'); |
---|
133 | $content = theme('entes_planificadores_toolbar_admin', $links); |
---|
134 | $block = array( |
---|
135 | 'subject' => t('Administración'), |
---|
136 | 'content' => $content, |
---|
137 | ); |
---|
138 | return $block; |
---|
139 | } |
---|
140 | } |
---|
141 | break; |
---|
142 | case 1: |
---|
143 | global $user; |
---|
144 | if ($user->uid) { |
---|
145 | $links = _entes_planificadores_toolbar_usuario_items($user->uid); |
---|
146 | if (is_array($links) && count($links)) { |
---|
147 | $entes_planificadores_toolbar_path = drupal_get_path('module', 'entes_planificadores_toolbar'); |
---|
148 | //drupal_add_js($entes_planificadores_toolbar_path . '/js/entes_planificadores_toolbar.js'); |
---|
149 | $content = theme('entes_planificadores_toolbar_usuarios', $links); |
---|
150 | $block = array( |
---|
151 | 'subject' => t('Mi usuario'), |
---|
152 | 'content' => $content, |
---|
153 | ); |
---|
154 | return $block; |
---|
155 | } |
---|
156 | } |
---|
157 | |
---|
158 | break; |
---|
159 | case 2: |
---|
160 | if (user_access('ver planificador')) { |
---|
161 | if((arg(0) == 'node' && is_numeric(arg(1))) || (arg(0) == 'planificacion' && is_numeric(arg(1)))) { |
---|
162 | $ente_planificador = node_load(arg(1)); |
---|
163 | if ($ente_planificador->type == "ente_planificador") { |
---|
164 | $links = _entes_planificadores_toolbar_planner_items($ente_planificador); |
---|
165 | if (is_array($links) && count($links)) { |
---|
166 | $entes_planificadores_toolbar_path = drupal_get_path('module', 'entes_planificadores_toolbar'); |
---|
167 | //drupal_add_js($entes_planificadores_toolbar_path . '/js/entes_planificadores_toolbar.js'); |
---|
168 | $content = theme('entes_planificadores_toolbar_planner', $links); |
---|
169 | $block = array( |
---|
170 | 'subject' => check_plain($ente_planificador->title), |
---|
171 | 'content' => $content, |
---|
172 | ); |
---|
173 | return $block; |
---|
174 | } |
---|
175 | } |
---|
176 | } |
---|
177 | } |
---|
178 | break; |
---|
179 | case 3: |
---|
180 | if (user_access('ver planificador')) { |
---|
181 | global $user; |
---|
182 | $ente = usuario_tiene_ente($user->uid); |
---|
183 | if ($ente->nid) { |
---|
184 | $ente_planificador = node_load($ente->nid); |
---|
185 | $links = _entes_planificadores_toolbar_planner_items($ente_planificador); |
---|
186 | if (is_array($links) && count($links)) { |
---|
187 | $entes_planificadores_toolbar_path = drupal_get_path('module', 'entes_planificadores_toolbar'); |
---|
188 | //drupal_add_js($entes_planificadores_toolbar_path . '/js/entes_planificadores_toolbar.js'); |
---|
189 | $content = theme('entes_planificadores_toolbar_myplanner', $links); |
---|
190 | $block = array( |
---|
191 | 'subject' => t('Mi ente planificador'), |
---|
192 | 'content' => $content, |
---|
193 | ); |
---|
194 | return $block; |
---|
195 | } |
---|
196 | } |
---|
197 | } |
---|
198 | break; |
---|
199 | } |
---|
200 | } |
---|
201 | } |
---|
202 | |
---|
203 | /* |
---|
204 | * Implementation of _entes_planificadores_toolbar_usuario_items() |
---|
205 | * Agrega las opciones al menu del usuario |
---|
206 | */ |
---|
207 | function _entes_planificadores_toolbar_usuario_items($uid) { |
---|
208 | $handler_icon = variable_get('entes_planificadores_toolbar_handler_icons_users', 'entes_planificadores_normal'); |
---|
209 | $links = module_invoke_all('usuario_items_toolbar', $uid, $handler_icon); |
---|
210 | drupal_alter('toolbar_usuario', $links); |
---|
211 | return $links; |
---|
212 | } |
---|
213 | |
---|
214 | /* |
---|
215 | * Implementation of _entes_planificadores_toolbar_admin_items() |
---|
216 | * Agrega las opciones al menu admin |
---|
217 | */ |
---|
218 | function _entes_planificadores_toolbar_admin_items() { |
---|
219 | $handler_icon = variable_get('entes_planificadores_toolbar_handler_icons_admin', 'entes_planificadores_normal'); |
---|
220 | $links = module_invoke_all('admin_items_toolbar', $handler_icon); |
---|
221 | drupal_alter('toolbar_admin', $links); |
---|
222 | return $links; |
---|
223 | } |
---|
224 | |
---|
225 | /* |
---|
226 | * Implementation of _entes_planificadores_toolbar_planner_items() |
---|
227 | * Agrega las opciones al menu planner y myplanner |
---|
228 | */ |
---|
229 | function _entes_planificadores_toolbar_planner_items($ente_planificador) { |
---|
230 | $handler_icon = variable_get('entes_planificadores_toolbar_handler_icons_planner', 'entes_planificadores_normal'); |
---|
231 | $links = module_invoke_all('planner_items_toolbar', $ente_planificador, $handler_icon); |
---|
232 | drupal_alter('toolbar_planner', $links); |
---|
233 | return $links; |
---|
234 | } |
---|
235 | |
---|
236 | /** |
---|
237 | * Get all iconsets and their details. |
---|
238 | * |
---|
239 | * @param $reset |
---|
240 | * If TRUE, clear the cache and fetch the information again. |
---|
241 | * @return |
---|
242 | * array of iconset objects. |
---|
243 | */ |
---|
244 | function entes_planificadores_toolbar_get_iconsets($reset = FALSE) { |
---|
245 | static $iconsets; |
---|
246 | if ($reset || !isset($iconsets)) { |
---|
247 | $iconsets = module_invoke_all('planificacion_iconset_info'); |
---|
248 | } |
---|
249 | return $iconsets; |
---|
250 | } |
---|
251 | |
---|
252 | /** |
---|
253 | * Get an iconsets details. |
---|
254 | * |
---|
255 | * @param $iconset |
---|
256 | * The iconset name. |
---|
257 | * @return |
---|
258 | * object with requested iconset. |
---|
259 | */ |
---|
260 | function entes_planificadores_toolbar_get_iconset($iconset) { |
---|
261 | $iconsets = entes_planificadores_toolbar_get_iconsets(); |
---|
262 | return $iconsets[$iconset]; |
---|
263 | } |
---|
264 | |
---|
265 | /** |
---|
266 | * Get the path to an icon. |
---|
267 | * |
---|
268 | * @param $instance |
---|
269 | * string instance (users, admin, planner). |
---|
270 | * @param $iconset |
---|
271 | * The icon set to use. |
---|
272 | * @return |
---|
273 | * If icon exists a string containing the path to the image file, else NULL. |
---|
274 | */ |
---|
275 | function entes_planificadores_toolbar_get_icon_path($instance, $icon, $iconset) { |
---|
276 | $iconset = entes_planificadores_toolbar_get_iconset($iconset); |
---|
277 | if (!empty($iconset) && !empty($instance) && !empty($icon)) { |
---|
278 | $icon_path = $iconset->path . '/' . drupal_strtolower($instance) . '/' . drupal_strtolower($icon) . '.' . $iconset->extension; |
---|
279 | if (file_exists($icon_path)) { |
---|
280 | return $icon_path; |
---|
281 | } |
---|
282 | } |
---|
283 | return 'default'; |
---|
284 | } |
---|
285 | |
---|
286 | /** |
---|
287 | * Implementation of hook_iconset_info(). |
---|
288 | */ |
---|
289 | function entes_planificadores_toolbar_planificacion_iconset_info() { |
---|
290 | $iconset = new stdClass(); |
---|
291 | $iconset->key = 'entes_planificadores_normal'; |
---|
292 | $iconset->name = t('Defaults icons'); |
---|
293 | $iconset->description = t('Default ente planificadores icons'); |
---|
294 | $iconset->width = '48'; |
---|
295 | $iconset->height = '48'; |
---|
296 | $iconset->extension = 'png'; |
---|
297 | $iconset->path = drupal_get_path('module', 'entes_planificadores_toolbar') . '/icons'; |
---|
298 | $iconset->css_sprite = FALSE; |
---|
299 | |
---|
300 | return array($iconset->key => $iconset); |
---|
301 | } |
---|
302 | |
---|
303 | /** |
---|
304 | * Implementation of hook_usuario_items_toolbar(). |
---|
305 | */ |
---|
306 | function entes_planificadores_toolbar_usuario_items_toolbar($uid, $handler_icon) { |
---|
307 | $link = array(); |
---|
308 | if (user_access('access user profiles')) { |
---|
309 | $icon_path = entes_planificadores_toolbar_get_icon_path('users', 'user', $handler_icon); |
---|
310 | $link[] = array( |
---|
311 | 'path' => 'user/' . $uid, |
---|
312 | 'icon_path' => $icon_path, |
---|
313 | 'icon' => theme('image', $icon_path, t('Ver la información de mi usuario'), t('Ver la información de mi usuario'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
314 | 'title' => t('Ver'), |
---|
315 | 'description' => t('Ver la información de mi usuario'), |
---|
316 | 'category' => 'user', |
---|
317 | ); |
---|
318 | } |
---|
319 | if (user_access('change own username')) { |
---|
320 | $icon_path = entes_planificadores_toolbar_get_icon_path('users', 'userpassword', $handler_icon); |
---|
321 | $link[] = array( |
---|
322 | 'path' => 'user/' . $uid . '/chgpwd', |
---|
323 | 'icon_path' => $icon_path, |
---|
324 | 'icon' => theme('image', $icon_path, t('Cambiar mi contraseña'), t('Cambiar mi contraseña'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
325 | 'title' => t('Contraseña'), |
---|
326 | 'description' => t('Cambiar mi contraseña'), |
---|
327 | 'category' => 'user', |
---|
328 | ); |
---|
329 | $icon_path = entes_planificadores_toolbar_get_icon_path('users', 'useredit', $handler_icon); |
---|
330 | $link[] = array( |
---|
331 | 'path' => 'user/' . $uid . '/edit', |
---|
332 | 'icon_path' => $icon_path, |
---|
333 | 'icon' => theme('image', $icon_path, t('Editar la información de mi usuario'), t('Editar la información de mi usuario'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
334 | 'title' => t('Editar'), |
---|
335 | 'description' => t('Editar la información de mi usuario'), |
---|
336 | 'category' => 'user', |
---|
337 | ); |
---|
338 | } |
---|
339 | $ente = usuario_tiene_ente($uid); |
---|
340 | if ($ente->nid) { |
---|
341 | $icon_path = entes_planificadores_toolbar_get_icon_path('users', 'userplanner', $handler_icon); |
---|
342 | $link[] = array( |
---|
343 | 'path' => 'node/' . $ente->nid, |
---|
344 | 'icon_path' => $icon_path, |
---|
345 | 'icon' => theme('image', $icon_path, t('Ver mi ente planificador'), t('Ver mi ente planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
346 | 'title' => t('Ente planificador'), |
---|
347 | 'description' => t('Ver mi ente planificador'), |
---|
348 | 'category' => 'planner', |
---|
349 | ); |
---|
350 | } |
---|
351 | $icon_path = entes_planificadores_toolbar_get_icon_path('users', 'userlogout', $handler_icon); |
---|
352 | $link[] = array( |
---|
353 | 'path' => 'logout', |
---|
354 | 'icon_path' => $icon_path, |
---|
355 | 'icon' => theme('image', $icon_path, t('Salir del sistema'), t('Salir del sistema'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
356 | 'title' => t('Salir'), |
---|
357 | 'description' => t('Salir del sistema'), |
---|
358 | 'category' => 'user', |
---|
359 | ); |
---|
360 | return $link; |
---|
361 | } |
---|
362 | |
---|
363 | /** |
---|
364 | * Implementation of hook_admin_items_toolbar(). |
---|
365 | */ |
---|
366 | function entes_planificadores_toolbar_admin_items_toolbar($handler_icon) { |
---|
367 | $link = array(); |
---|
368 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'users', $handler_icon); |
---|
369 | $link[] = array( |
---|
370 | 'path' => 'administrar_usuarios', |
---|
371 | 'icon_path' => $icon_path, |
---|
372 | 'icon' => theme('image', $icon_path, t('Ver los usuarios de los entes planificadores'), t('Ver los usuarios de los entes planificadores'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
373 | 'title' => t('Usuarios'), |
---|
374 | 'description' => t('Ver los usuarios de los entes planificadores'), |
---|
375 | 'category' => 'admin', |
---|
376 | ); |
---|
377 | if (user_access('administer users')) { |
---|
378 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'usersetting', $handler_icon); |
---|
379 | $link[] = array( |
---|
380 | 'path' => 'admin/user/settings', |
---|
381 | 'icon_path' => $icon_path, |
---|
382 | 'icon' => theme('image', $icon_path, t('Configurar los usuarios de los entes planificadores'), t('Configurar los usuarios de los entes planificadores'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
383 | 'title' => t('User settings'), |
---|
384 | 'description' => t('Configurar los usuarios de los entes planificadores'), |
---|
385 | 'category' => 'admin', |
---|
386 | ); |
---|
387 | } |
---|
388 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'roles', $handler_icon); |
---|
389 | $link[] = array( |
---|
390 | 'path' => 'admin/settings/ente_planificador', |
---|
391 | 'icon_path' => $icon_path, |
---|
392 | 'icon' => theme('image', $icon_path, t('Configurar los roles de los usuarios de los entes planificadores'), t('Configurar los roles de los usuarios de los entes planificadores'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
393 | 'title' => t('Roles planificadores'), |
---|
394 | 'description' => t('Configurar los roles de los usuarios de los entes planificadores'), |
---|
395 | 'category' => 'admin', |
---|
396 | ); |
---|
397 | if (user_access('administer permissions')) { |
---|
398 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'rolesperm', $handler_icon); |
---|
399 | $link[] = array( |
---|
400 | 'path' => 'admin/user/permissions', |
---|
401 | 'icon_path' => $icon_path, |
---|
402 | 'icon' => theme('image', $icon_path, t('Permissions let you control what users can do on your site'), t('Permissions let you control what users can do on your site'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
403 | 'title' => t('Permissions'), |
---|
404 | 'description' => t('Permissions let you control what users can do on your site'), |
---|
405 | 'category' => 'admin', |
---|
406 | ); |
---|
407 | } |
---|
408 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'planners', $handler_icon); |
---|
409 | $link[] = array( |
---|
410 | 'path' => 'administrar/entes_planificadores', |
---|
411 | 'icon_path' => $icon_path, |
---|
412 | 'icon' => theme('image', $icon_path, t('Consultar lista de actores planificadores'), t('Consultar lista de actores planificadores'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
413 | 'title' => t('Actores planificadores'), |
---|
414 | 'description' => t('Consultar lista de actores planificadores'), |
---|
415 | 'category' => 'planner', |
---|
416 | ); |
---|
417 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'plannersearch', $handler_icon); |
---|
418 | $link[] = array( |
---|
419 | 'path' => 'datosactoresplanificadores', |
---|
420 | 'icon_path' => $icon_path, |
---|
421 | 'icon' => theme('image', $icon_path, t('Consultar datos de los actores planificadores (APM/APMS)'), t('Consultar datos de los actores planificadores (APM/APMS)'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
422 | 'title' => t('Buscar actores planificadores'), |
---|
423 | 'description' => t('Consultar datos de los actores planificadores (APM/APMS)'), |
---|
424 | 'category' => 'planner', |
---|
425 | ); |
---|
426 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'planneradd', $handler_icon); |
---|
427 | $link[] = array( |
---|
428 | 'path' => 'administrar/entes_planificadores/registrar', |
---|
429 | 'icon_path' => $icon_path, |
---|
430 | 'icon' => theme('image', $icon_path, t('Agregar un nuevo actor planificador'), t('Agregar un nuevo actor planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
431 | 'title' => t('Agregar actor planificador'), |
---|
432 | 'description' => t('Agregar un nuevo actor planificador'), |
---|
433 | 'category' => 'planner', |
---|
434 | ); |
---|
435 | if (user_access('access administration pages')) { |
---|
436 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'nodetypes', $handler_icon); |
---|
437 | $link[] = array( |
---|
438 | 'path' => 'admin/content', |
---|
439 | 'icon_path' => $icon_path, |
---|
440 | 'icon' => theme('image', $icon_path, t('Administrar contenidos'), t('Administrar contenidos'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
441 | 'title' => t('Administrar contenido'), |
---|
442 | 'description' => t('Administrar contenidos'), |
---|
443 | 'category' => 'admin', |
---|
444 | ); |
---|
445 | } |
---|
446 | if (user_access('administer site configuration')) { |
---|
447 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'modules', $handler_icon); |
---|
448 | $link[] = array( |
---|
449 | 'path' => 'admin/build/modules', |
---|
450 | 'icon_path' => $icon_path, |
---|
451 | 'icon' => theme('image', $icon_path, t('Administrar modulos'), t('Administrar modulos'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
452 | 'title' => t('Modulos'), |
---|
453 | 'description' => t('Administrar modulos'), |
---|
454 | 'category' => 'admin', |
---|
455 | ); |
---|
456 | } |
---|
457 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'date', $handler_icon); |
---|
458 | $link[] = array( |
---|
459 | 'path' => 'fechas_planificacion', |
---|
460 | 'icon_path' => $icon_path, |
---|
461 | 'icon' => theme('image', $icon_path, t('Fechas de planificación'), t('Fechas de planificación'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
462 | 'title' => t('Fechas'), |
---|
463 | 'description' => t('Fechas de planificación'), |
---|
464 | 'category' => 'planner', |
---|
465 | ); |
---|
466 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'dateedit', $handler_icon); |
---|
467 | $link[] = array( |
---|
468 | 'path' => 'fechas_planificacion/todas_edit', |
---|
469 | 'icon_path' => $icon_path, |
---|
470 | 'icon' => theme('image', $icon_path, t('Editar las fechas de planificación'), t('Editar las fechas de planificación'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
471 | 'title' => t('Editar Fechas'), |
---|
472 | 'description' => t('Editar las fechas de planificación'), |
---|
473 | 'category' => 'planner', |
---|
474 | ); |
---|
475 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'emailsend', $handler_icon); |
---|
476 | $link[] = array( |
---|
477 | 'path' => 'fechas_planificacion/envia_email', |
---|
478 | 'icon_path' => $icon_path, |
---|
479 | 'icon' => theme('image', $icon_path, t('Enviar correo con las fechas de planificación'), t('Enviar correo con las fechas de planificación'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
480 | 'title' => t('Enviar correo'), |
---|
481 | 'description' => t('Enviar correo con las fechas de planificación'), |
---|
482 | 'category' => 'planner', |
---|
483 | ); |
---|
484 | $icon_path = entes_planificadores_toolbar_get_icon_path('admin', 'emailnotify', $handler_icon); |
---|
485 | $link[] = array( |
---|
486 | 'path' => 'fechas_planificacion/notificacion', |
---|
487 | 'icon_path' => $icon_path, |
---|
488 | 'icon' => theme('image', $icon_path, t('Configurar las fechas de notificación'), t('Configurar las fechas de notificación'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
489 | 'title' => t('Notificación'), |
---|
490 | 'description' => t('Configurar las fechas de notificación'), |
---|
491 | 'category' => 'planner', |
---|
492 | ); |
---|
493 | |
---|
494 | return $link; |
---|
495 | } |
---|
496 | |
---|
497 | /** |
---|
498 | * Implementation of hook_planner_items_toolbar(). |
---|
499 | */ |
---|
500 | function entes_planificadores_toolbar_planner_items_toolbar($ente_planificador, $handler_icon) { |
---|
501 | global $user; |
---|
502 | $link = array(); |
---|
503 | $situacion_actual_preliminar = module_exists('situacion_actual_preliminar'); |
---|
504 | $situacion_actual = module_exists('situacion_actual'); |
---|
505 | $causas_criticas = module_exists('causas_criticas'); |
---|
506 | $situacion_ideal = module_exists('situacion_ideal'); |
---|
507 | $proyectos_direccionales = module_exists('proyectos_direccionales'); |
---|
508 | //$node_es_ente_acceso = nodo_es_ente_planificador_acceso($ente_planificador->nid); |
---|
509 | $node_es_ente = nodo_es_ente_planificador($ente_planificador->nid); |
---|
510 | $link = array(); |
---|
511 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'planner', $handler_icon); |
---|
512 | $link[] = array( |
---|
513 | 'path' => 'node/' . $ente_planificador->nid, |
---|
514 | 'icon_path' => $icon_path, |
---|
515 | 'icon' => theme('image', $icon_path, t('Consultar los datos del actor planificador'), t('Consultar los datos del actor planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
516 | 'title' => t('Actor planificador'), |
---|
517 | 'description' => t('Consultar los datos del actor planificador'), |
---|
518 | 'category' => 'planner', |
---|
519 | ); |
---|
520 | if ($node_es_ente) { |
---|
521 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'plannerdata', $handler_icon); |
---|
522 | $link[] = array( |
---|
523 | 'path' => 'node/' . $ente_planificador->nid . '/datos_basicos', |
---|
524 | 'icon_path' => $icon_path, |
---|
525 | 'icon' => theme('image', $icon_path, t('Editar los datos del ente planificador'), t('Editar los datos del ente planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
526 | 'title' => t('Datos del Actor planificador'), |
---|
527 | 'description' => t('Editar los datos del ente planificador'), |
---|
528 | 'category' => 'planner', |
---|
529 | ); |
---|
530 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'plannerusers', $handler_icon); |
---|
531 | $link[] = array( |
---|
532 | 'path' => 'node/' . $ente_planificador->nid . '/usuarios', |
---|
533 | 'icon_path' => $icon_path, |
---|
534 | 'icon' => theme('image', $icon_path, t('Muestra los usuarios del ente planificador'), t('Muestra los usuarios del ente planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
535 | 'title' => t('Usuarios'), |
---|
536 | 'description' => t('Muestra los usuarios del ente planificador'), |
---|
537 | 'category' => 'planner', |
---|
538 | ); |
---|
539 | } |
---|
540 | if (user_access('administer users')) { |
---|
541 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'planneruseradd', $handler_icon); |
---|
542 | $link[] = array( |
---|
543 | 'path' => 'admin/user/user/create/' . $ente_planificador->nid, |
---|
544 | 'icon_path' => $icon_path, |
---|
545 | 'icon' => theme('image', $icon_path, t('Agregar un usuario al ente planificador'), t('Agregar un usuario al ente planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
546 | 'title' => t('Agregar usuarios'), |
---|
547 | 'description' => t('Agregar un usuario al ente planificador'), |
---|
548 | 'category' => 'planner', |
---|
549 | ); |
---|
550 | } |
---|
551 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'plannerstatus', $handler_icon); |
---|
552 | $link[] = array( |
---|
553 | 'path' => 'planificacion/' . $ente_planificador->nid, |
---|
554 | 'icon_path' => $icon_path, |
---|
555 | 'icon' => theme('image', $icon_path, t('Muestra los avances en la planificación del ente planificador'), t('Muestra los avances en la planificación del ente planificador'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
556 | 'title' => t('Avances'), |
---|
557 | 'description' => t('Muestra los avances en la planificación del ente planificador'), |
---|
558 | 'category' => 'planning', |
---|
559 | ); |
---|
560 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'date', $handler_icon); |
---|
561 | $link[] = array( |
---|
562 | 'path' => 'fechas_planificacion', |
---|
563 | 'icon_path' => $icon_path, |
---|
564 | 'icon' => theme('image', $icon_path, t('Fechas de planificación'), t('Fechas de planificación'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
565 | 'title' => t('Fechas'), |
---|
566 | 'description' => t('Fechas de planificación'), |
---|
567 | ); |
---|
568 | |
---|
569 | |
---|
570 | |
---|
571 | |
---|
572 | |
---|
573 | |
---|
574 | |
---|
575 | |
---|
576 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'planners', $handler_icon); |
---|
577 | $link[] = array( |
---|
578 | 'path' => 'administrar/entes_planificadores', |
---|
579 | 'icon_path' => $icon_path, |
---|
580 | 'icon' => theme('image', $icon_path, t('Consultar lista de actores planificadores'), t('Consultar lista de actores planificadores'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
581 | 'title' => t('Actores planificadores'), |
---|
582 | 'description' => t('Consultar lista de actores planificadores'), |
---|
583 | 'category' => 'planner', |
---|
584 | ); |
---|
585 | $icon_path = entes_planificadores_toolbar_get_icon_path('planner', 'plannersearch', $handler_icon); |
---|
586 | $link[] = array( |
---|
587 | 'path' => 'datosactoresplanificadores', |
---|
588 | 'icon_path' => $icon_path, |
---|
589 | 'icon' => theme('image', $icon_path, t('Consultar datos de los actores planificadores (APM/APMS)'), t('Consultar datos de los actores planificadores (APM/APMS)'), array('class' => 'handler-icon-' . $handler_icon)), |
---|
590 | 'title' => t('Buscar actores planificadores'), |
---|
591 | 'description' => t('Consultar datos de los actores planificadores (APM/APMS)'), |
---|
592 | 'category' => 'planner', |
---|
593 | ); |
---|
594 | return $link; |
---|
595 | } |
---|