| 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 |
/** |
/** |