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

Diff of /contributions/modules/interests/interests.module

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

revision 1.3, Sat May 12 13:20:24 2007 UTC revision 1.4, Mon Jun 11 23:45:42 2007 UTC
# Line 216  function interests_browse() { Line 216  function interests_browse() {
216          }          }
217    
218          //Do the selection of nodes where tags match          //Do the selection of nodes where tags match
   
         $result = db_query("SELECT i.counter, t.tid, t.name, n.nid, n.title, n.type FROM {interests} i, {term_data} t, {term_node} tn, {node} n WHERE n.nid = tn.nid AND tn.tid = t.tid AND i.tid = t.tid AND i.uid = '%s' ORDER BY n.type, i.counter desc, n.changed desc", $user->uid);  
219    
220          while($row = db_fetch_array($result)){          $resultTypes = db_query("SELECT nt.type, nt.name FROM {node_type} nt");
221                  if($currentType != $row['type']){          while($row = db_fetch_array($resultTypes)){
222                          switch($row['type']){                  $result = db_query("SELECT i.counter, t.tid, t.name, n.nid, n.title FROM {interests} i, {term_data} t, {term_node} tn, {node} n WHERE n.nid = tn.nid AND tn.tid = t.tid AND i.tid = t.tid AND i.uid = '%s' AND n.type = '%s' GROUP BY n.nid ORDER BY i.counter desc, n.changed desc LIMIT 5", $user->uid, $row['type']);
223                                  case 'blog':                  if(db_num_rows($result)){
224                                          $sectionTitle = t('Latest blog posts of interest');                          $sectionTitle = $row['name'];
                                         break;  
                                 case 'page':  
                                         $sectionTitle = t('Latest content of interest');  
                                         break;  
                         }  
                         $output .= "</ul>";  
225                          $output .= "<h2>$sectionTitle</h2>";                          $output .= "<h2>$sectionTitle</h2>";
226                          $output .= "<ul>";                          $output .= "<ul>";
227                          $currentType = $row['type'];  
228                  }else{                          while($rowNodes = db_fetch_array($result)){
229                          $currentType = $row['type'];                                  $output .= "<li>".l($rowNodes['title'], 'node/'.$rowNodes['nid'])."</li>";
230                            }
231    
232                            $output .= "</ul>";
233                  }                  }
                 $output .= "<li>".l($row['title'], 'node/'.$row['nid'])."</li>";  
234          }          }
235    
236          return $output;          return $output;
237    
238  }  }
239    
240  function _interests_user_suggestions(){  function _interests_user_suggestions(){
241          global $user;          global $user;
   
         $result = db_query("SELECT i.counter AS count, t.tid, t.name, t.vid, t.weight FROM {interests} i, {term_data} t WHERE t.tid = i.tid AND i.uid = '%s' ORDER BY i.counter DESC", $user->uid);  
   
242    
243          $tags = tagadelic_build_weighted_tags($result, $steps = 6);          if($user->uid == 0){
244          $output = theme('tagadelic_weighted', $tags);                  $output = t("This site uses interest tagging for authenticated users");
245            }
246            else{
247                    $result = db_query("SELECT i.counter AS count, t.tid, t.name, t.vid, t.weight FROM {interests} i, {term_data} t WHERE t.tid = i.tid AND i.uid = '%s' ORDER BY t.name DESC", $user->uid);
248                    $tags = tagadelic_build_weighted_tags($result, $steps = 6);
249                    $output = theme('tagadelic_weighted', $tags);
250            }
251          return $output;          return $output;
252  }  }
253  /**  /**

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.2