コード例 #1
0
	/**
	 * @return Gpf_Data_RecordSet
	 */
	public function getAffiliateCampaigns() {
		$cTable = Pap_Db_Table_Commissions::getInstance();
		$rsCommissions = $cTable->getAllCommissionsInCampaign('', '');

		foreach ($this->campaigns as $campaign) {
			$status = $campaign->get(Pap_Db_Table_Campaigns::STATUS);
			if(!in_array($status, Pap_Affiliates_Promo_Campaigns::getCampaignAllowedStatuses())) {
				continue;
			}

			if ($cTable->findCampaignInCommExistsRecords($campaign->get($this->campaignIDColumnName), $rsCommissions)) {
				if ($this->isAffiliateInCampaign($campaign)) {
					$this->affiliateCampaigns->addRecord($campaign);
				}
			}
		}

		return $this->affiliateCampaigns;
	}
コード例 #2
0
	private function loadCampaigns() {
        $result = new Gpf_Data_RecordSet('id');

        $selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::ID, 'id');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::NAME, 'name');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::STATUS, 'status');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::DESCRIPTION, 'description');
        $selectBuilder->select->add(Pap_Db_Table_Campaigns::LOGO_URL, 'logourl');
        
        $selectBuilder->from->add(Pap_Db_Table_Campaigns::getName());
        
        $selectBuilder->where->add(Pap_Db_Table_Campaigns::STATUS, 'IN', Pap_Affiliates_Promo_Campaigns::getCampaignAllowedStatuses());

        $selectBuilder->orderBy->add(Pap_Db_Table_Campaigns::ORDER);
        
        $result->load($selectBuilder);
        return $result;
	}