Public Member Functions | Data Fields

ilSearchGUI Class Reference

Inheritance diagram for ilSearchGUI:
Collaboration diagram for ilSearchGUI:

Public Member Functions

 ilSearchGUI ($a_user_id=0)
 Constructor public.
 performAction ()
 setUserId ($a_user_id)
 getUserId ()
 setFolderId ($a_folder_id)
 getFolderId ()
 setViewmode ($a_viewmode)
 getViewmode ()
 search ($a_search_type= 'new')
 searchInResult ()
 __getFolderSelect ($a_type, $a_search_in_type= '')
 __showResult ()
 __addAction (&$tpl, $a_type, $a_search_in_type= '')
 __showResultTable ($a_type, $a_search_in_type= '')
 __show ()
 __showHeader ()
 __showLocator ()
 __showTabs ()
 __formatLink ($a_link, $a_target)
 __formatUserResult ($a_res)
 __formatGroupResult ($a_res)
 __formatDigiLibResult ($a_res, $a_search_in)
 __formatLearningModuleResult ($a_res, $a_search_in)
 __getContextPath ($a_endnode_id, $a_startnode_id=1)
 __saveResult ()
 __save ($a_type, $a_subtype= '')
 ilSearchGUI ()
 Constructor public.
 setType ($a_type)
 Set/get type of search (detail or 'fast' search) public.
 getType ()
 setCombination ($a_combination)
 Set/get combination of search ('and' or 'or') public.
 getCombination ()
 setString ($a_str)
 Set/get search string public.
 getString ()
 setDetails ($a_details)
 Set/get details (object types for details search) public.
 getDetails ()
 getRootNode ()
 setRootNode ($a_node_id)
executeCommand ()
 Control public.
 saveResult ()
 showSearch ()
 showSelectRoot ()
 selectRoot ()
 showSavedResults ()
 searchInResults ()
 performSearch ()
 prepareOutput ()
__performDetailsSearch (&$query_parser, &$result)
__parseQueryString ()
 parse query string, using query parser instance
__searchObjects (&$query_parser)
 Search in obect title,desctiption.
__searchMeta (&$query_parser, $a_type)
 Search in object meta data (keyword).
 __getFilter ()
 Get object type for filter (If detail search is enabled).
 __showSearchInResults ()
 Show search in results button.
 __getFolderSelect ()

Data Fields

 $ilias
 $search
 $tpl
 $lng
 $tree
 $res_type
 $offset
 $sort_by
 $sort_order
 $user_id
 $folder_id
 $folder_obj
 $viewmode
 $message
 $root_node
 $combination
 $string
 $type

Detailed Description

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


Member Function Documentation

ilSearchGUI::__addAction ( &$  tpl,
a_type,
a_search_in_type = '' 
)

Definition at line 273 of file class.ilSearchGUI.php.

References $tpl, __getFolderSelect(), and ilUtil::getImagePath().

Referenced by __showResultTable().

        {
                $tpl->setCurrentBlock("tbl_form_header");
                $tpl->setVariable("FORMACTION","search.php");
                $tpl->parseCurrentBlock();

                $tpl->setCurrentBlock("tbl_action_select");
                $tpl->setVariable("SELECT_ACTION",$this->__getFolderSelect($a_type,$a_search_in_type));
                $tpl->setVariable("BTN_NAME",$a_type."_".$a_search_in_type);
                $tpl->setVariable("BTN_VALUE",$this->lng->txt("ok"));
                $tpl->parseCurrentBlock();

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__formatDigiLibResult ( a_res,
a_search_in 
)

Definition at line 612 of file class.ilSearchGUI.php.

References $counter, __formatLink(), __getContextPath(), ilLMPageObject::_getPresentationTitle(), ilUtil::formCheckbox(), ilLMObjectFactory::getInstance(), and ilObjectFactory::getInstanceByRefId().

Referenced by __showResultTable().

        {
                if(!is_array($a_res))
                {
                        return array();
                }
                include_once "./classes/class.ilObjectFactory.php";

                $counter = 0;
                foreach($a_res as $book)
                {
                        if($counter < $this->offset or $counter >= $this->offset + RESULT_LIMIT)
                        {
                                ++$counter;
                                $f_result[$counter] = array();
                                continue;
                        }

                        if(!$this->tree->isInTree($book["id"]))
                        {
                                ++$counter;
                                continue;
                        }
                        $tmp_obj = ilObjectFactory::getInstanceByRefId($book["id"]);
                        switch($a_search_in)
                        {
                                case "meta":
                                        $f_result[$counter][]           = ilUtil::formCheckbox(0,"dbk[meta][]",$counter);
                                        $f_result[$counter][]           = $tmp_obj->getTitle();
                                        $f_result[$counter][]           = $this->__getContextPath($book["id"]);

                                        include_once "./content/classes/class.ilObjDlBook.php";
                                        list($book["link"],$book["target"]) = ilObjDlBook::_getLinkToObject($book["id"],"meta");
                                        $f_result[$counter][] = $this->__formatLink($book["link"],$book["target"]);

                                        break;

                                case "content":
                                        // GET INSTANCE OF PAGE OBJECT
                                        include_once ("content/classes/class.ilLMObjectFactory.php");

                                        $tmp_page_obj = ilLMObjectFactory::getInstance($tmp_obj, $book["page_id"]);
                                        if(!is_object($tmp_page_obj))
                                        {
                                                ++$counter;
                                                continue;
                                        }
                                        $tmp_page_obj->setLMId($book["id"]);

                                        $f_result[$counter][]           = ilUtil::formCheckbox(0,"dbk[content][]",$counter);
                                        $f_result[$counter][]           = $tmp_obj->getTitle();
                                        //$f_result[$counter][] = $tmp_page_obj->getPresentationTitle();
                                        $f_result[$counter][] =
                                                ilLMPageObject::_getPresentationTitle($book["page_id"],$tmp_obj->getPageHeader());
                                        $f_result[$counter][]           = $this->__getContextPath($book["id"]);

                                        include_once "./content/classes/class.ilObjDlBook.php";
                                        list($book["link"],$book["target"]) = ilObjDlBook::_getLinkToObject($book["id"],"content",$book["page_id"]);

                                        $f_result[$counter][] = $this->__formatLink($book["link"],$book["target"]);

                                        unset($tmp_page_obj);
                                        break;
                        }
                        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:

ilSearchGUI::__formatGroupResult ( a_res  ) 

Definition at line 574 of file class.ilSearchGUI.php.

References $counter, __formatLink(), ilObjGroup::_getLinkToObject(), ilUtil::formCheckbox(), and ilObjectFactory::getInstanceByRefId().

Referenced by __showResultTable().

        {
                if(!is_array($a_res))
                {
                        return array();
                }
                include_once "./classes/class.ilObjectFactory.php";

                $counter = 0;
                foreach($a_res as $group)
                {
                        if($counter < $this->offset or $counter >= $this->offset + RESULT_LIMIT)
                        {
                                ++$counter;
                                $f_result[$counter] = array();
                                continue;
                        }

                        if(!$this->tree->isInTree($group["id"]))
                        {
                                ++$counter;
                                continue;
                        }
                        $tmp_obj = ilObjectFactory::getInstanceByRefId($group["id"]);
                        
                        $f_result[$counter][]   = ilUtil::formCheckbox(0,"grp[]",$counter);
                        $f_result[$counter][]   = $tmp_obj->getTitle();
                        $f_result[$counter][]   = $tmp_obj->getDescription();

                        list($group["link"],$group["target"]) = ilObjGroup::_getLinkToObject($group["id"]);
                        $f_result[$counter][]   = $this->__formatLink($group["link"],$group["target"]);

                        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:

ilSearchGUI::__formatLearningModuleResult ( a_res,
a_search_in 
)

Definition at line 683 of file class.ilSearchGUI.php.

References $counter, __formatLink(), __getContextPath(), ilLMPageObject::_getPresentationTitle(), ilUtil::formCheckbox(), ilLMObjectFactory::getInstance(), and ilObjectFactory::getInstanceByRefId().

Referenced by __showResultTable().

        {
                if(!is_array($a_res))
                {
                        return array();
                }
                include_once "./classes/class.ilObjectFactory.php";

                $counter = 0;
                foreach($a_res as $book)
                {
                        if($counter < $this->offset or $counter >= $this->offset + RESULT_LIMIT)
                        {
                                ++$counter;
                                $f_result[$counter] = array();
                                continue;
                        }

                        if(!$this->tree->isInTree($book["id"]))
                        {
                                ++$counter;
                                continue;
                        }
                        $tmp_obj = ilObjectFactory::getInstanceByRefId($book["id"]);
                        switch($a_search_in)
                        {
                                case "meta":
                                        $f_result[$counter][]           = ilUtil::formCheckbox(0,"lm[meta][]",$counter);
                                        $f_result[$counter][]           = $tmp_obj->getTitle();
                                        $f_result[$counter][]           = $this->__getContextPath($book["id"]);

                                        include_once "./content/classes/class.ilObjContentObject.php";

                                        list($book["link"],$book["target"]) = ilObjContentObject::_getLinkToObject($book["id"],"meta");
                                        $f_result[$counter][] = $this->__formatLink($book["link"],$book["target"]);
                                        break;
                                        
                                case "content":
                                        // GET INSTANCE OF PAGE OBJECT
                                        include_once ("content/classes/class.ilLMObjectFactory.php");

                                        $tmp_page_obj = ilLMObjectFactory::getInstance($tmp_obj, $book["page_id"]);
                                        if(!is_object($tmp_page_obj))
                                        {
                                                ++$counter;
                                                continue;
                                        }
                                        $tmp_page_obj->setLMId($book["id"]);

                                        $f_result[$counter][]           = ilUtil::formCheckbox(0,"lm[content][]",$counter);
                                        $f_result[$counter][]           = $tmp_obj->getTitle();
                                        //$f_result[$counter][] = $tmp_page_obj->getPresentationTitle();
                                        $f_result[$counter][] =
                                                ilLMPageObject::_getPresentationTitle($book["page_id"],$tmp_obj->getPageHeader());
                                        $f_result[$counter][] = $this->__getContextPath($book["id"]);

                                        include_once "./content/classes/class.ilObjContentObject.php";

                                        list($book["link"],$book["target"]) = ilObjContentObject::_getLinkToObject($book["id"],"content",$book["page_id"]);
                                        
                                        $f_result[$counter][] = $this->__formatLink($book["link"],$book["target"]);

                                        unset($tmp_page_obj);
                                        break;
                        }

                        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:

ilSearchGUI::__formatLink ( a_link,
a_target 
)

Definition at line 530 of file class.ilSearchGUI.php.

Referenced by __formatDigiLibResult(), __formatGroupResult(), __formatLearningModuleResult(), and __formatUserResult().

        {
                return "<a href=\"".$a_link."\" target=\"".$a_target."\".>".$this->lng->txt("search_show_result");
        }

Here is the caller graph for this function:

ilSearchGUI::__formatUserResult ( a_res  ) 

Definition at line 535 of file class.ilSearchGUI.php.

References $counter, $user, __formatLink(), ilObjUser::_getLinkToObject(), ilUtil::formCheckbox(), ilObjectFactory::getInstanceByObjId(), and ilObjectFactory::ObjectIdExists().

Referenced by __showResultTable().

        {
                if(!is_array($a_res))
                {
                        return array();
                }
                include_once "./classes/class.ilObjectFactory.php";

                $counter = 0;
                foreach($a_res as $user)
                {
                        if($counter < $this->offset or $counter >= $this->offset + RESULT_LIMIT)
                        {
                                ++$counter;
                                $f_result[$counter] = array();
                                continue;
                        }

                        if(!ilObjectFactory::ObjectIdExists($user["id"]))
                        {
                                ++$counter;
                                continue;
                        }
                        $tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"]);
                        
                        $f_result[$counter][]   = ilUtil::formCheckbox(0,"usr[]",$counter);
                        $f_result[$counter][]   = $tmp_obj->getLogin();
                        $f_result[$counter][]   = $tmp_obj->getFirstname();
                        $f_result[$counter][]   = $tmp_obj->getLastname();

                        list($user["link"],$user["target"]) = ilObjUser::_getLinkToObject($user["id"]);
                        $f_result[$counter][]   = $this->__formatLink($user["link"],$user["target"]);

                        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:

ilSearchGUI::__getContextPath ( a_endnode_id,
a_startnode_id = 1 
)

Definition at line 755 of file class.ilSearchGUI.php.

Referenced by __formatDigiLibResult(), and __formatLearningModuleResult().

        {
                $path = "";
                
                if(!$this->tree->isInTree($a_startnode_id) or !$this->tree->isInTree($a_endnode_id))
                {
                        return '';
                }
                $tmpPath = $this->tree->getPathFull($a_endnode_id, $a_startnode_id);

                // count -1, to exclude the learning module itself
                for ($i = 1; $i < (count($tmpPath) - 1); $i++)
                {
                        if ($path != "")
                        {
                                $path .= " > ";
                        }

                        $path .= $tmpPath[$i]["title"];
                }
                return $path;
        }

Here is the caller graph for this function:

ilSearchGUI::__getFilter (  ) 

Get object type for filter (If detail search is enabled).

Returns:
array object types public

Definition at line 600 of file class.ilSearchGUI.php.

References $key, and getDetails().

Referenced by __searchMeta(), and __searchObjects().

        {
                foreach($this->getDetails() as $key => $detail_type)
                {
                        switch($key)
                        {
                                case 'lms':
                                        $filter[] = 'lm';
                                        $filter[] = 'dbk';
                                        $filter[] = 'pg';
                                        $filter[] = 'st';
                                        $filter[] = 'sahs';
                                        $filter[] = 'htlm';
                                        break;

                                case 'frm':
                                        $filter[] = 'frm';
                                        break;

                                case 'glo':
                                        $filter[] = 'glo';
                                        break;

                                case 'exc':
                                        $filter[] = 'exc';
                                        break;

                                case 'tst':
                                        $filter[] = 'tst';
                                        $filter[] = 'svy';
                                        $filter[] = 'qpl';
                                        $filter[] = 'spl';
                                        break;

                                case 'mep':
                                        $filter[] = 'mep';
                                        $filter[] = 'mob';
                                        break;

                                case 'fil':
                                        $filter[] = 'file';
                                        break;
                        }
                }
                return $filter ? $filter : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__getFolderSelect ( a_type,
a_search_in_type = '' 
)

Definition at line 201 of file class.ilSearchGUI.php.

References formSelect().

        {
                $subtree = $this->folder_obj->getSubtree();

                $options[0] = $this->lng->txt("search_select_one_folder_select");
                $options[$this->folder_obj->getRootId()] = $this->lng->txt("search_save_as_select")." ".$this->lng->txt("search_search_results");
                
                foreach($subtree as $node)
                {
                        if($node["obj_id"] == $this->folder_obj->getRootId())
                        {
                                continue;
                        }
                        // CREATE PREFIX
                        $prefix = $this->lng->txt("search_save_as_select");
                        for($i = 1; $i < $node["depth"];++$i)
                        {
                                $prefix .= "&nbsp;&nbsp;";
                        }
                        $options[$node["obj_id"]] = $prefix.$node["title"];
                }
                return $select_str = ilUtil::formSelect(0,$a_type."_".$a_search_in_type,$options,false,true);
        }

Here is the call graph for this function:

ilSearchGUI::__getFolderSelect (  ) 

Definition at line 667 of file class.ilSearchGUI.php.

References $folder_obj, and formSelect().

Referenced by __addAction(), and __showSearchInResults().

        {
                global $ilUser;

                include_once 'Services/Search/classes/class.ilSearchFolder.php';

                // INITIATE SEARCH FOLDER OBJECT
                $folder_obj =& new ilSearchFolder($ilUser->getId());


                $subtree = $folder_obj->getSubtree();

                $options[0] = $this->lng->txt("search_select_one_folder_select");
                $options[$folder_obj->getRootId()] = $this->lng->txt("search_save_as_select")." ".$this->lng->txt("search_search_results");
                
                foreach($subtree as $node)
                {
                        if($node["obj_id"] == $folder_obj->getRootId())
                        {
                                continue;
                        }
                        // CREATE PREFIX
                        $prefix = $this->lng->txt("search_save_as_select");
                        for($i = 1; $i < $node["depth"];++$i)
                        {
                                $prefix .= "&nbsp;&nbsp;";
                        }
                        $options[$node["obj_id"]] = $prefix.$node["title"];
                }
                return ilUtil::formSelect(0,'folder',$options,false,true);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilSearchGUI::__parseQueryString (  ) 

parse query string, using query parser instance

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

Definition at line 526 of file class.ilSearchGUI.php.

References getCombination(), getString(), and ilUtil::stripSlashes().

Referenced by performSearch().

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

                $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
                $query_parser->setCombination($this->getCombination());
                $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:

& ilSearchGUI::__performDetailsSearch ( &$  query_parser,
&$  result 
)

Definition at line 456 of file class.ilSearchGUI.php.

References $result, $type, __searchMeta(), ilObjectSearchFactory::_getExerciseSearchInstance(), ilObjectSearchFactory::_getFileSearchInstance(), ilObjectSearchFactory::_getForumSearchInstance(), ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance(), ilObjectSearchFactory::_getHTLMSearchInstance(), ilObjectSearchFactory::_getLMContentSearchInstance(), ilObjectSearchFactory::_getMediaPoolSearchInstance(), ilObjectSearchFactory::_getTestSearchInstance(), and getDetails().

Referenced by performSearch().

        {
                foreach($this->getDetails() as $type => $always_one)
                {
                        switch($type)
                        {
                                case 'lms':
                                        $content_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
                                        $content_search->setFilter(array('lm','dbk'));
                                        $result->mergeEntries($content_search->performSearch());

                                        $result_meta =& $this->__searchMeta($query_parser,'title');
                                        $result->mergeEntries($result_meta);
                                        $result_meta =& $this->__searchMeta($query_parser,'description');
                                        $result->mergeEntries($result_meta);
                                        if($this->settings->enabledLucene())
                                        {
                                                $htlm_search =& ilObjectSearchFactory::_getHTLMSearchInstance($query_parser);
                                                $result->mergeEntries($htlm_search->performSearch());
                                        }
                                        break;

                                case 'frm':
                                        $forum_search =& ilObjectSearchFactory::_getForumSearchInstance($query_parser);
                                        $result->mergeEntries($forum_search->performSearch());
                                        break;

                                case 'glo':
                                        // Glossary term definition pages
                                        $gdf_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
                                        $gdf_search->setFilter(array('gdf'));
                                        $result->mergeEntries($gdf_search->performSearch());

                                        // Glossary terms
                                        $gdf_term_search =& ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
                                        $result->mergeEntries($gdf_term_search->performSearch());
                                        break;

                                case 'exc':
                                        $exc_search =& ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
                                        $result->mergeEntries($exc_search->performSearch());
                                        break;

                                case 'tst':
                                        $tst_search =& ilObjectSearchFactory::_getTestSearchInstance($query_parser);
                                        $result->mergeEntries($tst_search->performSearch());
                                        break;

                                case 'mep':
                                        $mep_search =& ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
                                        $result->mergeEntries($mep_search->performSearch());
                                        break;

                                case 'fil':
                                        if($this->settings->enabledLucene())
                                        {
                                                $file_search =& ilObjectSearchFactory::_getFileSearchInstance($query_parser);
                                                $result->mergeEntries($file_search->performSearch());
                                        }
                                        break;
                        }
                }
                return $result;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__save ( a_type,
a_subtype = '' 
)

Definition at line 848 of file class.ilSearchGUI.php.

References $_POST, $title, ilLMPageObject::_getPresentationTitle(), ilLMObjectFactory::getInstance(), ilObjectFactory::getInstanceByObjId(), ilObjectFactory::getInstanceByRefId(), getUserId(), and search().

Referenced by __saveResult().

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

                $tmp_folder_obj =& new ilSearchFolder($this->getUserId(),$_POST[$a_type."_".$a_subtype]);
                // GET RESULT SET
                $tmp_result = $this->search->getResultByType($a_type);

                switch($a_type)
                {
                        case "lm":
                        case "dbk":
                                foreach($_POST[$a_type][$a_subtype] as $result_id)
                                {
                                        if(!$this->tree->isInTree($tmp_result[$a_subtype][$result_id]["id"]))
                                        {
                                                continue;
                                        }
                                        $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_result[$a_subtype][$result_id]["id"]);
                                        $title = $tmp_obj->getTitle();
                                        
                                        if($a_subtype == "meta")
                                        {
                                                $target = addslashes(serialize(array("type" => $a_type,
                                                                                                                         "subtype" => $a_subtype,
                                                                                                                         "id" => $tmp_result[$a_subtype][$result_id]["id"])));
                                        }
                                        else
                                        {
                                                include_once ("content/classes/class.ilLMObjectFactory.php");

                                                $tmp_page_obj = ilLMObjectFactory::getInstance($tmp_obj,$tmp_result[$a_subtype][$result_id]["page_id"]);
                                                if(!is_object($tmp_page_obj))
                                                {
                                                        continue;
                                                }
                                                $tmp_page_obj->setLMId($tmp_result[$a_subtype][$result_id]["id"]);

                                                //$title .= " -> ".$tmp_page_obj->getPresentationTitle();
                                                $title .= " -> ".
                                                        ilLMPageObject::_getPresentationTitle($tmp_result[$a_subtype][$result_id]["page_id"], $tmp_obj->getPageHeader());

                                                $target = addslashes(serialize(array("type" => $a_type,
                                                                                                                         "subtype" => $a_subtype,
                                                                                                                         "id" => $tmp_result[$a_subtype][$result_id]["id"],
                                                                                                                         "page_id" => $tmp_result[$a_subtype][$result_id]["page_id"])));
                                        }
                                        $search_res_obj =& new ilSearchResult($this->getUserId());
                                        $search_res_obj->setTitle($title);
                                        $search_res_obj->setTarget($target);

                                        $tmp_folder_obj->assignResult($search_res_obj);

                                        unset($search_res_obj);
                                }
                                break;
                                
                        case "grp":
                                foreach($_POST["grp"] as $result_id)
                                {
                                        $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_result[$result_id]["id"]);
                        
                                        $title  = $tmp_obj->getTitle();
                                        if($tmp_obj->getDescription())
                                        {
                                                $title .= " (".$tmp_obj->getDescription().")";
                                        }
                                        $target = addslashes(serialize(array("type" => $a_type,
                                                                                                                 "id" => $tmp_result[$result_id]["id"])));
                                        $search_res_obj =& new ilSearchResult($this->getUserId());
                                        $search_res_obj->setTitle($title);
                                        $search_res_obj->setTarget($target);

                                        $tmp_folder_obj->assignResult($search_res_obj);

                                        unset($search_res_obj);
                                }
                                break;
                        case "usr":
                                foreach($_POST["usr"] as $result_id)
                                {

                                        $tmp_obj = ilObjectFactory::getInstanceByObjId($tmp_result[$result_id]["id"]);
                        
                                        $title  = $tmp_obj->getFirstname();
                                        $title .= " ".$tmp_obj->getLastname();
                                        $title .= " (".$tmp_obj->getLogin().")";

                                        $target = addslashes(serialize(array("type" => $a_type,
                                                                                                                 "id" => $tmp_result[$result_id]["id"])));

                                        $search_res_obj =& new ilSearchResult($this->getUserId());
                                        $search_res_obj->setTitle($title);
                                        $search_res_obj->setTarget($target);

                                        $tmp_folder_obj->assignResult($search_res_obj);

                                        unset($search_res_obj);
                                }
                                break;
                }

                unset($tmp_folder_obj);
                
                $this->message = $this->lng->txt("search_results_saved");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__saveResult (  ) 

Definition at line 778 of file class.ilSearchGUI.php.

References $_POST, $type, and __save().

Referenced by performAction().

        {
                // VALIDATE
                if(isset($_POST["cmd"]["dbk_content"]))
                {
                        $type = "dbk";
                        $subtype = "content";

                        if(!is_array($_POST["dbk"]["content"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                if(isset($_POST["cmd"]["dbk_meta"]))
                {
                        $type = "dbk";
                        $subtype = "meta";
                        if(!is_array($_POST["dbk"]["meta"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                if(isset($_POST["cmd"]["lm_content"]))
                {
                        $type = "lm";
                        $subtype = "content";
                        if(!is_array($_POST["lm"]["content"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                if(isset($_POST["cmd"]["lm_meta"]))
                {
                        $type = "lm";
                        $subtype = "meta";
                        if(!is_array($_POST["lm"]["meta"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                if(isset($_POST["cmd"]["grp_"]))
                {
                        $type = "grp";
                        $subtype = "";
                        if(!is_array($_POST["grp"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                if(isset($_POST["cmd"]["usr_"]))
                {
                        $type = "usr";
                        $subtype = "";
                        if(!is_array($_POST["usr"]))
                        {
                                $this->message = $this->lng->txt("search_select_one_result")."<br />";
                        }
                }
                // NO FOLDER SELECTED
                if(!$_POST[$type."_".$subtype])
                {
                        $this->message .= $this->lng->txt("search_select_one")."<br />";
                }

                if(!$this->message)
                {
                        $this->__save($type,$subtype);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilSearchGUI::__searchMeta ( &$  query_parser,
a_type 
)

Search in object meta data (keyword).

Returns:
object result object public

Definition at line 564 of file class.ilSearchGUI.php.

References __getFilter(), ilObjectSearchFactory::_getMetaDataSearchInstance(), and getType().

Referenced by __performDetailsSearch(), and performSearch().

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

                $meta_search =& ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
                if($this->getType() == SEARCH_DETAILS)
                {
                        $meta_search->setFilter($this->__getFilter());
                }
                switch($a_type)
                {
                        case 'keyword':
                                $meta_search->setMode('keyword');
                                break;

                        case 'contribute':
                                $meta_search->setMode('contribute');
                                break;

                        case 'title':
                                $meta_search->setFilter(array('pg','st'));
                                $meta_search->setMode('title');
                                break;

                        case 'description':
                                $meta_search->setFilter(array('pg','st'));
                                $meta_search->setMode('description');
                                break;
                }
           return $meta_search->performSearch();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilSearchGUI::__searchObjects ( &$  query_parser  ) 

Search in obect title,desctiption.

Returns:
object result object public

Definition at line 545 of file class.ilSearchGUI.php.

References __getFilter(), ilObjectSearchFactory::_getObjectSearchInstance(), and getType().

Referenced by performSearch().

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

                $obj_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);

                if($this->getType() == SEARCH_DETAILS)
                {
                        $obj_search->setFilter($this->__getFilter());
                }
                return $obj_search->performSearch();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__show (  ) 

Definition at line 414 of file class.ilSearchGUI.php.

References __showHeader(), __showLocator(), __showResult(), __showTabs(), ilUtil::formSelect(), infoPanel(), search(), and sendInfo().

Referenced by performAction(), and search().

        {
                // SHOW SEARCH PAGE
                $this->tpl->addBlockFile("CONTENT","content","tpl.search.html");
                $this->tpl->addBlockFile("STATUSLINE","statusline","tpl.statusline.html");
                infoPanel();
                $this->tpl->setVariable("SEARCH_ACTION","./search.php");

                #$this->tpl->setVariable("TXT_SEARCH",$this->lng->txt("search"));

                $this->__showHeader();
                $this->__showLocator();
                $this->__showTabs();
                $this->__showResult();

                if($this->message)
                {
                        sendInfo($this->message);
                }

                $this->tpl->setVariable("FORM_SEARCH_STR",$this->search->getSearchString());
                $this->tpl->setVariable("OR_CHECKED",$this->search->getCombination() == "or" ? "checked=\"checked\"" : "");
                $this->tpl->setVariable("AND_CHECKED",$this->search->getCombination() == "and" ? "checked=\"checked\"" : "");
        $this->tpl->setVariable("TXT_AND",$this->lng->txt("search_and"));
        $this->tpl->setVariable("TXT_OR",$this->lng->txt("search_or"));

                $search_for = $this->search->getSearchFor();

                $this->tpl->setVariable("LM_CHECKED",in_array("lm",$search_for) ? "checked=\"checked\"" : "");
                $this->tpl->setVariable("DBK_CHECKED",in_array("dbk",$search_for) ? "checked=\"checked\"" : "");

                // hide options if user is not logged in
                if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
                {
                        $this->tpl->setVariable("USR_CHECKED",in_array("usr",$search_for) ? "checked=\"checked\"" : "");
                        $this->tpl->setVariable("GRP_CHECKED",in_array("grp",$search_for) ? "checked=\"checked\"" : "");
                }

                $search_in = array("meta" => $this->lng->txt("search_meta"),"content" => $this->lng->txt("search_content"));

                $this->tpl->setVariable("LM_SELECT",ilUtil::formSelect($this->search->getSearchInByType("lm")
                                                                                                                           ,"search_in[lm]",$search_in,false,true));
                $this->tpl->setVariable("DBK_SELECT",ilUtil::formSelect($this->search->getSearchInByType("dbk")
                                                                                                                                ,"search_in[dbk]",$search_in,false,true));
                // TABLE TEXT
                // hide options if user is not logged in
                $this->tpl->setVariable("TXT_LM",$this->lng->txt("obj_lm"));
                $this->tpl->setVariable("TXT_DBK",$this->lng->txt("obj_dbk"));

                if ($this->ilias->account->getId() != ANONYMOUS_USER_ID)
                {
                        $this->tpl->setVariable("TXT_USER",$this->lng->txt("obj_usr"));
                        $this->tpl->setVariable("TXT_GROUPS",$this->lng->txt("obj_grp"));
                }

                // TEXT VARIABLES
                $this->tpl->setVariable("TXT_SEARCHTERM",$this->lng->txt("search_search_term"));
                $this->tpl->setVariable("TXT_CONCATENATION",$this->lng->txt("search_concatenation"));
                $this->tpl->setVariable("TXT_SEARCH_FOR",$this->lng->txt("search_search_for"));

                // BUTTONS
                $this->tpl->setVariable("BTN_SEARCH",$this->lng->txt("search"));
                $this->tpl->setVariable("BTN_SEARCH_RESULT",$this->lng->txt("search_in_result"));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showHeader (  ) 

Definition at line 479 of file class.ilSearchGUI.php.

References getFolderId().

Referenced by __show().

        {
                if($this->getFolderId() == $this->folder_obj->getRootId())
                {
                        $this->tpl->setVariable("TXT_HEADER",$this->lng->txt("search"));
                }
                else
                {
                        // TODO SHOW TITLE OF SEARCH RESULT
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showLocator (  ) 

Definition at line 491 of file class.ilSearchGUI.php.

References ilFrameTargetInfo::_getFrame().

Referenced by __show().

        {
                $this->tpl->addBlockFile("LOCATOR","locator","tpl.locator.html");


                $this->tpl->setCurrentBlock("locator_item");
                $this->tpl->setVariable("LINK_ITEM","./search.php");
                $this->tpl->setVariable("LINK_TARGET", ilFrameTargetInfo::_getFrame("MainContent"));
                $this->tpl->setVariable("ITEM",$this->lng->txt("mail_search_word"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("locator");
                $this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
                $this->tpl->parseCurrentBlock();

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showResult (  ) 

Definition at line 225 of file class.ilSearchGUI.php.

References $ilBench, $res, __showResultTable(), and search().

Referenced by __show().

        {
                global $ilBench;

                $ilBench->start("Search", "showResult");

                if(!$this->search->getNumberOfResults() && $this->search->getSearchFor())
                {
                        $this->message .= $this->lng->txt("search_no_match")."<br />";
                        return false;
                }
                if($this->search->getResultByType("usr") and ( !$this->res_type or $this->res_type == 'usr'))
                {
                        $this->__showResultTable("usr");
                }
                if($this->search->getResultByType("grp") and ( !$this->res_type or $this->res_type == 'grp'))
                {
                        $this->__showResultTable("grp");
                }
                if($res = $this->search->getResultByType("dbk") and ( !$this->res_type or $this->res_type == 'dbk'))
                {
                        if(count($res["meta"]))
                        {
                                $this->__showResultTable("dbk","meta");
                        }
                        if(count($res["content"]))
                        {
                                $this->__showResultTable("dbk","content");
                        }
                }
                if($res = $this->search->getResultByType("lm") and ( !$this->res_type or $this->res_type == 'lm'))
                {
                        if(count($res["meta"]))
                        {
                                $this->__showResultTable("lm","meta");
                        }
                        if(count($res["content"]))
                        {
                                $ilBench->start("Search", "showResultTable_lm_content");
                                $this->__showResultTable("lm","content");$ilBench->start("Search", "showResultTable_lm_content");
                                $ilBench->stop("Search", "showResultTable_lm_content");
                        }
                }

                $ilBench->stop("Search", "showResult");

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showResultTable ( a_type,
a_search_in_type = '' 
)

Definition at line 292 of file class.ilSearchGUI.php.

References $ilBench, $tbl, __addAction(), __formatDigiLibResult(), __formatGroupResult(), __formatLearningModuleResult(), __formatUserResult(), and search().

Referenced by __showResult().

        {
                global $ilBench;

                // FOR ALL TYPES
                $tbl = new ilTableGUI(0,false);

                #$tpl =& new ilTemplate ("tpl.table.html", true, true);

                #$tpl->addBlockFile(strtoupper($a_type),$a_type,"tpl.table.html");

                $this->__addAction($tbl->getTemplateObject(),$a_type,$a_search_in_type);

                // SWITCH 'usr','dbk','lm','grp'
                switch($a_type)
                {
                        case "usr":
                                $ilBench->start("Search", "showResultTable_usr");
                                $tbl->setTitle($this->lng->txt("search_user"),"icon_usr_b.gif",$this->lng->txt("search_user"));
                                $tbl->setHeaderNames(array("",$this->lng->txt("login"),$this->lng->txt("firstname")
                                                                                   ,$this->lng->txt("lastname"),$this->lng->txt("search_show_result")));
                                $tbl->setHeaderVars(array("","login","firstname","lastname",""),array("res_type" => "usr"));
                                $tbl->setColumnWidth(array("3%","25%","25%","25%","25%"));
                                $tbl->setData(array_values($this->__formatUserResult($this->search->getResultByType("usr"))));
                                $ilBench->stop("Search", "showResultTable_usr");
                                break;

                        case "grp":
                                $ilBench->start("Search", "showResultTable_grp");
                                $tbl->setTitle($this->lng->txt("search_group"),"icon_grp_b.gif",$this->lng->txt("search_group"));
                                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("description"),
                                                                                   $this->lng->txt("search_show_result")));
                                $tbl->setHeaderVars(array("","title","description",""),array("res_type" => "grp"));
                                $tbl->setColumnWidth(array("3%","25%","25%","22%"));
                                $tbl->setData(array_values($this->__formatGroupResult($this->search->getResultByType("grp"))));
                                $ilBench->stop("Search", "showResultTable_grp");
                                break;


                        case "dbk":
                                // SWITCH 'meta','content'
                                switch($a_search_in_type)
                                {
                                        case "meta":
                                                $ilBench->start("Search", "showResultTable_dbk_meta");
                                                $tbl->setTitle($this->lng->txt("search_dbk_meta"),"icon_dbk_b.gif",$this->lng->txt("search_dbk_meta"));
                                                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("context"),
                                                                                                   $this->lng->txt("search_show_result")));
                                                $tbl->setHeaderVars(array("","title","context",""),array("res_type" => "dbk"));

                                                $tbl->setColumnWidth(array("3%","50%","30%","17%"));

                                                $tmp_res = $this->search->getResultByType("dbk");
                                                $tbl->setData($this->__formatDigiLibResult($tmp_res["meta"],"meta"));
                                                $ilBench->stop("Search", "showResultTable_dbk_meta");
                                                break;

                                        case "content":
                                                $ilBench->start("Search", "showResultTable_dbk_content");
                                                $tbl->setTitle($this->lng->txt("search_dbk_content"),"icon_dbk_b.gif",$this->lng->txt("search_dbk_content"));
                                                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("page"),$this->lng->txt("context"),
                                                                                                   $this->lng->txt("search_show_result")));
                                                $tbl->setHeaderVars(array("","title","page","context",""),array("res_type" => "dbk"));

                                                $tbl->setColumnWidth(array("3%","30%","20%","30%","17%"));

                                                $tmp_res = $this->search->getResultByType("dbk");
                                                $tbl->setData($this->__formatDigiLibResult($tmp_res["content"],"content"));
                                                $ilBench->stop("Search", "showResultTable_dbk_content");
                                                break;
                                }
                                break;

                        case "lm":

                                // SWITCH 'meta','content'
                                switch($a_search_in_type)
                                {
                                        case "meta":
                                                $ilBench->start("Search", "showResultTable_lm_meta");
                                                $tbl->setTitle($this->lng->txt("search_lm_meta"),"icon_lm_b.gif",$this->lng->txt("search_lm_meta"));
                                                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("context"),
                                                                                                   $this->lng->txt("search_show_result")));
                                                $tbl->setHeaderVars(array("","title","context",""),array("res_type" => "lm"));

                                                $tbl->setColumnWidth(array("3%","50%","30%","17%"));

                                                $tmp_res = $this->search->getResultByType("lm");
                                                $tbl->setData($this->__formatLearningModuleResult($tmp_res["meta"],"meta"));
                                                $ilBench->stop("Search", "showResultTable_lm_meta");
                                                break;

                                        case "content":
                                                $ilBench->start("Search", "showResultTable_lm_content");
                                                $tbl->setTitle($this->lng->txt("search_lm_content"),"icon_lm_b.gif",$this->lng->txt("search_lm_content"));
                                                $tbl->setHeaderNames(array("",$this->lng->txt("title"),$this->lng->txt("page"),$this->lng->txt("context"),
                                                                                                   $this->lng->txt("search_show_result")));
                                                $tbl->setHeaderVars(array("","title","page","context",""),array("res_type" => "lm"));

                                                $tbl->setColumnWidth(array("3%","30%","20%","30%","17%"));

                                                $tmp_res = $this->search->getResultByType("lm");
                                                $tbl->setData($this->__formatLearningModuleResult($tmp_res["content"],"content"));
                                                $ilBench->stop("Search", "showResultTable_lm_content");
                                                break;
                                }
                                break;
                }
                $tbl->setOrderColumn($this->sort_by);
                $tbl->setOrderDirection($this->sort_order);
                $tbl->disable("sort");
                $tbl->setLimit(RESULT_LIMIT);
                $tbl->setOffset($this->offset);
                $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
                #$tpl->setVariable(strtoupper($a_type),$tbl->render());

                #$tbl->setTemplate($tpl);
                $tbl->render();
                $this->tpl->setVariable(strtoupper($a_type), $tbl->tpl->get());
                unset($tbl);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showSearchInResults (  ) 

Show search in results button.

If search was successful

Returns:
void public

Definition at line 652 of file class.ilSearchGUI.php.

References __getFolderSelect(), and ilUtil::getImagePath().

Referenced by performSearch(), and showSavedResults().

        {
                $this->tpl->setCurrentBlock("search_results");
                $this->tpl->setVariable("BTN_SEARCHRESULTS",$this->lng->txt('search_in_result'));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("save_result");
                $this->tpl->setVariable("DOWNRIGHT",ilUtil::getImagePath('arrow_downright.gif'));
                $this->tpl->setVariable("BTN_SAVE_RESULT",$this->lng->txt('save'));
                $this->tpl->setVariable("SELECT_FOLDER",$this->__getFolderSelect());
                $this->tpl->parseCurrentBlock();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::__showTabs (  ) 

Definition at line 508 of file class.ilSearchGUI.php.

Referenced by __show().

        {
                $this->tpl->addBlockFile("TABS","tabs","tpl.tabs.html");

                // SEARCH ADMINISTRATION
                $this->tpl->setCurrentBlock("tab");
                $this->tpl->setVariable("TAB_TYPE","tabinactive");
                $this->tpl->setVariable("TAB_LINK","search_administration.php");
                $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_search_results"));
                $this->tpl->parseCurrentBlock();

                if($this->res_type)
                {
                        $this->tpl->setCurrentBlock("tab");
                        $this->tpl->setVariable("TAB_TYPE","tabinactive");
                        $this->tpl->setVariable("TAB_LINK","search.php");
                        $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_all_results"));
                        $this->tpl->parseCurrentBlock();
                }

                return true;
        }

Here is the caller graph for this function:

& ilSearchGUI::executeCommand (  ) 

Control public.

Definition at line 128 of file class.ilSearchGUI.php.

References $cmd, $rbacsystem, and prepareOutput().

        {
                global $rbacsystem;

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

                switch($next_class)
                {
                        default:
                                if(!$cmd)
                                {
                                        $cmd = "showSavedResults";
                                }

                                $this->prepareOutput();
                                $this->$cmd();
                                break;
                }
                return true;
        }

Here is the call graph for this function:

ilSearchGUI::getCombination (  ) 

Definition at line 85 of file class.ilSearchGUI.php.

Referenced by __parseQueryString(), and showSearch().

        {
                return $this->combination ? $this->combination : SEARCH_OR;
        }

Here is the caller graph for this function:

ilSearchGUI::getDetails (  ) 

Definition at line 109 of file class.ilSearchGUI.php.

Referenced by __getFilter(), __performDetailsSearch(), performSearch(), and showSearch().

        {
                return $this->details ? $this->details : array();
        }

Here is the caller graph for this function:

ilSearchGUI::getFolderId (  ) 

Definition at line 147 of file class.ilSearchGUI.php.

Referenced by __showHeader().

        {
                return $this->folder_id;
        }

Here is the caller graph for this function:

ilSearchGUI::getRootNode (  ) 

Definition at line 115 of file class.ilSearchGUI.php.

Referenced by performSearch(), showSavedResults(), and showSearch().

        {
                return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
        }

Here is the caller graph for this function:

ilSearchGUI::getString (  ) 

Definition at line 97 of file class.ilSearchGUI.php.

Referenced by __parseQueryString(), and showSearch().

        {
                return $this->string;
        }

Here is the caller graph for this function:

ilSearchGUI::getType (  ) 

Definition at line 73 of file class.ilSearchGUI.php.

Referenced by __searchMeta(), __searchObjects(), performSearch(), and showSearch().

        {
                return $this->type ? $this->type : SEARCH_FAST;
        }

Here is the caller graph for this function:

ilSearchGUI::getUserId (  ) 

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

Referenced by __save().

        {
                return $this->user_id;
        }

Here is the caller graph for this function:

ilSearchGUI::getViewmode (  ) 

Definition at line 170 of file class.ilSearchGUI.php.

        {
                return $this->viewmode;
        }

ilSearchGUI::ilSearchGUI ( a_user_id = 0  ) 

Constructor public.

Definition at line 73 of file class.ilSearchGUI.php.

References $_GET, $ilias, $lng, $tpl, performAction(), search(), setFolderId(), setUserId(), and setViewmode().

        {
                global $ilias,$tpl,$lng;

                // DEFINE SOME CONSTANTS
                #define("RESULT_LIMIT",$ilias->account->getPref("hits_per_page") ? $ilias->account->getPref("hits_per_page") : 3);
                define("RESULT_LIMIT",10);
                // Initiate variables
                $this->ilias    =& $ilias;
                $this->tpl              =& $tpl;
                $this->lng              =& $lng;
                $this->lng->loadLanguageModule("search");


                $this->folder_id  = $_GET["folder_id"];
                $this->res_type   = $_GET["res_type"];
                $this->offset     = $_GET["offset"];
                $this->sort_by    = $_GET["sort_by"];
                $this->sort_order = $_GET["sort_order"];
                
                $this->setFolderId($_GET["folder_id"]);
                $this->setViewmode($_GET["viewmode"]);

                $this->setUserId($a_user_id);

                // INITIATE SEARCH OBJECT
                $this->search =& new ilSearch($a_user_id,true);
                $this->tree = new ilTree(1);

                // INITIATE SEARCH FOLDER OBJECT
                $this->folder_obj =& new ilSearchFolder($a_user_id);

                $this->performAction();
        }

Here is the call graph for this function:

ilSearchGUI::ilSearchGUI (  ) 

Constructor public.

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

References $_POST, $_SESSION, ilSearchBaseGUI::ilSearchBaseGUI(), setCombination(), setDetails(), setString(), and setType().

        {
                $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
                $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
                $this->setCombination($_POST['search']['combination'] ? $_POST['search']['combination'] : $_SESSION['search']['combination']);
                $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
                $this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);

                parent::ilSearchBaseGUI();
        }

Here is the call graph for this function:

ilSearchGUI::performAction (  ) 

Definition at line 108 of file class.ilSearchGUI.php.

References $_POST, __saveResult(), __show(), search(), and searchInResult().

Referenced by ilSearchGUI().

        {
                if(isset($_POST["cmd"]["search"]))
                {
                        $this->search();
                        return true;
                }
                if(isset($_POST["cmd"]["search_res"]))
                {
                        $this->searchInResult();
                        return true;
                }
                if(!isset($_POST["cmd"]))
                {
                        $this->__show();
                        return true;
                }

                // cmd is dbk_content or dbk_meta or lm_content or lm_meta or grp_ or usr
                $this->__saveResult();
                $this->__show();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::performSearch (  ) 

Definition at line 341 of file class.ilSearchGUI.php.

References $message, $result, __parseQueryString(), __performDetailsSearch(), __searchMeta(), __searchObjects(), __showSearchInResults(), getDetails(), getRootNode(), getType(), sendInfo(), and showSearch().

Referenced by searchInResults().

        {
                global $ilUser;

                if($this->getType() == SEARCH_DETAILS and !$this->getDetails())
                {
                        sendInfo($this->lng->txt('search_choose_object_type'));
                        $this->showSearch();

                        return false;
                }

                
                // Step 1: parse query string
                if(!is_object($query_parser =& $this->__parseQueryString()))
                {
                        sendInfo($query_parser);
                        $this->showSearch();
                        
                        return false;
                }
                // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
                $result =& $this->__searchObjects($query_parser);

                // Step 3: perform meta keyword search. Get an MetaDataSearch object.
                $result_meta =& $this->__searchMeta($query_parser,'keyword');
                $result->mergeEntries($result_meta);

                $result_meta =& $this->__searchMeta($query_parser,'contribute');
                $result->mergeEntries($result_meta);
        
                // Perform details search in object specific tables
                if($this->getType() == SEARCH_DETAILS)
                {
                        $result = $this->__performDetailsSearch($query_parser,$result);
                }
                // Step 5: Search in results
                if($this->search_mode == 'in_results')
                {
                        include_once 'Services/Search/classes/class.ilSearchResult.php';

                        $old_result_obj = new ilSearchResult($ilUser->getId());
                        $old_result_obj->read();

                        $result->diffEntriesFromResult($old_result_obj);
                }
                        

                // Step 4: merge and validate results
                $result->filter($this->getRootNode(),$query_parser->getCombination() == 'and');
                $this->showSearch();

                if(!count($result->getResults()))
                {
                        sendInfo($this->lng->txt('search_no_match'));
                }
                else
                {
                        $this->__showSearchInResults();
                }

                if($result->isLimitReached())
                {
                        $message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
                        sendInfo($message);
                }

                // Step 6: show results
                include_once 'Services/Search/classes/class.ilSearchResultPresentationGUI.php';

                $search_result_presentation = new ilSearchResultPresentationGUI($result);
                $this->tpl->setVariable("RESULTS",$search_result_presentation->showResults());

                // Step 7: save as user result
                $result->setUserId($ilUser->getId());
                $result->save();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::prepareOutput (  ) 

Reimplemented from ilSearchBaseGUI.

Definition at line 423 of file class.ilSearchGUI.php.

References ilUtil::getImagePath().

Referenced by executeCommand().

        {
                parent::prepareOutput();

                $this->tpl->setCurrentBlock("header_image");
                $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_src_b.gif"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setVariable("TXT_HEADER",$this->lng->txt('search'));

                $this->tpl->addBlockFile("TABS","tabs","tpl.tabs.html");

                $this->tpl->setCurrentBlock("tab");
                $this->tpl->setVariable("TAB_TYPE","tabactive");
                $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTarget($this));
                $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("tab");
                $this->tpl->setVariable("TAB_TYPE","tabinactive");
                $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
                $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_advanced"));
                $this->tpl->parseCurrentBlock();

                $this->tpl->setCurrentBlock("tab");
                $this->tpl->setVariable("TAB_TYPE","tabinactive");
                $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilsearchresultgui'));
                $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_search_results"));
                $this->tpl->parseCurrentBlock();
                
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::saveResult (  ) 

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

References $_POST, $folder_obj, $ref_id, $title, ilObject::_lookupObjId(), ilObject::_lookupTitle(), ilObject::_lookupType(), sendInfo(), and showSavedResults().

        {
                include_once 'Services/Search/classes/class.ilUserResult.php';
                include_once 'Services/Search/classes/class.ilSearchFolder.php';

                global $ilUser;

                if(!$_POST['folder'])
                {
                        sendInfo($this->lng->txt('search_select_one'));
                        $this->showSavedResults();

                        return false;
                }
                if(!count($_POST['id']))
                {
                        sendInfo($this->lng->txt('search_select_one_result'));
                        $this->showSavedResults();

                        return false;
                }

                $folder_obj =& new ilSearchFolder($ilUser->getId(),(int) $_POST['folder']);

                foreach($_POST['id'] as $ref_id)
                {
                        $title = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
                        $target = addslashes(serialize(array('type' => ilObject::_lookupType(ilObject::_lookupObjId($ref_id)),
                                                                                                 'id'   => $ref_id)));

                        $search_res_obj =& new ilUserResult($ilUser->getId());
                        $search_res_obj->setTitle($title);
                        $search_res_obj->setTarget($target);

                        $folder_obj->assignResult($search_res_obj);
                        unset($search_res_obj);
                }
                sendInfo($this->lng->txt('search_results_saved'));
                $this->showSavedResults();

        }

Here is the call graph for this function:

ilSearchGUI::search ( a_search_type = 'new'  ) 

Definition at line 175 of file class.ilSearchGUI.php.

References $_POST, $ilBench, and __show().

Referenced by __save(), __show(), __showResult(), __showResultTable(), ilSearchGUI(), performAction(), and searchInResult().

        {
                global $ilBench;

                $ilBench->start("Search", "search");
                $this->search->setSearchString($_POST["search_str"]);
                $this->search->setCombination($_POST["combination"]);
                $this->search->setSearchFor($_POST["search_for"]);
                $this->search->setSearchIn($_POST["search_in"]);
                $this->search->setSearchType($a_search_type);
                if($this->search->validate($this->message))
                {
                        $this->search->performSearch();
                }
                // TEMP MESSAGE
                $this->offset = 0;
                $this->__show();
                $ilBench->stop("Search", "search");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::searchInResult (  ) 

Definition at line 195 of file class.ilSearchGUI.php.

References search().

Referenced by performAction().

        {
                $this->search("result");
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::searchInResults (  ) 

Definition at line 332 of file class.ilSearchGUI.php.

References performSearch().

        {
                $this->search_mode = 'in_results';
                $this->performSearch();

                return true;
        }

Here is the call graph for this function:

ilSearchGUI::selectRoot (  ) 

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

References $_GET, setRootNode(), and showSavedResults().

        {
                $this->setRootNode((int) $_GET['root_id']);
                $this->showSavedResults();

                return true;
        }

Here is the call graph for this function:

ilSearchGUI::setCombination ( a_combination  ) 

Set/get combination of search ('and' or 'or') public.

Definition at line 81 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by ilSearchGUI().

        {
                $_SESSION['search']['combination'] = $this->combination = $a_combination;
        }

Here is the caller graph for this function:

ilSearchGUI::setDetails ( a_details  ) 

Set/get details (object types for details search) public.

Definition at line 105 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by ilSearchGUI().

        {
                $_SESSION['search']['details'] = $this->details = $a_details;
        }

Here is the caller graph for this function:

ilSearchGUI::setFolderId ( a_folder_id  ) 

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

Referenced by ilSearchGUI().

        {
                $this->folder_id = $a_folder_id ? $a_folder_id : 1;
        }

Here is the caller graph for this function:

ilSearchGUI::setRootNode ( a_node_id  ) 

Definition at line 119 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by selectRoot().

        {
                $_SESSION['search_root'] = $this->root_node = $a_node_id;
        }

Here is the caller graph for this function:

ilSearchGUI::setString ( a_str  ) 

Set/get search string public.

Definition at line 93 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by ilSearchGUI().

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

Here is the caller graph for this function:

ilSearchGUI::setType ( a_type  ) 

Set/get type of search (detail or 'fast' search) public.

Definition at line 69 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by ilSearchGUI().

        {
                $_SESSION['search']['type'] = $this->type = $a_type;
        }

Here is the caller graph for this function:

ilSearchGUI::setUserId ( a_user_id  ) 

Definition at line 134 of file class.ilSearchGUI.php.

Referenced by ilSearchGUI().

        {
                $this->user_id = $a_user_id;
        }

Here is the caller graph for this function:

ilSearchGUI::setViewmode ( a_viewmode  ) 

Definition at line 151 of file class.ilSearchGUI.php.

References $_SESSION.

Referenced by ilSearchGUI().

        {
                switch($a_viewmode)
                {
                        case "flat":
                                $this->viewmode = "flat";
                                $_SESSION["s_viewmode"] = "flat";
                                break;

                        case "tree":
                                $this->viewmode = "tree";
                                $_SESSION["s_viewmode"] = "tree";
                                break;
                                
                        default:
                                $this->viewmode = $_SESSION["s_viewmode"] ? $_SESSION["s_viewmode"] : "flat";
                                break;
                }
        }

Here is the caller graph for this function:

ilSearchGUI::showSavedResults (  ) 

Definition at line 305 of file class.ilSearchGUI.php.

References __showSearchInResults(), getRootNode(), and showSearch().

Referenced by saveResult(), and selectRoot().

        {
                global $ilUser;

                // Read old result sets
                include_once 'Services/Search/classes/class.ilSearchResult.php';
        
                $result_obj = new ilSearchResult($ilUser->getId());
                $result_obj->read();
                $result_obj->filterResults($this->getRootNode());

                $this->showSearch();

                // Show them
                if(count($result_obj->getResults()))
                {
                        $this->__showSearchInResults();

                        include_once 'Services/Search/classes/class.ilSearchResultPresentationGUI.php';
                        
                        $search_result_presentation = new ilSearchResultPresentationGUI($result_obj);
                        $this->tpl->setVariable("RESULTS",$search_result_presentation->showResults());
                }

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::showSearch (  ) 

Definition at line 193 of file class.ilSearchGUI.php.

References ilObject::_lookupObjId(), ilObject::_lookupTitle(), ilUtil::formCheckbox(), ilUtil::formRadioButton(), getCombination(), getDetails(), getRootNode(), getString(), getType(), and ilUtil::prepareFormOutput().

Referenced by performSearch(), and showSavedResults().

        {
                global $ilLocator;
/*
                $ilLocator->addItem($this->lng->txt('search'),
                        $this->ctrl->getLinkTarget($this));
                $this->tpl->setLocator();
*/

                $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search.html','Services/Search');

                $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('search'));
                $this->tpl->setVariable("TXT_SEARCHAREA",$this->lng->txt('search_area'));
                $this->tpl->setVariable("SEARCH_ACTION",$this->ctrl->getFormAction($this));
                $this->tpl->setVariable("TXT_SEARCHTERM",$this->lng->txt("search_search_term"));
                $this->tpl->setVariable("TXT_AND",$this->lng->txt('search_all_words'));
                $this->tpl->setVariable("TXT_OR",$this->lng->txt('search_any_word'));
                $this->tpl->setVariable("BTN_SEARCH",$this->lng->txt('search'));

                // Check 'or' as default
                if($this->getCombination() == SEARCH_AND)
                {
                        $this->tpl->setVariable("AND_CHECKED",'checked=checked');
                }
                else
                {
                        $this->tpl->setVariable("OR_CHECKED",'checked=checked');
                }
                // Set old query string
                $this->tpl->setVariable("FORM_SEARCH_STR",ilUtil::prepareFormOutput($this->getString(),true));

                $this->tpl->setVariable("HREF_UPDATE_AREA",$this->ctrl->getLinkTarget($this,'showSelectRoot'));
                $this->tpl->setVariable("UPDATE_AREA",$this->lng->txt('search_change'));

                // SEARCHTYPE
                $this->tpl->setVariable("TXT_SEARCH_TYPE",$this->lng->txt('search_type'));
                $this->tpl->setVariable("INFO_FAST",$this->lng->txt('search_fast_info'));
                $this->tpl->setVariable("INFO_DETAILS",$this->lng->txt('search_details_info'));

                $this->tpl->setVariable("CHECK_FAST",ilUtil::formRadioButton($this->getType() == SEARCH_FAST ? 1 : 0,
                                                                                                                                         'search[type]',
                                                                                                                                         SEARCH_FAST ));

                $this->tpl->setVariable("CHECK_DETAILS",ilUtil::formRadioButton($this->getType() == SEARCH_DETAILS ? 1 : 0,
                                                                                                                                         'search[type]',
                                                                                                                                         SEARCH_DETAILS));
                // SEARCH DETAILS
                $this->tpl->setVariable("LMS",$this->lng->txt('learning_resources'));
                $this->tpl->setVariable("GLO",$this->lng->txt('objs_glo'));
                $this->tpl->setVariable("MEP",$this->lng->txt('objs_mep'));
                $this->tpl->setVariable("TST",$this->lng->txt('search_tst_svy'));
                $this->tpl->setVariable("FOR",$this->lng->txt('objs_frm'));
                $this->tpl->setVariable("EXC",$this->lng->txt('objs_exc'));
                $this->tpl->setVariable("FIL",$this->lng->txt('objs_file'));

                
                $details = $this->getDetails();
                $this->tpl->setVariable("CHECK_GLO",ilUtil::formCheckbox($details['glo'] ? 1 : 0,'search[details][glo]',1));
                $this->tpl->setVariable("CHECK_LMS",ilUtil::formCheckbox($details['lms'] ? 1 : 0,'search[details][lms]',1));
                $this->tpl->setVariable("CHECK_MEP",ilUtil::formCheckbox($details['mep'] ? 1 : 0,'search[details][mep]',1));
                $this->tpl->setVariable("CHECK_TST",ilUtil::formCheckbox($details['tst'] ? 1 : 0,'search[details][tst]',1));
                $this->tpl->setVariable("CHECK_FOR",ilUtil::formCheckbox($details['frm'] ? 1 : 0,'search[details][frm]',1));
                $this->tpl->setVariable("CHECK_EXC",ilUtil::formCheckbox($details['exc'] ? 1 : 0,'search[details][exc]',1));
                $this->tpl->setVariable("CHECK_FIL",ilUtil::formCheckbox($details['fil'] ? 1 : 0,'search[details][fil]',1));



                // SEARCHAREA
                if($this->getRootNode() == ROOT_FOLDER_ID)
                {
                        $this->tpl->setVariable("SEARCHAREA",$this->lng->txt('search_in_magazin'));
                }
                else
                {
                        $text = $this->lng->txt('search_below')." '";
                        $text .= ilObject::_lookupTitle(ilObject::_lookupObjId($this->getRootNode()));
                        $text .= "'";
                        $this->tpl->setVariable("SEARCHAREA",$text);
                }

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilSearchGUI::showSelectRoot (  ) 

Definition at line 276 of file class.ilSearchGUI.php.

References $_GET, $exp, $tree, and sendInfo().

        {
                global $tree;

                $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search_root_selector.html','Services/Search');

                include_once 'Services/Search/classes/class.ilSearchRootSelector.php';

                sendInfo($this->lng->txt('search_area_info'));

                $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this,'showSelectRoot'));
                $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
                $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showSelectRoot'));

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

                $this->tpl->setVariable("EXPLORER",$exp->getOutput());
        }

Here is the call graph for this function:


Field Documentation

ilSearchGUI::$combination

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

ilSearchGUI::$folder_id

Definition at line 63 of file class.ilSearchGUI.php.

ilSearchGUI::$folder_obj

Definition at line 64 of file class.ilSearchGUI.php.

Referenced by __getFolderSelect(), and saveResult().

ilSearchGUI::$ilias

Reimplemented from ilSearchBaseGUI.

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

Referenced by ilSearchGUI().

ilSearchGUI::$lng

Reimplemented from ilSearchBaseGUI.

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

Referenced by ilSearchGUI().

ilSearchGUI::$message

Definition at line 67 of file class.ilSearchGUI.php.

Referenced by performSearch().

ilSearchGUI::$offset

Definition at line 58 of file class.ilSearchGUI.php.

ilSearchGUI::$res_type

Definition at line 57 of file class.ilSearchGUI.php.

ilSearchGUI::$root_node

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

ilSearchGUI::$search

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

ilSearchGUI::$sort_by

Definition at line 59 of file class.ilSearchGUI.php.

ilSearchGUI::$sort_order

Definition at line 60 of file class.ilSearchGUI.php.

ilSearchGUI::$string

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

ilSearchGUI::$tpl

Reimplemented from ilSearchBaseGUI.

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

Referenced by __addAction(), and ilSearchGUI().

ilSearchGUI::$tree

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

Referenced by showSelectRoot().

ilSearchGUI::$type

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

Referenced by __performDetailsSearch(), and __saveResult().

ilSearchGUI::$user_id

Definition at line 62 of file class.ilSearchGUI.php.

ilSearchGUI::$viewmode

Definition at line 65 of file class.ilSearchGUI.php.


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