/[drupal]/contributions/modules/epublish/epublish_layout_nodes.inc
ViewVC logotype

Contents of /contributions/modules/epublish/epublish_layout_nodes.inc

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


Revision 1.3 - (show annotations) (download) (as text)
Sun Sep 27 08:39:22 2009 UTC (8 weeks, 4 days ago) by jerdiggity
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +3 -3 lines
File MIME type: text/x-php
#283156 (Fatal error when combined with i18n module)
Special thanks to jackmaninov, chris_five, havran & everyone else who shared their input.
1 <?php
2 // $Id: layout_nodes.inc,v 1.6 2007/02/28 14:13:27 gloscon Exp $
3 /**
4 * @file
5 * epublish_layout_indexed.inc
6 */
7
8 $description = 'node views';
9 $context = 'page';
10
11 /**
12 * theme_epublish_layout_nodes: A themeable function to produce a list of section topics and their nodes.
13 *
14 * @param $topics
15 * An array of topics returned from epublish_build_section3.
16 * @param $params
17 * An associative array of parameters. This exists so that the function
18 * can be themed to handle whatever value(s) the theme designer wants passed
19 * into the layout. For example, an image might be passed into the function
20 * using $params = ('image_path' => $url, 'image_width' => $width, 'image_height' => $height, 'caption' => $caption)
21 *
22 * @return
23 * An HTML-formatted list of nodes.
24 */
25 function theme_epublish_layout_nodes($topics, $params=NULL) {
26 if ($params['description']) {
27 $description = '<div class="description">'. $params['description'] .'</div>';
28 }
29 // The default assumption for this layout is that topics are NOT shown
30 if ($params['show_topics']) {
31 foreach ($topics as $topic) {
32 if (count($topic->nodes)) {
33 $subsection = epublish_get_section_by_title($topic->name);
34 if ($subsection->sid) {
35 $output .= '<div class="topic">'. l(t($topic->name), 'headlines/'. $subsection->sid) ."</div>\n";
36 }
37 else {
38 $output .= '<div class="topic">'. $topic->name ."</div>\n";
39 }
40 foreach ($topic->nodes as $nid) {
41 if (module_exists('i18n')) {
42 $lang = i18n_get_lang();
43 $transnids = translation_node_get_translations($nid);
44 if ($transnids[$lang]) {
45 $nid = $transnids[$lang]->nid;
46 }
47 }
48 $output .= node_view(node_load($nid), 1);
49 }
50 }
51 }
52 }
53 else {
54 foreach ($topics as $topic) {
55 foreach ($topic->nodes as $nid) {
56 if (module_exists('i18n')) {
57 $lang = i18n_get_lang();
58 $transnid = translation_node_nid($nid, $lang);
59 if ($transnid) {
60 $nid = $transnid; $transnid = '';
61 }
62 }
63 $output .= node_view(node_load($nid), 1);
64 }
65 }
66 }
67 return '<div class="epublish"><div class="nodes">'. $description . $output ."</div></div>";
68 }

  ViewVC Help
Powered by ViewVC 1.1.2