Exemple #1
0
 function recommend_contact($receiver, $contact, $message)
 {
     $user = lms_steam::get_current_user();
     $subject = str_replace("%NAME", $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME"), gettext("Recommendation of %NAME as contact"));
     $message .= "\n\n--\n\n" . gettext("This message was created via the introduce contact function.") . " " . str_replace(array("%NAME1", "%NAME2"), array($user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME")), gettext("%NAME1 wants to recommend %NAME2 to you.")) . "\n\n" . gettext("Name") . ": " . $contact->get_attribute("USER_FIRSTNAME") . " " . $contact->get_attribute("USER_FULLNAME") . "\n" . gettext("Contact page") . ": " . PATH_URL . "user/" . $contact->get_name() . "/\n";
     lms_steam::mail($receiver, $user, $subject, $message);
 }
Exemple #2
0
 public static function createObject($name, $description = "", $content = "", $mimeType = "application/x-msdownload", $artefactClass, $user = null)
 {
     self::init();
     if ($user == null) {
         $user = lms_steam::get_current_user();
     }
     $newArtefact = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, Artefacts::getArtefactsContainer($user), "Artefact: " + $name);
     $newArtefact->set_attribute(PORTFOLIO_PREFIX . "TYPE", "ARTEFACT");
     $newArtefact->set_attribute(PORTFOLIO_PREFIX . "ARTEFACTCLASS", $artefactClass);
     $dataPresent = $content == "" ? false : true;
     $newArtefact->set_attribute(PORTFOLIO_PREFIX . "DATAPRESENT", $dataPresent);
     $newArtefact->set_attribute(PORTFOLIO_PREFIX . "LINKED_LOCATIONS", array());
     $newArtefact->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "ARTEFACT");
     if ($dataPresent) {
         $data = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "data", $content, $mimeType, $newArtefact);
     }
     $newArtefactObject = Artefacts::getArtefactByRoom($newArtefact);
     $newArtefactObject->checkActivity();
     $newArtefactObject->checkCompetence();
     //Create Forum
     $newArtefactObject->createForum();
     //create and assign groups
     //		$newArtefact->createGroups();
     return $newArtefactObject;
 }
Exemple #3
0
 public function subscribe($password = "", $message = "")
 {
     $user = lms_steam::get_current_user();
     $group_name = $this->get_display_name();
     if ($this->is_password_protected()) {
         if ($this->check_group_pw($password)) {
             $this->add_member($user, $password);
             $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $this->get_name(), gettext("You have been added to '%GROUP'."))));
         } else {
             $result = array("succeeds" => FALSE, "problem" => gettext("Wrong password."), "hint" => gettext("If you want to join and do not know the password, please contact a group moderator."), "confirmation" => "");
         }
     } else {
         if ($this->is_moderated()) {
             $user = lms_steam::get_current_user();
             $username = $user->get_full_name();
             $this->add_membership_request($user);
             $admins = $this->get_admins();
             if (!is_array($admins)) {
                 $admins = array($admins);
             }
             $link = $this instanceof koala_group_course ? PATH_URL . SEMESTER_URL . "/" . $this->get_semester()->get_name() . "/" . $this->get_name() . "/requests/" : PATH_URL . "groups/" . $this->get_id() . "/requests/";
             foreach ($admins as $admin) {
                 $adminname = $admin->get_full_name();
                 $mailbody = str_replace("%NAME", $adminname, gettext("Dear %NAME,")) . "\n\n" . str_replace(array("%NAME", "%GROUP"), array($username, $group_name), gettext("The user %NAME has requested membership for '%GROUP':")) . "\n\n<b>{$message}</b>\n\n" . gettext("Since you are a moderator for this group, you can affirm the membership or decline.") . "\n\n" . str_replace("%PAGE", "<a href=\"{$link}\">" . gettext("open membership requests") . "</a>", gettext("Please see %PAGE for further instructions."));
                 //$admin->mail( "LLMS: Membership Request" , $message,  $user->get_attribute( "USER_EMAIL" ) );
                 lms_steam::mail($admin, $user, gettext("koaLA: Membership Request"), $mailbody);
             }
             $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, str_replace("%GROUP", $group_name, gettext("Membership request for '%GROUP' has been sent."))));
         } else {
             $this->add_member($user);
             $result = array("succeeds" => TRUE, "confirmation" => str_replace("%GROUP", $group_name, gettext("You have been added to '%GROUP'.")));
         }
     }
     return $result;
 }
Exemple #4
0
 public static function init()
 {
     $user = lms_steam::get_current_user();
     $workroom = $user->get_workroom();
     $portfolio_main_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolio", $workroom, "room for portfolio module");
     $artefacts_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "artefacts", $portfolio_main_room, "room for artefacts for portfolios");
     $portfolios_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolios", $portfolio_main_room, "room for portfolios");
 }
 public function is_moderated()
 {
     if ($this->is_password_protected()) {
         return FALSE;
     }
     $user = lms_steam::get_current_user();
     return !$this->steam_object->check_access(SANCTION_INSERT, $user);
 }
Exemple #6
0
 public function get_url()
 {
     if (lms_steam::get_current_user()->get_id() == $this->get_id()) {
         return PATH_URL . "desktop/";
     } else {
         return PATH_URL . "user/" . $this->get_name() . "/";
     }
 }
 public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
 {
     $ajaxResponseObject->setStatus("ok");
     $user = \lms_steam::get_current_user();
     $description = strip_tags($this->params["desc"]);
     $name = strip_tags($this->params["name"]);
     $newArtefact = \ArtefactCertificate::create($name, $description);
     return parent::ajaxResponseNew($ajaxResponseObject, $newArtefact);
 }
 function get_display_name()
 {
     $creator = $this->steam_object->get_creator();
     if ($creator instanceof steam_user && $creator->get_id() == lms_steam::get_current_user()->get_id()) {
         return gettext("Your workroom");
     }
     $koala_creator = koala_object::get_koala_object($creator);
     return str_replace("%NAME", $koala_creator->get_display_name(), gettext("%NAME's workroom"));
 }
 public function __construct($steam_user)
 {
     $this->steam_user = $steam_user;
     $profile_object = $steam_user->get_attribute("LLMS_NETWORKING_PROFILE");
     if (!$profile_object instanceof steam_object && lms_steam::get_current_user()->get_id() != $steam_user->get_id()) {
         throw new Exception("Networking profile not initialized", E_USER_NO_NETWORKINGPROFILE);
     }
     $this->profile_object = $profile_object;
 }
Exemple #10
0
 function __construct($parent_tmp, $steamObject_tmp, $type)
 {
     $this->parent = $parent_tmp;
     $this->steamObject = $steamObject_tmp;
     $this->type = $type;
     $this->myUser = lms_steam::get_current_user();
     //get meta data
     $doc = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), $this->steamObject->get_path() . "/exam.xml");
     $this->xml = simplexml_load_string($doc->get_content());
 }
Exemple #11
0
 public function processData(\IRequestObject $requestObject)
 {
     $params = $requestObject->getParams();
     if (isset($params) && isset($params[0])) {
         $this->user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $params[0]);
     }
     if (!isset($this->user) || !$this->user instanceof \steam_user) {
         $this->user = \lms_steam::get_current_user();
     }
 }
 public function get_context_menu($context, $params = array())
 {
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_insert($user)) {
         $menu[] = array("name" => gettext("Create folder"), "link" => $this->get_link_base() . "new-folder");
         $menu[] = array("name" => gettext("Upload document"), "link" => PATH_URL . "upload.php?env=" . $this->get_id());
         $menu[] = array("name" => gettext("Create Weblink"), "link" => PATH_URL . "docextern_create.php?env=" . $this->get_id());
     }
     return $menu;
 }
 public function get_context_menu($context, $params = array())
 {
     if ($context !== 'units') {
         return array();
     }
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_insert($user)) {
         $menu[] = array('name' => gettext('Create new unit'), 'link' => $this->get_url() . 'new');
     }
     return $menu;
 }
Exemple #14
0
 public static function getArtefactsContainer($user = null)
 {
     self::init();
     if ($user == null) {
         $user = lms_steam::get_current_user();
     }
     if (!array_key_exists(PORTFOLIO_PREFIX . "ArtefactsContainer", $_SESSION)) {
         //$user = lms_steam::get_current_user();
         $_SESSION[PORTFOLIO_PREFIX . "ArtefactsContainer"] = $user->get_workroom()->get_object_by_name("portfolio")->get_object_by_name("artefacts");
     }
     return $_SESSION[PORTFOLIO_PREFIX . "ArtefactsContainer"];
 }
 public function get_context_menu($context, $params = array())
 {
     if ($context !== 'units') {
         return array();
     }
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_write($user)) {
         $menu[] = array("name" => gettext("Preferences"), "link" => $this->get_link_base() . "edit");
         $menu[] = array("name" => gettext("Delete unit"), "link" => $this->get_link_base() . "delete");
     }
     return $menu;
 }
 static function create_question($parent, $so, $user = null)
 {
     isset($user) or $user = lms_steam::get_current_user();
     self::$user = $user;
     if ($so instanceof steam_document) {
         $xml = simplexml_load_string($so->get_content());
         if ($xml->type == "MultipleChoice" || $xml->type == "MultipleChoiceQuestion") {
             return new elearning_question_multiplechoice($parent, $so, $xml);
         }
     } else {
         return NULL;
     }
 }
 public function get_context_menu($context, $params = array())
 {
     if ($context !== "documents") {
         return array();
     }
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_insert($user)) {
         CREATE_FOLDER ? $menu[] = array("name" => gettext("Create folder"), "link" => $this->get_link_base() . "new-folder") : "";
         UPLOAD_DOCUMENT ? $menu[] = array("name" => gettext("Upload document"), "link" => PATH_URL . "upload.php?env=" . $this->get_id()) : "";
         ADD_WEBLINK ? $menu[] = array("name" => gettext("Create Weblink"), "link" => PATH_URL . "docextern_create.php?env=" . $this->get_id()) : "";
     }
     return $menu;
 }
Exemple #18
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     if (!\lms_steam::is_steam_admin($user)) {
         //TODO: REDIRECT!!
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         $start_date = iso_to_unix($values["start"]);
         $end_date = iso_to_unix($values["end"]);
         // TODO PROBLEM CHECKING MISSING
         $courses = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
         $all_user = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
         $new_semester = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["name"], $courses, FALSE, $values["desc"]);
         $new_semester_admins = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "admins", $new_semester, FALSE, "admin group for " . $values["desc"]);
         $new_semester_admins->set_attribute("OBJ_TYPE", "semester_admins");
         $new_semester_admins->add_member($user);
         $new_semester->set_insert_access($new_semester_admins, TRUE);
         $new_semester->set_read_access($all_user, TRUE);
         $new_semester->set_attributes(array("SEMESTER_START_DATE" => $start_date, "SEMESTER_END_DATE" => $end_date));
         // CACHE ZURÜCKSETZEN
         $cache = get_cache_function("ORGANIZATION");
         $cache->drop("lms_steam::get_semesters");
         header("Location: " . PATH_URL . "semester/index/" . $values["name"] . "/all");
     }
     $content = \Semester::getInstance()->loadTemplate("semester_create.template.html");
     $content->setVariable("INFO_TEXT", gettext("So, you want to start a new semester?") . " " . gettext("Please fill out the requested values on the right.") . "<br/><br/>" . str_replace("%SEMESTER", STEAM_CURRENT_SEMESTER, gettext("And don't forget to reset the current semester in the etc/koala.def.php, which is <b>%SEMESTER</b> at the moment.")));
     $content->setVariable("LABEL_NAME", gettext("Shortname"));
     $content->setVariable("INFO_NAME", gettext("IMPORTANT: Don't use any slashes, commas or dots in this name. Keep it short, like 'WS0607' or 'SS06'."));
     $content->setVariable("LABEL_DESC", gettext("Name"));
     $content->setVariable("INFO_DESC", gettext("Examples: 'Wintersemester 06/07', or 'Sommersemester 2006'"));
     $content->setVariable("LABEL_START_DATE", gettext("Starting date of semester"));
     $content->setVariable("LABEL_END_DATE", gettext("Ending date of semester"));
     $content->setVariable("INFO_DATE_FORMAT", gettext("Please type in the date in the following format: YYYY-MM-DD"));
     $content->setVariable("LABEL_CREATE", gettext("Create Semester"));
     /* TODO: Portal anpassen
     		$portal->set_page_main(
     			array(array("link" => PATH_URL.SEMESTER_URL."/", "name" => gettext("Semester")), array("link" => "", "name" => gettext("Create new"))),
     			$content->get(),
     			""
     		);
     		*/
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
 public function processData(\IRequestObject $requestObject)
 {
     if ($requestObject instanceof \UrlRequestObject) {
         $this->params = $requestObject->getParams();
         isset($this->params[0]) ? $this->id = $this->params[0] : "";
         isset($this->params[1]) ? $this->calendar = $this->params[1] : "";
     } else {
         if ($requestObject instanceof \AjaxRequestObject) {
             $this->params = $requestObject->getParams();
             isset($this->params["id"]) ? $this->id = $this->params["id"] : "";
             isset($this->params["calendar"]) ? $this->calendar = $this->params["calendar"] : "";
         }
     }
     $currentUser = \lms_steam::get_current_user();
     $currentUserId = $currentUser->get_id();
     $steam = $GLOBALS["STEAM"];
     $steamId = $steam->get_id();
     $objSubscriptionId = $this->id;
     $objSubscription = \steam_factory::get_object($steamId, $objSubscriptionId);
     $objCalendarId = $this->calendar;
     $objCalendar = \steam_factory::get_object($steamId, $objCalendarId);
     $calendarCreatorId = $objCalendar->get_creator()->get_id();
     if ($calendarCreatorId != $currentUserId) {
         throw new \Exception("User is not allowed to subscribe events");
     }
     if ($objSubscription instanceof \steam_user) {
         $steamCalendar = $objSubscription->get_attribute("USER_CALENDAR");
     } else {
         $steamCalendar = $objSubscription->get_attribute("GROUP_CALENDAR");
     }
     if (!$steamCalendar instanceof \steam_calendar) {
         throw new \Exception("steam_calendar is not set.");
     }
     $steamCalendarId = $steamCalendar->get_id();
     $subscriptions = $objCalendar->get_attribute("CALENDAR_SUBSCRIPTIONS");
     $deletedSubscription = false;
     foreach ($subscriptions as $index => $subscription) {
         if ($subscription->get_id() == $steamCalendarId) {
             unset($subscriptions[$index]);
             $deletedSubscription = true;
         }
     }
     if (!$deletedSubscription) {
         throw new \Exception("Subcription could not deleted. steam_calendar is not subscribed by the calendar!");
     }
     $objCalendar->set_attribute("CALENDAR_SUBSCRIPTIONS", $subscriptions);
 }
Exemple #20
0
 public function getSanction()
 {
     if (!is_array($this->extensions)) {
         throw new \Exception("extensions not type of array");
     }
     $sanction = array();
     $currentUser = \lms_steam::get_current_user();
     $currentUserId = $currentUser->get_id();
     foreach ($this->extensions as $id => $extension) {
         if ($extension instanceof \steam_group) {
             $parentGroup = $extension->get_parent_group();
             $parentGroupName = $parentGroup->get_name();
             //IF SEMESTER
             if ($parentGroupName == "Courses") {
                 $sanction[$id] = 1;
             } elseif ($parentGroupName == "PrivGroups" || $parentGroupName == "PublicGroups") {
                 if ($extension->is_admin($currentUser)) {
                     $sanction[$id] = 2;
                 } else {
                     if ($extension->is_member($currentUser)) {
                         $sanction[$id] = 1;
                     } else {
                         $sanction[$id] = 0;
                     }
                 }
             }
         } else {
             if ($extension instanceof \steam_room) {
                 $objType = $extension->get_attribute("OBJ_TYPE");
                 $sanctionValue = $extension->get_sanction();
                 $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE;
                 if ($objType == "calendar") {
                     if ($sanctionValue < SANCTION_READ) {
                         $sanction[$id] = 0;
                     } else {
                         if ($sanctionValue < $SANCTION_WRITE_FOR_CURRENT_OBJECT) {
                             $sanction[$id] = 1;
                         } else {
                             $sanction[$id] = 2;
                         }
                     }
                 }
             }
         }
     }
     return $sanction;
 }
Exemple #21
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $obj = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
     $currentUser = \lms_steam::get_current_user();
     $subscriptionWrapper = new SubscriptionWrapper();
     $subscriptionWrapper->setCalendar($obj);
     $result = $subscriptionWrapper->getSubscriptions();
     $extensions = array();
     $extensions = $result["extensions"];
     $calendars = array();
     $calendars = $result["result"];
     $sanctionWrapper = new SanctionWrapper();
     $sanctionWrapper->setExtensions("extensions");
     $sanctions = $sanctionWrapper->getSanction();
     //RECHTE UND DATEN KÖNNEN ZUR KALENDERAUSGABE VERWENDET WERDEN
     return $frameResponseObject;
 }
 public function get_context_menu($context, $params = array())
 {
     if ($context !== 'units') {
         return array();
     }
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_write($user)) {
         $menu[] = array("name" => gettext("Preferences"), "link" => $this->get_link_base() . "edit");
         $menu[] = array("name" => gettext("Delete unit"), "link" => $this->get_link_base() . "delete");
         $menu[] = array("name" => gettext("generate points list"), "link" => $this->get_link_base() . "points_tab");
         $menu[] = array("name" => gettext("New Homework"), "link" => $this->get_link_base() . "new_homework");
     }
     if ($this->steam_object->check_access_insert($user)) {
     }
     return $menu;
 }
Exemple #23
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $compare = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]);
     $to = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[2]);
     $wiki_html_handler = new \lms_wiki($wiki_container);
     //$wiki_html_handler->set_admin_menu( "versions", $wiki_doc );
     $content = \Wiki::getInstance()->loadTemplate("wiki_version_compare.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_version_compare.template.html" );
     $difftext = wiki_diff_html($to, $compare);
     $content->setVariable("DIFF_TEXT", $difftext);
     $wiki_html_handler->set_main_html($content->get());
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id(), "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => PATH_URL . "wiki/viewentry/" . $wiki_doc->get_id() . "/", "name" => str_replace(".wiki", "", h($wiki_doc->get_name()))), array("link" => PATH_URL . "wiki/versionoverview/" . $wiki_doc->get_id() . "/versions/", "name" => gettext("Version management")), array("link" => "", "name" => gettext("Version compare") . " (" . $compare->get_version() . " " . gettext("to") . " " . $to->get_version() . ")")));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Exemple #24
0
 public function group_get_members($pGroup)
 {
     if (!$pGroup instanceof koala_group) {
         throw new Exception("parameter is not an instance of koala_group", E_PARAM);
     }
     if (!$pGroup->is_admin(lms_steam::get_current_user())) {
         throw new Exception("no admin rights.operation canceled.");
     }
     $cache = get_cache_function($pGroup->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($pGroup)) {
         case "koala_group_course":
             $group_name = $pGroup->get_course_id() . " - " . $pGroup;
             $members = $cache->call("lms_steam::group_get_members", $pGroup->steam_group_learners->get_id());
             break;
         default:
             $members = $cache->call("lms_steam::group_get_members", $pGroup->get_id());
             break;
     }
     // INITIALIZATION
     $course_id = $pLmsGroupCourse->get_course_id();
     $course_name = $pLmsGroupCourse->get_course_dsc_short();
     $semester = $pLmsGroupCourse->get_semester();
     $excel = new Spreadsheet_Excel_Writer();
     $excel->send($course_id . "_" . $semester->get_name());
     $sheet =& $excel->addWorksheet(gettext("participants"));
     // WRITE EXCEL SHEET
     $sheet->writeString(0, 0, $course_id . " - " . $course_name());
     $sheet->writeSting(1, 0, $semester->get_name());
     $sheet->writeString(3, 0, gettext("student id"));
     $sheet->writeString(3, 1, gettext("forename"));
     $sheet->writeString(3, 2, gettext("surname"));
     $no_members = count($members);
     if ($no_members > 0) {
         $row = 5;
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             $sheet->writeString($row, 1, $member["USER_FIRSTNAME"]);
             $sheet->writeString($row, 2, $member["USER_FULLNAME"]);
             $sheet->writeString($row, 3, $member["USER_EMAIL"]);
             $sheet->writeString($row, 4, $member["USER_PROFILE_FACULTY"]);
             $row++;
         }
     }
     $excel->close();
 }
Exemple #25
0
 function storeanswer()
 {
     $cid = $_POST["cid"];
     $eid = $_POST["eid"];
     $qid = $_POST["qid"];
     $aid = $_POST["aid"];
     $value = $_POST["value"];
     if (elearning_user::get_instance(lms_steam::get_current_user()->get_name(), elearning_mediathek::get_instance()->get_course()->get_id())->has_exam_finished()) {
         echo !$value;
     } else {
         $course = elearning_mediathek::get_elearning_course_by_id($this->courseid);
         $chapter = $course->get_chapter_by_id($cid);
         $question = $chapter->get_question_by_id($qid);
         $answer = $question->get_answer_by_id($aid);
         $answer->store_answer($value);
         echo $value;
     }
 }
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     $r = "";
     foreach ($path as $s) {
         $r .= $s;
     }
     error_log("Path: " . $r);
     if (is_string($path)) {
         $path = url_parse_rewrite_path($path);
     }
     if (!isset($portal) || !is_object($portal)) {
         $portal = lms_portal::get_instance();
         $portal->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_mediathing") {
             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 = $portal->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;
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $html_handler = new koala_html_course($owner);
     if (count($path) > 1 && $path[1] == "create_exit") {
         // sinnvolle aktionen hier
         $action = "create_exit";
         include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php';
     } else {
         $action = "index";
         include PATH_EXTENSIONS . 'units_mediathing/modules/units_mediathing.php';
     }
 }
Exemple #27
0
 public function processData(\IRequestObject $requestObject)
 {
     $this->params = $requestObject->getParams();
     isset($this->params[0]) ? $this->id = $this->params[0] : "";
     $currentUser = \lms_steam::get_current_user();
     $buddies = $currentUser->get_buddies();
     $changed = false;
     foreach ($buddies as $i => $buddy) {
         if ($buddy->get_id() == $this->id) {
             unset($buddies[$i]);
             $changed = true;
         }
     }
     if (!$changed) {
         throw new \Exception("User isn't part of your buddylist");
     } else {
         $currentUser->set_buddies($buddies);
     }
 }
 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;
 }
 public function get_context_menu($context, $params = array())
 {
     if ($context !== 'units') {
         return array();
     }
     $user = lms_steam::get_current_user();
     $menu = array();
     if ($this->steam_object->check_access_write($user)) {
         if (isset($_GET["show"]) && $_GET["show"] == "all") {
             $menu[] = array("name" => gettext("Show one"), "link" => $this->get_link_base());
         } else {
             $menu[] = array("name" => gettext("Show all"), "link" => $this->get_link_base() . "?show=all");
         }
         $menu[] = array("name" => gettext("Export (Excel)"), "link" => $this->get_link_base() . "export_excel");
         $menu[] = array("name" => gettext("Edit sheets"), "link" => $this->get_link_base() . "sheets_edit");
         $menu[] = array("name" => gettext("Preferences"), "link" => $this->get_link_base() . "edit");
         $menu[] = array("name" => gettext("Delete unit"), "link" => $this->get_link_base() . "delete");
     }
     return $menu;
 }
Exemple #30
0
 function __construct()
 {
     $this->portal = lms_portal::get_instance();
     $this->portal->initialize(GUEST_NOT_ALLOWED);
     $this->user = lms_steam::get_current_user();
     $this->cache = get_cache_function($this->user->get_name(), 86400);
     $this->request = $_REQUEST;
     $this->post = $_POST;
     switch ($this->request['action']) {
         case "sort_inventory":
             $this->sort_inventory();
             break;
         case "get_user_attribute":
             $this->get_user_attribute();
             break;
         case "set_user_attribute":
             $this->set_user_attribute();
             break;
         case "set_boxes":
             $this->set_boxes();
             break;
         case "get_boxes":
             $this->get_boxes();
             break;
         case "get_current_user":
             $this->get_current_user();
             break;
         case "set_courses_units_boxes":
             $this->set_courses_units_boxes();
             break;
         case "get_courses_units_boxes":
             $this->get_courses_units_boxes();
             break;
         case "set_list_inventory_boxes":
             $this->set_list_inventory_boxes();
             break;
         case "get_list_inventory_boxes":
             $this->get_list_inventory_boxes();
             break;
     }
 }