Ejemplo n.º 1
0
$id = NULL;
if (isset($_GET['constraint'])) {
    $constraint = trim($_GET['constraint']);
}
if (isset($_GET['id'])) {
    $id = trim($_GET['id']);
}
$post_data = 'action: "list_subjects_of_type"';
if (isset($constraint)) {
    $post_data .= ', constraint: "' . $constraint . '"';
}
if (isset($id)) {
    $post_data .= ', id: "' . $id . '"';
}
$current_subject_type = new SubjectType();
$current_subject_type->load($id);
?>
<a href="index.php?p=form_add_subject&subject_type=<?php 
echo $id;
?>
"
	class="btn btn-primary pull-right" style="margin: 10px;">Add a new <?php 
echo $current_subject_type->type_name;
?>
</a>
<h3><?php 
echo $current_subject_type->type_name;
?>
</h3>
<p><?php 
echo $current_subject_type->type_description;
Ejemplo n.º 2
0
 function printTree($tree)
 {
     $output = '';
     if (!is_null($tree) && count($tree) > 0) {
         $output .= '<ul>';
         foreach ($tree as $node) {
             $tmp_subject_type = new SubjectType();
             $tmp_subject_type->load($node['id']);
             $output .= '<li>';
             $output .= $tmp_subject_type->get_link();
             if (!empty($node['children'])) {
                 $output .= $this->printTree($node['children']);
             }
             $output .= '</li>';
         }
         $output .= '</ul>';
     }
     return $output;
 }
Ejemplo n.º 3
0
 public function what_am_i()
 {
     $my_subject_type = new SubjectType();
     $my_subject_type->load($this->subject_type_id);
     return $my_subject_type->what_am_i();
 }
Ejemplo n.º 4
0
 public function get_parent_name()
 {
     if (empty($this->parent_id)) {
         return;
     } else {
         $parent = new SubjectType();
         $parent->load($this->parent_id);
         $output = $parent->get_link();
         if (!empty($parent->parent_id)) {
             $output .= ' -> ' . $parent->get_parent_name();
         }
         return $output;
     }
 }
         $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) {
             $output .= '<tr><td>';
             $output .= '<a href="index.php?p=list_subjects&constraint=subject_type&id=' . $subject->id . '">' . $subject->type_name . '</a>';
             $output .= '</td>';
             $output .= '<td>' . $subject->type_description . '</td>';
             $output .= '</tr>';
         }
         $output .= '</table>';
         echo $output;
     } else {
         echo "false";