Ejemplo n.º 1
0
Archivo: content.php Proyecto: cwcw/cms
function BlogOutput(&$rows, &$params, $gid, &$access, $pop, &$menu, $archive = NULL)
{
    global $mainframe, $Itemid, $task, $id, $option, $database, $mosConfig_live_site;
    // parameters
    if ($params->get('page_title', 1)) {
        $header = $params->def('header', $menu->name);
    } else {
        $header = '';
    }
    $columns = $params->def('columns', 2);
    if ($columns == 0) {
        $columns = 1;
    }
    $intro = $params->def('intro', 4);
    $leading = $params->def('leading', 1);
    $links = $params->def('link', 4);
    $pagination = $params->def('pagination', 2);
    $pagination_results = $params->def('pagination_results', 1);
    $pagination_results = $params->def('pagination_results', 1);
    $descrip = $params->def('description', 1);
    $descrip_image = $params->def('description_image', 1);
    // needed for back button for page
    $back = $params->get('back_button', $mainframe->getCfg('back_button'));
    // needed to disable back button for item
    $params->set('back_button', 0);
    $params->def('pageclass_sfx', '');
    $params->set('intro_only', 1);
    $total = count($rows);
    // pagination support
    $limitstart = intval(mosGetParam($_REQUEST, 'limitstart', 0));
    $limit = $intro + $leading + $links;
    if ($total <= $limit) {
        $limitstart = 0;
    }
    $i = $limitstart;
    // needed to reduce queries used by getItemid
    $ItemidCount['bs'] = $mainframe->getBlogSectionCount();
    $ItemidCount['bc'] = $mainframe->getBlogCategoryCount();
    $ItemidCount['gbs'] = $mainframe->getGlobalBlogSectionCount();
    // used to display section/catagory description text and images
    // currently not supported in Archives
    if ($menu->componentid && ($descrip || $descrip_image)) {
        switch ($menu->type) {
            case 'content_blog_section':
                $description = new mosSection($database);
                $description->load($menu->componentid);
                break;
            case 'content_blog_category':
                $description = new mosCategory($database);
                $description->load($menu->componentid);
                break;
            case 'content_blog_category':
            case 'components':
            default:
                $menu->componentid = 0;
                break;
        }
    }
    // Page Output
    // page header
    if ($header) {
        echo '<div class="componentheading' . $params->get('pageclass_sfx') . '">' . $header . '</div>';
    }
    if ($archive) {
        echo '<br />';
        echo mosHTML::monthSelectList('month', 'size="1" class="inputbox"', $params->get('month'));
        echo mosHTML::integerSelectList(2000, 2010, 1, 'year', 'size="1" class="inputbox"', $params->get('year'), "%04d");
        echo '<input type="submit" class="button" />';
    }
    // checks to see if there are there any items to display
    if ($total) {
        $col_with = 100 / $columns;
        // width of each column
        $width = 'width="' . $col_with . '%"';
        if ($archive) {
            // Search Success message
            $msg = sprintf(_ARCHIVE_SEARCH_SUCCESS, $params->get('month'), $params->get('year'));
            echo "<br /><br /><div align='center'>" . $msg . "</div><br /><br />";
        }
        echo '<table class="' . $params->get('pageclass_sfx') . '" cellpadding="0" cellspacing="0">';
        // Secrion/Category Description & Image
        if ($menu->componentid && ($descrip || $descrip_image)) {
            $link = $mosConfig_live_site . '/images/stories/' . $description->image;
            echo '<tr>';
            echo '<td valign="top">';
            if ($descrip_image) {
                echo '<img src="' . $link . '" align="' . $description->image_position . '" hspace="6" alt="" />';
            }
            if ($descrip) {
                echo $description->description;
            }
            echo '<br/><br/>';
            echo '</td>';
            echo '</tr>';
        }
        // Leading story output
        if ($leading) {
            echo '<tr>';
            echo '<td valign="top">';
            for ($z = 0; $z < $leading; $z++) {
                if ($i >= $total) {
                    // stops loop if total number of items is less than the number set to display as leading
                    break;
                }
                echo '<div>';
                show($rows[$i], $params, $gid, $access, $pop, $option, $ItemidCount);
                echo '</div>';
                $i++;
            }
            echo '</td>';
            echo '</tr>';
        }
        if ($intro && $i < $total) {
            echo '<tr>';
            echo '<td valign="top">';
            echo '<table width="100%"  cellpadding="0" cellspacing="0">';
            // intro story output
            for ($z = 0; $z < $intro; $z++) {
                if ($i >= $total) {
                    // stops loop if total number of items is less than the number set to display as intro + leading
                    break;
                }
                if (!($z % $columns) || $columns == 1) {
                    echo '<tr>';
                }
                echo '<td valign="top" ' . $width . '>';
                // outputs either intro or only a link
                if ($z < $intro) {
                    show($rows[$i], $params, $gid, $access, $pop, $option, $ItemidCount);
                } else {
                    echo '</td>';
                    echo '</tr>';
                    break;
                }
                echo '</td>';
                if (!(($z + 1) % $columns) || $columns == 1) {
                    echo '</tr>';
                }
                $i++;
            }
            // this is required to output a final closing </tr> tag when the number of items does not fully
            // fill the last row of output - a blank column is left
            if ($intro % $columns) {
                echo '</tr>';
            }
            echo '</table>';
            echo '</td>';
            echo '</tr>';
        }
        // Links output
        if ($links && $i < $total) {
            echo '<tr>';
            echo '<td valign="top">';
            echo '<div class="blog_more' . $params->get('pageclass_sfx') . '">';
            HTML_content::showLinks($rows, $links, $total, $i, 1, $ItemidCount);
            echo '</div>';
            echo '</td>';
            echo '</tr>';
        }
        // Pagination output
        if ($pagination) {
            if ($pagination == 2 && $total <= $limit) {
                // not visible when they is no 'other' pages to display
            } else {
                // get the total number of records
                $limitstart = $limitstart ? $limitstart : 0;
                require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php';
                $pageNav = new mosPageNav($total, $limitstart, $limit);
                if ($option == 'com_frontpage') {
                    $link = 'index.php?option=com_frontpage&amp;Itemid=' . $Itemid;
                } else {
                    if ($archive) {
                        $year = $params->get('year');
                        $month = $params->get('month');
                        $link = 'index.php?option=com_content&amp;task=' . $task . '&amp;id=' . $id . '&amp;Itemid=' . $Itemid . '&amp;year=' . $year . '&amp;month=' . $month;
                    } else {
                        $link = 'index.php?option=com_content&amp;task=' . $task . '&amp;id=' . $id . '&amp;Itemid=' . $Itemid;
                    }
                }
                echo '<tr>';
                echo '<td valign="top" align="center">';
                echo $pageNav->writePagesLinks($link);
                echo '<br /><br />';
                echo '</td>';
                echo '</tr>';
                if ($pagination_results) {
                    echo '<tr>';
                    echo '<td valign="top" align="center">';
                    echo $pageNav->writePagesCounter();
                    echo '</td>';
                    echo '</tr>';
                }
            }
        }
        echo '</table>';
    } else {
        if ($archive && !$total) {
            // Search Failure message for Archives
            $msg = sprintf(_ARCHIVE_SEARCH_FAILURE, $params->get('month'), $params->get('year'));
            echo '<br /><br /><div align="center">' . $msg . '</div><br />';
        } else {
            // Generic blog empty display
            echo _EMPTY_BLOG;
        }
    }
    // Back Button
    $params->set('back_button', $back);
    mosHTML::BackButton($params);
}
Ejemplo n.º 2
0
    function showBook($Itemid, $book, $verses, $limitstart, $pageNav)
    {
        global $Itemid, $my, $HTTP_SERVER_VARS;
        global $mosConfig_hideAuthor, $mosConfig_offset, $mosConfig_live_site;
        $link = sefRelToAbs("index.php?option=bible&amp;task=viewBook&amp;id=" . $book->ordering . "&amp;Itemid=" . $Itemid);
        $showNav = !strpos($HTTP_SERVER_VARS['PHP_SELF'], "index2.php");
        require_once $GLOBALS['mosConfig_absolute_path'] . '/includes/pageNavigation.php';
        if ($showNav) {
            $pageNav = new mosPageNav($book->qtdChapters, $limitstart, 1);
        }
        if ($sectionid != 0) {
            $id = $sectionid;
        }
        if (get_class($title) == 'mossection') {
            $catid = 0;
        } else {
            $catid = $title->id;
        }
        ?>
		<div class="contentheading">
			<span style="float: right" class="small">
				<?php 
        if ($showNav) {
            $chapters = array();
            for ($i = 0; $i < $book->qtdChapters; $i++) {
                $chapters[] = mosHTML::makeOption("{$i}", $i + 1);
            }
            // build the html select list
            $link = sefRelToAbs($link . '&amp;limitstart=\' + (this.options[selectedIndex].value) + \'');
            echo mosHTML::selectList($chapters, 'limitstart', 'class="inputbox" size="1" onchange="document.location.href=\'' . $link . '\';"', 'value', 'text', $limitstart);
        }
        ?>
			</span>
			<?php 
        echo $book->bookName . " " . ($limitstart + 1);
        ?>
</div>
		<table class="contentpaneopen">
		  <?php 
        if ($verses) {
            ?>
			  <tr>
			    <td>
				<table width="100%" border="0" cellspacing="0" cellpadding="3">
		        <?php 
            foreach ($verses as $row) {
                ?>
			        <tr><td valign='top'><i><a name='<?php 
                echo $row->verse;
                ?>
'><?php 
                echo $row->verse;
                ?>
</a></i></td><td><?php 
                echo $row->verseText;
                ?>
</td></tr>
			        <?php 
            }
            ?>
			      </table>
			    </td>
			  </tr>
	          <?php 
        }
        ?>
	    </table>
		<?php 
        if ($showNav) {
            ?>
			<div class="small">
				<span style="float: right">
					<?php 
            echo $pageNav->writePagesCounter();
            ?>
				</span>
				<?php 
            echo "\n<a href=\"" . sefRelToAbs("index.php?option=bible&amp;task=viewBooks&amp;Itemid=" . $Itemid) . "\" class=\"readon\">" . _BIBLE_SELECT_BOOK . "</a>";
            ?>
			</div>
			<div class="small" style="text-align: center;">
				<?php 
            if ($showNav) {
                echo $pageNav->writePagesLinks(sefRelToAbs("index.php?option=bible&amp;task=viewBook&amp;id=" . $book->ordering . "&amp;Itemid=" . $Itemid));
            }
            ?>
			</div>
			<?php 
        }
    }