Exemplo n.º 1
0
 public function executeIndex(sfWebRequest $request)
 {
     $this->step = sfConfig::get('app_max_activities_on_activitylist');
     $this->getUser()->syncParameters($this, 'activity', 'index', array('offset', 'limit', 'sort_column', 'sort_direction'), $request);
     if (is_null($this->sort_column)) {
         $this->sort_column = 'name';
         $this->sort_direction = 'up';
     }
     if (is_null($this->offset)) {
         $this->offset = 0;
     }
     if (is_null($this->limit) || $this->limit <= 0) {
         $this->limit = $this->step;
     }
     $c = new Criteria();
     SortCriteria::addSortCriteria($c, $this->sort_column, ActivityPeer::getSortAliases(), $this->sort_direction);
     $c->setOffset($this->offset);
     if ($this->limit >= 0) {
         $c->setLimit($this->limit);
     }
     $this->activity_list = ActivityPeer::doSelect($c);
     $this->count = ActivityPeer::doCount(new Criteria());
     if ($this->offset < 0 || $this->offset >= $this->count && $this->count > 0) {
         $this->forward404();
     }
 }
Exemplo n.º 2
0
 public function hasCapacityIssue()
 {
     if (is_null($this->getCapacity())) {
         return false;
     }
     $c = new Criteria();
     $c->add(ActivityPeer::MAXIMUM_OCCUPATION, $this->getCapacity(), Criteria::GREATER_THAN);
     $c->addJoin(ActivityPeer::ID, RoomHasActivityPeer::ACTIVITY_ID);
     $c->addAnd(RoomHasActivityPeer::ROOM_ID, $this->getId(), Criteria::EQUAL);
     return ActivityPeer::doCount($c) > 0;
 }
Exemplo n.º 3
0
 public function getActivitiesCount($c = null)
 {
     $c = ActivityPeer::getUsergroupActivityCriteria($this->getId(), $c);
     return ActivityPeer::doCount($c);
 }