Пример #1
0
 public function executeFeed($request)
 {
     $feed_versions = array('Atom1', 'Rss091', 'Rss10', 'Rss201');
     $type = $request->getParameter('type');
     if (!$type || !in_array($type, $feed_versions)) {
         $type = 'Atom1';
     }
     $class = 'sf' . $type . 'Feed';
     $feed = new $class();
     if (!$request->getParameter('username')) {
         $pager = ReportPeer::findNewReports(1, 10, 'desc');
         $reports = $pager->getResults();
         $feed->setTitle('Google Volume - New Reports');
         $feed->setLink('http://www.googlevolume.com');
         $feed->setAuthorEmail('*****@*****.**');
         $feed->setAuthorName('Info');
         //$feedImage = new sfFeedImage();
         //$feedImage->setFavicon('http://www.googlevolume.com/favicon.ico');
         //$feed->setImage($feedImage);
         self::addToFeed($feed, $reports);
     } else {
         $username = $request->getParameter('username');
         $sfGuardUser = myUser::retrieveByUsername($username);
         $profile = $sfGuardUser->getsfGuardUserProfiles();
         $profile = $profile[0];
         $feed->setTitle('Google Volume - ' . $profile->getFirstName() . ' ' . $profile->getLastname() . '\'s New Reports');
         $feed->setLink('http://www.googlevolume.com');
         $feed->setAuthorEmail('*****@*****.**');
         $feed->setAuthorName('Info');
         $c = new Criteria();
         $c->add(ReportPeer::USER_ID, $sfGuardUser->getId());
         $c->add(ReportPeer::PUBLIC_RECORD, true);
         $c->addDescendingOrderByColumn(ReportPeer::CREATED_AT);
         $c->setLimit(10);
         self::addToFeed($feed, ReportPeer::doSelect($c));
     }
     $this->feed = $feed;
 }