PageRenderTime 98ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/booking/reservations/agent_calendar_2007.php

https://bitbucket.org/anneivycat/california-tour
PHP | 313 lines | 285 code | 19 blank | 9 comment | 86 complexity | e6bfc7199758f172c3ea371ac1eb02f3 MD5 | raw file
  1. <?php
  2. error_reporting(0);
  3. extract($_GET);
  4. include ("../sqlfuncs.php");
  5. $l = connect_to_db();
  6. $l = select_db($l);
  7. if ($city=="") { $city="SF"; }
  8. $myCities["SB"]="Santa Barbara";
  9. $myCities["SF"]="San Francisco";
  10. $myCities["SD"]="San Diego";
  11. $myCities["LA"]="Los Angeles";
  12. $sql = 'SELECT `TOUR_TYPE` AS tt, `TOUR_NAME` AS tn
  13. FROM `TOUR`
  14. ORDER BY tt;';
  15. $r = mysql_query($sql);
  16. $nr = mysql_num_rows($r);
  17. for ($i=0;$i<$nr;$i++) {
  18. $line=mysql_fetch_array($r);
  19. $myTours[$line['tt']]=ucwords(strtolower($line['tn']));
  20. // echo $line['tt']."=".$line['tn']."<br />\n";
  21. }
  22. ?>
  23. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  24. <HTML>
  25. <HEAD>
  26. <TITLE>Tours from <?php echo $myCities[$city]; ?></TITLE>
  27. <?php if($languageUsed == "JP") { ?>
  28. <meta http-equiv=\"Content-Type\" content="text/html; charset=x-sjis">
  29. <?php
  30. } else {
  31. ?>
  32. <meta http-equiv=\"Content-Type\" content="text/html; charset=UTF-8">
  33. <?php
  34. }
  35. ?>
  36. <style type="text/css">
  37. BODY {
  38. font: 300 10px Verdana, Arial, sans-serif;
  39. }
  40. A SPAN { display: none; }
  41. A:HOVER SPAN { display: block; }
  42. </style>
  43. <?php echo "<title>California Tours - Tours From $city</title>\n"; ?>
  44. <script language="JavaScript">
  45. <!--
  46. function MM_swapImgRestore() { //v3.0
  47. var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  48. }
  49. function MM_preloadImages() { //v3.0
  50. var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  51. var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  52. if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  53. }
  54. function MM_findObj(n, d) { //v4.0
  55. var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  56. d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  57. if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  58. for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  59. if(!x && document.getElementById) x=document.getElementById(n); return x;
  60. }
  61. function MM_swapImage() { //v3.0
  62. var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  63. if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  64. }
  65. //-->
  66. </script>
  67. </head>
  68. <?php
  69. function getFirstWeekDay($CurrentYear,$CurrentMonth,$CurrentDay) {
  70. /*
  71. $day=mktime(0, 0, 0, $CurrentMonth,$CurrentDay,$CurrentYear);
  72. $day=date("w",$day);
  73. return ($day+1);
  74. */
  75. $day = date("w",strtotime("$CurrentMonth/1/$CurrentYear"));
  76. return ($day);
  77. }
  78. function getMonthName($iMonth) {
  79. if ($iMonth == 1) { return("January"); }
  80. if ($iMonth == 2) { return("February"); }
  81. if ($iMonth == 3) { return("March"); }
  82. if ($iMonth == 4) { return("April"); }
  83. if ($iMonth == 5) { return("May"); }
  84. if ($iMonth == 6) { return("June"); }
  85. if ($iMonth == 7) { return("July"); }
  86. if ($iMonth == 8) { return("August"); }
  87. if ($iMonth == 9) { return("September"); }
  88. if ($iMonth == 10) { return("October"); }
  89. if ($iMonth == 11) { return("November"); }
  90. if ($iMonth == 12) { return("December"); }
  91. return("INVALID MONTH");
  92. }
  93. function getDaysInMonth($CurrentYear,$CurrentMonth) {
  94. $iDaysInMonth = 31;
  95. if (getMonthName($CurrentMonth) == "January") { return(31); }
  96. if (getMonthName($CurrentMonth) == "March") { return(31); }
  97. if (getMonthName($CurrentMonth) == "April") { return(30); }
  98. if (getMonthName($CurrentMonth) == "May") { return(31); }
  99. if (getMonthName($CurrentMonth) == "June") { return(30); }
  100. if (getMonthName($CurrentMonth) == "July") { return(31); }
  101. if (getMonthName($CurrentMonth) == "August") { return(31); }
  102. if (getMonthName($CurrentMonth) == "September") { return(30); }
  103. if (getMonthName($CurrentMonth) == "October") { return(31); }
  104. if (getMonthName($CurrentMonth) == "November") { return(30); }
  105. if (getMonthName($CurrentMonth) == "December") { return(31); }
  106. if (getMonthName($CurrentMonth) == "February") {
  107. $strCurrentYear = sprintf("%s",$CurrentYear);
  108. if (($CurrentYear %4) == 0) {
  109. return(29);
  110. } else {
  111. return(28);
  112. }
  113. return ($iDaysInMonth);
  114. }
  115. }
  116. $day="";
  117. $dtToday = getdate(time());
  118. $year = 2007;
  119. if ($year=="") {
  120. $year=2005;
  121. $month=1;
  122. if($year==2004) {
  123. $year=2005;
  124. $month=1;
  125. $day="";
  126. }
  127. }
  128. $dtCurrentDate = sprintf("%s/%s/%s",$month,$day,$year);
  129. $CurrentYear = $year;
  130. $CurrentMonth = $month;
  131. $CurrentDay = $day;
  132. echo "<table ALIGN='CENTER' BORDER='0' bgcolor= '#000000' CELLSPACING='0' WIDTH='80%'>";
  133. $iFirstWeekDay = getFirstWeekDay($year,$month,$day);
  134. $iDaysInMonth = getDaysInMonth($year,$month);
  135. $i=$iDaysInMonth+$iFirstWeekDay;
  136. for ($iLoop = $iFirstWeekDay; $iLoop < $i; $iLoop++) {
  137. $aCalendarDays[$iLoop] = $iLoop+1-$iFirstWeekDay;
  138. }
  139. ?>
  140. <STYLE TYPE="text/css">
  141. BODY, TD {
  142. font: 300 12px Verdana, Arial, sans-serif;
  143. color: black;
  144. }
  145. .blueType {
  146. color: #33F;
  147. }
  148. A:link {COLOR: #3366FF; TEXT-DECORATION: none}
  149. A:visited {COLOR: #3366FF; TEXT-DECORATION: none}
  150. A:hover {COLOR: #0000CC; TEXT-DECORATION: none}
  151. .style1 {color: #3300FF}
  152. .style2 {color: #0033FF}
  153. </STYLE>
  154. </head>
  155. <body>
  156. <table width="742" border="0" cellspacing="0" cellpadding="0">
  157. <tr><td width="106">&nbsp;</td>
  158. <td width="261"><img src="/booking/images/california_tours_logo/home153_64.gif" width="153" height="64" alt="California Tours"></td>
  159. <td width="315" align="center"><h3>2007 tours from <?php echo $myCities[$city]; ?></h3></td>
  160. <td width="60">&nbsp;</td>
  161. </tr>
  162. </table>
  163. <br>
  164. <table width="768" border="0" cellspacing="0" cellpadding="0">
  165. <tr align="center" valign="middle" bgcolor="#ffba3d">
  166. <td width="31" height="13" bgcolor="#FFCC66"></td>
  167. <td width="293" height="13" bgcolor="#FFCC66" align="left"></td>
  168. <td width="351" height="13" bgcolor="#FFCC66" valign="middle" align="right"><a href="mailto:tours@california-tour.com"><img src="/booking/images/links_position/contact.gif" width="310" height="17" border="0" alt="California Tour"></a></td>
  169. <td width="63" height="13" bgcolor="#FFCC66"></td>
  170. </tr>
  171. <tr align="center" valign="top">
  172. <td colspan="5">
  173. <table width="720" border="0" cellspacing="0" cellpadding="0">
  174. <tr>
  175. <td width="130" align="left" valign="top">
  176. <table width="124" border="0" cellspacing="0" cellpadding="0">
  177. <tr><td height="12" align="left" valign="top"><img src="/booking/images/spacer/120_10.gif" width="120" height="10"></td>
  178. </tr>
  179. <tr><td height="168" align="left" valign="top">
  180. </td></tr></table></td>
  181. <td width="485" align="left" valign="top">
  182. <table width="477" border="0" cellspacing="0" cellpadding="0">
  183. <tr><td width="8">&nbsp;</td>
  184. <td align="left" valign="top">
  185. <div align="center">
  186. <br>
  187. <font size="2" color="#006699"><strong>
  188. <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
  189. Tours from
  190. <?php
  191. echo $myCities[$city];
  192. ?>
  193. </strong></font>
  194. </font>
  195. <br />
  196. <a href="?city=<?php echo $city; ?>&year=2006&month=1">jan</a>&nbsp;
  197. <a href="?city=<?php echo $city; ?>&year=2006&month=2">feb</a>&nbsp;
  198. <a href="?city=<?php echo $city; ?>&year=2006&month=3">mar</a>&nbsp;
  199. <a href="?city=<?php echo $city; ?>&year=2006&month=4">apr</a>&nbsp;
  200. <a href="?city=<?php echo $city; ?>&year=2006&month=5">may</a>&nbsp;
  201. <a href="?city=<?php echo $city; ?>&year=2006&month=6">june</a>&nbsp;
  202. <a href="?city=<?php echo $city; ?>&year=2006&month=7">july</a>&nbsp;
  203. <a href="?city=<?php echo $city; ?>&year=2006&month=8">aug</a>&nbsp;
  204. <a href="?city=<?php echo $city; ?>&year=2006&month=9">sept</a>&nbsp;
  205. <a href="?city=<?php echo $city; ?>&year=2006&month=10">oct</a>&nbsp;
  206. <a href="?city=<?php echo $city; ?>&year=2006&month=11">nov</a>&nbsp;
  207. <a href="?city=<?php echo $city; ?>&year=2006&month=12">dec</a>
  208. </font>
  209. <br /><br />
  210. <table width="565" cellspacing="0" cellpadding="0" style="border: 0px; padding: 2px;">
  211. <tr bgcolor="#FFFFFF" align="center" valign="top">
  212. <td colspan="7" height="19">
  213. <font face="Verdana, Arial, Helvetica, sans-serif" color="#006699">
  214. <strong><font size="2" color="#FF6600"><?php echo getMonthName($month); ?> <?php echo $year ?></font></strong>
  215. </font>
  216. </td></tr>
  217. <!-- Display Days of the Week -->
  218. <tr bgcolor="#006699" align="center" valign="middle">
  219. <td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Sun</font></td>
  220. <td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Mon</font></td>
  221. <td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Tues</font></td>
  222. <td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Wed</font></td>
  223. <td width="80"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Thur</font></td>
  224. <td width="83"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Fri</font></td>
  225. <td width="82"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFFF">Sat</font></td></tr>
  226. <!-- Display Calendar -->
  227. <?php for ($iDayBanner = 1; $iDayBanner <= $iColumns; $iDayBanner++) ?>
  228. <tr align="center" valign="top">
  229. <?php
  230. $ImgIndex = 0;
  231. $kk=0;
  232. $dm=substr("000".$month,-2);
  233. for ($i = 0; $i < 42; $i++) {
  234. $dd = $aCalendarDays[$i]+0;
  235. if ($dd == "") {
  236. echo"<TD BGCOLOR='WHITE' VALIGN= 'TOP' ALIGN='Left' style='width: 120px; height: 80px;'>&nbsp;</td>\n";
  237. } else {
  238. // $dd=($i-$iFirstWeekDay+1);
  239. $dd=substr("000".$dd,-2);
  240. echo"<TD BGCOLOR='WHITE' VALIGN= 'TOP' ALIGN='Left' id='tagada$dd' style='width: 120px; height: 80px;'>
  241. <font face='arial'>".($dd+0)."<br />";
  242. $MonthName = getMonthName($month);
  243. $ShortYear = substr($year,2,2);
  244. $query = "SELECT SCHEDULEDTOUR_CODE, TOUR_ID
  245. FROM SCHEDULEDTOUR
  246. WHERE SCHEDULEDTOUR_CODE
  247. LIKE '%$dm$dd$ShortYear'
  248. AND SCHEDULEDTOUR_CODE like '$city%'";
  249. // echo "<span style='font-size: 70%;'>$query</span><br />\n";
  250. $mysql_result = mysql_query($query);
  251. $totalnumrows = mysql_num_rows($mysql_result);
  252. if ($totalnumrows>0) {
  253. while ($row = mysql_fetch_array($mysql_result)) {
  254. $ScheduledTourCode = strtoupper($row[0]);
  255. $TourId = strtoupper($row[1]);
  256. $querytour = "SELECT * FROM TOUR WHERE TOUR_ID = '$TourId'";
  257. $mysql_result_tour = mysql_query($querytour);
  258. $rowtour = mysql_fetch_array($mysql_result_tour);
  259. $TourName = $rowtour[2];
  260. $ImgList = strtolower($rowtour[24]);
  261. if (strlen($ImgList) > 0) {
  262. $ImgListArray = explode(",",$ImgList);
  263. if ($ImgIndex >= count($ImgListArray)) {
  264. $ImgIndex = 0;
  265. $ThmImg = $ImgListArray[$ImgIndex];
  266. } else {
  267. $ThmImg = $ImgListArray[$ImgIndex];
  268. $ImgIndex = $ImgIndex+1;
  269. }
  270. }
  271. $SchedCodeLength = strlen($ScheduledTourCode);
  272. $ScheduledTourShortCode = substr($ScheduledTourCode,0,$SchedCodeLength - 2);
  273. $myURL="agenttoursignup.php?LocalScheduledTourCode=$ScheduledTourShortCode&languageUsed=$languageUsed&city=$city&year=$year&month=$month&day=$day&SchoolCode=$SchoolCode&UserName=$UserName";
  274. $ucTourName=$myTours[substr($ScheduledTourShortCode,0,4)];
  275. echo "\n<a href=\"$myURL\"><font face='arial' size='-1'>$ucTourName</font>\n";
  276. echo "<span><img border='0' src='/tour_thumbnails/$ThmImg' /></span></a><br />\n";
  277. }
  278. }
  279. echo "</td>\n";
  280. }
  281. $kk+=1;
  282. if ($kk == 7) {
  283. $kk=0;
  284. echo "</tr>\n";
  285. }
  286. }
  287. ?>
  288. </table></table></table></table>
  289. <center><FONT SIZE="1" FACE="Verdana, Arial, Helvetica, sans-serif" COLOR="#333333">Schedule subject to change.</FONT>
  290. <br>
  291. <br>
  292. <hr width="99%">
  293. </center>
  294. </body></html>