Public Member Functions | Data Fields

ilRepositoryGUI Class Reference

Class ilRepositoryGUI. More...

Public Member Functions

 ilRepositoryGUI ()
 Constructor public.
executeCommand ()
 execute command
 show ()
 frameset ()
 output tree frameset
 showTree ()
 display tree view

Data Fields

 $lng
 $ilias
 $tpl
 $tree
 $rbacsystem
 $cur_ref_id
 $cmd
 $mode
 $ctrl

Detailed Description

Class ilRepositoryGUI.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
Id:
class.ilRepositoryGUI.php 15005 2007-10-15 11:47:00Z smeyer

ilRepositoryGUI: ilObjGroupGUI, ilObjFolderGUI, ilObjFileGUI, ilObjCourseGUI, ilCourseObjectivesGUI ilRepositoryGUI: ilObjSAHSLearningModuleGUI, ilObjChatGUI, ilObjForumGUI ilRepositoryGUI: ilObjLearningModuleGUI, ilObjDlBookGUI, ilObjGlossaryGUI ilRepositoryGUI: ilObjQuestionPoolGUI, ilObjSurveyQuestionPoolGUI, ilObjTestGUI ilRepositoryGUI: ilObjSurveyGUI, ilObjExerciseGUI, ilObjMediaPoolGUI, ilObjFileBasedLMGUI ilRepositoryGUI: ilObjCategoryGUI, ilObjRoleGUI ilRepositoryGUI: ilObjiLincCourseGUI, ilObjiLincClassroomGUI, ilObjLinkResourceGUI ilRepositoryGUI: ilObjRootFolderGUI, ilObjMediaCastGUI, ilObjRemoteCourseGUI

Definition at line 45 of file class.ilRepositoryGUI.php.


Member Function Documentation

& ilRepositoryGUI::executeCommand (  ) 

execute command

Definition at line 192 of file class.ilRepositoryGUI.php.

References $_GET, $_SESSION, $cmd, $ilias, $lng, $rbacsystem, $tree, ilObject::_lookupType(), frameset(), ilUtil::redirect(), show(), and showTree().

        {
                global $tree, $rbacsystem, $ilias, $lng, $objDefinition,$ilUser;
                
                // Check for incomplete profile
                if($ilUser->getProfileIncomplete())
                {
                        ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
                }

                // check creation mode
                // determined by "new_type" parameter
                $new_type = $_POST["new_type"]
                        ? $_POST["new_type"]
                        : $_GET["new_type"];

                if ($new_type != "")
                {
                        $this->creation_mode = true;
                }

                // handle frameset command
                $cmd = $this->ctrl->getCmd();
                if (($cmd == "frameset" || $_GET["rep_frame"] == 1) && $_SESSION["il_rep_mode"] == "tree")
                {
                        $next_class = "";
                        $cmd = "frameset";
                }
                else if ($cmd == "frameset" && $_SESSION["il_rep_mode"] != "tree")
                {
                        $this->ctrl->setCmd("");
                        $cmd = "";
                }

                // determine next class
                if ($cmd != "frameset")
                {
                        if ($this->creation_mode)
                        {
                                $obj_type = $new_type;
                                $class_name = $this->objDefinition->getClassName($obj_type);
                                if (strtolower($class_name) != "user")
                                {
                                        $next_class = strtolower("ilObj".$class_name."GUI");
                                }
                                else
                                {
                                        $next_class = $this->ctrl->getNextClass();
                                }
                        }
                        else if ((($next_class = $this->ctrl->getNextClass($this)) == "")
                                || ($next_class == "ilrepositorygui" && $this->ctrl->getCmd() == "return"))
                        {
                                if ($cmd != "frameset" && $cmd != "showTree")
                                {
                                        // get GUI of current object
                                        $obj_type = ilObject::_lookupType($this->cur_ref_id,true);
                                        $class_name = $this->objDefinition->getClassName($obj_type);
                                        $next_class = strtolower("ilObj".$class_name."GUI");
                                        
                                        $this->ctrl->setCmdClass($next_class);
                                        if ($this->ctrl->getCmd() == "return")
                                        {
                                                $this->ctrl->setCmd("");
                                        }
                                }
                        }
                }

                // commands that are always handled by repository gui
                // to do: move to container
                //if ($cmd == "showTree" || $cmd == "linkSelector" || $cmd == "linkChilds")
                if ($cmd == "showTree")
                {
                        $next_class = "";
                }
//echo "<br>cmd:$cmd:nextclass:$next_class:";
                switch ($next_class)
                {
                        
                        default:
                                // forward all other classes to gui commands
                                if ($next_class != "" && $next_class != "ilrepositorygui")
                                {
                                        $class_path = $this->ctrl->lookupClassPath($next_class);
                                        // get gui class instance
                                        include_once($class_path);
                                        $class_name = $this->ctrl->getClassForClasspath($class_path);
                                        if (!$this->creation_mode)
                                        {
                                                $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
                                        }
                                        else
                                        {       
                                                // dirty walkaround for ilinc classrooms which need passed the ref_id of the parent iLinc course
                                                if ($class_name == 'ilObjiLincClassroomGUI')
                                                {
                                                        $this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);
                                                }
                                                else
                                                {
                                                        $this->gui_obj = new $class_name("", 0, true, false);
                                                }
                                        }
                                        //$this->gui_obj = new $class_name("", $this->cur_ref_id, true, false);

        
                                        $tabs_out = ($new_type == "")
                                                ? true
                                                : false;
                                        

                                        $this->gui_obj->setCreationMode($this->creation_mode);
                                        $this->ctrl->setReturn($this, "return");

                                        $this->show();
                                }
                                else    // 
                                {
                                        // process repository frameset
                                        if ($cmd == "frameset")
                                        {
                                                if ($_SESSION["il_rep_mode"] == "tree")
                                                {
                                                        $this->frameset();
                                                        return;
                                                }
                                                $cmd = "";
                                                $this->ctrl->setCmd("");
                                        }
                                        
                                        // process tree command
                                        if ($cmd == "showTree")
                                        {
                                                $this->showTree();
                                                return;
                                        }
                                        
                                        $cmd = $this->ctrl->getCmd("");
                                        
                                        // check read access for category
                                        if ($this->cur_ref_id > 0 && !$rbacsystem->checkAccess("read", $this->cur_ref_id))
                                        {
                                                $_SESSION["il_rep_ref_id"] = "";
                                                $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
                                                $this->tpl->show();
                                        }
                                        else
                                        {
                                                $this->cmd = $cmd;
                                                $this->$cmd();
                                        }
                                }
                                break;
                }
        }

Here is the call graph for this function:

ilRepositoryGUI::frameset (  ) 

output tree frameset

Definition at line 362 of file class.ilRepositoryGUI.php.

References $_GET, $lng, and exit.

Referenced by executeCommand().

        {
                global $lng;
                
                include_once("Services/Frameset/classes/class.ilFramesetGUI.php");
                $fs_gui = new ilFramesetGUI();

                if ($_GET["rep_frame"] == 1)
                {
                        // workaround for passing anchors (e.g. used in ilNoteGUI)
                        $anchor = ($_GET["anchor"] != "")
                                ? "#".$_GET["anchor"]
                                : "";
                        $fs_gui->setMainFrameSource(
                                str_replace("rep_frame", "rep_frame_done", $_SERVER["REQUEST_URI"]).$anchor);
                }
                else
                {
                        $fs_gui->setMainFrameSource(
                                "repository.php?getlast=true&ref_id=".$this->cur_ref_id);
                }
                $fs_gui->setSideFrameSource(
                        "repository.php?cmd=showTree&ref_id=".$this->cur_ref_id);

                $fs_gui->setSideFrameTitle($lng->txt("explorer_frame"));
                $fs_gui->setMainFrameTitle($lng->txt("repository_frame"));
                $fs_gui->setSideFrameName("tree");
                $fs_gui->setMainFrameName("rep_content");
                $fs_gui->setFramesetTitle($this->lng->txt("repository"));
                $fs_gui->show();
                exit;
        }

Here is the caller graph for this function:

ilRepositoryGUI::ilRepositoryGUI (  ) 

Constructor public.

Definition at line 61 of file class.ilRepositoryGUI.php.

References $_GET, $_SESSION, $ilCtrl, $ilias, $ilLog, $lng, $rbacsystem, $tpl, $tree, ilObject::_lookupType(), and ilUtil::isAPICall().

        {
                global $lng, $ilias, $tpl, $tree, $rbacsystem, $objDefinition,
                        $_GET, $ilCtrl, $ilLog;;
//var_dump($_SESSION['il_rep_clipboard']);
                $this->lng =& $lng;
                $this->ilias =& $ilias;
                $this->tpl =& $tpl;
                $this->tree =& $tree;
                $this->rbacsystem =& $rbacsystem;
                $this->objDefinition =& $objDefinition;

                $this->ctrl =& $ilCtrl;
                
                $this->creation_mode = false;

                $this->ctrl->saveParameter($this, array("ref_id"));
                if (!ilUtil::isAPICall())
                        $this->ctrl->setReturn($this,"");

                // determine current ref id and mode
                if (!empty($_GET["ref_id"]) || $this->ctrl->getCmd() == "showTree")
                {
                        $this->cur_ref_id = $_GET["ref_id"];
                }
                else
                {
//echo "1-".$_SESSION["il_rep_ref_id"]."-";
                        if (!empty($_SESSION["il_rep_ref_id"]) && !empty($_GET["getlast"]))
                        {
                                $this->cur_ref_id = $_SESSION["il_rep_ref_id"];
//echo "2-".$this->cur_ref_id."-";
                        }
                        else
                        {
                                $this->cur_ref_id = $this->tree->getRootId();

                                if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset")
                                {
//echo "hhh";
                                        $get_str = $post_str = "";
                                        foreach($_GET as $key => $value)
                                        {
                                                $get_str.= "-$key:$value";
                                        }
                                        foreach($_POST as $key => $value)
                                        {
                                                $post_str.= "-$key:$value";
                                        }
                                        $ilLog->write("Repository: command called without ref_id.".
                                                "GET:".$get_str."-POST:".$post_str, $ilLog->WARNING);
                                }
                                $_GET = array();
                                $_POST = array();
                                $this->ctrl->setCmd("frameset");
                        }
                }
//echo "<br>+".$_GET["ref_id"]."+";
                if (!$tree->isInTree($this->cur_ref_id) && $this->ctrl->getCmd() != "showTree")
                {
                        $this->cur_ref_id = $this->tree->getRootId();

                        // check wether command has been called with
                        // item that is not in tree
                        if ($_GET["cmd"] != "" && $_GET["cmd"] != "frameset")
                        {
                                $get_str = $post_str = "";
                                foreach($_GET as $key => $value)
                                {
                                        $get_str.= "-$key:$value";
                                }
                                foreach($_POST as $key => $value)
                                {
                                        $post_str.= "-$key:$value";
                                }
                                $ilLog->write("Repository: command called with ref_id that is not in tree.".
                                        "GET:".$get_str."-POST:".$post_str, $ilLog->WARNING);
                        }
                        $_GET = array();
                        $_POST = array();
                        $this->ctrl->setCmd("frameset");
                }

                // set current repository view mode
                if (!empty($_GET["set_mode"]))
                {
                        $_SESSION["il_rep_mode"] = $_GET["set_mode"];
                        if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
                        {
                                $this->ilias->account->writePref("il_rep_mode", $_GET["set_mode"]);
                        }
                }

                // get user setting
                if ($_SESSION["il_rep_mode"] == "")
                {
                        if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
                        {
                                $_SESSION["il_rep_mode"] = $this->ilias->account->getPref("il_rep_mode");
                        }
                }

                // if nothing set, get default view
                if ($_SESSION["il_rep_mode"] == "")
                {
                        $_SESSION["il_rep_mode"] = $this->ilias->getSetting("default_repository_view");
                }

                $this->mode = ($_SESSION["il_rep_mode"] != "")
                        ? $_SESSION["il_rep_mode"]
                        : "flat";

                // store current ref id
                if ($this->ctrl->getCmd() != "showTree" &&
                        $rbacsystem->checkAccess("read", $this->cur_ref_id))
                {
                        $type = ilObject::_lookupType($this->cur_ref_id, true);
                        if ($type == "cat" || $type == "grp" || $type == "crs"
                                || $type == "root")
                        {
                                $_SESSION["il_rep_ref_id"] = $this->cur_ref_id;
                        }
                }
                
                $_GET["ref_id"] = $this->cur_ref_id;
        }

Here is the call graph for this function:

ilRepositoryGUI::show (  ) 

Definition at line 350 of file class.ilRepositoryGUI.php.

References $ret.

Referenced by executeCommand().

        {
                // normal command processing
                $ret =& $this->ctrl->forwardCommand($this->gui_obj);
                $this->tpl->setVariable("OBJECTS", $this->gui_obj->getHTML());

                $this->tpl->show();
        }

Here is the caller graph for this function:

ilRepositoryGUI::showTree (  ) 

display tree view

Definition at line 399 of file class.ilRepositoryGUI.php.

References $_GET, ilUtil::getImagePath(), and ilUtil::getStyleSheetLocation().

Referenced by executeCommand().

        {
                $this->tpl = new ilTemplate("tpl.main.html", true, true);
                $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());

                //$this->tpl = new ilTemplate("tpl.explorer.html", false, false);
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
                $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.gif", false));

                include_once ("classes/class.ilRepositoryExplorer.php");
                $exp = new ilRepositoryExplorer("repository.php?cmd=goto");
                $exp->setExpandTarget("repository.php?cmd=showTree");
                $exp->setTargetGet("ref_id");

                if ($_GET["repexpand"] == "")
                {
                        $expanded = $this->tree->readRootId();
                }
                else
                {
                        $expanded = $_GET["repexpand"];
                }

                $exp->setExpand($expanded);

                // build html-output
                $exp->setOutput(0);
                $output = $exp->getOutput();

                $this->tpl->setCurrentBlock("content");
                //$this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("repository"));
                $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
                $this->tpl->setVariable("EXPLORER", $output);
                //$this->tpl->setVariable("ACTION", "repository.php?repexpand=".$_GET["repexpand"]);
                $this->tpl->parseCurrentBlock();
                //$this->tpl->show(true);
                $this->tpl->show(false);
        }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilRepositoryGUI::$cmd

Definition at line 53 of file class.ilRepositoryGUI.php.

Referenced by executeCommand().

ilRepositoryGUI::$ctrl

Definition at line 55 of file class.ilRepositoryGUI.php.

ilRepositoryGUI::$cur_ref_id

Definition at line 52 of file class.ilRepositoryGUI.php.

ilRepositoryGUI::$ilias

Definition at line 48 of file class.ilRepositoryGUI.php.

Referenced by executeCommand(), and ilRepositoryGUI().

ilRepositoryGUI::$lng

Definition at line 47 of file class.ilRepositoryGUI.php.

Referenced by executeCommand(), frameset(), and ilRepositoryGUI().

ilRepositoryGUI::$mode

Definition at line 54 of file class.ilRepositoryGUI.php.

ilRepositoryGUI::$rbacsystem

Definition at line 51 of file class.ilRepositoryGUI.php.

Referenced by executeCommand(), and ilRepositoryGUI().

ilRepositoryGUI::$tpl

Definition at line 49 of file class.ilRepositoryGUI.php.

Referenced by ilRepositoryGUI().

ilRepositoryGUI::$tree

Definition at line 50 of file class.ilRepositoryGUI.php.

Referenced by executeCommand(), and ilRepositoryGUI().


The documentation for this class was generated from the following file: