Public Member Functions | Data Fields

ilRepositorySearchGUI Class Reference

Public Member Functions

 ilRepositorySearchGUI ()
 Constructor public.
 setString ($a_str)
 Set/get search string public.
 getString ()
executeCommand ()
 Control public.
 __clearSession ()
 cancel ()
 start ()
 addUser ()
 setCallback (&$class, $method)
 show ()
 __showSearch ()
 appendSearch ()
 performSearch ()
 __performUserSearch ()
 __performGroupSearch ()
 __performRoleSearch ()
__parseQueryString ($a_string)
 parse query string, using query parser instance
 __loadQueries ()
 __setSearchType ()
 __fillUserSearch ()
 __updateResults ()
 __appendToStoredResults ($a_usr_ids)
 __storeEntries (&$new_res)
 __fillUserTable ($user_ids)
 __fillGroupTable ($group_ids)
 __fillRoleTable ($role_ids)
 __showSearchResults ()
 __showSearchUserTable ($a_result_set, $a_user_ids=NULL, $a_cmd="performSearch", $tpl_var= 'RES_TABLE')
 __showSearchGroupTable ($a_result_set, $a_grp_ids=NULL)
 __showSearchRoleTable ($a_result_set, $a_role_ids)
 listUsersGroup ()
 listUsersRole ()
 __setTableGUIBasicData (&$tbl, &$result_set, $from="")
__initTableGUI ()

Data Fields

 $search_type = 'usr'

Detailed Description

Definition at line 38 of file class.ilRepositorySearchGUI.php.


Member Function Documentation

ilRepositorySearchGUI::__appendToStoredResults ( a_usr_ids  ) 

Definition at line 432 of file class.ilRepositorySearchGUI.php.

References $_SESSION.

Referenced by listUsersGroup(), and listUsersRole().

        {
                if(!$_SESSION['search_append'])
                {
                        return $_SESSION['rep_search']['usr'] = $a_usr_ids;
                }
                foreach($a_usr_ids as $usr_id)
                {
                        $_SESSION['rep_search']['usr'][] = $usr_id;
                }
                return $_SESSION['rep_search']['usr'] ? array_unique($_SESSION['rep_search']['usr']) : array();
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__clearSession (  ) 

Definition at line 103 of file class.ilRepositorySearchGUI.php.

References $_SESSION.

Referenced by start().

        {
                
                unset($_SESSION['rep_search']);
                unset($_SESSION['append_results']);
                unset($_SESSION['rep_query']);
                unset($_SESSION['rep_search_type']);
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__fillGroupTable ( group_ids  ) 

Definition at line 484 of file class.ilRepositorySearchGUI.php.

References $counter, $ref_id, ilObject::_getAllReferences(), ilUtil::formCheckbox(), and ilObjectFactory::getInstanceByRefId().

Referenced by __showSearchResults().

        {
                $group_ids = $group_ids ? $group_ids : array();
                $counter = 0;
                foreach($group_ids as $group_id)
                {
                        if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($ref_id = end(
                                                                                                                                   $ref_ids = ilObject::_getAllReferences($group_id)),false))
                        {
                                continue;
                        }
                        $grp_ids[$counter] = $group_id;
                                        
                        $f_result[$counter][] = ilUtil::formCheckbox(0,"group[]",$ref_id);
                        $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
                        $f_result[$counter][] = $tmp_obj->getCountMembers();
                                        
                        unset($tmp_obj);
                        ++$counter;
                }
                return $f_result ? $f_result : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__fillRoleTable ( role_ids  ) 

Definition at line 507 of file class.ilRepositorySearchGUI.php.

References $counter, $role_id, ilUtil::formCheckbox(), and ilObjectFactory::getInstanceByObjId().

Referenced by __showSearchResults().

        {
                $role_ids = $role_ids ? $role_ids : array();

                $counter = 0;
                foreach($role_ids as $role_id)
                {
                        // exclude anonymous role
                        if ($role_id == ANONYMOUS_ROLE_ID)
                        {
                                continue;
                        }
                        if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($role_id,false))
                        {
                                continue;
                        }
                        // exclude roles with no users assigned to
                        if ($tmp_obj->getCountMembers() == 0)
                        {
                                continue;
                        }
                        $role_ids[$counter] = $role_id;
                                
                        $f_result[$counter][] = ilUtil::formCheckbox(0,"role[]",$role_id);
                        $f_result[$counter][] = array($tmp_obj->getTitle(),$tmp_obj->getDescription());
                        $f_result[$counter][] = $tmp_obj->getCountMembers();

                        unset($tmp_obj);
                        ++$counter;
                }
                return $f_result ? $f_result : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__fillUserSearch (  ) 

Definition at line 371 of file class.ilRepositorySearchGUI.php.

References $_SESSION, ilUserSearchOptions::_getSearchableFieldsInfo(), and ilUtil::formSelect().

Referenced by __showSearch().

        {
                include_once 'Services/Search/classes/class.ilUserSearchOptions.php';

                foreach(ilUserSearchOptions::_getSearchableFieldsInfo() as $info)
                {
                        switch($info['type'])
                        {
                                case FIELD_TYPE_UDF_SELECT:
                                case FIELD_TYPE_SELECT:
                                        $this->tpl->setCurrentBlock("select_field");
                                        $this->tpl->setVariable("SELECT_NAME",$info['lang']);

                                        $name = $info['db'];
                                        $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($_SESSION['rep_query']['usr'][$name],
                                                                                                                                                        "rep_query[usr][$name]",
                                                                                                                                                        $info['values'],
                                                                                                                                                        false,
                                                                                                                                                        true));
                                        $this->tpl->parseCurrentBlock();
                                        break;

                                case FIELD_TYPE_UDF_TEXT:
                                case FIELD_TYPE_TEXT:
                                        $this->tpl->setCurrentBlock("text_field");
                                        $this->tpl->setVariable("TEXT_NAME",$info['lang']);

                                        $name = $info['db'];
                                        $this->tpl->setVariable("USR_NAME","rep_query[usr][$name]");
                                        $this->tpl->setVariable("USR_VALUE",$_SESSION['rep_query']['usr'][$name]);
                                        $this->tpl->parseCurrentBlock();
                                        break;
                        }
                        $this->tpl->setCurrentBlock("usr_rows");
                        $this->tpl->parseCurrentBlock();
                }

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__fillUserTable ( user_ids  ) 

Definition at line 460 of file class.ilRepositorySearchGUI.php.

References $counter, ilUtil::formCheckbox(), and ilObjectFactory::getInstanceByObjId().

Referenced by __showSearchResults(), listUsersGroup(), and listUsersRole().

        {
                $user_ids = $user_ids ? $user_ids : array();

                $counter = 0;
                foreach($user_ids as $usr_id)
                {
                        if(!is_object($tmp_obj = ilObjectFactory::getInstanceByObjId($usr_id,false)))
                        {
                                continue;
                        }
                        $user_ids[$counter] = $usr_id;
                                        
                        $f_result[$counter][] = ilUtil::formCheckbox(0,"user[]",$usr_id);
                        $f_result[$counter][] = $tmp_obj->getLogin();
                        $f_result[$counter][] = $tmp_obj->getFirstname();
                        $f_result[$counter][] = $tmp_obj->getLastname();

                        unset($tmp_obj);
                        ++$counter;
                }
                return $f_result ? $f_result : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilRepositorySearchGUI::__initTableGUI (  ) 

Definition at line 847 of file class.ilRepositorySearchGUI.php.

Referenced by __showSearchGroupTable(), __showSearchRoleTable(), and __showSearchUserTable().

        {
                include_once "./classes/class.ilTableGUI.php";

                return new ilTableGUI(0,false);
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__loadQueries (  ) 

Definition at line 342 of file class.ilRepositorySearchGUI.php.

References $_POST, and $_SESSION.

Referenced by ilRepositorySearchGUI().

        {
                if(is_array($_POST['rep_query']))
                {
                        $_SESSION['rep_query'] = $_POST['rep_query'];
                }
        }

Here is the caller graph for this function:

& ilRepositorySearchGUI::__parseQueryString ( a_string  ) 

parse query string, using query parser instance

Returns:
object of query parser or error message if an error occured public

Definition at line 325 of file class.ilRepositorySearchGUI.php.

References ilUtil::stripSlashes().

Referenced by __performGroupSearch(), __performRoleSearch(), and __performUserSearch().

        {
                include_once 'Services/Search/classes/class.ilQueryParser.php';

                $query_parser = new ilQueryParser(ilUtil::stripSlashes($a_string));
                $query_parser->setCombination(QP_COMBINATION_OR);
                $query_parser->setMinWordLength(1);
                $query_parser->parse();

                if(!$query_parser->validate())
                {
                        return $query_parser->getMessage();
                }
                return $query_parser;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__performGroupSearch (  ) 

Definition at line 281 of file class.ilRepositorySearchGUI.php.

References $_SESSION, __parseQueryString(), __storeEntries(), and sendInfo().

Referenced by performSearch().

        {
                include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';

                $query_string = $_SESSION['rep_query']['grp']['title'];
                if(!is_object($query_parser = $this->__parseQueryString($query_string)))
                {
                        sendInfo($query_parser,true);
                        return false;
                }

                include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
                $object_search = new ilLikeObjectSearch($query_parser);
                $object_search->setFilter(array('grp'));
                $this->__storeEntries($object_search->performSearch());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__performRoleSearch (  ) 

Definition at line 300 of file class.ilRepositorySearchGUI.php.

References $_SESSION, __parseQueryString(), __storeEntries(), and sendInfo().

Referenced by performSearch().

        {
                include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';

                $query_string = $_SESSION['rep_query']['role']['title'];
                if(!is_object($query_parser = $this->__parseQueryString($query_string)))
                {
                        sendInfo($query_parser,true);
                        return false;
                }
                
                // Perform like search
                include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
                $object_search = new ilLikeObjectSearch($query_parser);
                $object_search->setFilter(array('role'));
                $this->__storeEntries($object_search->performSearch());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__performUserSearch (  ) 

Definition at line 235 of file class.ilRepositorySearchGUI.php.

References $_SESSION, __parseQueryString(), __storeEntries(), ilUserSearchOptions::_getSearchableFieldsInfo(), ilObjectSearchFactory::_getUserDefinedFieldSearchInstance(), ilObjectSearchFactory::_getUserSearchInstance(), and sendInfo().

Referenced by performSearch().

        {
                include_once 'Services/Search/classes/class.ilUserSearchOptions.php';
                include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';

                foreach(ilUserSearchOptions::_getSearchableFieldsInfo() as $info)
                {
                        $name = $info['db'];
                        $query_string = $_SESSION['rep_query']['usr'][$name];

                        // continue if no query string is given
                        if(!$query_string)
                        {
                                continue;
                        }
                
                        if(!is_object($query_parser = $this->__parseQueryString($query_string)))
                        {
                                sendInfo($query_parser);
                                return false;
                        }
                        switch($info['type'])
                        {
                                case FIELD_TYPE_UDF_SELECT:
                                case FIELD_TYPE_UDF_TEXT:
                                        $udf_search = ilObjectSearchFactory::_getUserDefinedFieldSearchInstance($query_parser);
                                        $udf_search->setFields(array($name));
                                        $result_obj = $udf_search->performSearch();

                                        // Store entries
                                        $this->__storeEntries($result_obj);
                                        break;

                                case FIELD_TYPE_SELECT:
                                case FIELD_TYPE_TEXT:
                                        $user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
                                        $user_search->setFields(array($name));
                                        $result_obj = $user_search->performSearch();

                                        // store entries
                                        $this->__storeEntries($result_obj);
                                        break;
                        }
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__setSearchType (  ) 

Definition at line 351 of file class.ilRepositorySearchGUI.php.

References $_POST, and $_SESSION.

Referenced by ilRepositorySearchGUI().

        {
                // Update search type. Default to user search
                if($_POST['search_for'])
                {
                        #echo 1;
                        $_SESSION['rep_search_type'] = $_POST['search_for'];
                }
                if(!$_POST['search_for'] and !$_SESSION['rep_search_type'])
                {
                        #echo 2;
                        $_SESSION['rep_search_type'] = 'usr';
                }
                
                $this->search_type = $_SESSION['rep_search_type'];
                #echo $this->search_type;

                return true;
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__setTableGUIBasicData ( &$  tbl,
&$  result_set,
from = "" 
)

Definition at line 805 of file class.ilRepositorySearchGUI.php.

References $_GET, and $tbl.

Referenced by __showSearchGroupTable(), __showSearchRoleTable(), and __showSearchUserTable().

        {
                global $ilUser;

        switch($from)
                {
                        case "group":
                                $offset = $_GET["offset"];
                        $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
                                $direction = $_GET["sort_order"];
                                $tbl->setLimit(1000000);
                                break;
                                
                        case "role":
                                $offset = $_GET["offset"];
                        $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
                                $direction = $_GET["sort_order"];
                                $tbl->setLimit(1000000);
                                break;

                        default:
                                $offset = $_GET["offset"];
                                // init sort_by (unfortunatly sort_by is preset with 'title'
                        if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"]))
                {
                    $_GET["sort_by"] = "login";
                }
                $order = $_GET["sort_by"];
                                $direction = $_GET["sort_order"];
                                $tbl->setLimit($ilUser->getPref('hits_per_page'));
                                break;
                }

                $tbl->setOrderColumn($order);
                $tbl->setOrderDirection($direction);
                $tbl->setOffset($offset);
                $tbl->setMaxCount(count($result_set));
                $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
                $tbl->setData($result_set);
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__showSearch (  ) 

Definition at line 150 of file class.ilRepositorySearchGUI.php.

References $_SESSION, __fillUserSearch(), ilUtil::formRadioButton(), and ilUtil::getImagePath().

Referenced by listUsersGroup(), listUsersRole(), and show().

        {
                $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.rep_search.html','Services/Search');
                $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
                $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_usr.gif'));
                $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
                $this->tpl->setVariable("SEARCH_MEMBERS_HEADER",$this->lng->txt("add_members_header"));


                // user search
                $this->tpl->setVariable("SEARCH_ASSIGN_USR",$this->lng->txt("search_for_users"));
                $this->tpl->setVariable("SEARCH_ROW_CHECK_USER",ilUtil::formRadioButton($this->search_type == 'usr',"search_for","usr"));
                $this->__fillUserSearch();


                // groups
                $this->tpl->setVariable("SEARCH_ROW_TXT_GROUP",$this->lng->txt("search_for_grp_members"));
                $this->tpl->setVariable("GROUP_TERM",$this->lng->txt('search_grp_title'));
        $this->tpl->setVariable("SEARCH_ROW_CHECK_GROUP",ilUtil::formRadioButton($this->search_type == 'grp',"search_for","grp"));
                $this->tpl->setVariable("GRP_VALUE",$_SESSION['rep_query']['grp']['title']);


                // roles
                $this->tpl->setVariable("SEARCH_ROW_TXT_ROLE",$this->lng->txt("search_for_role_members"));
                $this->tpl->setVariable("ROLE_TERM",$this->lng->txt('search_role_title'));
                $this->tpl->setVariable("SEARCH_ROW_CHECK_ROLE",ilUtil::formRadioButton($this->search_type == 'role',"search_for","role"));
                $this->tpl->setVariable("ROLE_VALUE",$_SESSION['rep_query']['role']['title']);


                $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
                if(count($_SESSION['rep_search']['usr']))
                {
                        $this->tpl->setVariable("BTN3_VALUE",$this->lng->txt('append_results'));
                }
                $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__showSearchGroupTable ( a_result_set,
a_grp_ids = NULL 
)

Definition at line 628 of file class.ilRepositorySearchGUI.php.

References $_GET, $tbl, $tpl, __initTableGUI(), __setTableGUIBasicData(), and ilUtil::getImagePath().

Referenced by __showSearchResults().

        {
                if(!$a_result_set)
                {
                        return false;
                }

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

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

                $tpl->setCurrentBlock("tbl_action_btn");
                $tpl->setVariable("BTN_NAME","listUsersGroup");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("crs_list_users"));
                $tpl->parseCurrentBlock();

                if (!empty($a_grp_ids))
                {
                        $tpl->setCurrentBlock("tbl_select_all");
                        $tpl->setVariable("COLUMN_COUNTS",4);
                        $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                        $tpl->parseCurrentBlock();
                }

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("COLUMN_COUNTS",5);
                $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("crs_header_edit_members"),"icon_grp.gif",$this->lng->txt("crs_header_edit_members"));
                $tbl->setHeaderNames(array("",
                                                                   $this->lng->txt("obj_grp"),
                                                                   $this->lng->txt("crs_count_members")));
                $tbl->setHeaderVars(array("",
                                                                  "title",
                                                                  "nr_members"),
                                                        array("ref_id" => $_GET['ref_id'],
                                                                  "cmd" => "show",
                                                                  "cmdClass" => "ilrepositorysearchgui",
                                                                  "cmdNode" => $_GET["cmdNode"]));

                $tbl->setColumnWidth(array("","80%","19%"));


                $this->__setTableGUIBasicData($tbl,$a_result_set,"group");
                $tbl->render();

                $this->tpl->setVariable("RES_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__showSearchResults (  ) 

Definition at line 541 of file class.ilRepositorySearchGUI.php.

References $_SESSION, $counter, $result, __fillGroupTable(), __fillRoleTable(), __fillUserTable(), __showSearchGroupTable(), __showSearchRoleTable(), and __showSearchUserTable().

Referenced by show().

        {
                $counter = 0;
                $f_result = array();
                switch($this->search_type)
                {
                        case "usr":
                                $result = $this->__fillUserTable($_SESSION['rep_search']['usr']);
                                $this->__showSearchUserTable($result,$_SESSION['rep_search']['usr']);
                                break;

                        case 'grp':
                                $result = $this->__fillGroupTable($_SESSION['rep_search']['grp']);
                                $this->__showSearchGroupTable($result,$_SESSION['rep_search']['grp']);
                                break;

                        case 'role':
                                $result = $this->__fillRoleTable($_SESSION['rep_search']['role']);
                                $this->__showSearchRoleTable($result,$_SESSION['rep_search']['role']);
                                break;
                }

                // Finally fill user table, if search type append
                if($_SESSION['search_append'] and $this->search_type != 'usr')
                {
                        $result = $this->__fillUserTable($_SESSION['rep_search']['usr']);
                        $this->__showSearchUserTable($result,$_SESSION['rep_search']['usr'],'search','APPEND_TABLE');
                        
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__showSearchRoleTable ( a_result_set,
a_role_ids 
)

Definition at line 682 of file class.ilRepositorySearchGUI.php.

References $_GET, $tbl, $tpl, __initTableGUI(), __setTableGUIBasicData(), and ilUtil::getImagePath().

Referenced by __showSearchResults().

        {
                if(!$a_result_set)
                {
                        return false;
                }

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

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

                $tpl->setCurrentBlock("tbl_action_btn");
                $tpl->setVariable("BTN_NAME","listUsersRole");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("crs_list_users"));
                $tpl->parseCurrentBlock();
                
                if (!empty($a_role_ids))
                {
                        $tpl->setCurrentBlock("tbl_select_all");
                        $tpl->setVariable("COLUMN_COUNTS",4);
                        $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                        $tpl->parseCurrentBlock();
                }

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("COLUMN_COUNTS",5);
                $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("crs_header_edit_members"),"icon_role.gif",$this->lng->txt("crs_header_edit_members"));
                $tbl->setHeaderNames(array("",
                                                                   $this->lng->txt("objs_role"),
                                                                   $this->lng->txt("crs_count_members")));
                $tbl->setHeaderVars(array("",
                                                                  "title",
                                                                  "nr_members"),
                                                        array("ref_id" => $_GET['ref_id'],
                                                                  "cmd" => "show",
                                                                  "cmdClass" => "ilrepositorysearchgui",
                                                                  "cmdNode" => $_GET["cmdNode"]));

                $tbl->setColumnWidth(array("","80%","19%"));


                $this->__setTableGUIBasicData($tbl,$a_result_set,"role");
                $tbl->render();
                
                $this->tpl->setVariable("RES_TABLE",$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__showSearchUserTable ( a_result_set,
a_user_ids = NULL,
a_cmd = "performSearch",
tpl_var = 'RES_TABLE' 
)

Definition at line 571 of file class.ilRepositorySearchGUI.php.

References $_GET, $tbl, $tpl, __initTableGUI(), __setTableGUIBasicData(), and ilUtil::getImagePath().

Referenced by __showSearchResults(), listUsersGroup(), and listUsersRole().

        {
                if(!$a_result_set)
                {
                        return false;
                }

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


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

                $tpl->setCurrentBlock("tbl_action_btn");
                $tpl->setVariable("BTN_NAME","addUser");
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("btn_add"));
                $tpl->parseCurrentBlock();
                if (!empty($a_user_ids))
                {
                        $tpl->setCurrentBlock("tbl_select_all");
                        $tpl->setVariable("COLUMN_COUNTS",4);
                        $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                        $tpl->parseCurrentBlock();
                }

                $tpl->setCurrentBlock("tbl_action_row");
                $tpl->setVariable("COLUMN_COUNTS",5);
                $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
                $tpl->parseCurrentBlock();

                $tbl->setTitle($this->lng->txt("search_results"),"icon_usr.gif",$this->lng->txt("search_results"));
                $tbl->setHeaderNames(array("",
                                                                   $this->lng->txt("username"),
                                                                   $this->lng->txt("firstname"),
                                                                   $this->lng->txt("lastname")));
                $tbl->setHeaderVars(array("",
                                                                  "login",
                                                                  "firstname",
                                                                  "lastname"),
                                                        array("ref_id" => $_GET['ref_id'],
                                                                  "cmd" => $a_cmd,
                                                                  "cmdClass" => "ilrepositorysearchgui",
                                                                  "cmdNode" => $_GET["cmdNode"]));

                $tbl->setColumnWidth(array("","33%","33%","33%"));

                $this->__setTableGUIBasicData($tbl,$a_result_set);
                $tbl->render();
                
                $this->tpl->setVariable($tpl_var,$tbl->tpl->get());

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::__storeEntries ( &$  new_res  ) 

Definition at line 445 of file class.ilRepositorySearchGUI.php.

Referenced by __performGroupSearch(), __performRoleSearch(), and __performUserSearch().

        {
                if($this->stored == false)
                {
                        $this->result_obj->mergeEntries($new_res);
                        $this->stored = true;
                        return true;
                }
                else
                {
                        $this->result_obj->intersectEntries($new_res);
                        return true;
                }
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::__updateResults (  ) 

Definition at line 410 of file class.ilRepositorySearchGUI.php.

References $_SESSION, and $result.

Referenced by performSearch().

        {
                if(!$_SESSION['search_append'])
                {
                        $_SESSION['rep_search'] = array();
                }
                foreach($this->result_obj->getResults() as $result)
                {
                        $_SESSION['rep_search'][$this->search_type][] = $result['obj_id'];
                }
                if(!$_SESSION['rep_search'][$this->search_type])
                {
                        $_SESSION['rep_search'][$this->search_type] = array();
                }
                else
                {
                        // remove duplicate entries
                        $_SESSION['rep_search'][$this->search_type] = array_unique($_SESSION['rep_search'][$this->search_type]);
                }
                return true;
        }

Here is the caller graph for this function:

ilRepositorySearchGUI::addUser (  ) 

Definition at line 127 of file class.ilRepositorySearchGUI.php.

References $_POST, and show().

        {
                // call callback if that function does give a return value => show error message
                $class =& $this->callback['class'];
                $method = $this->callback['method'];

                // listener redirects if everything is ok.
                $class->$method($_POST['user']);
                $this->show();
        }

Here is the call graph for this function:

ilRepositorySearchGUI::appendSearch (  ) 

Definition at line 187 of file class.ilRepositorySearchGUI.php.

References $_SESSION, and performSearch().

        {
                $_SESSION['search_append'] = true;
                $this->performSearch();
        }

Here is the call graph for this function:

ilRepositorySearchGUI::cancel (  ) 

Definition at line 112 of file class.ilRepositorySearchGUI.php.

        {
                $this->ctrl->returnToParent($this);
        }

& ilRepositorySearchGUI::executeCommand (  ) 

Control public.

Definition at line 83 of file class.ilRepositorySearchGUI.php.

References $cmd, and $rbacsystem.

        {
                global $rbacsystem;

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

                switch($next_class)
                {
                        default:
                                if(!$cmd)
                                {
                                        $cmd = "show";
                                }
                                $this->$cmd();
                                break;
                }
                return true;
        }

ilRepositorySearchGUI::getString (  ) 

Definition at line 74 of file class.ilRepositorySearchGUI.php.

        {
                return $this->string;
        }

ilRepositorySearchGUI::ilRepositorySearchGUI (  ) 

Constructor public.

Definition at line 46 of file class.ilRepositorySearchGUI.php.

References $ilCtrl, $lng, $tpl, __loadQueries(), and __setSearchType().

        {
                global $ilCtrl,$tpl,$lng;

                $this->ctrl =& $ilCtrl;
                $this->tpl =& $tpl;
                $this->lng =& $lng;
                $this->lng->loadLanguageModule('search');
                $this->lng->loadLanguageModule('crs');

                $this->__setSearchType();
                $this->__loadQueries();

                $this->result_obj = new ilSearchResult();
                $this->result_obj->setMaxHits(1000000);
                $this->settings =& new ilSearchSettings();

        }

Here is the call graph for this function:

ilRepositorySearchGUI::listUsersGroup (  ) 

Definition at line 738 of file class.ilRepositorySearchGUI.php.

References $_POST, $_SESSION, $rbacsystem, $result, $tree, __appendToStoredResults(), __fillUserTable(), __showSearch(), __showSearchUserTable(), ilObjectFactory::getInstanceByRefId(), sendInfo(), and show().

        {
                global $rbacsystem,$tree;

                $_SESSION["crs_group"] = $_POST["group"] = $_POST["group"] ? $_POST["group"] : $_SESSION["crs_group"];

                if(!is_array($_POST["group"]))
                {
                        sendInfo($this->lng->txt("crs_no_groups_selected"));
                        $this->show();

                        return false;
                }

                $this->__showSearch();

                // GET ALL MEMBERS
                $members = array();
                foreach($_POST["group"] as $group_id)
                {
                        if(!$tmp_obj = ilObjectFactory::getInstanceByRefId($group_id))
                        {
                                continue;
                        }
                        $members = array_merge($tmp_obj->getGroupMemberIds(),$members);

                        unset($tmp_obj);
                }
                $this->__appendToStoredResults($members);

                $result = $this->__fillUserTable($_SESSION['rep_search']['usr']);
                $this->__showSearchUserTable($result,$_SESSION['rep_search']['usr'],"listUsersGroup");

                return true;
        }

Here is the call graph for this function:

ilRepositorySearchGUI::listUsersRole (  ) 

Definition at line 773 of file class.ilRepositorySearchGUI.php.

References $_POST, $_SESSION, $rbacreview, $rbacsystem, $result, $role_id, $tree, __appendToStoredResults(), __fillUserTable(), __showSearch(), __showSearchUserTable(), sendInfo(), and show().

        {
                global $rbacsystem,$rbacreview,$tree;

                $_SESSION["crs_role"] = $_POST["role"] = $_POST["role"] ? $_POST["role"] : $_SESSION["crs_role"];

                if(!is_array($_POST["role"]))
                {
                        sendInfo($this->lng->txt("crs_no_roles_selected"));
                        $this->show();

                        return false;
                }

                $this->__showSearch();

                // GET ALL MEMBERS
                $members = array();
                foreach($_POST["role"] as $role_id)
                {
                        $members = array_merge($rbacreview->assignedUsers($role_id),$members);
                }
                $members = $this->__appendToStoredResults($members);

                $result = $this->__fillUserTable($_SESSION['rep_search']['usr']);
                $this->__showSearchUserTable($result,$user_ids,"listUsersRole");

                return true;
        }

Here is the call graph for this function:

ilRepositorySearchGUI::performSearch (  ) 

Definition at line 194 of file class.ilRepositorySearchGUI.php.

References $_POST, $_SESSION, __performGroupSearch(), __performRoleSearch(), __performUserSearch(), __updateResults(), sendInfo(), and show().

Referenced by appendSearch().

        {
                // unset search_append if called directly
                if($_POST['cmd']['performSearch'])
                {
                        unset($_SESSION['search_append']);
                }

                switch($this->search_type)
                {
                        case 'usr':
                                $this->__performUserSearch();
                                break;

                        case 'grp':
                                $this->__performGroupSearch();
                                break;

                        case 'role':
                                $this->__performRoleSearch();
                                break;

                        default:
                                echo 'not defined';
                }
                $this->result_obj->filter(ROOT_FOLDER_ID,QP_COMBINATION_OR);

                if(!count($this->result_obj->getResults()))
                {
                        sendInfo($this->lng->txt('search_no_match'));
                }
                $this->__updateResults();
                if($this->result_obj->isLimitReached())
                {
                        $message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
                        sendInfo($message);
                }
                // show results
                $this->show();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::setCallback ( &$  class,
method 
)

Definition at line 138 of file class.ilRepositorySearchGUI.php.

        {
                $this->callback = array('class' => $class,'method' => $method);
        }

ilRepositorySearchGUI::setString ( a_str  ) 

Set/get search string public.

Definition at line 70 of file class.ilRepositorySearchGUI.php.

References $_SESSION.

        {
                $_SESSION['search']['string'] = $this->string = $a_str;
        }

ilRepositorySearchGUI::show (  ) 

Definition at line 143 of file class.ilRepositorySearchGUI.php.

References __showSearch(), and __showSearchResults().

Referenced by addUser(), listUsersGroup(), listUsersRole(), performSearch(), and start().

        {
                $this->__showSearch();
                $this->__showSearchResults();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilRepositorySearchGUI::start (  ) 

Definition at line 117 of file class.ilRepositorySearchGUI.php.

References __clearSession(), and show().

        {
                // delete all session info
                $this->__clearSession();
                $this->show();

                return true;
        }

Here is the call graph for this function:


Field Documentation

ilRepositorySearchGUI::$search_type = 'usr'

Definition at line 40 of file class.ilRepositorySearchGUI.php.


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