function p404_redirect()
{
    if (is_404()) {
        $options = get_my_options();
        $link = get_current_URL();
        if ($link == $options['p404_redirect_to']) {
            echo "<b>All 404 Redirect to Homepage</b> has detected that the target URL is invalid, this will cause an infinite loop redirection, please go to the plugin settings and correct the traget link! ";
            exit;
        }
        if ($options['p404_status'] == '1' & $options['p404_redirect_to'] != '') {
            header('HTTP/1.1 301 Moved Permanently');
            header("Location: " . $options['p404_redirect_to']);
            exit;
        }
    }
}
Exemple #2
0
    // 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 = koala_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");
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $portal = \lms_portal::get_instance();
     if (!isset($messageboard) || !is_object($messageboard)) {
         if (empty($this->params[0])) {
             throw new \Exception("Environment not set.");
         }
         if (empty($this->params[1])) {
             throw new \Exception("Group not set.");
         }
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]))) {
             throw new \Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[1]))) {
             throw new \Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($messageboard) && is_object($messageboard)) {
         $creator = $messageboard->get_creator();
         if ($messageboard->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     // TODO: Passt der link?
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new message board is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the the forum name.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($messageboard) || !is_object($messageboard)) {
                 $new_forum = \steam_factory::create_messageboard($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New forum '%NAME' created."));
             } else {
                 $messageboard->set_attribute(OBJ_NAME, $values["name"]);
                 $messageboard->set_attribute(OBJ_DESC, $values["dsc"]);
                 $portal->set_confirmation(gettext("The changes have been saved."));
                 $new_forum = $messageboard;
             }
             $koala_forum = new \lms_forum($new_forum);
             $access = (int) $values["access"];
             $access_descriptions = \lms_forum::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_forum->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_MESSAGEBOARD, array("FORUM_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($messageboard) || !is_object($messageboard)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $portal->set_problem_description($problems, isset($hints) ? $hints : "");
         }
     }
     $content = \Messageboard::getInstance()->loadTemplate("object_new.template.html");
     if (isset($messageboard) && is_object($messageboard)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($messageboard->get_name()), gettext("You are going to edit the forum '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $messageboard->get_name();
             $values["dsc"] = $messageboard->get_attribute(OBJ_DESC);
             $values["access"] = $messageboard->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new forum in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create forum"));
         $pagetitle = gettext("Create forum");
         $breadcrumbheader = gettext("Add new forum");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_BB_BOLD", gettext("B"));
     $content->setVariable("HINT_BB_BOLD", gettext("boldface"));
     $content->setVariable("LABEL_BB_ITALIC", gettext("I"));
     $content->setVariable("HINT_BB_ITALIC", gettext("italic"));
     $content->setVariable("LABEL_BB_UNDERLINE", gettext("U"));
     $content->setVariable("HINT_BB_UNDERLINE", gettext("underline"));
     $content->setVariable("LABEL_BB_STRIKETHROUGH", gettext("S"));
     $content->setVariable("HINT_BB_STRIKETHROUGH", gettext("strikethrough"));
     $content->setVariable("LABEL_BB_IMAGE", gettext("IMG"));
     $content->setVariable("HINT_BB_IMAGE", gettext("image"));
     $content->setVariable("LABEL_BB_URL", gettext("URL"));
     $content->setVariable("HINT_BB_URL", gettext("web link"));
     $content->setVariable("LABEL_BB_MAIL", gettext("MAIL"));
     $content->setVariable("HINT_BB_MAIL", gettext("email link"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
         $access_default = PERMISSION_PUBLIC;
     } else {
         $access_default = PERMISSION_PUBLIC;
     }
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_forum::get_access_descriptions($grp);
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     // TODO: Passt der link?
     $rootlink = \lms_steam::get_link_to_root($grp);
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($messageboard) && is_object($messageboard)) {
         $headline[] = array("link" => PATH_URL . "forums/" . $messageboard->get_id() . "/", "name" => $messageboard->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle("Messageboard");
     $rawHtml = new \Widgets\RawHtml();
     $rawHtml->setHtml($content->get());
     $frameResponseObject->addWidget($rawHtml);
     return $frameResponseObject;
 }
Exemple #4
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //CODE FOR ALL COMMANDS OF THIS PACKAGE START
     $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 PACKAGE END
     $env = $wiki_container->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     if (!isset($wiki_container) || !is_object($wiki_container)) {
         if (!($env = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["env"]))) {
             throw new Exception("Environment unknown.");
         }
         if (!($grp = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $_GET["group"]))) {
             throw new Exception("Group unknown");
         }
     }
     $accessmergel = FALSE;
     if (isset($wiki_container) && is_object($wiki_container)) {
         $creator = $wiki_container->get_creator();
         if ($wiki_container->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(\lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of new wiki is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the wiki.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 $new_wiki = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $env, $values["dsc"]);
                 $new_wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
                 $_SESSION["confirmation"] = str_replace("%NAME", $values["name"], gettext("New wiki '%NAME' created."));
             } else {
                 $wiki_container->set_attribute(OBJ_NAME, $values["name"]);
                 if ($values["wiki_startpage"] == gettext("Glossary")) {
                     $values["wiki_startpage"] = "glossary";
                 }
                 $wiki_container->set_attribute("OBJ_WIKI_STARTPAGE", $values["wiki_startpage"]);
                 $wiki_container->set_attribute(OBJ_DESC, $values["dsc"]);
                 //$portal->set_confirmation(gettext( "The changes have been saved." ));
                 $new_wiki = $wiki_container;
             }
             $koala_wiki = new \lms_wiki($new_wiki);
             $access = (int) $values["access"];
             $access_descriptions = \lms_wiki::get_access_descriptions($grp);
             if (!$accessmergel) {
                 $koala_wiki->set_access($access, $access_descriptions[$access]["members"], $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins);
             }
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name());
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CONTAINER, array("OBJ_TYPE", "WIKI_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($wiki_container) || !is_object($wiki_container)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             $frameResponseObject->setProblemDescription($problems);
             $frameResponseObject->setProblemSolution(isset($hints) ? $hints : "");
         }
     }
     $content = \Wiki::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($wiki_container) && is_object($wiki_container)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($wiki_container->get_name()), gettext("You are going to edit the wiki '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $wiki_container->get_name();
             $values["dsc"] = $wiki_container->get_attribute(OBJ_DESC);
             $values["wiki_startpage"] = $wiki_container->get_attribute("OBJ_WIKI_STARTPAGE");
             $values["access"] = $wiki_container->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $wiki_entries = $wiki_container->get_inventory(CLASS_DOCUMENT);
         $wiki_entries_sorted = array();
         foreach ($wiki_entries as $wiki_entry) {
             if ($wiki_entry->get_attribute(DOC_MIME_TYPE) === "text/wiki") {
                 $wiki_entries_sorted[] = str_replace(".wiki", "", $wiki_entry->get_name());
             }
         }
         sort($wiki_entries_sorted);
         $startpageFound = false;
         foreach ($wiki_entries_sorted as $wiki_entry) {
             $content->setCurrentBlock("BLOCK_WIKI_STARTPAGE_OPTION");
             $content->setVariable("OPTION_WIKI_STARTPAGE", $wiki_entry);
             if ($values["wiki_startpage"] == $wiki_entry) {
                 $content->setVariable("WIKI_STARTPAGE_SELECTED", "selected");
                 $startpageFound = true;
             }
             $content->parse("BLOCK_WIKI_STARTPAGE_OPTION");
         }
         if (!$startpageFound) {
             $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         }
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("OPTION_WIKI_GLOSSARY", gettext("Glossary"));
         $content->setVariable("OPTION_WIKI_GLOSSARY_SELECTED", "selected");
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new wiki in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create wiki"));
         $pagetitle = gettext("Create wiki");
         $breadcrumbheader = gettext("Add new wiki");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
         if (!empty($values["wiki_startpage"])) {
             $content->setVariable("VALUE_WIKI_STARTPAGE", h($values["wiki_startpage"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_WIKI_STARTPAGE", gettext("Startpage"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $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"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_wiki::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (isset($wiki_container) && is_object($wiki_container) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY] = str_replace("%NAME", "you", $access[PERMISSION_PRIVATE_READONLY]);
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     WIKI_FULL_HEADLINE ? $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication"))) : "";
     if (isset($wiki_container) && is_object($wiki_container)) {
         $headline[] = array("link" => PATH_URL . "wiki/index/" . $wiki_container->get_id() . "/", "name" => h($wiki_container->get_name()));
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     $frameResponseObject->setTitle($pagetitle);
     $frameResponseObject->setHeadline($headline);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
     /*$portal->set_page_main( $headline, $content->get() );
     	 $portal->set_page_title( $pagetitle );
     	 $portal->show_html();*/
 }
Exemple #5
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //$portal = \lms_portal::get_instance();
     //$portal->initialize( GUEST_NOT_ALLOWED );
     //$portal->set_guest_allowed( GUEST_NOT_ALLOWED );
     $user = \lms_steam::get_current_user();
     //$portal_user = $portal->get_user();
     //$path = $request->getPath();
     //$current_semester = $path[3];
     $scg = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), STEAM_COURSES_GROUP, CLASS_GROUP);
     $current_semester = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $scg->get_groupname() . "." . STEAM_CURRENT_SEMESTER);
     $group_course = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), "Courses." . $this->params[0] . "." . $this->params[1]);
     $group = new \koala_group_course($group_course);
     $all_users = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     if (!$group->is_admin($user)) {
         include "bad_link.php";
         exit;
     }
     $lsfid = $group->get_steam_group()->get_attribute("COURSE_HISLSF_ID");
     $is_lsfcourse = is_string($lsfid) && strlen($lsfid) > 0 && $lsfid > 0;
     $paul_id = $group->get_attribute("COURSE_NUMBER");
     $is_paul_course = \koala_group_course::is_paul_course($paul_id);
     $accessmergel = FALSE;
     if (is_object($group)) {
         $creator = $group->get_steam_group()->get_creator();
         if ($group->get_steam_group()->get_attribute(KOALA_GROUP_ACCESS) == PERMISSION_UNDEFINED && lms_steam::get_current_user()->get_id() != $creator->get_id() && !lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     if (isset($_POST["course_save"])) {
         $values = $_POST["values"];
         $problems = "";
         $hints = "";
         if (empty($values["OBJ_DESC"])) {
             $problems .= gettext("The course name is missing.") . " ";
             $hints .= gettext("A name is necessary for identification.") . " ";
         }
         if (empty($values["COURSE_TUTORS"])) {
             $values["COURSE_TUTORS"] = "NN";
         }
         $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 (!$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 course'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_COURSE_PASSWORD && empty($values["password"])) {
             $problems .= gettext("The course password is missing.") . " ";
             $hints .= gettext("You chose to password protect your course. Please provide a password.") . " ";
         }
         if (empty($problems)) {
             $group->set_attributes(array_diff_key($values, array("password" => "", "maxsize" => "")));
             $learners = $group->get_group_learners();
             if (!$is_lsfcourse) {
                 $access = $values["access"];
                 $waspassword = 0;
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
                 if (!$accessmergel) {
                     $group->set_access($access, $learners, $group->get_group_staff());
                 }
                 if (isset($values) && $waspassword == 1 && isset($values["password"]) && $values["password"] == "******" && $values["access"] == PERMISSION_COURSE_PASSWORD) {
                     // Do nothing in case of valid password dummy
                 } elseif ($values["access"] != PERMISSION_COURSE_PASSWORD) {
                     $learners->set_password("");
                 } else {
                     $learners->set_password(isset($values["password"]) ? trim($values["password"]) : "");
                 }
                 if ($max_members > -1) {
                     $learners->set_attribute(GROUP_MAXSIZE, $max_members);
                 }
             }
             // extensions:
             if (isset($_POST["extensions_available"]) && !empty($_POST["extensions_available"])) {
                 $extensions_available = explode("/", $_POST["extensions_available"]);
                 if (isset($_POST["extensions_enabled"])) {
                     $extensions_enabled = $_POST["extensions_enabled"];
                 } else {
                     $extensions_enabled = array();
                 }
                 if (isset($_POST["extensions_enabled_add"])) {
                     $extensions_enabled = array_merge($extensions_enabled, explode("/", $_POST["extensions_enabled_add"]));
                 }
                 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);
                         }
                     }
                 }
             }
             $cache = get_cache_function("ORGANIZATION");
             $cache->drop("lms_steam::semester_get_courses", $current_semester->get_id());
             $_SESSION["confirmation"] = gettext("The changes have been saved.");
             header("Location: " . $_SERVER["REQUEST_URI"]);
             exit;
         } else {
             //$portal->set_problem_description( $problems, $hints );
         }
     } elseif (isset($_POST["get_paul_course_data"])) {
         //at this time only the course name and short description are updated/changed
         $paul_client = new \paul_soap();
         $paul_course_id = h($group->get_attribute(OBJ_NAME));
         try {
             $paul_course_info = $paul_client->get_course_information($paul_course_id);
         } catch (Exception $exception) {
             $problem = $exception->getMessage();
             error_log($problem);
             throw new Exception("PAUL_SOAP exception: " . $problem);
         }
         //the same as in the following else-block
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
         $values["OBJ_DESC"] = $paul_course_info["course_name_german"];
         $values["COURSE_SHORT_DSC"] = $paul_course_info["short_description"];
         //$portal->set_confirmation("test");
         //print_r($paul_course_values);
     } else {
         $values = $group->get_attributes(array("OBJ_NAME", "OBJ_DESC", "COURSE_TUTORS", "COURSE_SHORT_DSC", "COURSE_LONG_DSC"));
         $ms = $group->get_group_learners()->get_attribute(GROUP_MAXSIZE);
         if ($ms === 0) {
             $values["maxsize"] = "";
         } else {
             $values["maxsize"] = $ms;
         }
     }
     $content = \Course::getInstance()->loadTemplate("courses_edit.template.html");
     //$content = new HTML_TEMPLATE_IT();
     //$content->loadTemplateFile( PATH_TEMPLATES . "courses_edit.template.html" );
     $content->setVariable("LABEL_EDIT_COURSE_DESCRIPTION", gettext("Course Preferences"));
     $course_name = $group->get_attribute(OBJ_NAME);
     $course_number = $group->get_attribute("COURSE_NUMBER");
     $course_name = \koala_group_course::convert_course_id($course_name, $course_number);
     if (\koala_group_course::is_paul_course($course_number) && \lms_steam::is_koala_admin($user)) {
         $content->setVariable("VALUE_PAUL_ID", "  (" . gettext("PAUL-ID: " . h($group->get_attribute(OBJ_NAME))) . ")");
         $content->setVariable("ACTION_PAUL_COURSE_DATA", "<input type=\"submit\"  name=\"get_paul_course_data\" id=\"get_paul_course_data\" title=\"" . gettext("Get the course name and short description from PAUL") . "\" value=\"" . gettext("Get PAUL course data") . "\">");
     }
     $content->setVariable("LABEL_COURSE_ID", gettext("Course ID"));
     $content->setVariable("VALUE_COURSE_ID", h($course_name));
     $content->setVariable("LABEL_COURSE_NAME", gettext("Name"));
     $content->setVariable("VALUE_COURSE_NAME", h($values["OBJ_DESC"]));
     $content->setVariable("LABEL_COURSE_SHORT_INFORMATION", gettext("Short Info"));
     $content->setVariable("VALUE_SHORT_DSC", h($values["COURSE_SHORT_DSC"]));
     $content->setVariable("SHORT_DSC_SHOW_UP", gettext("This value will show up in the semester's courses list beside id, name and staff members."));
     $content->setVariable("LABEL_COURSE_TUTORS", gettext("Staff members"));
     $content->setVariable("VALUE_TUTORS", h($values["COURSE_TUTORS"]));
     $content->setVariable("LABEL_LONG_DSC", gettext("Long description"));
     $content->setVariable("LONG_DSC_SHOW_UP", gettext("This is for your course page. Please add information about schedule and locations at least."));
     $content->setVariable("VALUE_LONG_DSC", h($values["COURSE_LONG_DSC"]));
     $content->setVariable("COURSE_SAVE", gettext("Save changes"));
     $content->setVariable("AENDERN", gettext("Are you sure about your changes?"));
     $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"));
     if (!$is_lsfcourse) {
         $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", h($values["maxsize"]));
         $content->parse("BLOCK_MAXSIZE");
         $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 access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
             $content->parse("BLOCK_ACCESSMERGEL");
         } else {
             $waspassword = 0;
             $access = \koala_group_course::get_access_descriptions();
             if (isset($values) && isset($values["access"])) {
                 $akt_access = $values["access"];
             } else {
                 $akt_access = $group->get_attribute(KOALA_GROUP_ACCESS);
                 if ($akt_access == PERMISSION_COURSE_PASSWORD) {
                     $waspassword = 1;
                 }
             }
             if (is_array($access)) {
                 $content->setVariable("WASPASSWORD", $waspassword);
                 foreach ($access as $key => $array) {
                     if ($key != PERMISSION_UNDEFINED || $akt_access == PERMISSION_UNDEFINED) {
                         if ($key != PERMISSION_COURSE_PAUL_SYNC || $is_paul_course || $akt_access == PERMISSION_COURSE_PAUL_SYNC) {
                             $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_COURSE_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_COURSE_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");
                         }
                     }
                 }
             }
         }
         $content->parse("BLOCK_ACCESS");
     } else {
         $content->setCurrentBlock("BLOCK_ACCESS");
         $content->setCurrentBlock("BLOCK_HISLSF");
         $content->setVariable("PARTICIPANT_MANAGEMENT", gettext("Participant Management"));
         $hislink = "<a href=\"https://lsf.uni-paderborn.de/qisserver/rds?state=wsearchv&search=2&veranstaltung.veranstid=" . trim($lsfid) . "\" target=\"_blank\">HIS-LSF</a>";
         $content->setVariable("PARTICIPANT_MANAGEMENT_VALUE", str_replace("%LINK", $hislink, gettext("The participant management for this course is handled by <b>%LINK</b>.")));
         $content->parse("BLOCK_HISLSF");
         $content->parse("BLOCK_ACCESS");
     }
     // extensions:
     //$extensions = \lms_steam::get_extensionmanager()->get_extensions_by_class( 'koala_group_course' );
     $extensions = 0;
     /*	if ( count( $extensions ) > 0 ) {
     			$content->setCurrentBlock( "BLOCK_EXTENSIONS" );
     			$content->setVariable( "LABEL_EXTENSIONS", gettext( "Extensions" ) );
     			$extension_list = array();
     			foreach ( $extensions as $extension ) {
     				if( $extension->get_requirements() === array() )
     				{
     					$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() );
     					$extension_enabled = $extension->is_enabled( $group );
     					if ( $extension_enabled )
     					$content->setVariable( "EXTENSION_ENABLED", "checked='checked'" );
     					$subextensions = lms_steam::get_extensionmanager()->get_dependent_extensions($extension);
     					if( count( $subextensions ) > 0 )
     					{
     						$content->setCurrentBlock( "BLOCK_SUBEXTENSIONS" );
     						$content->setVariable( "LABEL_SUBEXTENSIONS", str_replace( "%EXTENSION", h($extension->get_display_name()), gettext( "The following sub-extensions are available for %EXTENSION" ) ));
     						foreach($subextensions as $subextension)
     						{
     							$subextension_name = $subextension->get_name();
     							$content->setCurrentBlock( "BLOCK_SUBEXTENSION" );
     							$content->setVariable( "PARENT_EXTENSION_ID", $extension_name );
     							$content->setVariable( "SUBEXTENSION_ID", $subextension->get_name() );
     							$content->setVariable( "SUBEXTENSION_NAME", $subextension->get_display_name() );
     							$content->setVariable( "SUBEXTENSION_DESC", $subextension->get_display_description() );
     							$checkbox_attributes = '';
     							if ( $subextension->is_enabled_for( $group ) )
     							$checkbox_attributes .= "checked='checked'";
     							if ( ! $extension_enabled || $subextension_name === "units_docpool")
     							$checkbox_attributes .= " disabled='disabled'";
     							$content->setVariable( "SUBEXTENSION_ENABLED", $checkbox_attributes );
     							$content->parse( "BLOCK_SUBEXTENSION" );
     							$extension_list[] = $subextension_name;
     						}
     						$content->parse( "BLOCK_SUBEXTENSIONS" );
     					}
     					$content->parse( "BLOCK_EXTENSION" );
     					$extension_list[] = $extension_name;
     				}
     			}
     			$content->setVariable( "VALUE_EXTENSIONS", implode( "/", $extension_list ) );
     			$content->parse( "BLOCK_EXTENSIONS" );
     		}*/
     $backlink = PATH_URL . "course/index/" . $this->params[0] . "/" . $this->params[1] . "/";
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     //$portal->set_page_main(
     //array( array( "link" => $backlink, "name" => h($values["OBJ_DESC"]) ), array( "linK" => "", "name" => gettext( "Course Preferences" ) ) ),
     //$content->get()
     //);
     $frameResponseObject->setHeadline(array(array("link" => $backlink, "name" => h($values["OBJ_DESC"])), array("linK" => "", "name" => gettext("Course Preferences"))));
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Exemple #6
0
} else {
    echo get_permalink(11);
}
?>
">Оптовым покупателям</a></li>
                 <li class="<?php 
if (get_current_URL() == get_page_link(169)) {
    echo 'active';
}
?>
"><a href="<?php 
echo get_permalink(169);
?>
">Контакты</a></li>
                 <li class="<?php 
if (get_current_URL() == get_page_link(171)) {
    echo 'active';
}
?>
"><a href="<?php 
echo get_permalink(171);
?>
">Где купить</a></li>
            </ul>
			<div  id="shopping-cart" class="col-md-2 col-sm-2 col-xs-12">
				
					<i class="glyphicon glyphicon-search gray-color" id="search-handler"></i>
					<?php 
wp_nav_menu(array('theme_location' => 'cart-menu'));
?>
				
Exemple #7
0
            }
            $content->parse('PARTICIPANT_PASSWORD');
        } else {
            $content->setVariable('ONCHANGE', "onchange=\"document.getElementById('passworddiv').style.display='none'\"");
        }
        $content->parse('PARTICIPANT');
    }
}
$content->parse('BLOCK_PARTICIPANT_MANAGEMENT');
// access rights:
$content->setCurrentBlock('BLOCK_ACCESS');
$content->setVariable('LABEL_ACCESS', gettext('Access rights'));
$content->setVariable('ACCESS_INFO_TEXT', gettext("Here you can decide who may have what kind of access to this tutorial and its material. You have the following options:"));
if (isset($tutorial) && $tutorial->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && $tutorial->get_steam_object()->get_creator()->get_id() != lms_steam::get_current_user()->get_id()) {
    // broken access settings, and user doesn't have the permissions to fix it:
    $mailto = 'mailto:' . SUPPORT_EMAIL . '?subject=KoaLA:%20Invalid%20participant%20management&body=' . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
    $content->setCurrentBlock('BLOCK_ACCESSMERGEL');
    $content->setVariable('LABEL_ACCESSMERGEL', str_replace('%MAILTO', $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
    $content->parse('BLOCK_ACCESSMERGEL');
} else {
    if (!empty($values['access'])) {
        $current_access = $values['access'];
    } else {
        if (isset($tutorial)) {
            $current_access = $tutorial->get_attribute(KOALA_ACCESS);
        } else {
            $current_access = PERMISSION_TUTORIAL_MATERIALS_COURSE;
        }
    }
    $access = koala_group_tutorial::get_workroom_access_descriptions();
    foreach ($access as $key => $array) {
Exemple #8
0
">NEW! ГРУППЫ</a></li>
                 		<li class="<?php 
if (get_current_URL() == get_page_link(26)) {
    echo 'active';
}
?>
"><a href="<?php 
echo get_permalink(26);
?>
">СТАТЬИ</a></li>
                 		<li class="<?php 
if (get_current_URL() == get_page_link(173)) {
    echo 'active';
}
?>
"><a href="<?php 
echo get_permalink(173);
?>
">ОТЗЫВЫ</a></li>
                 		<li class="<?php 
if (get_current_URL() == get_page_link(30)) {
    echo 'active';
}
?>
"><a href="<?php 
echo get_permalink(30);
?>
">КОНТАКТЫ</a></li>
            		</ul>
				</div>
			</div>
Exemple #9
0
 public function execute(\FrameResponseObject $frameResponseObject)
 {
     //if (!defined("OBJ_ID")) define( "OBJ_ID", $weblog->get_id() );
     $weblogId = $this->id;
     $weblog = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $weblogId);
     if (!defined("OBJ_ID")) {
         define("OBJ_ID", $weblog->get_id());
     }
     $env = $weblog->get_environment();
     $grp = $env->get_creator();
     if ($grp->get_name() == "learners" && $grp->get_attribute(OBJ_TYPE) == "course_learners") {
         $grp = $grp->get_parent_group();
     }
     $accessmergel = FALSE;
     if (isset($weblog) && is_object($weblog)) {
         $creator = $weblog->get_creator();
         if ($weblog->get_attribute(KOALA_ACCESS) == PERMISSION_UNDEFINED && \lms_steam::get_current_user()->get_id() != $creator->get_id() && !\lms_steam::is_koala_admin(lms_steam::get_current_user())) {
             $accessmergel = TRUE;
         }
     }
     $backlink = empty($_POST["values"]["backlink"]) ? $_SERVER["HTTP_REFERER"] : $_POST["values"]["backlink"];
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $values = $_POST["values"];
         if (get_magic_quotes_gpc()) {
             if (!empty($values['name'])) {
                 $values['name'] = stripslashes($values['name']);
             }
             if (!empty($values['dsc'])) {
                 $values['dsc'] = stripslashes($values['dsc']);
             }
         }
         if (empty($values["name"])) {
             $problems = gettext("The name of the weblog is missing.");
             $hints = gettext("Please type in a name.");
         }
         if (strpos($values["name"], "/")) {
             if (!isset($problems)) {
                 $problems = "";
             }
             $problems .= gettext("Please don't use the \"/\"-char in the name of the weblog.");
         }
         if (empty($problems)) {
             $group_members = $grp;
             $group_admins = 0;
             $group_staff = 0;
             // check if group is a course
             $grouptype = (string) $grp->get_attribute("OBJ_TYPE");
             if ($grouptype == "course") {
                 $group_staff = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".staff");
                 $group_admins = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".admins");
                 $group_members = \steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), $grp->get_groupname() . ".learners");
                 $workroom = $group_members->get_workroom();
             } else {
                 $workroom = $grp->get_workroom();
             }
             if (!isset($weblog) || !is_object($weblog)) {
                 $weblog_new = \steam_weblog::create_steam_structure($GLOBALS["STEAM"], $values["name"], $values["dsc"], $env);
                 $_SESSION["confirmation"] = str_replace("%NAME", h($values["name"]), gettext("New weblog '%NAME' created."));
             } else {
                 $weblog->set_attribute(OBJ_NAME, $values["name"]);
                 $weblog->set_attribute(OBJ_DESC, $values["dsc"]);
                 $frameResponseObject->setConfirmText(gettext("The changes have been saved."));
                 //$portal->set_confirmation( gettext( "The changes have been saved." ));
                 $weblog_new = $weblog;
             }
             //var_dump($weblog_new);die;
             $koala_weblog = new \lms_weblog($weblog_new);
             $access = (int) $values["access"];
             //var_dump($access);
             $access_descriptions = \lms_weblog::get_access_descriptions($grp);
             //var_dump(!$accessmergel);die;
             //if (!$accessmergel) $koala_weblog->set_access( $access, $access_descriptions[$access]["members"] , $access_descriptions[$access]["steam"], $group_members, $group_staff, $group_admins );
             // HIER DER NEUE CODE::ENDE
             $GLOBALS["STEAM"]->buffer_flush();
             $cache = get_cache_function(\lms_steam::get_current_user()->get_name(), 600);
             $cache->drop("lms_steam::get_inventory_recursive", $workroom->get_id(), CLASS_CALENDAR, array("WEBLOG_LANGUAGE"));
             $cache->drop("lms_steam::get_group_communication_objects", $workroom->get_id(), CLASS_MESSAGEBOARD | CLASS_CALENDAR | CLASS_CONTAINER | CLASS_ROOM);
             if (!isset($weblog) || !is_object($weblog)) {
                 header("Location: " . $backlink);
                 exit;
             }
         } else {
             //TODO:PROBLEMDESCRIPTION
             //$portal->set_problem_description( $problems, isset($hints)?$hints:"" );
         }
     }
     $content = \Weblog::getInstance()->loadTemplate("object_new.template.html");
     //$content = new HTML_TEMPLATE_IT( PATH_TEMPLATES );
     //$content->loadTemplateFile( "object_new.template.html" );
     if (isset($weblog) && is_object($weblog)) {
         $content->setVariable("INFO_TEXT", str_replace("%NAME", h($weblog->get_name()), gettext("You are going to edit the weblog '<b>%NAME</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Save changes"));
         $pagetitle = gettext("Preferences");
         if (empty($values)) {
             $values = array();
             $values["name"] = $weblog->get_name();
             $values["dsc"] = $weblog->get_attribute(OBJ_DESC);
             $values["access"] = $weblog->get_attribute(KOALA_ACCESS);
         }
         $breadcrumbheader = gettext("Preferences");
     } else {
         $grpname = $grp->get_attribute(OBJ_NAME);
         if ($grp->get_attribute(OBJ_TYPE) == "course") {
             $grpname = $grp->get_attribute(OBJ_DESC);
         }
         $content->setVariable("INFO_TEXT", str_replace("%ENV", h($grpname), gettext("You are going to create a new weblog in '<b>%ENV</b>'.")));
         $content->setVariable("LABEL_CREATE", gettext("Create weblog"));
         $pagetitle = gettext("Create weblog");
         $breadcrumbheader = gettext("Add new weblog");
     }
     if (!empty($values)) {
         if (!empty($values["name"])) {
             $content->setVariable("VALUE_NAME", h($values["name"]));
         }
         if (!empty($values["dsc"])) {
             $content->setVariable("VALUE_DSC", h($values["dsc"]));
         }
     }
     $content->setVariable("VALUE_BACKLINK", $backlink);
     $content->setVariable("LABEL_NAME", gettext("Name"));
     $content->setVariable("LABEL_DSC", gettext("Description"));
     $content->setVariable("LABEL_ACCESS", gettext("Access"));
     $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"));
     if ($accessmergel) {
         $mailto = "mailto:'.SUPPORT_EMAIL.'?subject=KoaLA:%20Invalid%20Access%20Rights&body=" . rawurlencode("\nLink: " . get_current_URL() . "\nCreator: " . $creator->get_identifier() . "\n");
         $content->setCurrentBlock("BLOCK_ACCESSMERGEL");
         $content->setVariable("LABEL_ACCESSMERGEL", str_replace("%MAILTO", $mailto, gettext("There is a problem with the access settings. Please <a href=\"%MAILTO\">contact the support team</a> to fix it by setting the access rights again.")));
         $content->parse("BLOCK_ACCESSMERGEL");
     } else {
         $access = \lms_weblog::get_access_descriptions($grp);
         if ((string) $grp->get_attribute("OBJ_TYPE") == "course") {
             $access_default = PERMISSION_PUBLIC;
         } else {
             $access_default = PERMISSION_PUBLIC_READONLY;
             if (is_object($weblog) && $creator->get_id() != \lms_steam::get_current_user()->get_id()) {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = str_replace("%NAME", $creator->get_name(), $access[PERMISSION_PRIVATE_READONLY]["label"]);
             } else {
                 $access[PERMISSION_PRIVATE_READONLY]["label"] = gettext("Only members can read and comment. Only you can post.");
             }
         }
         if (is_array($access)) {
             $content->setCurrentBlock("BLOCK_ACCESS");
             foreach ($access as $key => $array) {
                 if ($key != PERMISSION_UNDEFINED || isset($values) && (int) $values["access"] == PERMISSION_UNDEFINED) {
                     $content->setCurrentBlock("ACCESS");
                     $content->setVariable("LABEL", $array["summary_short"] . ": " . $array["label"]);
                     $content->setVariable("VALUE", $key);
                     if (isset($values) && $key == (int) $values["access"] || empty($values) && $key == $access_default) {
                         $content->setVariable("CHECK", "checked=\"checked\"");
                     }
                     $content->parse("ACCESS");
                 }
             }
             $content->parse("BLOCK_ACCESS");
         }
     }
     $content->setVariable("BACKLINK", "<a href=\"{$backlink}\">" . gettext("back") . "</a>");
     $rootlink = \lms_steam::get_link_to_root($grp);
     //var_dump($rootlink);die;
     $headline = array($rootlink[0], $rootlink[1], array("link" => $rootlink[1]["link"] . "communication/", "name" => gettext("Communication")));
     if (isset($weblog) && is_object($weblog)) {
         $headline[] = array("link" => PATH_URL . "weblog/index/" . $weblog->get_id() . "/", "name" => $weblog->get_name());
     }
     $headline[] = array("link" => "", "name" => $breadcrumbheader);
     //$portal->set_page_main( $headline, $content->get() );
     //$portal->set_page_title( $pagetitle );
     //return $portal->get_html();
     $frameResponseObject->setHeadline($headline);
     $frameResponseObject->setTitle($pagetitle);
     $widget = new \Widgets\RawHtml();
     $widget->setHtml($content->get());
     $frameResponseObject->addWidget($widget);
     return $frameResponseObject;
 }
Exemple #10
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;
 }