$qu_arr[4] = "\t\tORDER BY a.`objective_order`";
    $query = implode(" ", $qu_arr);
    $objectives = $db->GetAll($query);
    if ($objectives) {
        $obj_array = array();
        foreach ($objectives as $objective) {
            $fields = array('objective_id' => $objective["objective_id"], 'objective_code' => $objective["objective_code"], 'objective_name' => $objective["objective_name"], 'objective_description' => $objective["objective_description"]);
            if ($course_id || $event_id || $assessment_id || $objective_ids_string) {
                $fields["mapped"] = $objective["mapped"];
                if ($course_id) {
                    $fields["child_mapped"] = course_objective_has_child_mapped($objective["objective_id"], $course_id, true);
                } else {
                    if ($event_id) {
                        $fields["child_mapped"] = event_objective_parent_mapped_course($objective["objective_id"], $event_id, true);
                    } else {
                        if ($assessment_id) {
                            $fields["child_mapped"] = assessment_objective_parent_mapped_course($objective["objective_id"], $assessment_id, true);
                        }
                    }
                }
            }
            $query = "\tSELECT a.* FROM `global_lu_objectives` AS a\n\t\t\t\t\t\tJOIN `objective_organisation` AS b ON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\tWHERE a.`objective_parent` = " . $db->qstr($objective["objective_id"]) . "\n\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id);
            $fields["has_child"] = $db->GetAll($query) ? true : false;
            $obj_array[] = $fields;
        }
        echo json_encode($obj_array);
    } else {
        echo json_encode(array('error' => 'No child objectives found for the selected objective.'));
    }
    exit;
}
 $mapped_objectives = $db->GetAll($query);
 $primary = false;
 $secondary = false;
 $tertiary = false;
 $hierarchical_objectives = array();
 $flat_objectives = array();
 $explicit_assessment_objectives = false;
 //array();
 $mapped_assessment_objectives = array();
 if ($mapped_objectives) {
     foreach ($mapped_objectives as $objective) {
         //if its mapped to the assessment, but not the course, then it belongs in the assessment objective list
         //echo $objective["objective_name"].' is '.$objective["mapped"].' and '.$objective["mapped_to_course"]."<br/>";
         if ($objective["mapped"] && !$objective["mapped_to_course"]) {
             //may not belong in assessment specific objective list if parent objective is mapped to course
             $response = assessment_objective_parent_mapped_course($objective["objective_id"], $ASSESSMENT_ID);
             if (!$response) {
                 $explicit_assessment_objectives[] = $objective;
             } else {
                 if (in_array($objective["objective_type"], array("curricular_objective", "course"))) {
                     //$objective_id = $objective["objective_id"];
                     $hierarchical_objectives[] = $objective;
                 } else {
                     $flat_objectives[] = $objective;
                 }
             }
         } else {
             if (in_array($objective["objective_type"], array("curricular_objective", "course"))) {
                 //$objective_id = $objective["objective_id"];
                 $hierarchical_objectives[] = $objective;
             } else {