Пример #1
0
    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);
        }
    }