Пример #1
0
            }
            if (isset($_POST["primary_ids"]) && $_POST["primary_ids"]) {
                $primary_ids = explode(",", $_POST["primary_ids"]);
                if (!is_array($primary_ids)) {
                    $primary_ids = array($_POST["primary_ids"]);
                }
            } else {
                $primary_ids = array();
            }
            if (isset($_POST["secondary_ids"]) && $_POST["secondary_ids"]) {
                $secondary_ids = explode(",", $_POST["secondary_ids"]);
                if (!is_array($secondary_ids)) {
                    $secondary_ids = array($_POST["secondary_ids"]);
                }
            } else {
                $secondary_ids = array();
            }
            if (isset($_POST["tertiary_ids"]) && $_POST["tertiary_ids"]) {
                $tertiary_ids = explode(",", $_POST["tertiary_ids"]);
                if (!is_array($tertiary_ids)) {
                    $tertiary_ids = array($_POST["tertiary_ids"]);
                }
            } else {
                $tertiary_ids = array();
            }
            list($objectives, $top_level_id) = courses_fetch_objectives($org_id, $course_ids, -1, 0, false, array("primary" => $primary_ids, "secondary" => $secondary_ids, "tertiary" => $tertiary_ids), $event_id);
            echo course_objectives_in_list($objectives, $top_level_id, $top_level_id, true, false, 1, false, true, "primary", true);
        }
    }
    exit;
}
Пример #2
0
             if ($objective_id = (int) $objective_id) {
                 $query = "\tSELECT a.* FROM `global_lu_objectives` AS a\n                                                        JOIN `objective_organisation` AS b\n                                                        ON a.`objective_id` = b.`objective_id`\n                                                        WHERE a.`objective_id` = " . $db->qstr($objective_id) . "\n                                                        AND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n                                                        AND a.`objective_active` = '1'";
                 $result = $db->GetRow($query);
                 if ($result) {
                     if (!$db->AutoExecute("event_objectives", array("event_id" => $EVENT_ID, "objective_details" => $objective_text, "objective_id" => $objective_id, "objective_type" => "course", "updated_date" => time(), "updated_by" => $ENTRADA_USER->getID()), "INSERT")) {
                         $ERROR++;
                         $ERRORSTR[] = "There was an error when trying to insert a "course objective" into the system. System administrators have been informed of this error; please try again later.";
                         application_log("error", "Unable to insert a new course objective to the database when adding a new event. Database said: " . $db->ErrorMsg());
                     }
                 }
             }
         }
         /**
          * Changes have been made so update the $curriculum_objectives_list variable.
          */
         list($curriculum_objectives_list, $top_level_id) = courses_fetch_objectives($event_info["organisation_id"], array($event_info["course_id"]), -1, 1, false, false, $EVENT_ID, true);
     }
 }
 // Update MeSH keywords
 if (isset($_POST["delete_keywords"])) {
     if (trim($_POST["delete_keywords"][0]) !== "") {
         $lis = explode(",", $_POST["delete_keywords"][0]);
         $count = count($lis);
         if ($count > 0) {
             // Removed the keywords in the delete array.
             for ($i = 0; $i < $count; $i++) {
                 if (trim($lis[$i]) != "") {
                     $query = "  DELETE \n                                                                FROM `event_keywords` \n                                                                WHERE keyword_id = " . $db->qstr($lis[$i]) . " AND event_id = " . $db->qstr($EVENT_ID);
                     $db->Execute($query);
                 }
             }
Пример #3
0
							<label for="director_message" class="form-nrequired control-label">&nbsp;</label>
							<div class="controls">
								<h3>Director's Messages</h3>
								<?php 
                    echo trim(strip_selected_tags($course_details["course_message"], array("font")));
                    ?>
							</div>
						</div>
					<?php 
                }
                ?>
				</div>

				<?php 
                $show_objectives = false;
                list($objectives, $top_level_id) = courses_fetch_objectives($ORGANISATION_ID, array($COURSE_ID));
                foreach ($objectives["objectives"] as $objective) {
                    if (isset($objective["primary"]) && $objective["primary"] || isset($objective["secondary"]) && $objective["secondary"] || isset($objective["tertiary"]) && $objective["tertiary"]) {
                        $show_objectives = true;
                        break;
                    }
                }
                $query = "\tSELECT COUNT(*) FROM course_objectives WHERE course_id = " . $db->qstr($COURSE_ID);
                $result = $db->GetOne($query);
                if ($result) {
                    ?>
					<script type="text/javascript">
					function renewList (hierarchy) {
						if (hierarchy != null && hierarchy) {
							hierarchy = 1;
						} else {
Пример #4
0
         }
         if ($ERROR) {
             echo display_error();
             $STEP = 1;
         }
         break;
     case "1":
     default:
         break;
 }
 //Display page
 switch ($STEP) {
     case "2":
         $leaf_objs = array();
         foreach ($course_objectives as $co) {
             list($report_objectives, $top_level_id) = courses_fetch_objectives($course_details["organisation_id"], $course_details["course_id"], $co["objective_parent"], $co["objective_id"]);
             if (isset($report_objectives) && isset($report_objectives["objectives"]) && $report_objectives["objectives"]) {
                 //Fetch the active curriculum period start and finish dates
                 $query = "\tSELECT *\n\t\t\t\t\t\t\t\tFROM `curriculum_periods` a\n\t\t\t\t\t\t\t\tJOIN `curriculum_type_organisation` b\n\t\t\t\t\t\t\t\tON a.`curriculum_type_id` = b.`curriculum_type_id`\n\t\t\t\t\t\t\t\tWHERE a.`active` = 1\n\t\t\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($course_details["organisation_id"]) . "\n\t\t\t\t\t\t\t\tAND " . $db->qstr(time()) . " BETWEEN a.start_date AND a.finish_date;";
                 $curr_period = $db->getRow($query);
                 foreach ($report_objectives["objectives"] as $obj_id => $obj_details) {
                     $is_parent = true;
                     foreach ($report_objectives["objectives"] as $id => $details) {
                         if (array_search($obj_id, $details["parent_ids"]) === false) {
                             $is_parent = false;
                         } else {
                             $is_parent = true;
                             break;
                         }
                     }
                     if (!$is_parent) {
Пример #5
0
                $query = "\tSELECT a.`course_id`\n                            FROM `community_courses` AS a\n                            JOIN `courses` AS b\n                            ON a.`course_id` = b.`course_id`\n                            WHERE b.`course_active` = '1'\n                            AND a.`community_id` = " . $db->qstr($COMMUNITY_ID);
                $results = $db->GetAll($query);
                if ($results) {
                    foreach ($results as $course_id) {
                        $course_ids[] = $course_id["course_id"];
                        if ($course_ids_str) {
                            $course_ids_str .= ", " . $db->qstr($course_id["course_id"]);
                            $clean_ids_str .= "," . $course_id["course_id"];
                        } else {
                            $course_ids_str = $db->qstr($course_id["course_id"]);
                            $clean_ids_str = "," . $course_id["course_id"];
                        }
                    }
                }
                $show_objectives = false;
                list($objectives, $top_level_id) = courses_fetch_objectives($ENTRADA_USER->getActiveOrganisation(), $course_ids, -1, 1, false);
                ?>
                <script type="text/javascript">
                function renewList (hierarchy) {
                    if (hierarchy != null && hierarchy) {
                        hierarchy = 1;
                    } else {
                        hierarchy = 0;
                    }
                    new Ajax.Updater('objectives_list', '<?php 
                echo ENTRADA_URL;
                ?>
/api/objectives.api.php',
                        {
                            method:	'post',
                            parameters: 'course_ids=<?php 
Пример #6
0
                        ?>
                                </ul>
                            </div>
                            <?php 
                    }
                    ?>
                    </div>

                    <div>
                        <?php 
                    $query = "SELECT b.`objective_id`, b.`objective_name`\n                                    FROM `event_objectives` AS a\n                                    LEFT JOIN `global_lu_objectives` AS b\n                                    ON b.`objective_id` = a.`objective_id`\n                                    JOIN `objective_organisation` AS c\n                                    ON b.`objective_id` = c.`objective_id`\n                                    AND c.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n                                    WHERE a.`objective_type` = 'event'\n                                    AND b.`objective_active` = '1'\n                                    AND a.`event_id` = " . $db->qstr($EVENT_ID) . "\n                                    ORDER BY b.`objective_name` ASC;";
                    $clinical_presentations = $db->GetAll($query);
                    $show_event_objectives = clean_input($event_info["event_objectives"], array("notags", "nows")) != "" ? true : false;
                    $show_clinical_presentations = $clinical_presentations ? true : false;
                    $show_curriculum_objectives = false;
                    list($curriculum_objectives, $top_level_id) = courses_fetch_objectives($ENTRADA_USER->getActiveOrganisation(), array($event_info["course_id"]), -1, 1, false, false, $EVENT_ID, true);
                    $temp_objectives = $curriculum_objectives["objectives"];
                    foreach ($temp_objectives as $objective_id => $objective) {
                        unset($curriculum_objectives["used_ids"][$objective_id]);
                        $curriculum_objectives["objectives"][$objective_id]["objective_primary_children"] = 0;
                        $curriculum_objectives["objectives"][$objective_id]["objective_secondary_children"] = 0;
                        $curriculum_objectives["objectives"][$objective_id]["objective_tertiary_children"] = 0;
                    }
                    foreach ($curriculum_objectives["objectives"] as $objective_id => $objective) {
                        if (isset($objective["event_objective"]) && $objective["event_objective"]) {
                            foreach ($objective["parent_ids"] as $parent_id) {
                                if ($objective["primary"] || $objective["secondary"] || $objective["tertiary"] || $curriculum_objectives["objectives"][$parent_id]["primary"] || $curriculum_objectives["objectives"][$parent_id]["secondary"] || $curriculum_objectives["objectives"][$parent_id]["tertiary"]) {
                                    $curriculum_objectives["objectives"][$parent_id]["objective_" . ($objective["primary"] || $curriculum_objectives["objectives"][$parent_id]["primary"] && !$objective["secondary"] && !$objective["tertiary"] ? "primary" : ($objective["secondary"] || $curriculum_objectives["objectives"][$parent_id]["secondary"] && !$objective["primary"] && !$objective["tertiary"] ? "secondary" : "tertiary")) . "_children"]++;
                                    if ($curriculum_objectives["objectives"][$parent_id]["primary"]) {
                                        $curriculum_objectives["objectives"][$objective_id]["primary"] = true;
                                    } elseif ($curriculum_objectives["objectives"][$parent_id]["secondary"]) {
Пример #7
0
     $PAGE_TYPE = $page_details["page_type"];
     $results = $db->GetAll("SELECT `course_id` FROM `community_courses` WHERE `community_id` = " . $db->qstr($COMMUNITY_ID));
     $course_ids = array();
     $course_ids_string = "";
     foreach ($results as $course_id) {
         $course_ids[] = $course_id["course_id"];
         if ($course_ids_string) {
             $course_ids_string .= "," . $course_id["course_id"];
         } else {
             $course_ids_string .= $course_id["course_id"];
         }
     }
     $query = "\tSELECT `organisation_id` FROM `courses` WHERE `course_id` = " . $db->qstr($results[0]["course_id"]);
     $org_id = $db->GetOne($query);
     if ($PAGE_TYPE == "course" && $page_details["page_url"] == "objectives") {
         list($course_objectives, $top_level_id) = courses_fetch_objectives($org_id, $course_ids, -1, 1, false, false, 0, true);
     }
 }
 // Error Checking
 switch ($STEP) {
     case 2:
         /**
          * The "course" page type is meant to have more static unchangeable poperties than
          * a normal page, so the page_type, menu_title, permissions, and page_title
          * will not be set when the page type is currently set to "course"
          */
         if (array_search($PAGE_ID, isset($COMMUNITY_LOCKED_PAGE_IDS) && $COMMUNITY_LOCKED_PAGE_IDS ? $COMMUNITY_LOCKED_PAGE_IDS : array()) === false) {
             /**
              * Required field "page_type" / Page Type (Unchangeable for course content pages).
              */
             foreach ($PAGE_TYPES as $PAGE) {
Пример #8
0
/**
 *
 * @global object $db
 * @param type $org_id - the organisation you are finding objectives for
 * @param type $course_ids
 * @param type $top_level_id - the id of the objective that is the top level, if calling from a module it should be -1
 * @param type $parent_id - the parent id of the top level curriculum objective, default to 1 if this is called from a module
 * @param type $objectives
 * @param type $objective_ids
 * @param type $event_id
 * @param type $fetch_all_text
 * @return an array containing the objectives and the top level id of the curriculum objectives, use list($curriculum_objectives,$top_level_id) to retrieve the returned values
 */
function courses_fetch_objectives($org_id, $course_ids, $top_level_id = -1, $parent_id = 1, $objectives = false, $objective_ids = false, $event_id = 0, $fetch_all_text = false)
{
    global $db, $translate;
    if (!$objectives && is_array($course_ids)) {
        $objectives = array("used" => array(), "unused" => array(), "objectives" => array(), "used_ids" => array(), "primary_ids" => array(), "secondary_ids" => array(), "tertiary_ids" => array());
        $escaped_course_ids = "";
        for ($i = 0; $i < count($course_ids) - 1; $i++) {
            $escaped_course_ids .= $db->qstr($course_ids[$i]) . ",";
        }
        $escaped_course_ids .= $db->qstr($course_ids[count($course_ids) - 1]);
        $query = "\tSELECT b.`objective_name`, a.`objective_id`, a.`importance`, a.`objective_details`, a.`course_id`, b.`objective_parent`, b.`objective_order`\n\t\t\t\t\t\tFROM `course_objectives` AS a\n\t\t\t\t\t\tJOIN `global_lu_objectives` AS b\n\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\tJOIN `objective_organisation` AS c\n\t\t\t\t\t\tON b.`objective_id` = c.`objective_id`\n\t\t\t\t\t\tWHERE " . ($fetch_all_text ? "" : "`importance` != '0'\n\t\t\t\t\t\tAND ") . "`course_id` IN (" . $escaped_course_ids . ")\n\t\t\t\t\t\tAND a.`objective_type` = 'course'\n\t\t\t\t\t\tAND c.`organisation_id` = " . $db->qstr($org_id) . "\n                        AND a.`active` = '1'\n\t\t\t\t\t\tUNION\n\t\t\t\t\t\tSELECT b.`objective_name`, b.`objective_id`, a.`importance`, a.`objective_details`, a.`course_id`, b.`objective_parent`, b.`objective_order`\n\t\t\t\t\t\tFROM `course_objectives` AS a\n\t\t\t\t\t\tJOIN `global_lu_objectives` AS b\n\t\t\t\t\t\tON a.`objective_id` = b.`objective_parent`\n\t\t\t\t\t\tAND `course_id` IN (" . $escaped_course_ids . ")\n\t\t\t\t\t\tJOIN `objective_organisation` AS c\n\t\t\t\t\t\tON b.`objective_id` = c.`objective_id`\n\t\t\t\t\t\tWHERE " . ($fetch_all_text ? "" : "`importance` != '0'\n\t\t\t\t\t\tAND a.`objective_type` = 'course'\n\t\t\t\t\t\tAND ") . "a.`objective_type` = 'course'\n\t\t\t\t\t\tAND c.`organisation_id` = " . $db->qstr($org_id) . "\n                        AND a.`active` = '1'\n\t\t\t\t\t\tAND b.`objective_id` NOT IN (\n\t\t\t\t\t\t\tSELECT a.`objective_id`\n\t\t\t\t\t\t\tFROM `course_objectives` AS a\n\t\t\t\t\t\t\tJOIN `global_lu_objectives` AS b\n\t\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\t\tWHERE " . ($fetch_all_text ? "" : "`importance` != '0'\n\t\t\t\t\t\t\tAND ") . "`course_id` IN (" . $escaped_course_ids . ")\n\t\t\t\t\t\t\tAND `objective_type` = 'course'\n\t\t\t\t\t\t)\n\t\t\t\t\t\tORDER BY `objective_parent`, `objective_order` ASC";
        $results = $db->GetAll($query);
        if ($results && !is_array($objective_ids)) {
            foreach ($results as $result) {
                if ($result["importance"] == 1) {
                    $objectives["primary_ids"][$result["objective_id"]] = $result["objective_id"];
                } elseif ($result["importance"] == 2) {
                    $objectives["secondary_ids"][$result["objective_id"]] = $result["objective_id"];
                } elseif ($result["importance"] == 3) {
                    $objectives["tertiary_ids"][$result["objective_id"]] = $result["objective_id"];
                }
                $objectives["used_ids"][$result["objective_id"]] = $result["objective_id"];
                $objectives["objectives"][$result["objective_id"]] = array();
                $objectives["objectives"][$result["objective_id"]]["objective_details"] = $result["objective_details"];
            }
        }
        if (is_array($objective_ids)) {
            if (isset($objective_ids["primary"]) && is_array($objective_ids["primary"])) {
                foreach ($objective_ids["primary"] as $objective_id) {
                    if (array_search($objective_id, $objectives["used_ids"]) === false) {
                        $objectives["primary_ids"][$objective_id] = $objective_id;
                        $objectives["used_ids"][$objective_id] = $objective_id;
                    }
                }
            }
            if (isset($objective_ids["secondary"]) && is_array($objective_ids["secondary"])) {
                foreach ($objective_ids["secondary"] as $objective_id) {
                    if (array_search($objective_id, $objectives["used_ids"]) === false) {
                        $objectives["secondary_ids"][$objective_id] = $objective_id;
                        $objectives["used_ids"][$objective_id] = $objective_id;
                    }
                }
            }
            if (isset($objective_ids["tertiary"]) && is_array($objective_ids["tertiary"])) {
                foreach ($objective_ids["tertiary"] as $objective_id) {
                    if (array_search($objective_id, $objectives["used_ids"]) === false) {
                        $objectives["tertiary_ids"][$objective_id] = $objective_id;
                        $objectives["used_ids"][$objective_id] = $objective_id;
                    }
                }
            }
        }
    }
    if ($top_level_id == -1) {
        $objective_name = $translate->_("events_filter_controls");
        $objective_name = $objective_name["co"]["global_lu_objectives_name"];
        $query = "SELECT a.* FROM `global_lu_objectives` AS a\n\t\t\t\t\tINNER JOIN `objective_organisation` AS b\n\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\tWHERE b.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\t\tAND `objective_active` = '1'\n\t\t\t\t\tAND a.`objective_name` LIKE " . $db->qstr($objective_name) . "\n\t\t\t\t\tORDER BY a.`objective_order` ASC ";
    } else {
        $query = "SELECT a.* FROM `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_parent` = " . $db->qstr($parent_id) . "\n\t\t\t\t\tAND a.`objective_active` = '1'\n\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\t\tORDER BY a.`objective_order` ASC";
    }
    $results = $db->GetAll($query);
    if ($results) {
        if ($top_level_id == -1) {
            $top_level_id = $results[0]["objective_id"];
            $parent_id = $top_level_id;
            $query = "SELECT a.* FROM `global_lu_objectives` AS a\n\t\t\t\t\t\tJOIN `objective_organisation` AS b\n\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\tWHERE a.`objective_parent` = " . $db->qstr($parent_id) . "\n\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\t\t\tAND a.`objective_active` = '1'\n\t\t\t\t\t\tORDER BY a.`objective_order` ASC";
            $results = $db->GetAll($query);
        }
        foreach ($results as $result) {
            if ($parent_id == $top_level_id) {
                $objectives["objectives"][$result["objective_id"]]["objective_primary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["objective_secondary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["objective_tertiary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["children_primary"] = 0;
                $objectives["objectives"][$result["objective_id"]]["children_secondary"] = 0;
                $objectives["objectives"][$result["objective_id"]]["children_tertiary"] = 0;
                $objectives["objectives"][$result["objective_id"]]["name"] = $result["objective_name"];
                $objectives["objectives"][$result["objective_id"]]["description"] = isset($objectives["objectives"][$result["objective_id"]]["objective_details"]) && $objectives["objectives"][$result["objective_id"]]["objective_details"] ? $objectives["objectives"][$result["objective_id"]]["objective_details"] : $result["objective_description"];
                $objectives["objectives"][$result["objective_id"]]["parent"] = $top_level_id;
                $objectives["objectives"][$result["objective_id"]]["parent_ids"] = array();
                if (is_array($objectives["primary_ids"]) && array_search($result["objective_id"], $objectives["primary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["primary"] = true;
                } else {
                    $objectives["objectives"][$result["objective_id"]]["primary"] = false;
                }
                if (is_array($objectives["secondary_ids"]) && array_search($result["objective_id"], $objectives["secondary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["secondary"] = true;
                } else {
                    $objectives["objectives"][$result["objective_id"]]["secondary"] = false;
                }
                if (is_array($objectives["tertiary_ids"]) && array_search($result["objective_id"], $objectives["tertiary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["tertiary"] = true;
                } else {
                    $objectives["objectives"][$result["objective_id"]]["tertiary"] = false;
                }
            } else {
                $objectives["objectives"][$result["objective_id"]]["objective_primary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["objective_secondary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["objective_tertiary_children"] = 0;
                $objectives["objectives"][$result["objective_id"]]["name"] = $result["objective_name"];
                $objectives["objectives"][$result["objective_id"]]["description"] = isset($objectives["objectives"][$result["objective_id"]]["objective_details"]) && $objectives["objectives"][$result["objective_id"]]["objective_details"] ? $objectives["objectives"][$result["objective_id"]]["objective_details"] : $result["objective_description"];
                $objectives["objectives"][$result["objective_id"]]["parent"] = $parent_id;
                $objectives["objectives"][$result["objective_id"]]["parent_ids"] = $objectives["objectives"][$parent_id]["parent_ids"];
                $objectives["objectives"][$result["objective_id"]]["parent_ids"][] = $parent_id;
                if (is_array($objectives["primary_ids"]) && array_search($result["objective_id"], $objectives["primary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["primary"] = true;
                    foreach ($objectives["objectives"][$result["objective_id"]]["parent_ids"] as $parent_id) {
                        if ($parent_id != $top_level_id) {
                            $objectives["objectives"][$parent_id]["objective_primary_children"]++;
                        }
                    }
                } else {
                    $objectives["objectives"][$result["objective_id"]]["primary"] = false;
                }
                if (is_array($objectives["secondary_ids"]) && array_search($result["objective_id"], $objectives["secondary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["secondary"] = true;
                    foreach ($objectives["objectives"][$result["objective_id"]]["parent_ids"] as $parent_id) {
                        if ($parent_id != $top_level_id) {
                            $objectives["objectives"][$parent_id]["objective_secondary_children"]++;
                        }
                    }
                } else {
                    $objectives["objectives"][$result["objective_id"]]["secondary"] = false;
                }
                if (is_array($objectives["tertiary_ids"]) && array_search($result["objective_id"], $objectives["tertiary_ids"]) !== false) {
                    $objectives["objectives"][$result["objective_id"]]["tertiary"] = true;
                    foreach ($objectives["objectives"][$result["objective_id"]]["parent_ids"] as $parent_id) {
                        if ($parent_id != $top_level_id) {
                            $objectives["objectives"][$parent_id]["objective_tertiary_children"]++;
                        }
                    }
                } else {
                    $objectives["objectives"][$result["objective_id"]]["tertiary"] = false;
                }
            }
            list($objectives, $top_level_id) = courses_fetch_objectives($org_id, $course_ids, $top_level_id, $result["objective_id"], $objectives);
        }
    }
    if ($parent_id == $top_level_id) {
        foreach ($objectives["primary_ids"] as $primary_id) {
            if (is_array($objectives["objectives"][$primary_id]["parent_ids"])) {
                foreach ($objectives["objectives"][$primary_id]["parent_ids"] as $parent_id) {
                    if (array_search($parent_id, $objectives["used_ids"]) !== false) {
                        unset($objectives["used_ids"][$primary_id]);
                        unset($objectives["primary_ids"][$primary_id]);
                        $objectives["objectives"][$primary_id]["primary"] = false;
                        $objectives["objectives"][$parent_id]["objective_primary_children"]--;
                    }
                }
            }
        }
        foreach ($objectives["secondary_ids"] as $secondary_id) {
            if (is_array($objectives["objectives"][$secondary_id]["parent_ids"])) {
                foreach ($objectives["objectives"][$secondary_id]["parent_ids"] as $parent_id) {
                    if (array_search($parent_id, $objectives["used_ids"]) !== false) {
                        unset($objectives["used_ids"][$secondary_id]);
                        unset($objectives["secondary_ids"][$secondary_id]);
                        $objectives["objectives"][$secondary_id]["secondary"] = false;
                        $objectives["objectives"][$parent_id]["objective_secondary_children"]--;
                    }
                }
            }
        }
        foreach ($objectives["tertiary_ids"] as $tertiary_id) {
            if (is_array($objectives["objectives"][$tertiary_id]["parent_ids"])) {
                foreach ($objectives["objectives"][$tertiary_id]["parent_ids"] as $parent_id) {
                    if (array_search($parent_id, $objectives["used_ids"]) !== false) {
                        unset($objectives["used_ids"][$tertiary_id]);
                        unset($objectives["tertiary_ids"][$tertiary_id]);
                        $objectives["objectives"][$tertiary_id]["tertiary"] = false;
                        $objectives["objectives"][$parent_id]["objective_tertiary_children"]--;
                    }
                }
            }
        }
    }
    if ($event_id) {
        foreach ($objectives["objectives"] as $objective_id => $objective) {
            if (isset($event_objectives_string) && $event_objectives_string) {
                $event_objectives_string .= ", " . $db->qstr($objective_id);
            } else {
                $event_objectives_string = $db->qstr($objective_id);
            }
        }
        $event_objectives = $db->GetAll("\tSELECT a.* FROM `event_objectives` AS a\n\t\t\t\t\t\t\t\t\t\t\tJOIN `global_lu_objectives` AS b\n\t\t\t\t\t\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\t\t\t\t\t\tJOIN `objective_organisation` AS c\n\t\t\t\t\t\t\t\t\t\t\tON b.`objective_id` = c.`objective_id`\n\t\t\t\t\t\t\t\t\t\t\tWHERE a.`event_id` = " . $db->qstr($event_id) . "\n\t\t\t\t\t\t\t\t\t\t\tAND c.`organisation_id` = " . $db->qstr($org_id) . "\n\t\t\t\t\t\t\t\t\t\t\tAND a.`objective_type` = 'course'\n\t\t\t\t\t\t\t\t\t\t\tAND a.`objective_id` IN (" . $event_objectives_string . ")\n\t\t\t\t\t\t\t\t\t\t\tORDER BY b.`objective_order` ASC");
        if ($event_objectives) {
            foreach ($event_objectives as $objective) {
                if ($objectives["objectives"][$objective["objective_id"]]["primary"] || $objectives["objectives"][$objective["objective_id"]]["secondary"] || $objectives["objectives"][$objective["objective_id"]]["tertiary"] || is_array($objectives["objectives"][$objective["objective_id"]]["parent_ids"]) && $objectives["used_ids"] && count(array_intersect($objectives["objectives"][$objective["objective_id"]]["parent_ids"], $objectives["used_ids"]))) {
                    $objectives["objectives"][$objective["objective_id"]]["event_objective_details"] = $objective["objective_details"];
                    $objectives["objectives"][$objective["objective_id"]]["event_objective"] = true;
                }
            }
        }
    }
    return array($objectives, $top_level_id);
}
Пример #9
0
                        } else {
                            $clinical_presentations = array();
                        }
                    } else {
                        $query = "SELECT `objective_id`\n\t\t\t\t\t\t\t\t\tFROM `course_objectives`\n\t\t\t\t\t\t\t\t\tWHERE `course_id` = " . $COURSE_ID . "\n\t\t\t\t\t\t\t\t\tAND `objective_type` = 'event'\n                                    AND `active` = '1'";
                        $results = $db->GetAll($query);
                        if ($results) {
                            foreach ($results as $result) {
                                $clinical_presentations[$result["objective_id"]] = $clinical_presentations_list[$result["objective_id"]];
                            }
                        }
                    }
                    /**
                     * Fetch the Curriculum Objective details.
                     */
                    list($curriculum_objectives_list, $top_level_id) = courses_fetch_objectives($ENTRADA_USER->getActiveOrganisation(), array($COURSE_ID), -1, 1, false, false, 0, true);
                    $curriculum_objectives = array();
                    if (isset($_POST["checked_objectives"]) && ($checked_objectives = $_POST["checked_objectives"]) && is_array($checked_objectives)) {
                        foreach ($checked_objectives as $objective_id => $status) {
                            if ($objective_id = (int) $objective_id) {
                                if (isset($_POST["objective_text"][$objective_id]) && ($tmp_input = clean_input($_POST["objective_text"][$objective_id], array("notags")))) {
                                    $objective_text = $tmp_input;
                                } else {
                                    $objective_text = false;
                                }
                                $curriculum_objectives[$objective_id] = $objective_text;
                            }
                        }
                    }
                    ?>
					<h1>Add Assessment</h1>
<?php

if (isset($_POST["org_id"])) {
    $ORGANISATION_ID = $_POST["org_id"];
    if (isset($_POST["posted_objectives"])) {
        $posted_objectives = $POST["posted_objectives"];
    } else {
        $posted_objectives = null;
    }
    list($course_objectives, $top_level_id) = courses_fetch_objectives($ORGANISATION_ID, array(0), -1, 0, false, $posted_objectives);
    if (is_array($course_objectives["primary_ids"])) {
        foreach ($course_objectives["primary_ids"] as $objective_id) {
            echo "<input type=\"hidden\" class=\"primary_objectives\" id=\"primary_objective_" . $objective_id . "\" name=\"primary_objectives[]\" value=\"" . $objective_id . "\" />\n";
        }
    }
    if (is_array($course_objectives["secondary_ids"])) {
        foreach ($course_objectives["secondary_ids"] as $objective_id) {
            echo "<input type=\"hidden\" class=\"secondary_objectives\" id=\"secondary_objective_" . $objective_id . "\" name=\"secondary_objectives[]\" value=\"" . $objective_id . "\" />\n";
        }
    }
    if (is_array($course_objectives["tertiary_ids"])) {
        foreach ($course_objectives["tertiary_ids"] as $objective_id) {
            echo "<input type=\"hidden\" class=\"tertiary_objectives\" id=\"tertiary_objective_" . $objective_id . "\" name=\"tertiary_objectives[]\" value=\"" . $objective_id . "\" />\n";
        }
    }
    if (!count($course_objectives["objectives"])) {
        $NOTICE = 1;
        $NOTICESTR = null;
        $NOTICESTR[] = "No Curriculum Objectives were found for this organisation.";
        echo display_notice();
    } else {
Пример #11
0
    $ERROR++;
    $ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
    echo display_error();
    application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
    if ($COURSE_ID) {
        if (!$ORGANISATION_ID) {
            $query = "SELECT `organisation_id` FROM `courses` WHERE `course_id` = " . $db->qstr($COURSE_ID);
            $result = $db->GetOne($query);
            if ($result) {
                $ORGANISATION_ID = (int) $result;
            } else {
                $ORGANISATION_ID = 1;
            }
        }
        list($course_objectives, $top_level_id) = courses_fetch_objectives($ORGANISATION_ID, array($COURSE_ID), -1, 1, false, false, 0, true);
        $query = "\tSELECT * FROM `courses`\n\t\t\t\t\t\t\tWHERE `course_id` = " . $db->qstr($COURSE_ID) . "\n\t\t\t\t\t\t\tAND `course_active` = '1'";
        $course_details = $db->GetRow($query);
        if ($course_details) {
            if (!$ENTRADA_ACL->amIAllowed(new CourseContentResource($course_details["course_id"], $course_details["organisation_id"]), 'update')) {
                application_log("error", "A program coordinator attempted to modify content for a course [" . $COURSE_ID . "] that they were not the coordinator of.");
                header("Location: " . ENTRADA_URL . "/admin/" . $MODULE);
                exit;
            } else {
                $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/" . $MODULE . "?" . replace_query(array("section" => "content", "id" => $COURSE_ID)), "title" => $module_singular_name . " Content");
                $query = "\tSELECT a.*, b.`community_url`\n\t\t\t\t\t\t\tFROM `community_courses` AS a\n\t\t\t\t\t\t\tJOIN `communities` AS b\n\t\t\t\t\t\t\tON a.`community_id` = b.`community_id`\n\t\t\t\t\t\t\tWHERE a.`course_id` = " . $db->qstr($COURSE_ID);
                $course_community = $db->getRow($query);
                $PROCESSED = $course_details;
                /**
                 * If the type variable is set, there should be some work to do.
                 */
Пример #12
0
             $eventtypes_html .= "</tr>";
         }
         $eventtypes_html .= "</tbody>";
         $eventtypes_html .= "<tfoot>";
         $eventtypes_html .= "<tr>";
         $eventtypes_html .= "<td><strong>Totals</strong></td>";
         $eventtypes_html .= "<td><strong>" . $result["total_events"] . "</strong></td>";
         $eventtypes_html .= "<td><strong>" . display_hours($result["total_duration"]) . " hrs</strong></td>";
         $eventtypes_html .= "</tr>";
         $eventtypes_html .= "</tfoot>";
         $eventtypes_html .= "</table>";
     }
 }
 $ENTRADA_USER = new User();
 $ENTRADA_USER->setActiveOrganisation($org_id);
 list($objectives, $top_level_id) = courses_fetch_objectives($org_id, array($course->getID()), -1, 1, false);
 $pages_html["course_objectives"] = course_objectives_in_list($objectives, $top_level_id, $top_level_id, false, false, 1, false);
 if ($objectives) {
     $pages_html["course_objectives"] = "<h1>Course Objectives</h1>" . $pages_html["course_objectives"];
 } else {
     unset($pages_html["course_objectives"]);
 }
 /* Gradebook */
 $query = "\tSELECT a.`course_id`, a.`assessment_id`, a.`name`, a.`grade_weighting`, a.`order`, c.`title`\n\t\t\t\t\t\t\t\t\tFROM `assessments` AS a\n\t\t\t\t\t\t\t\t\tJOIN `course_audience` AS b\n\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\tAND a.`cohort` = b.`audience_value`\n\t\t\t\t\t\t\t\t\tJOIN `assessments_lu_meta` AS c\n\t\t\t\t\t\t\t\t\tON `a`.`characteristic_id` = c.`id`\n\t\t\t\t\t\t\t\t\tWHERE a.`course_id` = " . $db->qstr($course->getID()) . "\n\t\t\t\t\t\t\t\t\tAND a.`active` = 1";
 $results = $db->GetArray($query);
 $gradebook_html = "";
 if ($results) {
     $gradebook_html = "<h1>Gradebook</h1>";
     $query = "\tSELECT a.`course_id`, SUM(a.`grade_weighting`) AS `grade_weighting` \n\t\t\t\t\t\t\t\t\t\tFROM `assessments` AS a\n\t\t\t\t\t\t\t\t\t\tJOIN `course_audience` AS b\n\t\t\t\t\t\t\t\t\t\tON a.`course_id` = b.`course_id`\n\t\t\t\t\t\t\t\t\t\tAND a.`cohort` = b.`audience_value`\n\t\t\t\t\t\t\t\t\t\tWHERE a.`course_id` = " . $db->qstr($course->getID()) . "\n\t\t\t\t\t\t\t\t\t\tAND a.`active` = 1";
     $total_grade_weights = $db->GetAll($query);
     foreach ($results as $result) {