/** * A method to link a campaign to a zone * * @param int $zoneId * @param int $campaignId * @return bool */ function linkCampaign($zoneId, $campaignId) { if ($this->checkIdExistence('zones', $zoneId)) { $doZones = OA_Dal::staticGetDO('zones', $zoneId); if (!$this->checkPermissions(null, 'affiliates', $doZones->affiliateid, OA_PERM_ZONE_LINK)) { return false; } if ($this->checkIdExistence('campaigns', $campaignId)) { $aLinkedPlacements = Admin_DA::getPlacementZones(array('zone_id' => $zoneId), false, 'placement_id'); if (!isset($aLinkedPlacements[$campaignId])) { $result = Admin_DA::addPlacementZone(array('zone_id' => $zoneId, 'placement_id' => $campaignId)); if (PEAR::isError($result)) { $this->raiseError($result->getMessage()); return false; } MAX_addLinkedAdsToZone($zoneId, $campaignId); return true; } else { // Already linked return true; } } } return false; }
function MAX_duplicatePlacementZones($fromPlacementId, $toPlacementId) { $pAdZones = Admin_DA::getPlacementZones(array('placement_id' => $fromPlacementId), true, 'zone_id'); if (!empty($pAdZones)) { foreach ($pAdZones as $zoneId => $placementId) { Admin_DA::addPlacementZone(array('placement_id' => $toPlacementId, 'zone_id' => $zoneId), false); } } }
function testPlacementZones() { TestEnv::startTransaction(); $ret = Admin_DA::addPlacementZone(array('zone_id' => rand(1, 999), 'placement_id' => rand(1, 999))); $this->assertTrue(is_int($ret)); $this->assertTrue($ret > 0); $retVar = Admin_DA::getPlacementZones(array('placement_zone_assoc_id' => $ret)); $this->assertTrue(is_array($retVar[$ret])); TestEnv::rollbackTransaction(); }
Admin_DA::deletePlacementZones($aParameters); } else { Admin_DA::deleteAdZones($aParameters); } } else { // Remove this key, because it is already there and does not need to be added again. unset($aCurrent[$id]); } } } $addResult = true; if (!empty($aCurrent)) { foreach ($aCurrent as $id => $value) { $aVariables = array('zone_id' => $zoneId, $key => $id); if ($view == 'placement') { $addResult = Admin_DA::addPlacementZone($aVariables); } else { $addResult = Admin_DA::addAdZone($aVariables); } } } if (!$addResult) { Header("Location: zone-include.php?affiliateid={$publisherId}&zoneid={$zoneId}"); exit; } // Move on to the next page Header("Location: zone-probability.php?affiliateid={$publisherId}&zoneid={$zoneId}"); exit; } // Display initial parameters... $tabIndex = 1;