csfr_protection(); $action = NULL; if (isset($_POST['action'])) { $action = trim($_POST['action']); } if (isset($action)) { switch ($action) { case "list_subject_types": $current_taxonomy = new Taxonomy(); if (isset($_POST['id'])) { $current_taxonomy->load((int) $_POST['id']); } else { $current_taxonomy->load(); } echo '<p><a href="index.php?p=form_add_subject_type">Add a new subject type</a></p>'; echo $current_taxonomy->get_taxonomy(); break; case "list_subject_types_DEPRECATED": // might have an ID value passed as well. $db = Database::get_instance(); $query = $db->prepare("SELECT id FROM subject_types"); if ($query->execute()) { $subjects_collection = array(); while ($row = $query->fetch()) { $new_subject = new SubjectType(); $new_subject->load($row['id']); $subjects_collection[] = $new_subject; } $output = '<table class="table table-striped table-bordered">'; $output .= '<thead><tr><td><strong>Subject types</strong></td><td><strong>Description</strong></td></tr></thead>'; foreach ($subjects_collection as $subject) {