Пример #1
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     # Recently added
     $c = new Criteria();
     $c->addDescendingOrderByColumn(PluginPeer::CREATED_AT);
     $c->setLimit(6);
     $this->recent = PluginPeer::doSelect($c);
     # Most downloaded
     $c = new Criteria();
     $c->addDescendingOrderByColumn(PluginPeer::DOWNLOADS_COUNT);
     $c->setLimit(3);
     $this->hot = PluginPeer::doSelect($c);
     # Tags
     $c = new Criteria();
     $c->addDescendingOrderByColumn(TermPeer::COUNT);
     $c->setLimit(10);
     $this->terms = TermPeer::retrieveTags($c);
     # Authors
     $c = new Criteria();
     $c->addDescendingOrderByColumn(AuthorPeer::LOGGED_AT);
     $c->setLimit(6);
     // if ($this->getUser()->isAuthenticated())
     // 	$c->add(AuthorPeer::ID, $this->getUser()->getId(), Criteria::NOT_EQUAL);
     $this->authors = AuthorPeer::doSelect($c);
 }
Пример #2
0
 public function executeRecent(sfWebRequest $request)
 {
     $feed = $this->getFeed($request->getParameter('format'));
     $c = new Criteria();
     $c->addDescendingOrderByColumn(PluginPeer::CREATED_AT);
     $c->setLimit(20);
     $plugins = PluginPeer::doSelect($c);
     foreach ((array) $plugins as $plugin) {
         $item = new sfFeedItem();
         $item->setTitle($plugin->getTitle());
         $item->setLink('@plugin?slug=' . $plugin->getSlug());
         $item->setAuthorName($plugin->getAuthor()->getFullName());
         $item->setPubdate($plugin->getCreatedAt('U'));
         $item->setUniqueId($plugin->getSlug());
         $item->setContent($plugin->getDescription());
         $feed->addItem($item);
     }
     $this->feed = $feed;
 }
Пример #3
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(PluginPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(PluginPeer::DATABASE_NAME);
         $criteria->add(PluginPeer::ID, $pks, Criteria::IN);
         $objs = PluginPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #4
0
 public function executeView(sfWebRequest $request)
 {
     $this->author = AuthorPeer::retrieveByUsername($request->getParameter('username'));
     $this->forward404Unless($this->author);
     if ($this->author->getPluginsCount()) {
         $c = new Criteria();
         $c->addDescendingOrderByColumn(PluginPeer::DOWNLOADS_COUNT);
         $c->add(PluginPeer::AUTHOR_ID, $this->author->getId());
         $this->plugins = PluginPeer::doSelect($c);
     }
 }