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

Services/Search/classes/class.ilSearchGUI.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.ilSearchBaseGUI.php';
00036 
00037 define('SEARCH_FAST',1);
00038 define('SEARCH_DETAILS',2);
00039 define('SEARCH_AND','and');
00040 define('SEARCH_OR','or');
00041 
00042 class ilSearchGUI extends ilSearchBaseGUI
00043 {
00044         protected $search_cache = null;
00045         
00046         var $root_node;
00047         var $combination;
00048         var $string;
00049         var $type;
00050 
00055         function ilSearchGUI()
00056         {
00057                 global $ilUser;
00058                 
00059                 $this->root_node = $_SESSION['search_root'] ? $_SESSION['search_root'] : ROOT_FOLDER_ID;
00060                 $this->setType($_POST['search']['type'] ? $_POST['search']['type'] : $_SESSION['search']['type']);
00061                 $this->setCombination($_POST['search']['combination'] ? $_POST['search']['combination'] : $_SESSION['search']['combination']);
00062                 $this->setString($_POST['search']['string'] ? $_POST['search']['string'] : $_SESSION['search']['string']);
00063                 $this->setDetails($_POST['search']['details'] ? $_POST['search']['details'] : $_SESSION['search']['details']);
00064                 
00065                 parent::ilSearchBaseGUI();
00066         }
00067 
00068 
00073         function setType($a_type)
00074         {
00075                 $_SESSION['search']['type'] = $this->type = $a_type;
00076         }
00077         function getType()
00078         {
00079                 return $this->type ? $this->type : SEARCH_FAST;
00080         }
00085         function setCombination($a_combination)
00086         {
00087                 $_SESSION['search']['combination'] = $this->combination = $a_combination;
00088         }
00089         function getCombination()
00090         {
00091                 return $this->combination ? $this->combination : SEARCH_OR;
00092         }
00097         function setString($a_str)
00098         {
00099                 $_SESSION['search']['string'] = $this->string = $a_str;
00100         }
00101         function getString()
00102         {
00103                 return $this->string;
00104         }
00109         function setDetails($a_details)
00110         {
00111                 $_SESSION['search']['details'] = $this->details = $a_details;
00112         }
00113         function getDetails()
00114         {
00115                 return $this->details ? $this->details : array();
00116         }
00117 
00118                 
00119         function getRootNode()
00120         {
00121                 return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
00122         }
00123         function setRootNode($a_node_id)
00124         {
00125                 $_SESSION['search_root'] = $this->root_node = $a_node_id;
00126         }
00127                 
00132         function &executeCommand()
00133         {
00134                 global $rbacsystem;
00135 
00136 
00137                 $next_class = $this->ctrl->getNextClass($this);
00138                 $cmd = $this->ctrl->getCmd();
00139 
00140                 switch($next_class)
00141                 {
00142                         default:
00143                                 $this->initUserSearchCache();
00144                                 if(!$cmd)
00145                                 {
00146                                         $cmd = "showSavedResults";
00147                                 }
00148                                 $this->prepareOutput();
00149                                 $this->$cmd();
00150                                 break;
00151                 }
00152                 return true;
00153         }
00154 
00155         function saveResult()
00156         {
00157                 include_once 'Services/Search/classes/class.ilUserResult.php';
00158                 include_once 'Services/Search/classes/class.ilSearchFolder.php';
00159 
00160                 global $ilUser;
00161 
00162                 if(!$_POST['folder'])
00163                 {
00164                         ilUtil::sendInfo($this->lng->txt('search_select_one'));
00165                         $this->showSavedResults();
00166 
00167                         return false;
00168                 }
00169                 if(!count($_POST['id']))
00170                 {
00171                         ilUtil::sendInfo($this->lng->txt('search_select_one_result'));
00172                         $this->showSavedResults();
00173 
00174                         return false;
00175                 }
00176 
00177                 $folder_obj =& new ilSearchFolder($ilUser->getId(),(int) $_POST['folder']);
00178 
00179                 foreach($_POST['id'] as $ref_id)
00180                 {
00181                         $title = ilObject::_lookupTitle(ilObject::_lookupObjId($ref_id));
00182                         $target = addslashes(serialize(array('type' => ilObject::_lookupType(ilObject::_lookupObjId($ref_id)),
00183                                                                                                  'id'   => $ref_id)));
00184 
00185                         $search_res_obj =& new ilUserResult($ilUser->getId());
00186                         $search_res_obj->setTitle($title);
00187                         $search_res_obj->setTarget($target);
00188 
00189                         $folder_obj->assignResult($search_res_obj);
00190                         unset($search_res_obj);
00191                 }
00192                 ilUtil::sendInfo($this->lng->txt('search_results_saved'));
00193                 $this->showSavedResults();
00194 
00195         }
00196 
00197 
00198         function showSearch()
00199         {
00200                 global $ilLocator;
00201 
00202                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search.html','Services/Search');
00203 
00204                 $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('search'));
00205                 $this->tpl->setVariable("TXT_SEARCHAREA",$this->lng->txt('search_area'));
00206                 $this->tpl->setVariable("SEARCH_ACTION",$this->ctrl->getFormAction($this));
00207                 $this->tpl->setVariable("TXT_SEARCHTERM",$this->lng->txt("search_search_term"));
00208                 $this->tpl->setVariable("TXT_AND",$this->lng->txt('search_all_words'));
00209                 $this->tpl->setVariable("TXT_OR",$this->lng->txt('search_any_word'));
00210                 $this->tpl->setVariable("BTN_SEARCH",$this->lng->txt('search'));
00211 
00212                 // Check 'or' as default
00213                 if($this->getCombination() == SEARCH_AND)
00214                 {
00215                         $this->tpl->setVariable("AND_CHECKED",'checked=checked');
00216                 }
00217                 else
00218                 {
00219                         $this->tpl->setVariable("OR_CHECKED",'checked=checked');
00220                 }
00221                 // Set old query string
00222                 $this->tpl->setVariable("FORM_SEARCH_STR",ilUtil::prepareFormOutput($this->getString(),true));
00223 
00224                 $this->tpl->setVariable("HREF_UPDATE_AREA",$this->ctrl->getLinkTarget($this,'showSelectRoot'));
00225                 $this->tpl->setVariable("UPDATE_AREA",$this->lng->txt('search_change'));
00226 
00227                 // SEARCHTYPE
00228                 $this->tpl->setVariable("TXT_SEARCH_TYPE",$this->lng->txt('search_type'));
00229                 $this->tpl->setVariable("INFO_FAST",$this->lng->txt('search_fast_info'));
00230                 $this->tpl->setVariable("INFO_DETAILS",$this->lng->txt('search_details_info'));
00231 
00232                 $this->tpl->setVariable("CHECK_FAST",ilUtil::formRadioButton($this->getType() == SEARCH_FAST ? 1 : 0,
00233                                                                                                                                          'search[type]',
00234                                                                                                                                          SEARCH_FAST ));
00235 
00236                 $this->tpl->setVariable("CHECK_DETAILS",ilUtil::formRadioButton($this->getType() == SEARCH_DETAILS ? 1 : 0,
00237                                                                                                                                          'search[type]',
00238                                                                                                                                          SEARCH_DETAILS));
00239                 // SEARCH DETAILS
00240                 $this->tpl->setVariable("LMS",$this->lng->txt('learning_resources'));
00241                 $this->tpl->setVariable("GLO",$this->lng->txt('objs_glo'));
00242                 $this->tpl->setVariable("MEP",$this->lng->txt('objs_mep'));
00243                 $this->tpl->setVariable("TST",$this->lng->txt('search_tst_svy'));
00244                 $this->tpl->setVariable("FOR",$this->lng->txt('objs_frm'));
00245                 $this->tpl->setVariable("EXC",$this->lng->txt('objs_exc'));
00246                 $this->tpl->setVariable("MCST",$this->lng->txt('objs_mcst'));
00247                 $this->tpl->setVariable("FIL",$this->lng->txt('objs_file'));
00248 
00249                 
00250                 $details = $this->getDetails();
00251                 $this->tpl->setVariable("CHECK_GLO",ilUtil::formCheckbox($details['glo'] ? 1 : 0,'search[details][glo]',1));
00252                 $this->tpl->setVariable("CHECK_LMS",ilUtil::formCheckbox($details['lms'] ? 1 : 0,'search[details][lms]',1));
00253                 $this->tpl->setVariable("CHECK_MEP",ilUtil::formCheckbox($details['mep'] ? 1 : 0,'search[details][mep]',1));
00254                 $this->tpl->setVariable("CHECK_TST",ilUtil::formCheckbox($details['tst'] ? 1 : 0,'search[details][tst]',1));
00255                 $this->tpl->setVariable("CHECK_FOR",ilUtil::formCheckbox($details['frm'] ? 1 : 0,'search[details][frm]',1));
00256                 $this->tpl->setVariable("CHECK_EXC",ilUtil::formCheckbox($details['exc'] ? 1 : 0,'search[details][exc]',1));
00257                 $this->tpl->setVariable("CHECK_FIL",ilUtil::formCheckbox($details['fil'] ? 1 : 0,'search[details][fil]',1));
00258                 $this->tpl->setVariable("CHECK_MCST",ilUtil::formCheckbox($details['mcst'] ? 1 : 0,'search[details][mcst]',1));
00259 
00260 
00261 
00262                 // SEARCHAREA
00263                 if($this->getRootNode() == ROOT_FOLDER_ID)
00264                 {
00265                         $this->tpl->setVariable("SEARCHAREA",$this->lng->txt('search_in_magazin'));
00266                 }
00267                 else
00268                 {
00269                         $text = $this->lng->txt('search_below')." '";
00270                         $text .= ilObject::_lookupTitle(ilObject::_lookupObjId($this->getRootNode()));
00271                         $text .= "'";
00272                         $this->tpl->setVariable("SEARCHAREA",$text);
00273                 }
00274 
00275                 return true;
00276         }
00277 
00278         function showSelectRoot()
00279         {
00280                 global $tree;
00281 
00282                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.search_root_selector.html','Services/Search');
00283 
00284                 include_once 'Services/Search/classes/class.ilSearchRootSelector.php';
00285 
00286                 ilUtil::sendInfo($this->lng->txt('search_area_info'));
00287 
00288                 $exp = new ilSearchRootSelector($this->ctrl->getLinkTarget($this,'showSelectRoot'));
00289                 $exp->setExpand($_GET["search_root_expand"] ? $_GET["search_root_expand"] : $tree->readRootId());
00290                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showSelectRoot'));
00291 
00292                 // build html-output
00293                 $exp->setOutput(0);
00294 
00295                 $this->tpl->setVariable("EXPLORER",$exp->getOutput());
00296         }
00297 
00298         function selectRoot()
00299         {
00300                 $this->setRootNode((int) $_GET['root_id']);
00301                 $this->showSavedResults();
00302 
00303                 return true;
00304         }
00305 
00306         
00307         function showSavedResults()
00308         {
00309                 global $ilUser;
00310 
00311                 // Read old result sets
00312                 include_once 'Services/Search/classes/class.ilSearchResult.php';
00313         
00314                 $result_obj = new ilSearchResult($ilUser->getId());
00315                 $result_obj->read();
00316                 $result_obj->filterResults($this->getRootNode());
00317 
00318                 $this->showSearch();
00319 
00320                 // Show them
00321                 if(count($result_obj->getResults()))
00322                 {
00323                         $this->__showSearchInResults();
00324                         $this->addPager($result_obj,'max_page');
00325 
00326                         include_once 'Services/Search/classes/class.ilSearchResultPresentationGUI.php';
00327                         $search_result_presentation = new ilSearchResultPresentationGUI($result_obj);
00328                         $this->tpl->setVariable("RESULTS",$search_result_presentation->showResults());
00329                 }
00330 
00331                 return true;
00332         }
00333 
00334         function searchInResults()
00335         {
00336                 $this->search_mode = 'in_results';
00337                 $this->search_cache->setResultPageNumber(1);
00338                 unset($_SESSION['max_page']);
00339                 $this->performSearch();
00340 
00341                 return true;
00342         }
00343                 
00344 
00345         function performSearch()
00346         {
00347                 global $ilUser;
00348         
00349                 if(!isset($_GET['page_number']) and $this->search_mode != 'in_results' )
00350                 {
00351                         unset($_SESSION['max_page']);
00352                         $this->search_cache->delete();
00353                 }
00354 
00355                 if($this->getType() == SEARCH_DETAILS and !$this->getDetails())
00356                 {
00357                         ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
00358                         $this->showSearch();
00359 
00360                         return false;
00361                 }
00362 
00363                 
00364                 // Step 1: parse query string
00365                 if(!is_object($query_parser =& $this->__parseQueryString()))
00366                 {
00367                         ilUtil::sendInfo($query_parser);
00368                         $this->showSearch();
00369                         
00370                         return false;
00371                 }
00372                 // Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
00373                 $result =& $this->__searchObjects($query_parser);
00374 
00375                 // Step 3: perform meta keyword search. Get an MetaDataSearch object.
00376                 $result_meta =& $this->__searchMeta($query_parser,'keyword');
00377                 $result->mergeEntries($result_meta);
00378 
00379                 $result_meta =& $this->__searchMeta($query_parser,'contribute');
00380                 $result->mergeEntries($result_meta);
00381         
00382                 $result_meta =& $this->__searchMeta($query_parser,'title');
00383                 $result->mergeEntries($result_meta);
00384         
00385                 $result_meta =& $this->__searchMeta($query_parser,'description');
00386                 $result->mergeEntries($result_meta);
00387         
00388                 // Perform details search in object specific tables
00389                 if($this->getType() == SEARCH_DETAILS)
00390                 {
00391                         $result = $this->__performDetailsSearch($query_parser,$result);
00392                 }
00393                 // Step 5: Search in results
00394                 if($this->search_mode == 'in_results')
00395                 {
00396                         include_once 'Services/Search/classes/class.ilSearchResult.php';
00397 
00398                         $old_result_obj = new ilSearchResult($ilUser->getId());
00399                         $old_result_obj->read();
00400 
00401                         $result->diffEntriesFromResult($old_result_obj);
00402                 }
00403                         
00404 
00405                 // Step 4: merge and validate results
00406                 $result->filter($this->getRootNode(),$query_parser->getCombination() == 'and');
00407                 $result->save();
00408                 $this->showSearch();
00409 
00410                 if(!count($result->getResults()))
00411                 {
00412                         ilUtil::sendInfo($this->lng->txt('search_no_match'));
00413                 }
00414                 else
00415                 {
00416                         $this->__showSearchInResults();
00417                 }
00418 
00419                 if($result->isLimitReached())
00420                 {
00421                         $message = sprintf($this->lng->txt('search_limit_reached'),$this->settings->getMaxHits());
00422                         ilUtil::sendInfo($message);
00423                 }
00424 
00425                 // Step 6: show results
00426                 $this->addPager($result,'max_page');
00427 
00428                 include_once 'Services/Search/classes/class.ilSearchResultPresentationGUI.php';
00429                 $search_result_presentation = new ilSearchResultPresentationGUI($result);
00430                 $this->tpl->setVariable("RESULTS",$search_result_presentation->showResults());
00431 
00432                 return true;
00433         }
00434 
00435                 
00436 
00437         function prepareOutput()
00438         {
00439                 parent::prepareOutput();
00440 
00441                 $this->tpl->setCurrentBlock("header_image");
00442                 $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_src_b.gif"));
00443                 $this->tpl->parseCurrentBlock();
00444 
00445                 $this->tpl->setVariable("TXT_HEADER",$this->lng->txt('search'));
00446 
00447                 $this->tpl->addBlockFile("TABS","tabs","tpl.tabs.html");
00448 
00449                 $this->tpl->setCurrentBlock("tab");
00450                 $this->tpl->setVariable("TAB_TYPE","tabactive");
00451                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTarget($this));
00452                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search"));
00453                 $this->tpl->parseCurrentBlock();
00454 
00455                 $this->tpl->setCurrentBlock("tab");
00456                 $this->tpl->setVariable("TAB_TYPE","tabinactive");
00457                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('iladvancedsearchgui'));
00458                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_advanced"));
00459                 $this->tpl->parseCurrentBlock();
00460 
00461                 $this->tpl->setCurrentBlock("tab");
00462                 $this->tpl->setVariable("TAB_TYPE","tabinactive");
00463                 $this->tpl->setVariable("TAB_LINK",$this->ctrl->getLinkTargetByClass('ilsearchresultgui'));
00464                 $this->tpl->setVariable("TAB_TEXT",$this->lng->txt("search_search_results"));
00465                 $this->tpl->parseCurrentBlock();
00466                 
00467         }
00468 
00469         // PRIVATE
00470         function &__performDetailsSearch(&$query_parser,&$result)
00471         {
00472                 foreach($this->getDetails() as $type => $always_one)
00473                 {
00474                         switch($type)
00475                         {
00476                                 case 'lms':
00477                                         $content_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
00478                                         $content_search->setFilter($this->__getFilter());
00479                                         $result->mergeEntries($content_search->performSearch());
00480 
00481                                         if($this->settings->enabledLucene())
00482                                         {
00483                                                 $htlm_search =& ilObjectSearchFactory::_getHTLMSearchInstance($query_parser);
00484                                                 $result->mergeEntries($htlm_search->performSearch());
00485                                         }
00486                                         break;
00487 
00488                                 case 'frm':
00489                                         $forum_search =& ilObjectSearchFactory::_getForumSearchInstance($query_parser);
00490                                         $forum_search->setFilter($this->__getFilter());
00491                                         $result->mergeEntries($forum_search->performSearch());
00492                                         break;
00493 
00494                                 case 'glo':
00495                                         // Glossary term definition pages
00496                                         $gdf_search =& ilObjectSearchFactory::_getLMContentSearchInstance($query_parser);
00497                                         $gdf_search->setFilter($this->__getFilter());
00498                                         $result->mergeEntries($gdf_search->performSearch());
00499                                         // Glossary terms
00500                                         $gdf_term_search =& ilObjectSearchFactory::_getGlossaryDefinitionSearchInstance($query_parser);
00501                                         $result->mergeEntries($gdf_term_search->performSearch());
00502                                         break;
00503 
00504                                 case 'exc':
00505                                         $exc_search =& ilObjectSearchFactory::_getExerciseSearchInstance($query_parser);
00506                                         $exc_search->setFilter($this->__getFilter());
00507                                         $result->mergeEntries($exc_search->performSearch());
00508                                         break;
00509 
00510                                 case 'mcst':
00511                                         $mcst_search =& ilObjectSearchFactory::_getMediaCastSearchInstance($query_parser);
00512                                         $result->mergeEntries($mcst_search->performSearch());
00513                                         break;
00514 
00515                                 case 'tst':
00516                                         $tst_search =& ilObjectSearchFactory::_getTestSearchInstance($query_parser);
00517                                         $tst_search->setFilter($this->__getFilter());
00518                                         $result->mergeEntries($tst_search->performSearch());
00519                                         break;
00520 
00521                                 case 'mep':
00522                                         $mep_search =& ilObjectSearchFactory::_getMediaPoolSearchInstance($query_parser);
00523                                         $mep_search->setFilter($this->__getFilter());
00524                                         $result->mergeEntries($mep_search->performSearch());
00525                                         break;
00526 
00527                                 case 'fil':
00528                                         if($this->settings->enabledLucene())
00529                                         {
00530                                                 $file_search =& ilObjectSearchFactory::_getFileSearchInstance($query_parser);
00531                                                 $result->mergeEntries($file_search->performSearch());
00532                                         }
00533                                         break;
00534                         }
00535                 }
00536                 return $result;
00537         }
00538 
00544         function &__parseQueryString()
00545         {
00546                 include_once 'Services/Search/classes/class.ilQueryParser.php';
00547 
00548                 $query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
00549                 $query_parser->setCombination($this->getCombination());
00550                 $query_parser->parse();
00551 
00552                 if(!$query_parser->validate())
00553                 {
00554                         return $query_parser->getMessage();
00555                 }
00556                 return $query_parser;
00557         }
00563         function &__searchObjects(&$query_parser)
00564         {
00565                 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
00566 
00567                 $obj_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
00568                 if($this->getType() == SEARCH_DETAILS)
00569                 {
00570                         $obj_search->setFilter($this->__getFilter());
00571                 }
00572                 return $obj_search->performSearch();
00573         }
00574 
00575 
00581         function &__searchMeta(&$query_parser,$a_type)
00582         {
00583                 include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
00584 
00585                 $meta_search =& ilObjectSearchFactory::_getMetaDataSearchInstance($query_parser);
00586                 if($this->getType() == SEARCH_DETAILS)
00587                 {
00588                         $meta_search->setFilter($this->__getFilter());
00589                 }
00590                 switch($a_type)
00591                 {
00592                         case 'keyword':
00593                                 $meta_search->setMode('keyword');
00594                                 break;
00595 
00596                         case 'contribute':
00597                                 $meta_search->setMode('contribute');
00598                                 break;
00599 
00600                         case 'title':
00601                                 $meta_search->setMode('title');
00602                                 break;
00603 
00604                         case 'description':
00605                                 $meta_search->setMode('description');
00606                                 break;
00607                 }
00608             return $meta_search->performSearch();
00609         }
00615         function __getFilter()
00616         {
00617                 if($this->getType() != SEARCH_DETAILS)
00618                 {
00619                         return false;
00620                 }
00621                 
00622                 foreach($this->getDetails() as $key => $detail_type)
00623                 {
00624                         switch($key)
00625                         {
00626                                 case 'lms':
00627                                         $filter[] = 'lm';
00628                                         $filter[] = 'dbk';
00629                                         $filter[] = 'pg';
00630                                         $filter[] = 'st';
00631                                         $filter[] = 'sahs';
00632                                         $filter[] = 'htlm';
00633                                         break;
00634 
00635                                 case 'frm':
00636                                         $filter[] = 'frm';
00637                                         break;
00638 
00639                                 case 'glo':
00640                                         $filter[] = 'glo';
00641                                         break;
00642 
00643                                 case 'exc':
00644                                         $filter[] = 'exc';
00645                                         break;
00646 
00647                                 case 'mcst':
00648                                         $filter[] = 'mcst';
00649                                         break;
00650 
00651                                 case 'tst':
00652                                         $filter[] = 'tst';
00653                                         $filter[] = 'svy';
00654                                         $filter[] = 'qpl';
00655                                         $filter[] = 'spl';
00656                                         break;
00657 
00658                                 case 'mep':
00659                                         $filter[] = 'mep';
00660                                         $filter[] = 'mob';
00661                                         break;
00662 
00663                                 case 'fil':
00664                                         $filter[] = 'file';
00665                                         break;
00666                         }
00667                 }
00668                 return $filter ? $filter : array();
00669         }
00670 
00676         function __showSearchInResults()
00677         {
00678                 $this->tpl->setCurrentBlock("search_results");
00679                 $this->tpl->setVariable("BTN_SEARCHRESULTS",$this->lng->txt('search_in_result'));
00680                 $this->tpl->parseCurrentBlock();
00681 
00682                 $this->tpl->setCurrentBlock("save_result");
00683                 $this->tpl->setVariable("DOWNRIGHT",ilUtil::getImagePath('arrow_downright.gif'));
00684                 $this->tpl->setVariable("BTN_SAVE_RESULT",$this->lng->txt('save'));
00685                 $this->tpl->setVariable("SELECT_FOLDER",$this->__getFolderSelect());
00686                 $this->tpl->parseCurrentBlock();
00687 
00688                 return true;
00689         }
00690 
00691         function __getFolderSelect()
00692         {
00693                 global $ilUser;
00694 
00695                 include_once 'Services/Search/classes/class.ilSearchFolder.php';
00696 
00697                 // INITIATE SEARCH FOLDER OBJECT
00698                 $folder_obj =& new ilSearchFolder($ilUser->getId());
00699 
00700 
00701                 $subtree = $folder_obj->getSubtree();
00702 
00703                 $options[0] = $this->lng->txt("search_select_one_folder_select");
00704                 $options[$folder_obj->getRootId()] = $this->lng->txt("search_save_as_select")." ".$this->lng->txt("search_search_results");
00705                 
00706                 foreach($subtree as $node)
00707                 {
00708                         if($node["obj_id"] == $folder_obj->getRootId())
00709                         {
00710                                 continue;
00711                         }
00712                         // CREATE PREFIX
00713                         $prefix = $this->lng->txt("search_save_as_select");
00714                         for($i = 1; $i < $node["depth"];++$i)
00715                         {
00716                                 $prefix .= "&nbsp;&nbsp;";
00717                         }
00718                         $options[$node["obj_id"]] = $prefix.$node["title"];
00719                 }
00720                 return ilUtil::formSelect(0,'folder',$options,false,true);
00721         }
00728         protected function initUserSearchCache()
00729         {
00730                 global $ilUser;
00731                 
00732                 include_once('Services/Search/classes/class.ilUserSearchCache.php');
00733                 $this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
00734                 if($_GET['page_number'])
00735                 {
00736                         $this->search_cache->setResultPageNumber((int) $_GET['page_number']);
00737                 }
00738         }
00739         
00740 }
00741 ?>

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