예제 #1
0
 public static function init()
 {
     $user = lms_steam::get_current_user();
     $workroom = $user->get_workroom();
     $portfolio_main_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolio", $workroom, "room for portfolio module");
     $artefacts_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "artefacts", $portfolio_main_room, "room for artefacts for portfolios");
     $portfolios_room = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolios", $portfolio_main_room, "room for portfolios");
 }
예제 #2
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        if (!isset($this->params["group_course"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        if ($this->params["group_course"] == 1) {
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "learners") {
                    $group = $subgroup;
                }
                if ($subgroup->get_name() == "staff") {
                    $staffgroup = $subgroup;
                }
            }
        } else {
            if (!isset($this->params["group"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group"]);
            if ($this->params["group_admin"] == 0) {
                $staffgroup = $user;
            } else {
                $staffgroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group_admin"]);
            }
        }
        // create data structure and set access rights
        $rapidfeedback = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $group->get_workroom(), $this->params["desc"]);
        $rapidfeedback->set_attribute("OBJ_TYPE", "RAPIDFEEDBACK_CONTAINER");
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_GROUP", $group);
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_STAFF", $staffgroup);
        $rapidfeedback->set_attribute("RAPIDFEEDBACK_ADMIN_SURVEY", 1);
        $rapidfeedback->set_sanction_all($group);
        $rapidfeedback->set_sanction_all($staffgroup);
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #3
0
 public static function create($name)
 {
     //Create Room
     $newPortfolio = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, self::getPortfoliosContainer(), $name);
     $newPortfolio->set_attribute(PORTFOLIO_PREFIX . "TYPE", "PORTFOLIO");
     $newPortfolio->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "PORTFOLIO");
     $newPortfolio = new PortfolioModel($newPortfolio);
     //Create Forum
     $newPortfolio->createForum();
     //Create Groups
     //		$newPortfolio->createGroups();
     return $newPortfolio;
 }
예제 #4
0
 public static function getSchoolBookmarkFolderObject()
 {
     $myuser = $GLOBALS["STEAM"]->get_current_steam_user();
     $object = $myuser->get_attribute("USER_SCHOOLBOOKMARKROOM");
     if (isset($object) && $object instanceof \steam_room && $object->get_attribute(OBJ_TYPE) === "container_schoolbookmarkroom") {
         return $object;
     } else {
         $object = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "Schoolbookmarkroom", null);
         $object->set_attribute(OBJ_TYPE, "container_schoolbookmarkroom");
         $myuser->set_attribute("USER_SCHOOLBOOKMARKROOM", $object);
         return $object;
     }
 }
예제 #5
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $portal = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), strip_tags($this->params["name"]), $current_room);
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadBookmarks", {"id":"{$this->id}"}, "bookmarksWrapper", "updater", null, null, "bookmarks");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #6
0
파일: Debug.class.php 프로젝트: rolwi/koala
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $testObject = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "Test Workflow2", $user->get_workroom());
     $testObject->set_attribute("OBJ_TYPE", "WORKPLAN_CONTAINER");
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $content = $workplanExtension->loadTemplate("workplan_create.template.html");
     $rawWidget = new \Widgets\RawHtml();
     $rawWidget->setHtml("Test container wurde erstellt!");
     $frameResponseObject->setTitle("Projektplan erstellen");
     $frameResponseObject->addWidget($rawWidget);
     return $frameResponseObject;
 }
예제 #7
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $gallery = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $gallery->set_attribute("bid:collectiontype", "gallery");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tlocation.reload();
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #8
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $current_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $wave = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), rawurlencode($this->params["title"]), $current_room, $this->params["title"]);
        $wave->set_attribute("OBJ_TYPE", "container_waveside");
        $wave->set_attribute("WAVE_SLOGAN", $this->params["slogan"]);
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tsendRequest("LoadContent", {"id":"{$this->id}"}, "explorerWrapper", "updater", null, null, "explorer");
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #9
0
function createContainerObject($name, $env)
{
    /*    if (preg_match('/^(.*).wiki$/', $name)) {
            $newName = preg_replace('/^(.*).wiki$/', '$1', $name);
            $wiki = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $newName, $env);
            $wiki->set_attribute("OBJ_TYPE", "container_wiki_koala");
            //$user = \lms_steam::get_current_user();
            //$koala_wiki = new \koala_wiki($wiki);
            //$koala_wiki->set_access(PERMISSION_PRIVATE_READONLY, 0, 0, $user);
        } elseif (preg_match('/^(.*).galerie$/', $name)) {
            $newName = preg_replace('/^(.*).galerie$/', '$1', $name);
            $gallery = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $newName, $env);
            $gallery->set_attribute("bid:collectiontype", "gallery");
        } else {*/
    $newObject = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, $env);
    return setObjectName($newObject, $name);
}
예제 #10
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        $env_room = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->id);
        $calendar = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["name"], $env_room);
        $calendar->set_attribute("OBJ_TYPE", "calendar");
        $steamCalendar = \steam_factory::create_calendar($GLOBALS["STEAM"]->get_id(), $this->params["name"] . "_calendar", null);
        $calendar->set_attribute("GROUP_CALENDAR", $steamCalendar);
        $steamCalendar->set_attribute("CALENDAR_OWNER", $calendar);
        $calendar->set_attribute("CALENDAR_SUBSCRIPTIONS", array());
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
\t\tlocation.reload();
\t\t
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #11
0
파일: Entry.class.php 프로젝트: rolwi/koala
 private function checkActivity()
 {
     if (!$this->getRoom()->get_object_by_name(PORTFOLIO_PREFIX . "ACTIVITIES") instanceof steam_room) {
     }
     \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), PORTFOLIO_PREFIX . "ACTIVITIES", $this->getRoom(), "Fertigkeiten");
 }
예제 #12
0
 protected function get_documents_folder($owner, $create = FALSE)
 {
     $workroom = $owner->get_workroom();
     $docs = $workroom->get_object_by_name("documents");
     if (is_object($docs) && $docs->get_attribute(OBJ_TYPE) === "room_documents_koala") {
         return $docs;
     } else {
         if (!$create || !$workroom->check_access_insert(lms_steam::get_current_user())) {
             return FALSE;
         }
     }
     $docs = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "documents", $workroom);
     if (!is_object($docs)) {
         throw new Exception("Could not create documents folder for " . get_class($owner) . " : id " . $owner->get_id());
     }
     $docs->set_attribute(OBJ_TYPE, "room_documents_koala");
     return $docs;
 }
예제 #13
0
파일: wiki_new.php 프로젝트: rolwi/koala
 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"]);
         $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();
예제 #14
0
 public function frameResponse(\FrameResponseObject $frameResponseObject)
 {
     $workplanExtension = \Workplan::getInstance();
     $workplanExtension->addJS();
     $user = $GLOBALS["STEAM"]->get_current_steam_user();
     $portal = \lms_portal::get_instance();
     $newWorkplan = FALSE;
     if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["new_workplan"])) {
         $newWorkplan = TRUE;
         $values = $_POST["values"];
         $workplanContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $values["name"], $user->get_workroom());
         $workplanContainer->set_attribute("OBJ_TYPE", "WORKPLAN_CONTAINER");
         $xml = new \SimpleXMLElement("<workplan></workplan>");
         $xml->addAttribute("name", $values["name"]);
         $start = $values["start"];
         $start = mktime(0, 0, 0, substr($start, 3, 2), substr($start, 0, 2), substr($start, 6, 4));
         $workplanContainer->set_attribute("WORKPLAN_START", $start);
         $xml->addAttribute("start", $start);
         if (!empty($values["end"])) {
             $end = $values["end"];
             $end = mktime(0, 0, 0, substr($end, 3, 2), substr($end, 0, 2), substr($end, 6, 4));
             $workplanContainer->set_attribute("WORKPLAN_END", $end);
             $xml->addAttribute("end", $end);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_END", -1);
             $xml->addAttribute("end", -1);
         }
         if (!empty($values["description"])) {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", $values["description"]);
             $xml->addAttribute("description", $values["description"]);
         } else {
             $workplanContainer->set_attribute("WORKPLAN_DESCRIPTION", "");
             $xml->addAttribute("description", "");
         }
         \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "version.xml", $xml->saveXML(), "text/xml", $workplanContainer);
         $portal->set_confirmation("Projektplan " . $values["name"] . " erfolgreich erstellt.");
     }
     if (!$newWorkplan) {
         $workplanContainer = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params[0]);
     }
     if (is_object($workplanContainer) && $workplanContainer instanceof \steam_room) {
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (!$newWorkplan) {
             $content->setCurrentBlock("BLOCK_CONFIRMATION");
             $content->setVariable("CONFIRMATION_TEXT", "NONE");
             $content->parse("BLOCK_CONFIRMATION");
         }
         // if current user has required rights display actionbar
         if ($workplanContainer->get_creator()->get_id() == $user->get_id() || in_array("WORKPLAN_" . $user->get_id() . "_LEADER", $workplanContainer->get_attribute_names())) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
             $content->setVariable("LABEL_CHANGE", "Eigenschaften bearbeiten");
             $content->setVariable("LABEL_SNAPSHOT", "Snapshot erstellen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             if ($workplanContainer->get_creator()->get_id() == $user->get_id()) {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "");
             } else {
                 $content->setVariable("WORKPLAN_RIGHTS_CHANGE", "none");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_ACTIONBAR");
         }
         $actionBar = new \Widgets\RawHtml();
         $actionBar->setHtml($content->get());
         $frameResponseObject->addWidget($actionBar);
         $tabBar = new \Widgets\TabBar();
         $tabBar->setTabs(array(array("name" => "Überblick", "link" => $this->getExtension()->getExtensionUrl() . "overview/" . $workplanContainer->get_id()), array("name" => "Tabelle", "link" => $this->getExtension()->getExtensionUrl() . "listView/" . $workplanContainer->get_id()), array("name" => "Gantt-Diagramm", "link" => $this->getExtension()->getExtensionUrl() . "ganttView/" . $workplanContainer->get_id()), array("name" => "Mitarbeiter", "link" => $this->getExtension()->getExtensionUrl() . "users/" . $workplanContainer->get_id()), array("name" => "Snapshots", "link" => $this->getExtension()->getExtensionUrl() . "snapshots/" . $workplanContainer->get_id())));
         $tabBar->setActiveTab(0);
         $frameResponseObject->addWidget($tabBar);
         $content = $workplanExtension->loadTemplate("workplan_overview.template.html");
         if (isset($_POST["edit"])) {
             $edit = $_POST["edit"];
         } else {
             $edit = 0;
         }
         // if the user clicked on the edit symbol in Index-Command-View display edit view
         if ($edit == 1) {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             $content->setVariable("WORKPLAN_OVERVIEW_EDIT", "Eigenschaften bearbeiten");
             $content->setVariable("NAME_LABEL", "Projektname:*");
             $content->setVariable("START_LABEL", "Beginn:*");
             $content->setVariable("END_LABEL", "Ende:");
             $content->setVariable("CREATOR_LABEL", "Projektersteller:");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung:");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 $content->setVariable("DESCRIPTION_VALUE", $workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"));
             }
             $content->setVariable("LABEL_SAVE", "Speichern");
             $content->setVariable("LABEL_BACK", "Abbrechen");
             $content->setVariable("WORKPLAN_ID", $workplanContainer->get_id());
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE_EDIT");
             // else display normal view
         } else {
             $content->setCurrentBlock("BLOCK_WORKPLAN_OVERVIEW_TABLE");
             $content->setVariable("WORKPLAN_OVERVIEW_ATTRIBUTE", "Eigenschaft");
             $content->setVariable("WORKPLAN_OVERVIEW_VALUE", "Wert");
             $content->setVariable("NAME_LABEL", "Projektname");
             $content->setVariable("START_LABEL", "Beginn");
             $content->setVariable("END_LABEL", "Ende");
             $content->setVariable("CREATOR_LABEL", "Projektersteller");
             $content->setVariable("DESCRIPTION_LABEL", "Beschreibung");
             $content->setVariable("NAME_VALUE", $workplanContainer->get_name());
             $content->setVariable("START_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_START")));
             $content->setVariable("CREATOR_VALUE", $workplanContainer->get_creator()->get_full_name());
             if ($workplanContainer->get_attribute("WORKPLAN_END") != -1) {
                 $content->setVariable("END_VALUE", date("d.m.Y", (int) $workplanContainer->get_attribute("WORKPLAN_END")));
             } else {
                 $content->setVariable("END_VALUE", "-");
             }
             if (in_array("WORKPLAN_DESCRIPTION", $workplanContainer->get_attribute_names())) {
                 if (strlen(trim($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION"))) > 0) {
                     $content->setVariable("DESCRIPTION_VALUE", nl2br($workplanContainer->get_attribute("WORKPLAN_DESCRIPTION")));
                 } else {
                     $content->setVariable("DESCRIPTION_VALUE", "-");
                 }
             } else {
                 $content->setVariable("DESCRIPTION_VALUE", "-");
             }
             $content->parse("BLOCK_WORKPLAN_OVERVIEW_TABLE");
         }
         $rawWidget = new \Widgets\RawHtml();
         $rawWidget->setHtml($content->get());
         $frameResponseObject->setTitle("Projektplan: " . $workplanContainer->get_name());
         $frameResponseObject->setHeadline(array(array("link" => $this->getExtension()->getExtensionUrl(), "name" => "Projektplanverwaltung"), array("", "name" => $workplanContainer->get_name())));
         $frameResponseObject->addWidget($rawWidget);
         return $frameResponseObject;
     }
 }
예제 #15
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        $ajaxResponseObject->setStatus("ok");
        if (!isset($this->params["group"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        if ($this->params["group"] == 1) {
            // course
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "staff") {
                    $admingroup = $subgroup;
                } else {
                    if ($subgroup->get_name() == "learners") {
                        $basegroup = $subgroup;
                    }
                }
            }
        } else {
            // group
            if (!isset($this->params["basegroup"]) || !isset($this->params["admingroup"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $basegroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["basegroup"]);
            $admingroup = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["admingroup"]);
        }
        $start = $this->params["startElements"];
        $maxcol = intval(log($start, 2) + 1);
        $pyramidRoom = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $basegroup->get_workroom(), $this->params["title"]);
        $pyramidRoom->set_sanction_all($admingroup);
        $pyramidRoom->set_sanction_all($basegroup);
        $pyramidRoom->set_attribute("OBJ_TYPE", "container_pyramiddiscussion");
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ACTCOL", 0);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINGROUP", $admingroup);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_BASEGROUP", $basegroup);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_DEADLINES", array());
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_EDITOR", $this->params["editor"]);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_INITIALIZED", 1);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAX", $start);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_MAXCOL", $maxcol);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_OVERRIDE_DEADLINES", 0);
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_USEDEADLINES", "no");
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_VERSION", "koala_3.0");
        $participants = array();
        $members = $basegroup->get_members();
        $admins = $admingroup->get_members();
        foreach ($admins as $admin) {
            if (!$basegroup->is_member($admin) && $admin instanceof \steam_user) {
                array_push($members, $admin);
            }
        }
        foreach ($members as $member) {
            if ($member instanceof \steam_user) {
                $participants[$member->get_id()] = 0;
            }
        }
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_PARTICIPANT_MANAGEMENT", $participants);
        $adminconfig = array();
        foreach ($admins as $admin) {
            if ($admin instanceof \steam_user) {
                $options = array();
                $options["show_adminoptions"] = "true";
                $adminconfig[$admin->get_id()] = $options;
            }
        }
        $pyramidRoom->set_attribute("PYRAMIDDISCUSSION_ADMINCONFIG", $adminconfig);
        $pyramidGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "pyramid_" . $pyramidRoom->get_id(), $basegroup);
        // create position documents and corresponding groups
        $groups = array();
        for ($count = 1; $count <= $maxcol; $count++) {
            for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) {
                $newGroup = \steam_factory::create_group($GLOBALS["STEAM"]->get_id(), "group_" . $count . "_" . $count2, $pyramidGroup);
                $newGroup->set_insert_access($basegroup);
                $newGroup->set_insert_access($admingroup);
                $groups[$count . $count2] = $newGroup;
                $newPosition = \steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Position_" . $count . "_" . $count2, "", $this->params["editor"], $pyramidRoom, "Position " . $count . "-" . $count2);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_COLUMN", $count);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_ROW", $count2);
                $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_READ_STATES", array());
                $newPosition->set_attribute("PYRAMIDDISCUSSION_POS_TITLE", "");
                $newPosition->set_attribute("PYRAMIDDISCUSSION_RELGROUP", $newGroup);
            }
        }
        // generate group structure
        for ($count = 2; $count <= $maxcol; $count++) {
            for ($count2 = 1; $count2 <= $start / pow(2, $count - 1); $count2++) {
                $groups[$count . $count2]->add_member($groups[$count - 1 . ($count2 * 2 - 1)]);
                $groups[$count . $count2]->add_member($groups[$count - 1 . $count2 * 2]);
            }
        }
        foreach ($groups as $group) {
            $pyramidGroup->add_member($group);
        }
        $path = PATH_URL;
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #16
0
파일: dialognew.php 프로젝트: rolwi/koala
 if (!$allowed) {
     $action = "error";
 }
 $result = false;
 $title = rawurlencode(strip_tags($_POST["title"]));
 $desc = strip_tags(stripslashes($_POST["title"]), "<b><i><em><font><strong><small><big>");
 // relogin required
 if ($steam->get_login_user()->get_name() === "guest") {
     $do_login = True;
     $error[] = "error_not_logged_in";
 } else {
     //actions
     switch ($action) {
         case "folder":
             if (trim($_POST["title"]) != "") {
                 $result = steam_factory::create_room($steam, $title, $current_room, $desc);
                 $result->set_attribute("bid:collectiontype", $_POST["collectiontype"]);
             } else {
                 $error[] = "error_title";
             }
             break;
         case "file":
             if (isset($_FILES["file"]) && $_FILES["file"]["name"] != "") {
                 $filecontent = file_get_contents($_FILES["file"]["tmp_name"]);
                 $mimetype = derive_mimetype($_FILES["file"]["name"]);
                 $inventory = $current_room->get_inventory();
                 for ($i = 0; $i < count($inventory); $i++) {
                     if (rawurlencode($_FILES["file"]["name"]) == $inventory[$i]->get_name()) {
                         $result = $inventory[$i];
                         $result->set_content($filecontent);
                         $result->set_attribute("DOC_MIME_TYPE", $mimetype);
예제 #17
0
 $problems = "";
 $hints = "";
 // Prüfen auf Parameter, die angegeben werden müssen
 if (!$values["name"]) {
     $problems .= gettext("One of the required fields is missing.");
     $hints .= gettext("Please provide a name for the unit.");
 }
 if (empty($problems)) {
     $all_users = steam_factory::groupname_to_object($GLOBALS["STEAM"]->get_id(), STEAM_ALL_USER);
     $staff = $course->steam_group_staff;
     $learners = $course->steam_group_learners;
     $name = $values["name"];
     if (!isset($unit)) {
         //Erstelle unit
         $env = $course->get_workroom();
         $new_unit_vilm = steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $name, $env, "Videostreaming Lektion");
         $new_unit_vilm->set_attributes(array("UNIT_TYPE" => "units_videostreaming", "OBJ_TYPE" => "videostreaming_unit_koala", "UNIT_DISPLAY_TYPE" => gettext("units_videostreaming")));
         $file = PATH_EXTENSIONS . "units_videostreaming/images/videostreaming.png";
         $fh = fopen($file, 'r');
         $data = fread($fh, filesize($file));
         fclose($fh);
         $unit_icon = steam_factory::create_document($GLOBALS["STEAM"]->get_id(), "Videostreaming Icon", $data, "image/png");
         $new_unit_vilm->set_attribute(OBJ_ICON, $unit_icon);
         // weitere Vorbereitungen z.B. Verzeichnisstuktur ... sollte hier erstellt werden
     } else {
         $new_unit = $unit->get_steam_object();
         $koala_unit = $unit;
         $attrs = $new_unit->get_attributes(array(OBJ_NAME));
         if ($attrs[OBJ_NAME] !== $values['name']) {
             $new_unit->set_name($values['name']);
         }
예제 #18
0
 private static function init($user)
 {
     $workroom = $user->get_workroom();
     //create rooms
     $portfolioContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolio", $workroom, "room for portfolio module");
     $portfolioContainer->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "PORTFOLIOCONTAINER");
     $entryContainer = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "entries", $portfolioContainer, "room for artefacts for portfolios");
     $entryContainer->set_attribute("OBJ_TYPE", PORTFOLIO_PREFIX . "ENTRYCONTAINER");
     return new self($user, $portfolioContainer, $entryContainer);
 }
예제 #19
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();*/
 }
예제 #20
0
    public function ajaxResponse(\AjaxResponseObject $ajaxResponseObject)
    {
        if (!isset($this->params["group_course"])) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        $user = $GLOBALS["STEAM"]->get_current_steam_user();
        if ($this->params["group_course"] == 1) {
            // course
            if (!isset($this->params["course"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $course = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["course"]);
            $subgroups = $course->get_subgroups();
            foreach ($subgroups as $subgroup) {
                if ($subgroup->get_name() == "staff") {
                    $staff = $subgroup->get_members();
                    $admins = array();
                    foreach ($staff as $staffMember) {
                        if ($staffMember instanceof \steam_user) {
                            array_push($admins, $staffMember->get_id());
                        }
                    }
                } else {
                    if ($subgroup->get_name() == "learners") {
                        $group = $subgroup;
                    }
                }
            }
        } else {
            // group
            if (!isset($this->params["group"])) {
                $rawWidget = new \Widgets\RawHtml();
                $rawWidget->setHtml("Error: Kurs oder Gruppe auswählen");
                $ajaxResponseObject->addWidget($rawWidget);
                return $ajaxResponseObject;
            }
            $group = \steam_factory::get_object($GLOBALS["STEAM"]->get_id(), $this->params["group"]);
            $admins = array($user->get_id());
        }
        if (intval($this->params["rounds"]) == 0) {
            $rawWidget = new \Widgets\RawHtml();
            $rawWidget->setHtml("Error: Rundenzahl bitte als Integer eingeben.");
            $ajaxResponseObject->addWidget($rawWidget);
            return $ajaxResponseObject;
        }
        // create data structure and set access rights
        $TCR = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), $this->params["title"], $group->get_workroom(), $this->params["title"]);
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "theses", $TCR, "container for theses");
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "reviews", $TCR, "container for reviews");
        \steam_factory::create_container($GLOBALS["STEAM"]->get_id(), "responses", $TCR, "container for responses");
        $TCR->set_attribute("OBJ_TYPE", "TCR_CONTAINER");
        $TCR->set_attribute("TCR_ROUNDS", $this->params["rounds"]);
        $TCR->set_attribute("TCR_USERS", array());
        $TCR->set_attribute("TCR_ADMINS", $admins);
        $TCR->set_attribute("TCR_GROUP", $group);
        $TCR->set_sanction_all($group);
        $ajaxResponseObject->setStatus("ok");
        $jswrapper = new \Widgets\JSWrapper();
        $jswrapper->setJs(<<<END
\t\tcloseDialog();
END
);
        $ajaxResponseObject->addWidget($jswrapper);
        return $ajaxResponseObject;
    }
예제 #21
0
 public static function init()
 {
     if (self::$initOnce) {
         return false;
     } else {
         self::$initOnce = true;
     }
     $user = \lms_steam::get_current_user();
     $workroom = $user->get_workroom();
     $html = "";
     if ($workroom->get_object_by_name("portfolio")) {
         return false;
     }
     //create rooms
     $portfolio_main_room = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolio", $workroom, "room for portfolio module");
     $artefacts_room = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "artefacts", $portfolio_main_room, "room for artefacts for portfolios");
     $portfolios_room = \steam_factory::create_room($GLOBALS["STEAM"]->get_id(), "portfolios", $portfolio_main_room, "room for portfolios");
     //create groups
     $parentgroup = \steam_factory::get_group($GLOBALS["STEAM"]->get_id(), "PrivGroups");
     $groups = $parentgroup->get_subgroups();
     $names = array();
     foreach ($groups as $group) {
         $names[] = $group->get_name();
     }
     if (!in_array($user->get_name(), $names)) {
         $group = $parentgroup->create_subgroup($user->get_name());
         $html .= "Private Gruppe erstellt<br>";
         $artefactsGroup = $group->create_subgroup("artefacts");
         $html .= "Private Gruppe für Belege erstellt<br>";
         $portfoliosGroup = $group->create_subgroup("portfolios");
         $html .= "Private Gruppe für Portfolios erstellt<br>";
     }
     /*
     //create groups
     $parentgroup = \steam_factory::get_group($GLOBALS[ "STEAM" ]->get_id(), "PrivGroups");
     if (!(($group = $parentgroup->get_subgroup_by_name($user->get_name())) instanceof \steam_group)){
     	$group = $parentgroup->create_subgroup($user->get_name());
     	$html .= "Private Gruppe erstellt<br>";
     }
     if (!($group->get_subgroup_by_name("artefacts") instanceof \steam_group)){
     	$artefactsGroup = $group->create_subgroup("artefacts");
     	$html .= "Private Gruppe für Belege erstellt<br>";
     }
     if (!($group->get_subgroup_by_name("portfolios") instanceof \steam_group)){
     	$portfoliosGroup = $group->create_subgroup("portfolios");
     	$html .= "Private Gruppe für Portfolios erstellt<br>";
     }
     */
     return true;
 }