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= '') | |
Data Fields | |
$ilias | |
$search | |
$tpl | |
$lng | |
$tree | |
$res_type | |
$offset | |
$sort_by | |
$sort_order | |
$user_id | |
$folder_id | |
$folder_obj | |
$viewmode | |
$message |
Definition at line 37 of file class.ilSearchGUI.php.
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(); }
ilSearchGUI::__formatDigiLibResult | ( | $ | a_res, | |
$ | a_search_in | |||
) |
Definition at line 612 of file class.ilSearchGUI.php.
References $counter, __formatLink(), __getContextPath(), ilObjContentObject::_getLinkToObject(), 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(); }
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(); }
ilSearchGUI::__formatLearningModuleResult | ( | $ | a_res, | |
$ | a_search_in | |||
) |
Definition at line 683 of file class.ilSearchGUI.php.
References $counter, __formatLink(), __getContextPath(), ilObjContentObject::_getLinkToObject(), 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(); }
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"); }
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(); }
ilSearchGUI::__getContextPath | ( | $ | a_endnode_id, | |
$ | a_startnode_id = 1 | |||
) |
Definition at line 755 of file class.ilSearchGUI.php.
References $path.
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; }
ilSearchGUI::__getFolderSelect | ( | $ | a_type, | |
$ | a_search_in_type = '' | |||
) |
Definition at line 201 of file class.ilSearchGUI.php.
References formSelect().
Referenced by __addAction().
{ $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 .= " "; } $options[$node["obj_id"]] = $prefix.$node["title"]; } return $select_str = ilUtil::formSelect(0,$a_type."_".$a_search_in_type,$options,false,true); }
ilSearchGUI::__save | ( | $ | a_type, | |
$ | a_subtype = '' | |||
) |
Definition at line 848 of file class.ilSearchGUI.php.
References $_POST, 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"); }
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); } }
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")); }
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 } }
ilSearchGUI::__showLocator | ( | ) |
Definition at line 491 of file class.ilSearchGUI.php.
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","bottom"); $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(); }
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"); }
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); }
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; }
ilSearchGUI::getFolderId | ( | ) |
Definition at line 147 of file class.ilSearchGUI.php.
Referenced by __showHeader().
{
return $this->folder_id;
}
ilSearchGUI::getUserId | ( | ) |
Definition at line 138 of file class.ilSearchGUI.php.
Referenced by __save().
{
return $this->user_id;
}
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(); }
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; }
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"); }
ilSearchGUI::searchInResult | ( | ) |
Definition at line 195 of file class.ilSearchGUI.php.
References search().
Referenced by performAction().
{ $this->search("result"); }
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; }
ilSearchGUI::setUserId | ( | $ | a_user_id | ) |
Definition at line 134 of file class.ilSearchGUI.php.
Referenced by ilSearchGUI().
{ $this->user_id = $a_user_id; }
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; } }
ilSearchGUI::$folder_id |
Definition at line 63 of file class.ilSearchGUI.php.
ilSearchGUI::$folder_obj |
Definition at line 64 of file class.ilSearchGUI.php.
ilSearchGUI::$ilias |
Definition at line 44 of file class.ilSearchGUI.php.
Referenced by ilSearchGUI().
ilSearchGUI::$lng |
Definition at line 53 of file class.ilSearchGUI.php.
Referenced by ilSearchGUI().
ilSearchGUI::$message |
Definition at line 67 of file class.ilSearchGUI.php.
ilSearchGUI::$offset |
Definition at line 58 of file class.ilSearchGUI.php.
ilSearchGUI::$res_type |
Definition at line 57 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::$tpl |
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.
ilSearchGUI::$user_id |
Definition at line 62 of file class.ilSearchGUI.php.
ilSearchGUI::$viewmode |
Definition at line 65 of file class.ilSearchGUI.php.