Пример #1
0
    static function showPost($post, $options = null)
    {
        if (isset($options[self::SHORTEST]) && $options[self::SHORTEST]) {
            self::showShortPost($post);
            return;
        } else {
            if (isset($options[self::FLASH]) && $options[self::FLASH]) {
                self::showFlashPost($post, $options);
                return;
            } else {
                if (isset($options[self::VIDEO]) && $options[self::VIDEO]) {
                    self::showVideoPost($post);
                    return;
                } else {
                    if (isset($options[self::MOST_RECENT_MENU]) && $options[self::MOST_RECENT_MENU]) {
                        self::showMostRecentMenu($post, $options);
                        return;
                    } else {
                        if (isset($options[self::MOST_RECENT_CONTENT]) && $options[self::MOST_RECENT_CONTENT]) {
                            self::showMostRecentContent($post, $options);
                            return;
                        }
                    }
                }
            }
        }
        ?>
	<div class="post <?php 
        echo $post->getType();
        ?>
" id="post<?php 
        echo $post->getID();
        ?>
">
		<div class="pb_header"><?php 
        if (!isset($options[self::NO_DATE]) || !$options[self::NO_DATE]) {
            ?>
			<div class="post_creationDate"><?php 
            echo format_datetime($post->getCreationDate());
            ?>
</div><?php 
        }
        if (!isset($options[self::NO_CATEGORIES]) || !$options[self::NO_CATEGORIES]) {
            ?>
			<div class="post_categories"><?php 
            $first = true;
            $cats = explode(",", $post->getCategories());
            foreach ($cats as $cat) {
                if ($first) {
                    $first = false;
                } else {
                    echo ", ";
                }
                echo '<a href="' . FileManager::appendToRootPath('Category/' . trim(Filter::decodeFilteredText($cat))) . '">' . trim(Filter::decodeFilteredText($cat)) . '</a>';
            }
            ?>
</div><?php 
        }
        ?>
			<div class="clear"></div>
		</div>
		<div class="post_header">
			<div class="post_headline clear"><?php 
        echo Filter::decodeFilteredText($post->getHeadline());
        ?>
</div><?php 
        $title_class = "post_title";
        if (isset($options[self::SMALL_TITLE]) && $options[self::SMALL_TITLE]) {
            $title_class .= " small_title";
        }
        ?>
			<div class="<?php 
        echo $title_class;
        ?>
"><a href="<?php 
        echo FileManager::appendToRootPath($post->getPermalink());
        ?>
"><?php 
        echo Filter::decodeFilteredText($post->getTitle());
        ?>
</a></div>
			<div class="post_subtitle"><?php 
        echo Filter::decodeFilteredText($post->getSubtitle());
        ?>
</div>
		</div>
		<div class="post_content clear">
			<span id="post_place_<?php 
        echo $post->getID();
        ?>
" class="post_place"></span><?php 
        if (is_array($post->getContent())) {
            $first = true;
            foreach ($post->getContent() as $rsID) {
                if ($first) {
                    $first = false;
                } else {
                    echo " ";
                }
                //echo Filter::decodeFilteredText($cont);
                $cont = ResourceManager::loadResource($rsID);
                $path = FileManager::appendToRootPath($cont->getPath());
                $description = Filter::decodeFilteredText($cont->getDescription());
                echo "<a href='{$path}'><img src='" . $path . "' width='100' height='50' alt='" . $description . "' title='" . $description . "'></a>";
            }
        } else {
            if ($post->getType() == "videoreportage") {
                echo youtubeManager::getVideoPlayer($post->getContent());
            } else {
                //type=news
                echo Filter::decodeFilteredText($post->getContent());
                $rs_id = PostManager::getPostResource($post->getID());
                if ($rs_id) {
                    $photo = ResourceManager::loadResource($rs_id);
                    echo "<img src='" . FileManager::appendToRootPath($photo->getPath()) . "' />";
                }
            }
        }
        if (!is_null($post->getPlace())) {
            require_once "manager/MapManager.php";
            MapManager::printInfoInElement($post->getPlace(), "post_place_" . $post->getID());
        }
        $postdao = new PostDao();
        ?>
			<div class="post_authorname"><a href="<?php 
        echo FileManager::appendToRootPath("User/" . $postdao->getAuthorName($post));
        ?>
"><?php 
        echo $postdao->getAuthorName($post);
        ?>
</a></div>	
		</div>
		<div class="post_footer clear">
			<div class="post_vote">
				<div class="vote_image"><a href="<?php 
        echo FileManager::appendToRootPath($post->getPermalink() . "/Vote?vote=yes");
        ?>
">s&igrave;</a></div>
				<div class="vote_image"><a href="<?php 
        echo FileManager::appendToRootPath($post->getPermalink() . "/Vote?vote=no");
        ?>
">no</a></div>
				Voto: <?php 
        echo $post->getVote();
        ?>
			</div>
			<?php 
        if (!isset($options[self::NO_TAGS]) || !$options[self::NO_TAGS]) {
            if (!is_null($post->getTags()) && trim($post->getTags()) != "") {
                ?>
			<div class="post_tags">Tag: <?php 
                $first = true;
                $tags = explode(",", $post->getTags());
                foreach ($tags as $tag) {
                    if ($first) {
                        $first = false;
                    } else {
                        echo ", ";
                    }
                    echo '<a href="' . FileManager::appendToRootPath('Tag/' . trim(Filter::decodeFilteredText($tag))) . '">' . trim(Filter::decodeFilteredText($tag)) . '</a>';
                }
                ?>
</div><?php 
            }
        }
        if (!isset($options[self::NO_MODIF_DATE]) || !$options[self::NO_MODIF_DATE]) {
            ?>
			<div class="post_modificationDate">Ultima modifica: <?php 
            echo format_datetime($post->getModificationDate());
            ?>
</div><?php 
        }
        ?>
		</div><?php 
        if (!isset($options[self::NO_COMMENTS]) || !$options[self::NO_COMMENTS]) {
            self::showComments($post);
        }
        ?>
	</div>
<?php 
    }