/**
 * function that creates individual ads and adds it to the
 * adgroup.
 */
function addAds($adService, $adGroupID)
{
    global $SAMPLE_DATA;
    $ad1 = createAd(NULL, $adGroupID, $SAMPLE_DATA['AD1_DESC'], $SAMPLE_DATA['AD1_DISPLAY_URL'], $SAMPLE_DATA['AD1_NAME'], $SAMPLE_DATA['AD1_SHORT_DESC'], 'On', $SAMPLE_DATA['AD1_TITLE'], $SAMPLE_DATA['AD1_URL']);
    $ad2 = createAd(NULL, $adGroupID, $SAMPLE_DATA['AD2_DESC'], $SAMPLE_DATA['AD2_DISPLAY_URL'], $SAMPLE_DATA['AD2_NAME'], $SAMPLE_DATA['AD2_SHORT_DESC'], 'On', $SAMPLE_DATA['AD2_TITLE'], $SAMPLE_DATA['AD2_URL']);
    debug("Calling addAds");
    //PHP NOTE: In case of nested arrays, only the outer-most
    //element needs to be keyed with the correct param name.
    $adsParam = array('ads' => array($ad1, $ad2));
    $retObj = execute($adService, 'addAds', $adsParam);
    //IMPL NOTE: PHP will treat single element as an object and not an array
    //PHP NOTE: Return values of arrays are structured differently than
    //as described in wsdl.
    if (isset($retObj->out->AdResponse[0]->ad)) {
        checkResponse($retObj->out->AdResponse[0]);
        debug("------> Ad ID: " . $retObj->out->AdResponse[0]->ad->ID);
        checkForEditorialReason($adService, $retObj->out->AdResponse[0]->ad);
    }
    if (isset($retObj->out->AdResponse[1]->ad)) {
        checkResponse($retObj->out->AdResponse[1]);
        debug("------> Ad ID: " . $retObj->out->AdResponse[1]->ad->ID);
        checkForEditorialReason($adService, $retObj->out->AdResponse[1]->ad);
    }
    return $retObj->out;
}
Exemple #2
0
    $templateDirWeb = array();
    makeTemplateDir($propertyInfo, $templateDir, $templateDirWeb);
    $result = array('links' => $links, 'propertyInfo' => $propertyInfo, 'templateDir' => $templateDir, 'templateDirWeb' => $templateDirWeb, 'templateInfo' => $mJsonObj);
    header("Content-Type: application/json");
    echo json_encode($result);
});
$app->post('/sendFinal', function () use($app) {
    $request = $app->request();
    $body = $request->getBody();
    $result = json_decode($body);
    $propertyInfo = json_decode(json_encode($result->propertyInfo), true);
    $imgs = $result->links;
    //print_arr($propertyInfo);
    /*---------------------------------*/
    $finalised = array();
    createAd($propertyInfo, $imgs, $finalised);
    //print_arr($finalised);
});
$app->get('/test', function () use($app) {
    // phpinfo();
    // $resizedDir = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testDraw/";
    // $imgUrl = "{$_SERVER['DOCUMENT_ROOT']}/api/assets/testDraw/main.jpg";
    // $resizedUrl = "";
    // $jsonObject = get_json_object ($propertyInfo['agency_localDir']);
    // resizeSingleMain ($imgUrl, $jsonObject, $resizedDir, $resizedUrl);
    // finaliseMainAdItem ($propertyInfo, $resizedUrl);
    // $imgUrls = array (
    //	"{$_SERVER['DOCUMENT_ROOT']}/myApp/api/assets/testResize/main-resized.jpg",
    //	"{$_SERVER['DOCUMENT_ROOT']}/myApp/api/assets/testResize/1-resized.jpg",
    //	"{$_SERVER['DOCUMENT_ROOT']}/myApp/api/assets/testResize/2-resized.jpg"
    // );