Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00035 include_once 'Services/Search/classes/class.ilSearchSettings.php';
00036
00037 class ilSearchBaseGUI
00038 {
00039 var $settings = null;
00040
00041 protected $ctrl = null;
00042 var $ilias = null;
00043 var $lng = null;
00044 var $tpl = null;
00045
00050 function ilSearchBaseGUI()
00051 {
00052 global $ilCtrl,$ilias,$lng,$tpl,$ilMainMenu;
00053
00054 $this->ilias =& $ilias;
00055 $this->ctrl =& $ilCtrl;
00056 $this->tpl =& $tpl;
00057 $this->lng =& $lng;
00058 $this->lng->loadLanguageModule('search');
00059
00060 $ilMainMenu->setActive('search');
00061 $this->settings =& new ilSearchSettings();
00062 }
00063
00064 function prepareOutput()
00065 {
00066 $this->tpl->addBlockFile("CONTENT", "content", "tpl.search_base.html",'Services/Search');
00067 $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
00068 ilUtil::infoPanel();
00069
00070 }
00071
00079 protected function addPager($result,$a_session_key)
00080 {
00081 global $tpl;
00082
00083 $_SESSION["$a_session_key"] = max($_SESSION["$a_session_key"],$this->search_cache->getResultPageNumber());
00084
00085 if($_SESSION["$a_session_key"] == 1 and
00086 (count($result->getResults()) < $result->getMaxHits()))
00087 {
00088 return true;
00089 }
00090
00091 if($this->search_cache->getResultPageNumber() > 1)
00092 {
00093 $this->ctrl->setParameter($this,'page_number',$this->search_cache->getResultPageNumber() - 1);
00094 $this->tpl->setCurrentBlock('prev');
00095 $this->tpl->setVariable('PREV_LINK',$this->ctrl->getLinkTarget($this,'performSearch'));
00096 $this->tpl->setVariable('TXT_PREV',$this->lng->txt('search_page_prev'));
00097 $this->tpl->parseCurrentBlock();
00098 }
00099 for($i = 1;$i <= $_SESSION["$a_session_key"];$i++)
00100 {
00101 if($i == $this->search_cache->getResultPageNumber())
00102 {
00103 $this->tpl->setCurrentBlock('pages_link');
00104 $this->tpl->setVariable('NUMBER',$i);
00105 $this->tpl->parseCurrentBlock();
00106 continue;
00107 }
00108
00109 $this->ctrl->setParameter($this,'page_number',$i);
00110 $link = '<a href="'.$this->ctrl->getLinkTarget($this,'performSearch').'" /a>'.$i.'</a> ';
00111 $this->tpl->setCurrentBlock('pages_link');
00112 $this->tpl->setVariable('NUMBER',$link);
00113 $this->tpl->parseCurrentBlock();
00114 }
00115
00116
00117 if(count($result->getResults()) >= $result->getMaxHits())
00118 {
00119 $this->tpl->setCurrentBlock('next');
00120 $this->ctrl->setParameter($this,'page_number',$this->search_cache->getResultPageNumber() + 1);
00121 $this->tpl->setVariable('NEXT_LINK',$this->ctrl->getLinkTarget($this,'performSearch'));
00122 $this->tpl->setVariable('TXT_NEXT',$this->lng->txt('search_page_next'));
00123 $this->tpl->parseCurrentBlock();
00124 }
00125
00126 $this->tpl->setCurrentBlock('prev_next');
00127 $this->tpl->setVariable('SEARCH_PAGE',$this->lng->txt('search_page'));
00128 $this->tpl->parseCurrentBlock();
00129
00130 $this->ctrl->clearParameters($this);
00131 }
00132
00133 }
00134 ?>