| 1 |
<?php
|
| 2 |
// $Id: layout_one_two.inc,v 1.7 2007/02/28 14:13:27 gloscon Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* layout_one_two.inc.
|
| 7 |
*/
|
| 8 |
$description = 'one- and two-column';
|
| 9 |
$context = 'page';
|
| 10 |
|
| 11 |
/**
|
| 12 |
* theme_epublish_layout_one_two: A themeable function to produce a list of section topics and their headlines.
|
| 13 |
* This layout lists the first topic and its headlines in larger type, along with author bylines for each
|
| 14 |
* headline. Subsequent topics appear in smaller type in a two-column layout that shows headlines only.
|
| 15 |
*
|
| 16 |
* @param $section
|
| 17 |
* An array of topics, each of which is an object containing an attribute named "nodes" that is an array of node IDs
|
| 18 |
* @param $params
|
| 19 |
* An associative array of parameters. This exists so that the function
|
| 20 |
* can be themed to handle whatever value(s) the theme designer wants passed
|
| 21 |
* into the layout. For example, an image might be passed into the function
|
| 22 |
* using $params = ('image_path' => $url, 'image_width' => $width, 'image_height' => $height, 'caption' => $caption)
|
| 23 |
*
|
| 24 |
* @return
|
| 25 |
* An HTML-formatted list of headlines.
|
| 26 |
*/
|
| 27 |
function theme_epublish_layout_one_two($topics, $params=NULL) {
|
| 28 |
if ($params['description']) {
|
| 29 |
$description = '<div class="description">'. $params['description'] .'</div>';
|
| 30 |
}
|
| 31 |
$output = ' <div class="epublish"><div class="one_two">'."$description\n";
|
| 32 |
if ($topics) {
|
| 33 |
$topic = array_shift($topics);
|
| 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 .= '<div class="title">'. l(t($node->title), "node/$nid") ."</div>\n";
|
| 44 |
$output .= '<div class="user">'. t('By') .' '.'<span class="all_caps">'. $node->name ."</span></div>\n";
|
| 45 |
if ($node->epublish_abstract) {
|
| 46 |
$output .= '<div class="abstract">'. check_markup($node->epublish_abstract, $node->format) ."</div>\n";
|
| 47 |
}
|
| 48 |
}
|
| 49 |
$output .= "\n";
|
| 50 |
$output .= ' <div class="other_heads">
|
| 51 |
<table width="100%">
|
| 52 |
<tr>
|
| 53 |
<td width="50%" valign="top">'."\n";
|
| 54 |
$count = count($topics);
|
| 55 |
$position = 1;
|
| 56 |
foreach ($topics as $topic) {
|
| 57 |
if ($position * 2 > $count) {
|
| 58 |
$position = 0;
|
| 59 |
$output .= ' </td>
|
| 60 |
<td width="12"><img width="12" height="1"></td>
|
| 61 |
<td width="50%" valign="top">'."\n";
|
| 62 |
}
|
| 63 |
$position++;
|
| 64 |
$output .= ' <div class="topic">'. $topic->name ."</div>\n";
|
| 65 |
foreach ($topic->nodes as $nid) {
|
| 66 |
if (module_exists('i18n')) {
|
| 67 |
$lang = i18n_get_lang();
|
| 68 |
$transnid = translation_node_nid($nid, $lang);
|
| 69 |
if ($transnid) {
|
| 70 |
$nid = $transnid; $transnid = '';
|
| 71 |
}
|
| 72 |
}
|
| 73 |
$node = node_load($nid);
|
| 74 |
$output .= '<div class="topic_title">'. l(t($node->title), "node/$nid") ."</div>\n";
|
| 75 |
}
|
| 76 |
}
|
| 77 |
$output .= ' </td>
|
| 78 |
</tr>
|
| 79 |
</table>
|
| 80 |
</div>';
|
| 81 |
}
|
| 82 |
$output .= "</div></div>\n";
|
| 83 |
return $output;
|
| 84 |
}
|