本文整理汇总了PHP中OA_Permission::getEntityId方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission::getEntityId方法的具体用法?PHP OA_Permission::getEntityId怎么用?PHP OA_Permission::getEntityId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Permission
的用法示例。
在下文中一共展示了OA_Permission::getEntityId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mergeData
/**
* Merge aggregate stats with entity properties (name, children, etc)
*
* The overridden method also takes care to remove inactive entities
* and to enforce the anonymous properties when logged in as advertiser
* or publisher
*
* @param array Query parameters
* @param string Key name
* @return array Full entity stats with entity data
*/
function mergeData($aParams, $key)
{
$aEntitiesData = parent::mergeData($aParams, $key);
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) || OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
if (is_null($this->aAnonAdvertisers)) {
$this->aAnonAdvertisers = array();
$this->aAnonPlacements = array();
$aPlacements = Admin_DA::fromCache('getPlacements', array('placement_anonymous' => 't'));
foreach ($aPlacements as $placementId => $placement) {
$this->aAnonAdvertisers[$placement['advertiser_id']] = true;
$this->aAnonPlacements[$placementId] = true;
}
}
}
foreach (array_keys($aEntitiesData) as $entityId) {
if (!isset($this->data[$key][$entityId])) {
unset($aEntitiesData[$entityId]);
} elseif ($key == 'advertiser_id' && isset($this->aAnonAdvertisers[$entityId])) {
$aEntitiesData[$entityId]['hidden'] = true;
} elseif ($key == 'placement_id' && isset($this->aAnonPlacements[$entityId])) {
$aEntitiesData[$entityId]['hidden'] = true;
} elseif ($key == 'ad_id' && isset($this->aAnonPlacements[$aEntitiesData[$entityId]['placement_id']])) {
$aEntitiesData[$entityId]['hidden'] = true;
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
if (isset($aParams['placement_id'])) {
$aEntitiesData[$entityId]['hidden'] = isset($this->aAnonPlacements[$aParams['placement_id']]);
} else {
$aEntitiesData[$entityId]['hidden'] = isset($this->aAnonAdvertisers[OA_Permission::getEntityId()]);
}
}
}
return $aEntitiesData;
}
示例2: processBanners
function processBanners($commit = false)
{
$doBanners = OA_Dal::factoryDO('banners');
if (OA_INSTALLATION_STATUS === OA_INSTALLATION_STATUS_INSTALLED && OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$doBanners->addReferenceFilter('agency', $agencyId = OA_Permission::getEntityId());
}
$doBanners->find();
$different = 0;
$same = 0;
$errors = array();
while ($doBanners->fetch()) {
// Rebuild filename
if ($doBanners->storagetype == 'sql' || $doBanners->storagetype == 'web') {
$doBanners->imageurl = '';
}
$GLOBALS['_MAX']['bannerrebuild']['errors'] = false;
if ($commit) {
$doBannersClone = clone $doBanners;
$doBannersClone->update();
$newCache = $doBannersClone->htmlcache;
} else {
$newCache = phpAds_getBannerCache($doBanners->toArray());
}
if (empty($GLOBALS['_MAX']['bannerrebuild']['errors'])) {
if ($doBanners->htmlcache != $newCache && $doBanners->storagetype == 'html') {
$different++;
} else {
$same++;
}
} else {
$errors[] = $doBanners->toArray();
}
}
return array('errors' => $errors, 'different' => $different, 'same' => $same);
}
示例3: clearEntitiesInSession
private function clearEntitiesInSession()
{
global $session;
$clientid = $session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'];
unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid']);
if ($clientid) {
unset($session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['campaignid'][$clientid]);
}
phpAds_SessionDataStore();
}
示例4: 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;
}
示例5: getStats
function getStats()
{
// Set time zone to local
OA_setTimeZoneLocal();
$oEnd = new Date();
$oEnd->setHour(0);
$oEnd->setMinute(0);
$oEnd->setSecond(0);
$oEnd->toUTC();
$oStart = new Date($oEnd);
$oStart->subtractSpan(new Date_Span('7-0-0-0'));
$oStart->toUTC();
$doDsah = OA_Dal::factoryDO('data_summary_ad_hourly');
$doDsah->selectAdd();
$doDsah->selectAdd("DATE_FORMAT(date_time, '%Y-%m-%d') AS day");
$doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.impressions) AS total_impressions');
$doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.clicks) AS total_clicks');
$doDsah->whereAdd("date_time >= '" . $doDsah->escape($oStart->format('%Y-%m-%d %H:%M:%S')) . "'");
$doDsah->whereAdd("date_time < '" . $doDsah->escape($oEnd->format('%Y-%m-%d %H:%M:%S')) . "'");
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$doBanners = OA_Dal::factoryDO('banners');
$doCampaigns = OA_Dal::factoryDO('campaigns');
$doClients = OA_Dal::factoryDO('clients');
$doClients->agencyid = OA_Permission::getEntityId();
$doCampaigns->joinAdd($doClients);
$doBanners->joinAdd($doCampaigns);
$doBanners->selectAdd();
$doBanners->selectAdd("bannerid");
$doBanners->find();
$ad_ids = array();
while ($doBanners->fetch()) {
$ad_ids[] = $doBanners->bannerid;
}
if (empty($ad_ids)) {
return array();
}
$doDsah->whereAdd("ad_id IN (" . implode(",", $ad_ids) . ")");
}
$doDsah->groupBy('day');
$doDsah->orderBy('day');
$doDsah->find();
$aStats = array();
while ($doDsah->fetch()) {
$row = $doDsah->toArray();
$aStats[0][date('D', strtotime($row['day']))] = $row['total_impressions'];
$aStats[1][date('D', strtotime($row['day']))] = $row['total_clicks'];
}
return $aStats;
}
示例6: _getTrackerArray
function _getTrackerArray()
{
$conf = $GLOBALS['_MAX']['CONF'];
$where = "c.clientid = t.clientid";
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$where .= " AND c.agencyid = " . OA_Permission::getEntityId();
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$where .= " AND t.clientid = " . OA_Permission::getEntityId();
}
$query = "\n SELECT\n c.clientname AS client_name,\n c.clientid AS client_id,\n t.trackername AS tracker_name,\n t.trackerid AS tracker_id\n FROM\n {$conf['table']['trackers']} AS t,\n {$conf['table']['clients']} AS c\n WHERE\n {$where}\n ORDER BY\n c.clientname,t.trackername\n ";
$res = phpAds_dbQuery($query);
while ($row = phpAds_dbFetchArray($res)) {
$trackerArray[$row['tracker_id']] = "<span dir='" . $GLOBALS['phpAds_TextDirection'] . "'>[id" . $row['client_id'] . "] " . $row['client_name'] . " - [id" . $row['tracker_id'] . "] " . $row['tracker_name'] . "</span> ";
}
return $trackerArray;
}
示例7: _getPublisherArray
/**
* @todo Handle cases where user is not Admin, Agency or Advertiser
*/
function _getPublisherArray($orderBy = null)
{
$conf = $GLOBALS['_MAX']['CONF'];
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates'];
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates'] . " WHERE agencyid=" . OA_Permission::getEntityId();
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$query = "SELECT affiliateid,name" . " FROM " . $conf['table']['prefix'] . $conf['table']['affiliates'] . " WHERE affiliateid=" . OA_Permission::getEntityId();
}
$orderBy ? $query .= " ORDER BY {$orderBy} ASC" : 0;
$res = phpAds_dbQuery($query);
while ($row = phpAds_dbFetchArray($res)) {
$affiliateArray[$row['affiliateid']] = phpAds_buildAffiliateName($row['affiliateid'], $row['name']);
}
return $affiliateArray;
}
示例8: _getAdvertiserArray
function _getAdvertiserArray($orderBy = null)
{
$conf = $GLOBALS['_MAX']['CONF'];
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients'];
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients'] . " WHERE agencyid=" . OA_Permission::getEntityId();
} elseif (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$query = "SELECT clientid,clientname" . " FROM " . $conf['table']['prefix'] . $conf['table']['clients'] . " WHERE clientid=" . OA_Permission::getEntityId();
}
$orderBy ? $query .= " ORDER BY {$orderBy} ASC" : 0;
$oDbh = OA_DB::singleton();
$oRes = $oDbh->query($query);
while ($row = $oRes->fetchRow()) {
$clientArray[$row['clientid']] = phpAds_buildName($row['clientid'], $row['clientname']);
}
return $clientArray;
}
示例9: 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>";
}
示例10: setAdvertiserPageContext
/**
* Gets list of other advertisers and set a menu page context variable with them
* Can be easily reused across inventory->advertisers pages
*
* TODO: Consider reading page name from automatically instead of passing it as a parameter
*
* @static
* @param integer $clientid Advertiser ID
* @param string $pageName
* @param string $sortPageName
*/
function setAdvertiserPageContext($clientid, $pageName, $sortPageName = 'advertiser-index.php')
{
$doClients = OA_Dal::factoryDO('clients');
$doClients->agencyid = OA_Permission::getEntityId();
$doClients->addSessionListOrderBy($sortPageName);
$doClients->find();
while ($doClients->fetch()) {
phpAds_PageContext(phpAds_buildName($doClients->clientid, $doClients->clientname), "{$pageName}?clientid=" . $doClients->clientid, $clientid == $doClients->clientid);
}
}
示例11: MAX_checkZone
function MAX_checkZone($publisherId, $zoneId)
{
$allowed = false;
if (MAX_checkGenericId($publisherId) && MAX_checkGenericId($zoneId)) {
if (OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$allowed = count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$allowed = count(Admin_DA::getZones(array('agency_id' => OA_Permission::getAgencyId(), 'publisher_id' => $publisherId, 'zone_id' => $zoneId)));
} elseif (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$allowed = $publisherId == OA_Permission::getEntityId() && count(Admin_DA::getZones(array('publisher_id' => $publisherId, 'zone_id' => $zoneId)));
}
}
return $allowed;
}
示例12:
$affiliateid = OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER) ? OA_Permission::getEntityId() : '';
}
if (!isset($agencyid)) {
$agencyid = OA_Permission::isAccount(OA_ACCOUNT_ADMIN) ? '' : OA_Permission::getAgencyId();
}
if (!isset($bannerid)) {
$bannerid = '';
}
if (!isset($campaignid)) {
$campaignid = '';
}
if (!isset($channelid)) {
$channelid = '';
}
if (!isset($clientid)) {
$clientid = OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER) ? OA_Permission::getEntityId() : '';
}
if (!isset($day)) {
$day = '';
}
if (!isset($trackerid)) {
$trackerid = '';
}
if (!isset($userlogid)) {
$userlogid = '';
}
if (!isset($zoneid)) {
$zoneid = '';
}
/**
* Starts or continue existing session
示例13: phpAds_registerGlobal
require_once MAX_PATH . '/lib/max/other/html.php';
// Register input variables
phpAds_registerGlobal('action', 'variablemethod');
// Since there may be an unknown number of variables posted (which are accessed by $_POST directly in the code below),
// clean the whole $_POST array
MAX_commonRemoveSpecialChars($_POST);
/*-------------------------------------------------------*/
/* Affiliate interface security */
/*-------------------------------------------------------*/
OA_Permission::enforceAccount(OA_ACCOUNT_MANAGER);
OA_Permission::enforceAccessToObject('clients', $clientid);
OA_Permission::enforceAccessToObject('trackers', $trackerid);
/*-------------------------------------------------------*/
/* Store preferences */
/*-------------------------------------------------------*/
$session['prefs']['inventory_entities'][OA_Permission::getEntityId()]['clientid'] = $clientid;
phpAds_SessionDataStore();
/*-------------------------------------------------------*/
/* HTML framework */
/*-------------------------------------------------------*/
if (!isset($variables)) {
if (isset($session['prefs']['tracker-variables.php']['variables']) && $session['prefs']['tracker-variables.php']['trackerid'] == $trackerid) {
$variables = $session['prefs']['tracker-variables.php']['variables'];
}
}
if (!empty($trackerid)) {
// Get publisher list
$dalAffiliates = OA_Dal::factoryDAL('affiliates');
$rsAffiliates = $dalAffiliates->getPublishersByTracker($trackerid);
$rsAffiliates->find();
$publishers = array();
示例14: getAdvertiserMap
function getAdvertiserMap()
{
$aAdvertisers = array();
$dalClients = OA_Dal::factoryDAL('clients');
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$agency_id = OA_Permission::getEntityId();
$aAdvertisers = $dalClients->getAllAdvertisersForAgency($agency_id);
} else {
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$advertiserId = OA_Permission::getEntityId();
$aAdvertiser = $dalClients->getAdvertiserDetails($advertiserId);
$aAdvertisers[$advertiserId] = $aAdvertiser;
}
}
$aAdvertiserMap = array();
foreach ($aAdvertisers as $clientid => $aClient) {
$aAdvertiserMap[$clientid] = array('name' => $aClient['clientname'], 'url' => "advertiser-campaigns.php?clientid=" . $clientid);
}
return $aAdvertiserMap;
}
示例15: displayPage
function displayPage($bannerid, $campaignid, $clientid, $bannerTypes, $aBanner, $type, $form, $ext_bannertype, $formDisabled = false)
{
// Initialise some parameters
$pageName = basename($_SERVER['SCRIPT_NAME']);
$aEntities = array('clientid' => $clientid, 'campaignid' => $campaignid, 'bannerid' => $bannerid);
$entityId = OA_Permission::getEntityId();
if (OA_Permission::isAccount(OA_ACCOUNT_ADVERTISER)) {
$entityType = 'advertiser_id';
} else {
$entityType = 'agency_id';
}
// Display navigation
$aOtherCampaigns = Admin_DA::getPlacements(array($entityType => $entityId));
$aOtherBanners = Admin_DA::getAds(array('placement_id' => $campaignid), false);
// Display banner preview
MAX_displayNavigationBanner($pageName, $aOtherCampaigns, $aOtherBanners, $aEntities);
//actual page content - type chooser and form
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
$oTpl = new OA_Admin_Template('banner-edit.html');
$oTpl->assign('clientId', $clientid);
$oTpl->assign('campaignId', $campaignid);
$oTpl->assign('bannerId', $bannerid);
$oTpl->assign('bannerTypes', $bannerTypes);
$oTpl->assign('bannerType', $ext_bannertype ? $ext_bannertype : $type);
$oTpl->assign('bannerHeight', $aBanner["height"]);
$oTpl->assign('bannerWidth', $aBanner["width"]);
$oTpl->assign('disabled', $formDisabled);
$oTpl->assign('form', $form->serialize());
$oTpl->display();
/*********************************************************/
/* HTML framework */
/*********************************************************/
phpAds_PageFooter();
}