Example #1
0
 public function getHtml()
 {
     $portal = \lms_portal::get_instance();
     $annotations = $this->data->get_annotations();
     $annotations = array_reverse($annotations);
     $lastAnnotation = 0;
     foreach ($annotations as $annotation) {
         $this->getContent()->setCurrentBlock("BLOCK_CHAT");
         if ($lastAnnotation === 0) {
             $lastAnnotation = $annotation->get_attribute("OBJ_CREATION_TIME");
             $this->getContent()->setCurrentBlock("BLOCK_STATUS");
             $this->getContent()->setVariable("STATUS_MESSAGE", "Diskussion mit " . $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname() . ".<br>" . getReadableDate($lastAnnotation));
             $this->getContent()->parse("BLOCK_STATUS");
         } else {
             $tmp = $lastAnnotation;
             $lastAnnotation = $annotation->get_attribute("OBJ_CREATION_TIME");
             if ($lastAnnotation - $tmp > 600) {
                 $this->getContent()->setCurrentBlock("BLOCK_STATUS");
                 $this->getContent()->setVariable("STATUS_MESSAGE", getReadableDate($lastAnnotation));
                 $this->getContent()->parse("BLOCK_STATUS");
             }
         }
         $this->getContent()->setCurrentBlock("BLOCK_OUTGOING");
         $this->getContent()->setVariable("OUTGOING_MESSAGE", $annotation->get_content());
         $this->getContent()->setVariable("OUTGOING_IMG", \lms_user::get_user_image_url(32, 32));
         $this->getContent()->setVariable("OUTGOING_TITLE", $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname());
         $this->getContent()->parse("BLOCK_OUTGOING");
         $this->getContent()->parse("BLOCK_CHAT");
     }
     return $this->getContent()->get();
 }
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     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);
     }
     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_pyramiddiscussion") {
             return;
         }
         $koala_container = new koala_container_pyramiddiscussion($steam_unit, new units_pyramiddiscussion($owner->get_steam_object()));
         $unit = $koala_container;
     }
     $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 = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]);
     $current_semester = $owner->get_semester();
     //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/";
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $html_handler = new koala_html_course($owner);
     $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit));
     $course = $owner;
     include PATH_EXTENSIONS . "units_pyramiddiscussion/modules/units_pyramiddiscussion.php";
 }
Example #3
0
    public function getHtml()
    {
        if (!self::$once) {
            \lms_portal::get_instance()->set_prototype_enabled(false);
            \lms_portal::get_instance()->add_javascript_src("jquery", PATH_URL . "widgets/js/jquery.js");
            \lms_portal::get_instance()->add_javascript_src("StarRating", PATH_URL . "widgets/js/StarRating.js");
            \lms_portal::get_instance()->add_css_style_link(PATH_URL . "widgets/css/StarRating.css");
            self::$once = true;
        }
        $js = <<<END
\$(function(){ 
\t\$('.star' + {$this->id}).rating({
\t\t\talert("Hund"); 
\t\t}
\t});
});
END;
        $this->getContent()->setVariable("STAR_ID", $this->id);
        if ($this->readonly) {
            $this->getContent()->setVariable("DISABLED", "disabled=\"disabled\"");
        }
        if ($this->checked) {
            $this->getContent()->setVariable("CHECKED{$this->checked}", "checked=\"checked\"");
        }
        return "<script>" . $js . "</script>" . $this->getContent()->get();
    }
Example #4
0
 public static function get_instance()
 {
     if (self::$instance == null) {
         self::$instance = new lms_portal();
     }
     return self::$instance;
 }
Example #5
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;
 }
 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';
     }
 }
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     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);
     }
     $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_extern") {
             return;
         }
         $unit = new units_extern($owner->get_steam_object());
         $docextern = new koala_object_docextern($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 = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]);
     $current_semester = $owner->get_semester();
     $course = $owner;
     //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/";
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $html_handler = new koala_html_course($owner);
     $html_handler->set_context("units", array('subcontext' => 'unit', 'owner' => $owner, 'unit' => $docextern));
     switch ($action) {
         case 'edit':
             include self::$PATH . 'modules/units_extern_edit.php';
             exit;
             break;
         case 'delete':
             include self::$PATH . 'modules/units_extern_delete.php';
             exit;
             break;
     }
     include PATH_EXTENSIONS . 'units_extern/modules/units_extern.php';
 }
Example #8
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;
     }
 }
Example #9
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     $content = \Wave::getInstance()->loadTemplate("wave.template.html");
     if (strtolower($this->calledNamespace) === "wave" && strtolower($this->calledCommand) === "index") {
         $sideId = $this->params[0];
         $internalPath = $this->params;
         array_shift($internalPath);
         $sideUrl = $this->getExtension()->getExtensionUrl() . "Index/" . $sideId . "/";
     } else {
         $sideObject = \steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), WAVE_PATH_INTERN);
         if ($sideObject instanceof \steam_object) {
             $sideId = $sideObject->get_id();
             $internalPath = $this->params;
             $sideUrl = PATH_URL;
         } else {
             die("WAVE config broken (WAVE_PATH_INTERN: " . WAVE_PATH_INTERN . ")");
         }
     }
     if (!isset($internalPath)) {
         $internalPath = array();
     }
     $waveEngine = new \Wave\Model\WaveEngine($sideId, $internalPath, $sideUrl);
     $waveSide = $waveEngine->getSide();
     $waveObject = $waveEngine->getCurrentObject();
     if ($waveObject instanceof \Wave\Model\WavePage) {
         $content->setVariable("CONTENT", $waveObject->getHtml());
         $rawHtml = new \Widgets\RawHtml();
         $rawHtml->setHtml($content->get());
         $frameResponseObject->addWidget($rawHtml);
         return $frameResponseObject;
     } else {
         if ($waveObject instanceof \Wave\Model\WaveDownload) {
             $waveObject->download();
             die;
         } else {
             die("Not Wave-Object detected.");
         }
     }
 }
Example #10
0
 public function handleRequest($pathArray)
 {
     $frame = lms_portal::get_instance();
     //$frame->initialize(GUEST_NOT_ALLOWED, false);
     $frame->init_login(GUEST_ALLOWED, false);
     lms_steam::connect(STEAM_SERVER, STEAM_PORT, $frame->get_user()->get_login(), $frame->get_user()->get_password());
     $urlRequestObject = new UrlRequestObject();
     $urlRequestObject->setParams($pathArray);
     $command = new \Wave\Commands\Index();
     if ($command->validateData($urlRequestObject)) {
         $command->processData($urlRequestObject);
         try {
             $frameResponeObject = $command->frameResponse(new FrameResponseObject());
         } catch (steam_exception $e) {
             if ($e->get_code() === 300) {
                 die("no read access");
             }
         }
         $data = \Widgets\Widget::getData($frameResponeObject->getWidgets());
         echo $data["html"];
     }
 }
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     if (!isset($portal) || !is_object($portal)) {
         $portal = lms_portal::get_instance();
         $portal->initialize(GUEST_NOT_ALLOWED);
     }
     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_pointlist") {
             return;
         }
         $koala_container = new koala_container_pointlist($steam_unit, new units_pointlist($owner->get_steam_object()));
         $unit = $koala_container;
     }
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $html_handler = new koala_html_course($owner);
     $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit));
     $user = lms_steam::get_current_user();
     $course = $owner;
     if (is_string($path)) {
         $path = url_parse_rewrite_path($path);
     }
     if (!is_object($owner) || !$owner instanceof koala_group_course) {
         throw new Exception("No owner (course) provided.", E_PARAMETER);
     }
     switch (TRUE) {
         case isset($path[1]) && $path[1] == "sheets_edit":
             include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_sheets_edit.php";
             break;
         case isset($path[1]) && $path[1] == "export_excel":
             include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist_excel.php";
             break;
         default:
             include PATH_EXTENSIONS . "units_pointlist/modules/units_pointlist.php";
             break;
     }
 }
Example #12
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $frameResponseObject->setTitle(gettext("Your Desktop"));
     // Cache for 7 Minutes
     $cache = get_cache_function($user->get_name(), 420);
     $feeds = $cache->call("koala_user::get_news_feeds_static", 0, 10, FALSE, $user);
     $home = \Home::getInstance();
     //$home->addJS();
     $content = $home->loadTemplate("home.template.html");
     $infobar = new \Widgets\InfoBar();
     $infobar->setHeadline(gettext("Hallo") . " " . $portal->get_user()->get_forename() . " " . $portal->get_user()->get_surname() . "!");
     $content->setVariable("INFOBAR", $infobar->getHtml());
     $captionImage = new \Widgets\CaptionImage();
     $captionImage->setLink(PATH_URL . "user/index/" . $user->get_name() . "/");
     $captionImage->setLinkText(gettext("To your profile"));
     $captionImage->setImageSrc(\lms_user::get_user_image_url(140, 185));
     $captionImage->setImageAlt(gettext("Profile Image"));
     $captionImage->setImageTitle(gettext("Complete your Profile"));
     $content->setVariable("PROFILEIMAGE", $captionImage->getHtml());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->addWidget($infobar);
     $rawHtml->addWidget($captionImage);
     $homeExtensions = \ExtensionMaster::getInstance()->getExtensionByType("IHomeExtension");
     foreach ($homeExtensions as $homeExtension) {
         $content->setCurrentBlock("HOME_EXTENSION");
         $widget = $homeExtension->getWidget();
         $rawHtml->addWidget($widget);
         $content->setVariable("HOME_EXTENSION_CONTENT", $widget->getHtml());
         $content->parse("HOME_EXTENSION");
     }
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #13
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     $author_id = isset($this->params[1]) ? $this->params[1] : null;
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("forum_all_topics.template.html");
     $dsc = $messageboard->get_attribute("OBJ_DESC");
     if (!empty($dsc)) {
         $content->setCurrentBlock("BLOCK_DESCRIPTION");
         $content->setVariable("FORUM_DESCRIPTION", get_formatted_output($dsc));
         $content->parse("BLOCK_DESCRIPTION");
     }
     $grp = $messageboard->get_environment()->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $content->setVariable("CURRENT_DISCUSSIONS_LABEL", gettext("Current Thread"));
     $content->setVariable("LABEL_SEARCH", gettext("Search"));
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($messageboard->get_id(), PATH_URL . "services/feeds/forum_public.php?id=" . $messageboard->get_id(), "discussion board", \lms_steam::get_link_to_root($messageboard));
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($messageboard->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "forums/" . $messageboard->get_id() . "/");
         exit;
     }
     if (empty($_GET["pattern"]) && !isset($author_id)) {
         $cache = get_cache_function(OBJ_ID, 300);
         $discussions = $cache->call("lms_forum::get_discussions", OBJ_ID);
     } elseif (isset($author_id)) {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_user_posts", $messageboard->get_id(), $author_id);
     } else {
         $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 300);
         $discussions = $cache->call("lms_forum::search_pattern", $messageboard->get_id(), $_GET["pattern"]);
     }
     $content->setVariable("LABEL_ALL_TOPICS", gettext("All Threads"));
     if ($messageboard->check_access_annotate(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_WRITE_ACCESS");
         if (isset($author_id)) {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("All Threads"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/");
         } else {
             $content->setVariable("LABEL_THREADS_POSTED_IN", gettext("Threads you've posted in"));
             // TODO: Passt der link?
             $content->setVariable("LINK_AUTHOR", PATH_URL . "forums/" . $messageboard->get_id() . "/?author=" . \lms_steam::get_current_user()->get_name());
         }
         // TODO: Passt der link?
         $content->setVariable("LINK_POST_NEW", PATH_URL . "messageboard/newDiscussion/" . $messageboard->get_id());
         $content->setVariable("LABEL_POST_NEW_THREAD", gettext("Post a new thread"));
         $content->parse("BLOCK_WRITE_ACCESS");
     }
     if ($messageboard->check_access_write(\lms_steam::get_current_user())) {
         $content->setCurrentBlock("BLOCK_ADMIN");
         $content->setVariable("LINK_EDIT", PATH_URL . "messageboard/editMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_EDIT", gettext("Preferences"));
         $content->setVariable("LINK_DELETE", PATH_URL . "messageboard/deleteMessageboard/" . $messageboard->get_id());
         $content->setVariable("LABEL_DELETE", gettext("Delete forum"));
         $content->parse("BLOCK_ADMIN");
     }
     $content->setCurrentBlock("BLOCK_WATCH");
     if ($is_watching) {
         $content->setVariable("LABEL_BOOKMARK", gettext("End watching"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=delete_bookmark&unsubscribe=" . $messageboard->get_id());
     } else {
         $content->setVariable("LABEL_BOOKMARK", gettext("Watch this forum"));
         // TODO: Passt der link?
         $content->setVariable("LINK_BOOKMARK", PATH_URL . "forums/" . $messageboard->get_id() . "/?action=bookmark_rss");
     }
     $content->parse("BLOCK_WATCH");
     // ACCESS
     $access_descriptions = \lms_forum::get_access_descriptions($grp);
     $access_descriptions = $access_descriptions[$messageboard->get_attribute(KOALA_ACCESS)];
     $access = $access_descriptions["summary_short"] . ": " . $access_descriptions["label"];
     $content->setCurrentBlock("BLOCK_ACCESS");
     $content->setVariable("TITLE_ACCESS", gettext("Access"));
     $content->setVariable("LABEL_ACCESS", $access);
     $content->parse("BLOCK_ACCESS");
     $content->setVariable("LABEL_TITLE", gettext("Title"));
     $content->setVariable("LABEL_AUTHOR", gettext("Author"));
     $content->setVariable("LABEL_REPLIES", gettext("Replies"));
     $content->setVariable("LABEL_LATEST_POST", gettext("Latest Post"));
     // PAGE SETZEN
     $no_discussions = count($discussions);
     $paginator = \lms_portal::get_paginator(20, $no_discussions, gettext("(%TOTAL discussions in forum)"));
     $start = $paginator["startIndex"];
     //$start = $portal->set_paginator( $content, 20, $no_discussions, gettext( "(%TOTAL discussions in forum)" ) );
     $end = $start + 20 > $no_discussions ? $no_discussions : $start + 20;
     for ($i = $start; $i < $end; $i++) {
         $discussion = $discussions[$i];
         $content->setVariable("PAGINATOR", $paginator["html"]);
         $content->setCurrentBlock("BLOCK_THREAD");
         if (time() - $discussion["LATEST_POST_TS"] > $_SESSION["last_login"]) {
             $content->setCurrentBlock("BLOCK_THREAD_NEW");
             $content->setVariable("NEW_LABEL", gettext("New"));
             $content->parse("BLOCK_THREAD_NEW");
         }
         $content->setVariable("THREAD_LINK", PATH_URL . "messageboard/viewDiscussion/" . $discussion["OBJ_ID"] . "/");
         $content->setVariable("THREAD_SUBJECT", h($discussion["OBJ_NAME"]));
         $content->setVariable("THREAD_LAST_ENTRY", how_long_ago($discussion["LATEST_POST_TS"]));
         // TODO: Passt der link?
         $content->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $discussion["AUTHOR_LOGIN"] . "/");
         $content->setVariable("AUTHOR_IMAGE", PATH_URL . "cached/get_document.php?id=" . $discussion["OBJ_ICON"] . "&type=usericon&width=30&height=40");
         $title = !empty($discussion["USER_ACADEMIC_TITLE"]) ? $discussion["USER_ACADEMIC_TITLE"] . " " : "";
         $content->setVariable("AUTHOR_NAME", h($title . $discussion["USER_FIRSTNAME"] . " " . $discussion["USER_FULLNAME"]));
         $content->setVariable("THREAD_REPLIES", h($discussion["REPLIES"]));
         $content->parse("BLOCK_THREAD");
     }
     $portal->set_rss_feed(PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID, gettext("Feed"), str_replace("%l", isset($login) ? $login : "", gettext("Subscribe to this forum's Newsfeed")));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($messageboard->get_name())));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #14
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $workplanExtension->addJS($fileName = 'jsgantt.js');
     $workplanExtension->addCSS($fileName = 'jsgantt.css');
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $objectID = $this->params[0];
     $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
         $tabBar->setActiveTab(4);
         $frameResponseObject->addWidget($tabBar);
         $xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
         // if user submitted new snapshot dialog add a now annotation/snapshot
         if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_snapshot"])) {
             $values = $_POST["values"];
             $newannotation = \steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $values["snapshotname"], strval($xmlfile[0]->get_version()), $workplanContainer);
             $xmlfile[0]->add_annotation($newannotation);
             $portal->set_confirmation("Snapshot " . $values["snapshotname"] . " erfolgreich erstellt.");
         }
         // display snapshot list
         $content = $workplanExtension->loadTemplate("workplan_snapshots.template.html");
         $snapshots = $xmlfile[0]->get_annotations();
         $howmany = count($snapshots);
         if ($howmany > 0) {
             $content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST");
             $content->setVariable("NAME_LABEL", "Name");
             $content->setVariable("DATE_LABEL", "Datum");
             $content->setVariable("VIEW_LABEL", "Ansicht");
             for ($count = count($snapshots) - 1; $count >= 0; $count--) {
                 $content->setCurrentBlock("BLOCK_SNAPSHOTS_LIST_ELEMENT");
                 $content->setVariable("ELEMENT_NAME", $snapshots[$count]->get_name());
                 $timestamp = $snapshots[$count]->get_attribute("OBJ_CREATION_TIME");
                 $content->setVariable("ELEMENT_DATE", strftime("%x %X", $timestamp));
                 $content->setVariable("ELEMENT_LIST", "Tabelle");
                 $content->setVariable("ELEMENT_GANTT", "Gantt-Diagramm");
                 $content->setVariable("WORKPLAN_VERSION", $snapshots[$count]->get_content());
                 $content->setVariable("WORKPLAN_ID", $objectID);
                 $content->setVariable("ANNOTATION_ID", $count);
                 $version = $snapshots[$count]->get_content();
                 if ($version == $xmlfile[0]->get_version()) {
                     $viewversion = $xmlfile[0];
                 } else {
                     $previousversions = $xmlfile[0]->get_previous_versions();
                     $viewversion = $previousversions[count($previousversions) - $version];
                 }
                 // change information of every snapshot to a form which is used to create the gantt view
                 $xml = simplexml_load_string($viewversion->get_content());
                 $helpToArray = $xml->children();
                 $list = array();
                 for ($counter = 0; $counter < count($helpToArray); $counter++) {
                     array_push($list, $helpToArray[$counter]);
                 }
                 usort($list, 'sort_xmllist');
                 $oids = "";
                 $names = "";
                 $start = "";
                 $end = "";
                 $depends = "";
                 $milestones = "";
                 for ($count2 = 0; $count2 < count($list); $count2++) {
                     $oids = $oids . $list[$count2]->oid . ",";
                     $names = $names . $list[$count2]->name . ",";
                     $start = $start . $list[$count2]->start . ",";
                     $end = $end . $list[$count2]->end . ",";
                     $depends = $depends . $list[$count2]->depends . ",";
                     if ($list[$count2]->getName() == 'milestone') {
                         $milestones = $milestones . "1,";
                     } else {
                         $milestones = $milestones . "0,";
                     }
                 }
                 $oids = "[" . substr($oids, 0, strlen($oids) - 1) . "]";
                 $names = "[" . substr($names, 0, strlen($names) - 1) . "]";
                 $start = "[" . substr($start, 0, strlen($start) - 1) . "]";
                 $end = "[" . substr($end, 0, strlen($end) - 1) . "]";
                 $depends = "[" . substr($depends, 0, strlen($depends) - 1) . "]";
                 $milestones = "[" . substr($milestones, 0, strlen($milestones) - 1) . "]";
                 $content->setVariable("WORKPLAN_OIDS", $oids);
                 $content->setVariable("WORKPLAN_NAMES", $names);
                 $content->setVariable("WORKPLAN_STARTS", $start);
                 $content->setVariable("WORKPLAN_ENDS", $end);
                 $content->setVariable("WORKPLAN_DEPENDS", $depends);
                 $content->setVariable("WORKPLAN_MILESTONES", $milestones);
                 $content->parse("BLOCK_SNAPSHOTS_LIST_ELEMENT");
             }
             $content->parse("BLOCK_SNAPSHOTS_LIST");
         } else {
             $content->setCurrentBlock("BLOCK_SNAPSHOTS_NO_LIST");
             $content->setVariable("NO_SNAPSHOTS", "Keine Snapshots zu diesem Projektplan vorhanden.");
             $content->parse("BLOCK_SNAPSHOTS_NO_LIST");
         }
         // if current user has the required rights display create snapshot dialog
         $content->setCurrentBlock("BLOCK_NEW_SNAPSHOT");
         $content->setVariable("WORKPLAN_ID", $objectID);
         $content->setVariable("LABEL_NEW_SNAPSHOT", "Neuen Snapshot erstellen");
         $content->setVariable("LABEL_NAME", "Name:*");
         $content->setVariable("LABEL_CREATE", "Abschicken");
         $content->setVariable("WORKPLAN_SHOW_CURRENTVERSION", "Aktuelle Version des Projektplans einblenden");
         $content->setVariable("WORKPLAN_HIDE_SNAPSHOT", "Snapshot ausblenden");
         $content->setVariable("WORKPLAN_HIDECURRENT_SNAPSHOT", "Aktuelle Version des Projektplans ausblenden");
         if ($user->get_id() == $workplanContainer->get_creator()->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content->setVariable("SNAPSHOT_RIGHTS", "");
         } else {
             $content->setVariable("SNAPSHOT_RIGHTS", "none");
         }
         $content->parse("BLOCK_NEW_SNAPSHOT");
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Example #15
0
 public static function error($error, $solution)
 {
     $portal = \lms_portal::get_instance();
     $portal->set_problem_description($error, $solution);
 }
Example #16
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $group_id = $path[1];
     $content = \Semester::getInstance()->loadTemplate("search_persons.template.html");
     if (!($steam_group = \steam_factory::get_object($GLOBALS['STEAM']->get_id(), $group_id))) {
         throw new \Exception('Group not found: ' . $group_id);
     }
     if (!$steam_group instanceof \steam_group) {
         throw new \Exception('Is not a group: ' . $group_id);
     }
     // always try to use the correct specialized group:
     if (!isset($group)) {
         $group = \koala_object::get_koala_object($steam_group);
     } else {
         if ($group instanceof \koala_object) {
             $group = \koala_object::get_koala_object($group->get_steam_object());
         } else {
             throw new \Exception("No 'group' param provided");
         }
     }
     // TODO: Passt der Link?
     $backlink = $group->get_url();
     if (!$group->is_admin($user)) {
         throw new \Exception("No admin of " . $group->get_groupname() . ": " . $user->get_name());
     }
     if (!empty($_REQUEST["add"]) && count($_REQUEST["add"]) > 0) {
         $login = key($_REQUEST["add"]);
         $new_member = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $login);
         if ($group instanceof \koala_group_tutorial) {
             if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
                 $course_learners_group = $group->steam_group_course_learners;
                 $subgroups = $course_learners_group->get_subgroups();
                 foreach ($subgroups as $sg) {
                     if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($new_member) && $sg != $steam_group) {
                         $already_member_and_exclusive = true;
                         $in_group = $sg;
                     }
                 }
             }
         }
         if (isset($already_member_and_exclusive) && $already_member_and_exclusive) {
             if (!isset($_POST['confirmed']) || $_POST['confirmed'] != "true") {
                 $content->setVariable("WARNING_TEXT", "<p/>" . gettext("Attention! The user you want to add already became member in another tutorial in the meantime."));
             }
             if (isset($_POST['confirmed']) && $_POST['confirmed'] === "true") {
                 if ($group->add_member($new_member)) {
                     // PROCEDURE FOR COURSE ADMINS
                     if ($group->get_attribute("OBJ_TYPE") === "course_staff") {
                         // TODO: fct to add an admin? set_sanction_all does not seem to work... :(
                         $steam_group->set_sanction_all($new_member);
                     }
                     if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") {
                         $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS");
                         $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"]));
                     }
                     $group_name = \koala_object::get_koala_object($group)->get_display_name();
                     $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n";
                     $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n";
                     $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information."));
                     \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message);
                     $cache = get_cache_function($new_member->get_name());
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE);
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE);
                     $cache->drop("lms_steam::user_get_groups", $new_member->get_name());
                     $cache->drop("lms_steam::user_get_profile", $new_member->get_name());
                     $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE);
                     $cache = get_cache_function($group->get_id());
                     $cache->drop("lms_steam::group_get_members", $group->get_id());
                     $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group.")));
                 }
             }
         } else {
             if ($group->add_member($new_member)) {
                 // PROCEDURE FOR COURSE ADMINS
                 if ($group->get_attribute("OBJ_TYPE") === "course_staff") {
                     // TODO: fct to add an admin? set_sanction_all does not seem to work... :(
                     $steam_group->set_sanction_all($new_member);
                 }
                 if ($group->get_attribute("OBJ_TYPE") == "course_tutorial" || $group->get_attribute("OBJ_TYPE") == "group_tutorial_koala") {
                     $no_of_learners = (int) $group->get_attribute("GROUP_NO_MEMBERS");
                     $group->set_attribute("GROUP_NO_MEMBERS", $no_of_learners + count($_REQUEST["add"]));
                 }
                 $group_name = \koala_object::get_koala_object($group)->get_display_name();
                 $message = str_replace("%NAME", $new_member->get_full_name(), gettext("Dear %NAME,")) . "\n\n";
                 $message .= str_replace("%GROUP", $group_name, gettext("You were added to '%GROUP' as a new member.")) . "\n\n";
                 $message .= gettext("This is an automatically generated message.") . " " . gettext("If you haven't been informed about this membership in advance, please contact the sender of this message.") . "\n\n" . str_replace("%GROUP", "<a href=\"" . $backlink . "\">" . $group_name . "</a>", gettext("See '%GROUP' for further information."));
                 \lms_steam::mail($new_member, $user, PLATFORM_NAME . ": " . str_replace("%GROUP", h($group_name), gettext("You were added to '%GROUP' as a new member")), $message);
                 $cache = get_cache_function($new_member->get_name());
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), TRUE);
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name(), FALSE);
                 $cache->drop("lms_steam::user_get_groups", $new_member->get_name());
                 $cache->drop("lms_steam::user_get_profile", $new_member->get_name());
                 $cache->drop("lms_portal::get_menu_html", $new_member->get_name(), TRUE);
                 $cache = get_cache_function($group->get_id());
                 $cache->drop("lms_steam::group_get_members", $group->get_id());
                 $portal->set_confirmation(str_replace("%NAME", $new_member->get_full_name(), gettext("%NAME successfully added to group.")));
             }
         }
     }
     if ($group->get_maxsize() > 0 && $group->get_maxsize() <= $group->count_members()) {
         $html_content = "<div class=\"infoBar\">" . gettext("The group is full! You can not add any further members, because the maximum size of the group has been reached. Please increase this value to add more members.") . "</div>";
     } else {
         $content->setVariable("HEAD_SEARCH", gettext("Search"));
         $content->setVariable("INFO_TEXT", gettext("Here you can lookup some people.") . " " . str_replace("%GROUP", $group->get_display_name(), gettext("You can add a search result as member to '<b>%GROUP</b>'.")));
         if (!empty($_REQUEST["pattern"])) {
             $content->setVariable("VALUE_PATTERN", $_REQUEST["pattern"]);
         }
         $content->setVariable("LABEL_CHECK_NAME", gettext("Name"));
         $content->setVariable("LABEL_CHECK_LOGIN", gettext("Email address or login"));
         $content->setVariable("LABEL_SEARCH", gettext("Search"));
         $content->setVariable("GROUP_ID", $group->get_id());
         $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
         // SEARCH RESULTS
         if (!empty($_REQUEST["pattern"])) {
             $cache = get_cache_function($user->get_name(), 60);
             $result = $cache->call("lms_steam::search_user", $_REQUEST["pattern"], $_REQUEST["lookin"]);
             if ($_REQUEST["lookin"] == "name") {
                 $content->setVariable("CHECKED_NAME", 'checked="checked"');
             } else {
                 $content->setVariable("CHECKED_LOGIN", 'checked="checked"');
             }
             // PROCEED RESULT SET
             $html_people = \Semester::getInstance()->loadTemplate("list_users.template.html");
             $no_people = count($result);
             if ($no_people > 0) {
                 if (isset($_REQUEST["backlink"])) {
                     $tmp_backlink = $_REQUEST["backlink"];
                 } else {
                     if (isset($backlink)) {
                         $tmp_backlink = $backlink;
                     }
                 }
                 //$start = $portal->set_paginator( 10, $no_people, "(" . gettext( "%TOTAL people in result set" ) . ")", "?pattern=" . $_REQUEST[ "pattern" ] . "&lookin=" . $_REQUEST[ "lookin" ] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink );
                 $paginator = \lms_portal::get_paginator(10, $no_people, "(" . gettext("%TOTAL people in result set") . ")", "?pattern=" . $_REQUEST["pattern"] . "&lookin=" . $_REQUEST["lookin"] . "&group=" . $_REQUEST["group"] . "&backlink=" . $tmp_backlink);
                 $start = $paginator["startIndex"];
                 $end = $start + 10 > $no_people ? $no_people : $start + 10;
                 $html_people->setVariable("PAGINATOR", $paginator["html"]);
                 $html_people->setVariable("LABEL_CONTACTS", gettext("Results") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_people), gettext("%a-%z out of %s")) . ")");
                 $html_people->setCurrentBlock("BLOCK_CONTACT_LIST");
                 $html_people->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
                 $html_people->setVariable("LABEL_SUBJECT_AREA", gettext("Subject area"));
                 $html_people->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
                 $html_people->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
                 for ($i = $start; $i < $end; $i++) {
                     $person = $result[$i];
                     $html_people->setCurrentBlock("BLOCK_CONTACT");
                     // TODO: Passt der Link?
                     $html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . $person["OBJ_NAME"] . "/");
                     // TODO: Passt der Link?
                     $icon_link = PATH_URL . "download/" . $person["OBJ_ICON"] . "/usericon/30/40";
                     $html_people->setVariable("CONTACT_IMAGE", $icon_link);
                     $html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"]));
                     $html_people->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . $person["OBJ_NAME"]);
                     $html_people->setVariable("LABEL_MESSAGE", gettext("Message"));
                     $html_people->setVariable("LABEL_SEND", gettext("Send"));
                     $html_people->setVariable("OBJ_DESC", h($person["OBJ_DESC"]));
                     $p = new \steam_object($GLOBALS["STEAM"]->get_id(), $person["OBJ_ID"]);
                     //if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to
                     //see if our person is already member in one of the other tutorials.
                     $already_member_and_exclusive = false;
                     if ($group instanceof \koala_group_tutorial) {
                         if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
                             $course_learners_group = $steam_group->get_parent_group();
                             $subgroups = $course_learners_group->get_subgroups();
                             foreach ($subgroups as $sg) {
                                 if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($p) && $sg != $steam_group) {
                                     $already_member_and_exclusive = true;
                                     $in_group = $sg;
                                 }
                             }
                         }
                     }
                     if (!$group->is_member($p)) {
                         if ($already_member_and_exclusive) {
                             $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><small><b>" . gettext("Attention: User already in tutorial") . " " . $in_group->get_name() . "<p /></b></small><input type=\"hidden\" name=\"confirmed\" value=\"true\"/><input type=\"submit\"  name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add anyhow") . "\"/></td>");
                         } else {
                             $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"add[" . h($person["OBJ_NAME"]) . "]\" value=\"" . gettext("Add") . "\"/></td>");
                         }
                     } else {
                         $html_people->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\">" . gettext("Already a member.") . "</td>");
                     }
                     $html_people->parse("BLOCK_CONTACT");
                 }
                 $html_people->parse("BLOCK_CONTACT_LIST");
             } else {
                 $html_people->setVariable("LABEL_CONTACTS", gettext("No results."));
             }
             $content->setVariable("HTML_USER_LIST", $html_people->get());
         } else {
             $content->setVariable("CHECKED_NAME", 'checked="checked"');
         }
     }
     /*
     $portal->set_page_title( gettext( "Add member" ) );
     
     // give input focus to search field:
     $portal->add_javascript_onload("group_add_member", "document.getElementById('pattern').focus();");
     
     if(!isset($html_content))
     {
     	$portal->set_page_main(
     		array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ),
     		$content->get(),
     		""
     		);
     } 
     else
     {
     	$portal->set_page_main(
     		array( $group->get_link(), array( "name" => gettext( "Add member" ) ) ),
     		$html_content,
     		""
     		);
     }
     $portal->show_html();
     */
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #17
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $current_user = \lms_steam::get_current_user();
     $login = $current_user->get_name();
     //$path = $request->getPath();
     if (isset($this->id)) {
         $userName = $this->id;
         $user = \steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $userName);
     } else {
         $user = $current_user;
     }
     //$portal=\lms_portal::get_instance();
     $cache = get_cache_function($login, 86400);
     //	$portal->set_page_title( $login );
     $html_handler_profile = new \koala_html_profile($user);
     $html_handler_profile->set_context("groups");
     $content = \Profile::getInstance()->loadTemplate("list_groups.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_groups.template.html" );
     if ($this->viewer_authorized($current_user, $user)) {
         $public = $user->get_id() != $current_user->get_id() ? TRUE : FALSE;
         $groups = $cache->call("lms_steam::user_get_groups", $login, $public);
         usort($groups, "sort_objects");
         $no_groups = count($groups);
         if ($no_groups > 0) {
             $content->setCurrentBlock("BLOCK_GROUP_LIST");
             $pageIterator = \lms_portal::get_paginator(10, $no_groups, "(" . gettext("%TOTAL groups in list") . ")");
             $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
             $start = $pageIterator["startIndex"];
             $end = $start + 10 > $no_groups ? $no_groups : $start + 10;
             if ($current_user->get_id() == $user->get_id()) {
                 $content->setVariable("LABEL_GROUPS", gettext("Your groups") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
             } else {
                 $content->setVariable("LABEL_GROUPS", str_replace("%NAME", $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME"), gettext("%NAME's groups")) . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_groups), gettext("%a-%z out of %s")) . ")");
             }
             // GROUPS
             $content->setVariable("LABEL_NAME_DESCRIPTION", gettext("Name, description"));
             $content->setVariable("LABEL_MEMBERS", gettext("Members list"));
             $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
             if ($user->get_id() == $current_user->get_id()) {
                 $content->setVariable("TH_MANAGE_GROUP", gettext("Manage membership"));
             }
             for ($i = $start; $i < $end; $i++) {
                 $group = $groups[$i];
                 $content->setCurrentBlock("BLOCK_GROUP");
                 $content->setVariable("GROUP_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/");
                 $content->setVariable("GROUP_NAME", h($group["OBJ_NAME"]));
                 $content->setVariable("MEMBER_LINK", PATH_URL . "groups/" . $group["OBJ_ID"] . "/members/");
                 $content->setVariable("GROUP_MEMBERS", h($group["GROUP_NO_MEMBERS"]));
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?group=" . $group["OBJ_ID"]);
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
                 if ($user->get_id() == $current_user->get_id()) {
                     $content->setVariable("TD_MANAGE_GROUP", "<a href=\"" . PATH_URL . "group_cancel.php?group=" . $group["OBJ_ID"] . "\">" . gettext("Resign") . "</a>");
                 }
                 $content->setVariable("OBJ_DESC", h($group["OBJ_DESC"]));
                 $content->parse("BLOCK_GROUP");
             }
             $content->parse("BLOCK_GROUP_LIST");
         } else {
             $content->setVariable("LABEL_GROUPS", gettext("No memberships found."));
         }
     } else {
         $messagebox = "<div class=\"infoBar\"><h2>" . gettext("The user has restricted the display of this information.") . "</h2></div>";
         $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", $messagebox);
     }
     $frameResponseObject->setHeadline($html_handler_profile->get_headline());
     $html_handler_profile->set_html_left($content->get());
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($html_handler_profile->get_html());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
     //$portal->set_page_main( $html_handler_profile->get_headline(), $html_handler_profile->get_html());
     //return $portal->get_html();
 }
Example #18
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     if (!isset($messageboard) || !is_object($messageboard)) {
         if (empty($this->params[0])) {
             throw new \Exception("Environment not set.");
         }
         if (empty($this->params[1])) {
             throw new \Exception("Group not set.");
         }
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]))) {
             throw new \Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]))) {
             throw new \Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($messageboard) && is_object($messageboard)) {
         $creator = $messageboard->get_creator();
         if ($messageboard->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new message board is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the the forum name.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($messageboard) || !is_object($messageboard)) {
                 $new_forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New forum '%NAME' created."));
             } else {
                 $messageboard->set_attribute(OBJ_NAME, $values["name"]);
                 $messageboard->set_attribute(OBJ_DESC, $values["dsc"]);
                 $portal->set_confirmation(gettext("The changes have been saved."));
                 $new_forum = $messageboard;
             }
             $koala_forum = new \lms_forum($new_forum);
             $access = (int) $values["access"];
             $access_descriptions = \lms_forum::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_forum->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($messageboard) || !is_object($messageboard)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $portal->set_problem_description($problems, isset($hints) ? $hints : "");
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
     if (isset($messageboard) && is_object($messageboard)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $messageboard->get_name();
             $values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
             $values["access"] = $messageboard->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new forum in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create forum"));
         $pagetitle = gettext("Create forum");
         $breadcrumbheader = gettext("Add new forum");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
         $access_default = PERMISSION_PUBLIC;
     } else {
         $access_default = PERMISSION_PUBLIC;
     }
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_forum::get_access_descriptions($grp);
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($grp);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($messageboard) && is_object($messageboard)) {
         $headline[] = array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #19
0
    public function get_report_html($user)
    {
        $mediathek = elearning_mediathek::get_instance();
        /*
         * **********************************************
         * ********* CSS STYLE **************************
         * **********************************************
         */
        $css = <<<END
#loading_overlay {
\tdisplay:block;
\theight:100%;
\twidth:100%;
\tposition:absolute;
\ttop:0;
\tleft:0;
\tbackground-color:white;
\topacity:0.75;
\tfilter: alpha(opacity=75);
\tz-index: 300;
}

#loader img{
\tleft:50%;
\tmargin-left:-17px;
\tmargin-top:-17px;
    position:fixed;
    top:50%;
}
\t\t
.q {
\tdisplay:none;
\topacity: 0;
}

.q_right {
\tdisplay:none;
\topacity: 0;
}

.q_wrong {
\tdisplay:none;
\topacity: 0;
}

.q_active {
\tdisplay: block;
\topacity: 0; 
}
END;
        lms_portal::get_instance()->add_css_style($css);
        /*
         * **********************************************
         * ********* ONLOAD JAVASCRIPT ******************
         * **********************************************
         */
        $js_onload = <<<END
showQuestion(1);
END;
        lms_portal::get_instance()->add_javascript_onload("elearning_exam", $js_onload);
        /*
         * **********************************************
         * ********* JAVASCRIPT *************************
         * **********************************************
         */
        $js_code = <<<END
function hide_all_questions() {
\tvar allElems = document.getElementsByTagName('div');
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif (thisElem.className && thisElem.className == 'q_right_active') {
\t\t\tthisElem.className = 'q_right';
\t\t\tthisElem.style.opacity = 0;
\t\t\t//Effect.Hide(thisElem.id);
\t\t} else if (thisElem.className && thisElem.className == 'q_wrong_active') {
\t\t\tthisElem.className = 'q_wrong';
\t\t\tthisElem.style.opacity = 0;
\t\t\t//Effect.Hide(thisElem.id);
\t\t}
\t} 
}

function showQuestion(qnr) {
\tif (countWorngQuestions() == 0) {
\t\thide_all_questions();
\t\tdocument.images['img_prev'].style.display = 'none';
\t\tdocument.images['img_next'].style.display = 'none';
\t\tdocument.getElementById('question_headline').innerHTML = 'Sie haben alle Fragen richtig beantwortet!';
\t\treturn;
\t}

\tif (countWorngQuestions() == 1) {
\t\tdocument.getElementById('question_headline').innerHTML = 'Nicht korrekt beantwortete Frage';
\t} else {
\t\tdocument.getElementById('question_headline').innerHTML = 'Nicht korrekt beantwortete Fragen';
\t}
\t
\tif (qnr > countQuestions()) {
\t\treturn;
\t}
\tif (document.getElementById('q_'+qnr).className == 'q_right') {
\t\tif (actualQuestion() > qnr) {
\t\t\tshowQuestion(qnr-1);
\t\t} else {
\t\t\tshowQuestion(qnr+1);
\t\t}
\t\treturn;
\t} 
\t
\thide_all_questions();
\tdocument.getElementById('q_'+qnr).className = document.getElementById('q_'+qnr).className + '_active';
\tEffect.Appear('q_'+qnr);
\tupdateButtons();
}

function actualQuestion() {
\tvar allElems = document.getElementsByTagName('div');
\tj = 0;
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif (thisElem.className && (thisElem.className == 'q_right' || thisElem.className == 'q_wrong')) {
\t\t\tj++;
\t\t} else if (thisElem.className && (thisElem.className == 'q_right_active' || thisElem.className == 'q_wrong_active')) {
\t\t\tj++;
\t\t\treturn j;
\t\t}
\t}
}

function countQuestions() {
\tvar allElems = document.getElementsByTagName('div');
\tj = 0;
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif (thisElem.className && (thisElem.className == 'q_right' || thisElem.className == 'q_wrong' || thisElem.className && thisElem.className == 'q_right_active' || thisElem.className && thisElem.className == 'q_wrong_active')) {
\t\t\tj++;
\t\t}
\t}
\treturn j;
}

function countWorngQuestions() {
\tvar allElems = document.getElementsByTagName('div');
\tj = 0;
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif ((thisElem.className && thisElem.className == 'q_wrong') || (thisElem.className && thisElem.className == 'q_wrong_active')) {
\t\t\tj++;
\t\t}
\t}
\treturn j;
}

function showNextQuestion() {
\tshowQuestion(actualQuestion() + 1);
}

function showPrevQuestion() {
\tshowQuestion(actualQuestion() - 1);
}

function updateButtons() {
\tif (hasPrevWrongQuestion()) {
\t\tdocument.images['img_prev'].style.display = 'block';
\t} else {
\t\tdocument.images['img_prev'].style.display = 'none';
\t}
\t
\tif (hasNextWrongQuestion()) {
\t\tdocument.images['img_next'].style.display = 'block';
\t} else {
\t\tdocument.images['img_next'].style.display = 'none';
\t}
}

function hasPrevWrongQuestion() {
\tvar allElems = document.getElementsByTagName('div');
\tvar j = 0;
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif ((thisElem.className && thisElem.className == 'q_right') || (thisElem.className && thisElem.className == 'q_wrong') || (thisElem.className && thisElem.className == 'q_right_active') || (thisElem.className && thisElem.className == 'q_wrong_active')) {
\t\t\tj++;
\t\t\tif (j == actualQuestion()) {
\t\t\t\tfor (var k = i-1; k >= 0; k--) {
\t\t\t\t\tvar nthisElem = allElems[k];
\t\t\t\t\tif ((nthisElem.className && nthisElem.className == 'q_wrong') || (nthisElem.className && nthisElem.className == 'q_wrong_active')) {
\t\t\t\t\t\treturn true;
\t\t\t\t\t}
\t\t\t\t}
\t\t\t\treturn false;
\t\t\t}
\t\t}
\t}
\treturn false;
}

function hasNextWrongQuestion() {
\tvar allElems = document.getElementsByTagName('div');
\tvar j = 0;
\tfor (var i = 0; i < allElems.length; i++) {
\t\tvar thisElem = allElems[i];
\t\tif ((thisElem.className && thisElem.className == 'q_right') || (thisElem.className && thisElem.className == 'q_wrong') || (thisElem.className && thisElem.className == 'q_right_active') || (thisElem.className && thisElem.className == 'q_wrong_active')) {
\t\t\tj++;
\t\t\tif (j == actualQuestion()) {
\t\t\t\tfor (var k = i+1; k < allElems.length; k++) {
\t\t\t\t\tvar nthisElem = allElems[k];
\t\t\t\t\tif ((nthisElem.className && nthisElem.className == 'q_wrong') || (nthisElem.className && nthisElem.className == 'q_wrong_active')) {
\t\t\t\t\t\treturn true;
\t\t\t\t\t}
\t\t\t\t}
\t\t\t\treturn false;
\t\t\t}
\t\t}
\t}
\treturn false;
}

END;
        lms_portal::get_instance()->add_javascript_code("elearning_exam", $js_code);
        $elearning_user = elearning_user::get_instance($this->myUser->get_name(), elearning_mediathek::get_instance()->get_course()->get_id());
        $html = "<div class=\"printonly\" id=\"noprint_exam\"><b>Der Prüfungsbericht kann nicht gedruckt werden.</b></div><div class=\"noprint\" id=\"elearning_exam\">";
        $html .= "<h2>Prüfungsbericht " . $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME") . "</h2>";
        if ($elearning_user->has_exam_passed()) {
            $html .= "Der Nutzer " . $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME") . " (" . $user->get_name() . ") hat den Kurs »" . $this->get_parent()->get_name() . "« mit <b>" . $elearning_user->get_exam_sum_score() . " von " . $elearning_user->get_exam_sum_points() . "</b> möglichen Punkten <b>bestanden</b>.";
        } else {
            $html .= "Der Nutzer " . $user->get_attribute("USER_FIRSTNAME") . " " . $user->get_attribute("USER_FULLNAME") . " (" . $user->get_name() . ") hat den Kurs »" . $this->get_parent()->get_name() . "« mit <b>" . $elearning_user->get_exam_sum_score() . " von " . $elearning_user->get_exam_sum_points() . "</b> möglichen Punkten <b>nicht bestanden</b>.";
        }
        $html .= "<br clear=\"all\"><h3 id=\"question_headline\"></h3>";
        $html .= "<table style=\"width:100%;\"><tr><td style=\"width:0%;vertical-align:top\"><img style=\"width:44px;height:44px;display:none;margin-top:50px;\" name=\"img_prev\" onclick=\"showPrevQuestion()\" onmouseover=\"document.images['img_prev'].src='/styles/stahl-orange/images/prev_hover.png';style.cursor='pointer'\" onmouseout=\"document.images['img_prev'].src='/styles/stahl-orange/images/prev.png';\" src=\"/styles/stahl-orange/images/prev.png\"></td><td style=\"width:100%;text-align:left\">";
        $html .= $this->get_questions_exam_result_html($user);
        $html .= "</td><td style=\"width:0%;vertical-align:top\"><img style=\"width:44px;height:44px;margin-top:50px\" name=\"img_next\" onclick=\"showNextQuestion()\" onmouseover=\"document.images['img_next'].src='/styles/stahl-orange/images/next_hover.png';style.cursor='pointer'\" onmouseout=\"document.images['img_next'].src='/styles/stahl-orange/images/next.png';\" src=\"/styles/stahl-orange/images/next.png\"></td></table>";
        $html .= "</div>";
        return $html;
    }
Example #20
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $objectID = $this->params[0];
     $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
     // move workplan to group workroom if form was submitted
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["move"])) {
         $values = $_POST["values"];
         $groupID = $values["groupid"];
         $newgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $groupID);
         $newroom = $newgroup->get_workroom();
         $workplanContainer->set_attribute("WORKPLAN_GROUP", $groupID);
         $workplanContainer->move($newroom);
         $portal->set_confirmation("Projektplan " . $workplanContainer->get_name() . " erfolgreich in Gruppe " . $newgroup->get_name() . " verschoben.");
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $content = $workplanExtension->loadTemplate("workplan_users.template.html");
         $content->setCurrentBlock("BLOCK_CONFIRMATION");
         $content->setVariable("CONFIRMATION_TEXT", "NONE");
         $content->parse("BLOCK_CONFIRMATION");
         $confirmationBar = new \Widgets\RawHtml();
         $confirmationBar->setHtml($content->get());
         $frameResponseObject->addWidget($confirmationBar);
         // if current user has required rights display actionbar
         if ($workplanContainer->get_creator()->get_id() == $user->get_id()) {
             $actionBar = new \Widgets\ActionBar();
             $actionBar->setActions(array(array("name" => "Mitarbeiter bearbeiten", "link" => "javascript:changeUsers(" . $objectID . ")")));
             $frameResponseObject->addWidget($actionBar);
         }
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
         $tabBar->setActiveTab(3);
         $frameResponseObject->addWidget($tabBar);
         $content = $workplanExtension->loadTemplate("workplan_users.template.html");
         $content->setCurrentBlock("BLOCK_USERS_LIST");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_NAME", "Name");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE", "Rolle");
         $content->setVariable("WORKPLAN_USERS_ELEMENT_RESSOURCE", "Ressourcenwert");
         // check if workplan is in group and save the right users in array (sorted according to their role)
         $group = 0;
         if (in_array("WORKPLAN_GROUP", $workplanContainer->get_attribute_names())) {
             $group = $workplanContainer->get_attribute("WORKPLAN_GROUP");
         }
         if ($group == 0) {
             $users = array();
             array_push($users, $workplanContainer->get_creator());
         } else {
             $groupObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group);
             $users = array();
             $normalusers = array();
             $groupusers = $groupObject->get_members();
             array_push($users, $workplanContainer->get_creator());
             for ($count = 0; $count < count($groupusers); $count++) {
                 if ($groupusers[$count]->get_id() != $workplanContainer->get_creator()->get_id()) {
                     if (in_array("WORKPLAN_" . $groupusers[$count]->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
                         array_push($users, $groupusers[$count]);
                     } else {
                         array_push($normalusers, $groupusers[$count]);
                     }
                 }
             }
             $users = array_merge($users, $normalusers);
         }
         // display found users sorted according to their role
         for ($count = 0; $count < count($users); $count++) {
             $content->setCurrentBlock("BLOCK_USERS_ELEMENT");
             $content->setVariable("WORKPLAN_USERS_ELEMENT_NAME_VALUE", $users[$count]->get_full_name());
             $content->setVariable("WORKPLAN_USERS_ELEMENT_RESSOURCE_VALUE", $workplanContainer->get_attribute("WORKPLAN_" . $users[$count]->get_id() . "_RESSOURCE"));
             if ($workplanContainer->get_creator()->get_id() == $users[$count]->get_id()) {
                 $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Projektersteller");
             } else {
                 if (in_array("WORKPLAN_" . $users[$count]->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
                     $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Projektleiter");
                 } else {
                     $content->setVariable("WORKPLAN_USERS_ELEMENT_ROLE_VALUE", "Mitarbeiter");
                 }
             }
             $content->parse("BLOCK_USERS_ELEMENT");
         }
         $content->parse("BLOCK_USERS_LIST");
         // if workplan is private display dialog to move it to a group the current user is member in
         if ($group == 0) {
             $groups = $user->get_groups();
             $koalagroups = array();
             for ($count = 0; $count < count($groups); $count++) {
                 $currentGroup = $groups[$count];
                 if (substr($currentGroup->get_groupname(), 0, 10) == 'PrivGroups' | substr($currentGroup->get_groupname(), 0, 12) == 'PublicGroups') {
                     array_push($koalagroups, $currentGroup);
                 }
             }
             if (count($koalagroups) > 0) {
                 $content->setCurrentBlock("BLOCK_USERS_TOGROUP");
                 $content->setVariable("WORKPLAN_TOGROUP", "Verschieben in Gruppe: ");
                 $content->setVariable("GROUPCOUNT", count($koalagroups));
                 $content->setVariable("LABEL_MOVE", "Verschieben");
                 for ($count = 0; $count < count($koalagroups); $count++) {
                     $currentGroup = $koalagroups[$count];
                     $content->setCurrentBlock("BLOCK_USERS_TOGROUP_ELEMENT");
                     $content->setVariable("GROUPID", $currentGroup->get_id());
                     $content->setVariable("GROUPNAME", $currentGroup->get_name());
                     $content->parse("BLOCK_USERS_TOGROUP_ELEMENT");
                 }
                 $content->parse("BLOCK_USERS_TOGROUP");
             }
         }
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Example #21
0
<?php

require_once "../etc/koala.conf.php";
require_once PATH_LIB . "format_handling.inc.php";
require_once PATH_ETC . "permissions.def.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$user = lms_steam::get_current_user();
$em = lms_steam::get_extensionmanager();
if (!($steam_group = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["group"]))) {
    throw new Exception("Group not found: " . $_GET["id"]);
}
if (!$steam_group instanceof steam_group) {
    throw new Exception("Is not a group: " . $_GET["id"]);
}
$group = koala_object::get_koala_object($steam_group);
$backlink = $group->get_url();
//if the group is a tutorial and the course has exclusive subgroups for tutorials set, we have to
//see if we are already member in one of the other tutorials.
$already_member_and_exclusive = false;
if ($group instanceof koala_group_tutorial) {
    if ($group->get_course_group()->get_attribute("EXCLUSIVE_TUTORIAL_MEMBERSHIP") === "TRUE") {
        $course_learners_group = $steam_group->get_parent_group();
        $subgroups = $course_learners_group->get_subgroups();
        foreach ($subgroups as $sg) {
            if (($sg->get_attribute("OBJ_TYPE") === "course_tutorial" || $sg->get_attribute("OBJ_TYPE") === "group_tutorial_koala") && $sg->is_member($user) && $sg != $steam_group) {
                $already_member_and_exclusive = true;
                $in_group = $sg;
            }
        }
    }
Example #22
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $newWorkplan = FALSE;
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_workplan"])) {
         $newWorkplan = TRUE;
         $values = $_POST["values"];
         $workplanContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $user->get_workroom());
         $workplanContainer->set_attribute("OBJ_TYPE", "WORKPLAN_CONTAINER");
         $xml = new \SimpleXMLElement("<workplan></workplan>");
         $xml->addAttribute("name", $values["name"]);
         $start = $values["start"];
         $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4));
         $workplanContainer->set_attribute("WORKPLAN_START", $start);
         $xml->addAttribute("start", $start);
         if (!empty($values["end"])) {
             $end = $values["end"];
             $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4));
             $workplanContainer->set_attribute("WORKPLAN_END", $end);
             $xml->addAttribute("end", $end);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_END", -1);
             $xml->addAttribute("end", -1);
         }
         if (!empty($values["description"])) {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", $values["description"]);
             $xml->addAttribute("description", $values["description"]);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", "");
             $xml->addAttribute("description", "");
         }
         \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "version.xml", $xml->saveXML(), "text/xml", $workplanContainer);
         $portal->set_confirmation("Projektplan " . $values["name"] . " erfolgreich erstellt.");
     }
     if (!$newWorkplan) {
         $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]);
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (!$newWorkplan) {
             $content->setCurrentBlock("BLOCK_CONFIRMATION");
             $content->setVariable("CONFIRMATION_TEXT", "NONE");
             $content->parse("BLOCK_CONFIRMATION");
         }
         // if current user has required rights display actionbar
         if ($workplanContainer->get_creator()->get_id() == $user->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
             $content->setVariable("LABEL_CHANGE", "Eigenschaften bearbeiten");
             $content->setVariable("LABEL_SNAPSHOT", "Snapshot erstellen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             if ($workplanContainer->get_creator()->get_id() == $user->get_id()) {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "");
             } else {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "none");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
         }
         $actionBar = new \Widgets\RawHtml();
         $actionBar->setHtml($content->get());
         $frameResponseObject->addWidget($actionBar);
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $workplanContainer->get_id()), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $workplanContainer->get_id()), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $workplanContainer->get_id()), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $workplanContainer->get_id()), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $workplanContainer->get_id())));
         $tabBar->setActiveTab(0);
         $frameResponseObject->addWidget($tabBar);
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (isset($_POST["edit"])) {
             $edit = $_POST["edit"];
         } else {
             $edit = 0;
         }
         // if the user clicked on the edit symbol in Index-Command-View display edit view
         if ($edit == 1) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             $content->setVariable("WORKPLAN_OVERVIEW_EDIT", "Eigenschaften bearbeiten");
             $content->setVariable("NAME_LABEL", "Projektname:*");
             $content->setVariable("START_LABEL", "Beginn:*");
             $content->setVariable("END_LABEL", "Ende:");
             $content->setVariable("CREATOR_LABEL", "Projektersteller:");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung:");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 $content->setVariable("DESCRIPTION_VALUE", $workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"));
             }
             $content->setVariable("LABEL_SAVE", "Speichern");
             $content->setVariable("LABEL_BACK", "Abbrechen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             // else display normal view
         } else {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE");
             $content->setVariable("WORKPLAN_OVERVIEW_ATTRIBUTE", "Eigenschaft");
             $content->setVariable("WORKPLAN_OVERVIEW_VALUE", "Wert");
             $content->setVariable("NAME_LABEL", "Projektname");
             $content->setVariable("START_LABEL", "Beginn");
             $content->setVariable("END_LABEL", "Ende");
             $content->setVariable("CREATOR_LABEL", "Projektersteller");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             } else {
                 $content->setVariable("END_VALUE", "-");
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 if (strlen(trim($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"))) > 0) {
                     $content->setVariable("DESCRIPTION_VALUE", nl2br($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION")));
                 } else {
                     $content->setVariable("DESCRIPTION_VALUE", "-");
                 }
             } else {
                 $content->setVariable("DESCRIPTION_VALUE", "-");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE");
         }
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Example #23
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     $lms_user = $portal->get_user();
     $content = \Startpage::getInstance()->loadTemplate("startpage.template.html");
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["portal_values"])) {
         $portal_user = $GLOBALS["STEAM"]->get_current_steam_user();
         $portal_user->set_attribute("USER_LANGUAGE", $_POST["portal_values"]["USER_LANGUAGE"]);
         $lang_index = language_support::get_language_index();
         language_support::choose_language($lang_index[$_POST["portal_values"]["USER_LANGUAGE"]]);
         $cache = get_cache_function($portal_user->get_name());
         $cache->drop("lms_steam::user_get_profile", $portal_user->get_name());
         $cache->drop("lms_portal::get_menu_html", $portal_user->get_name(), TRUE);
         header("Location: " . $_POST["portal_values"]["redirect"]);
     }
     if ($lms_user->is_logged_in()) {
         header("Location: " . PATH_URL . "home/");
         exit;
     } else {
         $content->setCurrentBlock("BLOCK_SIGN_IN");
         $content->setVariable("LOGIN_FORM_ACTION", URL_SIGNIN);
         $content->setVariable("LABEL_LOGIN", gettext("Login"));
         $content->setVariable("LABEL_PASSWORD", gettext("Password"));
         $content->setVariable("SIGN_IN_BUTTON_TEXT", gettext("Sign in"));
         $content->parse("BLOCK_SIGN_IN");
         if (STARTPAGE_AS_PORTAL) {
             $rawHtml = new \Widgets\RawHtml();
             $rawHtml->setHtml($content->get());
             $urlRequestObject = new \UrlRequestObject();
             $urlRequestObject->setNamespace("Portal");
             $urlRequestObject->setCommand("Index");
             $urlRequestObject->setParams(array(STARTPAGE_AS_PORTAL_ID));
             $command = new \Portal\Commands\Index();
             if ($command->validateData($urlRequestObject)) {
                 $command->processData($urlRequestObject);
                 $portalFrameResponeObject = $command->frameResponse(new \FrameResponseObject());
             }
             $frameResponseObject->addWidget($rawHtml);
             $frameResponseObject->addWidget($portalFrameResponeObject->getWidgets());
         } else {
             $startpage_text_path = "./styles/" . STYLE . "/etc/startpage_text.xml";
             if (file_exists($startpage_text_path)) {
                 $startpage_text = simplexml_load_file($startpage_text_path, null, LIBXML_NOCDATA);
                 $content->setVariable("STARTPAGE_TEXT_LEFT", $startpage_text->left);
                 $content->setVariable("STARTPAGE_TEXT_CENTER", $startpage_text->center);
                 $content->setVariable("STARTPAGE_TEXT_RIGHT", $startpage_text->right);
             } else {
                 $content->setVariable("STARTPAGE_TEXT_LEFT", "Konnte startpage_text.xml nicht finden.");
                 $content->setVariable("STARTPAGE_TEXT_CENTER", "");
                 $content->setVariable("STARTPAGE_TEXT_RIGHT", "");
             }
             $rawHtml = new \Widgets\RawHtml();
             $code = \Startpage::getInstance()->readJS();
             $code = str_replace("{STARTPAGE_IMAGE_TEXT_LONG}", STARTPAGE_IMAGE_TEXT_LONG, $code);
             $code = str_replace("{STARTPAGE_IMAGE_TEXT_MEDIUM}", STARTPAGE_IMAGE_TEXT_MEDIUM, $code);
             $code = str_replace("{STARTPAGE_IMAGE_TEXT_SHORT}", STARTPAGE_IMAGE_TEXT_SHORT, $code);
             $rawHtml->setJs($code);
             $rawHtml->setHtml($content->get());
             $frameResponseObject->addWidget($rawHtml);
         }
         $frameResponseObject->setTitle("");
         return $frameResponseObject;
     }
 }
Example #24
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     $timestamp = $this->params[1];
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"], $date->get_environment()->get_id());
         } else {
             include "bad_link.php";
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         define("OBJ_ID", $weblogId);
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     $weblog_html_handler->set_widget_categories();
     $weblog_html_handler->set_widget_archive();
     $first_of_month = $timestamp;
     $last_of_month = strtotime("-1 day", strtotime("+1 month", $first_of_month));
     $date_objects = $weblog->get_date_objects((int) $first_of_month, (int) $last_of_month);
     // $date_objects = $weblog->get_date_objects( );
     $no_entries = count($date_objects);
     //TODO: PAGINATOR REINKNALLEN
     $pageIterator = \lms_portal::get_paginator(5, $no_entries, gettext("%TOTAL entries in this archive."));
     //$content->setVariable("PAGEITERATOR", $pageIterator["html"]);
     $start = $pageIterator["startIndex"];
     //$start = $portal->set_paginator( 5, $no_entries, gettext( "%TOTAL entries in this archive." ) );
     $end = $start + 5 > $no_entries ? $no_entries : $start + 5;
     $weblog_html_handler->print_entries($date_objects, TRUE);
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", (isset($login))?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($weblog->get_name()), "link" => PATH_URL . "weblog/" . $weblog->get_id() . "/"), array("link" => "", "name" => strftime("%B %G", $timestamp)));
     //$portal->set_page_main(
     //	$headline,
     //	$weblog_html_handler->get_html()
     //);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #25
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     $current_semester = $this->params[1];
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     //$html_handler_course = new \koala_html_course($course);
     if (!$group instanceof \koala_group) {
         throw new \Exception("Variable group not set.");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["remove"]) && is_array($_POST["remove"])) {
             $id = key($_POST["remove"]);
             $member_to_kick = \steam_factory::username_to_object($GLOBALS["STEAM"]->get_id(), $id);
             $group->remove_member($member_to_kick);
             $frameResponseObject->setConfirmText(str_replace("%NAME", h($member_to_kick->get_attribute("USER_FIRSTNAME")) . " " . h($member_to_kick->get_attribute("USER_FULLNAME")), gettext("User %NAME successfully removed from group members.")));
             //$portal->set_confirmation( str_replace( "%NAME", h($member_to_kick->get_attribute( "USER_FIRSTNAME" ))." " . h($member_to_kick->get_attribute( "USER_FULLNAME" )), gettext( "User %NAME successfully removed from group members." ) ) );
             // clear caches:
             $cache = get_cache_function($member_to_kick->get_name());
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), TRUE);
             $cache->drop("lms_steam::user_get_groups", $member_to_kick->get_name(), FALSE);
             $cache->drop("lms_steam::user_get_profile", $member_to_kick->get_name());
             $cache->drop("lms_portal::get_menu_html", $member_to_kick->get_name(), TRUE);
             $cache = get_cache_function($group->get_id());
             $cache->drop("lms_steam::group_get_members", $group->get_id());
         } else {
             if (isset($_POST["hide"]) && is_array($_POST["hide"])) {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $users_to_hide = array_keys($_POST["hide"]);
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $tmp1_users_to_hide = array_unique(array_merge($hidden_members, $users_to_hide));
                 $tmp2_users_to_hide = array_diff($tmp1_users_to_hide, $displayed_staff_members);
                 $final_users_to_hide = array_unique(array_merge($tmp2_users_to_hide, $users_to_hide));
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $final_users_to_hide);
             } else {
                 $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
                 if (!is_array($hidden_members)) {
                     $hidden_members = array();
                 }
                 $displayed_staff_members = array();
                 $displayed_staff_members = array_keys($_POST["displayed_staff_member"]);
                 $users_to_hide = array();
                 $users_to_hide = array_diff($hidden_members, $displayed_staff_members);
                 $group->get_steam_group()->set_attribute("COURSE_HIDDEN_STAFF", $users_to_hide);
             }
             $frameResponseObject->setConfirmText("Sucessfully updated the visibility of course staff");
             //$portal->set_confirmation( "Sucessfully updated the visibility of course staff" );
         }
     }
     $cache = get_cache_function($group->get_id(), CACHE_LIFETIME_STATIC);
     switch (get_class($group)) {
         case "koala_group_course":
             $html_handler_group = new \koala_html_course($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->steam_group_staff->get_id() );
             $members = \lms_steam::group_get_members($group->steam_group_staff->get_id());
             break;
         default:
             $html_handler_group = new \koala_html_group($group);
             $html_handler_group->set_context("staff");
             //$members = $cache->call( "lms_steam::group_get_members", $group->get_id() );
             $members = \lms_steam::group_get_members($group->get_id());
             break;
     }
     $is_admin = $group->is_admin($user);
     $content = \Course::getInstance()->loadTemplate("list_staff.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "list_staff.template.html" );
     $no_members = count($members);
     //DONE
     if ($no_members > 0) {
         $pageIterator = \lms_portal::get_paginator(10, $no_members, "(" . str_replace("%NAME", h($group->get_name()), gettext("%TOTAL members in %NAME")) . ")");
         $content->setVariable("PAGEITERATOR", $pageIterator["html"]);
         $start = $pageIterator["startIndex"];
         //$start = $portal->set_paginator( $content, 10, $no_members, "(" . str_replace( "%NAME", h($group->get_name()), gettext( "%TOTAL members in %NAME" ) ) . ")" );
         $end = $start + 10 > $no_members ? $no_members : $start + 10;
         $content->setVariable("LABEL_CONTACTS", gettext("staff member") . " (" . str_replace(array("%a", "%z", "%s"), array($start + 1, $end, $no_members), gettext("%a-%z out of %s")) . ")");
         $content->setCurrentBlock("BLOCK_CONTACT_LIST");
         $content->setVariable("LABEL_NAME_POSITION", gettext("Name, position"));
         !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("LABEL_SUBJECT_AREA", gettext("Origin/Focus"));
         $content->setVariable("LABEL_COMMUNICATION", gettext("Communication"));
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_MANAGE or $content->setVariable("TH_MANAGE_CONTACT", gettext("Action"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("TH_STAFF_MEMBER_VISIBILITY", gettext("hidden"));
             !COURSE_STAFFLIST_HIDE or $content->setVariable("STAFF_MEMBER_VISIBILITY_TITLE", gettext("Selected staff members will not be visible on the course start page."));
         }
         !COURSE_STAFF_EXTENSIONS or $content->setVariable("TH_MANAGE_EXTENSIONS", "Status");
         $content->setVariable("BEGIN_HTML_FORM", "<form method=\"POST\" action=\"\">");
         $content->setVariable("END_HTML_FORM", "</form>");
         $hidden_members = $group->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
         if (!is_array($hidden_members)) {
             $hidden_members = array();
         }
         for ($i = $start; $i < $end; $i++) {
             $member = $members[$i];
             if ($member["USER_TRASHED"] === 1) {
                 continue;
             }
             $content->setCurrentBlock("BLOCK_CONTACT");
             $content->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($member["OBJ_NAME"]) . "/");
             $icon_link = $member["OBJ_ICON"] == 0 ? PATH_STYLE . "images/anonymous.jpg" : PATH_URL . "download/image/" . h($member["OBJ_ICON"]) . "/26/35";
             $content->setVariable("CONTACT_IMAGE", $icon_link);
             $title = !empty($member["USER_ACADEMIC_TITLE"]) ? h($member["USER_ACADEMIC_TITLE"]) . " " : "";
             $content->setVariable("CONTACT_NAME", $title . h($member["USER_FIRSTNAME"]) . " " . h($member["USER_FULLNAME"]));
             if (!COURSE_SHOW_ONLY_EXTERN_MAIL || COURSE_SHOW_ONLY_EXTERN_MAIL && is_string(\steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL")) && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_EMAIL") != "" && steam_factory::get_user($GLOBALS['STEAM']->get_id(), $member["OBJ_NAME"])->get_attribute("USER_FORWARD_MSG") === 1) {
                 $content->setVariable("LINK_SEND_MESSAGE", PATH_URL . "messages_write.php?to=" . h($member["OBJ_NAME"]));
                 $content->setVariable("LABEL_MESSAGE", gettext("Message"));
                 $content->setVariable("LABEL_SEND", gettext("Send"));
             }
             !COURSE_STAFF_FACULTY_AND_FOCUS or $content->setVariable("FACULTY_AND_FOCUS", h($member["USER_PROFILE_FACULTY"]));
             if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
                 !COURSE_STAFFLIST_MANAGE or $content->setVariable("TD_MANAGE_CONTACT", "<td align=\"center\"><input type=\"submit\"  name=\"remove[" . h($member["OBJ_NAME"]) . "]\" value=\"" . gettext("Remove") . "\"/></td>");
                 if (in_array($member["OBJ_ID"], $hidden_members)) {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" checked=\"checked\"/>" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 } else {
                     !COURSE_STAFFLIST_HIDE or $content->setVariable("TD_STAFF_MEMBER_VISIBILITY", "<td align=\"center\"><input type=\"checkbox\" name=\"hide[" . $member["OBJ_ID"] . "]\" />" . "\n\t\t\t<input type=\"hidden\" name=\"displayed_staff_member[" . $member["OBJ_ID"] . "]\" />" . "</td>");
                 }
             }
             $member_desc = empty($member["OBJ_DESC"]) ? "student" : $member["OBJ_DESC"];
             $status = secure_gettext($member_desc);
             $content->setVariable("OBJ_DESC", h($status));
             if (COURSE_STAFF_EXTENSIONS) {
                 $extensions = $group->get_extensions();
                 $result = "";
                 foreach ($extensions as $extension) {
                     $result .= $extension->get_member_info(\steam_factory::get_user($GLOBALS["STEAM"]->get_id(), $member["OBJ_NAME"]), $group);
                 }
                 $content->setVariable("EXTENSIONS_DATA", $result);
             }
             $content->parse("BLOCK_CONTACT");
         }
         if (\lms_steam::is_koala_admin($user) || !COURSE_KOALAADMIN_ONLY && $is_admin) {
             !COURSE_STAFFLIST_HIDE or $content->setVariable("LABEL_SUBMIT_BUTTON", gettext("Save"));
         }
         $content->parse("BLOCK_CONTACT_LIST");
     } else {
         $content->setVariable("LABEL_NO_MEMBERS", gettext("No staff found."));
     }
     $html_handler_group->set_html_left($content->get());
     //$portal->set_page_main( $html_handler_group->get_headline(), $html_handler_group->get_html() , "" );
     $frameResponseObject->setHeadline($html_handler_group->get_headline());
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($html_handler_group->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
 function handle_path($path, $owner = FALSE, $portal = FALSE)
 {
     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);
     }
     $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 = steam_factory::groupname_to_object( $GLOBALS[ "STEAM" ]->get_id(), $scg->get_name() . "." . $path[0]);
     $current_semester = $owner->get_semester();
     //$backlink = PATH_URL . "extensions/units/" . $path[0] ."/" . $path[1] . "/units/";
     $backlink = $owner->get_url() . $this->get_path_name() . "/";
     $action = "";
     if (isset($path[0]) && is_numeric($path[0])) {
         if (isset($path[1]) && is_numeric($path[1])) {
             $backlink .= $path[0] . "/";
             $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[1], CLASS_CONTAINER);
             $koala_container = new koala_container($container, $backlink);
             $backlink .= $path[1] . "/";
             $unit = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0]);
             if (isset($path[2])) {
                 $action = $path[2];
             }
         } else {
             $backlink .= $path[0] . "/";
             $container = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), (int) $path[0], CLASS_CONTAINER);
             $koala_container = new koala_container_homework($container, new units_homework($owner->get_steam_object()));
             $unit = $koala_container;
             if (isset($path[1])) {
                 $action = $path[1];
             }
         }
     } else {
         $container = $owner->get_workroom();
         $koala_container = new koala_container_workroom($container, $backlink);
         $unit = $koala_container;
         if (isset($path[0])) {
             $action = $path[0];
         }
     }
     if (is_object($unit) && $unit->get_attribute("UNIT_TYPE") !== "container_homework_unit_koala" && $unit->get_attribute("UNIT_TYPE") !== "units_homework") {
         if (!$unit instanceof koala_container_homework && !$this->get_koala_object_for($unit->get_steam_object(), $unit->get_steam_object()->get_type(), $unit->get_attribute(OBJ_TYPE)) instanceof koala_container_homework) {
             return FALSE;
         }
     }
     $koala_container->set_obj_types_invisible(array("container_wiki_koala", "room_wiki_koala", "KOALA_WIKI"));
     $html_handler = new koala_html_course($owner);
     $html_handler->set_context("units", array("subcontext" => "unit", "owner" => $owner, "unit" => $unit, "container" => $container));
     switch ($action) {
         case "new-folder":
             $environment = $container;
             unset($container);
             unset($koala_container);
             include "container_new.php";
             exit;
             break;
         case "edit":
             if ($container->get_id() == $unit->get_id()) {
                 include self::$PATH . "modules/units_homework_edit.php";
             } else {
                 include "container_edit.php";
             }
             exit;
             break;
         case "delete":
             include "container_delete.php";
             exit;
             break;
         case "new_homework":
             include self::$PATH . "modules/units_homework_upload.php";
             exit;
             break;
         case "feedback":
             include self::$PATH . "modules/units_homework_feedback.php";
             exit;
             break;
         case "points_tab":
             include self::$PATH . "modules/units_homework_pointslist.php";
             exit;
             break;
     }
     include self::$PATH . "modules/units_homework.php";
     return TRUE;
 }
Example #27
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $comment_id = $this->params[1];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $comment = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment_id);
     $content = \Messageboard::getInstance()->loadTemplate("comment_edit.template.html");
     if ($_SERVER["REQUEST_METHOD"] == "GET") {
         $content->setVariable("LABEL_HERE_IT_IS", "");
         $content->setVariable("TEXT_COMMENT", h($comment->get_content()));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
     } else {
         $values = $_POST["values"];
         if (!empty($values["save"])) {
             $comment->set_content($values["message"]);
             require_once "Cache/Lite.php";
             // Handle Related Cache-Data (for the case that the subject may be editable in the future)
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forumcache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for Weblog RSS Feed for the Comments
             $cache = get_cache_function(OBJ_ID, 600);
             $discussions = $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             header("Location: " . $values["return_to"]);
             exit;
         } else {
             // PREVIEW
             $content->setCurrentBlock("BLOCK_PREVIEW");
             $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the edit"));
             $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["message"]));
             $content->parse("BLOCK_PREVIEW");
             $content->setVariable("LABEL_HERE_IT_IS", gettext("Change it?"));
             $content->setVariable("TEXT_COMMENT", h($values["message"]));
             $content->setVariable("BACK_LINK", $values["return_to"]);
         }
     }
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
     $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
     $content->setVariable("LABEL_RETURN", gettext("back"));
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($messageboard);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name()), array("link" => "", "name" => gettext("Edit a comment")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #28
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $forum_id = $this->params[0];
     $portal = \lms_portal::get_instance();
     $user = \lms_steam::get_current_user();
     $rss_feeds = $user->get_attribute("USER_RSS_FEEDS");
     if (!($messageboard = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $forum_id))) {
         include "bad_link.php";
         exit;
     }
     if ($messageboard instanceof \steam_document) {
         $thread = $messageboard;
         $messageboard = $thread->get_annotating();
         define("OBJ_ID", $thread->get_id());
         if (!$thread->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     } else {
         define("OBJ_ID", $messageboard->get_id());
         if (!$messageboard->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     if (!$messageboard instanceof \steam_messageboard) {
         include "bad_link.php";
         exit;
     }
     $is_watching = FALSE;
     if (is_array($rss_feeds)) {
         foreach (array_keys($rss_feeds) as $item) {
             if ($item == $messageboard->get_id()) {
                 $is_watching = TRUE;
             }
         }
     }
     $object = $messageboard;
     $user = \lms_steam::get_current_user();
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $object->check_access_write($user)) {
         $values = $_POST["values"];
         if ($values["delete"]) {
             $_SESSION["confirmation"] = str_replace("%NAME", h($object->get_name()), gettext("The forum '%NAME' has been deleted."));
             $workroom = $object->get_environment();
             \lms_steam::delete($object);
             // Clean Cache for the deleted Forum
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache = get_cache_function(OBJ_ID, 600);
             $cache->drop("lms_steam::get_annotations", OBJ_ID);
             // Handle Related Cache-Data
             require_once "Cache/Lite.php";
             $cache = new \Cache_Lite(array("cacheDir" => PATH_CACHE));
             $cache->clean(OBJ_ID);
             // clean forum cache
             $fcache = get_cache_function(OBJ_ID, 600);
             $fcache->drop("lms_forum::get_discussions", OBJ_ID);
             // clean cache for forum RSS Feed for the Comments
             $fcache->drop("lms_steam::get_annotations", OBJ_ID);
             // clean rsscache
             $rcache = get_cache_function("rss", 600);
             // TODO: Passt der link?
             $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
             $rcache->drop("lms_rss::get_items", $feedlink);
             // Clean communication summary cache für the group/course
             if (is_object($workroom)) {
                 $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
                 $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
                 $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             }
             header("Location: " . PATH_URL . "group/index");
             exit;
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_delete.template.html");
     if ($object->check_access_write($user)) {
         $content->setVariable("LABEL_ARE_YOU_SURE", str_replace("%NAME", h($object->get_name()), gettext("Are you sure you want to delete the forum '%NAME' ?")));
         // TODO: Passt der link?
         $rootlink = \lms_steam::get_link_to_root($object);
         $content->setVariable("DELETE_BACK_LINK", $rootlink[1]["link"] . "communication/");
         $content->setCurrentBlock("BLOCK_DELETE");
         $content->setVariable("FORM_ACTION", $_SERVER["REQUEST_URI"]);
         $content->setVariable("LABEL_DELETE_IT", gettext("yes, delete it"));
         $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
         $content->setVariable("LABEL_RETURN", gettext("back"));
         $content->parse("BLOCK_DELETE");
     } else {
         $content->setVariable("LABEL_ARE_YOU_SURE", gettext("You have no rights to delete this forum!"));
     }
     $content->setVariable("TEXT_INFORMATION", gettext("The forum and all its entries be deleted."));
     $creator = $object->get_creator();
     $creator_data = $creator->get_attributes(array("USER_FULLNAME", "USER_FIRSTNAME", "OBJ_ICON"));
     $content->setVariable("LABEL_FROM_AND_AGO", str_replace("%N", "<a href=\"" . PATH_URL . "/user/" . $creator->get_name() . "/\">" . h($creator_data["USER_FIRSTNAME"]) . " " . h($creator_data["USER_FULLNAME"]) . "</a>", gettext("by %N")) . "," . how_long_ago($object->get_attribute("OBJ_CREATION_TIME")));
     $icon = $creator_data["OBJ_ICON"];
     if ($icon instanceof \steam_object) {
         $icon_id = $icon->get_id();
     } else {
         $icon_id = 0;
     }
     $content->setVariable("ICON_SRC", PATH_URL . "get_document.php?id=" . $icon_id);
     // TODO: Passt der Link?
     $rootlink = \lms_steam::get_link_to_root($object);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($object->get_name()), "link" => PATH_URL . "forums/" . $object->get_id() . "/"), array("name" => gettext("Delete forum")));
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #29
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $workplanExtension->addJS($fileName = 'jsgantt.js');
     $workplanExtension->addCSS($fileName = 'jsgantt.css');
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $objectID = $this->params[0];
     $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectID);
     $xmlfile = $workplanContainer->get_inventory_filtered(array(array("+", "class", CLASS_DOCUMENT)));
     $createContainer = 0;
     // check if user submitted create milestone or create task form
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (isset($_POST["new_milestone"])) {
             $createContainer = 1;
         } else {
             if (isset($_POST["new_task"])) {
                 $createContainer = 2;
             }
         }
     }
     // create new milestone or task
     if ($createContainer != 0) {
         $xmltree = new \SimpleXMLElement($xmlfile[0]->get_content());
         if ($createContainer == 1) {
             $xml = $xmltree->addChild("milestone");
             $newName = $_POST["milestonename"];
             $newStart = $_POST["milestonedate"];
             $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4));
             $newEnd = $_POST["milestonedate"];
             $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4));
             if (strlen($_POST["milestoneduration"]) > 0) {
                 $newDuration = $_POST["milestoneduration"];
             } else {
                 $newDuration = -1;
             }
             if (strlen($_POST["milestonedepends"]) > 0) {
                 $newDepends = $_POST["milestonedepends"];
             } else {
                 $newDepends = -1;
             }
             $newUsers = "";
             if (isset($_POST["milestoneusers"])) {
                 for ($count = 0; $count < count($_POST["milestoneusers"]); $count++) {
                     $newUsers = $newUsers . $_POST["milestoneusers"][$count] . ",";
                 }
                 $newUsers = substr($newUsers, 0, strlen($newUsers) - 1);
             }
             $portal->set_confirmation("Meilenstein " . $newName . " wurde erfolgreich erstellt.");
         } else {
             $xml = $xmltree->addChild("task");
             $newName = $_POST["taskname"];
             $newStart = $_POST["taskstart"];
             $newStart = mktime(0, 0, 0, substr($newStart, 3, 2), substr($newStart, 0, 2), substr($newStart, 6, 4));
             $newEnd = $_POST["taskend"];
             $newEnd = mktime(0, 0, 0, substr($newEnd, 3, 2), substr($newEnd, 0, 2), substr($newEnd, 6, 4));
             if (strlen($_POST["taskduration"]) > 0) {
                 $newDuration = $_POST["taskduration"];
             } else {
                 $newDuration = -1;
             }
             if (strlen($_POST["taskdepends"]) > 0) {
                 $newDepends = $_POST["taskdepends"];
             } else {
                 $newDepends = -1;
             }
             $newUsers = "";
             if (isset($_POST["taskusers"])) {
                 for ($count = 0; $count < count($_POST["taskusers"]); $count++) {
                     $newUsers = $newUsers . $_POST["taskusers"][$count] . ",";
                 }
                 $newUsers = substr($newUsers, 0, strlen($newUsers) - 1);
             }
             $portal->set_confirmation("Vorgang " . $newName . " wurde erfolgreich erstellt.");
         }
         $newContainer = \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $newName, $workplanContainer);
         $xml->addChild("name", $newName);
         $xml->addChild("oid", $newContainer->get_id());
         $newContainer->set_attribute("WORKPLAN_START", $newStart);
         $xml->addChild("start", $newStart);
         $newContainer->set_attribute("WORKPLAN_END", $newEnd);
         $xml->addChild("end", $newEnd);
         $xml->addChild("duration", $newDuration);
         $newContainer->set_attribute("WORKPLAN_DURATION", $newDuration);
         $xml->addChild("depends", $newDepends);
         $newContainer->set_attribute("WORKPLAN_DEPENDS", $newDepends);
         $newContainer->set_attribute("WORKPLAN_USERS", $newUsers);
         $xml->addChild("users", $newUsers);
         $xmlfile[0]->set_content($xmltree->saveXML());
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         // if user has the required rights display actionbar
         if ($user->get_id() == $workplanContainer->get_creator()->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html");
             $content->setCurrentBlock("BLOCK_CONFIRMATION");
             $content->setVariable("CONFIRMATION_TEXT", "NONE");
             $content->parse("BLOCK_CONFIRMATION");
             $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_ACTIONBAR");
             $content->setVariable("LABEL_NEW_SNAPSHOT", "Snapshot erstellen");
             $content->setVariable("WORKPLAN_ID", $objectID);
             $content->setVariable("LABEL_NEW_MILESTONE", "Neuer Meilenstein");
             $content->setVariable("LABEL_NEW_TASK", "Neuer Vorgang");
             $content->parse("BLOCK_WORKPLAN_GANTT_ACTIONBAR");
             $actionBar = new \Widgets\RawHtml();
             $actionBar->setHtml($content->get());
             $frameResponseObject->addWidget($actionBar);
         }
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $objectID), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $objectID), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $objectID), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $objectID), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $objectID)));
         $tabBar->setActiveTab(2);
         $frameResponseObject->addWidget($tabBar);
         $xml = simplexml_load_string($xmlfile[0]->get_content());
         $helpToArray = $xml->children();
         $list = array();
         for ($counter = 0; $counter < count($helpToArray); $counter++) {
             array_push($list, $helpToArray[$counter]);
         }
         usort($list, 'sort_xmllist');
         $content = $workplanExtension->loadTemplate("workplan_ganttview.template.html");
         if (count($list) == 0) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_GANTT_EMPTY");
             $content->setVariable("WORKPLAN_GANTT_EMPTY", "Keine Meilensteine oder Vorgänge zu diesem Projektplan vorhanden.");
             $content->parse("BLOCK_WORKPLAN_GANTT_EMPTY");
         }
         // change the format of the information so it can be displayed via javascript/jsgantt
         $oids = "[";
         $tasks = "[";
         $starts = "[";
         $ends = "[";
         $dependslist = "[";
         $milestones = "[";
         for ($counter = 0; $counter < count($list); $counter++) {
             $name = $list[$counter]->name;
             $tasks = $tasks . $name . ",";
             $starts = $starts . (int) $list[$counter]->start . ",";
             $ends = $ends . (int) $list[$counter]->end . ",";
             $oids = $oids . $list[$counter]->oid . ",";
             $depends = $list[$counter]->depends;
             if ($depends == -1) {
                 $dependslist = $dependslist . "-1,";
             } else {
                 $dependslist = $dependslist . $depends . ",";
             }
             if ($list[$counter]->getName() == "milestone") {
                 $milestones = $milestones . "1,";
             } else {
                 $milestones = $milestones . "0,";
             }
         }
         if (count($list) > 0) {
             $oids = substr($oids, 0, strlen($oids) - 1) . "]";
             $tasks = substr($tasks, 0, strlen($tasks) - 1) . "]";
             $starts = substr($starts, 0, strlen($starts) - 1) . "]";
             $ends = substr($ends, 0, strlen($ends) - 1) . "]";
             $dependslist = substr($dependslist, 0, strlen($dependslist) - 1) . "]";
             $milestones = substr($milestones, 0, strlen($milestones) - 1) . "]";
         } else {
             $oids = $oids . "]";
             $tasks = $tasks . "]";
             $starts = $starts . "]";
             $ends = $ends . "]";
             $dependslist = $dependslist . "]";
             $milestones = $milestones . "]";
         }
         $content->setCurrentBlock("BLOCK_GANTT_CHART");
         $content->setVariable("GANTT_DIV", "ganttchartdiv");
         $content->setVariable("WORKPLAN_GANTT_TASKS", $tasks);
         $content->setVariable("WORKPLAN_GANTT_OID", $oids);
         $content->setVariable("WORKPLAN_GANTT_MILESTONE", $milestones);
         $content->setVariable("WORKPLAN_GANTT_DEPENDS", $dependslist);
         $content->setVariable("WORKPLAN_GANTT_START", $starts);
         $content->setVariable("WORKPLAN_GANTT_END", $ends);
         $content->parse("BLOCK_GANTT_CHART");
         $content->setCurrentBlock("BLOCK_WORKPLAN_LIST_FORMULAR");
         $content->setVariable("LABEL_NEW_MILESTONE", "Meilenstein hinzufügen");
         $content->setVariable("LABEL_NEW_TASK", "Vorgang hinzufügen");
         $content->setVariable("NAME_LABEL", "Name:*");
         $content->setVariable("START_LABEL", "Beginn:*");
         $content->setVariable("END_LABEL", "Ende:*");
         $content->setVariable("DATE_LABEL", "Datum:*");
         $content->setVariable("DURATION_LABEL", "Dauer:");
         $content->setVariable("DEPENDS_LABEL", "Abhängigkeit:");
         $content->setVariable("USERS_LABEL", "Mitarbeiter:");
         $groupID = 0;
         if (in_array("WORKPLAN_GROUP", $workplanContainer->get_attribute_names())) {
             $groupID = $workplanContainer->get_attribute("WORKPLAN_GROUP");
         }
         if ($groupID == 0) {
             $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE");
             $content->setVariable("USER_ID", $user->get_id());
             $content->setVariable("USER_NAME", $user->get_full_name());
             $content->parse("BLOCK_USER_OPTION_MILESTONE");
             $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK");
             $content->setVariable("USER_ID", $user->get_id());
             $content->setVariable("USER_NAME", $user->get_full_name());
             if (in_array("WORKPLAN_" . $user->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) {
                 $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $user->get_id() . "_RESSOURCE"));
             } else {
                 $content->setVariable("USER_RESSOURCE", 0);
             }
             $content->parse("BLOCK_USER_OPTION_TASK");
         } else {
             $groupObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $groupID);
             $members = $groupObject->get_members();
             for ($count = 0; $count < count($members); $count++) {
                 $currentMember = $members[$count];
                 $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_MILESTONE");
                 $content->setVariable("USER_ID", $currentMember->get_id());
                 $content->setVariable("USER_NAME", $currentMember->get_full_name());
                 $content->parse("BLOCK_USER_OPTION_MILESTONE");
                 $content->setCurrentBlock("BEGIN BLOCK_USER_OPTION_TASK");
                 $content->setVariable("USER_ID", $currentMember->get_id());
                 $content->setVariable("USER_NAME", $currentMember->get_full_name());
                 if (in_array("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE", $workplanContainer->get_attribute_names())) {
                     $content->setVariable("USER_RESSOURCE", $workplanContainer->get_attribute("WORKPLAN_" . $currentMember->get_id() . "_RESSOURCE"));
                 } else {
                     $content->setVariable("USER_RESSOURCE", 0);
                 }
                 $content->parse("BLOCK_USER_OPTION_TASK");
             }
         }
         $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS");
         $content->setVariable("DEPENDS_OID", "-1");
         $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit");
         $content->parse("BLOCK_LIST_MILESTONE_DEPENDS");
         $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS");
         $content->setVariable("DEPENDS_OID", "-1");
         $content->setVariable("DEPENDS_NAME", "Keine Abhängigkeit");
         $content->parse("BLOCK_LIST_TASK_DEPENDS");
         for ($count = 0; $count < count($list); $count++) {
             if ($list[$count]->getName() == 'task') {
                 $content->setCurrentBlock("BLOCK_LIST_MILESTONE_DEPENDS");
                 $content->setVariable("DEPENDS_OID", $list[$count]->oid);
                 $content->setVariable("DEPENDS_NAME", $list[$count]->name);
                 $content->parse("BLOCK_LIST_MILESTONE_DEPENDS");
                 $content->setCurrentBlock("BLOCK_LIST_TASK_DEPENDS");
                 $content->setVariable("DEPENDS_OID", $list[$count]->oid);
                 $content->setVariable("DEPENDS_NAME", $list[$count]->name);
                 $content->parse("BLOCK_LIST_TASK_DEPENDS");
             }
         }
         $content->setVariable("LABEL_BACK", "Ausblenden");
         $content->setVariable("LABEL_ADD", "Hinzufügen");
         $content->setVariable("WORKPLAN_ID", $this->params[0]);
         $content->parse("BLOCK_WORKPLAN_LIST_FORMULAR");
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
Example #30
0
 public function getHtml()
 {
     \lms_portal::get_instance()->add_css_style_link(PATH_URL . "widgets/css/underconstruction.css");
     $this->getContent()->setVariable("DUMMY", "");
     return $this->getContent()->get();
 }