Public Member Functions | Data Fields

ilSearchResultPresentationGUI Class Reference

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

Detailed Description

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


Member Function Documentation

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

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

References $tpl, ilObjForum::_lookupThreadSubject(), ilLMObject::_lookupTitle(), and ilLMObject::_lookupType().

Referenced by renderItemList().

        {
                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 'content/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 '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;

                        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_tpl block template
string $a_type object type private

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

References $title, and ilUtil::getImagePath().

Referenced by renderItemList().

        {
                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 208 of file class.ilSearchResultPresentationGUI.php.

Referenced by renderItemList().

        {
                $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_tpl block template
string $a_html html code private

Definition at line 177 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 43 of file class.ilSearchResultPresentationGUI.php.

References $ilCtrl, $lng, $result, and $tpl.

        {
                global $tpl,$lng,$ilCtrl;

                $this->lng =& $lng;
                
                $this->result =& $result;

                $this->type_ordering = array(
                        "cat", "crs", "grp", "chat", "frm", "lres",
                        "glo", "webr", "file", "exc",
                        "tst", "svy", "mep", "qpl", "spl");

                $this->ctrl =& $ilCtrl;
        }

& ilSearchResultPresentationGUI::newBlockTemplate (  ) 

returns a new list block template

private

Returns:
object block template

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

References $tpl.

Referenced by renderItemList().

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

                return $tpl;
        }

Here is the caller graph for this function:

& ilSearchResultPresentationGUI::renderItemList ( &$  results  ) 

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

References $key, $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)
                                        {
                                                $this->addSeparatorRow($tpl);
                                        }
                                        $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 165 of file class.ilSearchResultPresentationGUI.php.

Referenced by renderItemList().

        {
                $this->cur_row_type = "";
        }

Here is the caller graph for this function:

& ilSearchResultPresentationGUI::showResults (  ) 

Definition at line 59 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::$result = 0
ilSearchResultPresentationGUI::$tpl

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