コード例 #1
0
if (!defined("PARENT_INCLUDED") || !defined("IN_COURSE_ENROLMENT")) {
    exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
    header("Location: " . ENTRADA_URL);
    exit;
} elseif (!$ENTRADA_ACL->amIAllowed('course', 'update', false)) {
    $ONLOAD[] = "setTimeout('window.location=\\'" . ENTRADA_URL . "/admin/" . $MODULE . "\\'', 15000)";
    $ERROR++;
    $ERRORSTR[] = "You do not have the permissions required to use 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"] . "] do not have access to this module [" . $MODULE . "]");
} else {
    $course = Models_Course::get($COURSE_ID);
    if ($course) {
        courses_subnavigation($course->toArray(), "enrolment");
        $curriculum_periods = Models_CurriculumPeriod::fetchRowByCurriculumTypeIDCourseID($course->getCurriculumTypeID(), $course->getID());
        if ($curriculum_periods) {
            if (isset($_GET["cperiod_id"]) && ($temp = clean_input($_GET["cperiod_id"], array("trim", "int")))) {
                $cperiod_id = $temp;
            }
            $course_audience = $course->getMembers($cperiod_id);
            if (isset($_GET["download"]) && ($type = clean_input($_GET["download"], array("trim", "striptags")))) {
                switch ($type) {
                    case "csv":
                        ob_clean();
                        if ($course_audience) {
                            $output = "";
                            $num_members = 0;
                            foreach ($course_audience as $audience_type => $audience_type_members) {
                                if ($audience_type == "groups") {
                                    foreach ($audience_type_members as $group_name => $audience) {
コード例 #2
0
 public function getCurriculumPeriod($cperiod_id = null)
 {
     return Models_CurriculumPeriod::fetchRowByID($cperiod_id);
 }
コード例 #3
0
                 echo json_encode(array("status" => "error", "data" => array("No course audience found.")));
             }
         } else {
             echo json_encode(array("status" => "error", "data" => array("Invalid curriculum period id provided.")));
         }
     } else {
         echo json_encode(array("status" => "error", "data" => array("Invalid course identifier provided.")));
     }
     break;
 case "sync_date":
     if (isset($course_id)) {
         if (isset($cperiod_id)) {
             $audience = new Models_Course_Audience();
             $a = $audience->fetchRowByCourseIDCperiodID($course_id, $cperiod_id);
             $ldap_sync_date = false;
             $period = Models_CurriculumPeriod::fetchRowByID($cperiod_id);
             if ($a) {
                 $ldap_sync_date = $a->getLdapSyncDate();
                 if ($ldap_sync_date) {
                     echo json_encode(array("status" => "success", "data" => array("ldap_sync_date" => "Successfully synchronized enrolment <strong>" . date("Y-m-d H:i", $ldap_sync_date) . "</strong>")));
                 } else {
                     if ($period) {
                         echo json_encode(array("status" => "success", "data" => array("ldap_sync_date" => "Enrolment will be synchronized on <strong>" . date("Y-m-d", strtotime("-2 weeks", $period->getStartDate()) . "</strong>."))));
                     } else {
                         echo json_encode(array("status" => "error", "data" => array("Invalid curriculum period id provided.")));
                     }
                 }
             } else {
                 echo json_encode(array("status" => "error", "data" => array("No audience found.")));
             }
         } else {