foreach ($clinical_presentations as $clinical_presentation) { if (isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["cp"]) && is_array($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["cp"]) && in_array($clinical_presentation["objective_id"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["cp"])) { $checked = "checked=\"checked\""; } else { $checked = ""; } $presentations[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $clinical_presentation["objective_name"], "value" => "cp_" . $clinical_presentation["objective_id"], "checked" => $checked); } } echo lp_multiple_select_popup("cp", $presentations, array("title" => "Select Clinical Presentations:", "submit_text" => "Apply", "cancel" => true, "submit" => true)); break; case "co": // Curriculum Objectives $objectives = $organisation; $children = array(); fetch_curriculum_objectives_children(0, $children); if ($children) { foreach ($children as $curriculum_objective) { if (isset($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["co"]) && is_array($_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["co"]) && in_array($curriculum_objective["objective_id"], $_SESSION[APPLICATION_IDENTIFIER]["events"]["filters"]["co"])) { $checked = "checked=\"checked\""; } else { $checked = ""; } $objectives[$ENTRADA_USER->getActiveOrganisation()]["options"][] = array("text" => $curriculum_objective["objective_name"], "value" => "co_" . $curriculum_objective["objective_id"], "checked" => $checked); } } echo lp_multiple_select_popup("co", $objectives, array("title" => "Select Curriculum Objectives:", "submit_text" => "Apply", "cancel" => true, "submit" => true)); break; case "topic": // Topics $topics = $organisation;
function fetch_curriculum_objectives_children($parent_id = 0, &$objectives) { global $db, $ENTRADA_USER, $translate; $parent_id = (int) $parent_id; if ($parent_id) { $query = "\tSELECT a.*\n\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\tWHERE a.`objective_active` = '1'\n\t\t\t\t\tAND a.`objective_parent` = " . $db->qstr($parent_id) . "\n\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()); } else { $objective_name = $translate->_("events_filter_controls"); $objective_name = $objective_name["co"]["global_lu_objectives_name"]; $query = "\tSELECT a.*\n\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\tWHERE a.`objective_active` = '1'\n\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n\t\t\t\t\tAND a.`objective_name` = " . $db->qstr($objective_name); } $results = $db->GetAll($query); if ($results) { foreach ($results as $result) { $children = fetch_curriculum_objectives_children($result["objective_id"], $objectives); if (!$children) { $objectives[] = $result; } } return true; } return false; }