예제 #1
0
/**
 * recursive chapter output 
 * 
 * ... yeah :(
 *
 * @param Chapter $chapter 
 * @return string
 */
function outputChapter(Chapter $chapter, View $view)
{
    ?>
    <li class="chapter">
        <h2><?php 
    echo $chapter->getName();
    ?>
</h2>
    
        <?php 
    if (count($chapter->getChapters()) > 0) {
        ?>
        <ul class="chapters">

            <?php 
        foreach ($chapter->getChapters() as $subChapter) {
            ?>
            <?php 
            outputChapter($subChapter, $view);
            ?>
            <?php 
        }
        ?>
    
        </ul>
        <?php 
    }
    ?>

        <?php 
    if (count($chapter->getPages()) > 0) {
        ?>

        <ul class="pages">
            <?php 
        foreach ($chapter->getPages() as $page) {
            ?>
            <li>
                <a href="<?php 
            echo $view['router']->generate('book_page', array('path' => $page->getPath()));
            ?>
">
                    <?php 
            echo $page->getTitle();
            ?>
                </a>
            </li>
            <?php 
        }
        ?>
        </ul>

        <?php 
    }
    ?>
    </li>
<?php 
}
예제 #2
0
/**
 * recursive chapter output 
 * 
 * ... yeah :(
 *
 * @param Chapter $chapter 
 * @return string
 */
function outputChapter(Chapter $chapter)
{
    ?>
    <h1><?php 
    echo $chapter->getName();
    ?>
</h1>
    
    <?php 
    if (count($chapter->getChapters()) > 0) {
        ?>
    <ul class="chapters">

        <?php 
        foreach ($chapter->getChapters() as $subChapter) {
            ?>
        <?php 
            outputChapter($subChapter);
            ?>
        <?php 
        }
        ?>
    
    </ul>
    <?php 
    }
    ?>

    <?php 
    if (count($chapter->getPages()) > 0) {
        ?>

    <ul class="pages">
        <h2>Pagina's</h2>
        <?php 
        foreach ($chapter->getPages() as $page) {
            ?>
        <?php 
            echo $page->getParsedText();
            ?>
        <?php 
        }
        ?>
    
    </ul>

    <?php 
    }
}