/[drupal]/contributions/modules/cre/recommendation_modules/node_recommendation.module
ViewVC logotype

Diff of /contributions/modules/cre/recommendation_modules/node_recommendation.module

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

revision 1.1.4.8, Mon Jul 23 14:11:41 2007 UTC revision 1.1.4.9, Thu Aug 30 04:19:52 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id: node_recommendation.module,v 1.1.4.7 2007/05/09 17:14:45 hickory Exp $  // $Id: node_recommendation.module,v 1.1.4.8 2007/07/23 14:11:41 hickory Exp $
3    
4  /*  /*
5  * hook_help  * hook_help
# Line 277  function node_recommendation_recommendat Line 277  function node_recommendation_recommendat
277    
278    $recommendations = $uid ? cre_top($uid, 'node_recommendation_cre_query', $n, 'node', variable_get('node_recommendation_tag', 'vote'), 'node', array($type)) : _node_recommendation_get_top_rated_nodes($n); // return recommendations for logged-in users, top-rated nodes otherwise.    $recommendations = $uid ? cre_top($uid, 'node_recommendation_cre_query', $n, 'node', variable_get('node_recommendation_tag', 'vote'), 'node', array($type)) : _node_recommendation_get_top_rated_nodes($n); // return recommendations for logged-in users, top-rated nodes otherwise.
279    
280      if($uid != 0 ) {
281        $recommendations = cre_top($uid, 'node_recommendation_cre_query', $n, 'node', variable_get('node_recommendation_tag', 'vote'), 'node', array($type));
282        if($recommendations == NULL) {
283          // user doesn't have any recommendations therefore! return top nodes
284          $recommendations = _node_recommendation_get_top_rated_nodes($n);
285        }
286      }
287      else { // anon user therefore just get the top rated nodes
288        $recommendations = _node_recommendation_get_top_rated_nodes($n);
289      }
290    $content = array();    $content = array();
291    foreach ($recommendations as $node) {    foreach ($recommendations as $node) {
292      $content[] = theme('cre_node_view', $node->content_id);      $content[] = theme('cre_node_view', $node->content_id);
# Line 290  function node_recommendation_recommendat Line 300  function node_recommendation_recommendat
300  function _node_recommendation_get_top_rated_nodes($n) {  function _node_recommendation_get_top_rated_nodes($n) {
301    $result = db_query("SELECT c.content_id as content_id, c.value as avg_vote, n.title    $result = db_query("SELECT c.content_id as content_id, c.value as avg_vote, n.title
302      FROM {votingapi_cache} c, {node} n      FROM {votingapi_cache} c, {node} n
303      WHERE c.content_id = n.nid AND c.function = 'average' AND c.tag = '%s'      WHERE c.content_id = n.nid AND c.function = 'average' AND c.tag = '%s' AND c.content_type = 'node'
304      ORDER BY avg_vote DESC LIMIT %d",      ORDER BY avg_vote DESC LIMIT %d",
305      variable_get('node_recommendation_tag', 'vote'), $n);      variable_get('node_recommendation_tag', 'vote'), $n);
306    $voting_results = array();    $voting_results = array();

Legend:
Removed from v.1.1.4.8  
changed lines
  Added in v.1.1.4.9

  ViewVC Help
Powered by ViewVC 1.1.2