function _glossary_list in Glossary 5.2
Same name and namespace in other branches
- 5 glossary.module \_glossary_list()
- 6 glossary.module \_glossary_list()
- 7 glossary.module \_glossary_list()
1 call to _glossary_list()
File
- ./
glossary.module, line 1073 - Glossary terms will be automatically marked with links to their descriptions.
Code
function _glossary_list() {
$output = "";
$destination = drupal_get_destination();
$vids = _glossary_get_filter_vids();
$vocs = array();
foreach ($vids as $vid) {
$voc = taxonomy_get_vocabulary($vid);
$vocs[$voc->name] = $voc;
}
uksort($vocs, _glossary_cmp_strcase);
$eo = array(
'even',
'odd',
);
$i = 0;
$output .= '<table><tr><th>' . t("Glossary name") . '</th><th>' . t('Operations') . '</th></tr>';
foreach ($vocs as $voc) {
$links = array();
$class = $eo[++$i & 1];
if (user_access('administer taxonomy')) {
$links['glossary_edit'] = array(
'title' => t('Edit @name', array(
'@name' => drupal_strtolower($vocabulary->name),
)),
'href' => 'admin/content/taxonomy/edit/vocabulary/' . $voc->vid,
'query' => $destination,
);
}
$links['glossary_view'] = array(
'title' => t('List'),
'href' => 'glossary/' . $voc->vid,
);
if ($voc->description) {
$output .= '<tr class="' . $class . ' merge-down"><th>' . $voc->name . '</th><td>' . theme('links', $links) . '</td></tr>';
$output .= '<tr class="' . $class . ' merge-up"><td colspan="2" class="glossary-list-description">' . $voc->description . '</td></tr>';
}
else {
$output .= '<tr class="' . $class . '">';
$output .= '<th>' . $voc->name . '</th><td>' . theme('links', $links) . '</td></tr>';
}
}
// Were there any rows produced?
if ($i == 0) {
$output .= '<tr><td colspan="5">' . t('No applicable vocabularies were found, please check your settings.') . '</td></tr>';
}
$output .= '</table>';
return $output;
}