当前位置: 首页>>代码示例>>PHP>>正文


PHP Admin_DA类代码示例

本文整理汇总了PHP中Admin_DA的典型用法代码示例。如果您正苦于以下问题:PHP Admin_DA类的具体用法?PHP Admin_DA怎么用?PHP Admin_DA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Admin_DA类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSpan

 /**
  * A method that can be inherited and used by children classes to get the
  * required date span of a statistics page.
  *
  * @param object $oCaller      The calling object. Expected to have the
  *                             the following class variables:
  *                                  $oCaller->aPlugins    - An array of statistics fields plugins
  *                                  $oCaller->oStartDate  - Will be set by method
  *                                  $oCaller->spanDays    - Will be set by method
  *                                  $oCaller->spanWeeks   - Will be set by method
  *                                  $oCaller->spanMonths  - Will be set by method
  * @param array  $aParams      An array of query parameters for
  *                             {@link Admin_DA::fromCache()}.
  */
 function getSpan(&$oCaller, $aParams)
 {
     $oStartDate = new Date(date('Y-m-d'));
     $oStartDate->setHour(0);
     $oStartDate->setMinute(0);
     $oStartDate->setSecond(0);
     // Check span using all plugins
     foreach ($oCaller->aPlugins as $oPlugin) {
         $aPluginParams = call_user_func(array($oPlugin, 'getHistorySpanParams'));
         $aSpan = Admin_DA::fromCache('getHistorySpan', $aParams + $aPluginParams);
         if (!empty($aSpan['start_date'])) {
             $oDate = new Date($aSpan['start_date']);
             $oDate->setTZbyID('UTC');
             if ($oDate->before($oStartDate)) {
                 $oDate->convertTZ($oStartDate->tz);
                 $oStartDate = new Date($oDate);
             }
         }
     }
     $oStartDate->setHour(0);
     $oStartDate->setMinute(0);
     $oStartDate->setSecond(0);
     $oNow = new Date();
     $oSpan = new Date_Span(new Date($oStartDate), new Date($oNow->format('%Y-%m-%d')));
     // Store the span data required for stats display
     $oCaller->oStartDate = $oStartDate;
     $oCaller->spanDays = (int) ceil($oSpan->toDays());
     $oCaller->spanWeeks = (int) ceil($oCaller->spanDays / 7) + ($oCaller->spanDays % 7 ? 1 : 0);
     $oCaller->spanMonths = ($oNow->getYear() - $oStartDate->getYear()) * 12 + ($oNow->getMonth() - $oStartDate->getMonth()) + 1;
     // Set the caller's aDates span in the event that it's empty
     if (empty($oCaller->aDates)) {
         $oCaller->aDates['day_begin'] = $oStartDate->format('%Y-%m-%d');
         $oCaller->aDates['day_end'] = $oNow->format('%Y-%m-%d');
     }
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:49,代码来源:History.php

示例2: beforePageHeader

 public function beforePageHeader(OX_Admin_UI_Event_EventContext $oEventContext)
 {
     $pageId = $oEventContext->data['pageId'];
     $pageData = $oEventContext->data['pageData'];
     $oHeaderModel = $oEventContext->data['headerModel'];
     $agencyId = $pageData['agencyid'];
     $campaignId = $pageData['campaignid'];
     $advertiserId = $pageData['clientid'];
     $oEntityHelper = $this->oMarkedTextAdvertiserComponent->getEntityHelper();
     if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         switch ($pageId) {
             case 'campaign-banners':
                 $oDalZones = OA_Dal::factoryDAL('zones');
                 $linkedWebsites = $oDalZones->getWebsitesAndZonesListByCategory($agencyId, null, $campaignId, true);
                 $arraylinkedWebsitesKeys = array_keys($linkedWebsites);
                 $linkedWebsitesKey = $arraylinkedWebsitesKeys[0];
                 $arraylinkedZonesKeys = array_keys($linkedWebsites[$linkedWebsitesKey]['zones']);
                 $zoneId = $arraylinkedZonesKeys[0];
                 $aZone = Admin_DA::getZone($zoneId);
                 if ($aZone['type'] == 3) {
                     if (OA_Permission::hasAccessToObject('clients', $clientid) && OA_Permission::hasAccessToObject('campaigns', $campaignid)) {
                         OX_Admin_Redirect::redirect('plugins/' . $this->oMarkedTextAdvertiserComponent->group . "/oxMarkedTextAdvertiser-index.php?campaignid={$campaignId}&clientid={$advertiserId}");
                     }
                 }
                 break;
         }
     }
 }
开发者ID:rcdesign-cemetery,项目名称:openx-markedtext,代码行数:28,代码来源:EntityScreenManager.php

示例3: getZones

 function getZones()
 {
     global $list_filters;
     if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
         $aParams = array();
         $aPublishers = Admin_DA::getPublishers($aParams);
         // set publisher id if list is to be filtered by publisher
         if (isset($list_filters['publisher'])) {
             $aParams = array('publisher_id' => $list_filters['publisher']);
         } else {
             // else use all publishers
             $aParams = array('publisher_id' => implode(',', array_keys($aPublishers)));
         }
         if (isset($this->_filter)) {
             $aParams['zone_inventory_forecast_type'] = $this->getForecastType();
         }
         $aZones = Admin_DA::getZones($aParams);
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $aParams = array('agency_id' => OA_Permission::getEntityId());
         $aPublishers = Admin_DA::getPublishers($aParams);
         // set publisher id if list is to be filtered by publisher
         if (isset($list_filters['publisher'])) {
             $aParams = array('publisher_id' => $list_filters['publisher']);
         } else {
             // else use all of this agency's publishers
             $aParams = array('publisher_id' => implode(',', array_keys($aPublishers)));
         }
         if (isset($this->_filter)) {
             $aParams['zone_inventory_forecast_type'] = $this->getForecastType();
         }
         $aZones = Admin_DA::getZones($aParams);
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $aParams = array('publisher_id' => OA_Permission::getEntityId());
         $aPublishers = Admin_DA::getPublishers($aParams);
         $aParams = array('publisher_id' => implode(',', array_keys($aPublishers)));
         if (isset($this->_filter)) {
             $aParams['zone_inventory_forecast_type'] = $this->getForecastType();
         }
         $aZones = Admin_DA::getZones($aParams);
     } else {
         $aPublishers = array();
         $aZones = array();
     }
     $aZoneArray = array();
     foreach ($aPublishers as $publisherId => $aPublisher) {
         foreach ($aZones as $zoneId => $aZone) {
             if ($aZone['publisher_id'] == $publisherId) {
                 $aZoneArray[$zoneId] = phpads_buildName($publisherId, MAX_getPublisherName($aPublisher['name'])) . " - " . phpAds_buildName($zoneId, MAX_getZoneName($aZone['name']));
             }
         }
     }
     return $aZoneArray;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:53,代码来源:ZoneIdField.php

示例4: display

 function display()
 {
     $aParams = array();
     if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $aParams['agency_id'] = OA_Permission::getEntityId();
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
         $aParams['advertiser_id'] = OA_Permission::getEntityId();
     } elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
         $aParams['publisher_id'] = OA_Permission::getEntityId();
     }
     $aPlacements = Admin_DA::getPlacements($aParams, true);
     $aPlacements = $this->multiSort($aPlacements, "name", true);
     echo "\n        <select name='{$this->_name}' tabindex='" . $this->_tabIndex++ . "'>";
     foreach ($aPlacements as $aPlacement) {
         $selected = $aPlacement['placement_id'] == $this->getValue() ? " selected='selected'" : '';
         $name = MAX_getPlacementName($aPlacement);
         echo "\n            <option value='{$aPlacement['placement_id']}'{$selected}>" . htmlspecialchars($name) . "</option>";
     }
     echo "\n        </select>";
 }
开发者ID:villos,项目名称:tree_admin,代码行数:20,代码来源:CampaignSelectionField.php

示例5: testFromCacheGetAdsStats

 function testFromCacheGetAdsStats()
 {
     $this->_generateStats();
     $res = Admin_DA::fromCache('getAdsStats', array('placement_id' => $this->campaignId));
     $this->assertTrue(is_array($res));
     $this->assertTrue(count($res));
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:7,代码来源:AdminDA.dal.test.php

示例6: getCampaignMap

function getCampaignMap($advertiserId)
{
    $aCampaigns = Admin_DA::getPlacements(array('advertiser_id' => $advertiserId));
    $aCampaignMap = array();
    foreach ($aCampaigns as $campaignId => $aCampaign) {
        $campaignName = $aCampaign['name'];
        // mask campaign name if anonymous campaign
        $campaign_details = Admin_DA::getPlacement($campaignId);
        $campaignName = MAX_getPlacementName($campaign_details);
        $aCampaignMap[$campaignId] = array('name' => $campaignName);
    }
    return $aCampaignMap;
}
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:13,代码来源:campaign-banners.php

示例7: mergeConversions


//.........这里部分代码省略.........
         $aGroupBy = array('day_and_hour');
     }
     $aFrom = array("{$conf['table']['prefix']}{$conf['table']['data_intermediate_ad_connection']} diac");
     $aWhere = array("diac.inside_window = 1");
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_APPROVED . " AND diac.connection_action = " . MAX_CONNECTION_AD_IMPRESSION . ",1,0)) AS sum_conversions_" . MAX_CONNECTION_AD_IMPRESSION;
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_APPROVED . " AND diac.connection_action = " . MAX_CONNECTION_AD_CLICK . ",1,0)) AS sum_conversions_" . MAX_CONNECTION_AD_CLICK;
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_APPROVED . " AND diac.connection_action = " . MAX_CONNECTION_AD_ARRIVAL . ",1,0)) AS sum_conversions_" . MAX_CONNECTION_AD_ARRIVAL;
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_APPROVED . " AND diac.connection_action = " . MAX_CONNECTION_MANUAL . ",1,0)) AS sum_conversions_" . MAX_CONNECTION_MANUAL;
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_APPROVED . ",1,0)) AS sum_conversions";
     $aFields[] = "SUM(IF(diac.connection_status = " . MAX_CONNECTION_STATUS_PENDING . ",1,0)) AS sum_conversions_pending";
     if (!empty($aParams['day_begin']) && !empty($aParams['day_end'])) {
         $oStartDate =& new Date("{$aParams['day_begin']} 00:00:00");
         $oEndDate =& new Date("{$aParams['day_end']} 23:59:59");
         $oStartDate->toUTC();
         $oEndDate->toUTC();
         $aWhere[] = "diac.tracker_date_time BETWEEN '" . $oStartDate->format('%Y-%m-%d %H:%M:%S') . "'" . " AND '" . $oEndDate->format('%Y-%m-%d %H:%M:%S') . "'";
     }
     if (!empty($aParams['agency_id'])) {
         $aFrom['b'] = "JOIN {$conf['table']['prefix']}{$conf['table']['banners']} b ON (b.bannerid = diac.ad_id)";
         $aFrom['m'] = "JOIN {$conf['table']['prefix']}{$conf['table']['campaigns']} m ON (m.campaignid = b.campaignid)";
         $aFrom['c'] = "JOIN {$conf['table']['prefix']}{$conf['table']['clients']} c ON (c.clientid = m.clientid)";
         $aFrom['z'] = "LEFT JOIN {$conf['table']['prefix']}{$conf['table']['zones']} z ON (z.zoneid = diac.zone_id)";
         $aFrom['p'] = "LEFT JOIN {$conf['table']['prefix']}{$conf['table']['affiliates']} p ON (p.affiliateid = z.affiliateid AND p.agencyid = '{$aParams['agency_id']}')";
         $aWhere[] = "c.agencyid = '{$aParams['agency_id']}'";
     }
     if (!empty($aParams['advertiser_id']) || isset($aParams['include']['advertiser_id'])) {
         $aFrom['b'] = "JOIN {$conf['table']['prefix']}{$conf['table']['banners']} b ON (b.bannerid = diac.ad_id)";
         $aFrom['m'] = "JOIN {$conf['table']['prefix']}{$conf['table']['campaigns']} m ON (m.campaignid = b.campaignid)";
         if (!empty($aParams['advertiser_id'])) {
             $aWhere[] = "m.clientid = '{$aParams['advertiser_id']}'";
         }
         if (isset($aParams['include']['advertiser_id']) && !isset($aParams['exclude']['advertiser_id'])) {
             $aFields[] = "m.clientid AS advertiser_id";
             $aGroupBy[] = "advertiser_id";
         }
     }
     if (!empty($aParams['placement_id']) || isset($aParams['include']['placement_id'])) {
         $aFrom['b'] = "JOIN {$conf['table']['prefix']}{$conf['table']['banners']} b ON (b.bannerid = diac.ad_id)";
         if (!empty($aParams['placement_id'])) {
             $aWhere[] = "b.campaignid = '{$aParams['placement_id']}'";
         }
         if (isset($aParams['include']['placement_id']) && !isset($aParams['exclude']['placement_id'])) {
             $aFields[] = "b.campaignid AS placement_id";
             $aGroupBy[] = "placement_id";
         }
     }
     if (!empty($aParams['publisher_id']) || isset($aParams['include']['publisher_id'])) {
         $aFrom['z'] = "JOIN {$conf['table']['prefix']}{$conf['table']['zones']} z ON (z.zoneid = diac.zone_id)";
         if (!empty($aParams['publisher_id'])) {
             $aWhere[] = "z.affiliateid = '{$aParams['publisher_id']}'";
         }
         if (isset($aParams['include']['publisher_id']) && !isset($aParams['exclude']['publisher_id'])) {
             $aFields[] = "z.affiliateid AS publisher_id";
             $aGroupBy[] = "publisher_id";
         }
     }
     if (!empty($aParams['ad_id'])) {
         $aWhere[] = "diac.ad_id = '{$aParams['ad_id']}'";
     }
     if (!isset($aParams['exclude']['ad_id'])) {
         $aFields[] = "diac.ad_id AS ad_id";
         $aGroupBy[] = "ad_id";
     }
     // Using isset: zone_id could be 0 in case of direct selection
     if (isset($aParams['zone_id'])) {
         $aWhere[] = "diac.zone_id = '{$aParams['zone_id']}'";
     }
     if (!isset($aParams['exclude']['zone_id'])) {
         $aFields[] = "diac.zone_id AS zone_id";
         $aGroupBy[] = "zone_id";
     }
     $sFields = count($aFields) ? join(', ', $aFields) : '';
     $sFrom = count($aFrom) ? join(' ', $aFrom) : '';
     $sWhere = count($aWhere) ? 'WHERE ' . join(' AND ', $aWhere) : '';
     $sGroupBy = count($aGroupBy) ? 'GROUP BY ' . join(', ', $aGroupBy) : '';
     $query = "SELECT " . $sFields . " FROM " . $sFrom . " " . $sWhere . " " . $sGroupBy;
     $oDbh = OA_DB::singleton();
     $key = $method == 'getEntitiesStats' ? 'pkey' : 'day_and_hour';
     $oRes = $oDbh->query($query);
     $aResult = array();
     if (!PEAR::isError($oRes)) {
         while ($row = $oRes->fetchRow()) {
             $aResult[$row[$key]] = $row;
             unset($aResult[$row[$key]][$key]);
         }
     }
     if ($method != 'getEntitiesStats') {
         $aResult = Admin_DA::_convertStatsArrayToTz($aResult, $aParams, null, $tzMethod, $tzArgs);
     }
     foreach ($aResult as $k => $row) {
         if (!isset($aRows[$k])) {
             $aRows[$k] = $emptyRow;
         }
         foreach ($row as $field => $value) {
             if (!isset($aRows[$k][$field])) {
                 $aRows[$k][$field] = $value;
             }
         }
     }
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:101,代码来源:Delivery.php

示例8: OA_Admin_Template

    }
}
/*-------------------------------------------------------*/
/* Main code                                             */
/*-------------------------------------------------------*/
require_once MAX_PATH . '/lib/OA/Admin/Template.php';
$oTpl = new OA_Admin_Template('campaign-index.html');
// Get clients & campaign and build the tree
$doCampaigns = OA_Dal::factoryDO('campaigns');
$doCampaigns->clientid = $clientid;
$doCampaigns->addListOrderBy($listorder, $orderdirection);
$doCampaigns->find();
while ($doCampaigns->fetch() && ($row_campaigns = $doCampaigns->toArray())) {
    $campaigns[$row_campaigns['campaignid']]['campaignid'] = $row_campaigns['campaignid'];
    // mask campaign name if anonymous campaign
    $campaign_details = Admin_DA::getPlacement($row_campaigns['campaignid']);
    $row_campaigns['campaignname'] = MAX_getPlacementName($campaign_details);
    $campaigns[$row_campaigns['campaignid']]['campaignname'] = $row_campaigns['campaignname'];
    $campaigns[$row_campaigns['campaignid']]['impressions'] = phpAds_formatNumber($row_campaigns['views']);
    $campaigns[$row_campaigns['campaignid']]['clicks'] = phpAds_formatNumber($row_campaigns['clicks']);
    $campaigns[$row_campaigns['campaignid']]['conversions'] = phpAds_formatNumber($row_campaigns['conversions']);
    if ($row_campaigns['activate'] && $row_campaigns['activate'] != '0000-00-00') {
        $oActivateDate =& new Date($row_campaigns['activate']);
        $campaigns[$row_campaigns['campaignid']]['activate'] = $oActivateDate->format($date_format);
    } else {
        $campaigns[$row_campaigns['campaignid']]['activate'] = '-';
    }
    if ($row_campaigns['activate'] && $row_campaigns['expire'] != '0000-00-00') {
        $oExpireDate =& new Date($row_campaigns['expire']);
        $campaigns[$row_campaigns['campaignid']]['expire'] = $oExpireDate->format($date_format);
    } else {
开发者ID:villos,项目名称:tree_admin,代码行数:31,代码来源:advertiser-campaigns.php

示例9: array

            $translated_message = $translation->translate($GLOBALS['strChannelAclHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, "channel-edit.php?" . (!empty($affiliateid) ? "affiliateid={$affiliateid}&" : "") . "channelid={$channelid}"), htmlspecialchars($doChannel->name)));
            OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
            // Redirect
            if (!empty($affiliateid)) {
                header("Location: channel-acl.php?affiliateid={$affiliateid}&channelid={$channelid}");
            } else {
                header("Location: channel-acl.php?channelid={$channelid}");
            }
            exit;
        }
    }
}
/*-------------------------------------------------------*/
/* HTML framework                                        */
/*-------------------------------------------------------*/
MAX_displayNavigationChannel($pageName, $aOtherChannels, $aEntities);
$aChannel = Admin_DA::getChannel($channelid);
if (!isset($acl)) {
    $acl = Admin_DA::getChannelLimitations(array('channel_id' => $channelid));
    // This array needs to be sorted by executionorder, this should ideally be done in SQL
    // When we move to DataObject this should be addressed
    ksort($acl);
}
if (!empty($affiliateid)) {
    $aParams = array('affiliateid' => $affiliateid, 'channelid' => $channelid);
} else {
    $aParams = array('agencyid' => $agencyId, 'channelid' => $channelid);
}
MAX_displayAcls($acl, $aParams);
echo "<br /><input type='submit' name='submit' value='{$GLOBALS['strSaveChanges']}' tabindex='" . $tabindex++ . "'></form>";
phpAds_PageFooter();
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:31,代码来源:channel-acl.php

示例10: _checkObjectsExist

 /**
  * Function check if advertiser or placement exists
  * if not: display proper error message
  * Error message contains link to:
  * - advertiser summary statistics if campaign does not exists
  * - stats.php if advertiser does not exists
  *
  * @param int $advertiserId Advertiser Id
  * @param int $placementId  Placement Id (Campaign Id)
  */
 function _checkObjectsExist($advertiserId, $placementId)
 {
     // Check if placement (campaign) exist
     if (0 == count(Admin_DA::getPlacements($this->coreParams + array('advertiser_id' => $advertiserId, 'placement_id' => $placementId)))) {
         phpAds_PageHeader('2');
         // Check if advertiser (clientid) exist
         if (0 == count(Admin_DA::getPlacements($this->coreParams + array('advertiser_id' => $advertiserId)))) {
             phpAds_Die($GLOBALS['strDeadLink'], str_replace('{link}', 'stats.php', $GLOBALS['strNoAdvertiser']));
         } else {
             $link = "stats.php?" . htmlspecialchars(preg_replace('#campaignid=[0-9]*&?#', '', $_SERVER['QUERY_STRING']), ENT_QUOTES);
             phpAds_Die($GLOBALS['strDeadLink'], str_replace('{link}', $link, $GLOBALS['strNoPlacement']));
         }
     }
 }
开发者ID:hostinger,项目名称:revive-adserver,代码行数:24,代码来源:CampaignHistory.php

示例11: displayPage

function displayPage($channel, $form)
{
    $pageName = basename($_SERVER['PHP_SELF']);
    $agencyId = OA_Permission::getAgencyId();
    // Obtain the needed data
    if (!empty($channel['affiliateid'])) {
        $aEntities = array('agencyid' => $agencyId, 'affiliateid' => $channel['affiliateid'], 'channelid' => $channel['channelid']);
        // Editing a channel at the publisher level; Only use the
        // channels at this publisher level for the navigation bar
        $aOtherChannels = Admin_DA::getChannels(array('publisher_id' => $channel['affiliateid']));
    } else {
        $aEntities = array('agencyid' => $agencyId, 'channelid' => $channel['channelid']);
        // Editing a channel at the agency level; Only use the
        // channels at this agency level for the navigation bar
        $aOtherChannels = Admin_DA::getChannels(array('agency_id' => $agencyId, 'channel_type' => 'agency'));
    }
    //show header and breadcrumbs
    MAX_displayNavigationChannel($pageName, $aOtherChannels, $aEntities);
    //get template and display form
    $oTpl = new OA_Admin_Template('channel-edit.html');
    $oTpl->assign('form', $form->serialize());
    $oTpl->assign('formId', $form->getId());
    $oTpl->display();
    //show footer
    phpAds_PageFooter();
}
开发者ID:villos,项目名称:tree_admin,代码行数:26,代码来源:channel-edit.php

示例12: displayPage

function displayPage($aZone, $form)
{
    $pageName = basename($_SERVER['SCRIPT_NAME']);
    $agencyId = OA_Permission::getAgencyId();
    $aEntities = array('affiliateid' => $aZone['affiliateid'], 'zoneid' => $aZone['zoneid']);
    $aOtherPublishers = Admin_DA::getPublishers(array('agency_id' => $agencyId));
    $aOtherZones = Admin_DA::getZones(array('publisher_id' => $aZone['affiliateid']));
    MAX_displayNavigationZone($pageName, $aOtherPublishers, $aOtherZones, $aEntities);
    //get template and display form
    $oTpl = new OA_Admin_Template('zone-advanced.html');
    $oTpl->assign('form', $form->serialize());
    $oTpl->display();
    _echoDeliveryCappingJs();
    //footer
    phpAds_PageFooter();
}
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:16,代码来源:zone-advanced.php

示例13: unlinkCampaign

 /**
  * A method to unlink a campaign from a zone
  *
  * @param int $zoneId
  * @param int $campaignId
  * @return bool
  */
 function unlinkCampaign($zoneId, $campaignId)
 {
     if ($this->checkIdExistence('zones', $zoneId) && $this->checkIdExistence('campaigns', $campaignId)) {
         $doZones = OA_Dal::staticGetDO('zones', $zoneId);
         if (!$this->checkPermissions(null, 'affiliates', $doZones->affiliateid, OA_PERM_ZONE_LINK)) {
             return false;
         }
         $result = Admin_DA::deletePlacementZones(array('zone_id' => $zoneId, 'placement_id' => $campaignId));
         if ($result === 0) {
             $this->raiseError('Unknown link for zoneId and campaignId Error');
             return false;
         } else {
             return $result;
         }
     }
     return false;
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:24,代码来源:Zone.php

示例14: getHistory

 /**
  * Fetch the history stats using the specified parameters
  *
  * @param array  $aParams Query parameters
  * @param string $link    Optional link for the leftmost column content
  */
 function getHistory($aParams, $link = '')
 {
     $oNow = new Date();
     $aParams['tz'] = $oNow->tz->getID();
     $method = $this->oHistory->setBreakdownInfo($this);
     // Add plugin aParams
     $pluginParams = array();
     foreach ($this->aPlugins as $oPlugin) {
         $oPlugin->addQueryParams($pluginParams);
     }
     $aStats = Admin_DA::fromCache($method, $aParams + $this->aDates + $pluginParams);
     // Merge plugin additional $oPlugin
     foreach ($this->aPlugins as $oPlugin) {
         $oPlugin->mergeData($aStats, $method, $aParams + $this->aDates, $this->aEmptyRow);
     }
     if (count($aStats) == 0) {
         $this->noStatsAvailable = true;
         return $aStats;
     }
     // Fill unused plugins columns
     foreach (array_keys($aStats) as $k) {
         $aStats[$k] += $this->aEmptyRow;
     }
     // Set some of the variables that used to be set by getSpan
     if (!empty($aStats)) {
         $dates = array_keys($aStats);
         // assumes first row has earliest date
         $firstDate = new Date($dates[0]);
         // Convert to current TZ
         $firstDate->setTZbyID('UTC');
         $firstDate->convertTZ($oNow->tz);
         $firstDate->setHour(0);
         $firstDate->setMinute(0);
         $firstDate->setSecond(0);
         if (empty($this->aDates)) {
             $this->aDates['day_begin'] = $firstDate->format('%Y-%m-%d');
             $this->aDates['day_end'] = $oNow->format('%Y-%m-%d');
         }
         $this->oStartDate = new Date($firstDate);
     }
     $aDates = $this->oHistory->getDatesArray($this->aDates, $this->statsBreakdown, $this->oStartDate);
     $this->oHistory->fillGapsAndLink($aStats, $aDates, $this, $link);
     if (!in_array($this->listOrderField, array_merge(array($this->statsBreakdown), array_keys($this->aColumns)))) {
         $this->listOrderField = $this->statsBreakdown;
         $this->listOrderDirection = $this->statsBreakdown == 'hour' || $this->statsBreakdown == 'dow' ? 'up' : 'down';
     }
     // If required, re-format the data in the weekly breakdown format
     if ($this->statsBreakdown == 'week') {
         $this->oHistory->prepareWeekBreakdown($aStats, $this);
     }
     MAX_sortArray($aStats, $this->listOrderField, $this->listOrderDirection == 'up');
     // Summarise the values into a the totals array, & format
     $this->_summariseTotalsAndFormat($aStats, true);
     return $aStats;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:61,代码来源:CommonHistory.php

示例15: _linkZonesToCampaignsBannersOrSingleBanner

 /**
  * Batch linking list of zones to campaign's banners or a specific banner
  * This is a sub-function of linkZonesToCampaigns and linkZonesToBanner.
  *
  * Banners are linked when:
  *  - text text banner and text zone (ignore width/height)
  *  - link non text banners when matching width/height to non text zone
  * Don't link banners to zone if that link already exists
  * Don't link Email zones
  *
  * @param array $aZonesIds array of zones IDs
  * @param int $campaignId  the campaign ID.
  * @param int $bannerId    the banner ID.
  * @return int number of linked banners
  */
 function _linkZonesToCampaignsBannersOrSingleBanner($aZonesIds, $campaignId, $bannerId = null)
 {
     $prefix = $this->getTablePrefix();
     $rsEmailZones = DBC::NewRecordSet("SELECT zoneid FROM {$prefix}zones WHERE delivery = " . MAX_ZoneEmail . " AND zoneid IN (" . implode(',', array_map('intval', $aZonesIds)) . ")");
     $aEmailZoneIds = $rsEmailZones->getAll();
     $fastLinking = !$GLOBALS['_MAX']['CONF']['audit']['enabledForZoneLinking'];
     $fromWhereClause = " FROM\n                {$prefix}banners AS b\n                CROSS JOIN\n                {$prefix}zones AS z\n                LEFT JOIN {$prefix}ad_zone_assoc AS aza ON (aza.ad_id = b.bannerid AND aza.zone_id = z.zoneid)\n            WHERE";
     if (!empty($campaignId)) {
         $fromWhereClause .= "\n                b.campaignid = " . DBC::makeLiteral($campaignId) . "\n                AND";
         foreach ($aEmailZoneIds as $zoneId) {
             $okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $campaignId);
             if (PEAR::isError($okToLink)) {
                 $aZonesIds = array_diff($aZonesIds, array($zoneId));
             }
         }
     }
     if (!empty($bannerId)) {
         $fromWhereClause .= "\n                b.bannerid = " . DBC::makeLiteral($bannerId) . "\n                AND";
         // Remove any zoneids which this banner cannot be linked to due to email zone restrictions
         foreach ($aEmailZoneIds as $zoneId) {
             $aAd = Admin_DA::getAd($bannerId);
             $okToLink = Admin_DA::_checkEmailZoneAdAssoc($zoneId, $aAd['placement_id']);
             if (PEAR::isError($okToLink)) {
                 $aZonesIds = array_diff($aZonesIds, array($zoneId));
             }
         }
     }
     $fromWhereClause .= "\n                z.zoneid IN (" . implode(",", array_map('intval', $aZonesIds)) . ")\n                AND\n                (\n                    (\n                        b.storagetype = 'txt'\n                        AND\n                        z.delivery = " . phpAds_ZoneText . "\n                    )\n                    OR\n                    (\n                        z.delivery <> " . phpAds_ZoneText . "\n                        AND\n                        b.storagetype <> 'txt'\n                        AND\n                        (\n                          (\n                            ( z.width = -1\n                              OR\n                              z.width = b.width\n                            )\n                            AND\n                            ( z.height = -1\n                              OR\n                              z.height = b. height\n                            )\n                          )\n                          OR\n                          (\n                            b.height = -1 AND b.width = -1\n                          )\n                        )\n                    )\n                )\n                AND\n                aza.ad_zone_assoc_id IS NULL\n        ";
     // if only one zone is selected and this zone is an email zone
     // we only link it if it was not previously linked to any banner (email zones can be linked to one banner only)
     if ($fastLinking) {
         $query = "INSERT INTO {$prefix}ad_zone_assoc (zone_id, ad_id, priority_factor)\n                SELECT z.zoneid, b.bannerid, 1\n                {$fromWhereClause}\n            ";
         return $this->oDbh->exec($query);
     } else {
         $query = "\n                SELECT z.zoneid AS zoneid,\n                       b.bannerid AS bannerid\n                {$fromWhereClause}\n            ";
         $rsAdZones = DBC::NewRecordSet($query);
         if (PEAR::isError($rsAdZones)) {
             return $rsAdZones;
         }
         $aAdZones = $rsAdZones->getAll();
         $doAdZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc');
         foreach ($aAdZones as $aAdZone) {
             $doAdZoneAssoc->zone_id = $aAdZone['zoneid'];
             $doAdZoneAssoc->ad_id = $aAdZone['bannerid'];
             $doAdZoneAssoc->priority_factor = 1;
             $doAdZoneAssoc->insert();
         }
         return count($aAdZones);
     }
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:65,代码来源:Zones.php


注:本文中的Admin_DA类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。