Ejemplo n.º 1
0
 $campaign = $dbRes->fetch();
 if ($campaign) {
     try {
         switch ($_REQUEST['action']) {
             case 'archive':
                 $engine->stopCampaign($campaign['XML_ID']);
                 $engine->archiveCampaign($campaign['XML_ID']);
                 break;
             case 'unarchive':
                 $engine->unArchiveCampaign($campaign['XML_ID']);
                 break;
             case 'stop':
                 $engine->stopCampaign($campaign['XML_ID']);
                 break;
             case 'resume':
                 $engine->resumeCampaign($campaign['XML_ID']);
                 break;
         }
         $campaignInfo = $engine->getCampaign(array($campaign['XML_ID']));
         $campaignInfo = $campaignInfo[0];
         Adv\YandexCampaignTable::setSkipRemoteUpdate(true);
         $result = Adv\YandexCampaignTable::update($campaignId, array("SETTINGS" => $campaignInfo));
         Adv\YandexCampaignTable::setSkipRemoteUpdate(false);
         if (!$result->isSuccess()) {
             $errorsList = $result->getErrorMessages();
             foreach ($errorsList as $errorMessage) {
                 $adminList->AddGroupError($errorMessage, $campaignId);
             }
         }
     } catch (Engine\YandexDirectException $e) {
         $adminList->AddGroupError($e->getCode() . ': ' . $e->getMessage());