示例#1
0
    $booking["uid"] = $lms_ldap->studentid2uid($booking["matrnr"]);
    if (empty($booking["uid"])) {
        logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\tWARNING " . $booking["matrnr"] . " NOT FOUND IN LDAP");
        continue;
    }
    $result = $GLOBALS["STEAM"]->predefined_command($user_module, "lookup_login", array($booking["uid"], TRUE), 0);
    if (is_object($result[0])) {
        $student = $result[0];
    } else {
        // Benutzer hat sich noch nie in sTeam eingeloggt.
        continue;
    }
    $steam_group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $booking["course_koala"], 0);
    $course = new koala_group_course($steam_group);
    // ZULASSUNG IN KOALA MIT UEBERNEHMEN
    if ($course->add_member($student)) {
        $message = str_replace("%NAME", $student->get_attribute("USER_FIRSTNAME") . " " . $student->get_attribute("USER_FULLNAME"), gettext("Hallo %NAME,")) . "\n\n";
        $message .= str_replace("%GROUP", $course->get_name(), gettext("You have been automatically added to the course '%GROUP' because of your membership in that course in the HIS LSF system.")) . "\n\n";
        $message .= gettext("This is an automatically generated email.");
        lms_steam::mail($student, lms_steam::get_current_user(), PLATFORM_NAME . ": " . str_replace("%GROUP", $course->get_name(), gettext("You have been added to the course '%GROUP'.")), $message);
    }
    $query = "insert into " . SYNC_TABLE_NAME . " values(" . "'', '" . $booking["semester"] . "', " . "'" . $booking["course_lsf"] . "', " . "'" . $booking["course_koala"] . "', " . "'" . $booking["matrnr"] . "', " . "'" . $booking["uid"] . "', " . "'" . $booking["status_lsf"] . "', " . "''" . ");";
    if (mysql_query($query)) {
        $counter_new_bookings++;
    }
}
// LOGGING
try {
    logging::write_log(LOG_HISLSFSYNC, "HISLSF_SYNC\tNew Bookings: " . $counter_new_bookings);
} catch (Exception $e) {
    error_log($e->getTraceAsString());