PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/courses/index.php

https://bitbucket.org/molusc/sma-website
PHP | 299 lines | 265 code | 30 blank | 4 comment | 46 complexity | 7d56f8b3b640e834489f8b508df1f801 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php require_once('../Connections/bryanmadge.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6. $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7. $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  8. switch ($theType) {
  9. case "text":
  10. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  11. break;
  12. case "long":
  13. case "int":
  14. $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  15. break;
  16. case "double":
  17. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  18. break;
  19. case "date":
  20. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  21. break;
  22. case "defined":
  23. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  24. break;
  25. }
  26. return $theValue;
  27. }
  28. }
  29. session_start(); ?>
  30. <?php
  31. if (!isset($_GET["catid"]))
  32. $_GET["catid"] = 0;
  33. $catid = $_GET["catid"];
  34. if (!isset($_GET["debug"]))
  35. $_GET["debug"] = 0;
  36. $debug = $_GET["debug"];
  37. mysql_select_db($database_bryanmadge, $bryanmadge);
  38. if(isset($_SESSION['company']))
  39. $query_categories = "SELECT categoryid, category.coursecategory, Count(catalog_id) AS CountOfCourseCatalogID FROM catalog, category WHERE category.id=categoryid AND category.id <> 7 GROUP BY categoryid ORDER BY category.coursecategory";
  40. else
  41. $query_categories = "SELECT categoryid, category.coursecategory, Count(catalog_id) AS CountOfCourseCatalogID FROM catalog, category WHERE category.id=categoryid GROUP BY categoryid ORDER BY category.coursecategory";
  42. $categories = mysql_query($query_categories, $bryanmadge) or die(mysql_error());
  43. $row_categories = mysql_fetch_assoc($categories);
  44. $totalRows_categories = mysql_num_rows($categories);
  45. $catid_catalog = "8";
  46. if (isset($catid)) {
  47. $catid_catalog = $catid;
  48. }
  49. mysql_select_db($database_bryanmadge, $bryanmadge);
  50. $query_catalog = sprintf("SELECT catalog.catalog_id, catalog.title, catalog.categoryid, category.coursecategory, catalog.subcategoryid, subcategory.subcategory FROM (catalog INNER JOIN category ON catalog.categoryid = category.id) LEFT JOIN subcategory ON catalog.SubCategoryid = subcategory.id WHERE (((catalog.categoryid)=%s)) ORDER BY category.coursecategory, subcategory.subcategory, catalog.title", GetSQLValueString($catid_catalog, "int"));
  51. $catalog = mysql_query($query_catalog, $bryanmadge) or die(mysql_error());
  52. $row_catalog = mysql_fetch_assoc($catalog);
  53. $totalRows_catalog = mysql_num_rows($catalog);
  54. $catid_subcategories = "7";
  55. if (isset($catid)) {
  56. $catid_subcategories = (get_magic_quotes_gpc()) ? $catid : addslashes($catid);
  57. }
  58. mysql_select_db($database_bryanmadge, $bryanmadge);
  59. $query_subcategories = sprintf("SELECT subcategory.id, subcategory.subcategory, subcategory.parentcategoryid FROM subcategory WHERE subcategory.parentcategoryid=%s ORDER BY subcategory.subcategory", $catid_subcategories);
  60. $subcategories = mysql_query($query_subcategories, $bryanmadge) or die(mysql_error());
  61. $row_subcategories = mysql_fetch_assoc($subcategories);
  62. $totalRows_subcategories = mysql_num_rows($subcategories);
  63. ?>
  64. <html><!-- InstanceBegin template="/Templates/general.dwt" codeOutsideHTMLIsLocked="false" -->
  65. <head>
  66. <LINK REL="SHORTCUT ICON" HREF="../favicon.ico">
  67. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  68. <meta name="GENERATOR" content="Dreamweaver MX">
  69. <meta name="keywords" content="CDM Regulations, CESMM, civil engineering, construction management, contract administration, contract procedures, courses, environmental awareness, geotechnical, Health and safety, ICE Conditions of Contract, ICE Professional Review, JCT Form of Contract, Method of Measurement for Highway Works, MMHW, NEC New Engineering and Construction Contract, Project management, report writing, site supervision, Standard Forms of Contract, training, AMPR, CET, CPD, TMPR, Eurocodes">
  70. <!-- #BeginEditable "doctitle" -->
  71. <title>Training Courses - Symmons Madge Associates Ltd</title>
  72. <meta name="robots" content="noindex">
  73. <!-- #EndEditable -->
  74. <link rel="stylesheet" href="../bma.css" type="text/css">
  75. <link rel="stylesheet" href="../print.css" type="text/css" media="print" />
  76. <!-- InstanceParam name="OptionalPageTitle" type="boolean" value="true" --><!-- InstanceParam name="OptionalBreadcrumbs" type="boolean" value="true" --><!-- InstanceParam name="Google Analytics Code" type="boolean" value="true" -->
  77. </head>
  78. <body><div class="printhide"><!-- #BeginLibraryItem "/Library/Masthead.lbi" -->
  79. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  80. <tr>
  81. <td width="150" rowspan="2"><a href="../home.html" target="_top">
  82. <!-- <img src="../images/smalogo_sml_party_hat.gif" ALT="Symmons Madge Associates Ltd home" width="124" height="90" border="0">
  83. -->
  84. <img src="../images/smalogo_sml.gif" ALT="Symmons Madge Associates Ltd home" width="124" height="64" border="0"> </a></td>
  85. <td><p class="tagline"><font size="4">Training for a Successful Future</font></p></td>
  86. </tr>
  87. <tr>
  88. <td valign="bottom"><table class="masthead" width="100%" height=25 border="0" cellpadding="0" cellspacing="0">
  89. <tr>
  90. <!-- <td width="5%" bgcolor="#FFFFFF">&nbsp;</td>-->
  91. <td align="left" valign="top"><img src="/images/corner_TL.gif" width="15" height="25"></td>
  92. <td>&nbsp;&nbsp;<a
  93. href="index.php" target="_top">Courses</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  94. href="../diary/diary.php" target="_top">Course&nbsp;Diary</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  95. href="../training/training-club.php" target="_top">Regional Training</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  96. href="../consultancy/index.html" target="_top">Consultancy</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  97. href="../search/index.php" target="_top">Search</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  98. href="../links.html" target="_top">Links</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  99. href="../company/about.html" target="_top">About us</a> &nbsp;<FONT color=#909090>:</FONT>&nbsp;&nbsp;<a
  100. href="../contact.html" target="_top">Contact</a>&nbsp;&nbsp;</td>
  101. </tr>
  102. </table></td>
  103. </tr>
  104. </table>
  105. <!-- #EndLibraryItem --></div>
  106. <div class="printonly">
  107. <div align="right"><img src="../images/smalogo_sml.gif" width="124" height="64" class="floatright"></div>
  108. </div>
  109. <div id="main">
  110. <p class="breadcrumbs printhide"><!-- #BeginEditable "breadcrumbs" --> <a href="../home.html" target="_top">Home</a>&nbsp;&gt;&nbsp;<a href="../training/index.html">Training</a>&nbsp;&gt;&nbsp;Course
  111. Portfolio<!-- #EndEditable --></p>
  112. <h1 class="bmapagetitle"><!-- #BeginEditable "title" --><a name="top"></a>Training
  113. Course Portfolio<!-- #EndEditable --></h1>
  114. <!-- #BeginEditable "body" --> <div class="bmabody">
  115. <table width="100%" border="0" cellspacing="0" cellpadding="5">
  116. <tr>
  117. <td width="200" align="left" valign="top" class="navleft">
  118. <?php do {
  119. echo "<li><a href=\"/courses/index.php?catid=",$row_categories['categoryid'],"\">",$row_categories['coursecategory'],"</a></li>";
  120. } while ($row_categories = mysql_fetch_assoc($categories)); ?>
  121. </ul>
  122. </td>
  123. <td valign="top"><div class="bmabody">
  124. <p>We offer a wide range of courses both on an open and in-house basis. We can also provide many other training courses to meet your specific needs. Please contact us even if the course you need is not listed or should you require a specific course developed.</p>
  125. <p>To find out more telephone: 01446 775959 or e-mail: <a href="mailto:admin@symmonsmadge.co.uk">admin@symmonsmadge.co.uk</a></p>
  126. <!-- iSearch search form -->
  127. <FORM METHOD="post" ACTION="/search/index.php">
  128. <TABLE BORDER="0" CELLPADDING="3" CELLSPACING="1">
  129. <TR ALIGN="center">
  130. <TD ALIGN="center"><INPUT MAXLENGTH="255" NAME="s" SIZE="40"></TD>
  131. <TD ALIGN="center"><INPUT TYPE="submit" VALUE="Search"></TD>
  132. </TR>
  133. </TABLE>
  134. <INPUT TYPE="hidden" NAME="action" VALUE="search">
  135. </FORM>
  136. <?php if (1 == $debug) { // Show if debug on
  137. echo "Catid: $catid";
  138. } // Show if debug on ?>
  139. <?php if (0 <> $catid) { // show if a cateogry selected ?>
  140. <h2><?php echo $row_catalog['coursecategory']; ?></h2>
  141. <?php
  142. if (1 == $debug) { // Show if debug on ?>
  143. <p>Subcategories: <?php echo $totalRows_subcategories ?> </p>
  144. <?php } // Show if debug on ?>
  145. <?php if ($totalRows_subcategories > 0) { // Show if recordset not empty ?>
  146. <?php
  147. $i = 1;
  148. do {
  149. $subcatsarry[$i] = $row_subcategories['subcategory'];
  150. $i++;
  151. } while ($row_subcategories = mysql_fetch_assoc($subcategories));
  152. // echo print_r($subcatsarry);
  153. $numsubcats = count($subcatsarry);
  154. // echo "<br>$numsubcats";
  155. $tablerows = ceil($numsubcats/2);
  156. // echo "<br>$tablerows";
  157. ?>
  158. <h4>Subcategories:</h4>
  159. <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="bmabody">
  160. <?php
  161. $i = 1;
  162. while ($i <= $tablerows) {
  163. echo "<tr valign=\"top\">\n<td><li><a href=\"#$i\"><strong>$subcatsarry[$i]</strong></a></li></td>\n";
  164. $j = $i + $tablerows;
  165. if ($j <= $numsubcats) {
  166. echo "<td><li><a href=\"#$j\"><strong>$subcatsarry[$j]</strong></a></li></td>\n</tr>\n";
  167. }
  168. $i++;
  169. }
  170. ?>
  171. </table>
  172. <p>&nbsp;</p>
  173. <p>&nbsp;</p>
  174. <p></p>
  175. <?php } // Show if recordset not empty ?>
  176. <?php
  177. $subcategories = mysql_query($query_subcategories, $bryanmadge) or die(mysql_error());
  178. $t = 0;
  179. $i = 0;
  180. for ($k = 0; $k <= $numsubcats; $k++) {
  181. $i = $i + 1;
  182. if ($row_catalog['catalog_id'] <> null) {
  183. $n = $row_catalog['subcategoryid'];
  184. if (1 == $debug) { // Show if debug on
  185. echo 'k: ',$k,"<br>";
  186. }
  187. if (($t <> 1) AND (0 == $k) AND ($row_catalog['subcategoryid'] <> null)) {
  188. $row_subcategories = mysql_fetch_assoc($subcategories);
  189. // $k = -1;
  190. $t = 1;
  191. }
  192. if (1 == $debug) { // Show if debug on
  193. echo 'k: ',$k,"<br>";
  194. }
  195. if (0 < $k) {
  196. $row_subcategories = mysql_fetch_assoc($subcategories);
  197. }
  198. if (1 == $debug) { // Show if debug on
  199. echo 'catalog.categoryid: ',$row_catalog['categoryid'],"<br>";
  200. echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";
  201. echo 'subcategories.id: ',$row_subcategories['id'],"<br>";
  202. echo 'k: ',$k,"<br>";
  203. } ?>
  204. </p>
  205. <table width="100%" border="0" class="bmabody">
  206. <tr>
  207. <td><h3><a name="<?php echo $i; ?>"></a><?php echo $row_subcategories['subcategory']; ?></h3></td>
  208. </tr>
  209. <tr>
  210. <td><ul>
  211. <?php do { ?>
  212. <li><a href="course-details.php?id=<?php echo $row_catalog['catalog_id']; ?>"><?php echo $row_catalog['title']; ?></a></li>
  213. <?php
  214. if (1 == $debug) { // Show if debug on
  215. echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";
  216. echo 'subcategories.id: ',$row_subcategories['id'],"<br>";
  217. echo 'catalog.subcategoryid: ',$row_catalog['subcategoryid'],"<br>";
  218. }
  219. if ($row_catalog['subcategoryid'] == null) {
  220. $row_catalog['subcategoryid'] = 0;
  221. }
  222. if ($row_subcategories['id'] == null) {
  223. $row_subcategories['id'] = 0;
  224. }
  225. if (1 == $debug) { // Show if debug on
  226. echo 'catalog.subcategoryid after check: ',$row_catalog['subcategoryid'],"<br>";
  227. }
  228. ?>
  229. <?php // } while (($row_catalog = mysql_fetch_assoc($catalog)) AND ($row_catalog['subcategoryid'] = $row_subcategories['id'])); ?>
  230. <?php } while (($row_catalog = mysql_fetch_assoc($catalog)) AND $row_subcategories['id'] == $row_catalog['subcategoryid']); ?>
  231. </ul></td>
  232. </tr>
  233. <tr>
  234. <td><p align="right"><a href="#top">back to top</a></p></td>
  235. </tr>
  236. </table>
  237. <?php
  238. }
  239. }
  240. ?>
  241. <?php } // show if a cateogry selected ?>
  242. </div></td>
  243. </tr>
  244. </table>
  245. </div>
  246. <!-- #EndEditable --></div>
  247. <div class="printhide"><!-- #BeginLibraryItem "/Library/Full Footer.lbi" --><hr width="65%">
  248. <p align="center"><!-- #BeginLibraryItem "/Library/Footer.lbi" --><!-- #EndLibraryItem --></p>
  249. <!-- #EndLibraryItem --><!-- #BeginLibraryItem "/Library/Legal footer.lbi" --><div align="center" class="bmabody"><font size="1"><a href="../company/legal.html">Legal
  250. Notice</a><br>
  251. Copyright &copy; Symmons Madge Associates Ltd, All Rights Reserved</font></div>
  252. <!-- #EndLibraryItem --><!-- Start of StatCounter Code -->
  253. <script type="text/javascript" language="javascript">
  254. var sc_project=337750;
  255. var sc_partition=1;
  256. </script>
  257. <script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript>
  258. <a href="http://www.statcounter.com/" target="_blank"><img src="http://c2.statcounter.com/counter.php?sc_project=337750&amp;java=0" alt="counter stats" border="0"></a>
  259. </noscript>
  260. <!-- End of StatCounter Code -->
  261. <!-- InstanceBeginEditable name="EditRegion1" --><!-- #BeginLibraryItem "/Library/Google Analytics PHP Include.lbi" -->
  262. <?php include_once($_SERVER['DOCUMENT_ROOT'] . "/analyticstracking.php"); ?><!-- #EndLibraryItem --><!-- InstanceEndEditable --></div>
  263. </body>
  264. <!-- InstanceEnd --></html>
  265. <?php
  266. mysql_free_result($categories);
  267. mysql_free_result($catalog);
  268. mysql_free_result($subcategories);
  269. ?>