예제 #1
0
function fetch_objective_parents($objective_id, $level = 0)
{
    global $db, $ENTRADA_USER;
    if ($level >= 99) {
        exit;
    }
    $query = "\tSELECT a.`objective_parent`, a.`objective_id`, a.`objective_name`\n\t\t\t\tFROM `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_id` = " . $db->qstr($objective_id) . "\n\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation());
    $objective = $db->GetAssoc($query);
    if ($objective) {
        foreach ($objective as $parent_id => $objective_data) {
            if ($parent_id != 0) {
                $objective_data["parent"] = fetch_objective_parents($parent_id, $level++);
            }
        }
        return $objective_data;
    }
}
예제 #2
0
         if ($PROCESSED["count"] == 1 || $PROCESSED["count"] == 2) {
             $course_count = array_sum(count_objective_child_courses($child["objective_id"]));
         } else {
             $course_count = 0;
         }
         $child_objectives[$i]["course_count"] = $course_count;
         if ($PROCESSED["count"] == 1 || $PROCESSED["count"] == 3) {
             $event_count = array_sum(count_objective_child_events($child["objective_id"], $SEARCH_DURATION["start"], $SEARCH_DURATION["end"], $PROCESSED["course_id"], $PROCESSED["group_id"]));
         } else {
             $event_count = 0;
         }
         $child_objectives[$i]["event_count"] = $event_count;
         $i++;
     }
 }
 $objective_parents = fetch_objective_parents($PROCESSED["objective_parent"]);
 if ($objective_parents) {
     $flattened_objectives = flatten_array($objective_parents);
     for ($i = 0; $i <= count($flattened_objectives); $i++) {
         if ($i % 2 == 0 && (!empty($flattened_objectives[$i]) && ($flattened_objectives[$i] != $PROCESSED["objective_parent"] || count($objective_parents) == 2))) {
             $o_breadcrumb[] = "<a class=\"objective-link\" href=\"" . ENTRADA_RELATIVE . "/curriculum/explorer?objective_parent=" . ($flattened_objectives[$i + 2] ? $flattened_objectives[$i + 2] : 0) . "&id=" . $flattened_objectives[$i] . "&step=2\" data-id=\"" . $flattened_objectives[$i] . "\">" . $flattened_objectives[$i + 1] . "</a>";
         } else {
             if ($i % 2 == 0) {
                 $o_breadcrumb[] = $flattened_objectives[$i + 1];
             }
         }
     }
     if ($o_breadcrumb) {
         $breadcrumb = implode(" / ", array_reverse($o_breadcrumb));
     } else {
         $breadcrumb = null;
예제 #3
0
                        }
                    }
                    break;
                case "fetch-linked-objectives":
                    echo "<h1>" . $objective_details["objective_name"] . "</h1>";
                    echo !empty($objective_details["objective_description"]) ? "<p>" . $objective_details["objective_description"] . "</p>" : "";
                    if (isset($_POST["objective_set_id"]) && ($tmp_input = clean_input($_POST["objective_set_id"], "int"))) {
                        $PROCESSED["objective_set_id"] = $tmp_input;
                    }
                    $query = "\tSELECT a.`objective_id`, a.`objective_description`, a.`objective_name`, b.`linked_objective_id`\n\t\t\t\t\t\t\t\tFROM `global_lu_objectives` AS a\n\t\t\t\t\t\t\t\tJOIN `linked_objectives` AS b\n\t\t\t\t\t\t\t\tON b.`target_objective_id` = a.`objective_id`\n\t\t\t\t\t\t\t\tWHERE b.`objective_id` = " . $db->qstr($OBJECTIVE_ID) . "\n\t\t\t\t\t\t\t\tAND b.`active` = '1'";
                    $linked_objectives = $db->GetAll($query);
                    echo "<h2>Currently Linked Objectives</h2>\n";
                    echo "<ul id=\"currently-linked-objectives\">";
                    if ($linked_objectives) {
                        foreach ($linked_objectives as $objective) {
                            $parent = fetch_objective_parents($objective["objective_id"]);
                            echo "<li data-id=\"" . $objective["objective_id"] . "\"><strong>" . $objective["objective_name"] . "</strong><a href=\"#\" class=\"unlink\"><i class=\"icon-trash\"></i></a>" . ($parent["parent"]["objective_name"] ? "<br /><small class=\"content-small\">From " . $parent["parent"]["objective_name"] . "</small>" : "") . "" . (!empty($objective["objective_description"]) ? "<br />" . $objective["objective_description"] : "") . "</li>";
                        }
                    } else {
                        echo "<li class=\"no-objectives\">This objective is not currently linked to any other objectives.</li>";
                    }
                    echo "</ul>";
                    $query = "\tSELECT a.* FROM `global_lu_objectives` a\n\t\t\t\t\t\t\t\tJOIN `objective_audience` b\n\t\t\t\t\t\t\t\tON a.`objective_id` = b.`objective_id`\n\t\t\t\t\t\t\t\tAND b.`organisation_id` = " . $db->qstr($ORGANISATION_ID) . "\n\t\t\t\t\t\t\t\tWHERE a.`objective_parent` = '0'\n\t\t\t\t\t\t\t\tAND a.`objective_active` = '1'\n\t\t\t\t\t\t\t\tAND a.`objective_id` != " . $db->qstr($PROCESSED["objective_set_id"]) . "\n\t\t\t\t\t\t\t\tGROUP BY a.`objective_id`";
                    $objectives = $db->GetAll($query);
                    if ($objectives) {
                        $objective_name = $translate->_("events_filter_controls");
                        $hierarchical_name = $objective_name["co"]["global_lu_objectives_name"];
                        ?>
							<h2>Objectives Available to Link</h2>
							<ul id="linked-objective-list" class="objective-list">
								<?php