nid) { case 206666: $extra = project_stuff_project_by_core(); break; case 199251: $extra = project_stuff_cvs_rss(); break; } $node->content['body']['#value'] .= $extra; } } function project_stuff_project_by_core() { $output = ''; $tags = array( 'DRUPAL-4-7' => t('Drupal 4.7.x'), 'DRUPAL-5' => t('Drupal 5.x'), 'DRUPAL-6' => t('Drupal 6.x'), ); foreach ($tags as $tag => $label) { $top_list[] = l($tag, $_GET['q'], array(), NULL, $tag); $projects = db_query("SELECT DISTINCT p.nid, n.title, p.uri FROM {project_projects} p INNER JOIN {project_release_nodes} r ON p.nid = r.pid INNER JOIN {node} n ON n.nid = p.nid INNER JOIN {term_node} tn ON p.nid = tn.nid WHERE tn.tid = 14 AND r.tag LIKE '%s%%' ORDER BY n.title", $tag); $list = array(); while ($project = db_fetch_object($projects)) { $list[] = l($project->title, "project/$project->uri", array(), NULL, NULL, TRUE); } if (!empty($list)) { $output .= theme('item_list', $list, "$label"); } } if (!empty($top_list)) { $output = theme('item_list', $top_list) . $output; } return $output; } function project_stuff_cvs_rss() { $count_query = "SELECT COUNT(*) FROM {node} WHERE type = 'project_project' && status = '1'"; $total = db_result(db_query($count_query)); $header = array(array('data' => t('Number'), 'field' => 'nid', 'sort' => 'desc'), t('Title'), t('CVS/RSS')); $result = pager_query("SELECT nid, title, status FROM {node} WHERE type = 'project_project' && status='1' ". tablesort_sql($header), 100, 0, $count_query); $rows = array(); $page = (int)$_GET['page']; $count= $total - $page * 100; while($row = db_fetch_array($result)) { $url = url('cvs', 'rss=true&nid='. $row['nid'], NULL, TRUE); $rows[]= array($count--, l($row['title'], 'node/'. $row['nid']), theme('feed_icon', $url)); } drupal_set_message("There are $total projects."); return theme('table', $header, $rows). theme('pager'); }