| 1 |
<?php |
<?php |
| 2 |
// $Id: links_weblink.module,v 1.18 2007/12/14 18:52:15 syscrusher Exp $ |
// $Id: links_weblink.module,v 1.19 2008/07/17 02:50:26 syscrusher Exp $ |
| 3 |
|
|
| 4 |
/* |
/* |
| 5 |
* links_weblink defines a "weblink" node type, for backward compatibility |
* links_weblink defines a "weblink" node type, for backward compatibility |
| 79 |
$page = array(); |
$page = array(); |
| 80 |
$page['#theme'] = 'links_weblink_page'; |
$page['#theme'] = 'links_weblink_page'; |
| 81 |
|
|
| 82 |
|
$html = ""; |
| 83 |
|
|
| 84 |
// This array will hold the level we are showing |
// This array will hold the level we are showing |
| 85 |
// as $tid => $name |
// as $tid => $name |
| 86 |
$terms = array(); |
$terms = array(); |
| 99 |
$top_level = true; |
$top_level = true; |
| 100 |
// Go get all the top-level terms for applicable vocabs |
// Go get all the top-level terms for applicable vocabs |
| 101 |
$vocabs = taxonomy_get_vocabularies('weblink'); |
$vocabs = taxonomy_get_vocabularies('weblink'); |
| 102 |
|
// If no vocabs are defined, we can't go any further, so abort out |
| 103 |
|
// with an administrator warning. |
| 104 |
|
if (! count($vocabs)) { |
| 105 |
|
$vars = array(); |
| 106 |
|
$msg = "No categories are defined for the weblink module."; |
| 107 |
|
if (user_access('administer taxonomy')) { |
| 108 |
|
$vars['!admin_link'] = l(t('category administration'),'admin/content/taxonomy'); |
| 109 |
|
$msg .= " (go to !admin_link)"; |
| 110 |
|
} |
| 111 |
|
$html .= t("<p>$msg</p>\n", $vars); |
| 112 |
|
watchdog('links', $msg, $vars, WATCHDOG_WARNING, l(t('administer'), 'admin/content/taxonomy')); |
| 113 |
|
return $html; |
| 114 |
|
} |
| 115 |
foreach ($vocabs as $vocab) { |
foreach ($vocabs as $vocab) { |
| 116 |
$tree = taxonomy_get_tree($vocab->vid, 0, -1, 1); |
$tree = taxonomy_get_tree($vocab->vid, 0, -1, 1); |
| 117 |
foreach ($tree as $term) { |
foreach ($tree as $term) { |
| 155 |
} |
} |
| 156 |
|
|
| 157 |
if ($top_level) { |
if ($top_level) { |
| 158 |
drupal_set_title(t('Weblinks Top Level')); |
$title = t('Weblinks Top Level'); |
| 159 |
} else { |
} else { |
| 160 |
drupal_set_title(t('Weblinks: %topics', array('%topics'=>implode(', ',$terms)))); |
$title = t('Weblinks: %topics', array('%topics'=>implode(', ',$terms))); |
| 161 |
$breadcrumbs = drupal_get_breadcrumb(); |
$breadcrumbs = drupal_get_breadcrumb(); |
| 162 |
$breadcrumbs[] = l(t('Weblinks top level'), 'links/weblink'); |
$breadcrumbs[] = l(t('Weblinks top level'), 'links/weblink'); |
| 163 |
if (count($all_parents)) { |
if (count($all_parents)) { |
| 165 |
} |
} |
| 166 |
drupal_set_breadcrumb($breadcrumbs); |
drupal_set_breadcrumb($breadcrumbs); |
| 167 |
} |
} |
| 168 |
|
drupal_set_title($title); |
| 169 |
|
|
| 170 |
// List the nodes at the current level |
// List the nodes at the current level |
| 171 |
|
|
| 194 |
'#value' => $node_html, |
'#value' => $node_html, |
| 195 |
); |
); |
| 196 |
} |
} |
| 197 |
|
} else { |
| 198 |
|
$html .= t("<p>There are no weblinks defined at this level of the category tree.</p>\n"); |
| 199 |
} |
} |
| 200 |
|
|
| 201 |
return drupal_render($page); |
//dprint_r($page); |
| 202 |
|
|
| 203 |
|
$html .= drupal_render($page); |
| 204 |
|
return $html; |
| 205 |
} |
} |
| 206 |
|
|
| 207 |
function theme_links_weblink_category_children($children) { |
function theme_links_weblink_category_children($children) { |