} catch (ATCExceptionDBError $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCExceptionDBConn $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (ATCException $e) { header("HTTP/1.0 400 Bad Request"); echo 'Caught exception: ', $e->getMessage(), "\n"; } catch (Exception $e) { header("HTTP/1.0 500 Internal Server Error"); echo 'Caught exception: ', $e->getMessage(), "\n"; } } if (!isset($_GET['id'])) { $categories = $ATC->get_lesson_category(); ?> <table class="tablesorter"> <thead> <tr> <th> Code </th> <th> Category </th> <td> <a href="system_lesson_category.php?id=0" class="button new">New</a> </tr> </thead> <tbody> <?php foreach ($categories as $category) { echo '<tr>'; echo ' <td style="background-color:' . $category->colour . '; color:' . $category->text_colour . '">' . $category->category_short . '</td>';
}); } <?php } ?> }, close: function() { $( this ).dialog( "destroy" ); } }); return false; }); </script> <?php } else { $lesson = $ATC->get_lesson($_GET['id']); $categories = $ATC->get_lesson_category(); if (count($lesson)) { $lesson = $lesson[0]; } else { $lesson = new stdClass(); $lesson->lesson_id = 0; $lesson->lesson_category_id = 0; $lesson->code = null; $lesson->nzqa_qualifies = 0; $lesson->level = 0; $lesson->description = null; } ?> <form method="POST"> <label for="lesson_category_id">Lesson category</label><br /> <select name="lesson_category_id" id="lesson_category_id">