equal
deleted
inserted
replaced
|
1 <?php |
|
2 /** |
|
3 * @file |
|
4 * Vocabulary Permissions Per Role - UI. |
|
5 */ |
|
6 |
|
7 /** |
|
8 * Replacement page callback for the taxonomy overview page. |
|
9 * |
|
10 * Either return the default form or our own page. |
|
11 */ |
|
12 function vppr_taxonomy_overview_vocabularies() { |
|
13 if (user_access('administer taxonomy')) { |
|
14 module_load_include('inc', 'taxonomy', 'taxonomy.admin'); |
|
15 return drupal_get_form('taxonomy_overview_vocabularies'); |
|
16 } |
|
17 |
|
18 $vocabularies = taxonomy_get_vocabularies(); |
|
19 $rows = array(); |
|
20 foreach ($vocabularies as $vocabulary) { |
|
21 if (user_access('administer ' . $vocabulary->machine_name . ' vocabulary terms')) { |
|
22 $row = array(); |
|
23 $row[] = check_plain($vocabulary->name); |
|
24 $row[] = l(t('list terms'), "admin/structure/taxonomy/$vocabulary->machine_name"); |
|
25 $row[] = l(t('add terms'), "admin/structure/taxonomy/$vocabulary->machine_name/add"); |
|
26 $rows[] = $row; |
|
27 } |
|
28 } |
|
29 $header = array(t('Vocabulary name')); |
|
30 $header[] = array('data' => t('Operations'), 'colspan' => '2'); |
|
31 |
|
32 // TODO: Return a render array instead; this is a page callback, at last. |
|
33 return theme('table', array( |
|
34 'header' => $header, |
|
35 'rows' => $rows, |
|
36 'empty' => t('No vocabularies available.'), |
|
37 'attributes' => array('id' => 'vppr-vocabularies'), |
|
38 )); |
|
39 } |