Пример #1
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        ob_start();
        $areas = $this->group->areas();
        if (count($areas)) {
            ?>

<table class="table">
	<thead>
		<tr>
			<th class="span4"><h3><?php 
            echo HTML::anchor(Route::model($this->group), HTML::chars($this->group->name));
            ?>
</h3></th>
			<th class="span1"><?php 
            echo __('Topics');
            ?>
</th>
			<th class="span1"><?php 
            echo __('Posts');
            ?>
</th>
			<th class="span2"><?php 
            echo __('Latest post');
            ?>
</th>
		</tr>
	</thead>

	<tbody>

	<?php 
            foreach ($areas as $area) {
                ?>

		<?php 
                if (Permission::has($area, Model_Forum_Area::PERMISSION_READ, self::$_user)) {
                    ?>

		<tr>
			<td>
				<h4><?php 
                    echo HTML::anchor(Route::model($area), HTML::chars($area->name));
                    ?>
</h4>
				<?php 
                    echo $area->description;
                    ?>
			</td>
			<td><?php 
                    echo Num::format($area->topic_count, 0);
                    ?>
</td>
			<td><?php 
                    echo Num::format($area->post_count, 0);
                    ?>
</td>
			<td>

			<?php 
                    if ($area->topic_count > 0) {
                        $last_topic = $area->last_topic();
                        ?>

				<small class="ago"><?php 
                        echo HTML::time(Date::short_span($last_topic->last_posted, true, true), $last_topic->last_posted);
                        ?>
</small>
				<?php 
                        echo HTML::user($last_topic->last_post()->author_id, $last_topic->last_poster);
                        ?>
<br />
				<?php 
                        echo HTML::anchor(Route::model($last_topic), '<i class="muted iconic-upload"></i>', array('title' => __('First post')));
                        ?>
				<?php 
                        echo HTML::anchor(Route::model($last_topic, '?page=last#last'), HTML::chars($last_topic->name), array('title' => HTML::chars($last_topic->name)));
                        ?>

			<?php 
                    } else {
                        ?>

				<sup><?php 
                        echo __('No topics yet.');
                        ?>
</sup>

			<?php 
                    }
                    ?>

			</td>
		</tr>

		<?php 
                } elseif ($area->status != Model_Forum_Area::STATUS_HIDDEN) {
                    ?>

		<tr>
			<td colspan="4">
				<h4><?php 
                    echo HTML::chars($area->name);
                    ?>
</h4>
				<?php 
                    echo __('Members only');
                    ?>
			</td>
		</tr>

		<?php 
                }
                ?>

	<?php 
            }
            ?>

	</tbody>
</table>

<?php 
        } else {
            echo new View_Alert(__('No areas yet.'), null, View_Alert::INFO);
        }
        return ob_get_clean();
    }