コード例 #1
0
ファイル: side.html.php プロジェクト: anvnguyen/Goteo
 */
use Goteo\Library\Text, Goteo\Model\Blog\Post;
$blog = $this['blog'];
$list = array();
switch ($this['type']) {
    case 'posts':
        $title = Text::get('blog-side-last_posts');
        $items = Post::getAll($blog->id, 7);
        // enlace a la entrada
        foreach ($items as $item) {
            $list[] = '<a href="/blog/' . $item->id . '"> ' . Text::recorta($item->title, 100) . '</a>';
        }
        break;
    case 'tags':
        $title = Text::get('blog-side-tags');
        $items = Post\Tag::getList($blog->id);
        // enlace a la lista de entradas con filtro tag
        foreach ($items as $item) {
            if ($item->used > 0) {
                $list[] = '<a href="/blog/?tag=' . $item->id . '">' . $item->name . '</a>';
            }
        }
        break;
    case 'comments':
        $title = Text::get('blog-side-last_comments');
        $items = Post\Comment::getList($blog->id);
        // enlace a la entrada en la que ha comentado
        foreach ($items as $item) {
            $text = Text::recorta($item->text, 200);
            $list[] = "\n\t\t\t\t<div>\n\t\t\t\t\t<!--span class='avatar'><img src='/image/{$item->user}->avatar->id/50/50/1' alt='' /></span-->\n\t\t\t\t\t<span class='date'>{$item->date}</span>\n\t\t\t\t\t<div class='high-comment'>\n\t\t\t\t\t\t<strong><a href=\"/blog/{$item->post}\">{$item->user->name}</a></strong>\n\t\t\t\t\t\t<p>{$text}</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        }