| 1 |
<?php
|
| 2 |
// $Id: layout_list.inc,v 1.6 2007/02/28 14:13:27 gloscon Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* epublish_layout_regular.inc
|
| 7 |
*/
|
| 8 |
$description = 'simple list of headlines only';
|
| 9 |
$context = 'list';
|
| 10 |
|
| 11 |
/**
|
| 12 |
* theme_epublish_layout_list: A themeable function to show a simple list of headlines.
|
| 13 |
* This layout lists headlines only, and does not show topic names. The list layout is
|
| 14 |
* designed for use by epublish.module, which can use it to control the order in which
|
| 15 |
* headlines display in each edition of a publication.
|
| 16 |
*
|
| 17 |
* @param $topics
|
| 18 |
* An array of topics returned from epublish_build_section3.
|
| 19 |
* @param $params
|
| 20 |
* An associative array of parameters. This exists so that the function
|
| 21 |
* can be themed to handle whatever value(s) the theme designer wants passed
|
| 22 |
* into the layout. For example, an image might be passed into the function
|
| 23 |
* using $params = ('image_path' => $url, 'image_width' => $width, 'image_height' => $height, 'caption' => $caption)
|
| 24 |
*
|
| 25 |
* @return
|
| 26 |
* An HTML-formatted list of headlines.
|
| 27 |
*/
|
| 28 |
function theme_epublish_layout_list($topics, $params=NULL) {
|
| 29 |
if ($params['description']) {
|
| 30 |
$description = '<div class="description">'. $params['description'] .'</div>';
|
| 31 |
}
|
| 32 |
$output = '<div class="pub_list">'. $description .'<ul>';
|
| 33 |
foreach ($topics as $topic) {
|
| 34 |
foreach ($topic->nodes as $nid) {
|
| 35 |
if (module_exists('i18n')) {
|
| 36 |
$lang = i18n_get_lang();
|
| 37 |
$transnids = translation_node_get_translations($nid);
|
| 38 |
if ($transnids[$lang]) {
|
| 39 |
$nid = $transnids[$lang]->nid;
|
| 40 |
}
|
| 41 |
}
|
| 42 |
$node = node_load($nid);
|
| 43 |
$output .= "<li>" . l(t($node->title), "node/$nid");
|
| 44 |
if ($node->epublish_abstract) {
|
| 45 |
$output .= ': '. check_markup($node->epublish_abstract, $node->format);
|
| 46 |
}
|
| 47 |
$output .= "</li>\n";
|
| 48 |
}
|
| 49 |
}
|
| 50 |
$output .= "</ul></div>\n";
|
| 51 |
return $output;
|
| 52 |
}
|