X-Git-Url: http://git.inspyration.org/?p=zf2.biz%2Fgalerie.git;a=blobdiff_plain;f=module%2FGalerie%2Fsrc%2FGalerie%2FController%2FIndexController.php;h=c2bd5f71f7013c872bc78547f6253a0759b909f4;hp=fef7968acf41c52ef388443caa2f0810368da2af;hb=7054185396fe453db27a958653a70d76c1186c21;hpb=b9de62fff679629641c3b50ad3f3ff52df9abd60 diff --git a/module/Galerie/src/Galerie/Controller/IndexController.php b/module/Galerie/src/Galerie/Controller/IndexController.php index fef7968..c2bd5f7 100644 --- a/module/Galerie/src/Galerie/Controller/IndexController.php +++ b/module/Galerie/src/Galerie/Controller/IndexController.php @@ -12,6 +12,7 @@ use Zend\View\Renderer\PhpRenderer; use Zend\Session\Container; use Zend\Feed\Writer\FeedFactory; +use Zend\Feed\Reader\Reader as FeedReader; use Galerie\Model\Galerie; use Galerie\Graph\Test as TestPie; @@ -159,7 +160,12 @@ class IndexController extends AbstractActionController $entry = $rss->createEntry(); $entry->setTitle($d->name); - $entry->setLink($this->url()->fromRoute('galerie/view', array('id' => $d->id))); + $entry->setLink($this->url()->fromRoute( + 'galerie/view', + array('id' => $d->id)) + array('force_canonical' => true) + ); + $entry->addAuthor(array( 'name' => $d->username, )); @@ -214,6 +220,25 @@ class IndexController extends AbstractActionController return $response; } + + public function rsscheckAction() + { + $url = $this->url()->fromRoute('galerie/rss', array(), array('force_canonical' => true)); + $channel = FeedReader::import($url); + $title = $channel->getTitle(); + $author = $channel->getAuthor(); + $username = $author['name']; + $galeries = array(); + foreach ($channel as $item) { + $galeries[] = "{$item->getTitle()} : {$item->getDescription()}"; + } + + return new ViewModel(array( + 'title' => $title, + 'username' => $username, + 'galeries' => $galeries, + )); + } public function excelAction() {