Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:0_bassac:2_availability [2025/01/24 09:02] benoiten:0_bassac:2_availability [2026/07/06 09:54] (current) – external edit 127.0.0.1
Line 1: Line 1:
-/*                  WARNING !                             */ +/* This page's availability section is now [DISPO_CALENDAR] (a plugin, */ 
-/*     TEAM :       IF YOU EDIT THIS PAGE               */ +/* see mekong-delta/lib/plugins/dispocalendar) — no more raw PHP here, */ 
-/*                  DO NOT APPROVE IT: IT WILL BREAK​    */ +/* so normal edit+approve is safe again (2026-07-06)                */
-/*                  instead, contact Ben                  */+
  
 ~~NOCACHE~~ ~~NOCACHE~~
Line 20: Line 19:
 <html><div style='float: left; font-family: "Cormorant Upright", serif; font-size: 1.2rem; line-height: 1.4; margin: 1.5rem 2rem 1.5rem 0; border: none; background: #e2d1c4; padding: .4rem 1rem .3rem 1.5rem; box-shadow: 3px 3px 12px -6px rgba(0,0,0,1);'></html> <html><div style='float: left; font-family: "Cormorant Upright", serif; font-size: 1.2rem; line-height: 1.4; margin: 1.5rem 2rem 1.5rem 0; border: none; background: #e2d1c4; padding: .4rem 1rem .3rem 1.5rem; box-shadow: 3px 3px 12px -6px rgba(0,0,0,1);'></html>
  
- +[DISPO_CALENDAR add_hours=12]
-<php> +
-/* Parameter: $calendar_blackout +
- * Number of days in the future to NOT offer availability. +
- */ +
-$calendar_blackout 0;     # 0 when last minute promotions do not apply +
- +
- +
-echo '<h4>Today and tomorrow</h4>'; +
-/* +
-  Last minute availabilities +
- */ +
-_tpl_load_live('https://transmekong.com/dispo.php?lang=en'); +
- +
-echo "</div>"; +
- +
-/* +
-  Production of the short date form for availabilities +
- */ +
-$monthsfrom = ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12", "janv.", "févr.", "mars", "avr.", "mai", "juin", "juil.", "août", "sept.", "oct.", "nov.", "déc."]; +
-$monthsto = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; +
- +
-$params = explode('&', substr($_SERVER['QUERY_STRING'], strpos($_SERVER['QUERY_STRING'], '?'))); +
-foreach($params as $param){ +
-    $equa = explode('=', $param); +
-    if ($equa[0] === 'date'){ +
-        $dateorg = str_replace($monthsfrom, $monthsto, urldecode($equa[1])); +
-        $date = date('d M Y', strtotime($dateorg)); +
-    } +
-+
-if (empty($date)){ +
-    $date = date('d M Y'); +
-+
- +
-echo "<h4 style='clear: left;'>Availability around your date</h4>"; +
- +
-echo "<p>These are the availability to <i>join in on a scheduled departure</i>. Please see <a href='1.0_charter'>the itineraries</a> if you like to charter a Bassac.</p>\n"; +
- +
-echo "<form method='get' action='${_SERVER['SCRIPT_URI']}'><input name='date' type='text' size='15' value='${date}' id='datepicker' /><input type='submit' value='Send'></form>\n\n"; +
- +
-echo "<div style='clear: both'></div>"; +
- +
-$datetxt = date ('l F j, Y', strtotime($date));   # Tune format for language +
- +
-/* +
-  Collection and display of the availability for these dates +
- */ +
- +
-$dateurl = urlencode($date); +
- +
-_tpl_load_live("https://transmekong.com/dispo_table.php?lang=en&date=${dateurl}&wiki=1"); +
- +
-$fromdate = date('Y-m-d', strtotime("today") + $calendar_blackout * 86400); +
- +
-echo <<<JQUI_CALENDAR +
-<script type="text/javascript">/*<![CDATA[*/ +
-var timestamp = Date.parse("${fromdate}"); +
-var fromDate = new Date(timestamp); +
- +
-jQuery( function() { +
-  jQuery( "#datepicker" ).datepicker({ +
-    dateFormat: "dd M yy", +
-    minDate: fromDate, +
-    hideIfNoPrevNext: true, +
-    monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"+
-  }); +
-} ); +
-/*!]]>*/</script> +
- +
-JQUI_CALENDAR; +
- +
-</php>+
  
 [WEBLEADS] [WEBLEADS]
Line 97: Line 25:
 For any date inaccessible through the calendar, please [[mailto:sales@mekong-delta.com|contact us]] for availabilities. For any date inaccessible through the calendar, please [[mailto:sales@mekong-delta.com|contact us]] for availabilities.
  
-----+{{section>:admin:snippets:bassac_tag#en public&noheader}}
  
 ====== ====== ====== ======
 {{page>:en:terms:partners:bassac}} {{page>:en:terms:partners:bassac}}