function parseRotatorBannerDescription() { $row = new Pap_Db_BannerInRotator(); $row->setParentBannerId($this->getId()); $select = new Gpf_SqlBuilder_SelectBuilder(); $select->select->addAll(Pap_Db_Table_BannersInRotators::getInstance()); $select->from->add(Pap_Db_Table_BannersInRotators::getName()); $select->where->add(Pap_Db_Table_BannersInRotators::PARENT_BANNER_ID,'=',$this->getId()); $dateCondition = new Gpf_SqlBuilder_CompoundWhereCondition(); $dateCondition->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'=',null,'OR',false); $dateCondition->add(Pap_Db_Table_BannersInRotators::VALID_UNTIL,'>',date(self::DATETIME_FORMAT),'OR'); $select->where->addCondition($dateCondition,'AND'); foreach ($select->getAllRows() as $row){ $this->rotatedBanners[] = $row; $this->maxRank+=$row->get(Pap_Db_Table_BannersInRotators::RANK); } }
protected function getBannerInRotatorCollection($id){ $bannerInRotator = new Pap_Db_BannerInRotator(); $bannerInRotator->setRotatedBannerId($id); $bannerInRotator->setParentBannerId($this->form->getFieldValue(Pap_Db_Table_BannersInRotators::PARENT_BANNER_ID)); return $bannerInRotator->loadCollection(array(Pap_Db_Table_BannersInRotators::ROTATED_BANNER_ID,Pap_Db_Table_BannersInRotators::PARENT_BANNER_ID)); }