本文整理汇总了PHP中OA_Permission::getAgencyId方法的典型用法代码示例。如果您正苦于以下问题:PHP OA_Permission::getAgencyId方法的具体用法?PHP OA_Permission::getAgencyId怎么用?PHP OA_Permission::getAgencyId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OA_Permission
的用法示例。
在下文中一共展示了OA_Permission::getAgencyId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWebsitesAndZonesByAgencyId
function getWebsitesAndZonesByAgencyId($agencyId = null)
{
if (is_null($agencyId)) {
$agencyId = OA_Permission::getAgencyId();
}
$prefix = $this->getTablePrefix();
$oDbh = OA_DB::singleton();
$tableW = $oDbh->quoteIdentifier($prefix . $this->table, true);
$tableZ = $oDbh->quoteIdentifier($prefix . 'zones', true);
// Select out websites only first (to ensure websites with no zones are included in the list)
$aWebsitesAndZones = array();
$query = "\n SELECT\n w.affiliateid AS website_id,\n w.website AS website_url,\n w.name AS website_name\n FROM\n {$tableW} AS w\n WHERE\n w.agencyid = " . DBC::makeLiteral($agencyId) . "\n ORDER BY w.name";
$rsAffiliates = DBC::NewRecordSet($query);
$rsAffiliates->find();
while ($rsAffiliates->fetch()) {
$aWebsiteZone = $rsAffiliates->toArray();
$aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'] = array();
}
$query = "\n SELECT\n w.affiliateid AS website_id,\n w.website AS website_url,\n w.name AS website_name,\n z.zoneid AS zone_id,\n z.zonename AS zone_name,\n z.width AS zone_width,\n z.height AS zone_height\n FROM\n {$tableW} AS w,\n {$tableZ} AS z\n WHERE\n z.affiliateid = w.affiliateid\n AND w.agencyid = " . DBC::makeLiteral($agencyId) . "\n ORDER BY w.name";
$rsAffiliatesAndZones = DBC::NewRecordSet($query);
$rsAffiliatesAndZones->find();
while ($rsAffiliatesAndZones->fetch()) {
$aWebsiteZone = $rsAffiliatesAndZones->toArray();
$aWebsitesAndZones[$aWebsiteZone['website_id']]['name'] = $aWebsiteZone['website_name'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['url'] = $aWebsiteZone['website_url'];
$aWebsitesAndZones[$aWebsiteZone['website_id']]['zones'][$aWebsiteZone['zone_id']] = array('name' => $aWebsiteZone['zone_name'], 'width' => $aWebsiteZone['zone_width'], 'height' => $aWebsiteZone['zone_height']);
}
return $aWebsitesAndZones;
}
示例2: getAgencyDetails
function getAgencyDetails($agencyId = null)
{
if (is_null($agencyId)) {
$agencyId = OA_Permission::getAgencyId();
}
$doAgency =& OA_Dal::factoryDO('agency');
$doAgency->get($agencyId);
$aResult = $doAgency->toArray();
return $aResult;
}
示例3: setDefaultForAdd
/**
* This method sets all default values when adding a new channel.
*
*/
function setDefaultForAdd()
{
if (empty($this->agencyId)) {
$this->agencyId = OA_Permission::getAgencyId();
}
if (empty($this->websiteId)) {
// Set it to 'global'
$this->websiteId = 0;
}
}
示例4: start
/**
* The final "child" implementation of the parental abstract method.
*
* @see OA_Admin_Statistics_Common::start()
*/
function start()
{
// Get the preferences
$aPref = $GLOBALS['_MAX']['PREF'];
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER);
// HTML Framework
$this->pageId = '2.4';
$this->aPageSections = array('2.1', '2.4', '2.2');
$this->hideInactive = MAX_getStoredValue('hideinactive', $aPref['ui_hide_inactive'] == true, null, true);
$this->showHideInactive = true;
$this->startLevel = MAX_getStoredValue('startlevel', 0, null, true);
// Init nodes
$this->aNodes = MAX_getStoredArray('nodes', array());
$expand = MAX_getValue('expand', '');
$collapse = MAX_getValue('collapse');
// Adjust which nodes are opened closed...
MAX_adjustNodes($this->aNodes, $expand, $collapse);
$aParams = $this->coreParams;
if (!OA_Permission::isAccount(OA_ACCOUNT_ADMIN)) {
$aParams['agency_id'] = OA_Permission::getAgencyId();
}
// Add module page parameters
$this->aPageParams['period_preset'] = MAX_getStoredValue('period_preset', 'today');
$this->aPageParams['statsBreakdown'] = htmlspecialchars(MAX_getStoredValue('statsBreakdown', 'day'));
$this->_loadParams();
switch ($this->startLevel) {
case 1:
$this->aEntitiesData = $this->getZones($aParams, $this->startLevel, $expand);
break;
default:
$this->startLevel = 0;
$this->aEntitiesData = $this->getPublishers($aParams, $this->startLevel, $expand);
break;
}
// Summarise the values into a the totals array, & format
$this->_summariseTotalsAndFormat($this->aEntitiesData);
$this->showHideLevels = array();
switch ($this->startLevel) {
case 1:
$this->showHideLevels = array(0 => array('text' => $GLOBALS['strShowParentAffiliates'], 'icon' => 'images/icon-affiliate.gif'));
$this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveZonesHidden']}";
break;
case 0:
$this->showHideLevels = array(1 => array('text' => $GLOBALS['strHideParentAffiliates'], 'icon' => 'images/icon-affiliate-d.gif'));
$this->hiddenEntitiesText = "{$this->hiddenEntities} {$GLOBALS['strInactiveAffiliatesHidden']}";
break;
}
// Save prefs
$this->aPagePrefs['startlevel'] = $this->startLevel;
$this->aPagePrefs['nodes'] = implode(",", $this->aNodes);
$this->aPagePrefs['hideinactive'] = $this->hideInactive;
$this->aPagePrefs['startlevel'] = $this->startLevel;
}
示例5: createTemplateWithModel
public static function createTemplateWithModel($panel, $single = true)
{
$agencyId = OA_Permission::getAgencyId();
$oDalZones = OA_Dal::factoryDAL('zones');
$infix = $single ? '' : '-' . $panel;
phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "text{$infix}", "page{$infix}");
$campaignId = $GLOBALS['campaignid'];
$text = $GLOBALS["text{$infix}"];
$linked = $panel == 'linked';
$showStats = empty($GLOBALS['_MAX']['CONF']['ui']['zoneLinkingStatistics']) ? false : true;
$websites = $oDalZones->getWebsitesAndZonesList($agencyId, $campaignId, $linked, $text);
$matchingZones = 0;
foreach ($websites as $aWebsite) {
$matchingZones += count($aWebsite['zones']);
}
$aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $matchingZones);
$pagerFileName = 'campaign-zone-zones.php';
$pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'text' => $text);
$currentPage = null;
if (!$single) {
$currentPage = $GLOBALS["page{$infix}"];
}
$oTpl = new OA_Admin_Template('campaign-zone-zones.html');
$oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
$oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
// Add statistics for the displayed zones if required
if ($showStats) {
$oDalZones->mergeStatistics($websites, $campaignId);
}
// Count how many zone are displayed
$showingCount = 0;
foreach ($websites as $website) {
$showingCount += count($website['zones']);
}
$aZonesCounts['showing'] = $showingCount;
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('websites', $websites);
$oTpl->assign('zonescounts', $aZonesCounts);
$oTpl->assign('text', $text);
$oTpl->assign('status', $panel);
$oTpl->assign('page', $oTopPager->getCurrentPageID());
$oTpl->assign('showStats', $showStats);
$oTpl->assign('colspan', $showStats ? 6 : 3);
return $oTpl;
}
示例6: start
/**
* The final "child" implementation of the parental abstract method.
*
* @see OA_Admin_Statistics_Common::start()
*/
function start()
{
// Security check
OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER);
// Load the period preset and stats breakdown parameters
$this->_loadPeriodPresetParam();
$this->_loadStatsBreakdownParam();
// Load $_GET parameters
$this->_loadParams();
// HTML Framework
$this->pageId = '2.2';
$this->aPageSections = array('2.1', '2.4', '2.2');
// Prepare the data for display by output() method
$aParams = array();
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aParams['agency_id'] = OA_Permission::getAgencyId();
}
$this->prepare($aParams, 'stats.php');
}
示例7: createTemplateWithModel
public static function createTemplateWithModel($panel, $single = true)
{
$agencyId = OA_Permission::getAgencyId();
$oDalZones = OA_Dal::factoryDAL('zones');
$infix = $single ? '' : '-' . $panel;
phpAds_registerGlobalUnslashed('action', 'campaignid', 'clientid', "category{$infix}", "category{$infix}-text", "text{$infix}", "page{$infix}");
$campaignId = $GLOBALS['campaignid'];
$category = $GLOBALS["category{$infix}"];
$categoryText = $GLOBALS["category{$infix}-text"];
$text = $GLOBALS["text{$infix}"];
$linked = $panel == 'linked';
$websites = $oDalZones->getWebsitesAndZonesListByCategory($agencyId, $category, $campaignId, $linked, $text);
$pagerFileName = 'campaign-zone-zones.php';
$pagerParams = array('clientid' => $GLOBALS['clientid'], 'campaignid' => $GLOBALS['campaignid'], 'status' => $panel, 'category' => $category, 'category-text' => $categoryText, 'text' => $text);
$currentPage = null;
if (!$single) {
$currentPage = $GLOBALS["page{$infix}"];
}
$oTpl = new OA_Admin_Template('campaign-zone-zones.html');
$oPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, true, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
$oTopPager = OX_buildPager($websites, self::WEBSITES_PER_PAGE, false, 'websites', 2, $currentPage, $pagerFileName, $pagerParams);
list($itemsFrom, $itemsTo) = $oPager->getOffsetByPageId();
$websites = array_slice($websites, $itemsFrom - 1, self::WEBSITES_PER_PAGE, true);
$aZonesCounts = array('all' => $oDalZones->countZones($agencyId, null, $campaignId, $linked), 'matching' => $oDalZones->countZones($agencyId, $category, $campaignId, $linked, $text));
$showingCount = 0;
// TODO: currently we're calculating the number in PHP code. Once
// MAX_Dal_Admin_Zones::countZones() supports the limit parameter, we can remove
// the code below and use the dal.
foreach ($websites as $website) {
$showingCount += count($website['zones']);
}
$aZonesCounts['showing'] = $showingCount;
$oTpl->assign('pager', $oPager);
$oTpl->assign('topPager', $oTopPager);
$oTpl->assign('websites', $websites);
$oTpl->assign('zonescounts', $aZonesCounts);
$oTpl->assign('category', $categoryText);
$oTpl->assign('text', $text);
$oTpl->assign('status', $panel);
$oTpl->assign('page', $oTopPager->getCurrentPageID());
return $oTpl;
}
示例8: setDefaultForAdd
/**
* This method sets all default values when adding a new publisher.
*
*/
function setDefaultForAdd()
{
if (empty($this->agencyId)) {
$this->agencyId = OA_Permission::getAgencyId();
}
}
示例9: foreach
break;
case 'w':
$aDates['day_begin'] = $oDayDate->format('%Y-%m-%d');
$oDayDate->addSeconds(60 * 60 * 24 * 7);
// Add 7 days
$aDates['day_end'] = $oDayDate->format('%Y-%m-%d');
break;
case 'd':
default:
$aDates['day'] = $oDayDate->format('%Y-%m-%d');
break;
}
}
}
// Restrict to the current manager ID
$aParams['agency_id'] = OA_Permission::getAgencyId();
/*-------------------------------------------------------*/
/* Main code */
/*-------------------------------------------------------*/
// Get conversions - additional security check which allow to edit only those conversions visible to user
$aConversions = Admin_DA::getConversions($aParams + $aDates);
if (!empty($aConversions)) {
$conf = $GLOBALS['_MAX']['CONF'];
$modified = false;
// Modify conversions
foreach ($statusIds as $conversionId => $statusId) {
if (isset($aConversions[$conversionId]) && $aConversions[$conversionId]['connection_status'] != $statusId) {
$modified = true;
// Edit conversion
$doData_intermediate_ad_connection = OA_Dal::factoryDO('data_intermediate_ad_connection');
$doData_intermediate_ad_connection->get($conversionId);
示例10: getDefaultAgencyId
function getDefaultAgencyId()
{
return OA_Permission::getAgencyId();
}
示例11: processForm
function processForm($aAdvertiser, $form)
{
$aFields = $form->exportValues();
// Name
if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
$aAdvertiser['clientname'] = $aFields['clientname'];
}
// Default fields
$aAdvertiser['contact'] = $aFields['contact'];
$aAdvertiser['email'] = $aFields['email'];
$aAdvertiser['comments'] = $aFields['comments'];
// Same advertiser limitation
$aAdvertiser['advertiser_limitation'] = $aFields['advertiser_limitation'] == '1' ? 1 : 0;
// Reports
$aAdvertiser['report'] = $aFields['report'] == 't' ? 't' : 'f';
$aAdvertiser['reportdeactivate'] = $aFields['reportdeactivate'] == 't' ? 't' : 'f';
$aAdvertiser['reportinterval'] = (int) $aFields['reportinterval'];
if ($aAdvertiser['reportinterval'] == 0) {
$aAdvertiser['reportinterval'] = 1;
}
if ($aFields['reportlastdate'] == '' || $aFields['reportlastdate'] == '0000-00-00' || $aFields['reportprevious'] != $aAdvertiser['report']) {
$aAdvertiser['reportlastdate'] = date("Y-m-d");
}
if (empty($aAdvertiser['clientid'])) {
// Set agency ID
$aAdvertiser['agencyid'] = OA_Permission::getAgencyId();
$doClients = OA_Dal::factoryDO('clients');
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
// Insert
$aAdvertiser['clientid'] = $doClients->insert();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenAdded'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname']), MAX::constructURL(MAX_URL_ADMIN, 'campaign-edit.php?clientid=' . $aAdvertiser['clientid'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
// Go to next page
OX_Admin_Redirect::redirect("advertiser-index.php");
} else {
$doClients = OA_Dal::factoryDO('clients');
$doClients->get($aAdvertiser['clientid']);
$doClients->setFrom($aAdvertiser);
$doClients->updated = OA::getNow();
$doClients->update();
// Queue confirmation message
$translation = new OX_Translation();
$translated_message = $translation->translate($GLOBALS['strAdvertiserHasBeenUpdated'], array(MAX::constructURL(MAX_URL_ADMIN, 'advertiser-edit.php?clientid=' . $aAdvertiser['clientid']), htmlspecialchars($aAdvertiser['clientname'])));
OA_Admin_UI::queueMessage($translated_message, 'local', 'confirm', 0);
OX_Admin_Redirect::redirect('advertiser-edit.php?clientid=' . $aAdvertiser['clientid']);
}
exit;
}
示例12: setPublisherPageContext
/**
* Gets list of other publishers and set a menu page context variable with them
* Can be easily reused across inventory->publishers pages
*
* TODO: Consider reading page name from automatically instead of passing it as a parameter
*
* @static
* @param integer $affiliateid Affiliate ID
* @param string $pageName
* @param string $sortPageName
*/
function setPublisherPageContext($affiliateid, $pageName, $sortPageName = 'website-index.php')
{
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->agencyid = OA_Permission::getAgencyId();
if (OA_Permission::isAccount(OA_ACCOUNT_TRAFFICKER)) {
$doAffiliates->affiliateid = $affiliateid;
}
$doAffiliates->addSessionListOrderBy($sortPageName);
$doAffiliates->find();
while ($doAffiliates->fetch()) {
phpAds_PageContext(phpAds_buildAffiliateName($doAffiliates->affiliateid, $doAffiliates->name), "{$pageName}?affiliateid=" . $doAffiliates->affiliateid, $affiliateid == $doAffiliates->affiliateid);
}
}
示例13: 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;
}
示例14: loadPreferences
//.........这里部分代码省略.........
// eventually be set in the global array
$aPreferences = array();
// Put the admin account's preferences into the temporary
// storage array for preferences
if ($loadAdminOnly == true || !($currentAccountType == OA_ACCOUNT_ADMIN && $parentOnly)) {
OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aAdminPreferenceValues, $loadExtraInfo);
}
// Is the current account NOT the admin account?
if ($loadAdminOnly == false && $currentAccountType != OA_ACCOUNT_ADMIN) {
// Is the current account not a manager account?
if ($currentAccountType == OA_ACCOUNT_MANAGER) {
// This is a manager account
if (!$parentOnly) {
// Locate the owning manager account ID
if (!is_numeric($accountId)) {
$managerAccountId = OA_Permission::getAccountId();
} else {
$managerAccountId = $accountId;
}
if ($managerAccountId == 0) {
OA_Preferences::_unsetPreferences();
return;
}
// Get the manager account's preference values
$aManagerPreferenceValues = OA_Preferences::_getPreferenceValues($managerAccountId);
// Merge the preference values into the temporary
// storage array for preferences
OA_Preferences::_setPreferences($aPreferences, $aPreferenceTypes, $aManagerPreferenceValues, $loadExtraInfo);
}
} else {
// This must be an advertiser or trafficker account, so
// need to locate the manager account that "owns" this account
if (!is_numeric($accountId)) {
$owningAgencyId = OA_Permission::getAgencyId();
} else {
$owningAgencyId = 0;
if ($currentAccountType == OA_ACCOUNT_ADVERTISER) {
$doClients = OA_Dal::factoryDO('clients');
$doClients->account_id = $accountId;
$doClients->find();
if ($doClients->getRowCount() == 1) {
$aOwningAgencyId = $doClients->getAll(array('agencyid'), false, true);
$owningAgencyId = $aOwningAgencyId[0];
}
} else {
if ($currentAccountType == OA_ACCOUNT_TRAFFICKER) {
$doAffiliates = OA_Dal::factoryDO('affiliates');
$doAffiliates->account_id = $accountId;
$doAffiliates->find();
if ($doAffiliates->getRowCount() == 1) {
$aOwningAgencyId = $doAffiliates->getAll(array('agencyid'), false, true);
$owningAgencyId = $aOwningAgencyId[0];
}
}
}
}
if ($owningAgencyId == 0) {
OA_Preferences::_unsetPreferences();
return;
}
$doAgency = OA_Dal::factoryDO('agency');
$doAgency->agencyid = $owningAgencyId;
$doAgency->find();
if ($doAgency->getRowCount() == 1) {
// The manager account "owning" the advertiser or
// trafficker account has some preferences that
示例15: 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();
}