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


PHP OA_Dal类代码示例

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


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

示例1: 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

示例2: testUpdate

 /**
  * Tests the timestamps are updated correctly.
  * 
  * Test 1: Tests the current timestamp is inserted for a new image.
  * Test 2: Tests the timestamp is updated when an image is updated.
  *
  */
 function testUpdate()
 {
     // Test 1
     // Get the start time of the test
     $start = time();
     sleep(1);
     // Insert an image
     $doImages = OA_Dal::factoryDO('images');
     $doImages->filename = 'foo.jpg';
     $doImages->contents = '';
     DataGenerator::generateOne($doImages);
     // Get the image out of the DB
     $doImages = OA_Dal::staticGetDO('images', 'filename', 'foo.jpg');
     // Check the timestamp is > time at start of test and <= current time
     // Deal with MySQL 4.0 timestamps
     if (preg_match('/^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)$/', $doImages->t_stamp, $m)) {
         $doImages->t_stamp = "{$m[1]}-{$m[2]}-{$m[3]} {$m[4]}:{$m[5]}:{$m[6]}";
     }
     $actual = strtotime($doImages->t_stamp);
     $this->assertTrue($actual > $start && $actual <= time());
     // Test 2
     // Update the image
     $doImages->contents = '1';
     sleep(1);
     $doImages->update();
     // Get the image out of the DB
     $doImages = OA_Dal::staticGetDO('images', 'filename', 'foo.jpg');
     $oldTime = $actual;
     // Deal with MySQL 4.0 timestamps
     if (preg_match('/^(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)$/', $doImages->t_stamp, $m)) {
         $doImages->t_stamp = "{$m[1]}-{$m[2]}-{$m[3]} {$m[4]}:{$m[5]}:{$m[6]}";
     }
     $actual = strtotime($doImages->t_stamp);
     $this->assertTrue($actual > $oldTime && $actual <= time());
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:42,代码来源:Images.dal.test.php

示例3: testGetPublishersByTracker

 function testGetPublishersByTracker()
 {
     $campaignId = 1;
     // Add a couple of campaign_trackers
     $doCampaignsTrackers = OA_Dal::factoryDO('campaigns_trackers');
     $doCampaignsTrackers->campaignid = $campaignId;
     $doCampaignsTrackers->trackerid = 1;
     $aCampaignTrackerId = DataGenerator::generate($doCampaignsTrackers, 2);
     $doBanners = OA_Dal::factoryDO('banners');
     $doBanners->campaignid = $campaignId;
     $doBanners->acls_updated = '2007-04-03 18:39:45';
     $bannerId = DataGenerator::generateOne($doBanners, true);
     // Add a couple of affiliates
     $aAffiliateId = DataGenerator::generate('affiliates', 2);
     $doZones = OA_Dal::factoryDO('zones');
     $doZones->affiliateid = $aAffiliateId[0];
     $zoneId = DataGenerator::generateOne($doZones);
     $doAddZoneAssoc = OA_Dal::factoryDO('ad_zone_assoc');
     $doAddZoneAssoc->zone_id = $zoneId;
     $doAddZoneAssoc->ad_id = $BannerId;
     $adZoneAssocId = DataGenerator::generateOne($doAddZoneAssoc);
     // Test the correct number of rows is returned.
     $expectedRows = 1;
     $rsAffiliates = $this->dalAffiliates->getPublishersByTracker($aCampaignTrackerId[0]);
     $rsAffiliates->find();
     $actualRows = $rsAffiliates->getRowCount();
     $this->assertEqual($actualRows, $expectedRows);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:28,代码来源:Affiliates.dal.test.php

示例4: OA_Central_M2M

 /**
  * Class constructor
  *
  * @param string $accountId If null, the current account ID is used
  * @param string $accountType If null, the current account type is used
  * @return OA_Central_M2M
  */
 function OA_Central_M2M($accountId = null)
 {
     parent::OA_Central_Common();
     $currentId = OA_Permission::getAccountId();
     if (is_null($accountId)) {
         $this->accountId = $currentId;
     } else {
         $this->accountId = $accountId;
     }
     if ($this->accountId == $currentId) {
         $this->accountType = OA_Permission::getAccountType();
     } else {
         $doAccounts = OA_Dal::factoryDO('accounts');
         $doAccounts->account_id = $this->accountId;
         $doAccounts->find();
         if ($doAccounts->fetch()) {
             $this->accountType = $doAccounts->account_type;
         } else {
             Max::raiseError('Unexisting account ID', null, PEAR_ERROR_DIE);
         }
     }
     if ($this->accountType == OA_ACCOUNT_ADMIN) {
         $this->accountId = 0;
     }
 }
开发者ID:villos,项目名称:tree_admin,代码行数:32,代码来源:M2M.php

示例5: _iterateTableFields

/**
 * This function iterates over the table fields, and either gathers data which would be changed, or changes the data
 *
 * @param array $aTableFields
 * @return array
 */
function _iterateTableFields($aTableFields, $execute = false)
{
    $aChanged = array();
    $encTo = !empty($_POST['encTo']) ? $_POST['encTo'] : 'UTF-8';
    $encFrom = !empty($_POST['encFrom']) ? $_POST['encFrom'] : 'UTF-8';
    foreach ($aTableFields as $table => $tableData) {
        $doTable = OA_Dal::factoryDO($table);
        $doTable->find();
        while ($doTable->fetch()) {
            $changed = false;
            foreach ($tableData['fields'] as $field) {
                $converted = MAX_commonConvertEncoding($doTable->{$field}, $encTo, $encFrom);
                if ($converted === $doTable->{$field}) {
                    continue;
                }
                $id = array();
                foreach ($tableData['idfields'] as $idField) {
                    $id[$idField] = $doTable->{$idField};
                }
                if ($execute && !in_array(implode('.', $id), $_POST['aExecute'][$table][$field])) {
                    continue;
                }
                $aChanged[$table][$field][] = array('from' => $doTable->{$field}, 'to' => $converted, 'id' => $id);
                $doTable->{$field} = $converted;
                $changed = true;
            }
            if ($changed && $execute) {
                $doTable->update();
            }
        }
    }
    return $aChanged;
}
开发者ID:villos,项目名称:tree_admin,代码行数:39,代码来源:maintenance-encoding.php

示例6: md5

 function &staticGetApi($createDefaultManager = true)
 {
     $oApi =& $GLOBALS['_STATIC']['staticGetApi'];
     if (empty($oApi)) {
         $doAccounts = OA_Dal::factoryDO('accounts');
         $doAccounts->account_type = OA_ACCOUNT_ADMIN;
         $adminAccountId = DataGenerator::generateOne($doAccounts);
         if ($createDefaultManager) {
             $doAgency = OA_Dal::factoryDO('agency');
             $doAgency->name = 'Default Manager';
             $agencyId = DataGenerator::generateOne($doAgency);
             $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
             $managerAccountId = $doAgency->account_id;
         }
         $doUsers = OA_Dal::factoryDO('users');
         $doUsers->username = 'admin_' . md5(uniqid('', true));
         $doUsers->password = md5('secret');
         $doUsers->default_account_id = $createDefaultManager ? $managerAccountId : $adminAccountId;
         $userId = DataGenerator::generateOne($doUsers);
         $doAUA = OA_Dal::factoryDO('account_user_assoc');
         $doAUA->account_id = $adminAccountId;
         $doAUA->user_id = $userId;
         DataGenerator::generateOne($doAUA);
         $oApi = new Mocked_OA_Api_Xmlrpc($doUsers->username, 'secret');
     }
     return $oApi;
 }
开发者ID:akirsch,项目名称:revive-adserver,代码行数:27,代码来源:Common.api.php

示例7: testUpdateWhereOne

 function testUpdateWhereOne()
 {
     $this->initTables(array('campaigns', 'trackers'));
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'First';
     $doCampaigns->views = 10;
     $campaignId1 = DataGenerator::generateOne($doCampaigns);
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'Third';
     $doCampaigns->views = 30;
     $campaignId2 = DataGenerator::generateOne($doCampaigns);
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->campaignname = 'Fifth';
     $doCampaigns->views = 50;
     $campaignId3 = DataGenerator::generateOne($doCampaigns);
     $cUpdated = OA_DB_Sql::updateWhereOne('campaigns', 'campaignid', $campaignId2, array('campaignname' => 'Second', 'views' => 20));
     $this->assertEqual(1, $cUpdated);
     $doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignId2);
     $this->assertEqual('Second', $doCampaigns->campaignname);
     $this->assertEqual(20, $doCampaigns->views);
     $doCampaigns = OA_Dal::staticGetDO('campaigns', $campaignId1);
     $this->assertEqual('First', $doCampaigns->campaignname);
     $this->assertEqual('10', $doCampaigns->views);
     $aConf = $GLOBALS['_MAX']['CONF'];
     $this->oaTable->dropTable($aConf['table']['prefix'] . 'campaigns');
     $this->oaTable->dropTable($aConf['table']['prefix'] . 'trackers');
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:27,代码来源:Sql.tbl.test.php

示例8: defaultData

 function defaultData()
 {
     $oManager = new OX_Plugin_ComponentGroupManager();
     if (!array_key_exists('testPlugin', $GLOBALS['_MAX']['CONF']['pluginGroupComponents'])) {
         $oManager->disableComponentGroup('testPlugin');
     }
     $this->oManager->enableComponentGroup('testPlugin');
     $oTestPluginTable = OA_Dal::factoryDO('testplugin_table');
     if (!$oTestPluginTable) {
         OA::debug('Failed to instantiate DataObject for testplugin_table');
         return false;
     }
     $oTestPluginTable->myplugin_desc = 'Hello World';
     $aSettings[0]['data'] = $oTestPluginTable->insert();
     $aSettings[0]['section'] = 'myPlugin';
     $aSettings[0]['key'] = 'english';
     $oTestPluginTable->myplugin_desc = 'Hola Mundo';
     $aSettings[1]['data'] = $oTestPluginTable->insert();
     $aSettings[1]['section'] = 'myPlugin';
     $aSettings[1]['key'] = 'spanish';
     $oTestPluginTable->myplugin_desc = 'Look Simon, you\'re just making it up now';
     $aSettings[2]['data'] = $oTestPluginTable->insert();
     $aSettings[2]['section'] = 'myPlugin';
     $aSettings[2]['key'] = 'russian';
     $oManager->_registerSettings($aSettings);
     $oManager->disableComponentGroup('testPlugin');
     return true;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:28,代码来源:postscript_install_testUpgrade.php

示例9: 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);
}
开发者ID:villos,项目名称:tree_admin,代码行数:35,代码来源:lib-banner-cache.inc.php

示例10: testExecute

 function testExecute()
 {
     Mock::generatePartial('OA_UpgradeLogger', $mockLogger = 'OA_UpgradeLogger' . rand(), array('logOnly', 'logError', 'log'));
     $oLogger = new $mockLogger($this);
     $oLogger->setReturnValue('logOnly', true);
     $oLogger->setReturnValue('logError', true);
     $oLogger->setReturnValue('log', true);
     Mock::generatePartial('OA_Upgrade', $mockUpgrade = 'OA_Upgrade' . rand(), array('addPostUpgradeTask'));
     $mockUpgrade = new $mockUpgrade($this);
     $mockUpgrade->setReturnValue('addPostUpgradeTask', true);
     $mockUpgrade->oLogger = $oLogger;
     $mockUpgrade->oDBUpgrader = new OA_DB_Upgrade($oLogger);
     $mockUpgrade->oDBUpgrader->oTable =& $this->oaTable;
     // Run the upgrade
     $postscript = new OA_UpgradePostscript_2_7_30_beta_rc5();
     $ret = $postscript->execute(array(&$mockUpgrade));
     $this->assertTrue($ret);
     // Get the preference that we have inserted
     $doPreferences = OA_Dal::factoryDO('preferences');
     $doPreferences->preference_name = 'campaign_ecpm_enabled';
     $doPreferences->account_type = 'MANAGER';
     $doPreferences->find();
     $numberPreferences = $doPreferences->getRowCount();
     $this->assertEqual(1, $numberPreferences);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:25,代码来源:postscript_openads_upgrade_2.7.30-beta-rc5.mig.test.php

示例11: checkRangeData

 /**
  * A mathod to quickly check the data in the database for the date
  * range given, to ensure that the range being tested & corrected
  * seems reasonable.
  *
  * @param Date $oStartDate The start date/time of the range to test & correct.
  * @param Date $oEndDate   The end date/time of the range to test & correct.
  * @return boolean True if the date range seems okay, false otherwise.
  */
 function checkRangeData($oStartDate, $oEndDate)
 {
     // Test that there are no rows in the data_intermediate_ad table where the
     // operation interval value does not match that in the configuration file
     $doData_intermediate_ad = OA_Dal::factoryDO('data_intermediate_ad');
     $doData_intermediate_ad->whereAdd('date_time >= ' . $this->oDbh->quote($oStartDate->format('%Y-%m-%d %H:%M:%S'), 'timestamp'));
     $doData_intermediate_ad->whereAdd('date_time <= ' . $this->oDbh->quote($oEndDate->format('%Y-%m-%d %H:%M:%S'), 'timestamp'));
     $doData_intermediate_ad->whereAdd('operation_interval != ' . $this->oDbh->quote(OX_OperationInterval::getOperationInterval(), 'integer'));
     $doData_intermediate_ad->find();
     $rows = $doData_intermediate_ad->getRowCount();
     if ($rows > 0) {
         $message = "\n    Detected at least one row in the data_intermediate_ad table with operation interval != " . OX_OperationInterval::getOperationInterval() . ".\n";
         echo $message;
         return false;
     }
     // Test that all of the date/time values in the data_summary_ad_hourly
     // table align with the start of operation intervals
     $doData_summary_ad_hourly = OA_Dal::factoryDO('data_summary_ad_hourly');
     $doData_summary_ad_hourly->selectAdd();
     $doData_summary_ad_hourly->selectAdd('DISTINCT date_time');
     $doData_summary_ad_hourly->whereAdd('date_time >= ' . $this->oDbh->quote($oStartDate->format('%Y-%m-%d %H:%M:%S'), 'timestamp'));
     $doData_summary_ad_hourly->whereAdd('date_time <= ' . $this->oDbh->quote($oEndDate->format('%Y-%m-%d %H:%M:%S'), 'timestamp'));
     $doData_summary_ad_hourly->find();
     while ($doData_summary_ad_hourly->fetch()) {
         $oDate = new Date($doData_summary_ad_hourly->date_time);
         $result = OX_OperationInterval::checkDateIsStartDate($oDate);
         if (!$result) {
             $message = "\n    Detected at least one row in the data_summary_ad_hourly table with date_time value not on the hour start interval.\n";
             echo $message;
             return false;
         }
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:43,代码来源:TestAndCorrect.php

示例12: addAdZoneAssoc

 function addAdZoneAssoc($adId, $zoneId, $priority)
 {
     $doAd_zone_assoc = OA_Dal::factoryDO('ad_zone_assoc');
     $doAd_zone_assoc->ad_id = $adId;
     $doAd_zone_assoc->zone_id = $zoneId;
     $doAd_zone_assoc->priority = $priority;
     DataGenerator::generateOne($doAd_zone_assoc);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:8,代码来源:Priority_updateEcpmPriorities.dal.test.php

示例13: getAllAdvertisers

 /**
  * A method to retrieve a list of all advertiser names. Can be limited to
  * just return the advertisers that are "owned" by an agency.
  *
  * @param string  $listorder      The column name to sort the agency names by. One of "name" or "id".
  * @param string  $orderdirection The sort oder for the sort column. One of "up" or "down".
  * @param integer $agencyId       Optional. The agency ID to limit results to.
  * @return array
  *
  * @todo Consider removing order options (or making them optional)
  */
 function getAllAdvertisers($listorder, $orderdirection, $agencyId = null)
 {
     $doClients = OA_Dal::factoryDO('clients');
     if (!empty($agencyId) && is_numeric($agencyId)) {
         $doClients->agencyid = $agencyId;
     }
     $doClients->addListOrderBy($listorder, $orderdirection);
     return $doClients->getAll(array('clientname', 'an_adnetwork_id'), $indexWitkPk = true, $flatten = false);
 }
开发者ID:villos,项目名称:tree_admin,代码行数:20,代码来源:Clients.php

示例14: idExists

 private function idExists($tableName, $id)
 {
     $doObject = OA_Dal::factoryDO($tableName);
     if (empty($id) || !($object = $doObject->get($id))) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:9,代码来源:Trackers.php

示例15: getEntity

 protected function getEntity($entityTable, $entityId)
 {
     $do = OA_Dal::factoryDO($entityTable);
     $aEntity = null;
     if ($do->get($entityId)) {
         $aEntity = $do->toArray();
     }
     return $aEntity;
 }
开发者ID:rcdesign-cemetery,项目名称:openx-markedtext,代码行数:9,代码来源:EntityHelper.php


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