/[drupal]/contributions/modules/taxonomy_ticker/taxonomy_ticker.module
ViewVC logotype

Diff of /contributions/modules/taxonomy_ticker/taxonomy_ticker.module

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

revision 1.18, Sat May 5 14:53:06 2007 UTC revision 1.19, Mon Jan 7 16:19:20 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: taxonomy_ticker.module,v 1.17 2006/11/05 16:55:11 mathieu Exp $  // $Id: taxonomy_ticker.module,v 1.18 2007/05/05 14:53:06 mathieu Exp $
3    
4    
5  /**  /**
# Line 18  function taxonomy_ticker_help($section) Line 18  function taxonomy_ticker_help($section)
18  }  }
19    
20  function taxonomy_ticker_contents() {  function taxonomy_ticker_contents() {
21    // Scrolling vertically.    $tid    = variable_get("taxonomy_ticker_tid", array());
   if (variable_get('taxonomy_ticker_direction', 0) == 0) {  
     drupal_add_js(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker.js');  
     drupal_add_css(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker.css');  
   }  
   else {  
     drupal_add_js(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker_horizontally.js');  
     drupal_add_css(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker_horizontally.css');  
   }  
   
   $tickerspeed = variable_get('taxonomy_ticker_speed', 8);  
   // Removing the style tag from scrollPane breaks the scrolling functionality.  
   $block  = '<div id="scrollerClipper" style="z-index: '. $tickerspeed .'" onmouseover="pauseScroll();" onmouseout="reStartScroll();"><div id="outerscrollPane"><div id="scrollPane" style="position: relative; top: 0px; left: 0px;">';  
   
   $type_q = ($type ? "n.type = '$type'" : 1);  
   $tid    = variable_get("taxonomy_ticker_tid", 1);  
   foreach ($tid as $key => $val) {  
     $tid[$key] = "r.tid = '$val'";  
   }  
   if (!empty($tid)) $tids = "AND (". join(" OR ", $tid) .")";  
22    
23    $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 ". $tids ." AND $type_q ORDER BY n.changed DESC");    if (count($tid))
24      {
25    $results = db_query_range($query, 0, variable_get('taxonomy_ticker_count', 5));      // Scrolling vertically.
26        if (variable_get('taxonomy_ticker_direction', 0) == 0) {
27    $block .= '<div id="firstscrollerContentItem"></div>';        drupal_add_js(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker.js');
28    while ($result = db_fetch_object($results)) {        drupal_add_css(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker.css');
     /**  
      * The commented code that follows is an example of how to integrate taxonomy_ticker with  
      * a flexinode content-type, which could be used to show some html content instead of just  
      * displaying the title of the node.  
      */  
     /*  
     $node = node_load(array('nid'=>$result->nid));  
     if ( $node->flexinode_2 != '' ) {  
       // $block .= "<div class=\"scrollerContentItem\"><p><a href=\"" . $node->flexinode_2 . "\">$result->title</a></p></div>";  
       $block .= "<div class=\"scrollerContentItem\"><p>$node->flexinode_2</p></div>";  
29      }      }
30      else {      else {
31      */        drupal_add_js(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker_horizontally.js');
32      if (variable_get('taxonomy_ticker_teaser', 0) == 1) {        drupal_add_css(drupal_get_path('module', 'taxonomy_ticker') .'/taxonomy_ticker_horizontally.css');
       $node = node_load(array('nid' => $result->nid));  
       $teaser = '<br/>'. $node->teaser;  
33      }      }
34      else $teaser = '';  
35      $block .= '<div class="scrollerContentItem"><p>'. l($result->title, 'node/'. $result->nid) . $teaser .'</p></div>';      $tickerspeed = variable_get('taxonomy_ticker_speed', 8);
36      /*      // Removing the style tag from scrollPane breaks the scrolling functionality.
37        $block  = '<div id="scrollerClipper" style="z-index: '. $tickerspeed .'" onmouseover="pauseScroll();" onmouseout="reStartScroll();"><div id="outerscrollPane"><div id="scrollPane" style="position: relative; top: 0px; left: 0px;">';
38    
39        $type_q = ($type ? "n.type = '$type'" : 1);
40    
41        foreach ($tid as $key => $val) {
42          $tid[$key] = "r.tid = '$val'";
43      }      }
44      */      if (!empty($tid)) $tids = "AND (". join(" OR ", $tid) .")";
   }  
45    
46    $block .= '<div id="lastscrollerContentItem"></div>';      $query = db_rewrite_sql("SELECT n.nid, n.title, n.type FROM {node} n LEFT JOIN {term_node} r ON r.nid = n.nid WHERE n.status = 1 ". $tids ." AND $type_q ORDER BY n.changed DESC");
   $block .= '<div style="clear: both"></div></div></div></div>';  
47    
48        $results = db_query_range($query, 0, variable_get('taxonomy_ticker_count', 5));
49    
50        $block .= '<div id="firstscrollerContentItem"></div>';
51        while ($result = db_fetch_object($results)) {
52          /**
53           * The commented code that follows is an example of how to integrate taxonomy_ticker with
54           * a flexinode content-type, which could be used to show some html content instead of just
55           * displaying the title of the node.
56           */
57          /*
58          $node = node_load(array('nid'=>$result->nid));
59          if ( $node->flexinode_2 != '' ) {
60            // $block .= "<div class=\"scrollerContentItem\"><p><a href=\"" . $node->flexinode_2 . "\">$result->title</a></p></div>";
61            $block .= "<div class=\"scrollerContentItem\"><p>$node->flexinode_2</p></div>";
62          }
63          else {
64          */
65          if (variable_get('taxonomy_ticker_teaser', 0) == 1) {
66            $node = node_load(array('nid' => $result->nid));
67            $teaser = '<br/>'. $node->teaser;
68          }
69          else $teaser = '';
70          $block .= '<div class="scrollerContentItem"><p>'. l($result->title, 'node/'. $result->nid) . $teaser .'</p></div>';
71          /*
72          }
73          */
74        }
75    
76        $block .= '<div id="lastscrollerContentItem"></div>';
77        $block .= '<div style="clear: both"></div></div></div></div>';
78      }
79      else
80      {
81        $block='';
82      }
83    return $block;    return $block;
84  }  }
85    

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

  ViewVC Help
Powered by ViewVC 1.1.2