Exemplo n.º 1
0
 public function findallAction()
 {
     if ($value_id = $this->getRequest()->getParam('value_id')) {
         $rss_feed = new Rss_Model_Feed();
         $rss_feeds = $rss_feed->findAll(array('value_id' => $value_id), 'position ASC');
         $data = array();
         foreach ($rss_feeds as $rss_feed) {
             $news = $rss_feed->getNews();
             foreach ($news->getEntries() as $entry) {
                 $author = "";
                 $authors = array();
                 if ($entry->getAuthors()) {
                     foreach ($entry->getAuthors() as $author) {
                         $authors[] = $author["name"];
                     }
                     if (!empty($authors)) {
                         $author = implode(", ", $authors);
                     }
                 }
                 $feed_id = str_replace("/", "\$\$", base64_encode($entry->getEntryId()));
                 $data['collection'][] = array("url" => $this->getPath("rss/mobile_feed_view", array("value_id" => $value_id, "feed_id" => $feed_id)), "title" => $author ? $author : $entry->getTitle(), "subtitle" => $author ? html_entity_decode($entry->getTitle()) : html_entity_decode($entry->getShortDescription()), "picture" => $entry->getPicture());
             }
         }
         if (!empty($data['collection'][0]) and !empty($data['collection'][0]["picture"])) {
             $data["cover"] = $data['collection'][0];
             $data['collection'] = array_slice($data['collection'], 1, count($data['collection']) - 1);
         }
         $data['page_title'] = $this->getCurrentOptionValue()->getTabbarName();
         $this->_sendHtml($data);
     }
 }
Exemplo n.º 2
0
 public function findAction()
 {
     if ($value_id = $this->getRequest()->getParam('value_id') and $feed_id = $this->getRequest()->getParam('feed_id')) {
         $rss_feed = new Rss_Model_Feed();
         $rss_feeds = $rss_feed->findAll(array('value_id' => $value_id), 'position ASC');
         $data = array('feed' => array());
         $feed_id = base64_decode(str_replace("\$\$", "/", $feed_id));
         foreach ($rss_feeds as $rss_feed) {
             $option = $this->getCurrentOptionValue();
             $news = $rss_feed->getNews();
             foreach ($news->getEntries() as $entry) {
                 if ($feed_id == $entry->getEntryId()) {
                     $data = array("id" => base64_encode($entry->getEntryId()), "url" => $entry->getLink() ? $entry->getLink() : $entry->getEntryId(), "title" => $entry->getTitle(), "content" => $entry->getContent(), "image_url" => $entry->getPicture(), "updated_at" => $entry->getUpdatedAt(), "social_sharing_active" => $option->getSocialSharingIsActive());
                 }
             }
         }
         $this->_sendHtml($data);
     }
 }
Exemplo n.º 3
0
 public function deleteAction()
 {
     try {
         $id = $this->getRequest()->getParam('id');
         // Met à jour les positions des flux
         $rss = new Rss_Model_Feed();
         $rss->find($id)->delete();
         // Renvoie OK
         $html = array('success' => 1);
     } catch (Exception $e) {
         $html = array('message' => $e->getMessage(), 'message_button' => 1, 'message_loader' => 1);
     }
     $this->getLayout()->setHtml(Zend_Json::encode($html));
 }