} $clinical_presentation_objectives = events_fetch_objectives_structure($cp_objectives["objective_id"], $obj_ids); $output_objective_names = events_all_active_objectives($clinical_presentation_objectives); $row[$key] = implode("; ", $output_objective_names); break; case "curriculum_objectives": $curriculum_objectives = array(); $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\tFROM `event_objectives` eo\n\t\t\t\t\t\t\t\t\tJOIN `global_lu_objectives` glo\n\t\t\t\t\t\t\t\t\tON eo.`objective_id` = glo.`objective_id`\n\t\t\t\t\t\t\t\t\tWHERE eo.`event_id` = " . $db->qstr($event["event_id"]); $objs = $db->GetAll($query); $obj_ids = array(); if ($objs) { foreach ($objs as $o) { $obj_ids[] = $o["objective_id"]; } } $curriculum_objectives = events_fetch_objectives_structure($curriculum_objective_result["objective_id"], $obj_ids); $output_objective_names = events_all_active_objectives($curriculum_objectives); $row[$key] = implode("; ", $output_objective_names); break; case "attached_files": $attached_files = array(); $query = "\tSELECT *\n\t\t\t\t\t\t\t\t\tFROM `event_files` ef\n\t\t\t\t\t\t\t\t\tWHERE ef.`event_id` = " . $db->qstr($event["event_id"]); $items = $db->GetAll($query); if ($items) { foreach ($items as $i) { $attached_files[] = $f["file_name"]; } } $row[$key] = implode("; ", $attached_files); break; case "attached_quizzes":
function events_fetch_objectives_structure($parent_id, $used_ids, $org_id = 0) { global $db, $ENTRADA_USER; $org_id = $org_id == 0 ? $ENTRADA_USER->getActiveOrganisation() : (int) $org_id; $full_objective_list = array(); $query = "SELECT a.* FROM `global_lu_objectives` AS a\n\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\tWHERE a.`objective_parent` = " . $db->qstr($parent_id) . "\n\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\tORDER BY a.`objective_order` ASC"; $objective_children = $db->GetAll($query); if ($objective_children) { foreach ($objective_children as $objective) { $full_objective_list[$objective["objective_id"]] = array("objective_name" => $objective["objective_name"], "objective_active" => is_array($used_ids) && array_search($objective["objective_id"], $used_ids) !== false ? true : false, "children_active" => false, "children" => array()); $full_objective_list[$objective["objective_id"]]["children"] = events_fetch_objectives_structure($objective["objective_id"], $used_ids, $org_id); if (count($full_objective_list[$objective["objective_id"]]["children"])) { $full_objective_list[$objective["objective_id"]]["children_active"] = event_objectives_active($full_objective_list[$objective["objective_id"]]["children"]); } } } return $full_objective_list; }