index.php 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php require_once('header.php'); ?>
  2. <?php
  3. //$feeds = $feedManager->populate('name');
  4. $folders = $folderManager->populate('name');
  5. $currentFeed = false;
  6. if(isset($_GET['action'])){
  7. switch($_GET['action']){
  8. case 'readFeed':
  9. $currentFeed = $feedManager->getById($_GET['feed']);
  10. break;
  11. }
  12. }
  13. ?>
  14. <div id="main" class="wrapper clearfix">
  15. <aside>
  16. <h3 class="left">Flux</h3> <button style="margin: 20px 10px;" onclick="if(confirm('Tout marquer comme lu pour tous les flux?'))window.location='action.php?action=readAll'">Tout marquer comme lu</button>
  17. <ul class="clear">
  18. <?php foreach($folders as $folder){
  19. $feeds = $folder->getFeeds();
  20. ?>
  21. <li ><h1 class="folder" onclick="toggleFolder(this,<?php echo $folder->getId(); ?>);"><?php echo $folder->getName().' ('.count($feeds).')'; ?></h1>
  22. <ul <?php if(!$folder->getIsopen()){ ?>style="display:none;"<?php } ?> style="margin:0">
  23. <?php if (count($feeds)!=0 ) {foreach($feeds as $feed){ ?>
  24. <li><a href="index.php?action=readFeed&feed=<?php echo $feed->getId();?>" alt="<?php echo $feed->getUrl(); ?>" title="<?php echo $feed->getUrl(); ?>"><?php echo $feed->getName(); ?> <?php $unread = $feed->countUnreadEvents(); if($unread!=0){ ?></a> <button style="margin-left:10px;" onclick="if(confirm('Tout marquer comme lu pour ce flux?'))window.location='action.php?action=readAll&feed=<?php echo $feed->getId(); ?>'"><span alt="marquer comme lu" title="marquer comme lu"><?php echo $unread; ?></span></button><?php } ?> </li>
  25. <?php }} ?>
  26. </ul>
  27. </li>
  28. <?php } ?>
  29. </ul>
  30. </aside>
  31. <?php if($currentFeed !=false){
  32. $articleView = $configurationManager->get('articleView');
  33. $articlePerPages = $configurationManager->get('articlePerPages');
  34. $articleDisplayLink = $configurationManager->get('articleDisplayLink');
  35. $articleDisplayDate = $configurationManager->get('articleDisplayDate');
  36. $articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor');
  37. $numberOfFeed = $eventManager->rowCount(array('feed'=>$currentFeed->getId()));
  38. $page = (isset($_['page'])?$_['page']:1);
  39. $pages = round($numberOfFeed/$articlePerPages);
  40. $startArticle = ($page-1)*$articlePerPages;
  41. $events = $currentFeed->getEvents($startArticle,$articlePerPages,'id');
  42. ?>
  43. <article>
  44. <header>
  45. <h1><a target="_blank" href="<?php echo $currentFeed->getWebSite(); ?>"><?php echo $currentFeed->getName(); ?></a></h1>
  46. <p><?php echo $currentFeed->getDescription(); ?></p>
  47. </header>
  48. <?php
  49. foreach($events as $event){
  50. ?>
  51. <section <?php if(!$event->getUnread()){ ?>class="eventRead"<?php } ?> >
  52. <h2><a onclick="$(this).parent().parent().addClass('eventRead');" target="_blank" href="action.php?action=readContent&id=<?php echo $event->getId(); ?>" alt="Voir l'article sur le blog" title="Voir l'article sur le blog"><?php echo $event->getTitle(); ?></a></h2>
  53. <h3><?php if ($articleDisplayAuthor){ ?>Par <?php echo $event->getCreator(); } if ($articleDisplayLink){ ?> le <?php echo $event->getPubDate(); } if ($articleDisplayLink){ ?>- <a href="<?php echo $event->getGuid(); ?>" traget="_blank">Lien direct vers l'article</a><?php } ?>
  54. </h3>
  55. <p><?php if ($articleView=='partial'){echo $event->getDescription();}else{echo $event->getContent();} ?></p>
  56. <!--<a href="index.php?action=readFeedEvent&feed=<?php echo $feed->getId(); ?>&event=<?php echo $event->getId(); ?>">Lire la suite</a>-->
  57. </section>
  58. <?php } ?>
  59. <p>Page <?php echo $page; ?>/<?php echo $pages; ?> : <?php for($i=1;$i<$pages+1;$i++){ ?> <a href="index.php?action=readFeed&feed=<?php echo $currentFeed->getId(); ?>&page=<?php echo $i; ?>"><?php echo $i; ?></a> | <?php } ?> </p>
  60. </article>
  61. <?php } ?>
  62. </div> <!-- #main -->
  63. <?php require_once('footer.php'); ?>