function _glossary_list in Glossary 7
Same name and namespace in other branches
- 5.2 glossary.module \_glossary_list()
- 5 glossary.module \_glossary_list()
- 6 glossary.module \_glossary_list()
1 call to _glossary_list()
- glossary_page in ./
glossary.module - Main glossary page function.
File
- ./
glossary.module, line 1060 - 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 => $machine_name) {
$voc = taxonomy_vocabulary_load($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'),
'href' => 'admin/structure/taxonomy/' . $voc->machine_name . '/edit',
'query' => $destination,
);
}
$links['glossary_view'] = array(
'title' => t('List'),
'href' => 'glossary/' . $voc->machine_name,
);
$link_html = theme('links', array(
'links' => $links,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
));
if ($voc->description) {
$output .= '<tr class="' . $class . ' merge-down"><th>' . filter_xss($voc->name) . '</th><td>' . $link_html . '</td></tr>';
$output .= '<tr class="' . $class . ' merge-up"><td colspan="2" class="glossary-list-description">' . filter_xss($voc->description) . '</td></tr>';
}
else {
$output .= '<tr class="' . $class . '">';
$output .= '<th>' . filter_xss($voc->name) . '</th><td>' . $link_html . '</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;
}