• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/Search/classes/class.ilSearchBaseGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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 ?>

Generated on Fri Dec 13 2013 17:57:01 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1