| 1 |
<?php
|
| 2 |
// $Id: layout_indexed.inc,v 1.1 2007/02/28 14:25:05 gloscon Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* epublish_layout_indexed.inc
|
| 7 |
*/
|
| 8 |
|
| 9 |
|
| 10 |
$description = 'indexed';
|
| 11 |
$context = 'page';
|
| 12 |
|
| 13 |
/**
|
| 14 |
* theme_epublish_layout_indexed: A themeable function to produce a list of section topics and their nodes.
|
| 15 |
* An Table of content is displayed on top with abstract of each node following
|
| 16 |
* TOC grouped on topics.
|
| 17 |
* @param $topics
|
| 18 |
* An array of topics
|
| 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 topics and their nodes.
|
| 27 |
*/
|
| 28 |
function theme_epublish_layout_indexed($topics, $params=NULL) {
|
| 29 |
$o_index = "" ;
|
| 30 |
$o_detail = "" ;
|
| 31 |
$o_header = "" ;
|
| 32 |
$o_footer = "" ;
|
| 33 |
$o_advertisement = "" ;
|
| 34 |
$counter = 1 ;
|
| 35 |
// define class variables
|
| 36 |
$css_title = "epub-title";
|
| 37 |
$css_linktitle = "link-title" ;
|
| 38 |
$css_abstract = "abstract" ;
|
| 39 |
foreach ($topics as $topic) { // begin foreach (two)
|
| 40 |
if (count($topic->nodes)) {
|
| 41 |
$subsection = epublish_get_section_by_title($topic->name);
|
| 42 |
// Add topic to output string, ignore if topic is top or bottom one
|
| 43 |
if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ) {
|
| 44 |
// HTML Documentation comments
|
| 45 |
$o_index .= "<!-- BEGIN : ". t($topic->name) ." Links Section -->\n" ;
|
| 46 |
$o_detail .= "<!-- BEGIN : ". t($topic->name) ." Section -->\n" ;
|
| 47 |
if ($subsection->sid) {
|
| 48 |
if (arg(2)) {
|
| 49 |
$o_index .= '<div class="topic">'. l( $topic->name, "epublish/". arg(1) ."/". arg(2), array(), NULL, 'T'. $sid .'_'. $counter, FALSE, TRUE) ."</div>\n";
|
| 50 |
}
|
| 51 |
else {
|
| 52 |
$o_index .= '<div class="topic">'. l( $topic->name, "epublish/". arg(1), array(), NULL, 'T'. $sid .'_'. $counter, FALSE, TRUE) ."</div>\n";
|
| 53 |
}
|
| 54 |
$o_detail .= '<div class="topic">'. l(t($topic->name), "headlines/". $subsection->sid) .'<a name="T'. $sid .'_'. $counter .'"> </a>'."</div>\n";
|
| 55 |
}
|
| 56 |
else {
|
| 57 |
if (arg(2)) {
|
| 58 |
$o_index .= "<div class='topic'>". l( $topic->name, 'epublish/'. arg(1) .'/'. arg(2), array(), NULL, 'T'. $sid .'_'. $counter, FALSE, TRUE) ."</div>\n";
|
| 59 |
}
|
| 60 |
else {
|
| 61 |
$o_index .= '<div class="topic"> '. l( $topic->name, arg(0) ."/". arg(1), array(), NULL, "T". $sid .'_'. $counter, FALSE, TRUE) ."</div>\n";
|
| 62 |
}
|
| 63 |
$o_detail .= '<div class="topic"><a name="T'. $sid .'_'. $counter .'"> </a>'. $topic->name ."</div>\n";
|
| 64 |
}
|
| 65 |
}
|
| 66 |
// for translation
|
| 67 |
foreach ($topic->nodes as $nid) { // beigin of foreach (one)
|
| 68 |
if (module_exists('i18n')) {
|
| 69 |
$lang = i18n_get_lang();
|
| 70 |
$transnids = translation_node_get_translations($nid);
|
| 71 |
if ($transnids[$lang]) {
|
| 72 |
$nid = $transnids[$lang]->nid;
|
| 73 |
}
|
| 74 |
}
|
| 75 |
$node = node_load((array('nid' => $nid)));
|
| 76 |
// if it is not top or bottom topic add node title
|
| 77 |
if (($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98))) {
|
| 78 |
if (arg(2)) {
|
| 79 |
$o_index .= '<div class="'. $css_title .'"><span class="bullet">o </span>'. l($node->title, "epublish/". arg(1) ."/". arg(2), array(), NULL, 'N'. $sid .'_'. $counter, FALSE, TRUE) .'</div> ';
|
| 80 |
}
|
| 81 |
else {
|
| 82 |
$o_index .= '<div class="'. $css_title .'"><span class="bullet">o </span>'. l($node->title, arg(0) ."/". arg(1), array(), NULL, 'N'. $sid .'_'. $counter, FALSE, TRUE) .'</div> ';
|
| 83 |
}
|
| 84 |
$o_detail .= '<div class="'. $css_linktitle .' '. strtolower(preg_replace('|[^a-zA-Z0-9_]+|', '-', $topic->name) ) .'-'. $css_title .'"><span class="bullet">o </span>'. l(t($node->title), "node/$nid") .'<a name="N'. $sid .'_'. $counter .'"> </a>'."</div>\n" ;
|
| 85 |
}
|
| 86 |
// Now detail has got additional information
|
| 87 |
// Add Abstract
|
| 88 |
if ($node->epublish_abstract) {
|
| 89 |
if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98))) {
|
| 90 |
$o_detail .= '<div class="'. $css_abstract .'">'. check_markup($node->epublish_abstract .' <span class="morelink"> '. l("[more..]", "node/$nid") .' </span>', $node->format) ." </div>\n";
|
| 91 |
}
|
| 92 |
else {
|
| 93 |
// Footer
|
| 94 |
if ( ($topic->weight == 99) ) {
|
| 95 |
$o_footer .= '<div class="'. $css_abstract .'">'. check_markup($node->epublish_abstract, $node->format) ."</div>\n";
|
| 96 |
}
|
| 97 |
// Header
|
| 98 |
if ( $topic->weight == (-99)) {
|
| 99 |
$o_header .= '<div class="'. $css_abstract .'">'. check_markup($node->epublish_abstract, $node->format) ."</div>\n";
|
| 100 |
}
|
| 101 |
// Advertisement
|
| 102 |
if ( ($topic->weight == (-98)) ) {
|
| 103 |
$o_advertisement .= ''. check_markup($node->epublish_abstract, $node->format );
|
| 104 |
}
|
| 105 |
}
|
| 106 |
} // end of if for abstract
|
| 107 |
$counter++ ;
|
| 108 |
} // end of foreach statement (one)
|
| 109 |
}
|
| 110 |
if ( ($topic->weight != 99) && ($topic->weight != (-99)) && ($topic->weight != (-98)) ) {
|
| 111 |
$o_index .= "\n<!-- END : " . t($topic->name) ." Links Section -->\n" ;
|
| 112 |
$o_detail .= "\n<!-- END : ". t($topic->name) ." Section -->\n" ;
|
| 113 |
$o_detail .= '<div>'. l( "Top", arg(0) ."/". arg(1) ."/". arg(2), array(), NULL, '', FALSE, TRUE) .' </div>' ;
|
| 114 |
}
|
| 115 |
} //end of foreach (two)
|
| 116 |
|
| 117 |
if ( $o_advertisement ) {
|
| 118 |
$o_advertisement = '<div class="advertisement" >'. $o_advertisement ."</div>\n";
|
| 119 |
}
|
| 120 |
// Add a line after header if exists
|
| 121 |
if ( $o_header ) {
|
| 122 |
$o_header = $o_header .'<hr/>' ;
|
| 123 |
}
|
| 124 |
// Add a line before footer if exists
|
| 125 |
if ( $o_footer ) {
|
| 126 |
$o_footer = '<hr/>'. $o_footer ;
|
| 127 |
}
|
| 128 |
|
| 129 |
$output .= $o_header . $o_advertisement . $o_index . $o_detail . $o_footer ;
|
| 130 |
$output = '<div class="epublish">'.'<div class="regular">'. $description . $output .'</div>'.'</div>';
|
| 131 |
return $output ;
|
| 132 |
}
|