Public Member Functions | Data Fields

ilObjRoleFolderGUI Class Reference

Inheritance diagram for ilObjRoleFolderGUI:
Collaboration diagram for ilObjRoleFolderGUI:

Public Member Functions

 ilObjRoleFolderGUI ($a_data, $a_id, $a_call_by_reference)
 Constructor public.
executeCommand ()
 execute command
 viewObject ()
 view object
 confirmedDeleteObject ()
 confirmObject handles deletion of roles and role templates NOT the rolefolder object itself!!
 createObject ()
 role folders are created automatically POSSIBLE DEPRECATED !!! public
 deleteObject ()
 display deletion confirmation screen
 adoptPermSaveObject ()
 ??? TODO: what is the purpose of this function? public
 showPossibleSubObjects ($a_tpl)
 show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local role folders
 saveObject ()
 save object public
 __showRolesTable ($a_result_set, $a_role_ids)
__initTableGUI ()
 __setTableGUIBasicData (&$tbl, &$result_set, $from="")
 standard implementation for tables use 'from' variable use different initial setting of table
 __unsetSessionVariables ()
 __buildFilterSelect ()
 hitsperpageObject ()

Data Fields

 $type

Detailed Description

Definition at line 37 of file class.ilObjRoleFolderGUI.php.


Member Function Documentation

ilObjRoleFolderGUI::__buildFilterSelect (  ) 

Definition at line 596 of file class.ilObjRoleFolderGUI.php.

References $_SESSION, and formSelect().

Referenced by viewObject().

        {
                $action[1] = $this->lng->txt('all_roles');
                $action[2] = $this->lng->txt('all_global_roles');
                $action[3] = $this->lng->txt('all_local_roles');
                $action[4] = $this->lng->txt('internal_local_roles_only');
                $action[5] = $this->lng->txt('non_internal_local_roles_only');
                $action[6] = $this->lng->txt('role_templates_only');
                
                return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilObjRoleFolderGUI::__initTableGUI (  ) 

Reimplemented from ilObjectGUI.

Definition at line 561 of file class.ilObjRoleFolderGUI.php.

Referenced by __showRolesTable().

        {
                include_once "class.ilTableGUI.php";

                return new ilTableGUI(0,false);
        }

Here is the caller graph for this function:

ilObjRoleFolderGUI::__setTableGUIBasicData ( &$  tbl,
&$  result_set,
a_from = "" 
)

standard implementation for tables use 'from' variable use different initial setting of table

Reimplemented from ilObjectGUI.

Definition at line 568 of file class.ilObjRoleFolderGUI.php.

References $_GET, and $tbl.

Referenced by __showRolesTable().

        {
        switch($from)
                {
                        default:
                if (!$_GET["sort_by"] or $_GET["sort_by"] == "name")
                {
                    $_GET["sort_by"] = "title";
                }
                
                        $order = $_GET["sort_by"];
                                break;
                }

        //$tbl->enable("hits");
                $tbl->setOrderColumn($order);
                $tbl->setOrderDirection($_GET["sort_order"]);
                $tbl->setOffset($_GET["offset"]);
                $tbl->setLimit($_GET["limit"]);
                $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
                $tbl->setData($result_set);
        }

Here is the caller graph for this function:

ilObjRoleFolderGUI::__showRolesTable ( a_result_set,
a_role_ids 
)

Definition at line 485 of file class.ilObjRoleFolderGUI.php.

References $_SESSION, ilObjectGUI::$actions, $rbacsystem, $tbl, ilObjectGUI::$tpl, __initTableGUI(), __setTableGUIBasicData(), ilUtil::array_php2js(), ilUtil::getImagePath(), and ilObjectGUI::showPossibleSubObjects().

Referenced by viewObject().

        {
        global $rbacsystem;

                $actions = array("delete"  => $this->lng->txt("delete"));

        $tbl =& $this->__initTableGUI();
                $tpl =& $tbl->getTemplateObject();

                $tpl->setCurrentBlock("tbl_form_header");
                $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $tpl->parseCurrentBlock();
                
                $tpl = $this->showPossibleSubObjects($tpl);

                $tpl->setCurrentBlock("tbl_action_row");

                $tpl->setVariable("COLUMN_COUNTS",($_SESSION["filtered_roles"] == 4) ? 4 : 5);

                if ($_SESSION["filtered_roles"] != 4)
                {
                        $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));

                        foreach ($actions as $name => $value)
                        {
                                $tpl->setCurrentBlock("tbl_action_btn");
                                $tpl->setVariable("BTN_NAME",$name);
                                $tpl->setVariable("BTN_VALUE",$value);
                                $tpl->parseCurrentBlock();
                        }
                        
                        if (!empty($a_role_ids))
                        {
                
                                // set checkbox toggles
                                $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
                                $tpl->setVariable("JS_VARNAME","role_id");                      
                                $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_role_ids));
                                $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
                                $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
                                $tpl->parseCurrentBlock();
                        }
                }

                $tpl->setVariable("TPLPATH",$this->tpl->tplPath);


                $this->ctrl->setParameter($this,"cmd","view");

                // title & header columns
                $tbl->setTitle($this->lng->txt("roles"),"icon_role_b.gif",$this->lng->txt("roles"));

                if ($_SESSION["filtered_roles"] == 4)
                {
                        $tbl->setHeaderNames(array($this->lng->txt("type"),$this->lng->txt("role"),
                                                                           $this->lng->txt("description"),$this->lng->txt("context")));
                        $tbl->setHeaderVars(array("type","title","description","context"),$this->ctrl->getParameterArray($this,"",false));
                        $tbl->setColumnWidth(array("","30%","40%","30%"));
                } 
                else 
                {
                        $tbl->setHeaderNames(array("",$this->lng->txt("type"),
                                                                           $this->lng->txt("role"),
                                                                           $this->lng->txt("description"),
                                                                           $this->lng->txt("context")));
                        $tbl->setHeaderVars(array("","type","title","description","context"),$this->ctrl->getParameterArray($this,"",false));
                        $tbl->setColumnWidth(array("","","30%","40%","30%"));
                }
                
                $this->__setTableGUIBasicData($tbl,$a_result_set,"view");
                $tbl->render();
                $this->tpl->setVariable("ROLES_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjRoleFolderGUI::__unsetSessionVariables (  ) 

Definition at line 591 of file class.ilObjRoleFolderGUI.php.

        {
        // empty
        }

ilObjRoleFolderGUI::adoptPermSaveObject (  ) 

??? TODO: what is the purpose of this function? public

Definition at line 395 of file class.ilObjRoleFolderGUI.php.

References $_GET, and ilUtil::redirect().

        {
                sendinfo($this->lng->txt("saved_successfully"),true);
                
                ilUtil::redirect("adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=perm");
        }

Here is the call graph for this function:

ilObjRoleFolderGUI::confirmedDeleteObject (  ) 

confirmObject handles deletion of roles and role templates NOT the rolefolder object itself!!

public

Reimplemented from ilObjectGUI.

Definition at line 219 of file class.ilObjRoleFolderGUI.php.

References $_GET, $_SESSION, $id, $obj, $rbacreview, $rbacsystem, ilObject::_exists(), ilUtil::redirect(), and sendInfo().

        {
                global $rbacsystem,$rbacreview;

                // FOR NON_REF_OBJECTS WE CHECK ACCESS ONLY OF PARENT OBJECT ONCE
                if (!$rbacsystem->checkAccess('delete',$this->object->getRefId()))
                {
                        $perform_delete = false;
                        $this->ilias->raiseError($this->lng->txt("msg_no_perm_delete")." ".
                                                 $not_deletable,$this->ilias->error_obj->MESSAGE);
                }

                $return_loc = $this->tree->getParentId($this->object->getRefId());
                
                $feedback["count"] = count($_SESSION["saved_post"]);
                
                // FOR ALL SELECTED OBJECTS
                foreach ($_SESSION["saved_post"] as $id)
                {
                        // instatiate correct object class (role or rolt)
                        $obj =& $this->ilias->obj_factory->getInstanceByObjId($id);

                        if ($obj->getType() == "role")
                        {
                                $obj->setParent($this->object->getRefId());
                                $feedback["role"] = true;
                        }
                        else
                        {
                                $feedback["rolt"] = true;
                        }
                        $obj->delete();
                        unset($obj);
                }

                // set correct return location if rolefolder is removed
                $return_loc = ilObject::_exists($this->object->getId()) ? $_GET["ref_id"] : $return_loc;
        
                // Compose correct feedback
                if ($feedback["count"] > 1)
                {
                        if ($feedback["role"] === true)
                        {
                                if ($feedback["rolt"] === true)
                                {
                                        sendInfo($this->lng->txt("msg_deleted_roles_rolts"),true);                                      
                                }
                                else
                                {
                                        sendInfo($this->lng->txt("msg_deleted_roles"),true);                                            
                                }
                        }
                        else
                        {
                                sendInfo($this->lng->txt("msg_deleted_rolts"),true);                                            
                        }
                }
                else
                {
                        if ($feedback["role"] === true)
                        {
                                sendInfo($this->lng->txt("msg_deleted_role"),true);     
                        }
                        else
                        {
                        sendInfo($this->lng->txt("msg_deleted_rolt"),true);     
                        }       
                }
                        
                ilUtil::redirect("adm_object.php?ref_id=".$return_loc);
        }

Here is the call graph for this function:

ilObjRoleFolderGUI::createObject (  ) 

role folders are created automatically POSSIBLE DEPRECATED !!! public

Reimplemented from ilObjectGUI.

Definition at line 296 of file class.ilObjRoleFolderGUI.php.

References saveObject().

        {
                $this->object->setTitle($this->lng->txt("obj_".$this->object->getType()."_local"));
                $this->object->setDescription("obj_".$this->object->getType()."_local_desc");
                
                $this->saveObject();
        }

Here is the call graph for this function:

ilObjRoleFolderGUI::deleteObject (  ) 

display deletion confirmation screen

public

Definition at line 309 of file class.ilObjRoleFolderGUI.php.

References $_GET, $_POST, $_SESSION, $counter, $id, ilUtil::getImageTagByType(), ilObjectGUI::getTemplateFile(), sendInfo(), and ilUtil::switchColor().

        {
                if(!isset($_POST["role_id"]))
                {
                        $this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
                }
                // SAVE POST VALUES
                $_SESSION["saved_post"] = $_POST["role_id"];

                unset($this->data);
                $this->data["cols"] = array("type", "title", "description", "last_change");

                foreach($_POST["role_id"] as $id)
                {
                        $obj_data =& $this->ilias->obj_factory->getInstanceByObjId($id);

                        $this->data["data"]["$id"] = array(
                                "type"        => $obj_data->getType(),
                                "title"       => $obj_data->getTitle(),
                                "desc"        => $obj_data->getDescription(),
                                "last_update" => $obj_data->getLastUpdateDate());
                }

                $this->data["buttons"] = array( "cancelDelete"  => $this->lng->txt("cancel"),
                                                                  "confirmedDelete"  => $this->lng->txt("confirm"));

                $this->getTemplateFile("confirm");

                sendInfo($this->lng->txt("info_delete_sure"));

                $this->tpl->setVariable("FORMACTION", "adm_object.php?ref_id=".$_GET["ref_id"]."&cmd=gateway");

                // BEGIN TABLE HEADER
                foreach ($this->data["cols"] as $key)
                {
                        $this->tpl->setCurrentBlock("table_header");
                        $this->tpl->setVariable("TEXT",$this->lng->txt($key));
                        $this->tpl->parseCurrentBlock();
                }
                // END TABLE HEADER

                // BEGIN TABLE DATA
                $counter = 0;

                foreach ($this->data["data"] as $key => $value)
                {
                        // BEGIN TABLE CELL
                        foreach ($value as $key => $cell_data)
                        {
                                $this->tpl->setCurrentBlock("table_cell");

                                // CREATE TEXT STRING
                                if ($key == "type")
                                {
                                        $this->tpl->setVariable("TEXT_CONTENT",ilUtil::getImageTagByType($cell_data,$this->tpl->tplPath));
                                }
                                else
                                {
                                        $this->tpl->setVariable("TEXT_CONTENT",$cell_data);
                                }

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

                        $this->tpl->setCurrentBlock("table_row");
                        $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor(++$counter,"tblrow1","tblrow2"));
                        $this->tpl->parseCurrentBlock();
                        // END TABLE CELL
                }
                // END TABLE DATA

                // BEGIN OPERATION_BTN
                foreach ($this->data["buttons"] as $name => $value)
                {
                        $this->tpl->setCurrentBlock("operation_btn");
                        $this->tpl->setVariable("BTN_NAME",$name);
                        $this->tpl->setVariable("BTN_VALUE",$value);
                        $this->tpl->parseCurrentBlock();
                }
        }

Here is the call graph for this function:

& ilObjRoleFolderGUI::executeCommand (  ) 

execute command

Reimplemented from ilObjectGUI.

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

References $cmd, and $rbacsystem.

        {
                global $rbacsystem;

                $next_class = $this->ctrl->getNextClass($this);
                $cmd = $this->ctrl->getCmd();

                switch($next_class)
                {
                        default:
                                if(!$cmd)
                                {
                                        $cmd = "view";
                                }
                                $cmd .= "Object";
                                $this->$cmd();

                                break;
                }
                return true;
        }

ilObjRoleFolderGUI::hitsperpageObject (  ) 

Reimplemented from ilObjectGUI.

Definition at line 608 of file class.ilObjRoleFolderGUI.php.

References viewObject().

Here is the call graph for this function:

ilObjRoleFolderGUI::ilObjRoleFolderGUI ( a_data,
a_id,
a_call_by_reference 
)

Constructor public.

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

References $ilCtrl, and ilObjectGUI::ilObjectGUI().

        {
        global $ilCtrl;

        $this->ctrl =& $ilCtrl;
                $this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
                
                $this->type = "rolf";
                $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference);
        }

Here is the call graph for this function:

ilObjRoleFolderGUI::saveObject (  ) 

save object public

Reimplemented from ilObjectGUI.

Definition at line 465 of file class.ilObjRoleFolderGUI.php.

References $_GET, $_POST, $rbacadmin, ilObjectGUI::getReturnLocation(), ilUtil::redirect(), and sendInfo().

Referenced by createObject().

        {
                global $rbacadmin;

                // role folders are created automatically
                $_GET["new_type"] = $this->object->getType();
                $_POST["Fobject"]["title"] = $this->object->getTitle();
                $_POST["Fobject"]["desc"] = $this->object->getDescription();

                // always call parent method first to create an object_data entry & a reference
                $newObj = parent::saveObject();

                // put here your object specific stuff  

                // always send a message
                sendInfo($this->lng->txt("rolf_added"),true);
                
                ilUtil::redirect($this->getReturnLocation("save","adm_object.php?".$this->link_params));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjRoleFolderGUI::showPossibleSubObjects ( a_tpl  ) 

show possible subobjects (pulldown menu) overwritten to prevent displaying of role templates in local role folders

public

Definition at line 408 of file class.ilObjRoleFolderGUI.php.

References $count, $d, $rbacsystem, $row, and formSelect().

        {
                global $rbacsystem;

                $d = $this->objDefinition->getCreatableSubObjects($this->object->getType());
                
                if ($this->object->getRefId() != ROLE_FOLDER_ID or !$rbacsystem->checkAccess('create_rolt',ROLE_FOLDER_ID))
                {
                        unset($d["rolt"]);
                }
                
                if (!$rbacsystem->checkAccess('create_role',$this->object->getRefId()))
                {
                        unset($d["role"]);                      
                }

                if (count($d) > 0)
                {
                        foreach ($d as $row)
                        {
                            $count = 0;
                                if ($row["max"] > 0)
                                {
                                        //how many elements are present?
                                        for ($i=0; $i<count($this->data["ctrl"]); $i++)
                                        {
                                                if ($this->data["ctrl"][$i]["type"] == $row["name"])
                                                {
                                                    $count++;
                                                }
                                        }
                                }
                                if ($row["max"] == "" || $count < $row["max"])
                                {
                                        $subobj[] = $row["name"];
                                }
                        }
                }

                if (is_array($subobj))
                {
                        //build form
                        $opts = ilUtil::formSelect(12,"new_type",$subobj);
                        $a_tpl->setCurrentBlock("add_object");
                        $a_tpl->setVariable("SELECT_OBJTYPE", $opts);
                        $a_tpl->setVariable("BTN_NAME", "create");
                        $a_tpl->setVariable("TXT_ADD", $this->lng->txt("add"));
                        $a_tpl->parseCurrentBlock();
                }
                
                return $a_tpl;
        }

Here is the call graph for this function:

ilObjRoleFolderGUI::viewObject (  ) 

view object

public

Reimplemented from ilObjectGUI.

Definition at line 88 of file class.ilObjRoleFolderGUI.php.

References $_GET, $_POST, $_SESSION, $counter, $path, $rbacreview, $rbacsystem, __buildFilterSelect(), and __showRolesTable().

Referenced by hitsperpageObject().

        {
                global $rbacreview,$rbacsystem;

                if (!$rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
                {
                        $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
                }

                $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html');
                
                $assignable = false;

                if ($this->object->getId() == ROLE_FOLDER_ID)
                {
            $assignable = true;

                    $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];

            if ($_SESSION['filtered_roles'] == 0)
            {
                $_SESSION['filtered_roles'] = 2;
            }
        
                    $this->tpl->setCurrentBlock("filter");
                    $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
                    $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
                    $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
                    $this->tpl->setVariable("FILTER_NAME",'view');
                    $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
                    $this->tpl->parseCurrentBlock();


                // now get roles depending on filter settings
                $role_list = $rbacreview->getRolesByFilter($_SESSION["filtered_roles"],$this->object->getId());
        }
        else
        {
            $role_list = $rbacreview->getRoleListByObject($_GET["ref_id"],true);
        }

                $rbacreview->setRoleType($role_list);

        $counter = 0;

                foreach ($role_list as $role)
                {
            // exclude templates
            if ($role["type"] == "rolt")
            {
                $path = $this->lng->txt("obj_rolt");
                $rolf = ROLE_FOLDER_ID;
            }
            else
            {
                // fetch context path of role
                $rolf_list = $rbacreview->getFoldersAssignedToRole($role["obj_id"],$assignable);

                if ($this->object->getId() != ROLE_FOLDER_ID)
                {
                    $rolf = $this->object->getRefId();
                }
                else
                {
                    $rolf = $rolf_list[0];
                }
                
                        // only list roles that are not set to status "deleted"
                        if ($rbacreview->isDeleted($rolf))
                            {
                    continue;
                }

                // build context path
                $path = "";

                if ($this->tree->isInTree($rolf))
                            {
                    if ($rolf[0] == ROLE_FOLDER_ID)
                    {
                        $path = $this->lng->txt("global");
                    }
                    else
                    {
                                        $tmpPath = $this->tree->getPathFull($rolf);
                                        $path = $tmpPath[count($tmpPath)-2]["title"];
                                    }
                            }
                            else
                            {
                                    $path = "<b>Rolefolder ".$rolf." not found in tree! (Role ".$role["obj_id"].")</b>";
                            }
                        }
                        
                        $disabled = false;
                        $checkbox = ilUtil::formCheckBox(0,"role_id[]",$role["obj_id"],$disabled);

                        // disable checkbox for system role for the system user
                        if ($role["role_type"] != 'linked'
                                && ($role["obj_id"] == SYSTEM_ROLE_ID 
                                        or $role["obj_id"] == ANONYMOUS_ROLE_ID 
                                        or substr($role["title"],0,3) == "il_"))
                        {
                                $disabled = true;
                                $checkbox = "";
                        }

            if ($_SESSION["filtered_roles"] != 4)
            {
                $result_set[$counter][] = $checkbox;
                $role_ids[$counter] = $role["obj_id"];
            }

            $result_set[$counter][] = "<img src=\"".ilUtil::getImagePath("icon_".$role["type"]."_b.gif")."\" alt=\"".$this->lng->txt("obj_".$role["type"])."\" title=\"".$this->lng->txt("obj_".$role["type"])."\" border=\"0\" vspace=\"0\"/>";
            $result_set[$counter][] = "<a href=\"adm_object.php?ref_id=".$rolf."&obj_id=".$role["obj_id"]."&cmd=perm\">".$role["title"]."</a>";
            $result_set[$counter][] = $role["description"];
            $result_set[$counter][] = $path." (".$role["role_type"].")";;

                        ++$counter;
        }

                return $this->__showRolesTable($result_set,$role_ids);
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

ilObjRoleFolderGUI::$type

Definition at line 44 of file class.ilObjRoleFolderGUI.php.


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