function get_content_html() { if ($this->get_chapter_count() == count($this->parent->get_chapters()) - 1) { //$exam = $this->get_parent()->get_exam_by_type("final_exam"); //$exam->set_enabled(true); elearning_user::get_instance(lms_steam::get_current_user()->get_name(), elearning_mediathek::get_instance()->get_course()->get_id())->set_exam_enabled(); } global $STYLE; $doc = $this->cache->call("steam_factory::get_object_by_name", $GLOBALS["STEAM"]->get_id(), $this->steam_object_path . "/content.html"); $content = $this->get_navigation_html(); $content .= $this->cache->call(array($doc, "get_content")); // remove video javascript $content = preg_replace("/.*swfobject.js.*/", "", $content); $content = preg_replace("/.*video.js.*/", "", $content); // replace video div for jw flv // $content = preg_replace("/<div class=\"video\">media\\/(.*?)\\.f4v<\\/div>/", "<script src=\"../../scripts/flash/mediaplayer/swfobject.js\" type=\"text/javascript\"></script><div class=\"video\" id=\"video_$1\"></div> // <script type=\"text/javascript\"> // onload = function() {replaceVideo();} // function replaceVideo() { // var so = new SWFObject('../../scripts/flash/mediaplayer/player.swf','mpl','720','430','9'); // so.addParam('allowfullscreen','true'); // so.addParam('allowscriptaccess','always'); // so.addParam('wmode','opaque'); // so.addVariable('file', '/semester/WS0910/01/units/1008/elearning/einleitung/media/$1.f4v'); // so.write('video_$1');} // </script>", $content); if (!ENABLE_HTML5_VIDEO) { //replace video div for flowplayer global $portal; $portal->add_javascript_src("elearing_chapter", "/styles/" . $STYLE . "/assets/flowplayer/flowplayer-3.2.2.min.js"); $content = preg_replace("/<div class=\"video\">(.*?)\\/(.*?)\\.(.*?)<\\/div>/", "<a \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t href=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.\$3\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t class=\"elearning_video\" \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t id=\"video_\$2\"> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <img src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.jpg\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</a> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<!-- this will install flowplayer inside previous A- tag. -->\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tflowplayer(\"video_\$2\", \"/styles/" . $STYLE . "/assets/flowplayer/flowplayer-3.2.2.swf\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t play:{replayLabel: \"noch einmal abspielen\"}, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t clip: { \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t autoPlay: true, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t autoBuffering: false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t },\n \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t onFinish:function() { \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t this.unload();\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</script>", $content); } else { //replace video div with HTML5 video and flowplayer fallback $content = preg_replace("/<div class=\"video\">(.*?)\\/(.*?)\\.(.*?)<\\/div>/", "<script type=\"text/javascript\" src=\"/styles/" . $STYLE . "/assets/html5video/video.js\"></script>\n\t\t\t\t\t\t <div class=\"noprint\">\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t <link rel=\"stylesheet\" href=\"/styles/" . $STYLE . "/assets/html5video/video-js.css\" type=\"text/css\" media=\"screen\" title=\"Video JS\" charset=\"utf-8\">\n\t\t\t\t\t\t\t <div class=\"video-js-box\">\n\t\t\t\t\t\t\t <video class=\"video-js\" width=\"720\" height=\"405\" poster=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.jpg\" controls preload=\"none\">\n\t\t\t\t\t\t\t <source src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.mp4\" type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'>\n\t\t\t\t\t\t\t <source src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.webm\" type='video/webm; codecs=\"vp8, vorbis\"'>\n\t\t\t\t\t\t\t <source src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.theora.ogv\" type='video/ogg; codecs=\"theora, vorbis\"'>\n\t\t\t\t\t\t\t <!-- flash fallback -->\n\t\t\t\t\t\t\t <object class=\"vjs-flash-fallback\" width=\"720\" height=\"405\" type=\"application/x-shockwave-flash\"\n\t\t\t\t\t\t\t data=\"/styles/" . $STYLE . "/assets/flowplayer/flowplayer-3.2.2.swf\">\n\t\t\t\t\t\t\t <param name=\"movie\" value=\"/styles/" . $STYLE . "/assets/flowplayer/flowplayer-3.2.2.swf\" />\n\t\t\t\t\t\t\t <param name=\"allowfullscreen\" value=\"true\" />\n\t\t\t\t\t\t\t <param name=\"flashvars\" value='config={\"clip\":{\"url\":\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.flv\",\"autoPlay\":false,\"autoBuffering\":false}}' />\n\t\t\t\t\t\t\t <!-- image fallback -->\n\t\t\t\t\t\t\t <img src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.jpg\" width=\"720\" height=\"405\" alt=\"Vorschau Bild\"\n\t\t\t\t\t\t\t title=\"Video kann nicht abgespielt werden. Bitte prüfen sie die Systemanforderungen in der Hilfe.\" />\n\t\t\t\t\t\t\t </object>\n\t\t\t\t\t\t\t </video>\n\t\t\t\t\t\t\t </div>\n\t\t\t\t\t\t </div>\n\t\t\t\t\t\t <div class=\"printonly\">\n\t\t\t\t\t\t\t <img src=\"" . $_SERVER["REQUEST_URI"] . "\$1/\$2.jpg\" width=\"720\" height=\"405\" alt=\"Druckbild\"\n\t\t\t\t\t\t\t\t title=\"Druckbild.\" />\n\t\t\t\t\t\t </div>\n\t\t\t\t\t\t \n\t\t\t\t\t\t <script type=\"text/javascript\" charset=\"utf-8\">\n window.onload = function(){\n VideoJS.setup();\n }\n\n </script>", $content); } //replace question preg_match_all("/<div class=\"question\">(.*?)\\/(.*?)\\.(.*?)<\\/div>/", $content, $matches); $q_matches = $matches[2]; if ($q_matches != null) { for ($i = 0; $i < count($q_matches); $i++) { $q = $this->get_question_by_id($q_matches[$i]); if ($q != null) { if ($i == 0) { //first question $q_html = $q->get_question_script_html("../../"); $q_html .= $q->get_question_html(); } else { $q_html = $q->get_question_html(); } $content = preg_replace("/<div class=\"question\">(.*?)\\/" . $q_matches[$i] . "\\.(.*?)<\\/div>/", $q_html, $content); } else { error_log("elearning: Frage " . $q_matches[$i] . " in Kapitel " . $this->get_id() . " nicht gefunden."); } } } $content .= $this->get_footer_html(); $content .= "\n\t\t<div id=\"overlay\"></div>\n\t\t<div id=\"message\">\n \t\t<div id=\"messagetext\"></div>\n \t\t<div id=\"messageCloseButton\" onclick=\"closeMessageWindow()\">[<a href=\"javascript:closeMessageWindow()\">Schließen</a>]</div>\n\t\t</div>\n\t\t"; $content = "<div class=\"watermark middle right\"><div><img src=\"" . PATH_URL . "styles/" . $STYLE . "/images/wasserzeichen.png\" alt=\"Confidential\" /></div></div>" . $content; return $content; }
function load_answer($u) { if ($u == null) { $user = lms_steam::get_current_user(); } else { $user = $u; } $attribute = elearning_user::get_instance($user->get_name(), elearning_mediathek::get_instance()->get_course()->get_id())->get_exam_answers(); if ($attribute != null) { if (isset($attribute[$this->get_parent_chapter()->get_id() . "." . $this->get_parent_question()->get_id()])) { $qdata = $attribute[$this->get_parent_chapter()->get_id() . "." . $this->get_parent_question()->get_id()]; if ($qdata != 0) { if (isset($qdata[$this->get_id()]) && $qdata[$this->get_id()] == 1) { return 1; } } } } return 0; }
function nexttry() { $user_name = $_POST["user_name"]; $course_id = $_POST["course_id"]; $el_user = elearning_user::get_instance($user_name, $course_id); $el_user->set_next_try(); echo $el_user->get_internal_status_HTML(); }
function generate_certificate($user = null) { isset($user) or $user = $this->myUser; $elearning_user = elearning_user::get_instance($user->get_name(), elearning_mediathek::get_instance()->get_course()->get_id()); if ($elearning_user->has_exam_passed()) { //generating cert $cert = new elearning_certificate(); $filename_data = $cert->create_certificate($_SESSION["LMS_USER"]->get_login(), $_SESSION["LMS_USER"]->get_forename() . " " . $_SESSION["LMS_USER"]->get_surname(), $elearning_user->get_exam_sum_score(), $elearning_user->get_exam_sum_points(), date("d.m.Y")); //save cert to server $elearning_user->get_exam_cert()->set_content($filename_data); //save pdf to temp $login = $_SESSION["LMS_USER"]->get_login(); $myFile = PATH_TEMP . "zertifikat_{$login}.pdf"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $filename_data); fclose($fh); //chmod($myFile, 0777); //create Thumb //$command = "/opt/local/bin/convert $filename -geometry 550 -quality 80 jpg:$filename.jpg"; putenv("MAGICK_TMPDIR=" . PATH_TEMP); $im = new imagick($myFile . '[0]'); /* Convert to jpg */ $im->setImageFormat("jpg"); /* Thumbnail the image */ $im->thumbnailImage(150, null); //save Thumb $elearning_user->get_exam_cert_preview()->set_content((string) $im); // delete file unlink($myFile); } }
public static function get_certs($user_name) { $result = array(); $user = steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $user_name); $courses = lms_steam::user_get_booked_courses($user->get_id()); foreach ($courses as $course) { $unit = elearning_mediathek::get_elearning_unit($course["OBJ_ID"]); if ($unit === false) { continue; } $elearning_user = new elearning_user($user_name, $course["OBJ_ID"]); if ($elearning_user->has_exam_cert()) { $result[] = $elearning_user->get_exam_cert(); } } return $result; }
private function get_reporting_html() { global $STYLE; $html = ""; $html .= $this->get_reset_script_html(); $html .= $this->get_clear_script_html(); $html .= $this->get_toggleexam_script_html(); if ($this->elearning_course->get_exam_by_type("final_exam")->is_global_enabled()) { $t = "ausschalten"; } else { $t = "einschalten"; } $html .= "<table class=\"grid\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\">\n\t\t\t\t <tr>\n\t\t\t\t\t<th colspan=\"2\" class=\"group\">Einstellungen für die Prüfung</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class=\"label\">Für Teilnehmer freischalten:</td>\n\t\t\t\t\t<td class=\"value\"><a href=\"javascript:toggleexam()\" id=\"toggleexam\">" . $t . "</a></td>\n\t\t\t\t</tr>"; $html .= "<tr>\n\t\t\t\t\t<th colspan=\"2\" class=\"group\">Teilnehmer</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"; $learners = $this->owner->get_learners(); if (count($learners) == 0) { $html .= "<td colspan=\"2\" class=\"value\">diese Schulung hat zur Zeit keine Teilnehmer</td>"; } else { foreach ($learners as $learner) { $html .= "<tr><td class=\"label\">" . $learner->get_attribute("USER_FIRSTNAME") . " " . $learner->get_attribute("USER_FULLNAME") . "</td>"; $html .= "<td class=\"value\" id=\"elearning_learner_" . $learner->get_name() . "\">"; $el_learner = elearning_user::get_instance($learner->get_name(), elearning_mediathek::get_instance()->get_course()->get_id()); $html .= $el_learner->get_status_HTML(); if ($el_learner->has_exam_finished()) { $html .= " (<a href=\"javascript:resetexam('elearning_learner_" . $learner->get_name() . "','" . $learner->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">freischalten</a>"; $html .= " | <a href=\"javascript:clearexam('elearning_learner_" . $learner->get_name() . "','" . $learner->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">alles zurücksetzen</a>)"; } $html .= " (<a href=\"javascript:clearexam('elearning_learner_" . $learner->get_name() . "','" . $learner->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">alles zurücksetzen</a>)</td></tr>"; } } $html .= "<tr>\n\t\t\t\t\t<th colspan=\"2\" class=\"group\">Betreuer</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>"; $admins = $this->owner->get_admins(); if (count($admins) == 0) { $html .= "<td colspan=\"2\" class=\"value\">diese Schulung hat zur Zeit keine Betreuer</td>"; } else { foreach ($admins as $admin) { $html .= "<tr><td class=\"label\">" . $admin->get_attribute("USER_FIRSTNAME") . " " . $admin->get_attribute("USER_FULLNAME") . "</td>"; $html .= "<td class=\"value\" id=\"elearning_admin_" . $admin->get_name() . "\">"; $el_admin = elearning_user::get_instance($admin->get_name(), elearning_mediathek::get_instance()->get_course()->get_id()); $html .= $el_admin->get_status_HTML(); if ($el_admin->has_exam_finished()) { $html .= "(<a href=\"javascript:resetexam('elearning_admin_" . $admin->get_name() . "','" . $admin->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">freischalten</a>"; $html .= " | <a href=\"javascript:clearexam('elearning_admin_" . $admin->get_name() . "','" . $admin->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">alles zurücksetzen</a>)"; } $html .= " (<a href=\"javascript:clearexam('elearning_admin_" . $admin->get_name() . "','" . $admin->get_name() . "','" . $this->elearning_course->get_id() . "','" . $this->exam->get_id() . "')\">alles zurücksetzen</a>)</td></tr>"; $html .= "</td></tr>"; } } $html .= "</tr></table>"; $html .= "Erweiterungsversion: " . units_elearning::get_version() . "<br>"; $html .= "Kursversion: " . $this->elearning_course->get_version(); return $html; }
function get_member_info($user, $k_course) { return elearning_user::get_instance($user->get_name(), $k_course->get_id())->get_status_HTML(); }