Esempio n. 1
0
 * @link       http://www.ianmonroe.com
 * @since      File included in initial release
 *
 */
if (!isset($APP)) {
    die;
}
// $default_controller = $APP['controller_path'].'/aspect_controller.php';
$default_controller = 'src/controllers/subject_controller.php';
$post_data = 'action: "new_subject"';
$id = NULL;
if (isset($_GET['id'])) {
    $id = (int) trim($_GET['id']);
}
$taxonomy = new Taxonomy();
$taxonomy->load();
$ddm = new HTMLDropDown();
?>


<form class="form-horizontal" id="new_subject_form">
	<fieldset>
		<input name="action" type="hidden" value="new_subject" />
		<!-- Form Name -->
		<legend>Create a new Subject</legend>

		<!-- Text input-->
		<div class="form-group">
			<label class="col-md-4 control-label" for="name">Subject name</label>
			<div class="col-md-6">
				<input id="name" name="name" type="text" placeholder=""
 * @since      File included in initial release
 *
 */
// bootstrap the rest of the codebase.
require_once '../config.php';
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']);