| 1 |
<?php
|
| 2 |
// $Id: layout_regular.inc,v 1.6 2007/02/28 14:13:27 gloscon Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* epublish_layout_regular.inc
|
| 7 |
*/
|
| 8 |
$description = 'regular';
|
| 9 |
$context = 'page';
|
| 10 |
|
| 11 |
/**
|
| 12 |
* theme_epublish_layout_regular: A themeable function to produce a list of section topics and their nodes.
|
| 13 |
*
|
| 14 |
* @param $topics
|
| 15 |
* An array of topics
|
| 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 topics and their nodes.
|
| 24 |
*/
|
| 25 |
function theme_epublish_layout_regular($topics, $params=NULL) {
|
| 26 |
if ($params['description']) {
|
| 27 |
$description = '<div class="description">'. $params['description'] .'</div>';
|
| 28 |
}
|
| 29 |
foreach ($topics as $topic) {
|
| 30 |
if (count($topic->nodes)) {
|
| 31 |
$subsection = epublish_get_section_by_title($topic->name);
|
| 32 |
if ($subsection->sid) {
|
| 33 |
$output .= '<div class="topic">'. l(t($topic->name), "headlines/". $subsection->sid) ."</div>\n";
|
| 34 |
}
|
| 35 |
else {
|
| 36 |
$output .= '<div class="topic">'. $topic->name ."</div>\n";
|
| 37 |
}
|
| 38 |
foreach ($topic->nodes as $nid) {
|
| 39 |
if (module_exists('i18n')) {
|
| 40 |
$lang = i18n_get_lang();
|
| 41 |
$transnids = translation_node_get_translations($nid);
|
| 42 |
if ($transnids[$lang]) {
|
| 43 |
$nid = $transnids[$lang]->nid;
|
| 44 |
}
|
| 45 |
}
|
| 46 |
$node = node_load($nid);
|
| 47 |
$output .= '<div class="title">'. l(t($node->title), "node/$nid") ."</div>\n";
|
| 48 |
$output .= '<div class="user">'. t('by') .' '. l($node->name, "blog/". $node->uid) ."</div>\n";
|
| 49 |
if ($node->epublish_abstract) {
|
| 50 |
$output .= '<div class="abstract">'. check_markup($node->epublish_abstract, $node->format) ."</div>\n";
|
| 51 |
}
|
| 52 |
}
|
| 53 |
}
|
| 54 |
}
|
| 55 |
return '<div class="epublish"><div class="regular">'. $description . $output .'</div></div>';
|
| 56 |
}
|