Example #1
0
 public function group_get_subgroups($group_id)
 {
     if (!($group = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $group_id))) {
         throw new Exception("No valid object id ({$group_id}).", E_PARAMETER);
     }
     if (!$group instanceof steam_group) {
         throw new Exception("Object is not a group ({$group_id}).", E_PAREMETER);
     }
     $subgroups = $group->get_subgroups();
     $result = array();
     $i = 0;
     $attributes = array(OBJ_NAME, OBJ_DESC, OBJ_CREATION_TIME);
     steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $subgroups, $attributes);
     foreach ($subgroups as $subgroup) {
         $result[$i]["OBJ_ID"] = $subgroup->get_id();
         $result[$i]["OBJ_NAME"] = $subgroup->get_name();
         $result[$i]["OBJ_DESC"] = $subgroup->get_attribute("OBJ_DESC");
         $result[$i]["NO_MEMBERS"] = $subgroup->count_members();
         $result[$i]["OBJ_CREATION_TIME"] = $subgroup->get_attribute("OBJ_CREATION_TIME");
         $subsub = $subgroup->get_subgroups();
         $result[$i]["NO_SUBGROUPS"] = count($subsub);
         $i++;
     }
     return $result;
 }
Example #2
0
$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 != "") {
Example #3
0
foreach ($inventory as $item) {
    $tnr[$item->get_id()] = array();
    $tnr[$item->get_id()]["creator"] = $item->get_creator(1);
    $tnr[$item->get_id()]["item_write_access"] = $item->check_access_write($steam->get_login_user(), 1);
    $tnr[$item->get_id()]["item_read_access"] = $item->check_access_read($steam->get_login_user(), 1);
}
$result = $steam->buffer_flush();
$creators = array();
$item_write_access = array();
$item_read_access = array();
foreach ($inventory as $item) {
    $creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
    $item_write_access[$item->get_id()] = $result[$tnr[$item->get_id()]["item_write_access"]];
    $item_read_access[$item->get_id()] = $result[$tnr[$item->get_id()]["item_read_access"]];
}
steam_factory::load_attributes($steam, $inventory, array(OBJ_NAME, OBJ_DESC, OBJ_KEYWORDS, DOC_MIME_TYPE, "bid:description"));
// 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...
$undisplayed_pic_count = 0;
for ($i = 0; $i < count($inventory); $i += 1) {
    $item = $inventory[$i];
    // Skip image if rights are insufficient
    if (!$item_read_access[$item->get_id()]) {
        $undisplayed_pic_count++;
        continue;
    }
    $itemname = $item->get_attribute(OBJ_NAME);
    $itemdescription = $item->get_attribute(OBJ_DESC);
    $itemkeywords = implode(", ", $item->get_attribute(OBJ_KEYWORDS));
    $itemmimetype = $item->get_attribute(DOC_MIME_TYPE);
Example #4
0
$user = lms_steam::get_current_user();
$admin_group = steam_factory::get_group($GLOBALS["STEAM"]->get_id(), "admin");
if (!is_object($admin_group) || !$admin_group->is_member($user)) {
    header("location:/");
    exit;
}
$portal_user = $portal->get_user();
$path = url_parse_rewrite_path(isset($_GET["path"]) ? $_GET["path"] : "");
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "admin_paul.template.html");
$paulsync_folder = steam_factory::path_to_object($GLOBALS["STEAM"]->get_id(), "/home/root/documents/paulsync");
if (!is_object($paulsync_folder)) {
    throw new Exception("Paul sync log folder /home/root/documents/paulsync not found", E_CONFIGURATION);
    exit;
}
steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($paulsync_folder), array("PAUL_SYNC_STARTTIME", "PAUL_SYNC_ENDTIME", "PAUL_SYNC_RUNNING"));
$content->setCurrentBlock("BLOCK_BLOCK");
$content->setVariable("LABEL_BLOCK", "PAUL synchronisation");
$content->setCurrentBlock("ENTRY");
$content->setVariable("LABEL", "Sync Status");
$content->setVariable("VALUE", $paulsync_folder->get_attribute("PAUL_SYNC_RUNNING") === "TRUE" ? gettext("Running") : gettext("Not running"));
$content->parse("ENTRY");
$content->setCurrentBlock("ENTRY");
$content->setVariable("LABEL", "Last sync start time");
$content->setVariable("VALUE", date("d.m.y, H:i:s", $paulsync_folder->get_attribute("PAUL_SYNC_STARTTIME")));
$content->parse("ENTRY");
$content->setCurrentBlock("ENTRY");
$content->setVariable("LABEL", "Last sync end time");
$content->setVariable("VALUE", date("d.m.y, H:i:s", $paulsync_folder->get_attribute("PAUL_SYNC_ENDTIME")));
$content->parse("ENTRY");
/*
Example #5
0
                 $parent = $group->get_steam_group()->get_parent_group();
                 if (is_object($parent)) {
                     $pgroup_id = $parent->get_id();
                 } else {
                     $pgroup_id = -1;
                 }
                 // no koala group. its a steam only group
             }
             if ($pgroup_id != -1) {
                 $parentgroup = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $pgroup_id);
                 if (!is_object($parentgroup) || !$parentgroup instanceof steam_group) {
                     throw new Exception("Configuration Error: Invalid Public or Private Group Setting. False Group id=" . $pgroup_id, E_CONFIGURATION);
                     exit;
                 }
                 $siblings = $parentgroup->get_subgroups();
                 steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $siblings, array(OBJ_NAME));
                 foreach ($siblings as $sibling) {
                     if (strtolower($sibling->get_name()) == strtolower($values["name"])) {
                         if ($create_new || $sibling->get_id() != $group->get_steam_group()->get_id()) {
                             $problems .= gettext("The groupname you've choosen is used for another group already.") . " ";
                             $hints .= gettext("Please choose another groupname.") . " ";
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
 if (empty($values["short_dsc"])) {
     $problems .= gettext("The short description is missing.") . " ";
Example #6
0
 public function getHtmlForObjectId(\FrameResponseObject $frameResponseObject)
 {
     $rawHtml = new \Widgets\RawHtml();
     $objectId = $this->id;
     if (isset($this->params[1])) {
         $from = $this->params[1];
     } else {
         $from = 0;
     }
     $steam = $GLOBALS["STEAM"]->get_id();
     $currentRoom = \steam_factory::get_object($steam, $objectId);
     $this->object = $currentRoom;
     $currentRoomPath = $currentRoom->get_path(1);
     $currentRoomData = $currentRoom->get_attributes(array(OBJ_NAME, OBJ_DESC), 1);
     $steamUser = $GLOBALS["STEAM"]->get_current_steam_user();
     $steamUserId = $steamUser->get_id();
     //check if user may write in this folder
     $writeAllowed = $currentRoom->check_access_write($steamUser, 1);
     //get inventory and inventorys attributes if allowed to
     $allowed = $currentRoom->check_access_read($steamUser, 1);
     $result = $GLOBALS["STEAM"]->buffer_flush();
     $writeAllowed = $result[$writeAllowed];
     $allowed = $result[$allowed];
     $currentRoomPath = $result[$currentRoomPath];
     $currentRoomData = $result[$currentRoomData];
     $currentRoomDisplayName = str_replace("'s workarea", "", stripslashes($currentRoomData[OBJ_NAME]));
     if (isset($currentRoomData[OBJ_DESC]) && $currentRoomData[OBJ_DESC] != "") {
         $currentRoomDisplayName = $currentRoomData[OBJ_DESC];
     }
     $currentRoomDisplayName = str_replace("s workroom.", "", $currentRoomDisplayName);
     $numberOfThumbs = 10;
     //forces a stable navigation structure
     $from -= $from % $numberOfThumbs;
     //navigation commands
     $picCount = sizeof($currentRoom->get_inventory());
     $to = $from + ($numberOfThumbs - 1);
     if ($from >= $picCount) {
         $from = $picCount - 1 - ($picCount - 1) % $numberOfThumbs;
     }
     if ($to >= $picCount) {
         $to = $picCount - 1;
     }
     if ($allowed && $currentRoom instanceof \steam_container) {
         if ($from >= 0 && $to >= $numberOfThumbs - 1) {
             $inventory = $currentRoom->get_inventory_paged($from, $to);
         } else {
             $inventory = $currentRoom->get_inventory_paged(0, $numberOfThumbs - 1);
         }
     } else {
         $inventory = array();
     }
     //$contentJS = $this->loadTemplate("overlay.template.js");
     //add css
     //	\Gallery::getInstance()->addCSS();
     //add js
     //	\Gallery::getInstance()->addJS();
     //\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.min.js");
     //	\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/jquery.colorbox.js");
     //	\lms_portal::get_instance()->add_javascript_src("JQuery", PATH_URL . "gallery/js/colorbox.control.js");
     //TODO: overlay.template.js not working - overlay to start gallery missing
     //$this->addJS("overlay.template.js");
     $tpl = \Gallery::getInstance()->loadTemplate("gallery.template.html");
     //$tpl= new \HTML_TEMPLATE_IT();
     //$tpl->loadTemplateFile(\Gallery::getInstance()->getExtensionPath()."ui/html/gallery.template.html");
     $tpl->setVariable("IMAGEURL", \Gallery::getInstance()->getAssetUrl() . "image/round_green_play_button_4044.jpg");
     $tpl->setVariable("FROM", max($from + 1, 1));
     $tpl->setVariable("TO", min($to + 1, $picCount));
     $tpl->setVariable("PIC_COUNT", $picCount);
     $pagemin = $from - $numberOfThumbs;
     $pagemin = max($pagemin, 0);
     //Navigation
     $backlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . $pagemin . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_on.gif\"></a>";
     if ($from == 0) {
         $backlink = "<a href=\"\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zur&uuml;ck\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_prev_off.gif\"></a>";
         $tpl->setVariable("BACKLINK", $backlink);
     } else {
         $tpl->setVariable("BACKLINK", $backlink);
     }
     $pagemax = min($to, $picCount - 1);
     $forwardlink = "<a href=\"" . PATH_URL . "gallery/index/" . $objectId . "/" . ($pagemax + 1) . "\" class=\"pagingleft\"><img alt=\"Zurück\" title=\"Zurück\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_on.gif\"></a>";
     if ($to >= $picCount - 1) {
         $forwardlink = "<a href=\"\" class=\"pagingright\"><img alt=\"Vor\" title=\"Vor\" src=\"" . \Gallery::getInstance()->getAssetUrl() . "/icons/top_seq_next_off.gif\">";
         $tpl->setVariable("FORWARDLINK", $forwardlink);
     } else {
         $tpl->setVariable("FORWARDLINK", $forwardlink);
     }
     //Rights
     foreach ($inventory as $item) {
         $tnr[$item->get_id()] = array();
         $tnr[$item->get_id()]["creator"] = $item->get_creator(1);
         $tnr[$item->get_id()]["item_write_access"] = $item->check_access_write($GLOBALS["STEAM"]->get_current_steam_user(), 1);
         $tnr[$item->get_id()]["item_read_access"] = $item->check_access_read($GLOBALS["STEAM"]->get_current_steam_user(), 1);
     }
     $result = $GLOBALS["STEAM"]->buffer_flush();
     $creators = array();
     $itemWriteAccess = array();
     $itemReadAccess = array();
     foreach ($inventory as $item) {
         $creators[$item->get_id()] = $result[$tnr[$item->get_id()]["creator"]];
         $itemWriteAccess[$item->get_id()] = $result[$tnr[$item->get_id()]["item_write_access"]];
         $itemReadAccess[$item->get_id()] = $result[$tnr[$item->get_id()]["item_read_access"]];
     }
     \steam_factory::load_attributes($steam, $inventory, array(OBJ_NAME, OBJ_DESC, OBJ_KEYWORDS, DOC_MIME_TYPE, "bid:description"));
     // 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...
     $undisplayedPicCount = 0;
     //GET RIGHTS
     $sanction = $currentRoom->get_sanction();
     $attrib = $this->object->get_attributes(array(OBJ_NAME, OBJ_DESC, "bid:doctype"));
     $bid_doctype = isset($attrib["bid:doctype"]) ? $attrib["bid:doctype"] : "";
     $docTypeQuestionary = strcmp($attrib["bid:doctype"], "questionary") == 0;
     $docTypeMessageBoard = $this->object instanceof \steam_messageboard;
     // in questionaries the write right is limited to insert rights only
     if ($docTypeQuestionary) {
         $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_INSERT;
     } else {
         if ($docTypeMessageBoard) {
             $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_ANNOTATE;
         } else {
             $SANCTION_WRITE_FOR_CURRENT_OBJECT = SANCTION_WRITE | SANCTION_EXECUTE | SANCTION_MOVE | SANCTION_INSERT | SANCTION_ANNOTATE;
         }
     }
     $sanctionFlag = false;
     if (isset($sanction[$steamUserId])) {
         if ($sanction[$steamUserId] >= $SANCTION_WRITE_FOR_CURRENT_OBJECT) {
             $sanctionFlag = true;
         }
     }
     $env = $currentRoom->get_environment();
     if ($env instanceof \steam_room) {
         $envSanction = $env->get_sanction();
         if (isset($envSanction[$steamUserId])) {
             if ($envSanction[$steamUserId] >= $SANCTION_WRITE_FOR_CURRENT_OBJECT) {
                 $sanctionFlag = true;
             }
         }
     }
     $currentRoomCreater = $currentRoom->get_creator();
     $currentRoomCreaterId = $currentRoomCreater->get_id();
     if ($currentRoomCreaterId == $steamUserId) {
         $sanctionFlag = true;
     }
     for ($i = 0; $i < count($inventory); $i++) {
         $tpl->setCurrentBlock("ITEM");
         $item = $inventory[$i];
         if ($sanctionFlag) {
             $tpl->setVariable("REMOVE_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/trash.png");
             $tpl->setVariable("ITEM_PATH_URL2", PATH_URL);
             $tpl->setVariable("ITEM_THUMBNAIL_ID2", $item->get_id());
         }
         $tpl->setVariable("FULLSCREEN_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_fullscreen.png");
         $tpl->setVariable("SAVE_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_save.png");
         $tpl->setVariable("EDIT_ICON", \Gallery::getInstance()->getAssetUrl() . "icons/image_properties.gif");
         $popupMenu = new \Widgets\PopupMenu();
         $popupMenu->setData($item);
         $popupMenu->setElementId("gallery-overlay");
         $tpl->setVariable("POPUP_MENU", $popupMenu->getHtml());
         $rawHtml->addWidget($popupMenu);
         // Skip image if rights are insufficient
         if (!$itemReadAccess[$item->get_id()]) {
             $undisplayedPicCount++;
             continue;
         }
         $itemName = $item->get_attribute(OBJ_NAME);
         $itemDescription = $item->get_attribute(OBJ_DESC);
         $itemKeywords = implode(", ", $item->get_attribute(OBJ_KEYWORDS));
         $itemMimetype = $item->get_attribute(DOC_MIME_TYPE);
         //set Item
         $tpl->setVariable("OBJECT_ID", $item->get_id());
         $tpl->setVariable("OBJECT_NAME", $itemName);
         $tpl->setVariable("OBJECT_DESC", $itemDescription);
         $tpl->setVariable("OBJECT_KEYWORDS", $itemKeywords);
         // render a steam_document
         if ($item instanceof \steam_document) {
             //care for documents not to be displayed in the browser
             if ($itemMimetype === "image/gif" || $itemMimetype === "image/jpg" || $itemMimetype === "image/jpeg" || $itemMimetype === "image/png") {
                 $tpl->setVariable("ITEM_PATH_URL", PATH_URL);
                 $tpl->setVariable("ITEM_THUMBNAIL_ID", $item->get_id());
                 $tpl->setVariable("ITEM_BIGTHUMB_ID", $item->get_id());
                 if ($i - $undisplayedPicCount == 0) {
                     $tpl->setVariable("FIRST_GALLERY_ID", $item->get_id());
                 }
                 $tpl->parse("ITEM");
             }
         }
     }
     //set invisible items for colorbox
     for ($i = 0; $i < count($inventory); $i++) {
         $tpl->setCurrentBlock("INV");
         $item = $inventory[$i];
         // Skip image if rights are insufficient
         if (!$itemReadAccess[$item->get_id()]) {
             $undisplayedPicCount++;
             continue;
         }
         $itemName = $item->get_attribute(OBJ_NAME);
         $itemDescription = $item->get_attribute(OBJ_DESC);
         $itemKeywords = implode(", ", $item->get_attribute(OBJ_KEYWORDS));
         $itemMimetype = $item->get_attribute(DOC_MIME_TYPE);
         // set display name
         $objectDisplayName = $itemName;
         if ($itemDescription === 0) {
             $itemDescription = "";
         }
         $tpl->setVariable("OBJECT_NAME", $objectDisplayName);
         $tpl->setVariable("OBJECT_DESC", $itemDescription);
         // render a steam_document
         if ($item instanceof \steam_document) {
             //care for documents not to be displayed in the browser
             if ($itemMimetype === "image/gif" || $itemMimetype === "image/jpg" || $itemMimetype === "image/jpeg" || $itemMimetype === "image/png") {
                 $tpl->setVariable("ITEM_PATH_URL", PATH_URL);
                 $tpl->setVariable("ITEM_THUMBNAIL_ID", $item->get_id());
                 $tpl->parse("INV");
             }
         }
     }
     $actionBar = new \Widgets\ActionBar();
     $actionBar->setActions(array(array("name" => "Neues Bild", "ajax" => array("onclick" => array("command" => "Addpicture", "params" => array("id" => $this->id), "requestType" => "popup"))), array("name" => "Eigenschaften", "ajax" => array("onclick" => array("command" => "Properties", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer"))), array("name" => "Rechte", "ajax" => array("onclick" => array("command" => "Sanctions", "params" => array("id" => $this->id), "requestType" => "popup", "namespace" => "explorer")))));
     $css = self::auslesen(PATH_URL . "gallery/css/style.css");
     $js = self::auslesen(PATH_URL . "gallery/js/code.js");
     $rawHtml->setCss($css);
     $rawHtml->setJs($js);
     $rawHtml->setHtml($tpl->get());
     if ($sanctionFlag) {
         $frameResponseObject->addWidget($actionBar);
     }
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #7
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //		$portal = \lms_portal::get_instance();
     //	$portal->initialize( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //	$path = $request->getPath();
     $STEAM = $GLOBALS["STEAM"];
     $weblogId = $this->params[0];
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblogId);
     }
     $weblog = \steam_factory::get_object($STEAM->get_id(), $weblogId);
     //if ( ! $weblog = steam_factory::get_object( $STEAM->get_id(), $_GET[ "id" ] ) )
     //{
     //	include( "bad_link.php" );
     //	exit;
     //}
     if (!$weblog instanceof \steam_calendar) {
         if ($weblog instanceof \steam_container) {
             $category = $weblog;
             $categories = $category->get_environment();
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $categories->get_environment()->get_id());
         } elseif ($weblog instanceof \steam_date) {
             $date = $weblog;
             $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $date->get_environment()->get_id());
         } else {
             header("location: /404/");
             exit;
         }
     } else {
         $weblog = new \steam_weblog($GLOBALS["STEAM"]->get_id(), $weblogId);
         //define( "OBJ_ID",	$weblogId );
         if (!$weblog->check_access_read($user)) {
             throw new \Exception("No rights to view this.", E_USER_RIGHTS);
         }
     }
     $weblog_html_handler = new \lms_weblog($weblog);
     //var_dump($weblog_html_handler);die;
     $weblog_html_handler->set_menu("entries");
     $grp = $weblog->get_environment()->get_creator();
     \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($grp), array(OBJ_NAME, OBJ_TYPE));
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $weblog_html_handler->set_widget_categories();
     $all_date_objects = $weblog->get_date_objects();
     usort($all_date_objects, "sort_dates");
     //sort_dates defined in steam_calendar.class
     $weblog_html_handler->set_widget_archive(5);
     $weblog_html_handler->set_widget_blogroll();
     $weblog_html_handler->set_widget_access($grp);
     if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
         \lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", lms_steam::get_link_to_root($weblog));
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
         header("Location: " . PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
         exit;
     }
     if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
         $user = \lms_steam::get_current_user();
         $id = (int) $_GET["unsubscribe"];
         $feeds = $user->get_attribute("USER_RSS_FEEDS");
         if (!is_array($feeds)) {
             $feeds = array();
         }
         unset($feeds[$id]);
         $user->set_attribute("USER_RSS_FEEDS", $feeds);
         $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("subscription of '%NAME' canceled."));
         header("Location: " . PATH_URL . "weblog/index/" . $weblog->get_id() . "/");
         exit;
     }
     //TODO what is the reason for this structure?
     switch (TRUE) {
         case isset($date) && $date:
             $weblog_html_handler->print_entries(array($date), FALSE);
             break;
         default:
             $weblog_html_handler->print_entries($all_date_objects);
             break;
     }
     $weblog_html_handler->set_podcast_link();
     //$portal->set_rss_feed( PATH_URL . "services/feeds/weblog_public.php?id=" . OBJ_ID , gettext( "Feed" ), str_replace( "%l", isset($login)?$login:'', gettext( "Subscribe to this forum's Newsfeed" ) ) );
     $rootlink = \lms_steam::get_link_to_root($weblog);
     //var_dump($rootlink);die;
     //var_dump($rootlink);die;
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("link" => "", "name" => h($weblog->get_name())));
     //$portal->set_page_main(
     //$headline,
     //$weblog_html_handler->get_html()
     //);
     //var_dump($portal);die;
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($weblog_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #8
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 #9
0
 for ($i = $start; $i < $end; $i++) {
     $mailto = $data_result[$data_tnr[$i]["ATTRIBUTES"]]["mailto"];
     // ensure that mailto is an array always
     if (!is_array($mailto)) {
         $mailto = array($mailto);
     }
     // store array for further use
     $mailtos[$i] = $mailto;
     foreach ($mailto as $receiver) {
         if (is_object($receiver)) {
             $receiver_mapping[$i . "-" . $receiver->get_id()] = $receiver;
         }
     }
 }
 // get needed attributes of the receivers at once
 steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array_values($receiver_mapping), array(OBJ_NAME, OBJ_ICON, OBJ_TYPE));
 // Optimize server calls if receiver is a course
 $coursecount = 0;
 $course_tnr = array();
 for ($i = $start; $i < $end; $i++) {
     $mailto = $mailtos[$i];
     $receiver = $mailto[0];
     if (is_object($receiver)) {
         if ($receiver instanceof steam_object) {
             if ($receiver instanceof steam_group) {
                 $grouptype = $receiver->get_attribute(OBJ_TYPE);
                 if (!is_string($grouptype)) {
                     $grouptype = "";
                 }
                 if (stristr($grouptype, "course") || stristr($grouptype, "group_course")) {
                     $course_tnr[$receiver->get_id()] = $receiver->get_parent_group(TRUE);
Example #10
0
 /**
  * function get_date_objects:
  * 
  * @param $pStart
  * @param $pEnd
  * @param $pType
  * 
  * @return 
  */
 public function get_date_objects($pStart = 0, $pEnd = 0, $pType = 0)
 {
     if ($pStart == 0 && $pEnd == 0) {
         $pEnd = mktime(0, 0, 0, 1, 1, 2050);
     }
     $date_objects = $this->steam_command($this, "get_all_entries", array((int) $pStart, (int) $pEnd, $pType), 0);
     steam_factory::load_attributes($this->steam_connectorID, $date_objects, array("DATE_START_DATE"));
     usort($date_objects, "sort_dates");
     return $date_objects;
 }
Example #11
0
    $portal->set_guest_allowed(GUEST_ALLOWED);
}
$current_user = lms_steam::get_current_user();
$um = unitmanager::create_unitmanager($course);
$html_handler = new koala_html_course($course);
$html_handler->set_context("units");
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES_UNITS_BASE . "units.template.html");
$container = $course->get_workroom();
$koala_container = new koala_container_units($container, $course->get_url() . 'units/');
$koala_container->set_owner($course);
$is_admin = $course->is_admin($current_user);
$units = array();
$units_tmp = $koala_container->get_inventory();
// Pre-load Atributes for all units to optimize requests
steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $units_tmp, array(OBJ_TYPE, OBJ_NAME, OBJ_ICON, OBJ_DESC, "UNIT_TYPE", "UNIT_DISPLAY_TYPE"));
foreach ($units_tmp as $unit) {
    $koala_unit = koala_object::get_koala_object($unit);
    if (is_object($koala_unit) && method_exists($koala_unit, 'get_unit')) {
        $unit_class = $koala_unit->get_unit();
        if (is_object($unit_class) && method_exists($unit_class, 'is_enabled_for') && !$unit_class->is_enabled_for($owner)) {
            continue;
        }
    }
    $units[] = $unit;
}
if ($is_admin) {
    //clipboard:
    $koala_user = new koala_html_user(new koala_user($current_user));
    $clipboard_menu = $koala_user->get_clipboard_menu($koala_container);
    $content->setCurrentBlock("BLOCK_CLIPBOARD");
Example #12
0
 public function get_items($id)
 {
     $wiki = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id, CLASS_CONTAINER);
     $items = $wiki->get_inventory(CLASS_DOCUMENT, array(), SORT_NAME);
     $result = array();
     $i = 0;
     steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $items, array(OBJ_NAME, OBJ_CREATION_TIME, DOC_USER_MODIFIED, DOC_MIME_TYPE, DOC_LAST_MODIFIED));
     $authors = array();
     foreach ($items as $item) {
         if (!strstr($item->get_name(), ".wiki")) {
             continue;
         }
         $result[$i] = $item->get_attributes(array(OBJ_CREATION_TIME, DOC_USER_MODIFIED, DOC_MIME_TYPE, DOC_LAST_MODIFIED, OBJ_NAME));
         $author_obj = $item->get_attribute(DOC_USER_MODIFIED);
         if (is_object($author_obj)) {
             $authors[$author_obj->get_id()] = $item->get_attribute(DOC_USER_MODIFIED);
         }
         $result[$i]["OBJ_ID"] = $item->get_id();
         $i++;
     }
     steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array_values($authors), array(OBJ_NAME, USER_FULLNAME, USER_FIRSTNAME));
     $i = 0;
     foreach ($items as $item) {
         if (!strstr($item->get_name(), ".wiki")) {
             continue;
         }
         // Comments are unused in wikis at the moment
         /*
         			$comments = $item->get_annotations();
         			if ( count( $comments ) > 0 )
         			{
         				$result[ $i ][ "COMMENTS_NO" ]   = count( $comments );
         				$result[ $i ][ "COMMENTS_LAST" ] = $comments[ 0 ]->get_attribute( "OBJ_CREATION_TIME" );
         				$author = $comments[ 0 ]->get_creator();
         				$result[ $i ][ "COMMENTS_LAST_AUTHOR" ] = $author->get_attribute( "USER_FIRSTNAME" ) . " " . $author->get_attribute( "USER_FULLNAME" );
         			}
         */
         $author = $item->get_attribute(DOC_USER_MODIFIED);
         if (is_object($author)) {
             $name = $authors[$author->get_id()]->get_attribute(USER_FIRSTNAME) . " " . $authors[$author->get_id()]->get_attribute(USER_FULLNAME);
             $result[$i][DOC_USER_MODIFIED] = $name;
         }
         $i++;
     }
     return $result;
 }
Example #13
0
 public static function get_config_objects()
 {
     $configs = array();
     $config_container = steam_factory::get_object_by_name($GLOBALS["STEAM"]->get_id(), "/config/koala/extensions/");
     if (is_object($config_container)) {
         $config_objects = $config_container->get_inventory_raw();
         steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $config_objects, array(OBJ_NAME));
     } else {
         $config_objects = array();
     }
     foreach ($config_objects as $co) {
         $configs[$co->get_name()] = $co;
     }
     return $configs;
 }
Example #14
0
//lms_steam::connect(); //http_auth function is used instead
require_once PATH_LIB . "http_auth_handling.inc.php";
if (http_auth()) {
    if (!($discussion = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["id"]))) {
        include PATH_PUBLIC . "bad_link.php";
        exit;
    }
    $rss_channel = new RssChannel($discussion->get_name(), PATH_URL . "doc/" . $_GET["id"] . "/", "");
    $rss_channel->generate_http_header();
    print $rss_channel->generate_xml_header();
    $object = steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["id"]);
    if (is_object($object)) {
        $data_tnr["ATTRIBUTES"] = $object->get_attributes(array(OBJ_NAME, OBJ_CREATION_TIME, OBJ_DESC), TRUE);
        $data_tnr["CREATOR"] = $object->get_creator(TRUE);
        $data_result = $GLOBALS["STEAM"]->buffer_flush();
        $creator = $data_result[$data_tnr["CREATOR"]];
        steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($creator), array(USER_FULLNAME, USER_FIRSTNAME));
        print $rss_channel->generate_item($data_result[$data_tnr["ATTRIBUTES"]][OBJ_NAME] . " " . gettext("by") . " " . $creator->get_attribute(USER_FIRSTNAME) . " " . $creator->get_attribute(USER_FULLNAME), "", BBCode($data_result[$data_tnr["ATTRIBUTES"]][OBJ_DESC]), $creator->get_attribute(USER_FIRSTNAME) . " " . $creator->get_attribute(USER_FULLNAME), $data_result[$data_tnr["ATTRIBUTES"]][OBJ_CREATION_TIME], "", PATH_URL . "doc/" . $_GET["id"] . "/#comment" . $object->get_id());
    }
    $cache = get_cache_function($_GET["id"], 600);
    $discussions = $cache->call("lms_steam::get_annotations", $_GET["id"]);
    foreach ($discussions as $discussion) {
        print $rss_channel->generate_item(gettext("Post by ") . $discussion["OBJ_CREATOR"], "", BBCode($discussion["CONTENT"]), $discussion["OBJ_CREATOR"], $discussion["OBJ_CREATION_TIME"], "", PATH_URL . "doc/" . $_GET["id"] . "/#comment" . $discussion["OBJ_ID"]);
    }
    print $rss_channel->generate_xml_footer();
} else {
    $rss_channel = new PodcastRSS("Access denied", PATH_SERVER . $_SERVER["REQUEST_URI"], "You are not allowed to access this RSS Feed. Please check your username and password");
    $rss_channel->generate_http_header();
    $rss_channel->generate_xml_header(TRUE);
    exit;
}
Example #15
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $path = $this->params;
     $user = \lms_steam::get_current_user();
     $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
     $portal = \lms_portal::get_instance();
     $portal->initialize(GUEST_NOT_ALLOWED);
     $create_new = isset($path[0]) && $path[0] == "createGroup" ? TRUE : FALSE;
     $id = isset($path[1]) ? $path[1] : null;
     try {
         $steam_group = !empty($id) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $id) : FALSE;
     } catch (Exception $ex) {
         include "bad_link.php";
         exit;
     }
     $group_is_private = FALSE;
     if ($steam_group && is_object($steam_group)) {
         switch ((string) $steam_group->get_attribute("OBJ_TYPE")) {
             case "course":
                 $group = new \koala_group_course($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . SEMESTER_URL . "/" . $group->get_semester()->get_name() . "/" . h($group->get_name()) . "/";
                 break;
             default:
                 $group = new \koala_group_default($steam_group);
                 // TODO: Passt der backlink?
                 $backlink = PATH_URL . "groups/" . $group->get_id() . "/";
                 // Determine if group is public or private
                 $parent = $group->get_parent_group();
                 if ($parent->get_id() == STEAM_PRIVATE_GROUP) {
                     $group_is_private = TRUE;
                 }
                 break;
         }
     }
     if ($group_is_private) {
         if (!$steam_group->is_member($user) && !\lms_steam::is_koala_admin($user)) {
             throw new Exception(gettext("You have no rights to access this group"), E_USER_RIGHTS);
         }
     }
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $accessmergel = FALSE;
     if (isset($group) && is_object($group)) {
         $creator = $group->get_steam_group()->get_creator();
         if ($group->get_steam_group()->get_attribute(KOALA_GROUP_ACCESS) != PERMISSION_GROUP_PRIVATE && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     if ($create_new) {
         // CREATE
         if (isset($_POST) && isset($_POST["grouptype"]) && $_POST["grouptype"] == "group_private") {
             $is_public = FALSE;
         } else {
             $is_public = TRUE;
         }
         $waspassword = FALSE;
         // TODO: Passt der backlink?
         $backlink = PATH_URL . "groups_create.php";
         //TODO: 404 Fehler!!!
         //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group' );
         $submit_text = gettext("Create group");
     } else {
         // EDIT
         // TODO: Pfad anpassen!
         $backlink = PATH_URL . "groups/" . $group->get_steam_group()->get_id() . "/";
         if (!$group->is_admin($user)) {
             include "bad_link.php";
             exit;
         }
         $is_public = $group->is_public();
         $waspassword = $group->get_steam_group()->has_password();
         //$extensions = $group->get_extensions( TRUE );
         $submit_text = gettext("Save changes");
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["save"])) {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["name"])) {
             $problems = gettext("You have to specify a name for this group.") . " ";
             $hints = gettext("Choose a clear synonym which helps people to find your group by name.") . " ";
         } else {
             if (strpos($values['name'], '/')) {
                 $problems .= gettext("Please don't use the \"/\"-char in the groupname.") . ' ';
             }
             if (strpos($values['name'], '.')) {
                 $problems .= gettext("Please don't use the \".\"-char in the groupname.") . ' ';
             } else {
                 if ($is_public && $values["category"] == "0") {
                     $problems .= gettext("You have to choose a category.") . " ";
                     $hints .= gettext("Choose a category to help the users find your group. ") . " ";
                 }
                 if (empty($problems)) {
                     if ($create_new) {
                         if ($is_public) {
                             $pgroup_id = STEAM_PUBLIC_GROUP;
                         } else {
                             $pgroup_id = STEAM_PRIVATE_GROUP;
                         }
                     } else {
                         $parent = $group->get_steam_group()->get_parent_group();
                         if (is_object($parent)) {
                             $pgroup_id = $parent->get_id();
                         } else {
                             $pgroup_id = -1;
                         }
                         // no koala group. its a steam only group
                     }
                     if ($pgroup_id != -1) {
                         $parentgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $pgroup_id);
                         if (!is_object($parentgroup) || !$parentgroup instanceof \steam_group) {
                             throw new \Exception("Configuration Error: Invalid Public or Private Group Setting. False Group id=" . $pgroup_id, E_CONFIGURATION);
                             exit;
                         }
                         $siblings = $parentgroup->get_subgroups();
                         \steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $siblings, array(OBJ_NAME));
                         foreach ($siblings as $sibling) {
                             if (strtolower($sibling->get_name()) == strtolower($values["name"])) {
                                 if ($create_new || $sibling->get_id() != $group->get_steam_group()->get_id()) {
                                     $problems .= gettext("The groupname you've choosen is used for another group already.") . " ";
                                     $hints .= gettext("Please choose another groupname.") . " ";
                                     break;
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (empty($values["short_dsc"])) {
             $problems .= gettext("The short description is missing.") . " ";
             $hints .= gettext("Sometimes, keywords are sufficient to help people understand what your group is for.") . " ";
         }
         $max_members = -1;
         $sizeproblems = FALSE;
         if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && preg_match('/[^-.0-9]/', trim($values["maxsize"]))) {
             $problems .= gettext("Invalid max number of participants.") . " ";
             $hints .= gettext("Please enter a valid number for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
             $sizeproblems = TRUE;
         } else {
             if (!empty($values["maxsize"]) && trim($values["maxsize"]) != "" && trim($values["maxsize"]) < 0) {
                 $problems .= gettext("Invalid max number of participants.") . " ";
                 $hints .= gettext("Please enter a number equal or greater than '0' for the max number of participants.") . " " . gettext("Please note that the input of a '0' or to leave the field blank means no limitation.") . " ";
                 $sizeproblems = TRUE;
             } else {
                 if (isset($values["maxsize"])) {
                     if (trim($values["maxsize"]) === "") {
                         $max_members = 0;
                     } else {
                         $max_members = (int) trim($values["maxsize"]);
                     }
                 }
             }
         }
         if (!$create_new && !$sizeproblems && isset($max_members) && $max_members > 0 && $max_members < $group->count_members()) {
             $problems .= gettext("Cannot set max number of participants.") . " ";
             $hints .= str_replace("%ACTUAL", $group->count_members(), str_replace("%CHOSEN", $max_members, gettext("You choosed to limit your group's max number of participants of %CHOSEN but your course already has %ACTUAL participants. If you want to set the max number of participants below %ACTUAL you have to remove some participants first."))) . " ";
         }
         if (!empty($values["access"]) && $values["access"] == PERMISSION_GROUP_PUBLIC_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The group password is missing.") . " ";
             $hints .= gettext("You chose to password protect your group. Please provide a password.") . " ";
         }
         if (empty($problems)) {
             $access = $values["access"];
             $waspassword = 0;
             if ($create_new) {
                 // CREATE
                 $akt_access = PERMISSION_GROUP_UNDEFINED;
                 $environment = !empty($values["category"]) ? \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $values["category"]) : FALSE;
                 $new_group = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), $values["name"], $parentgroup, $environment, $values["short_dsc"]);
                 if (!is_object($new_group)) {
                     throw new \Exception("Error creating group with name=" . $values["name"] . " in parent=" . $parentgroup->get_name(), E_PARAMETER);
                     exit;
                 }
                 $group = new \koala_group_default($new_group);
                 $group->add_member(\lms_steam::get_current_user());
             } else {
                 // EDIT
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
             }
             if ($is_public) {
                 // PUBLIC
                 if ($akt_access == PERMISSION_GROUP_PUBLIC_PASSWORD) {
                     $waspassword = 1;
                 }
                 if (!$accessmergel) {
                     $group->set_group_access($access);
                 }
                 if (isset($values) && $waspassword == 1 && isset($values["password"]) && $values["password"] == "******" && $values["access"] == PERMISSION_GROUP_PUBLIC_PASSWORD) {
                     // Do nothing in case of valid password dummy
                 } elseif ($values["access"] != PERMISSION_GROUP_PUBLIC_PASSWORD) {
                     $group->get_steam_group()->set_password("");
                 } else {
                     $group->get_steam_group()->set_password(isset($values["password"]) ? trim($values["password"]) : "");
                 }
                 if ($max_members > -1) {
                     $group->set_attribute(GROUP_MAXSIZE, $max_members);
                 }
             } else {
                 // PRIVATE
                 // Set Group access only, if there is no problem with the access rights
                 // Set group access only for koala groups. Skip this for the steam only groups
                 if (!$accessmergel && ($create_new || $group->get_steam_group()->get_parent_group()->get_id() == STEAM_PRIVATE_GROUP)) {
                     $group->set_group_access(PERMISSION_GROUP_PRIVATE);
                 }
             }
             //echo "*part. '" . $values["privacy_deny_participants"] . "'<br/>"; //TODO
             $newvalues = array(OBJ_DESC => $values["short_dsc"], "OBJ_LONG_DSC" => $values["dsc"], "GROUP_PRIVACY" => $values["privacy_deny_documents"] | $values["privacy_deny_participants"]);
             $group->set_attributes($newvalues);
             if ($group->get_attribute('OBJ_NAME') != $values['name']) {
                 if (!$group->set_name($values['name'])) {
                     $problems .= gettext("A group with this name already exists.") . " ";
                     $hints .= gettext("Please choose another name for your group.") . " ";
                 }
             }
             if ($max_members > -1) {
                 $group->set_attribute(GROUP_MAXSIZE, $max_members);
             }
             // extensions:
             /* TODO: An Dominik! Dieser Code gibt einen Fehler zurück!
             			    if ( isset( $_POST["extensions_available"] ) && !empty( $_POST["extensions_available"] ) ) {
             		      		$extensions_available = explode( "/", $_POST["extensions_available"] );
             		      		if ( isset( $_POST["extensions_enabled"] ) )
             		        		$extensions_enabled = array_keys( $_POST["extensions_enabled"] );
             		      		else
             		        		$extensions_enabled = array();
             
             		        	if ( is_array( $extensions_available ) ) {
             		        		foreach ( $extensions_available as $extension_name ) {
             		          			$extension = \lms_steam::get_extensionmanager()->get_extension( $extension_name );
             		          			if ( !is_object( $extension ) ) continue;
             		          			if ( array_search( $extension_name, $extensions_enabled ) === FALSE )
             		            			$extension->disable_for( $group );
             		          			else
             		            			$extension->enable_for( $group );
             		        		}
             		      		}
             		    	}
             				*/
             if ($create_new) {
                 if ($is_public) {
                     $_SESSION["confirmation"] = str_replace("%CATEGORY", $environment->get_name(), str_replace("%NAME", $values["name"], gettext("The public group '%NAME' has been created in '%CATEGORY'.")));
                 } else {
                     $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("The private group '%NAME' has been created."));
                 }
                 header("Location: " . PATH_URL . "group/view/" . $group->get_steam_group()->get_id() . "/");
                 exit;
             } else {
                 $_SESSION["confirmation"] = gettext("The changes have been saved.");
                 header("Location: " . $_SERVER["REQUEST_URI"]);
                 exit;
             }
         } else {
             $portal->set_problem_description($problems, $hints);
         }
     } else {
         if (!$create_new) {
             // EDIT
             $current_values = $group->get_attributes(array(OBJ_NAME, OBJ_DESC, "OBJ_LONG_DSC", GROUP_MAXSIZE, "GROUP_PRIVACY"));
             //TODO
             // Convert "0" into "" for values which are not set yet
             foreach ($current_values as $key => $value) {
                 if ($value == "0") {
                     $current_values[$key] = "";
                 }
             }
             $values = array("name" => $current_values[OBJ_NAME], "short_dsc" => $current_values[OBJ_DESC], "dsc" => $current_values["OBJ_LONG_DSC"], "maxsize" => $current_values[GROUP_MAXSIZE], "privacy_deny_documents" => $current_values["GROUP_PRIVACY"] & PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS, "privacy_deny_participants" => $current_values["GROUP_PRIVACY"] & PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS);
             //echo "**part. '" . $values["privacy_deny_participants"] . "'<br/>"; //TODO
             //$values["privacy_deny_participants"] = $act_privacy_deny_participants;
             //echo "***part. '" . $values["privacy_deny_participants"] . "'<br/>";
             $ms = $values["maxsize"];
             if ($ms === 0) {
                 $values["maxsize"] = "";
             } else {
                 $values["maxsize"] = $ms;
             }
             $grouptype = $group->get_attribute(OBJ_TYPE);
         } else {
             // CREATE
             $grouptype = "";
             if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["save"])) {
                 $values = $_POST["values"];
             }
         }
     }
     $content = \Group::getInstance()->loadTemplate("groups_edit.template.html");
     if ($create_new) {
         // CREATE
         //TODO: Muss eine grouptype gesetzt sein?
         $content->setVariable("VALUE_GROUPTYPE", isset($_POST["grouptype"]) ? $_POST["grouptype"] : "");
         $infotext = gettext("You are going to create a new group. ");
     } else {
         // EDIT
         $infotext = gettext("You are going to edit information for '<b>%NAME</b>'. ");
         if ($is_public) {
             $infotext .= "<br />" . gettext("'%NAME' is a <b>public group</b>. Feel free to edit the groups description, choose extension modules for your group or change the participant management method.");
         } else {
             $infotext .= "<br />" . gettext("'%NAME' is a <b>private group</b>. Feel free to edit the groups description or choose extension modules for your group. The participant management method for private courses is invite only. Only group moderators can add users to this group.");
         }
         $infotext = str_replace("%NAME", h($values["name"]), $infotext);
     }
     $content->setVariable("INFO_TEXT", $infotext);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     isset($values["name"]) ? $content->setVariable("VALUE_NAME", h($values["name"])) : "";
     $content->setVariable("LABEL_SHORT_DSC", gettext("Short description"));
     isset($values["short_dsc"]) ? $content->setVariable("VALUE_SHORT_DSC", h($values["short_dsc"])) : "";
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     isset($values["dsc"]) ? $content->setVariable("VALUE_LONG_DSC", h($values["dsc"])) : "";
     $content->setVariable("GROUP_SAVE", $submit_text);
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     //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 = \Group::getInstance()->loadTemplate("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:
     /* TODO: an Dominik! 
     		 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 );
     				$content->setVariable( "EXTENSION_NAME", $extension->get_display_name() );
     				$content->setVariable( "EXTENSION_DESC", $extension->get_display_description() );
     				if ( $extension->is_enabled( $group ) )
     					$content->setVariable( "EXTENSION_ENABLED", "checked='checked'" );
     				$content->parse( "BLOCK_EXTENSION" );
     				$extension_list[] = $extension_name;
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}
     		*/
     if ($is_public) {
         // PUBLIC GROUP
         if ($create_new) {
             $privacy_deny_participants_default = PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS;
             //TODO //Voreinstellung?!
             $privacy_deny_documents_default = PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS;
             $values["privacy_deny_participants"] = $privacy_deny_participants_default;
             $values["privacy_deny_documents"] = $privacy_deny_documents_default;
             $content->setCurrentBlock("BLOCK_CATEGORIES");
             $content->setVariable("LABEL_CATEGORIES", gettext("Categories"));
             $content->setVariable("LABEL_PLEASE_CHOOSE", gettext("Please choose"));
             $public = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_PUBLIC_GROUP, CLASS_GROUP);
             $categories = $public->get_workroom()->get_inventory(CLASS_CONTAINER | CLASS_ROOM);
             foreach ($categories as $category) {
                 $content->setCurrentBlock("BLOCK_CATEGORY_DISPLAY");
                 $content->setVariable("CAT_ID", $category->get_id());
                 $content->setVariable("CAT_NAME", h($category->get_name()));
                 $parent = isset($path[1]) ? $path[1] : null;
                 if (!isset($values["category"]) && isset($parent) && $parent == $category->get_id() || isset($values["category"]) && $category->get_id() == $values["category"]) {
                     $content->setVariable("CAT_SELECTED", 'selected="selected"');
                 }
                 $content->parse("BLOCK_CATEGORY_DISPLAY");
             }
             $content->parse("BLOCK_CATEGORIES");
         } else {
             $content->setCurrentBlock("BLOCK_CATEGORY");
             $category = $group->get_steam_group()->get_environment();
             if (is_object($category)) {
                 $catname = $category->get_name();
             } else {
                 $catname = gettext("Miscellaneous");
             }
             $content->setVariable("LABEL_CATEGORY", gettext("Category"));
             $content->setVariable("VALUE_CATEGORY", $catname . "<br/><small>(" . gettext("The category cannot be changed") . ")</small>");
             $content->parse("BLOCK_CATEGORY");
         }
         // MAXSIZE
         $content->setCurrentBlock("BLOCK_MAXSIZE");
         $content->setVariable("LABEL_MAXSIZE", gettext("Max number of participants"));
         $content->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."));
         $content->setVariable("VALUE_MAXSIZE", isset($values["maxsize"]) ? h($values["maxsize"]) : "");
         $content->parse("BLOCK_MAXSIZE");
         // PARTICIPANT MANAGEMENT
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         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 participant management settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
             $content->parse("BLOCK_ACCESSMERGEL");
         } else {
             $waspassword = 0;
             $access = \koala_group_default::get_group_access_descriptions();
             if (isset($values) && isset($values["access"])) {
                 $akt_access = $values["access"];
             } else {
                 if ($create_new) {
                     // CREATE
                     $akt_access = PERMISSION_GROUP_PUBLIC_FREEENTRY;
                 } else {
                     // EDIT
                     $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                     if ($akt_access == PERMISSION_GROUP_PUBLIC_PASSWORD) {
                         $waspassword = 1;
                     }
                 }
             }
             if (is_array($access)) {
                 $content->setVariable("WASPASSWORD", $waspassword);
                 foreach ($access as $key => $array) {
                     if (($key != PERMISSION_GROUP_UNDEFINED || $akt_access == PERMISSION_GROUP_UNDEFINED) && $key != PERMISSION_GROUP_PRIVATE) {
                         $content->setCurrentBlock("ACCESS");
                         $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                         $content->setVariable("VALUE", $key);
                         if ($key == $akt_access) {
                             $content->setVariable("CHECK", "checked=\"checked\"");
                         }
                         if ($key == PERMISSION_GROUP_PUBLIC_PASSWORD) {
                             $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='block'\"");
                             $content->setCurrentBlock("ACCESS_PASSWORD");
                             $content->setVariable("LABEL_PASSWORD", gettext("Password"));
                             if (!empty($values["password"])) {
                                 $content->setVariable("VALUE_PASSWORD", $values["password"]);
                             } else {
                                 if ($waspassword == 1) {
                                     $content->setVariable("VALUE_PASSWORD", "******");
                                 }
                             }
                             if ($akt_access == PERMISSION_GROUP_PUBLIC_PASSWORD) {
                                 $content->setVariable("PASSWORDDIV_DISPLAY", "block");
                             } else {
                                 $content->setVariable("PASSWORDDIV_DISPLAY", "none");
                             }
                             $content->parse("ACCESS_PASSWORD");
                         } else {
                             $content->setVariable("ONCHANGE", "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
                         }
                         $content->parse("ACCESS");
                     }
                 }
             }
         }
         // PARTICIPANT AND DOCUMENT PRIVACY //TODO
         //$values[ "privacy_deny_participants" ] = PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS; //voreingestellt//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;
         //$values[ "privacy_deny_participants" ] = $privacy_deny_participants_default;
         $content->setCurrentBlock("BLOCK_PRIVACY");
         $content->setVariable("LABEL_PRIVACY", gettext("Privacy"));
         $content->setVariable("LABEL_PRIVACY_DSC", gettext("Set the privacy of participants and documents."));
         $content->setVariable("LABEL_PRIVACY_DENY_PARTICIPANTS", gettext("Hide participants"));
         $content->setVariable("LABEL_PRIVACY_DENY_DOCUMENTS", gettext("Hide documents"));
         $content->setVariable("VALUE_PRIVACY_DENY_PARTICIPANTS", PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS);
         $content->setVariable("VALUE_PRIVACY_DENY_DOCUMENTS", PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS);
         //echo "****part. '" . $values["privacy_deny_participants"] . "'<br/>"; //todo
         if (isset($values) && isset($values["privacy_deny_participants"])) {
             $privacy_deny_participants = $values["privacy_deny_participants"];
         }
         if (isset($values) && isset($values["privacy_deny_documents"])) {
             $privacy_deny_documents = $values["privacy_deny_documents"];
         }
         //if (isset($values) && isset($values["privacy_deny_participants"])) $privacy_deny_participants = PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS;
         //if ((isset($values) && $key == (int)$values[ "privacy_deny_participants" ]) || (empty($values) && $key == $privacy_deny_participants_default)) {
         if (isset($values) && $values["privacy_deny_participants"] == PERMISSION_GROUP_PRIVACY_DENY_PARTICIPANTS) {
             $content->setVariable("CHECK1", "checked=\"checked\"");
         }
         //if ((isset($values) && $key == (int)$values[ "privacy_deny_documents" ]) || (empty($values) && $key == $privacy_deny_documents_default)) {
         if (isset($values) && $values["privacy_deny_documents"] == PERMISSION_GROUP_PRIVACY_DENY_DOCUMENTS) {
             $content->setVariable("CHECK2", "checked=\"checked\"");
         }
         $content->parse("BLOCK_PRIVACY");
         //echo "*****part. '" . $values["privacy_deny_participants"] . "'"; //TODO
     } else {
         // PRIVATE GROUP
         if ($create_new || $group->get_steam_group()->get_parent_group()->get_id() == STEAM_PRIVATE_GROUP) {
             // Display the participant management access block only for koala groups
             // The participant management select box wont be displayed for steam only groups
             $content->setCurrentBlock("BLOCK_ACCESS");
             $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
             if (!$create_new) {
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
             } else {
                 $akt_access = PERMISSION_GROUP_PRIVATE;
             }
             $access = \oala_group_default::get_group_access_descriptions();
             $content->setCurrentBlock("ACCESS");
             if ($akt_access != PERMISSION_GROUP_PRIVATE) {
                 if ($accessmergel) {
                     $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
                     $content->setVariable("ACCESS_TEXT", 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 saving the properties one time.")));
                 } else {
                     $content->setVariable("ACCESS_TEXT", "A Problem with the access rights was detected. Please save the permissions one time to fix this issue.");
                 }
             } else {
                 $content->setVariable("ACCESS_TEXT", $access[PERMISSION_GROUP_PRIVATE]["label"]);
             }
             $content->parse("ACCESS");
             $content->parse("BLOCK_ACCESS");
         }
     }
     if ($create_new) {
         // CREATE
         if ($is_public) {
             $headertext = gettext("Create public group");
         } else {
             $headertext = gettext("Create private group");
         }
         $headernavi = array(array("link" => PATH_URL . "user/" . $user->get_name() . "/groups/", "name" => gettext("Your groups")), array("link" => $backlink, "name" => gettext("Create Group")), array("link" => "", "name" => $headertext));
     } else {
         // EDIT
         $headernavi = array(array("link" => $backlink, "name" => h($group->get_name())), array("link" => "", "name" => gettext("Preferences")));
     }
     /* TODO: Portal
     		$portal->set_page_main(
     			$headernavi,
     			$content->get()
     		);
     		$portal->show_html();
     				*/
     $frameResponseObject->setTitle("Group edit");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Example #16
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $user = \lms_steam::get_current_user();
     // Disable caching
     // TODO: Work on cache handling. An enabled cache leads to bugs
     // if used with the wiki.
     \CacheSettings::disable_caching();
     if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
         include "bad_link.php";
         exit;
     }
     if (!$wiki_container instanceof \steam_container) {
         $wiki_doc = $wiki_container;
         $wiki_container = $wiki_doc->get_environment();
         if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
             include "bad_link.php";
             exit;
         }
     }
     //CODE FOR ALL COMMANDS OF THIS PAKAGE END
     $wiki_html_handler = new \lms_wiki($wiki_container);
     $wiki_html_handler->set_admin_menu("mediathek", $wiki_container);
     $content = \Wiki::getInstance()->loadTemplate("wiki_mediathek.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_mediathek.template.html" );
     // get images
     $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) {
             $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 . "download/image/" . $image->get_id() . "/" . $newWidth . "/" . $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/index/" . $wiki_container->get_id() . "/");
     $content->setVariable("BACK_LABEL", gettext("back"));
     $wiki_html_handler->set_main_html($content->get());
     // breadcrumbs
     $rootlink = \lms_steam::get_link_to_root($wiki_container);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => gettext("Mediathek"))));
     /*$portal->set_page_main(
     		$headline,
     		$wiki_html_handler->get_html()
     		);
     		$portal->show_html();
     		*/
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($wiki_html_handler->get_html());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Example #17
0
        <P>&nbsp;</P>
        <?php 
include "../../etc/koala.def.php";
include "../../classes/PHPsTeam/steam_connector.class.php";
$aktsem = isset($_GET["semester"]) ? $_GET["semester"] : STEAM_CURRENT_SEMESTER;
$connector = new steam_connector(STEAM_SERVER, STEAM_PORT, STEAM_ROOT_LOGIN, STEAM_ROOT_PW);
$GLOBALS["STEAM"] = $connector;
$scg = steam_factory::get_object($connector->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
$scg = steam_factory::get_object($connector->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
$semname = $scg->get_groupname() . "." . $aktsem;
$semester = steam_factory::groupname_to_object($connector->get_id(), $semname);
if (!is_object($semester)) {
    die("Cannot find Group " . $scg->get_groupname() . "." . $aktsem . " for semester " . $aktsem);
}
$courses = $semester->get_subgroups();
steam_factory::load_attributes($connector->get_id(), $courses, array(OBJ_DESC, OBJ_NAME, "COURSE_UNITS_ENABLED"));
echo "Listing all Courses for Semester " . $aktsem . " (" . $semname . ")";
echo "<table><tr><td>Kurs</td><td>COURSE_UNITS_ENABLED</td><td>UNITS_DOCPOOL_ENABLED</td><td>Konvertiert</td></tr><tr>";
foreach ($courses as $course) {
    if (is_object($course)) {
        echo "<tr><td>" . $course->get_name() . " (" . $course->get_attribute(OBJ_DESC) . ")</td><td>" . $course->get_attribute("COURSE_UNITS_ENABLED") . "</td><td>" . $course->get_attribute("UNITS_DOCPOOL_ENABLED") . "</td><td>";
        if ($course->get_attribute("COURSE_UNITS_ENABLED") === "TRUE" && $course->get_attribute("UNITS_DOCPOOL_ENABLED") !== "TRUE") {
            if (isset($_GET["write"]) && $_GET["write"] == "true") {
                //$course->set_attribute("COURSE_UNITS_ENABLED", "TRUE");
                $course->set_attribute("UNITS_DOCPOOL_ENABLED", "TRUE");
            }
            echo "TRUE";
        }
        echo "</td></tr>";
    }
}
Example #18
0
    public function execute(\FrameResponseObject $frameResponseObject)
    {
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        $user = \lms_steam::get_current_user();
        // Disable caching
        // TODO: Work on cache handling. An enabled cache leads to bugs
        // if used with the wiki.
        \CacheSettings::disable_caching();
        if (!($wiki_container = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id))) {
            include "bad_link.php";
            exit;
        }
        if (!$wiki_container instanceof \steam_container) {
            $wiki_doc = $wiki_container;
            $wiki_container = $wiki_doc->get_environment();
            if ($wiki_doc->get_attribute(DOC_MIME_TYPE) != "text/wiki") {
                include "bad_link.php";
                exit;
            }
        }
        //CODE FOR ALL COMMANDS OF THIS PAKAGE END
        defined("OBJ_ID") or define("OBJ_ID", $wiki_container->get_id());
        $content = \Wiki::getInstance()->loadTemplate("wiki_edit.template.html");
        //$content = new HTML_TEMPLATE_IT();
        //$content->loadTemplateFile( PATH_TEMPLATES . "wiki_edit.template.html" );
        $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
        foreach ($wiki_entries as $wiki_entry) {
            if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                $name = $wiki_entry->get_name();
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_OPTION");
                $content->setVariable("WIKI_ENTRY_OPTION", "<option value=\"{$name}\">{$name}</option>");
                $content->parse("BLOCK_WIKI_ENTRY_OPTION");
            }
        }
        $problems = "";
        if (!isset($create)) {
            $create = FALSE;
        }
        if ($_SERVER["REQUEST_METHOD"] == "POST") {
            $values = $_POST["values"];
            if (get_magic_quotes_gpc()) {
                if (!empty($values['title'])) {
                    $values['title'] = stripslashes($values['title']);
                }
                if (!empty($values['body'])) {
                    $values['body'] = stripslashes($values['body']);
                }
            }
            if (empty($values["title"])) {
                $problems = gettext("Please enter a subject for your message.");
            }
            if (empty($values["body"])) {
                $problems .= empty($problems) ? gettext("Please enter your message.") : "<br>" . gettext("Please enter your message.");
            }
            if (strpos($values["title"], "/")) {
                if (!isset($problems)) {
                    $problems = "";
                }
                $problems .= gettext("Please don't use the \"/\"-char in the subject of your post.");
            }
            if (empty($problems)) {
                $wiki_content = str_replace("@", "&#64;", $values["body"]);
                if (!empty($values['save'])) {
                    if ($create) {
                        $wiki_doc = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), $values["title"] . ".wiki", $wiki_content, "text/wiki", $wiki_container, "");
                    } else {
                        // PRUEFEN, OB ALLES OK, DANN NEUE WERTE SPEICHERN
                        $wiki_doc->set_name($values['title'] . ".wiki");
                        $wiki_doc->set_content($wiki_content);
                    }
                    // Clean cache for wiki_entries
                    $cache = get_cache_function($wiki_container->get_id(), 600);
                    $cache->clean($wiki_container->get_id());
                    // clean rsscache
                    $rcache = get_cache_function("rss", 600);
                    $feedlink = PATH_URL . "services/feeds/wiki_public.php?id=" . $wiki_container->get_id();
                    $rcache->drop("lms_rss::get_items", $feedlink);
                    header("Location: " . PATH_URL . "wiki/editentry/" . $wiki_doc->get_id() . "/");
                    exit;
                } else {
                    // PREVIEW
                    $content->setCurrentBlock("BLOCK_PREVIEW");
                    $content->setVariable("LABEL_PREVIEW_EDIT", gettext("Preview the description"));
                    $content->setVariable("PREVIEW_EDIT", get_formatted_output($values["desc"]));
                    $content->parse("BLOCK_PREVIEW");
                    $headline = gettext("Change it?");
                    $content->setVariable("TEXT_DSC", h($values["desc"]));
                    $content->setVariable("TITLE_COMMENT", h($values["title"]));
                }
            } else {
                $frameResponseObject->setProblemDescription($problems);
                //$portal->set_problem_description( $problems );
            }
        }
        if (empty($values)) {
            $wikicontent = "";
            $wikiname = "";
            if (!$create) {
                $wikicontent = $wiki_doc->get_content();
                $wikicontent = str_replace("&#64;", "@", $wikicontent);
                $wikiname = $wiki_doc->get_name();
            }
            if (WIKI_WYSIWYG) {
                //TODO
                $content->setVariable("TEXT_DSC", h($wikicontent));
                //$content->setVariable( "TEXT_DSC", wikitext_to_html( h($wikicontent), $wiki_container->get_id() ) );
                //$content->setVariable( "NIC_SCRIPT", PATH_JAVASCRIPT . "niceditor/nicEdit.js");
            } else {
                $content->setVariable("TEXT_DSC", h($wikicontent));
            }
            $content->setVariable("TITLE_COMMENT", str_replace(".wiki", "", h($wikiname)));
            $content->setVariable("BACK_LINK", $_SERVER["HTTP_REFERER"]);
        } else {
            $content->setVariable("TITLE_COMMENT", h($values["title"]));
            if (isset($values["body"])) {
                $content->setVariable("TEXT_DSC", h($values["body"]));
            }
        }
        $content->setVariable("LABEL_HERE_IT_IS", "");
        $content->setVariable("LABEL_TITLE", gettext("Title"));
        $content->setVariable("LABEL_BODY", gettext("Body"));
        //$content->setVariable( "LABEL_WIKI_H2", gettext( "H2" ) );
        //$content->setVariable( "HINT_WIKI_H2", gettext( "heading (level 2)" ) );
        //$content->setVariable( "LABEL_WIKI_H3", gettext( "H3" ) );
        //$content->setVariable( "HINT_WIKI_H3", gettext( "heading (level 3)" ) );
        //$content->setVariable( "LABEL_WIKI_BOLD", gettext( "'''B'''" ) );
        //$content->setVariable( "HINT_WIKI_BOLD", gettext( "boldface" ) );
        //$content->setVariable( "LABEL_WIKI_ITALIC", gettext( "''I''" ) );
        //$content->setVariable( "HINT_WIKI_ITALIC", gettext( "italic" ) );
        //$content->setVariable( "LABEL_WIKI_BULLET_LIST", gettext( "* list" ) );
        //$content->setVariable( "HINT_WIKI_BULLET_LIST", gettext( "bullet list" ) );
        //$content->setVariable( "LABEL_WIKI_NUMBERED_LIST", gettext( "# list" ) );
        //$content->setVariable( "HINT_WIKI_NUMBERED_LIST", gettext( "numbered list" ) );
        //$content->setVariable( "LABEL_WIKI_LINE", gettext( "-----" ) );
        //$content->setVariable( "HINT_WIKI_LINE", gettext( "horizontal line" ) );
        //$content->setVariable( "LABEL_WIKI_LINK", gettext( "[[wiki]]" ) );
        //$content->setVariable( "HINT_WIKI_LINK", gettext( "wiki link" ) );
        //$content->setVariable( "LABEL_WIKI_URL", gettext( "[URL]" ) );
        //$content->setVariable( "HINT_WIKI_URL", gettext( "web link" ) );
        //$content->setVariable( "LABEL_WIKI_IMAGE", gettext( "IMG" ) );
        //$content->setVariable( "HINT_WIKI_IMAGE", gettext( "image" ) );
        $content->setVariable("LABEL_PREVIEW", gettext("Preview"));
        $content->setVariable("LABEL_SAVE_CHANGES", gettext("Save changes"));
        $content->setVariable("LABEL_RETURN", gettext("back"));
        $content->setVariable("JS_NOTICE", '"' . gettext("Warning!\\nYou have edited your entry!\\nIf you proceed, all changes will be lost!\\nDo you really want to proceed?") . '"');
        // widget: Images
        //$widget = new HTML_TEMPLATE_IT();
        //$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;
                }
            }
            if (empty($images)) {
                $content->setCurrentBlock("BLOCK_WIKI_ENTRY_NOIMAGE");
                $content->setVariable("WIKI_ENTRY_NOIMAGE", "Es befinden sich keine Bilder in der Mediathek.");
                $content->parse("BLOCK_WIKI_ENTRY_NOIMAGE");
            } else {
                $i = 0;
                foreach ($images as $image) {
                    $path = PATH_URL . "download/image/" . $image->get_id() . "/40/80/";
                    $content->setCurrentBlock("BLOCK_WIKI_ENTRY_IMAGE");
                    $content->setVariable("WIKI_ENTRY_IMAGE", <<<END
<table style="float:left">
\t<tr>
\t\t<td>
\t\t\t<input id="image{$i}" type="radio" name="images" value="{$image->get_name()}"/>
\t\t</td>
\t\t<td>
\t\t\t<img src="{$path}" title="{$image->get_name()}">
\t\t</td>
\t</tr>
</table>  \t
END
);
                    $content->parse("BLOCK_WIKI_ENTRY_IMAGE");
                    $i++;
                    //$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_LINK", PATH_URL . "get_document.php?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"));
        //$widget->setVariable("WIKI_IMAGE_EXTERNAL_LINK", "javascript:insert('[[Image:http://', ']]', 'formular', 'values[body]')");
        //$content->setCurrentBlock("BLOCK_WIDGET");
        //$content->setVariable("WIDGET_TITLE", gettext("Images"));
        //$content->setVariable("WIDGET_HTML_CODE", $widget->get());
        //$content->parse("BLOCK_WIDGET");
        if ($create) {
            $pagetitle = gettext("New Article");
        } else {
            $pagetitle = str_replace("%NAME", h(substr($wiki_doc->get_name(), 0, -5)), gettext("Edit '%NAME'?"));
        }
        $rootlink = \lms_steam::get_link_to_root($wiki_container);
        WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")), array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)) : ($headline = array(array("name" => h($wiki_container->get_name()), "link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/"), array("link" => "", "name" => $pagetitle)));
        /*$portal->set_page_main(
        		$headline,
        		$content->get()
        		);
        		$portal->show_html();
        		*/
        $frameResponseObject->setHeadline($headline);
        $rawHtml = new \Widgets\RawHtml();
        $rawHtml->setHtml($content->get());
        $frameResponseObject->addWidget($rawHtml);
        return $frameResponseObject;
    }
Example #19
0
<?php

$weblog_html_handler = new lms_weblog($weblog);
$weblog_html_handler->set_menu("entries");
$grp = $weblog->get_environment()->get_creator();
steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), array($grp), array(OBJ_NAME, OBJ_TYPE));
if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
    $grp = $grp->get_parent_group();
}
$weblog_html_handler->set_widget_categories();
$all_date_objects = $weblog->get_date_objects();
usort($all_date_objects, "sort_dates");
//sort_dates defined in steam_calendar.class
$weblog_html_handler->set_widget_archive(5);
$weblog_html_handler->set_widget_blogroll();
$weblog_html_handler->set_widget_access($grp);
if (isset($_GET["action"]) && $_GET["action"] == "bookmark_rss") {
    lms_steam::user_add_rssfeed($weblog->get_id(), PATH_URL . "services/feeds/weblog_public.php?id=" . $weblog->get_id(), "weblog", lms_steam::get_link_to_root($weblog));
    $_SESSION["confirmation"] = str_replace("%NAME", h($weblog->get_name()), gettext("You are keeping an eye on '%NAME' from now on."));
    header("Location: " . PATH_URL . "weblog/" . $weblog->get_id() . "/");
    exit;
}
if (isset($_GET["action"]) && $_GET["action"] == "delete_bookmark") {
    $user = lms_steam::get_current_user();
    $id = (int) $_GET["unsubscribe"];
    $feeds = $user->get_attribute("USER_RSS_FEEDS");
    if (!is_array($feeds)) {
        $feeds = array();
    }
    unset($feeds[$id]);
    $user->set_attribute("USER_RSS_FEEDS", $feeds);
Example #20
0
<?php

$wiki_html_handler = new lms_wiki($wiki_container);
$wiki_html_handler->set_admin_menu("mediathek", $wiki_container);
$content = new HTML_TEMPLATE_IT();
$content->loadTemplateFile(PATH_TEMPLATES . "wiki_mediathek.template.html");
// get images
$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) {
        $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;
        }
Example #21
0
 /**
  * Returns the user's subscribed news feeds.
  *
  * @param int $offset (optional) offset in the feeds (for pagination)
  * @param int $length (optional) number of items to return (e.g. for pagination)
  * @param boolean $return_pagination_info (optional) if TRUE, then an array('feeds'=>array(...),'total'=>nr,'start'=>nr,'page'=>nr,'length'=>nr) is returned instead of just a result array.
  * @return array of feeds, where each feed is an array('type','title','name','url','author','date','obj','feed_obj') with the corresponding values, or a mapping with pagination info if $return_pagination_info was TRUE
  */
 public static function get_news_feeds_static($offset = 0, $length = 0, $return_pagination_info = FALSE, $user = FALSE)
 {
     if (!is_object($user)) {
         throw new Exception("No valid steam_user provided", E_PARAMETER);
     }
     $rss_feeds = $user->get_attribute('USER_RSS_FEEDS');
     if (!is_array($rss_feeds) || count($rss_feeds) < 1) {
         if ($return_pagination_info) {
             return array('objects' => array(), 'total' => 0, 'start' => 0, 'length' => 0, 'page' => 0);
         } else {
             return array();
         }
     }
     $feeds = array();
     $feedobjects = array();
     foreach ($rss_feeds as $obj_id => $rss_feed) {
         try {
             $obj = steam_factory::get_object($GLOBALS['STEAM']->get_id(), $obj_id);
         } catch (Exception $e) {
             continue;
         }
         $feedobjects[$obj_id] = $obj;
     }
     // Check for Read-Access
     $read_tnr = array();
     foreach ($feedobjects as $object) {
         $read_tnr[$object->get_id()] = $object->check_access_read($user, TRUE);
     }
     $read_result = $GLOBALS["STEAM"]->buffer_flush();
     foreach ($rss_feeds as $obj_id => $rss_feed) {
         $obj = $feedobjects[$obj_id];
         if (!is_object($obj)) {
             continue;
         }
         if (!$read_result[$read_tnr[$obj_id]]) {
             continue;
         }
         $feed = array('obj' => $obj, 'feed_obj' => $obj);
         foreach ($rss_feed as $key => $value) {
             $feed[$key] = $value;
         }
         if ($feed['type'] === 'weblog') {
             $dates = $obj->get_date_objects();
             if (!is_array($dates)) {
                 $dates = array();
             }
             $feed['items'] = $dates;
         }
         $feeds[] = $feed;
     }
     $nr_feeds = count($feeds);
     for ($i = 0; $i < $nr_feeds; $i++) {
         $obj = $feeds[$i]['obj'];
         switch ($feeds[$i]['type']) {
             case 'weblog':
                 $feeds[$i]['weblog_items'] = array();
                 foreach ($feeds[$i]['items'] as $date) {
                     $feeds[$i]['weblog_items'][] = $date->get_annotations_filtered(array(array('+', 'class', CLASS_OBJECT)), array(array('>', 'attribute', array('DOC_LAST_MODIFIED', 'OBJ_CREATION_TIME'))), 0, 0, 0, TRUE);
                 }
                 break;
             default:
                 $feeds[$i]['items'] = $obj->get_annotations_filtered(array(array('+', 'class', CLASS_OBJECT)), array(array('>', 'attribute', array('DOC_LAST_MODIFIED', 'OBJ_CREATION_TIME'))), 0, 0, 0, TRUE);
                 break;
         }
     }
     $results = $GLOBALS['STEAM']->buffer_flush();
     // get all feed items:
     $item_to_feed = array();
     $items = array();
     for ($i = 0; $i < $nr_feeds; $i++) {
         switch ($feeds[$i]['type']) {
             case 'weblog':
                 $weblog_items = $feeds[$i]['weblog_items'];
                 unset($feeds[$i]['weblog_items']);
                 for ($j = 0; $j < count($weblog_items); $j++) {
                     $feed = array();
                     foreach ($feeds[$i] as $key => $value) {
                         $feed[$key] = $value;
                     }
                     $feed['feed_obj'] = $feeds[$i]['items'][$j];
                     $feed['items'] = $results[$weblog_items[$j]];
                     $feeds[] = $feed;
                 }
                 //$feeds[$i]['items'] = array_merge( $feeds[$i]['items'], $weblog_items );
                 break;
             default:
                 $feeds[$i]['items'] = $results[$feeds[$i]['items']];
                 break;
         }
     }
     $nr_feeds = count($feeds);
     for ($i = 0; $i < $nr_feeds; $i++) {
         foreach ($feeds[$i]['items'] as $item) {
             $item_to_feed[$item->get_id()] = $feeds[$i];
             $items[] = $item;
         }
     }
     // sort all items and limit them to length and offset:
     $pagination_info = $GLOBALS['STEAM']->predefined_command($GLOBALS['STEAM']->get_module('searching'), 'paginate_object_array', array($items, FALSE, array(array('>', 'attribute', array('DOC_LAST_MODIFIED', 'OBJ_CREATION_TIME'))), $offset, $length), FALSE);
     $items = $pagination_info['objects'];
     $data = array();
     // fetch additional information for the result set:
     foreach ($items as $item) {
         $item_data = array();
         switch ($item_to_feed[$item->get_id()]['type']) {
             case 'weblog':
                 $item_data['attributes'] = $item->get_attributes(array('DATE_TITLE', DOC_LAST_MODIFIED, DOC_USER_MODIFIED, OBJ_CREATION_TIME), TRUE);
                 $item_data['creator'] = $item->get_creator(TRUE);
                 break;
             case 'discussion board':
                 $item_data['attributes'] = $item->get_attributes(array(OBJ_NAME, DOC_LAST_MODIFIED, DOC_USER_MODIFIED, OBJ_CREATION_TIME), TRUE);
                 $item_data['creator'] = $item->get_creator(TRUE);
                 $item_data['annotating'] = $item->get_annotating(TRUE);
                 break;
             case 'document':
                 $item_data['attributes'] = $item->get_attributes(array(DOC_LAST_MODIFIED, DOC_USER_MODIFIED, OBJ_CREATION_TIME), TRUE);
                 $item_data['creator'] = $item->get_creator(TRUE);
                 break;
         }
         $data[$item->get_id()] = $item_data;
     }
     $results = $GLOBALS['STEAM']->buffer_flush();
     // return results:
     $feeds = array();
     $authors = array();
     foreach ($items as $item) {
         $feed = array();
         foreach ($item_to_feed[$item->get_id()] as $key => $value) {
             $feed[$key] = $value;
         }
         $item_data = $data[$item->get_id()];
         $attributes = $results[$item_data['attributes']];
         switch ($feed['type']) {
             case 'weblog':
                 $feed['url'] = PATH_URL . 'weblog/' . $feed['feed_obj']->get_id() . '/';
                 $title = $attributes['DATE_TITLE'];
                 if (!is_string($title)) {
                     $title = $feed['feed_obj']->get_attribute('DATE_TITLE');
                 }
                 $feed['title'] = $title;
                 break;
             case 'discussion board':
                 $annotating = $results[$item_data['annotating']];
                 // item is a discussion thread:
                 if (is_object($annotating) && $annotating->get_id() == $feed['feed_obj']->get_id()) {
                     $feed['url'] = PATH_URL . 'forums/' . $item->get_id() . '/';
                 } else {
                     $feed['url'] = PATH_URL . 'forums/' . $annotating->get_id() . '/';
                 }
                 $feed['title'] = $attributes[OBJ_NAME];
                 break;
             case 'document':
                 $feed['url'] = PATH_URL . 'doc/' . $feed['obj']->get_id() . '/';
                 $feed['title'] = $feed['obj']->get_name();
                 break;
         }
         if ($feed['feed_obj']->get_id() != $item->get_id()) {
             $feed['url'] .= '#comment' . $item->get_id();
         }
         $feed['obj'] = $item;
         $feed['date'] = $attributes[DOC_LAST_MODIFIED];
         if ($feed['date'] == 0) {
             $feed['date'] = $attributes[OBJ_CREATION_TIME];
         }
         $feed['author'] = $attributes[DOC_USER_MODIFIED];
         if (!is_object($feed['author'])) {
             $feed['author'] = $results[$item_data['creator']];
         }
         $authors[] = $feed['author'];
         $url = $feed['url'];
         if ($feed['feed_obj']->get_id() != $item->get_id()) {
             $url .= '#comment' . $item->get_id();
         }
         $feeds[] = $feed;
     }
     // Pre-Load Author-Data
     steam_factory::load_attributes($GLOBALS["STEAM"]->get_id(), $authors, array(USER_FIRSTNAME, USER_FULLNAME));
     if ($return_pagination_info) {
         $pagination_info['feeds'] = $feeds;
         return $pagination_info;
     } else {
         return $feeds;
     }
 }