Exemplo n.º 1
0
 /**
  * Returt Top 5 Authors by Period and category
  *
  * @param Period $period
  * @param int $category_id
  * @return Doctrine_Collection
  */
 public function getTopAuthors(Period $period = null, $iCategoryId = 0)
 {
     if ($iCategoryId == 0) {
         $q = UserTable::addPUserQuery();
         $q = UserTable::addActiveQuery($q);
         $q->andWhere($q->getRootAlias() . '.sells > ?', 0)->orderBy($q->getRootAlias() . '.sells DESC');
     } else {
         $q = Doctrine_Query::create()->select('u.*, sum(c.purchase_cnt) as sells')->from('User u')->innerJoin('u.Content c')->groupBy('c.id_user')->orderBy('u.sells')->where('c.id_category=?', $iCategoryId)->andWhere('sells > ?', 0);
         $q = UserTable::addPUserQuery($q);
         $q = UserTable::addActiveQuery($q);
     }
     $q->limit(5);
     return $q->execute();
 }
Exemplo n.º 2
0
 /**
  * Enter description here...
  *
  * @return <Doctrine_Collection>
  */
 public static function getPUsersActive()
 {
     $q = UserTable::addPUserQuery();
     $q = UserTable::addActiveQuery($q);
     return $q->execute();
 }