/[drupal]/contributions/modules/links/links_weblink.module
ViewVC logotype

Diff of /contributions/modules/links/links_weblink.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.19, Thu Jul 17 02:50:26 2008 UTC revision 1.20, Sat Nov 1 00:46:30 2008 UTC
# Line 1  Line 1 
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
# Line 79  function links_weblink_page() { Line 79  function links_weblink_page() {
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();
# Line 97  function links_weblink_page() { Line 99  function links_weblink_page() {
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) {
# Line 140  function links_weblink_page() { Line 155  function links_weblink_page() {
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)) {
# Line 150  function links_weblink_page() { Line 165  function links_weblink_page() {
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    
# Line 178  function links_weblink_page() { Line 194  function links_weblink_page() {
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) {

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.2