コード例 #1
0
ファイル: hovercard.php プロジェクト: anqh/anqh
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        // Title
        if ($this->area->description) {
            echo $this->area->description . '<hr>';
        }
        if ($this->area->topic_count) {
            // Area has topics
            $last_topic = $this->area->last_topic();
            $last_poster = $last_topic->last_post()->author();
            ?>

		<div class="media">
			<div class="pull-left">
				<?php 
            echo HTML::avatar($last_poster ? $last_poster['avatar'] : null, $last_poster ? $last_poster['username'] : null, false);
            ?>
			</div>
			<div class="media-body">
				<small class="ago"><?php 
            echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
            ?>
</small>
				<?php 
            echo $last_poster ? HTML::user($last_poster) : HTML::chars($last_topic->last_poster);
            ?>
				<br>
				<?php 
            echo HTML::anchor(Route::model($last_topic, '?page=last#last'), Forum::topic($last_topic), array('title' => HTML::chars($last_topic->name)));
            ?>
<br />
			</div>
		</div>

		<small class="stats muted">
			<i class="icon-comments"></i> <?php 
            echo Num::format($this->area->topic_count, 0);
            ?>
			<i class="icon-comment"></i> <?php 
            echo Num::format($this->area->post_count, 0);
            ?>
		</small>

<?php 
        } else {
            // Empty area
            echo __('No topics yet.');
        }
        return ob_get_clean();
    }