Browse Source

- Fix Blog + convertit it to the template system

pull/16/head
Jaussoin Timothée 13 years ago
parent
commit
ca761d1389
  1. 48
      app/widgets/Blog/Blog.php

48
app/widgets/Blog/Blog.php

@ -2,33 +2,37 @@
class Blog extends WidgetCommon {
function WidgetLoad()
{
}
function build()
{
$from = $_GET['f'];
if($_GET['n'])
$node = $_GET['n'];
else
$_GET['n'] = false;
$node = $_GET['n'];
$this->view->assign('from', $from);
$this->view->assign('node', $node);
$pd = new \modl\PostnDAO();
$messages = $pd->getPublic($from, $node);
echo '
<div class="posthead spacetop">
<a
class="button color orange icon feed merged left"
href="'.Route::urlize('feed',array($from, false)).'"
target="_blank"
>
'.t('Feed').' (Atom)
</a>
</div>';
echo $this->preparePosts($messages, true);
if(isset($messages[0])) {
// Title and logo
// For a Pubsub feed
if(isset($from) && isset($node) && $node != '') {
$pd = new \modl\NodeDAO();
$n = $pd->getNode($from, $node);
if(isset($n->title))
$this->view->assign('title', $n->title);
else
$this->view->assign('title', $n->nodeid);
// Fir a simple contact
} else {
$this->view->assign('title', t("%s's feed",$messages[0]->getContact()->getTrueName()));
$this->view->assign('logo', $messages[0]->getContact()->getPhoto('l'));
}
$this->view->assign('date', date('c'));
$this->view->assign('name', $messages[0]->getContact()->getTrueName());
$this->view->assign('feed', Route::urlize('feed',array($from, $node)));
}
$this->view->assign('posts', $this->preparePosts($messages, true));
}
}
Loading…
Cancel
Save