function get_question_script_exam_html($pathprefix, $eid)
 {
     $content = new HTML_TEMPLATE_IT();
     $content->loadTemplateFile(PATH_TEMPLATES_UNITS_ELEARNING . "elearning_question_multiplechoice.template.html");
     $content->setCurrentBlock("BLOCK_CHECKBOX");
     $content->setVariable("IMAGE_CHECKBOX_SELECTED_ENABLED", IMAGE_CHECKBOX_SELECTED_ENABLED);
     $content->setVariable("IMAGE_CHECKBOX_SELECTED_DISENABLED", IMAGE_CHECKBOX_SELECTED_DISABLED);
     $content->setVariable("IMAGE_CHECKBOX_UNSELECTED_ENABLED", IMAGE_CHECKBOX_UNSELECTED_ENABLED);
     $content->setVariable("IMAGE_CHECKBOX_UNSELECTED_DISENABLED", IMAGE_CHECKBOX_UNSELECTED_DISABLED);
     $content->setVariable("IMAGE_CHECKBOX_LOADER", IMAGE_CHECKBOX_LOADER);
     $content->parseCurrentBlock();
     $content->setCurrentBlock("BLOCK_EXAM_QUESTION_JAVASCRIPT");
     $content->setVariable("PATHPREFIX", $pathprefix);
     $content->setVariable("EID", $eid);
     $content->parseCurrentBlock();
     return $content->get();
 }
Example #2
0
function get_calendar_html($steam_calendar, $link, $timestamp = "")
{
    if (empty($timestamp)) {
        $timestamp = time();
    }
    $html = new HTML_TEMPLATE_IT();
    $html->loadTemplateFile(PATH_TEMPLATES . "widget_calendar.template.html");
    $html->setVariable("VALUE_MONTH", strftime("%b %G", $timestamp));
    $html->setVariable("ABBR_SUNDAY", "S");
    $html->setVariable("ABBR_MONDAY", "M");
    $html->setVariable("ABBR_TUESDAY", "T");
    $html->setVariable("ABBR_WEDNESDAY", "W");
    $html->setVariable("ABBR_THURSDAY", "T");
    $html->setVariable("ABBR_FRIDAY", "F");
    $html->setVariable("ABBR_SATURDAY", "S");
    $month = date("m", $timestamp);
    $year = date("Y", $timestamp);
    $next_month = $month == 12 ? 1 : $month + 1;
    $next_months_year = $month == 12 ? $year + 1 : $year;
    $first_day_of_month = strtotime("{$year}-{$month}-01");
    $last_day_of_month = strtotime("-1 day", strtotime("{$next_months_year}-{$next_month}-01"));
    $calendar_entries = $steam_calendar->get_entries($first_day_of_month, $last_day_of_month);
    $weekday_offset = strftime("%w", $first_day_of_month);
    $current_day = $first_day_of_month;
    for ($w = 1; $w <= 6; $w++) {
        if ($current_day > $last_day_of_month) {
            break;
        }
        $html->setCurrentBlock("BLOCK_WEEK");
        for ($wd = 0; $wd <= 6; $wd++) {
            if ($weekday_offset > 0) {
                $html->setVariable("WD{$wd}", "&nbsp;");
                $weekday_offset--;
                continue;
            }
            if ($current_day > $last_day_of_month) {
                $html->setVariable("WD{$wd}", "&nbsp;");
                $current_day = strtotime("+1 day", $current_day);
                continue;
            }
            $wdstr = strftime("%e", $current_day);
            $wdentries = $calendar_entries[$current_day];
            $wdlabel = $wdentries > 0 ? "<b>{$wdstr}</b>" : $wdstr;
            $html->setVariable("WD{$wd}", $wdlabel);
            $current_day = strtotime("+1 day", $current_day);
        }
        $html->parse("BLOCK_WEEK");
    }
    return $html->get();
}
 public function set_content()
 {
     $template = new HTML_TEMPLATE_IT();
     $template->loadTemplateFile(PORTFOLIO_PATH_TEMPLATES . "manage.template.html");
     // Set content on right side
     $template->setCurrentBlock("BLOCK_DESKTOP_LEFT");
     $template->setCurrentBlock("BLOCK_NEXTSTEPS");
     $template->setVariable("LABEL_NEXTSTEPS", "Nächste Schritte");
     $template->setCurrentBlock("BLOCK_NEXTSTEP");
     $template->setVariable("CONTENT_NEXTSTEPS", "Nummer 1");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_NEXTSTEPS", "Nummer 2");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_NEXTSTEPS", "Nummer 3");
     $template->parseCurrentBlock();
     $template->parseCurrentBlock();
     $template->setCurrentBlock("BLOCK_VISIBLE_PORTFOLIOS");
     $template->setVariable("LABEL_VISIBLE", "Sichtbare Portfolios");
     $template->setCurrentBlock("BLOCK_VISIBLE_BOX");
     $template->setVariable("CONTENT_VISIBLE", "Nummer 1");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_VISIBLE", "Nummer 2");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_VISIBLE", "Nummer 3");
     $template->parseCurrentBlock();
     $template->parseCurrentBlock();
     // Set content on left side
     $template->setCurrentBlock("BLOCK_DESKTOP_RIGHT");
     $template->setCurrentBlock("BLOCK_COMMENTS");
     $template->setVariable("LABEL_COMMENTS", "Kommentare");
     $template->setCurrentBlock("BLOCK_COMMENTS_BOX");
     $template->setVariable("CONTENT_COMMENTS", "Nummer 1");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_COMMENTS", "Nummer 2");
     $template->parseCurrentBlock();
     $template->setVariable("CONTENT_COMMENTS", "Nummer 3");
     $template->parseCurrentBlock();
     $template->parseCurrentBlock();
     $this->template->setVariable("HTML_CODE_LEFT", $template->get());
 }
Example #4
0
     if (empty($_SESSION['confirmation'])) {
         // don't warn if we came here on successful membership request...
         if ($group instanceof koala_group_course) {
             $portal->set_problem_description(gettext("You are already member of this course."));
         } else {
             $portal->set_problem_description(gettext("You are already member of this group."));
         }
     }
 } else {
     if ($already_member_and_exclusive) {
         if (empty($_SESSION['confirmation'])) {
             $portal->set_problem_description(gettext("You are already member of tutorial") . " " . $in_group->get_name() . ".", gettext("Resign from the tutorial to become member here."));
         }
     } else {
         if ($group->get_attribute(KOALA_GROUP_ACCESS) == PERMISSION_GROUP_UNDEFINED) {
             $content->setCurrentBlock("BLOCK_FORM");
             if ($group->get_maxsize() > 0 && $group->get_maxsize() <= $group->count_members()) {
                 $content->setVariable("LABEL_KIND_OF_GROUP", gettext("Group is full"));
                 $content->setVariable("INFO_KIND_OF_GROUP", str_replace("%NUMBER", $group->get_maxsize(), gettext("The maximum number of %NUMBER participants has been reached.")) . " " . gettext("You are not be able to join this group at this time."));
                 $content->setVariable("LABEL_SUBMIT", gettext("Unable to join group"));
                 $content->setVariable("SUBMIT_EXTRA", "style=\"display:none\"");
             } elseif ($group->is_password_protected()) {
                 $content->setVariable("LABEL_KIND_OF_GROUP", gettext("Password protected group"));
                 $content->setVariable("INFO_KIND_OF_GROUP", gettext("The moderators of this group had set a password to avoid unauthorized access.") . " " . gettext("If you would like to join this group and don't know it, please ask the moderators."));
                 $content->setCurrentBlock("BLOCK_GROUP_PASSWORD");
                 $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                 $content->parse("BLOCK_GROUP_PASSWORD");
                 $content->setVariable("LABEL_SUBMIT", gettext("Join this group"));
             } elseif ($group->is_moderated()) {
                 $content->setVariable("LABEL_KIND_OF_GROUP", gettext("Moderated group"));
                 $content->setVariable("INFO_KIND_OF_GROUP", gettext("To avoid unauthorized access, the moderators of this group have to approve your membership request first, before you can join the group.") . " " . gettext("Here, you can fill out a membership request and send it.") . " " . gettext("You will get automatically informed by mail if your request succeeds."));
Example #5
0
function get_comment_html($document, $url)
{
    $cache = get_cache_function($document->get_id(), 600);
    $user = lms_steam::get_current_user();
    $write_access = $document->check_access(SANCTION_ANNOTATE, $user);
    $template = new HTML_TEMPLATE_IT();
    $template->loadTemplateFile(PATH_TEMPLATES . "comments.template.html");
    $headline = gettext("Add your comment");
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $write_access) {
        $values = $_POST["values"];
        if (!empty($values["preview_comment"])) {
            $template->setCurrentBlock("BLOCK_PREVIEW_COMMENT");
            $template->setVariable("TEXT_COMMENT", $values["comment"]);
            $template->setVariable("PREVIEW", gettext("Preview"));
            $template->setVariable("POST_COMMENT", gettext("Post comment"));
            $template->setVariable("LABEL_PREVIEW_YOUR_COMMENT", gettext("Preview your comment"));
            $template->setVariable("VALUE_PREVIEW_COMMENT", get_formatted_output($values["comment"]));
            $template->parse("BLOCK_PREVIEW_COMMENT");
            $headline = gettext("Change it?");
        }
        if (!empty($values["submit_comment"]) && !empty($values["comment"])) {
            $new_comment = steam_factory::create_textdoc($GLOBALS["STEAM"]->get_id(), $user->get_name() . "-" . time(), $values["comment"]);
            $all_user = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
            $new_comment->set_acquire($document);
            $new_comment->set_read_access($all_user);
            $document->add_annotation($new_comment);
            $cache->drop("lms_steam::get_annotations", $document->get_id());
        }
    }
    $comments = $cache->call("lms_steam::get_annotations", $document->get_id());
    if (count($comments) > 0) {
        $template->setVariable("LABEL_COMMENTS", gettext("comments"));
    }
    $comments = array_reverse($comments);
    //reverse comment order (oldest first)
    foreach ($comments as $comment) {
        $obj_comment = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $comment["OBJ_ID"]);
        $template->setCurrentBlock("BLOCK_ANNOTATION");
        $template->setVariable("COMMENT_ID", $comment["OBJ_ID"]);
        $template->setVariable("AUTHOR_LINK", PATH_URL . "user/" . $comment["OBJ_CREATOR_LOGIN"] . "/");
        $template->setVariable("AUTHOR_NAME", $comment["OBJ_CREATOR"]);
        $template->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $comment["OBJ_ICON"]);
        $template->setVariable("LABEL_SAYS", gettext("says"));
        $template->setVariable("ANNOTATION_COMMENT", get_formatted_output($comment["CONTENT"], 80, "\n"));
        $template->setVariable("HOW_LONG_AGO", how_long_ago($comment["OBJ_CREATION_TIME"]));
        $template->setVariable('LINK_PERMALINK', $url . '/#comment' . $comment['OBJ_ID']);
        $template->setVariable("LABEL_PERMALINK", gettext("permalink"));
        if ($obj_comment->check_access_write($user)) {
            $template->setCurrentBlock("BLOCK_OWN_COMMENT");
            $template->setVariable("LINK_DELETE", $url . "/deletecomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_DELETE", gettext("delete"));
            $template->setVariable("LINK_EDIT", $url . "/editcomment" . $comment["OBJ_ID"] . "/");
            $template->setVariable("LABEL_EDIT", gettext("edit"));
            $template->parse("BLOCK_OWN_COMMENT");
        }
        $template->parse("BLOCK_ANNOTATION");
    }
    if ($write_access) {
        $template->setCurrentBlock("BLOCK_ADD_COMMENT");
        $template->setVariable("LABEL_ADD_YOUR_COMMENT", $headline);
        $template->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $template->setVariable("LABEL_OR", gettext("or"));
        $template->setVariable("LABEL_COMMENT", gettext("Add comment"));
        $template->setVariable("LABEL_BB_BOLD", gettext("B"));
        $template->setVariable("HINT_BB_BOLD", gettext("boldface"));
        $template->setVariable("LABEL_BB_ITALIC", gettext("I"));
        $template->setVariable("HINT_BB_ITALIC", gettext("italic"));
        $template->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
        $template->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
        $template->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
        $template->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
        $template->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
        $template->setVariable("HINT_BB_IMAGE", gettext("image"));
        $template->setVariable("LABEL_BB_URL", gettext("URL"));
        $template->setVariable("HINT_BB_URL", gettext("web link"));
        $template->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
        $template->setVariable("HINT_BB_MAIL", gettext("email link"));
        $template->parse("BLOCK_ADD_COMMENT");
    }
    return $template->get();
}
Example #6
0
$cache = get_cache_function($wiki_container->get_id(), 600);
$wiki_entries = $cache->call("lms_wiki::get_items", $wiki_container->get_id());
$recently_changed = new LinkedList(5);
$most_discussed = new LinkedList(5);
$latest_comments = new LinkedList(5);
$no_wiki_entries = count($wiki_entries);
if ($no_wiki_entries > 0) {
    $first_char = "";
    for ($i = 0; $i < $no_wiki_entries; $i++) {
        $this_char = substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1);
        if ($this_char > $first_char) {
            $first_char = $this_char;
            if ($i > 1) {
                $content->parse("BLOCK_CHARACTER");
            }
            $content->setCurrentBlock("BLOCK_CHARACTER");
            $content->setVariable("FIRST_CHAR", h($this_char));
        }
        $char_articles = array();
        while ($i < $no_wiki_entries && $this_char == substr(strtoupper($wiki_entries[$i]["OBJ_NAME"]), 0, 1)) {
            $char_articles[] = $wiki_entries[$i];
            if ($recently_changed->can_be_added($wiki_entries[$i]["DOC_LAST_MODIFIED"])) {
                $recently_changed->add_element($wiki_entries[$i]["DOC_LAST_MODIFIED"], $wiki_entries[$i]);
            }
            if (isset($wiki_entries[$i]["COMMENTS_NO"]) && $most_discussed->can_be_added($wiki_entries[$i]["COMMENTS_NO"]) && $wiki_entries[$i]["COMMENTS_NO"] > 1) {
                $most_discussed->add_element($wiki_entries[$i]["COMMENTS_NO"], $wiki_entries[$i]);
            }
            if (isset($wiki_entries[$i]["COMMENTS_LAST"]) && $latest_comments->can_be_added($wiki_entries[$i]["COMMENTS_LAST"]) && $wiki_entries[$i]["COMMENTS_LAST"] > 0) {
                $latest_comments->add_element($wiki_entries[$i]["COMMENTS_LAST"], $wiki_entries[$i]);
            }
            $i++;
Example #7
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     $portletName = $portlet->get_attribute(OBJ_DESC);
     $this->getExtension()->addCSS();
     $this->getExtension()->addJS();
     //old bib
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     $portletInstance = \PortletRss::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $num_items = isset($content["num_items"]) ? $content["num_items"] : 0;
     if (isset($content["address"])) {
         $feed = new \SimplePie();
         $feed->set_cache_location(PATH_CACHE);
         $feed->set_feed_url(derive_url($content["address"]));
         $feed->init();
         if ($num_items == 0) {
             $items = $feed->get_items();
         } else {
             $items = array_slice($feed->get_items(), 0, $num_items);
         }
     }
     $desc_length = isset($content["desc_length"]) ? $content["desc_length"] : 0;
     if (isset($content["allow_html"])) {
         $allow_html = $content["allow_html"] == "checked" ? true : false;
     } else {
         $allow_html = false;
     }
     $UBB = new \UBBCode();
     include_once PATH_BASE . "koala-core/lib/bid/derive_url.php";
     $portletFileName = $portletPath . "/ui/html/index.html";
     $tmpl = new \HTML_TEMPLATE_IT();
     $tmpl->loadTemplateFile($portletFileName);
     $tmpl->setVariable("EDIT_BUTTON", "");
     $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
     $tmpl->setVariable("RSS_NAME", $portletName);
     //refernce icon
     if ($portletIsReference) {
         $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
     }
     //popupmenu
     if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("PortletRss");
         $popupmenu->setElementId("portal-overlay");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
         $popupmenu = new \Widgets\PopupMenu();
         $popupmenu->setData($portlet);
         $popupmenu->setNamespace("Portal");
         $popupmenu->setElementId("portal-overlay");
         $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
         $popupmenu->setCommand("PortletGetPopupMenuReference");
         $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
     }
     if (sizeof($content) > 0) {
         if ($feed->error()) {
             $tmpl->setVariable("NOITEMSTEXT", "RSS-Ladefehler");
         } else {
             if (count($items) == 0) {
                 $tmpl->setVariable("NOITEMSTEXT", "RSS-Feed ist leer.");
             } else {
                 foreach ($items as $item) {
                     $tmpl->setCurrentBlock("BLOCK_RSS_ITEM");
                     if ($allow_html) {
                         $itemtitle = $item->get_title();
                         $itemdesc = $item->get_description();
                     } else {
                         $itemtitle = strip_tags($item->get_title());
                         $itemdesc = strip_tags($item->get_description());
                     }
                     if ($desc_length == 0) {
                         $itemdesc = "";
                     } else {
                         if ($desc_length > 0 && strlen($itemdesc) > $desc_length) {
                             $itemdesc = substr($itemdesc, 0, $desc_length) . "...";
                         }
                     }
                     $tmpl->setVariable("ITEMTITLE", $itemtitle);
                     $tmpl->setVariable("ITEMDESC", $itemdesc);
                     $tmpl->setVariable("ITEMURL", derive_url($item->get_permalink()));
                     $tmpl->setVariable("LINK", "");
                     $tmpl->parse("BLOCK_RSS_ITEM");
                 }
             }
         }
     } else {
         $tmpl->setVariable("NOITEMSTEXT", "RSS-Feed nicht konfiguriert.");
     }
     $htmlBody = $tmpl->get();
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     $outputWidget->addWidget(new \Widgets\PopupMenu());
     $this->rawHtmlWidget = $outputWidget;
 }
Example #8
0
    }
    if ($result[$tnr[$tutorials[$key]->get_id()]["attributes"]][OBJ_TYPE] == "0") {
        unset($tutorials[$key]);
        continue;
    }
    if ($result[$tnr[$tutorials[$key]->get_id()]["attributes"]][OBJ_TYPE] != "course_tutorial" && $result[$tnr[$tutorials[$key]->get_id()]["attributes"]][OBJ_TYPE] != "group_tutorial_koala") {
        unset($tutorials[$key]);
        continue;
    }
}
$tutorials = array_values($tutorials);
usort($tutorials, "sort_objects_new");
$no_tutorials = count($tutorials);
// $GLOBALS["STEAM"]->disconnect();
if ($no_tutorials > 0) {
    $content->setCurrentBlock("BLOCK_GROUP_LIST");
    if (isset($_GET['nrshow'])) {
        $nr_show = (int) $_GET['nrshow'];
    } else {
        $nr_show = 10;
    }
    if (isset($_REQUEST['sort'])) {
        $sort = $_REQUEST['sort'];
    } else {
        $sort = FALSE;
    }
    $paginator_text = gettext('%START - %END of %TOTAL');
    if ($nr_show > 0) {
        $paginator_text .= ', <a href="?nrshow=0' . (is_string($sort) ? '&sort=' . $sort : '') . '">' . gettext('show all') . '</a>';
    } else {
        $nr_show = $no_tutorials;
Example #9
0
require_once "../etc/koala.conf.php";
include_once PATH_LIB . "format_handling.inc.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "groups_create.template.html");
if (CREATE_PUBLIC_GROUP && CREATE_PRIVATE_GROUP) {
    $content->setVariable("INFO_TEXT", gettext("There are 2 types of groups on koaLA: <b>public</b> and <b>private</b>."));
    $content->setVariable("CHOOSE_TEXT", gettext("Choose which sort of group you'd like to start"));
    $content->setVariable("QUICK_SEARCH_TEXT_WIDTH", "200");
} else {
    $content->setVariable("QUICK_SEARCH_TEXT_WIDTH", "500");
}
$content->setVariable("QUICK_SEARCH_TEXT", str_replace("%l", "<a href=\"" . PATH_URL . "groups/\">" . gettext("quick search") . "</a>", gettext("There are some groups on koaLA yet. Would you like to do a %l to make sure someone hasn't already started the group you're about to make?")));
if (CREATE_PUBLIC_GROUP) {
    $content->setCurrentBlock("BLOCK_CREATE_PUBLIC_GROUP");
    $content->setVariable("VALUE_PARENT_PUBLIC_GROUP", STEAM_PUBLIC_GROUP);
    $content->setVariable("LABEL_PUBLIC", gettext("Public"));
    $content->setVariable("LABEL_CREATE_PUBLIC", gettext("Create"));
    $content->setVariable("FORM_ACTION_PUBLIC", PATH_URL . "groups_create_dsc.php");
    $content->parse("BLOCK_CREATE_PUBLIC_GROUP");
    $public_expl = array(gettext("Public groups are <b>useful for discussion and documents of general subjects</b>"), gettext("Admins can choose to show or hide discussions and/or group pools from non-members."), gettext("You can choose the participant management you like for your public group: Everybody can join the group freely, to join your group participants have to enter a secret password or you have to accept their application becoming a memebr of your group. Anyway, you are free to add members independently from the choosen participant management method."));
    $content->setCurrentBlock("BLOCK_EXPLAIN_PUBLIC_ALL");
    foreach ($public_expl as $e) {
        $content->setCurrentBlock("BLOCK_EXPLAIN_PUBLIC");
        $content->setVariable("EXPLAIN_PUBLIC_TEXT", $e);
        $content->parse("BLOCK_EXPLAIN_PUBLIC");
    }
    $content->parse("BLOCK_EXPLAIN_PUBLIC_ALL");
}
if (CREATE_PRIVATE_GROUP) {
Example #10
0
 public function getHtmlForUrl(UrlRequestObject $urlRequestObject)
 {
     $steam = $GLOBALS["STEAM"];
     //current room steam object
     if (isset($object) && (int) $object != 0) {
         $current_room = steam_factory::get_object($steam->get_id(), $object);
     } else {
         $current_room = $steam->get_current_steam_user()->get_workroom();
     }
     //current room steam object
     //$current_room = ($object != 0)?new steam_object($object):$steam->get_workroom_user($steam->login_user);
     $current_room_path = $current_room->get_path(1);
     $current_room_data = $current_room->get_attributes(array(OBJ_NAME, OBJ_DESC, OBJ_LAST_CHANGED, "bid:tags", "bid:presentation", "bid:collectiontype", "bid:description"), 1);
     $current_room_creator = $current_room->get_creator(1);
     //check if user may write in this folder
     $write_allowed = $current_room->check_access_write($steam->get_current_steam_user(), 1);
     //get inventory and inventorys attributes if allowed to
     $allowed = $current_room->check_access_read($steam->get_current_steam_user(), 1);
     $result = $steam->buffer_flush();
     $write_allowed = $result[$write_allowed];
     $allowed = $result[$allowed];
     $current_room_path = $result[$current_room_path];
     $current_room_data = $result[$current_room_data];
     $current_room_creator = $result[$current_room_creator];
     $current_room_creator_name = $current_room_creator->get_name();
     $current_room_display_name = str_replace("'s workarea", "", stripslashes($current_room_data[OBJ_NAME]));
     if (isset($current_room_data[OBJ_DESC]) && $current_room_data[OBJ_DESC] != "") {
         $current_room_display_name = $current_room_data[OBJ_DESC];
     }
     $current_room_display_name = str_replace("s workroom.", "", $current_room_display_name);
     $current_room_display_name = str_replace("s workroom", "", $current_room_display_name);
     $current_room_display_name = preg_replace("/.*'s bookmarks/", "Lesezeichen", $current_room_display_name);
     if ($allowed && $current_room instanceof steam_container) {
         $inventory = $current_room->get_inventory("", array("DOC_MIME_TYPE", "DOC_LAST_MODIFIED", "CONT_LAST_MODIFIED", "OBJ_LAST_CHANGED", "bid:tags", "bid:presentation", "bid:collectiontype", "bid:hidden", "bid:doctype", "bid:description", "DOC_EXTERN_URL", "OBJ_CREATION_TIME"));
     } else {
         $inventory = array();
     }
     if (sizeof($inventory) > 0) {
         $hascontent = true;
     } else {
         $hascontent = false;
     }
     //get head mounted content if needed
     $head_mounted = $current_room_data["bid:presentation"] === "head" && is_array($inventory) && isset($inventory[0]) && $inventory[0] instanceof steam_document;
     if ($head_mounted) {
         $tmp_content = new doc_content($steam, $inventory[0]);
         $head_mounted_content = $tmp_content->get_content($config_webserver_ip);
     }
     //******************************************************
     //** Display Stuff
     //******************************************************
     //template stuff
     $contenttemplate = new HTML_TEMPLATE_IT();
     $contenttemplate->loadTemplateFile($this->getExtensionPath() . "ui/taggedfolder.template.html");
     $contenttemplate->setVariable("FOLDER_ID", $current_room->get_id());
     $contenttemplate->setVariable("FOLDER_NAME", $current_room_display_name);
     //$contenttemplate->setVariable("FOLDER_PATH", PATH_URL . $current_room_path . "/");
     //$contenttemplate->setVariable("FOLDER_ICON", (($current_room_data["bid:presentation"] === "index")?"$config_webserver_ip/icons/mimetype/folder_closed_index.gif":"$config_webserver_ip/icons/mimetype/folder_closed.gif"));
     $contenttemplate->setVariable("FOLDER_LAST_CHANGED", date("d.m.Y H:i", $current_room_data[OBJ_LAST_CHANGED]));
     if (sizeof($inventory) == 0) {
         $contenttemplate->setCurrentBlock("no_content");
         $contenttemplate->setVariable("LANGUAGE_NO_CONTENT", gettext("LANGUAGE_NO_CONTENT"));
         $contenttemplate->parse("no_content");
     }
     return $contenttemplate->get();
     //set menu to write mode, if the user's access rights allow so and the user is not the guest user
     if ($write_allowed && $steam->get_login_user()->get_name() != "guest") {
         //$tpl->set_var("MENU",derive_menu("contentframe", $current_room, $current_room_path, 2));
     }
     //display directory
     //$content = false;
     $tnr = array();
     foreach ($inventory as $item) {
         $tnr[$item->get_id()] = array();
         $tnr[$item->get_id()]["creator"] = $item->get_creator(1);
         $tnr[$item->get_id()]["writeaccess"] = $item->check_access_write($steam->get_login_user(), 1);
         if ($item instanceof steam_document) {
             $tnr[$item->get_id()]["contentsize"] = $item->get_content_size(1);
         }
         if ($item instanceof steam_link) {
             $tnr[$item->get_id()]["link_object"] = $item->get_link_object(1);
         }
     }
     $result = $steam->buffer_flush();
     $creators = array();
     $linktargets = array();
     $accessresult = array();
     $sizeresult = array();
     foreach ($inventory as $item) {
         $creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
         $accessresult[$item->get_id()] = $result[$tnr[$item->get_id()]["writeaccess"]];
         if ($item instanceof steam_document) {
             $sizeresult[$item->get_id()] = $result[$tnr[$item->get_id()]["contentsize"]];
         }
         if ($item instanceof steam_link) {
             $linktargets[$item->get_id()] = $result[$tnr[$item->get_id()]["link_object"]];
         }
     }
     steam_factory::load_attributes($steam, $creators, array(OBJ_NAME));
     // If you want to use further Methods of caching e.g. PHP PEARs Cache_Lite
     // insert caching mechanisms in here...
     // below this, the steam connector is no longer used...
     $tags = array();
     foreach ($inventory as $item) {
         if (!$item instanceof steam_trashbin) {
             $itemname = $item->get_attribute(OBJ_NAME);
             $itemdescription = $item->get_attribute(OBJ_DESC);
             $itemmimetype = $item->get_attribute(DOC_MIME_TYPE);
             $lastchanged = $item->get_attribute(DOC_LAST_MODIFIED);
             if ($lastchanged === 0) {
                 $lastchanged = $item->get_attribute(OBJ_CREATION_TIME);
             }
             // set display name
             if ($itemdescription != "") {
                 $object_display_name = $itemdescription;
             } else {
                 $object_display_name = stripslashes($itemname);
             }
             $owner = $creators[$item->get_id()]->get_name();
             $bidDescription = $item->get_attribute("bid:description");
             $bidTags = $item->get_attribute("bid:tags");
             if (!$bidDescription) {
                 $bidDescription = "";
             }
             if (!$bidTags) {
                 $bidTags = "";
             }
             foreach (explode(" ", $bidTags) as $tag) {
                 $tag = trim($tag);
                 if (strlen($tag) > 0) {
                     if (!in_array($tag, $tags)) {
                         array_push($tags, $tag);
                     }
                 }
             }
             $tpl->set_var(array("OBJECT_ID" => $item->get_id(), "OBJECT_NAME" => $object_display_name, "OBJECT_NAME_GREY" => $object_display_name, "OBJECT_FILENAME" => stripslashes($itemname), "OBJECT_LAST_CHANGED" => date("d.m.Y H:i", $lastchanged), "bid:description" => $bidDescription, "bid:tags" => $bidTags, "OBJECT_OWNER" => $owner));
             if ($show_hidden) {
                 if ($content == false && $head_mounted) {
                     $tpl->parse("OBJECT_NAME", "head_mounted_name");
                 } else {
                     if ($item->get_attribute("bid:hidden")) {
                         $tpl->parse("OBJECT_NAME", "grey_name");
                     }
                 }
             } else {
                 if ($item->get_attribute("bid:hidden")) {
                     continue;
                 }
             }
             //parse correct Properties symbol
             $access = $accessresult[$item->get_id()];
             $tpl->parse("ITEM_PROPERTIES", $access ? "item_properties_on" : "item_properties_off");
             $visible = false;
             // render a steam_document
             if ($item instanceof steam_document) {
                 //derive mimetype
                 $mimetype = derive_icon(array("object" => $item, "name" => $itemname, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:doctype" => $item->get_attribute("bid:doctype"), "mimetype" => $itemmimetype));
                 //derive size
                 $size = $sizeresult[$item->get_id()];
                 $tpl->set_var(array("OBJECT_SIZE" => $size > 1048576 ? round($size / 1048576 + 0.05, 1) . " MB" : round($size / 1024 + 0.5) . " kB", "OBJECT_ICON" => $mimetype));
                 //care for documents not to be displayed in the browser
                 if ($itemmimetype === "text/html" || $itemmimetype === "text/plain" || $itemmimetype === "text/css" || $itemmimetype === "text/xml" || $itemmimetype === "application/vnd.google-earth.kml+xml" || $itemmimetype === "image/gif" || $itemmimetype === "image/jpg" || $itemmimetype === "image/jpeg" || $itemmimetype === "image/png") {
                     $tpl->parse("ITEM_LINK", "document");
                     $tpl->parse("DOCUMENTS", "item", true);
                 } else {
                     $tpl->parse("ITEM_LINK", "nb_document");
                     $tpl->parse("DOCUMENTS", "item", true);
                 }
                 $visible = true;
             } else {
                 if ($item instanceof steam_link || $item instanceof steam_exit) {
                     $linked_object = $linktargets[$item->get_id()];
                     if ($item instanceof steam_link) {
                         if ($itemdescription != "") {
                             $name = $itemdescription;
                         } else {
                             $name = $itemname;
                         }
                         if ($linked_object instanceof steam_document) {
                             $size = $linked_object->get_content_size();
                             $tpl->set_var(array("OBJECT_SIZE" => $size > 1048576 ? round($size / 1048576 + 0.05, 1) . " MB" : round($size / 1024 + 0.5) . " kB"));
                         } else {
                             $tpl->set_var(array("OBJECT_SIZE" => ""));
                         }
                     }
                     if ($item instanceof steam_exit) {
                         if ($itemdescription != "") {
                             $name = str_replace("s workroom.", "", stripslashes($itemdescription));
                         } else {
                             $name = str_replace("'s workarea", "", stripslashes($itemname));
                         }
                     }
                     //derive mimetype
                     $mimetype = derive_icon(array("object" => $item, "name" => $itemname, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:doctype" => $item->get_attribute("bid:doctype"), "mimetype" => $itemmimetype));
                     $tpl->set_var(array("LINK_OBJECT_ID" => is_object($linked_object) ? $linked_object->get_id() : -1, "OBJECT_NAME" => $name, "OBJECT_ICON" => $mimetype));
                     $tpl->parse("ITEM_LINK", "link");
                     $tpl->parse("DOCUMENTS", "item", true);
                     $visible = true;
                 } else {
                     if ($item instanceof steam_docextern) {
                         $url = derive_url($item->get_attribute(DOC_EXTERN_URL));
                         $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_LINK" => $url, "OBJECT_ICON" => "./icons/mimetype/www.gif"));
                         $tpl->parse("ITEM_LINK", "www-link");
                         $tpl->parse("DOCUMENTS", "item", true);
                         $visible = true;
                     } else {
                         if ($item->get_attribute("bid:doctype") != "") {
                             $icon = array("bid:doctype" => $item->get_attribute("bid:doctype"));
                             $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                             $tpl->parse("ITEM_LINK", "folder");
                             $tpl->parse("DOCUMENTS", "item", true);
                             $visible = true;
                         } else {
                             if ($item instanceof steam_messageboard) {
                                 $icon = array("object" => $item);
                                 $tpl->set_var(array("OBJECT_NAME" => stripslashes($itemname), "OBJECT_NAME_GREY" => stripslashes($itemname), "OBJECT_SIZE" => "", "OBJECT_ICON" => derive_icon($icon)));
                                 $tpl->parse("ITEM_LINK", "folder");
                                 $tpl->parse("DOCUMENTS", "item", true);
                                 $visible = true;
                             } else {
                                 if ($item instanceof steam_container && !$item instanceof steam_user) {
                                     $icon = array("object" => $item, "bid:collectiontype" => $item->get_attribute("bid:collectiontype"), "bid:presentation" => $item->get_attribute("bid:presentation"));
                                     $icon = derive_icon($icon);
                                     $lastchanged = $item->get_attribute("CONT_LAST_MODIFIED");
                                     if ($lastchanged === 0) {
                                         $lastchanged = $item->get_attribute(OBJ_CREATION_TIME);
                                     }
                                     $tpl->set_var(array("OBJECT_SIZE" => "", "OBJECT_ICON" => $icon, "OBJECT_LAST_CHANGED" => date("d.m.Y H:i", $lastchanged)));
                                     $tpl->parse("ITEM_LINK", "folder");
                                     $tpl->parse("DOCUMENTS", "item", true);
                                     $visible = true;
                                 }
                             }
                         }
                     }
                 }
             }
             //parse javascript mark/unmark
             if ($visible) {
                 $tpl->parse("MARK", "mark", 1);
                 $tpl->parse("UNMARK", "unmark", 1);
             }
             $content = $content || $visible;
         }
     }
     //  if(!$content) $tpl->parse("DOCUMENTS", "no_content");
     natsort($tags);
     $tagString = implode(" ", $tags);
     $tpl->set_var(array("TAGS" => $tagString));
     $_SESSION["tags"] = $tagString;
     out();
     //Logout & Disconnect
     $steam->disconnect();
     function out()
     {
         //parse all out
         global $tpl;
         $tpl->parse("OUT", "content");
         $tpl->p("OUT");
     }
 }
Example #11
0
    $portal = lms_portal::get_instance();
    $portal->initialize(GUEST_NOT_ALLOWED);
}
if (!isset($html_handler_course)) {
    $html_handler_course = new koala_html_course($course);
    $html_handler_course->set_context("units", array("subcontext" => "unit"));
}
$content = new HTML_TEMPLATE_IT();
//$content->loadTemplateFile( PATH_TEMPLATES_UNITS_DOCPOOL . "units_docpool.template.html" );
$content->loadTemplateFile(PATH_TEMPLATES . "list_inventory.template.html");
$content->setVariable("VALUE_CONTAINER_DESC", h($unit->get_attribute("OBJ_DESC")));
$content->setVariable("VALUE_CONTAINER_LONG_DESC", get_formatted_output($unit->get_attribute("OBJ_LONG_DESC")));
$docs = $unit->get_inventory();
$item_ids = array();
if (count($docs > 0)) {
    $content->setCurrentBlock("BLOCK_INVENTORY");
    $content->setVariable("LABEL_DOCNAME_DESCRIPTION", gettext("Name/Description"));
    $content->setVariable("LABEL_SIZE", gettext("File size"));
    $content->setVariable("LABEL_MODIFIED", gettext("Last modified"));
    $content->setVariable("LABEL_ACTIONS", gettext("Actions"));
    foreach ($docs as $doc) {
        // Ignore hidden files starting with '.'
        if (substr($doc->get_name(), 0, 1) == '.') {
            continue;
        }
        $content->setCurrentBlock("BLOCK_ITEM");
        $size = $doc instanceof steam_document ? $doc->get_content_size() : 0;
        $content->setVariable("LINK_ITEM", PATH_URL . "doc/" . $doc->get_id() . "/");
        $content->setVariable("LINK_DOWNLOAD", PATH_URL . "get_document.php?id=" . $doc->get_id());
        $content->setVariable("LABEL_DOWNLOAD", gettext("download"));
        $content->setVariable("SIZE_ITEM", get_formatted_filesize($size));
Example #12
0
<?php

// Deactivate HISLSF Support
//	include( "bad_link.php" );
//	exit;
require_once "../etc/koala.conf.php";
$portal = lms_portal::get_instance();
$portal->initialize(GUEST_NOT_ALLOWED);
$user = lms_steam::get_current_user();
$all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
if (!lms_steam::is_steam_admin($user) && !lms_steam::is_semester_admin($current_semester, $user)) {
    include "bad_link.php";
    exit;
}
$lsf_client = new hislsf_soap();
$result = $lsf_client->get_available_courses(SYNC_HISLSF_SEMESTER, $path[1]);
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "courses_create_hislsf.template.html");
$content->setVariable("FORM_ACTION", PATH_URL . SEMESTER_URL . "/" . $current_semester->get_name() . "/new/");
foreach ($result->veranstaltung as $course) {
    $content->setCurrentBlock("LSFCOURSE");
    $content->setVariable("LSF_COURSE_ID", (string) $course->Veranstaltungsschluessel);
    $content->setVariable("LSF_COURSE_NAME", (string) $course->Veranstaltungstyp . " " . (string) $course->Veranstaltungsname);
    $content->parse("LSFCOURSE");
}
$portal->set_page_main(array(array("link" => PATH_URL . SEMESTER_URL . "/" . $current_semester->get_name() . "/", "name" => $current_semester->get_attribute("OBJ_DESC")), array("linK" => "", "name" => gettext("Create new Course via LSF"))), $content->get());
$portal->show_html();
Example #13
0
        $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);
        $feedlink = PATH_URL . "services/feeds/forum_public.php?id=" . OBJ_ID;
        $rcache->drop("lms_rss::get_items", $feedlink);
        $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"));
Example #14
0
$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"));
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_wiki::get_access_descriptions($grp);
    if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
        $access_default = PERMISSION_PUBLIC;
    } else {
        $access_default = PERMISSION_PUBLIC_READONLY;
        if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != lms_steam::get_current_user()->get_id()) {
            $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
        } else {
            $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
        }
    }
    if (is_array($access)) {
Example #15
0
    function get_html()
    {
        if (!$this->is_finished()) {
            // set onload js to portal
            $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; 
}

.green{
\tdisplay:block;
\tposition:absolute;
\ttop:0px;
\tleft:0px;
\tz-index:1;
\twidth:0px;
\theight:25px;
\tbackground-color:#A5A12B;
}

.progressbar{
\tfont-family: 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;
\tfont-size: 9px;
\tposition: relative;
\ttop:50px;
\tleft:210px;
}

.progressbar_left{
\tposition:absolute;
\ttop:0px;
\tleft:0px;
\theight:26px;
\twidth:13px;
\tz-index:2;
\tbackground-image:url(/styles/stahl-orange/images/pr_l.png);
}

.progressbar_middle{
\tposition:absolute;
\tpadding-top:5px;
\ttext-align:center;
\ttop:0px;
\tleft:13px;
\theight:21px;
\twidth:250px;
\tz-index:2;
\tbackground-image:url(/styles/stahl-orange/images/pr_m.png);
}

.progressbar_right{
\tposition:absolute;
\ttop:0px;
\tleft:263px;
\theight:26px;
\twidth:13px;
\tz-index:2;
\tbackground-image:url(/styles/stahl-orange/images/pr_r.png);
}
END;
            lms_portal::get_instance()->add_css_style($css);
            /*
             * **********************************************
             * ********* ONLOAD JAVASCRIPT ******************
             * **********************************************
             */
            $js_onload = <<<END
document.getElementById('loading_overlay').style.display = 'none';
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_active') {
\t\t\tthisElem.className = 'q';
\t\t\tthisElem.style.display = "none";
\t\t\tthisElem.style.opacity = 0;
\t\t}
\t} 
}

function showQuestion(qnr) {
\tsetprogress((qnr / 19)*100);
\thide_all_questions();
\tdocument.getElementById('q_'+qnr).className = 'q_active';
\tdocument.getElementById('q_'+qnr).style.display = "block";
\tEffect.Fade('q_'+qnr, { duration: 1.0, from: 0, to: 0.9 });
\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') {
\t\t\tj++;
\t\t} else if (thisElem.className && thisElem.className == 'q_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' || thisElem.className && thisElem.className == 'q_active')) {
\t\t\tj++;
\t\t}
\t}
\treturn j;
}

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

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

function updateButtons() {
\tif (actualQuestion() == 1) {
\t\tdocument.images['img_prev'].style.display = 'none';
\t\tdocument.images['img_next'].style.display = 'block';
\t\tdocument.getElementById('finish_button').style.display = 'none';
\t\tdocument.getElementById('back_button').style.display = 'none';
\t} else if (actualQuestion() == countQuestions()) {
\t\tdocument.images['img_prev'].style.display = 'block';
\t\tdocument.images['img_next'].style.display = 'none';
\t\tdocument.getElementById('finish_button').style.display = 'block';
\t\tdocument.getElementById('back_button').style.display = 'block';
\t} else {
\t\tdocument.images['img_prev'].style.display = 'block';
\t\tdocument.images['img_next'].style.display = 'block';
\t\tdocument.getElementById('finish_button').style.display = 'none';
\t\tdocument.getElementById('back_button').style.display = 'none';
\t}
}

function setprogress(i) {
\ti = Math.round(i);
\tif (i > 100) {
\t\ti = 100;
\t}
\tif (i < 0) {
\t\ti = 0;
\t}
\tvar min = 4;
\tvar max = 277;
\tvar stepsize = (max - min) / 100;
\tdocument.getElementById("green").style.width = Math.round(i * stepsize) + "px";
\tdocument.getElementById("progressbar_middle").innerHTML = "Fortschritt " + i + "%";
}

END;
            lms_portal::get_instance()->add_javascript_code("elearning_exam", $js_code);
            $html = "<div class=\"printonly\" id=\"noprint_exam\"><b>Die Prüfung kann nicht gedruckt werden.</b></div><div id=\"loading_overlay\"><div id=\"loader\"><img src=\"/styles/stahl-orange/images/loader_gr.gif\" /></div></div>";
            $html .= "<div class=\"noprint\" id=\"elearning_exam\">";
            $html .= "<h1>" . $this->get_name() . "</h1>";
            $html .= "<img style=\"float:right\" src=\"/styles/stahl-orange/images/exam.jpg\" />";
            $html .= "<p>" . $this->get_description() . "</p>";
            $html .= "<div class=\"progressbar\">\n\t\t\t\t\t<div class=\"green\" id=\"green\"/></div>\n\t\t\t\t\t<div class=\"progressbar_left\"></div>\n\t\t\t\t\t<div class=\"progressbar_middle\" id=\"progressbar_middle\">Fortschritt 0%</div>\n\t\t\t\t\t<div class=\"progressbar_right\"></div>\n\t\t\t</div><br clear=\"all\"/>";
            $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_html();
            $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>";
            $html .= "\n\t\t\t<div id=\"overlay\"></div>\n\t\t\t<div id=\"message\">\n\t    \t\t<div id=\"messagetext\"></div>\n\t    \t\t<div id=\"messageCloseButton\" onclick=\"closeMessageWindow()\">[<a href=\"javascript:closeMessageWindow()\">Schließen</a>]</div>\n\t\t\t</div>\n\t\t\t";
            $pathprefix = "../units/" . elearning_mediathek::get_instance()->get_unit()->get_id() . "/";
            $html .= "<script type=\"text/javascript\">\n\t \t\tfunction finishexam() {\n\t\t\t\tapath = \"" . $pathprefix . "directaccess\";\n\t\t\t\tnew Ajax.Request(apath,\n\t\t\t\t\t  {\n\t\t\t\t\t    method:'post',\n\t\t\t\t\t    parameters: \"case=finishexam&&eid=" . $this->get_id() . "\",\n\t\t\t\t\t    onFailure: function(){ alert('Error while storing answer.'); },\n\t\t\t\t\t    onSuccess: function(response){window.location.reload();}\n\t\t\t\t\t  });\n\t\t\t\t}\n\t \t\t</script>";
            $html .= "<a style=\"display:none;\" class=\"back_button\" id=\"back_button\" href=\"javascript:showQuestion(1);\">Zur ersten Frage</a>";
            $html .= "<a style=\"display:none;\" class=\"finish_button\" id=\"finish_button\" href=\"javascript:if (confirm('Wollen Sie die Prüfung jetzt wirklich abschließen?')) {document.getElementById('loading_overlay').style.display = 'block';finishexam();}\">Prüfung abschließen</a>";
            return $html;
        } else {
            // set onload js to portal
            $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);
            $html = "<div class=\"printonly\" id=\"noprint_exam\"><b>Die Prüfungsergbnisse können nicht gedruckt werden.</b></div><div class=\"noprint\" id=\"elearning_exam\">";
            $elearning_user = elearning_user::get_instance($this->myUser->get_name(), elearning_mediathek::get_instance()->get_course()->get_id());
            if ($elearning_user->has_exam_passed()) {
                $html .= "<h2>Herzlichen Glückwunsch!</h2>";
                $html .= "Sie haben bei der Prüfung zum Kurs »" . $this->get_parent()->get_name() . "« <b>" . $elearning_user->get_exam_sum_score() . " von " . $elearning_user->get_exam_sum_points() . "</b> möglichen Punkten erreicht. Dieses Prüfungsergebnis wird auch den Ansprechpartnern zu dem Kurs angezeigt.<br/><br/>";
                $html .= "Zur abgelegten Prüfung haben Sie ein Zertifikat erhalten, das Sie auch später noch auf Ihrer persönlichen Einstiegsseite abrufen können. Klicken Sie auf das Vorschaubild des Zertifikats bzw. auf »Herunterladen«, wenn Sie es auf Ihrem Computer speichern oder ausdrucken möchten.<br/><br/>";
                $html .= "Falls Sie nicht alle Fragen richtig beantwortet haben, sehen Sie im Folgenden die nicht vollständig korrekt beantworteten Fragen. Sie können auch später erneut auf »Prüfung« klicken, um sich die nicht vollständig korrekt beantworteten Fragen anzeigen zu lassen.<br/><br/>";
                $html .= "Wenn Sie zum Kurs oder zu der Prüfung eine Frage haben, können Sie auf den Namen eines Ansprechpartners für diesen Kurs klicken, um mit ihm bzw. ihr in Kontakt zu treten.";
                $html .= "<div style=\"float:right;margin-top:15px;text-align:center\"><a href=\"" . "/download/" . $elearning_user->get_exam_cert()->get_id() . "/" . $elearning_user->get_exam_cert()->get_name() . "\"><img src=\"" . "/download/" . $elearning_user->get_exam_cert_preview()->get_id() . "/" . $elearning_user->get_exam_cert_preview()->get_name() . "\" /><br /> <small>Herunterladen</a></small></div>";
            } else {
                $html .= "<h2>Leider hat es nicht gereicht!</h2>";
                $html .= "Sie haben bei der Prüfung zum Kurs »" . $this->get_parent()->get_name() . "« die benötigten Punkte nicht erreicht. Dieses Prüfungsergebnis wird auch den Ansprechpartnern zu dem Kurs angezeigt.<br/><br/>";
                $html .= "Im Folgenden können Sie sich die nicht vollständig korrekt beantworteten Fragen ansehen. Sie können auch später erneut auf »Prüfung« klicken, um sich die nicht vollständig korrekt beantworteten Fragen anzeigen zu lassen. Auch die Inhalte des Kurses können Sie jederzeit anschauen und sich mit den Inhalten noch einmal beschäftigen.<br/><br/>";
                $html .= "Wenn Sie zum Kurs oder zu der Prüfung eine Frage haben, können Sie auf den Namen eines Ansprechpartners für diesen Kurs klicken, um mit ihm bzw. ihr in Kontakt zu treten. Er bzw. sie wird Ihnen auch mitteilen, wie Sie die Prüfung zu gegebener Zeit noch einmal ablegen können.";
            }
            global $course;
            $content = new HTML_TEMPLATE_IT();
            $content->loadTemplateFile(PATH_EXTENSIONS . "units_elearning/templates/exam.staff.template.html");
            $admins = $course->get_staff();
            $hidden_members = $course->get_steam_group()->get_attribute("COURSE_HIDDEN_STAFF");
            if (!is_array($hidden_members)) {
                $hidden_members = array();
            }
            $visible_staff = 0;
            foreach ($admins as $admin) {
                if (!in_array($admin->get_id(), $hidden_members)) {
                    $content->setCurrentBlock("BLOCK_ADMIN");
                    if (COURSE_START_ADMIN_PROFILE_ANKER) {
                        $content->setCurrentBlock("PROFILE_ANKER");
                    } else {
                        $content->setCurrentBlock("PROFILE_NO_ANKER");
                    }
                    $admin_attributes = $admin->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_DESC", "OBJ_NAME"));
                    if ($admin instanceof steam_user) {
                        $content->setVariable("ADMIN_NAME", $admin_attributes["USER_FIRSTNAME"] . " " . $admin_attributes["USER_FULLNAME"]);
                        !COURSE_START_ADMIN_PROFILE_ANKER or $content->setVariable("ADMIN_LINK", PATH_URL . "user/" . $admin->get_name() . "/");
                    } else {
                        $content->setVariable("ADMIN_NAME", $admin_attributes["OBJ_NAME"]);
                        !COURSE_START_ADMIN_PROFILE_ANKER or $content->setVariable("ADMIN_LINK", PATH_URL . "groups/" . $admin->get_id() . "/");
                    }
                    $icon_link = is_object($admin_attributes["OBJ_ICON"]) ? PATH_URL . "cached/get_document.php?id=" . $admin_attributes["OBJ_ICON"]->get_id() . "&type=usericon&width=40&height=47" : PATH_STYLE . "images/anonymous.jpg";
                    $content->setVariable("ADMIN_ICON", $icon_link);
                    $adminDescription = $admin_attributes["OBJ_DESC"];
                    switch ($adminDescription) {
                        case "student":
                            $adminDescription = gettext("student");
                            break;
                        case "staff member":
                            $adminDescription = gettext("staff member");
                            break;
                        case "alumni":
                            $adminDescription = gettext("alumni");
                            break;
                        case "guest":
                            $adminDescription = gettext("guest");
                            break;
                        case "":
                            $adminDescription = gettext("student");
                            break;
                        default:
                            break;
                    }
                    if (COURSE_START_SEND_MESSAGE && (!COURSE_SHOW_ONLY_EXTERN_MAIL || COURSE_SHOW_ONLY_EXTERN_MAIL && is_string($admin->get_attribute("USER_EMAIL")) && $admin->get_attribute("USER_EMAIL") != "" && $admin->get_attribute("USER_FORWARD_MSG") === 1)) {
                        $adminDescription = $adminDescription . " - <a href=\"/messages_write.php?to=" . $admin->get_name() . "\">" . gettext("Nachricht senden") . "</a>";
                    }
                    $content->setVariable("ADMIN_DESC", $adminDescription);
                    if (COURSE_START_ADMIN_PROFILE_ANKER) {
                        $content->parse("PROFILE_ANKER");
                    } else {
                        $content->parse("PROFILE_NO_ANKER");
                    }
                    $content->parse("BLOCK_ADMIN");
                    $visible_staff++;
                }
            }
            if ($visible_staff > 0) {
                $content->setCurrentBlock("BLOCK_ADMIN_HEADER");
                $content->setVariable("LABEL_ADMINS", gettext("Staff members"));
                $content->parse("BLOCK_ADMIN_HEADER");
            }
            $html .= $content->get();
            $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();
            $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 #16
0
$widget->loadTemplateFile(PATH_TEMPLATES . "widget_wiki_images.template.html");
$inventory = $wiki_container->get_inventory();
if (!is_array($inventory)) {
    $inventory = array();
}
if (sizeof($inventory) > 0) {
    steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $inventory, array(OBJ_NAME, OBJ_DESC, DOC_MIME_TYPE));
    $images = array();
    foreach ($inventory as $object) {
        $mime = strtolower($object->get_attribute(DOC_MIME_TYPE));
        if ($mime === "image/jpg" || $mime === "image/jpeg" || $mime === "image/gif" || $mime === "image/png") {
            $images[] = $object;
        }
    }
    foreach ($images as $image) {
        $widget->setCurrentBlock("BLOCK_IMAGE");
        $widget->setVariable("WIKI_IMAGE_NAME", $image->get_name());
        $widget->setVariable("WIKI_IMAGE_ADD_LINK", "javascript:insert('[[Image:" . $image->get_identifier() . "]]', '', 'formular', 'values[body]')");
        $widget->setVariable("WIKI_IMAGE_VIEW_LINK", $image->get_name());
        $widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name() . " ( " . $image->get_attribute(OBJ_DESC) . " )");
        $widget->setVariable("WIKI_IMAGE_LINK", PATH_URL . "get_document?id=" . $image->get_id() . "&width=40&height=80");
        $widget->setVariable("WIKI_IMAGE_VIEW_LINK", PATH_URL . "doc/" . $image->get_id() . "/");
        $widget->setVariable("WIKI_IMAGE_TITLE", $image->get_name());
        $widget->setVariable("WIKI_IMAGE_ADD", gettext("Insert"));
        $widget->setVariable("WIKI_IMAGE_VIEW", gettext("View"));
        $widget->parse("BLOCK_IMAGE");
    }
}
$widget->setVariable("UPLOAD_TEXT", gettext("Upload an image"));
$widget->setVariable("UPLOAD_LINK", PATH_URL . "upload?env=" . $wiki_container->get_id());
$widget->setVariable("WIKI_IMAGE_EXTERNAL", gettext("External image"));
Example #17
0
<?php

$public = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
$user = lms_steam::get_current_user();
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "groups_public.template.html");
if (MANAGE_GROUPS_MEMBERSHIP || CREATE_GROUPS) {
    $content->setCurrentBlock("BLOCK_ACTION_BAR_GROUPS");
    if (MANAGE_GROUPS_MEMBERSHIP) {
        $content->setCurrentBlock("BLOCK_MANAGE_GROUPS_MEMBERSHIP");
        $content->setVariable("LINK_MANAGE_SUBSCRIPTIONS", PATH_URL . "user/" . $user->get_name() . "/groups/");
        $content->setVariable("LABEL_MANAGE_SUBSCRIPTIONS", gettext("Manage subscriptions"));
        $content->parse("BLOCK_MANAGE_GROUPS_MEMBERSHIP");
    }
    if (CREATE_GROUPS) {
        $content->setCurrentBlock("BLOCK_CREATE_GROUPS");
        $content->setVariable("LINK_CREATE_NEW_GROUP", PATH_URL . "groups_create_dsc.php?parent=" . (isset($_GET["cat"]) ? $_GET["cat"] : $public->get_id()));
        $content->setVariable("LABEL_CREATE_NEW_GROUP", gettext("Create new group"));
        $content->parse("BLOCK_CREATE_GROUPS");
    }
    $content->parse("BLOCK_ACTION_BAR_GROUPS");
}
$content->setVariable("LABEL_NAME", gettext("Name"));
$content->setVariable("LABEL_DESC", gettext("Description"));
if (!empty($_GET["cat"])) {
    // EINE KATEGORIE ANZEIGEN
    if (!($category = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["cat"]))) {
        include "bad_link.php";
        exit;
    }
    if (!$category instanceof steam_container) {
 public function set_content()
 {
     //			ini_set("post_max_size", "50M");
     //			ini_set("upload_max_filesize", "50M");
     //			ini_set("memory_limit", "50M" );
     $user = lms_steam::get_current_user();
     if ($this->path == "upload/") {
         /*
          * Artefacts Upload Content
          */
         if ($_SERVER["REQUEST_METHOD"] == "POST") {
             $values = isset($_POST["values"]) ? $_POST["values"] : array();
             $problems = "";
             $hints = "";
             if (empty($_FILES) || !empty($_FILES["material"]["error"]) && $_FILES["material"]["error"] > 0) {
                 if (!empty($_FILES) && empty($_FILES["material"]["name"])) {
                     $problems = gettext("No file chosen.") . " ";
                 } else {
                     $problems = gettext("Could not upload document.") . " ";
                 }
                 $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), $problems);
             }
             if (empty($problems)) {
                 $content = file_get_contents($_FILES["material"]["tmp_name"]);
                 $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);
                 $artefacts_container = $user->get_workroom()->get_object_by_name("portfolio")->get_object_by_name("artefacts");
                 $new_container = steam_factory::create_container($GLOBALS["STEAM"]->get_id(), $filename, $artefacts_container);
                 $new_material = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $filename, $content, $_FILES["material"]["type"], FALSE);
                 print $values["dsc"] . "hhhh";
                 $new_material->set_attribute("DESCRIPTION", $values["dsc"]);
                 $new_container->set_attribute("DESCRIPTION", $values["dsc"]);
                 $new_material->move($new_container);
                 $_SESSION["confirmation"] = str_replace("%DOCUMENT", h($filename), gettext("'%DOCUMENT' has been uploaded."));
                 //					header( "Location: " . PATH_SERVER . "/portfolio/artefacts/" );
                 exit;
             }
         } else {
             /*
              * Artefacts Upload Form
              */
             $template = new HTML_TEMPLATE_IT();
             $template->loadTemplateFile(PORTFOLIO_PATH_TEMPLATES . "artefacts_upload.template.html");
             $template->setVariable("LABEL_UPLOAD", gettext("Upload"));
             $template->setVariable("LABEL_FILE", gettext("Local file"));
             $template->setVariable("LABEL_DSC", gettext("Description"));
             $template->setVariable("FORM_ACTION", PATH_SERVER . "/portfolio/artefacts/upload/");
             $this->template->setVariable("HTML_CODE_LEFT", $template->get());
         }
     } else {
         /*
          * Artefacts List
          */
         $template = new HTML_TEMPLATE_IT();
         $template->loadTemplateFile(PORTFOLIO_PATH_TEMPLATES . "artefacts.template.html");
         $user = lms_steam::get_current_user();
         /*
          * ALLE Artefakte holen
          */
         $workroom = $user->get_workroom();
         $portfolio_container = $workroom->get_object_by_name("portfolio");
         $artefacts_container = $portfolio_container->get_object_by_name("artefacts");
         $all_container = $artefacts_container->get_inventory();
         foreach ($all_container as $artefact_container) {
             //				$artefact_container->get_inventory();
             $id = $artefact_container->get_object_by_name($artefact_container->get_name())->get_id();
             $template->setCurrentBlock("BLOCK_ARTEFACT_ROW");
             $template->setVariable("ARTEFACT_PATH", PATH_SERVER . "/download/" . $id . "/" . $artefact_container->get_name());
             $template->setVariable("ARTEFACT_NAME", $artefact_container->get_name());
             $template->setVariable("ARTEFACT_SIZE", $artefact_container->get_name());
             $template->setVariable("ARTEFACT_DESCRIPTION", $artefact_container->get_attribute("DESCRIPTION") === 0 ? "" : $artefact_container->get_attribute("DESCRIPTION"));
             $template->parseCurrentBlock("BLOCK_ARTEFACT_ROW");
         }
         /*
          * Artefakte eines Portfolios holen
          */
         //$artefacts =) $this->portfolio->get_artefactes();
         //			if (count($artefacts) > 0) {
         //				foreach ($artefacts as $artefact) {
         //					$template->setCurrentBlock("BLOCK_ARTEFACT_ROW");
         //					$template->setVariable("ARTEFACT_NAME", "HUND");
         //					$template->parseCurrentBlock("BLOCK_ARTEFACT_ROW");
         //				}
         //			} else {
         //				//N$template->setVariable(_ARTEFACTS_TEXT
         //			}
         $this->template->setVariable("HTML_CODE_LEFT", $template->get());
     }
 }
Example #19
0
        $subject = str_replace("%GROUP", $group->get_name(), gettext("Your membership for '%GROUP' was rejected"));
        $message = gettext("Your membership was rejected.");
        $portal->set_confirmation(str_replace("%NAME", $candidate->get_attribute("USER_FIRSTNAME") . " " . $candidate->get_attribute("USER_FULLNAME"), gettext("Membership of %NAME rejected.")));
    }
    //$candidate->mail( $subject, $message, $user->get_attribute( "USER_EMAIL" ));
    lms_steam::mail($candidate, $user, $subject, $message);
}
$result = $group->get_membership_requests();
$html_people = new HTML_TEMPLATE_IT();
$html_people->loadTemplateFile(PATH_TEMPLATES . "list_users.template.html");
$no_people = count($result);
if ($no_people > 0) {
    $start = $portal->set_paginator(10, $no_people, "(" . gettext("%TOTAL membership requests") . ")");
    $end = $start + 10 > $no_people ? $no_people : $start + 10;
    $html_people->setVariable("LABEL_CONTACTS", gettext("Membership requests") . " (" . 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"));
    foreach ($result as $candidate) {
        $person = $candidate->get_attributes(array("USER_FIRSTNAME", "USER_FULLNAME", "OBJ_ICON", "OBJ_NAME", "OBJ_DESC"));
        $html_people->setCurrentBlock("BLOCK_CONTACT");
        $html_people->setVariable("CONTACT_LINK", PATH_URL . "user/" . h($person["OBJ_NAME"]) . "/");
        if (is_object($person["OBJ_ICON"])) {
            $icon_link = PATH_URL . "cached/get_document.php?id=" . $person["OBJ_ICON"]->get_id() . "&type=usericon";
        } else {
            $icon_link = PATH_STYLE . "images/anonymous.jpg";
        }
        $html_people->setVariable("CONTACT_IMAGE", $icon_link);
        $html_people->setVariable("CONTACT_NAME", h($person["USER_FIRSTNAME"]) . " " . h($person["USER_FULLNAME"]));
Example #20
0
 function get_content($id)
 {
     define("PATH_CURRENT_EXTENSION", PATH_PUBLIC . "bid/extension/journal/");
     global $portal;
     $journal = steam_factory::get_object($GLOBALS['STEAM']->get_id(), $id);
     /* get permissions */
     $readable = $journal->check_access_read($GLOBALS['STEAM']->get_current_steam_user(), 1);
     $writeable = $journal->check_access_write($GLOBALS['STEAM']->get_current_steam_user(), 1);
     $result = $GLOBALS['STEAM']->buffer_flush();
     $readable = $result[$readable];
     $writeable = $result[$writeable];
     /* fetch columns */
     $columns = $journal->get_inventory(CLASS_CONTAINER, array(OBJ_TYPE, "bid:journal:column:width"));
     $columnPortlets = array();
     /* now fetch portlets in all columns; buffering to be done */
     foreach ($columns as $column) {
         if ($column->get_attribute(OBJ_TYPE) != "container_portalColumn_bid") {
             continue;
         }
         $columnPortlets[$column->get_id()] = $column->get_inventory("", array(OBJ_NAME, OBJ_DESC, "bid:portlet", "bid:portlet:content"));
     }
     /*
      * Fill template and display
      */
     if (!$readable) {
         die("Ansicht nicht m&ouml;glich!<br>");
     }
     $content = new HTML_TEMPLATE_IT();
     $content->loadTemplateFile(PATH_CURRENT_EXTENSION . "templates/journal.index.template.html");
     $portal->set_page_title($journal->get_name());
     $portal->add_css_style_link(PATH_CURRENT_EXTENSION . "css/journal.css");
     $portal_width = 0;
     foreach ($columns as $column) {
         /* begin new column */
         $content->setCurrentBlock("portal_column");
         /* set column width */
         $column_width = $column->get_attribute("bid:portal:column:width");
         $portal_width += $column_width;
         $content->setVariable("PORTAL_COLUMN_WIDTH", $column_width);
         /* render editing area for column */
         if ($writeable && $GLOBALS["STEAM"]->get_current_steam_user()->get_name() != "guest") {
             $content->setVariable("PORTAL_COLUMN_ID", $column->get_id());
         }
         /* render portlets */
         if (sizeof($columnPortlets[$column->get_id()]) > 0) {
             foreach ($columnPortlets[$column->get_id()] as $portlet) {
                 if ($portlet->get_attribute("bid:portlet")) {
                     /* get the linked portlet if neccessary */
                     if ($portlet instanceof steam_link) {
                         $portlet = $portlet->get_link_object();
                     }
                     /* get content of portlet */
                     $portlet_content = $portlet->get_attribute("bid:portlet:content");
                     if (is_array($portlet_content) && count($portlet_content) > 0) {
                         array_walk($portlet_content, "_stripslashes");
                     } else {
                         $portlet_content = array();
                     }
                     /* get portlet data in handy format */
                     $portlet_name = $portlet->get_attribute(OBJ_DESC);
                     if (trim($portlet_name) == "") {
                         $portlet_name = $portlet->get_attribute(OBJ_NAME);
                     }
                     $portlet_type = $portlet->get_attribute("bid:portlet");
                     /* produce portlet output and store in output buffer =>
                      * $portlet_content */
                     ob_start();
                     include PATH_CURRENT_EXTENSION . "portlets/{$portlet_type}/view.php";
                     $portlet_content = ob_get_contents();
                     ob_end_clean();
                 } else {
                     $portlet_content = "&nbsp;";
                 }
                 $content->setVariable("PORTLET", $portlet_content);
             }
         }
         $content->parse("portal_column");
     }
     /* set portal width */
     $content->setVariable("PORTAL_WIDTH", $portal_width);
     /* return content */
     return $content->get();
 }
Example #21
0
        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_CONTAINER | CLASS_ROOM, array("OBJ_TYPE", "WIKI_LANGUAGE"));
            $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
        }
        header("Location: " . $values["return_to"]);
        exit;
    }
}
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "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 wiki '%NAME' ?")));
    $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 wiki!"));
}
$content->setVariable("TEXT_INFORMATION", gettext("The Wiki and all its entries will 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();
Example #22
0
// Pointlist
/*
<!-- BEGIN BLOCK_POINTLIST -->
<h3>{LABEL_POINTLIST_HEADER}</h3>
<p>
  {LABEL_POINTLIST_INFO}
  {LABEL_POINTLIST_DATA}
</p>
<!-- END BLOCK_POINTLIST -->
*/
$pointlist_object = $tutorial->get_attribute("UNIT_POINTLIST");
if (is_object($pointlist_object)) {
    include_once PATH_EXTENSIONS . "units_pointlist/classes/units_pointlist.extension.class.php";
    $proxy = $pointlist_object->get_attribute("UNIT_POINTLIST_PROXY");
    if (is_object($proxy)) {
        $content->setCurrentBlock("BLOCK_POINTLIST");
        $content->setVariable("LABEL_POINTLIST_HEADER", gettext("Pointlist"));
        $content->setVariable("LABEL_POINTLIST_INFO", str_replace("%LINK", "<a href='" . $course->get_url() . "units/" . $pointlist_object->get_id() . "/'>" . $pointlist_object->get_name() . "</a>", gettext("View the pointlist '%LINK'")));
        $content->setVariable("LABEL_POINTLIST_DATA", $plc);
        $content->parse("BLOCK_POINTLIST");
    }
}
//////////////////////////////////////////////////////////////////
// Documents
$attributes = array(DOC_LAST_MODIFIED, DOC_USER_MODIFIED);
$docs = $tutorial->get_workroom()->get_inventory(0, $attributes);
if (count($docs) > 0) {
    $content->setCurrentBlock("BLOCK_INVENTORY");
    $content->setVariable("LABEL_DOCNAME_DESCRIPTION", gettext("Name/Description"));
    $content->setVariable("LABEL_SIZE", gettext("File size"));
    $content->setVariable("LABEL_MODIFIED", gettext("Last modified"));
Example #23
0
$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"));
//hier Voreinstellung?!
//$values[ "privacy_deny_participants" ] = PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS; //TODO
//$values[ "privacy_deny_documents" ] = PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS;
//$privacy_deny_participants_default = PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS;
//$privacy_deny_documents_default = PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS;
if ($create_new && $is_public || $grouptype !== "group_moderated" && $grouptype !== "group_private") {
    // Add group maxsize field
    $m = new HTML_TEMPLATE_IT();
    $m->loadTemplateFile(PATH_TEMPLATES . "groups_maxsize_widget.template.html");
    $m->setCurrentBlock("BLOCK_MAXSIZE");
    $m->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
    $m->setVariable("LABEL_MAXSIZE_DSC", gettext("To limit the max number of participants for your course enter a number greater than 0. Leave this field blank or enter a '0' for no limitation."));
    isset($values["maxsize"]) ? $m->setVariable("VALUE_MAXSIZE", h($values["maxsize"])) : "";
    $mhtml = $m->get();
}
$content->setVariable("BACKLINK", "<a class=\"button\" href=\"{$backlink}\">" . gettext("back") . "</a>");
// extensions:
if (count($extensions) > 0) {
    $content->setCurrentBlock("BLOCK_EXTENSIONS");
    $content->setVariable("LABEL_EXTENSIONS", gettext("Extensions"));
    $extension_list = array();
    foreach ($extensions as $extension) {
        $extension_name = $extension->get_name();
        $content->setCurrentBlock("BLOCK_EXTENSION");
        $content->setVariable("EXTENSION_ID", $extension_name);
Example #24
0
    header("Location: " . PATH_URL . "messages.php");
    exit;
}
$user = lms_steam::get_current_user();
$cache = get_cache_function($user->get_name(), 600);
$cache->drop("lms_steam::user_count_unread_mails", $user->get_name());
$portal->set_page_title(gettext("Message"));
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "messages_read.template.html");
$mail_headers = $message->get_attribute("MAIL_MIMEHEADERS");
if (!is_array($mail_headers)) {
    $mail_headers = array();
}
if (array_key_exists("X-Steam-Group", $mail_headers)) {
    $groupname = $mail_headers["X-Steam-Group"];
    $content->setCurrentBlock("BLOCK_GROUP");
    $content->setVariable("LABEL_TO", gettext("To"));
    if ($group = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $groupname)) {
        $content->setVariable("VALUE_GROUP", "<a href=\"" . PATH_URL . "groups/" . $group->get_id() . "/members/\">" . $group->get_name() . "</a>");
    } else {
        $content->setVariable("VALUE_GROUP", h($groupname));
    }
    $content->parse("BLOCK_GROUP");
}
$message_sender_html = "";
if ($is_sent) {
    $content->setVariable("LABEL_FROM", gettext("To"));
    // construct the HTML output for the field "receiver"
    $mailto = $message->get_attribute("mailto");
    if (!is_array($mailto)) {
        $mailto = array($mailto);
Example #25
0
    foreach ($images as $image) {
        $actions = '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/">' . gettext("show properties") . '</a><br>';
        $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/edit/">' . gettext("edit properties") . '</a><br>';
        $actions .= '<a href="' . PATH_URL . 'doc/' . $image->get_id() . '/deleteImage/" onclick="return confirmDeletion();">' . gettext("delete image") . '</a>';
        $imageData = imagecreatefromstring($image->get_content());
        $width = $newWidth = imagesx($imageData);
        $height = $newHeight = imagesy($imageData);
        if ($width > 160) {
            $newHeight = (int) ($height * 160 / $width);
            $newWidth = 160;
        }
        if ($newHeight > 80) {
            $newWidth = (int) ($newWidth * 80 / $newHeight);
            $newHeight = 80;
        }
        $content->setCurrentBlock("BLOCK_IMAGE");
        $content->setVariable("IMAGE_NAME", $image->get_name());
        $content->setVariable("IMAGE_ID", $image->get_id());
        $content->setVariable("IMAGE_DESCRIPTION", $image->get_attribute('OBJ_DESC'));
        $content->setVariable("IMAGE_LINK", PATH_URL . "get_document.php?id=" . $image->get_id() . "&width=" . $newWidth . "&height=" . $newHeight);
        $content->setVariable("PREVIEW_LINK", "javascript:showBox(" . $image->get_id() . "," . $width . "," . $height . ");");
        $content->setVariable("IMAGE_ACTIONS", $actions);
        $content->parse("BLOCK_IMAGE");
    }
}
$question = gettext("Do you really want to delete this image?");
$note = gettext("NOTE: All wiki-entries containing this image have to be updated manually!");
$content->setVariable("QUESTION", $question);
$content->setVariable("NOTE", $note);
$content->setVariable("LABEL_CLOSE", gettext("close"));
$content->setVariable("BACK_LINK", PATH_URL . "wiki/" . $wiki_container->get_id() . "/");
Example #26
0
 public function processData(\IRequestObject $requestObject)
 {
     $objectId = $requestObject->getId();
     $portletInstance = \PortletMedia::getInstance();
     $portletPath = $portletInstance->getExtensionPath();
     $portlet = $portletObject = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $objectId);
     //icon
     $referIcon = \Portal::getInstance()->getAssetUrl() . "icons/refer_white.png";
     //reference handling
     $params = $requestObject->getParams();
     if (isset($params["referenced"]) && $params["referenced"] == true) {
         $portletIsReference = true;
         $referenceId = $params["referenceId"];
     } else {
         $portletIsReference = false;
     }
     //hack
     include_once PATH_BASE . "koala-core/lib/bid/slashes.php";
     //get content of portlet
     $content = $portlet->get_attribute("bid:portlet:content");
     if (is_array($content) && count($content) > 0) {
         array_walk($content, "_stripslashes");
     } else {
         $content = array();
     }
     if (sizeof($content) > 0) {
         $portletFileName = $portletPath . "/ui/html/index.html";
         $tmpl = new \HTML_TEMPLATE_IT();
         $tmpl->loadTemplateFile($portletFileName);
         //popupmenu
         if (!$portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("PortletMedia");
             $popupmenu->setElementId("portal-overlay");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         if ($portletIsReference && $portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $popupmenu = new \Widgets\PopupMenu();
             $popupmenu->setData($portlet);
             $popupmenu->setNamespace("Portal");
             $popupmenu->setElementId("portal-overlay");
             $popupmenu->setParams(array(array("key" => "sourceObjectId", "value" => $portlet->get_id()), array("key" => "linkObjectId", "value" => $referenceId)));
             $popupmenu->setCommand("PortletGetPopupMenuReference");
             $tmpl->setVariable("POPUPMENU", $popupmenu->getHtml());
         }
         $tmpl->setVariable("EDIT_BUTTON", "");
         $tmpl->setVariable("PORTLET_ID", $portlet->get_id());
         $tmpl->setVariable("HEADLINE", $content["headline"]);
         //refernce icon
         if ($portletIsReference) {
             $tmpl->setVariable("REFERENCE_ICON", "<img src='{$referIcon}'>");
         }
         $tmpl->setVariable("URL", $content["url"]);
         $tmpl->setVariable("DESCRIPTION", $content["description"]);
         $media_type = $content["media_type"];
         if ($media_type == "image") {
             $tmpl->setCurrentBlock("image");
             $tmpl->parse("MEDIA_ELEMENT", "image");
             $tmpl->parse("image");
         } else {
             if ($media_type == "movie") {
                 $tmpl->setCurrentBlock("movie");
                 $width = str_replace(array("px", "%"), "", $portlet->get_environment()->get_attribute("bid:portal:column:width")) - 10;
                 $media_player = $portletInstance->getAssetUrl() . 'mediaplayer.swf';
                 $tmpl->setVariable("MEDIA_PLAYER", $media_player);
                 $tmpl->setVariable("MEDIA_PLAYER_WIDTH", $width);
                 $tmpl->setVariable("MEDIA_PLAYER_HEIGHT", round($width * 3 / 4));
                 $tmpl->parse("movie");
             } else {
                 if ($media_type == "audio") {
                     $tmpl->setCurrentBlock("audio");
                     $width = str_replace(array("px", "%"), "", $portlet->get_environment()->get_attribute("bid:portal:column:width")) - 10;
                     $media_player = $portletInstance->getAssetUrl() . 'emff_lila_info.swf';
                     $tmpl->setVariable("MEDIA_PLAYER", $media_player);
                     $tmpl->setVariable("MEDIA_PLAYER_WIDTH", $width);
                     $tmpl->setVariable("MEDIA_PLAYER_HEIGHT", round($width * 11 / 40));
                     $tmpl->parse("audio");
                 }
             }
         }
         if ($portlet->check_access_write($GLOBALS["STEAM"]->get_current_steam_user())) {
             $tmpl->setCurrentBlock("BLOCK_EDIT_BUTTON");
             $tmpl->setVariable("PORTLET_ID_EDIT", $portlet->get_id());
             $tmpl->parse("BLOCK_EDIT_BUTTON");
         }
         //output
         $htmlBody = $tmpl->get();
     } else {
         //output for no content
         $htmlBody = "";
     }
     $this->content = $htmlBody;
     //widgets
     $outputWidget = new \Widgets\RawHtml();
     $outputWidget->setHtml($htmlBody);
     //popummenu
     $popupmenu = new \Widgets\PopupMenu();
     $popupmenu->setData($portlet);
     $popupmenu->setNamespace("PortletMedia");
     $popupmenu->setElementId("portal-overlay");
     $outputWidget->addWidget($popupmenu);
     $this->rawHtmlWidget = $outputWidget;
 }
Example #27
0
if (!isset($course)) {
    echo "<br /> Course not set";
    exit;
}
$html_handler = new koala_html_course($course);
$html_handler->set_context("exam_organization");
//set context for context menu
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_EXTENSIONS . PATH_TEMPLATES_EXAM_ORGANIZATION . "exam_organization_input_exam_results.template.html");
$container = $course->get_workroom();
$is_admin = $course->is_admin($current_user);
if ($is_admin) {
    //clipboard:
    $koala_user = new koala_html_user(new koala_user($current_user));
    //$clipboard_menu = $koala_user->get_clipboard_menu( $koala_container ); //error
    $content->setCurrentBlock("BLOCK_CLIPBOARD");
    //$content->setVariable( "CLIPBOARD_HTML", $clipboard_menu->get_html() );
    $content->parse("BLOCK_CLIPBOARD");
}
//get role
$content->setVariable("ROLE_STATUS", gettext("Your current role is student"));
if ($is_admin) {
    $content->setVariable("ROLE_STATUS", gettext("Your current role is admin/staff member"));
}
if ($is_admin) {
    $examChoosen = 0;
    if (isset($examTerm)) {
        $examChoosen = $examTerm;
    }
    $content->setVariable("INFO_EXAM_NUMBER", "Viewing page for Exam term " . $examChoosen);
    if ($examChoosen == 0) {
Example #28
0
    return is_string($text) ? $text : $default_result;
}
// PROFILE VALUES
$content->setVariable("VALUE_USER_FIRSTNAME", safe_string($user_profile["USER_FIRSTNAME"]));
$content->setVariable("VALUE_USER_FULLNAME", safe_string($user_profile["USER_FULLNAME"]));
$content->setVariable("VALUE_ACADEMIC_DEGREE", safe_string($user_profile["USER_ACADEMIC_DEGREE"]));
/*
 *  Assure translations for statuses are available via gettext
 */
gettext("student");
gettext("staff member");
gettext("guest");
gettext("alumni");
$stati = array("student", "staff member", "guest", "alumni");
foreach ($stati as $status) {
    $content->setCurrentBlock("BLOCK_STATUS");
    $content->setVariable("VALUE_STATUS", $status);
    if ($status === $user_profile["OBJ_DESC"]) {
        $content->setVariable("STATUS_SELECTED", 'selected="selected"');
    }
    $content->setVariable("VALUE_STATUS_TRANSLATED", secure_gettext($status));
    $content->parse("BLOCK_STATUS");
}
$academicTitle = (string) $user_profile["USER_ACADEMIC_TITLE"];
switch ($academicTitle) {
    case "Dr.":
        $content->setVariable("TITLE_DR_SELECTED", 'selected="selected"');
        break;
    case "PD Dr.":
        $content->setVariable("TITLE_PRIVDOZDR_SELECTED", 'selected="selected"');
        break;
Example #29
0
}
if (is_string($desc)) {
    $content->setVariable("VALUE_CONTAINER_DESC", h($desc));
}
$long_desc = $main_result[$main_tnr["OBJ_LONG_DESC"]];
if (is_string($long_desc)) {
    $content->setVariable("VALUE_CONTAINER_LONG_DESC", get_formatted_output($long_desc));
}
$can_write = $main_result[$main_tnr["can_write"]];
// don't show clipboard when viewing clipboard contents as a folder:
if (!$container->get_root_environment() instanceof steam_user) {
    //clipboard:
    $koala_user = new koala_html_user($user);
    $clipboard_menu = $koala_user->get_clipboard_menu($koala_container);
    if (CLIPBOARD) {
        $content->setCurrentBlock("BLOCK_CLIPBOARD");
        $content->setVariable("CLIPBOARD_HTML", $clipboard_menu->get_html());
        $content->parse("BLOCK_CLIPBOARD");
    }
}
if (!is_array($inventory) || count($inventory) == 0) {
    $content->setCurrentBlock("BLOCK_EMPTY_INVENTORY");
    $content->setVariable("LABEL_NO_DOCUMENTS_FOUND", gettext("There are no documents available yet.") . "<br /><br />");
    $content->parse("BLOCK_EMPTY_INVENTORY");
} else {
    // Prefetch needed data
    $attributes = array(OBJ_CREATION_TIME, DOC_LAST_MODIFIED, DOC_USER_MODIFIED, OBJ_DESC, DOC_EXTERN_URL, OBJ_ICON, OBJ_NAME);
    $data_tnr = array();
    $only_containers = TRUE;
    foreach ($inventory as $item) {
        $data_tnr[$item->get_id()] = array();
Example #30
0
$html_handler_course->set_context("units", array("subcontext" => "unit"));
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES_UNITS_PYRAMID . "units_pyramiddiscussion.template.html");
$content->setVariable("VALUE_DESC", $unit->get_attribute("OBJ_DESC"));
$content->setVariable("VALUE_LONG_DESC", get_formatted_output($unit->get_attribute("OBJ_LONG_DESC")));
$appearance = $unit->get_attribute("UNIT_PYRAMIDDISCUSSION_APPEARANCE");
if ($appearance === 0 || $appearance === "") {
    $appearance = "direct";
}
$unit_url = "https://" . $GLOBALS["STEAM"]->get_config_value("web_server") . ($GLOBALS["STEAM"]->get_config_value("web_port_http") != "443" ? ":" . $GLOBALS["STEAM"]->get_config_value("web_port_http") : "") . $unit->get_steam_object()->get_path() . "/";
$unit_url = str_replace("?", "%3f", $unit_url);
if ($appearance === "direct") {
    header("Location: " . $unit_url);
    exit;
} else {
    if ($appearance == "2") {
        $content->setCurrentBlock("BLOCK_IFRAME");
        $content->setVariable("VALUE_IFRAME_URL", $unit_url);
        $content->parse("BLOCK_IFRAME");
    } else {
        $content->setCurrentBlock("BLOCK_LINK");
        $content->setVariable("VALUE_LINK_URL", $unit_url);
        $content->setVariable("VALUE_LINK_TEXT", gettext("Show pyramiddiscussion"));
        $content->setVariable("VALUE_LINK_TARGET", "target='_blank'");
        $content->parse("BLOCK_LINK");
    }
}
$html_handler->set_html_left($content->get());
$portal->set_page_main($html_handler->get_headline(), $html_handler->get_html(), "");
$portal->show_html();
exit;