|
|
|
@ -9,6 +9,7 @@ class Menu extends WidgetCommon |
|
|
|
function load() |
|
|
|
{ |
|
|
|
$this->registerEvent('post', 'onPost'); |
|
|
|
$this->registerEvent('pubsub_postpublish_handle', 'onPublish'); |
|
|
|
$this->addjs('menu.js'); |
|
|
|
} |
|
|
|
|
|
|
|
@ -22,7 +23,12 @@ class Menu extends WidgetCommon |
|
|
|
RPC::call('movim_fill', 'menu_refresh', $view->draw('_menu_refresh', true)); |
|
|
|
} |
|
|
|
|
|
|
|
function onPost($packet) |
|
|
|
function onPublish($packet) |
|
|
|
{ |
|
|
|
$this->onPost($packet, false); |
|
|
|
} |
|
|
|
|
|
|
|
function onPost($packet, $notify = true) |
|
|
|
{ |
|
|
|
$pd = new \Modl\PostnDAO; |
|
|
|
$count = $pd->getCountSince(Cache::c('since')); |
|
|
|
@ -39,9 +45,9 @@ class Menu extends WidgetCommon |
|
|
|
$title = $post->title; |
|
|
|
} |
|
|
|
|
|
|
|
Notification::append('news', $contact->getTrueName(), $title, $contact->getPhoto('s'), 2); |
|
|
|
if($notify) Notification::append('news', $contact->getTrueName(), $title, $contact->getPhoto('s'), 2); |
|
|
|
} else { |
|
|
|
Notification::append('news', $post->title, $post->node, null, 2); |
|
|
|
if($notify) Notification::append('news', $post->title, $post->node, null, 2); |
|
|
|
} |
|
|
|
|
|
|
|
$this->onStream($count); |
|
|
|
@ -97,14 +103,14 @@ class Menu extends WidgetCommon |
|
|
|
} |
|
|
|
|
|
|
|
function prepareList($type = 'all', $server = null, $node = null, $page = 0) { |
|
|
|
movim_log(__METHOD__); |
|
|
|
//movim_log(__METHOD__);
|
|
|
|
$view = $this->tpl(); |
|
|
|
$pd = new \Modl\PostnDAO; |
|
|
|
$count = $pd->getCountSince(Cache::c('since')); |
|
|
|
|
|
|
|
// getting newer, not older
|
|
|
|
movim_log($page); |
|
|
|
movim_log($page == ""); |
|
|
|
//movim_log($page);
|
|
|
|
//movim_log($page == "");
|
|
|
|
if($page == 0 || $page == ""){ |
|
|
|
$count = 0; |
|
|
|
Cache::c('since', date(DATE_ISO8601, strtotime($pd->getLastDate()))); |
|
|
|
@ -116,30 +122,30 @@ class Menu extends WidgetCommon |
|
|
|
case 'all' : |
|
|
|
$view->assign('history', $this->call('ajaxGetAll', $next)); |
|
|
|
$items = $pd->getAllPosts(false, $page * $this->_paging + $count, $this->_paging); |
|
|
|
movim_log(__LINE__); |
|
|
|
/*movim_log(__LINE__); |
|
|
|
movim_log(" ALL "); |
|
|
|
movim_log($page * $this->_paging + $count); |
|
|
|
movim_log($page * $this->_paging + $count);*/ |
|
|
|
break; |
|
|
|
case 'news' : |
|
|
|
$view->assign('history', $this->call('ajaxGetNews', $next)); |
|
|
|
$items = $pd->getNews($page * $this->_paging + $count, $this->_paging); |
|
|
|
movim_log(__LINE__); |
|
|
|
/*movim_log(__LINE__); |
|
|
|
movim_log(" NEWS "); |
|
|
|
movim_log($page * $this->_paging + $count); |
|
|
|
movim_log($page * $this->_paging + $count);*/ |
|
|
|
break; |
|
|
|
case 'feed' : |
|
|
|
$view->assign('history', $this->call('ajaxGetFeed', $next)); |
|
|
|
$items = $pd->getFeed($page * $this->_paging + $count, $this->_paging); |
|
|
|
movim_log(__LINE__); |
|
|
|
/*movim_log(__LINE__); |
|
|
|
movim_log(" FEED "); |
|
|
|
movim_log($page * $this->_paging + $count); |
|
|
|
movim_log($page * $this->_paging + $count);*/ |
|
|
|
break; |
|
|
|
case 'node' : |
|
|
|
$view->assign('history', $this->call('ajaxGetNode', '"'.$server.'"', '"'.$node.'"', $next)); |
|
|
|
$items = $pd->getNode($server, $node, $page * $this->_paging + $count, $this->_paging); |
|
|
|
movim_log(__LINE__); |
|
|
|
/*movim_log(__LINE__); |
|
|
|
movim_log(" NODE "); |
|
|
|
movim_log($page * $this->_paging + $count); |
|
|
|
movim_log($page * $this->_paging + $count);*/ |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
|