ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSearchResultPresentationGUI Class Reference
+ Inheritance diagram for ilSearchResultPresentationGUI:
+ Collaboration diagram for ilSearchResultPresentationGUI:

Public Member Functions

 ilSearchResultPresentationGUI (&$result)
showResults ()
renderItemList (&$results)
 addHeaderRow (&$a_tpl, $a_type)
 adds a header row to a block template
 resetRowType ()
 addStandardRow (&$a_tpl, $a_html, $a_ref_id)
 adds a standard row to a block template
newBlockTemplate ()
 returns a new list block template
 addSeparatorRow (&$a_tpl)
 __appendChildLinks ($html, $item, &$item_list_gui)

Data Fields

 $tpl
 $lng
 $result = 0

Protected Attributes

 $search_cache = null

Detailed Description

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

Member Function Documentation

ilSearchResultPresentationGUI::__appendChildLinks (   $html,
  $item,
$item_list_gui 
)

Definition at line 222 of file class.ilSearchResultPresentationGUI.php.

References $tpl, ilLink\_getLink(), ilGlossaryTerm\_lookGlossaryTerm(), ilObjForum\_lookupThreadSubject(), ilLMObject\_lookupTitle(), ilNewsItem\_lookupTitle(), ilLMObject\_lookupType(), ilWikiPage\lookupTitle(), and ilWikiUtil\makeUrlTitle().

Referenced by renderItemList(), and ilShopResultPresentationGUI\renderItems().

{
if(!count($item['child']))
{
return $html;
}
$tpl = new ilTemplate('tpl.detail_links.html',true,true,'Services/Search');
$tpl->setVariable("HITS",$this->lng->txt('search_hits'));
switch($item['type'])
{
case 'lm':
include_once 'Modules/LearningModule/classes/class.ilLMObject.php';
foreach($item['child'] as $child)
{
$tpl->setCurrentBlock("link_row");
switch(ilLMObject::_lookupType($child))
{
case 'pg':
$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('obj_pg'));
break;
case 'st':
$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('obj_st'));
break;
}
$item_list_gui->setChildId($child);
$tpl->setVariable("SEPERATOR",' -> ');
$tpl->setVariable("LINK",$item_list_gui->getCommandLink('page'));
$tpl->setVariable("TARGET",$item_list_gui->getCommandFrame('page'));
$tpl->setVariable("TITLE",ilLMObject::_lookupTitle($child));
$tpl->parseCurrentBlock();
}
break;
case 'frm':
include_once './Modules/Forum/classes/class.ilObjForum.php';
foreach($item['child'] as $child)
{
$thread_post = explode('_',$child);
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('thread'));
$item_list_gui->setChildId($thread_post);
$tpl->setVariable("SEPERATOR",': ');
$tpl->setVariable("LINK",$item_list_gui->getCommandLink('posting'));
$tpl->setVariable("TARGET",$item_list_gui->getCommandFrame(''));
$tpl->setVariable("TITLE",ilObjForum::_lookupThreadSubject($thread_post[0]));
$tpl->parseCurrentBlock();
}
break;
case 'glo':
include_once './Modules/Glossary/classes/class.ilGlossaryTerm.php';
$this->lng->loadLanguageModule('content');
foreach($item['child'] as $child)
{
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('cont_term'));
$tpl->setVariable("SEPERATOR",': ');
$tpl->setVariable("LINK",ilLink::_getLink($item['ref_id'],'git',array('target' => 'git_'.$child.'_'.$item['ref_id'])));
$tpl->setVariable("TITLE",ilGlossaryTerm::_lookGlossaryTerm($child));
$tpl->parseCurrentBlock();
}
break;
case 'wiki':
include_once './Modules/Wiki/classes/class.ilWikiPage.php';
include_once './Modules/Wiki/classes/class.ilWikiUtil.php';
$this->lng->loadLanguageModule('wiki');
foreach($item['child'] as $child)
{
$page_title = ilWikiPage::lookupTitle($child);
$tpl->setCurrentBlock("link_row");
$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('wiki_page'));
$tpl->setVariable("SEPERATOR",': ');
$tpl->setVariable("LINK",ilLink::_getLink($item['ref_id'],'wiki',array(), "_".
ilWikiUtil::makeUrlTitle($page_title)));
$tpl->setVariable("TITLE", $page_title);
$tpl->parseCurrentBlock();
}
break;
case 'mcst':
include_once("./Services/News/classes/class.ilNewsItem.php");
foreach($item['child'] as $child)
{
$tpl->setCurrentBlock("link_row");
//$tpl->setVariable("CHAPTER_PAGE",$this->lng->txt('item'));
$item_list_gui->setChildId($child);
//$tpl->setVariable("SEPERATOR",': ');
$tpl->setVariable("LINK", $item_list_gui->getCommandLink('listItems'));
$tpl->setVariable("TARGET", $item_list_gui->getCommandFrame(''));
$tpl->setVariable("TITLE", ilNewsItem::_lookupTitle($child));
$tpl->parseCurrentBlock();
}
break;
default:
;
}
return $html . $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchResultPresentationGUI::addHeaderRow ( $a_tpl,
  $a_type 
)

adds a header row to a block template

Parameters
object$a_tplblock template
string$a_typeobject type private

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

References $title, and ilUtil\getImagePath().

Referenced by renderItemList(), and ilShopResultPresentationGUI\renderItems().

{
if ($a_type != "lres")
{
$icon = ilUtil::getImagePath("icon_".$a_type.".gif");
$title = $this->lng->txt("objs_".$a_type);
}
else
{
$icon = ilUtil::getImagePath("icon_lm.gif");
$title = $this->lng->txt("learning_resources");
}
$a_tpl->setCurrentBlock("container_header_row_image");
$a_tpl->setVariable("HEADER_IMG", $icon);
$a_tpl->setVariable("HEADER_ALT", $title);
$a_tpl->setVariable("BLOCK_HEADER_CONTENT", $title);
$a_tpl->parseCurrentBlock();
#$a_tpl->setCurrentBlock("container_header_row");
#$a_tpl->parseCurrentBlock();
#$a_tpl->touchBlock("container_row");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchResultPresentationGUI::addSeparatorRow ( $a_tpl)

Definition at line 216 of file class.ilSearchResultPresentationGUI.php.

Referenced by renderItemList(), and ilShopResultPresentationGUI\renderItems().

{
$a_tpl->touchBlock("separator_row");
$a_tpl->touchBlock("container_row");
}

+ Here is the caller graph for this function:

ilSearchResultPresentationGUI::addStandardRow ( $a_tpl,
  $a_html,
  $a_ref_id 
)

adds a standard row to a block template

Parameters
object$a_tplblock template
string$a_htmlhtml code private

Reimplemented in ilShopResultPresentationGUI.

Definition at line 184 of file class.ilSearchResultPresentationGUI.php.

References ilUtil\formCheckbox().

Referenced by renderItemList().

{
$this->cur_row_type = ($this->cur_row_type == "row_type_1")
? "row_type_2"
: "row_type_1";
$a_tpl->touchBlock($this->cur_row_type);
$a_tpl->setCurrentBlock("container_standard_row");
$a_tpl->setVariable("BLOCK_ROW_CONTENT", $a_html);
// add checkbox for saving results
$a_tpl->setVariable("BLOCK_ROW_CHECK",ilUtil::formCheckbox(0,'result[]',$a_ref_id));
$a_tpl->setVariable("ITEM_ID",$a_ref_id);
$a_tpl->parseCurrentBlock();
$a_tpl->touchBlock("container_row");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchResultPresentationGUI::ilSearchResultPresentationGUI ( $result)

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

References $ilCtrl, $lng, $result, $tpl, and ilUserSearchCache\_getInstance().

{
global $tpl,$lng,$ilCtrl,$ilUser;
$this->lng =& $lng;
$this->result =& $result;
$this->type_ordering = array(
"cat", "crs", "grp", "chat", "frm", "wiki", "lres",
"glo", "webr", "file",'mcst', "exc",
"tst", "svy", "sess","mep", "qpl", "spl");
$this->ctrl =& $ilCtrl;
include_once('Services/Search/classes/class.ilUserSearchCache.php');
$this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
}

+ Here is the call graph for this function:

& ilSearchResultPresentationGUI::newBlockTemplate ( )

returns a new list block template

private

Returns
object block template

Definition at line 207 of file class.ilSearchResultPresentationGUI.php.

References $tpl.

Referenced by renderItemList(), and ilShopResultPresentationGUI\renderItems().

{
$tpl =& new ilTemplate ("tpl.container_list_block.html",true, true,
"Services/Container");
$this->cur_row_type = "row_type_1";
return $tpl;
}

+ Here is the caller graph for this function:

& ilSearchResultPresentationGUI::renderItemList ( $results)

Definition at line 75 of file class.ilSearchResultPresentationGUI.php.

References $ref_id, $results, $tpl, __appendChildLinks(), ilSearchObjectListFactory\_getInstance(), addHeaderRow(), addSeparatorRow(), addStandardRow(), newBlockTemplate(), and resetRowType().

Referenced by showResults().

{
global $objDefinition;
$html = '';
$cur_obj_type = "";
$tpl =& $this->newBlockTemplate();
$first = true;
foreach($this->type_ordering as $act_type)
{
$item_html = array();
if (is_array($results[$act_type]))
{
foreach($results[$act_type] as $key => $item)
{
// get list gui class for each object type
if ($cur_obj_type != $item["type"])
{
include_once 'Services/Search/classes/class.ilSearchObjectListFactory.php';
$item_list_gui = ilSearchObjectListFactory::_getInstance($item['type']);
}
$html = $item_list_gui->getListItemHTML(
$item["ref_id"],
$item["obj_id"],
$item["title"],
$item["description"]);
if($html)
{
$html = $this->__appendChildLinks($html,$item,$item_list_gui);
$item_html[$item["ref_id"]] = $html;
}
}
// output block for resource type
if(count($item_html) > 0)
{
// separator row
if (!$first)
{
}
$first = false;
// add a header for each resource type
$this->addHeaderRow($tpl, $act_type);
$this->resetRowType();
// content row
foreach($item_html as $ref_id => $html)
{
$this->addStandardRow($tpl, $html, $ref_id);
}
}
}
}
return $tpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSearchResultPresentationGUI::resetRowType ( )

Definition at line 172 of file class.ilSearchResultPresentationGUI.php.

Referenced by renderItemList(), and ilShopResultPresentationGUI\renderItems().

{
$this->cur_row_type = "";
}

+ Here is the caller graph for this function:

& ilSearchResultPresentationGUI::showResults ( )

Reimplemented in ilShopResultPresentationGUI.

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

References $results, and renderItemList().

{
// Get results
$results = $this->result->getResultsForPresentation();
return $html =& $this->renderItemList($results);
}

+ Here is the call graph for this function:

Field Documentation

ilSearchResultPresentationGUI::$lng
ilSearchResultPresentationGUI::$search_cache = null
protected

Definition at line 39 of file class.ilSearchResultPresentationGUI.php.


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