Infra 1988 - Add Eclipsecon promo ad

Change-Id: Icb96eb7f456559ab5a8c2e52b5bd84050b03b704
Signed-off-by: Eric Poirier <eric@eclipse.org>
diff --git a/promo/promos.php b/promo/promos.php
index feefbb5..f8df95b 100644
--- a/promo/promos.php
+++ b/promo/promos.php
@@ -87,6 +87,48 @@
   return $retVal;
 }
 
+function buildDownloadHtmlAd($array) {
+
+  $urls = array(
+    'url1' => $array['url1'],
+    'url2' => $array['url2'],
+    'url3' => $array['url3'],
+  );
+
+  ob_start();
+  ?>
+  <table class="ad-eclipsecon-schedule table table-striped text-left">
+    <thead>
+      <tr>
+        <th>
+          <span class="ad-eclipsecon-schedule-title">
+            <span class="orange">EclipseCon</span><br>Upcoming Conferences:
+          </span>
+        </th>
+      </tr>
+    </thead>
+    <tbody>
+      <tr>
+        <td>North Carolina  //  <a class="orange" href="/go/<?php print $urls['url1']; ?>">May 7-10, 2016</a></td>
+      </tr>
+      <tr>
+        <td>France  //  <a class="orange" href="/go/<?php print $urls['url2']; ?>">June 7-9, 2016</a></td>
+      </tr>
+      <tr>
+        <td>Ludwidsburg  //  <a class="orange" href="/go/<?php print $urls['url3']; ?>">October 25-27, 2016</a></td>
+      </tr>
+    </tbody>
+  </table>
+  <?php
+
+  foreach ($urls as $url) {
+    $impression = new CampaignImpression($url, 'Download Page', @gethostbyaddr($_SERVER['REMOTE_ADDR']));
+    $impression->recordImpression();
+  }
+
+  return ob_get_clean();
+}
+
 /**
  * Eclipse Advertisements
  *
@@ -183,6 +225,21 @@
     'weight' => 6
   );
 
+  /**
+   * HTML AD
+   * */
+
+  $retVal[] = array(
+    'memberName' => 'Eclipsecon',
+    'url1' => 'PROMO_ECLIPSECON_NA2016',
+    'url2' => 'PROMO_ECLIPSECON_ECF2016',
+    'url3' => 'PROMO_ECLIPSECON_ECE2016',
+    'format' => 'html',
+    'type' => 'strat_ad',
+    'html'=>'/eclipse.org-common/classes/ads/tpl/eclipseconAd.tpl.php',
+    'weight' => 20
+  );
+
   return $retVal;
 
 }
@@ -198,6 +255,11 @@
     $selectedAd = array_rand_weighted($promos);
   }
 
+  // If the selected Ad is in HTML
+  if (!empty($selectedAd['format']) && $selectedAd['format'] == "html") {
+    return buildDownloadHtmlAd($selectedAd);
+  }
+
   switch ($selectedAd['type']) {
     case 'paid':
     // THERE IS NO BREAK HERE ON PURPOSE WE WANT STRAT_AD CASE CODE TO RUN
@@ -253,6 +315,11 @@
   } else {
     $selectedAd = array_rand_weighted($promos);
   }
+
+  // If the selected Ad is in HTML
+  if (!empty($selectedAd['format']) && $selectedAd['format'] == "html") {
+    return buildDownloadHtmlAd($selectedAd);
+  }
   return buildDownloadAd($selectedAd);
 }