Esempio n. 1
0
File: shouts.php Progetto: anqh/anqh
    /**
     * Render content.
     *
     * @return  string
     */
    public function content()
    {
        $shouts = array();
        foreach (Model_Shout::find_latest($this->limit) as $shout) {
            $shouts[] = array('created' => $shout->created, 'user_id' => $shout->author_id, 'shout' => $shout->shout);
        }
        if ($shouts) {
            ob_start();
            ?>

<ul class="list-unstyled">

	<?php 
            foreach (array_reverse($shouts) as $shout) {
                ?>
	<li>
		<?php 
                echo HTML::time(Date::format('HHMM', $shout['created']), array('datetime' => $shout['created'], 'class' => 'muted'));
                ?>
		<?php 
                echo HTML::user($shout['user_id']);
                ?>
:
		<?php 
                echo Text::smileys(Text::auto_link_urls(HTML::chars($shout['shout'])));
                ?>
	</li>
	<?php 
            }
            ?>

</ul>

<?php 
            if ($this->_can_shout) {
                ?>
<form <?php 
                echo $this->aside ? 'class="ajaxify"' : '';
                ?>
 action="<?php 
                echo Route::url('shouts', array('action' => 'shout'));
                ?>
" method="post">
	<input class="form-control" type="text" name="shout" maxlength="300" placeholder="<?php 
                echo __('Shout, and ye shall be heard..');
                ?>
" />
	<?php 
                echo Form::CSRF();
                ?>
</form>
<?php 
            }
            return ob_get_clean();
        }
        return '';
    }