示例#1
0
 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;
 }
示例#2
0
 public static function get_instance()
 {
     if (self::$instance === NULL) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 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;
 }
示例#4
0
 function toggleexam()
 {
     $course = elearning_mediathek::get_elearning_course_by_id($this->courseid);
     $course->get_exam_by_type("final_exam")->set_global_enabled(!$course->get_exam_by_type("final_exam")->is_global_enabled());
     if ($course->get_exam_by_type("final_exam")->is_global_enabled()) {
         echo "true";
     } else {
         echo "false";
     }
 }
示例#5
0
 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 function createCourse($id, $courseID, $customerID)
 {
     $user = lms_steam::get_current_user();
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $current_semester = steam_factory::get_group($GLOBALS["STEAM"]->get_id(), "Courses." . $this->getObjectName($customerID));
     $elearning_course = elearning_mediathek::get_instance()->get_elearning_course_by_id($courseID);
     $name = $elearning_course->get_name();
     $new_course = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $id, $current_semester, FALSE, $name);
     $icon_id = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/packages/elearning_stahl_verkauf/icon_verkauf.jpg")->get_id();
     $new_course->set_attributes(array("OBJ_TYPE" => "course", "COURSE_PARTICIPANT_MNGMNT" => 0, "COURSE_SEMESTER" => $this->getObjectName($customerID), "COURSE_TUTORS" => "", "COURSE_SHORT_DSC" => $elearning_course->get_description(), "COURSE_LONG_DSC" => "[img]" . PATH_SERVER . "/cached/get_document.php?id={$icon_id}&height=100[/img]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tIn dieser Schulung möchten wir Ihnen die notwendigen Kenntnisse vermitteln, wie Sie ein Verkaufsgespräch gut führen – beginnend mit dem Blickkontakt, wenn eine Kundin oder ein Kunde Ihr Geschäft betritt, bis hin zur Verabschiedung, mit der Sie den Kunden hoffentlich mit dem Gefühl verabschieden, dass er bald wiederkommen wird.\n\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\tOberhalb dieses Textes befindet sich eine Registerkarte »Lektionen«, über die Sie sich zunächst die Schulungsinhalte aneignen können. Auf diese Inhalte haben Sie jederzeit Zugriff; Sie können die Inhalte so oft durcharbeiten, wie Sie wünschen. Und Sie können dies von jedem an das Internet angeschlossenen Computer aus, also beispielsweise auch von zu Hause.\n\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\tUm zu zeigen, dass Sie die Inhalte beherrschen, müssen Sie an einem Test teilnehmen. Dieser Test wird zu einem bestimmten Termin für Sie freigeschaltet. Sie erhalten dann zu gegebener Zeit eine Mitteilung, dass Sie zu dem Test zugelassen sind. Neben der Registerkarte, mit der Sie zu den Schulungsinhalten gelangen, finden Sie dann eine zusätzliche Registerkarte, mit der Sie den Test ablegen können.\n\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\tSollten Sie auf Probleme stoßen – seien es technische, inhaltliche oder Fragen zur Benutzung dieses Systems – finden Sie Hilfe am oberen Rand dieser Seite. Außerdem können Sie jederzeit Kontakt zu Ihrem Ansprechpartner aufnehmen, der Ihnen gerne weiterhelfen wird.", "COURSE_HISLSF_ID" => "", "ACTIVATED_FOR_CUSTOMER" => $customerID));
     $learners = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "learners", $new_course, FALSE, "Participants of course '" . $name . "'");
     $learners->set_attribute("OBJ_TYPE", "course_learners");
     $staff = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "staff", $new_course, FALSE, "Tutors of course '" . $name . "'");
     $staff->set_attribute("OBJ_TYPE", "course_staff");
     $admins = steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_course, FALSE, "Admins of course '" . $name . "'");
     $admins->set_attribute("OBJ_TYPE", "course_admins");
     //$staff->add_member( $user );
     // RIGHTS MANAGEMENT =======================================
     $course_calendar = $new_course->get_calendar();
     $learners_workroom = $learners->get_workroom();
     $course_workroom = $new_course->get_workroom();
     $staff->set_sanction_all($staff);
     $staff->sanction_meta(SANCTION_ALL, $staff);
     $learners->set_sanction_all($staff);
     $learners->sanction_meta(SANCTION_ALL, $staff);
     $new_course->set_sanction_all($staff);
     $new_course->sanction_meta(SANCTION_ALL, $staff);
     $admins->set_sanction_all($admins);
     $admins->sanction_meta(SANCTION_ALL, $admins);
     $staff->set_sanction_all($admins);
     $staff->sanction_meta(SANCTION_ALL, $admins);
     $learners->set_sanction_all($admins);
     $learners->sanction_meta(SANCTION_ALL, $admins);
     $new_course->set_sanction_all($admins);
     $new_course->sanction_meta(SANCTION_ALL, $admins);
     $course_calendar->set_acquire(FALSE);
     $course_calendar->set_sanction_all($staff);
     $course_calendar->sanction_meta(SANCTION_ALL, $staff);
     $course_calendar->set_sanction_all($admins);
     $course_calendar->sanction_meta(SANCTION_ALL, $admins);
     $course_calendar->set_read_access($learners, TRUE);
     $course_calendar->set_write_access($new_course, FALSE);
     $course_calendar->set_insert_access($new_course, FALSE);
     $course_calendar->set_insert_access($all_users, FALSE);
     // Course workroom
     $course_workroom->set_sanction($new_course, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
     $course_workroom->set_sanction_all($staff);
     $course_workroom->set_sanction_all($admins);
     $course_workroom->sanction_meta(SANCTION_ALL, $staff);
     $course_workroom->sanction_meta(SANCTION_ALL, $admins);
     // Learners workroom
     $learners_workroom->set_read_access($all_users, TRUE);
     $learners_workroom->set_sanction($learners, SANCTION_READ | SANCTION_EXECUTE | SANCTION_ANNOTATE);
     $learners_workroom->set_sanction_all($staff);
     $learners_workroom->set_sanction_all($admins);
     $learners_workroom->sanction_meta(SANCTION_ALL, $staff);
     $learners_workroom->sanction_meta(SANCTION_ALL, $admins);
     $koala_course = new koala_group_course($new_course);
     $koala_course->set_access(1, $learners, $staff, $admins, KOALA_GROUP_ACCESS);
     $new_course->set_attributes(array("COURSE_UNITS_ENABLED" => "TRUE", "UNITS_DOCPOOL_ENABLED" => "TRUE", "UNITS_ELEARNING_ENABLED" => "TRUE", "UNITS_MEDIATHING_ENABLED" => "FALSE", "UNITS_ORGANIZATION_ENABLED" => "FALSE", "UNITS_VIDEOSTREAMING_ENABLED" => "FALSE"));
     // create unit elearning
     $env = $koala_course->get_workroom();
     $new_unit_elearning_course = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $elearning_course->get_name(), $env, $elearning_course->get_description());
     $new_unit_elearning_course->set_attributes(array("UNIT_TYPE" => "units_elearning", "OBJ_TYPE" => "elearning_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_elearning"), "ELEARNING_UNIT_ID" => $courseID));
     return true;
 }
示例#7
0
 public function execute(Request $request, Response $response)
 {
     $this->commandHelper = new CommandHelper();
     // Check values
     $firstname = $request->getParameter("firstname");
     $lastname = $request->getParameter("lastname");
     $email = $request->getParameter("email");
     $branchID = $request->getParameter("branchID");
     $customerID = $request->getParameter("customerID");
     $courseID = $request->getParameter("courseID");
     if ($courseID != 0) {
         $elearning_course_id = elearning_mediathek::get_elearning_unit_id($courseID);
         $customer_name = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($customerID);
         $numberOfLicenses = licensemanager::get_instance()->get_registered_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
         $remainingLicenses = licensemanager::get_instance()->get_available_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
     }
     if ($firstname == "") {
         throw new UsermanagementException("Keinen Vornamen angegeben", "Bitte gebe einen Vornamen ein.");
     } else {
         if ($lastname == "") {
             throw new UsermanagementException("Keinen Nachnamen angegeben", "Bitte gebe einen Nachnamen ein.");
         } else {
             if ($courseID != 0 && $remainingLicenses == 0) {
                 throw new UsermanagementException("Keine Lizenz für diesen Kurs verfügbar.", "Bitte installieren sie weiter Lizenzen oder wählen sie einen anderen Kurs aus.");
             } else {
                 //			// A list with all user
                 //			$userlist = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserList();
                 //
                 //			// The initial password for employee
                 //			$password = $this->commandHelper->createRandomPassword(8);
                 //
                 //			// A login candidate
                 //			$loginCandidate = strtolower($firstname[0] . str_replace(" ", "", $lastname));
                 //
                 //			// Add a suffix, if login already exists
                 //			if (array_search($loginCandidate, $userlist) != false) {
                 //				for ($i=1; $i<=count($userlist)+1; $i++) {
                 //					if (array_search($loginCandidate . $i, $userlist) == false) {
                 //						$loginCandidate .= $i;
                 //						break;
                 //					}
                 //				}
                 //			}
                 // create new user
                 $loginCandidate = $this->commandHelper->createValidLogin($firstname, $lastname);
                 $password = $this->commandHelper->createRandomPassword(8);
                 $activationCode = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->createEmployee($loginCandidate, $password, $email, $firstname, $lastname, $branchID, $customerID);
                 $xmlContent = "<users>\n";
                 $xmlContent .= "\t<user firstname=\"" . $firstname . "\" lastname=\"" . $lastname . "\" login=\"" . $loginCandidate . "\" password=\"" . $password . "\" state=\"ok\" />\n";
                 $xmlContent .= "</users>";
                 $xmlFileName = time() . ".xml";
                 $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->saveCustomerCreationLogFile($_SESSION["CURRENT_CUSTOMER_ID"], $xmlFileName, $xmlContent);
                 $text = "";
                 if ($courseID != 0 && $remainingLicenses > 0) {
                     $elearning_course_id = elearning_mediathek::get_elearning_unit_id($courseID);
                     $customer_name = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($customerID);
                     $userID = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->login2ID($loginCandidate);
                     licensemanager::get_instance()->register_user($userID, array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
                     $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->addParticipant($userID, $courseID);
                     $text = " und zum Kurs hinzugefügt";
                 }
                 return "Neuer Benutzer wurde erfolgreich angelegt{$text}.<br>Login: "******" und Passwort: " . $password;
             }
         }
     }
 }
示例#8
0
 public function getCourseRowOverview($courseID)
 {
     $elearning_course_id = elearning_mediathek::get_elearning_unit_id($courseID);
     $customer_id = $this->dataAccess->getObjectName($_SESSION["CURRENT_CUSTOMER_ID"]);
     $courseData = $this->dataAccess->getCourseData($courseID);
     //$numberOfLicenses 	= (int) $this->dataAccess->getCountCourseLicenses($courseID);
     $numberOfLicenses = licensemanager::get_instance()->get_registered_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_id)));
     $participants = $this->dataAccess->getCourseParticipants($courseID);
     //$remainingLicenses  = $numberOfLicenses - count($participants);
     $remainingLicenses = licensemanager::get_instance()->get_available_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_id)));
     //$html = "<tr style=\"cursor:pointer;\" onclick=\"submitForm(this)\" courseID=\"" . $courseID . "\">\n";
     $html = "<tr courseID=\"" . $courseID . "\">\n";
     // The "name/info" column
     $html .= "\t<td><b>»" . $courseData["name"] . "« (" . $courseData["course_id"] . ")</b><br>" . $courseData["shortDesc"] . "</td>\n";
     // The "remaining licenses" column
     $html .= "\t<td align=\"center\">" . $remainingLicenses . " / " . $numberOfLicenses . "</td>\n";
     $html .= "</tr>\n";
     return $html;
 }
示例#9
0
 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;
 }
示例#10
0
 private function get_toggleexam_script_html()
 {
     $pathprefix = "../../units/" . elearning_mediathek::get_instance()->get_unit()->get_id() . "/";
     $html = "";
     $html .= "<script type=\"text/javascript\">\n\t\tfunction toggleexam() {\n\t\tapath = \"" . $pathprefix . "directaccess\";\n\t\tnew Ajax.Request(apath,\n\t\t\t  {\n\t\t\t    method:'post',\n\t\t\t    parameters: \"case=toggleexam\",\n\t\t\t    onFailure: function(){ alert('Error while telling answer.'); },\n\t\t\t    onSuccess: function(response){updateanker(response);}\n\t\t\t  });\n\t\t}\n\t\tfunction updateanker(response) {\n\t\t\t\tvar values = response.responseText.split('@@');\n\t\t\t\tif (values[0] == \"true\") {\n        \t\t\tdocument.getElementById(\"toggleexam\").innerHTML=(\"ausschalten\");\n        \t\t} else {\n        \t\t\tdocument.getElementById(\"toggleexam\").innerHTML=(\"einschalten\");\n\t\t\t\t}\n\t\t\t\n\t\t}\n\t\t</script>";
     return $html;
 }
示例#11
0
 public function execute(Request $request, Response $response)
 {
     $this->commandHelper = new CommandHelper();
     $customerID = $request->getParameter("customerID");
     // The id of the course, the new created user will be added to
     $courseID = $request->getParameter("courseID");
     if ($request->getParameter("courseID") != "0") {
         $elearning_course_id = elearning_mediathek::get_elearning_unit_id($courseID);
         $customer_name = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($customerID);
         $numberOfLicenses = licensemanager::get_instance()->get_registered_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
         $remainingLicenses = licensemanager::get_instance()->get_available_license_seats(array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
         $remainingLicensesBak = $remainingLicenses;
     }
     $xlsFilePath = PATH_TEMP . $_FILES["csvFile"]["name"];
     move_uploaded_file($_FILES["csvFile"]["tmp_name"], $xlsFilePath);
     // Get wrapper object for xls file
     $PHPExcelWrapper = PHPExcel_IOFactory::load($xlsFilePath);
     // Get the first spreadsheet of xls file
     $spreadsheet = $PHPExcelWrapper->getSheet();
     // Iterates over rows
     $rowIterator = $spreadsheet->getRowIterator();
     // Counts the number of created users
     $newUserCounter = 0;
     $xmlContent = "<users>\n";
     while ($rowIterator->valid()) {
         // Get current row
         $row = $rowIterator->current();
         // Iterates over cells
         $cellIterator = $row->getCellIterator();
         // Data for new user
         $firstname = "";
         $lastname = "";
         $email = "";
         $branchID = "";
         $password = $this->commandHelper->createRandomPassword(8);
         while ($cellIterator->valid()) {
             // Get current cell
             $cell = $cellIterator->current();
             $colIndex = $cell->getColumn();
             $rowIndex = $cell->getRow();
             $value = $cell->getValue();
             switch ($colIndex) {
                 case "A":
                     $firstname = $this->fixEncoding($value);
                     break;
                 case "B":
                     $lastname = $this->fixEncoding($value);
                     break;
                 case "C":
                     $email = $this->fixEncoding($value);
                     break;
                 case "D":
                     $branchID = $this->fixEncoding($value);
                     break;
             }
             $cellIterator->next();
         }
         if ($firstname != "" || $lastname != "") {
             // create new user
             $login = $this->commandHelper->createValidLogin($firstname, $lastname);
             try {
                 $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->createEmployee($login, $password, $email, $firstname, $lastname, "", $customerID);
                 $creationState = "ok";
                 $newUserCounter++;
             } catch (Exception $exception) {
                 $creationState = "fail";
             }
             $xmlContent .= "\t<user firstname=\"" . $firstname . "\" lastname=\"" . $lastname . "\" login=\"" . $login . "\" password=\"" . $password . "\" state=\"" . $creationState . "\" />\n";
             // Add new user to course, if a course was selected
             if ($creationState == "ok" && $request->getParameter("courseID") != "0") {
                 if ($remainingLicenses > 0) {
                     $elearning_course_id = elearning_mediathek::get_elearning_unit_id($courseID);
                     $customer_name = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($customerID);
                     $userID = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->login2ID($login);
                     licensemanager::get_instance()->register_user($userID, array(new elearning_context($elearning_course_id), new unternehmens_context($customer_name)));
                     $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->addParticipant($userID, $courseID);
                     $remainingLicenses--;
                 }
             }
         }
         $rowIterator->next();
     }
     $xmlContent .= "</users>";
     $xmlFileName = time() . ".xml";
     $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->saveCustomerCreationLogFile($_SESSION["CURRENT_CUSTOMER_ID"], $xmlFileName, $xmlContent);
     // Throw exception, if to less licenses were available
     if ($request->getParameter("courseID") != "0" && $remainingLicensesBak < $newUserCounter) {
         throw new UsermanagementException("Aufgrund zu weniger freier Lizenzen konnten nicht alle angelegten Benutzer dem Kurs hinzugef&uuml;gt werden.", "Erweitern sie ihr Lizenz-Kontingent.");
     }
     return "Excel-Liste wurde importiert. Siehe unter 'Verlauf' f&uuml;r Einzelheiten der angelegten Benutzer.";
 }
 function get_question_exam_html($load = false, $result = false, $count = null, $sum = null)
 {
     global $STYLE;
     $html = "";
     if ($result) {
         $enabled = false;
         $res = "Result";
     } else {
         $enabled = true;
         $res = "";
     }
     if (!$result) {
         $html = "<div class=\"q\" id=\"q_{$count}\"><form class=\"multipleChoice\">\n        \t\t <div class=\"question\">" . ($count == null || $sum == null ? "" : "Frage {$count} von {$sum} - ") . $this->get_question_text() . "</div>";
     }
     if ($this->get_question_exam_image() != null) {
         $url = $this->get_question_exam_image();
         $found = strpos($url, "../");
         if ($found === false) {
         } else {
             $prefix = "../units/" . elearning_mediathek::get_instance()->get_unit()->get_id() . "/elearning/" . $this->parent->get_id() . "/";
             $url = str_replace("../", $prefix, $url);
         }
         if (stristr($_SERVER["REQUEST_URI"], "/units_elearning/report/") === false) {
             $html .= "<img style=\"float:left;height:150px\" src=\"" . $url . "\" />";
         } else {
             $html .= "<img style=\"float:left;height:150px\" src=\"../../" . $url . "\" />";
         }
     }
     $answers = $this->get_answers();
     $i = 0;
     $is_correct = TRUE;
     foreach ($answers as $answer) {
         $img = "";
         if ($result) {
             if ($answer->load_answer(self::get_user()) == 1) {
                 $is_checked = true;
             } else {
                 $is_checked = false;
             }
             if ($is_checked == $answer->is_correct()) {
                 $correct_answer = true;
             } else {
                 $correct_answer = false;
             }
             if ($correct_answer) {
                 //$img = "<img src=\"/styles/" . $STYLE . "/images/richtig_16.png\">";
                 $img = "<img style=\"float:left;margin: 6px 10px 0px 0px\" src=\"/styles/" . $STYLE . "/images/blank_16.png\">";
             } else {
                 $img = "<img style=\"float:left;margin: 6px 10px 0px 0px\" src=\"/styles/" . $STYLE . "/images/falsch_16.png\">";
                 $is_correct = FALSE;
             }
         }
         $s = "";
         if ($load) {
             if ($answer->load_answer(self::get_user()) == 1) {
                 $s = "1";
                 if ($enabled) {
                     $box_img = IMAGE_CHECKBOX_SELECTED_ENABLED;
                 } else {
                     $box_img = IMAGE_CHECKBOX_SELECTED_DISABLED;
                 }
             } else {
                 $s = "0";
                 if ($enabled) {
                     $box_img = IMAGE_CHECKBOX_UNSELECTED_ENABLED;
                 } else {
                     $box_img = IMAGE_CHECKBOX_UNSELECTED_DISABLED;
                 }
             }
         }
         //<img style=\"display:none;position:relative;float:left;top:0px;left:0px;height:15px;width:15px\" src=\"/styles/" . $STYLE . "/images/loader_15.gif\" id=\"questionIdLoader" . $this->get_id() . "-" . $i ."\">".
         if ($enabled) {
             $html .= "<div class=\"answer" . $res . "\">" . $img . "<input type=\"hidden\" value=\"{$s}\" id=\"questionId" . $this->get_id() . "-" . $i . "\" name=\"question\"><img id=\"questionCheckbox" . $this->get_id() . "-" . $i . "\" style=\"float:left;cursor:pointer;margin:0px 10px 0px 0px\" src=\"{$box_img}\" onMouseOver=\"window.status='Viel Erfolg bei der Prüfung!';return true;\" onMouseOut=\"window.status='';return true;\" onclick=\"checkAnswer('" . $this->parent->get_id() . "','" . $this->get_id() . "','" . $i . "');return false;\"><img id=\"questionCheckboxLoader" . $this->get_id() . "-" . $i . "\" style=\"float:left;display:none;margin:0px 10px 0px 0px\" src=\"" . IMAGE_CHECKBOX_LOADER . "\" ><div style=\"display:block;margin-top:5px;margin-left:39px\">" . $answer->get_answertext() . "</div></div>";
         } else {
             $html .= "<div class=\"answer" . $res . "\">" . $img . "<input type=\"hidden\" value=\"{$s}\" id=\"questionId" . $this->get_id() . "-" . $i . "\" name=\"question\"><img id=\"questionCheckbox" . $this->get_id() . "-" . $i . "\" style=\"float:left;margin:0px 10px 0px 0px\" src=\"{$box_img}\"><div style=\"display:block;margin-top:5px\">" . $answer->get_answertext() . "</div></div>";
         }
         $i++;
     }
     if ($result) {
         if ($is_correct) {
             $html = "<div class=\"q_right\" id=\"q_{$count}\"><form class=\"multipleChoice\">\n        \t\t\t<div class=\"question\">" . ($count == null || $sum == null ? "" : "Frage {$count} von {$sum} - ") . $this->get_question_text() . "</div>" . $html;
         } else {
             $html = "<div class=\"q_wrong\" id=\"q_{$count}\"><form class=\"multipleChoice\">\n        \t\t\t<div class=\"question\">" . ($count == null || $sum == null ? "" : "Frage {$count} von {$sum} - ") . $this->get_question_text() . "</div>" . $html;
         }
     }
     if ($this->get_question_image() != null) {
         $html .= "<br clear=\"all\">";
     }
     $html .= "</form></div>";
     return $html;
 }
示例#13
0
//diese Class sorgt für die Darstellung der Extension!!
if (!defined("PATH_TEMPLATES_UNITS_ELEARNING")) {
    define("PATH_TEMPLATES_UNITS_ELEARNING", PATH_EXTENSIONS . "units_elearning/templates/");
}
if (!isset($portal)) {
    $portal = lms_portal::get_instance();
    $portal->initialize(GUEST_NOT_ALLOWED);
}
if (!isset($html_handler_course)) {
    $html_handler_course = new koala_html_course($course);
    $html_handler_course->set_context("units", array("subcontext" => "unit"));
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES_UNITS_ELEARNING . "units_elearning.template.html");
$mediathek = elearning_mediathek::get_instance();
$mediathek->set_unit($steam_unit);
$mediathek->set_course($course);
$elearning_course = $mediathek->get_elearning_course_for_unit($steam_unit);
$navi = "<div id=\"elearning_navigation\"></div>";
if (!isset($elearning_course) || !$elearning_course instanceof elearning_course) {
    $content->setVariable("ELEARNING_COURSE_CONTENT", "ERROR");
} else {
    if ($action == "index") {
        header("Location: " . $_SERVER["REQUEST_URI"] . "elearning/einleitung/");
        exit;
    } else {
        if ($action == "chapter") {
            $html = "";
            //error_log("chapter" . $html);
            if (isset($chapter) && $chapter != "") {
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     $r = "";
     foreach ($path as $s) {
         $r .= $s;
     }
     if (is_string($path)) {
         $path = url_parse_rewrite_path($path);
     }
     //lms_portal::get_instance()->initialize(GUEST_NOT_ALLOWED);
     $steam_unit = "";
     $action = "";
     if (isset($path[0]) && is_numeric($path[0])) {
         $steam_unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
         if (is_object($steam_unit) && $steam_unit->get_attribute("UNIT_TYPE") !== "units_elearning") {
             return;
         }
         //TODO: cool. neues object von sich in sich ? Häh, geil!
         $unit = new units_elearning($owner->get_steam_object());
         $docextern = new koala_object_elearning($steam_unit, $unit);
         if (isset($path[1])) {
             $action = $path[1];
         }
     }
     $portal_user = lms_portal::get_instance()->get_user();
     $user = lms_steam::get_current_user();
     $scg = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = $owner->get_semester();
     $course = $owner;
     $this->set_course($course);
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $html_handler = new koala_html_course($owner);
     if (count($path) > 0 && $path[0] == "reporting") {
         $first_unit = $this->get_elearning_unit();
         $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner);
         if ($course->is_admin($user)) {
             $exam->render_reporting_html();
         } else {
             header("location:../../");
             exit;
         }
     } else {
         if (count($path) > 0 && $path[0] == "") {
             $first_unit = $this->get_elearning_unit();
             $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner);
             if ($exam->get_exam()->is_global_enabled() && elearning_user::get_instance($user->get_name(), $course->get_id())->has_exam_enabled()) {
                 $exam->render_html();
             } else {
                 header("location:../");
                 exit;
             }
         } else {
             if (count($path) > 1 && $path[0] == "report") {
                 $first_unit = $this->get_elearning_unit();
                 $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner);
                 $steam_user = $this->cache->call("steam_factory::get_user", $GLOBALS["STEAM"]->get_id(), $path[1]);
                 if ($exam->get_exam()->is_global_enabled() && $course->is_staff($user) && $steam_user instanceof steam_user) {
                     $exam->render_report_html($steam_user);
                 } else {
                     header("location:../");
                     exit;
                 }
             } else {
                 if (count($path) > 1 && $path[0] == "chart") {
                     $first_unit = $this->get_elearning_unit();
                     $exam = new exam($first_unit, $this->cache->call(array($first_unit, "get_attribute"), "ELEARNING_UNIT_ID"), $owner);
                     if ($exam->get_exam()->is_global_enabled() && $course->is_staff($user)) {
                         $exam->render_chart_html();
                     } else {
                         header("location:../");
                         exit;
                     }
                 } else {
                     if (count($path) == 1 || count($path) == 2 && $path[1] == "") {
                         $action = "index";
                         include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php';
                     } else {
                         if (count($path) > 2 && $path[1] == "elearning") {
                             $action = "chapter";
                             $chapter = $path[2];
                             if (count($path) > 4 && $path[3] == "media") {
                                 $action = "media";
                                 $media = $path[4];
                             }
                             include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php';
                         } else {
                             if (count($path) > 2 && $path[1] == "scripts") {
                                 $action = "scripts";
                                 $scripts = "";
                                 for ($i = 1; $i < count($path); $i++) {
                                     $scripts .= "/" . $path[$i];
                                 }
                                 include PATH_EXTENSIONS . 'units_elearning/modules/units_elearning.php';
                             } else {
                                 if (count($path) > 1 && $path[1] == "directaccess") {
                                     $mediathek = elearning_mediathek::get_instance();
                                     $elearning_course = elearning_mediathek::get_elearning_course_for_unit($steam_unit);
                                     $da = new directaccess($elearning_course->get_id(), $course);
                                     $da->callfunction($_POST["case"]);
                                 } else {
                                     $url = "";
                                     $first = TRUE;
                                     foreach ($path as $s) {
                                         if ($first) {
                                             $first = FALSE;
                                         } else {
                                             $url .= "/" . $s;
                                         }
                                     }
                                     $url = "/packages/elearning_stahl_verkauf" . "/chapters/" . $_SESSION["chapter"] . $url;
                                     $steam_doc = $this->cache->call("steam_factory::get_object_by_name", $GLOBALS["STEAM"]->get_id(), $url);
                                     if ($steam_doc instanceof steam_document) {
                                         echo $this->cache->call(array($steam_doc, "download"));
                                         exit;
                                     } else {
                                         error_log("Could not find: " . $url);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }