blob: da46de0e121cfd1454a64b38b62f6bfe1f8094ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<?php
function print_folder(OC_News_Folder $folder){
$tmpl_folder = new OCP\Template("news", "part.listfolder");
$tmpl_folder->assign('folder', $folder);
$tmpl_folder->printpage();
$children = $folder->getChildren();
foreach($children as $child) {
if ($child instanceOf OC_News_Folder){
print_folder($child);
}
elseif ($child instanceOf OC_News_Feed) { //onhover $(element).attr('id', 'newID');
$itemmapper = new OC_News_ItemMapper();
$items = $itemmapper->findAll($child->getId());
$counter = 0;
foreach($items as $item) {
if(!$item->isRead())
++$counter;
}
$tmpl_feed = new OCP\Template("news", "part.listfeed");
$tmpl_feed->assign('child', $child);
$tmpl_feed->assign('unreadItems',$counter);
$tmpl_feed->printpage();
}
else {
//TODO:handle error in this case
}
}
echo '</ul></div></li></ul>';
}
$allfeeds = isset($_['allfeeds']) ? $_['allfeeds'] : '';
print_folder($allfeeds);
?>
|