24 include_once 
'./Services/Search/classes/class.ilSearchSettings.php';
 
   25 include_once 
'./Services/Search/classes/class.ilSearchBaseGUI.php';
 
   26 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneAdvancedSearchFields.php';
 
   27 include_once 
'./Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
 
   28 include_once 
'./Services/Administration/interfaces/interface.ilAdministrationCommandHandling.php';
 
   68                 $ilBench->start(
'Lucene',
'0900_executeCommand');
 
   69                 $next_class = $this->ctrl->getNextClass($this);
 
   70                 $cmd = $this->ctrl->getCmd();
 
   75                         case 'ilobjectcopygui':
 
   76                                 include_once 
'./Services/Object/classes/class.ilObjectCopyGUI.php';
 
   78                                 $this->ctrl->forwardCommand($cp);
 
   84                                         $cmd = 
"showSavedResults";
 
   89                 $ilBench->stop(
'Lucene',
'0900_executeCommand');
 
  107                         $GLOBALS[
"tpl"]->setAdminViewButton(
 
  108                                 $this->ctrl->getLinkTarget($this, 
"disableAdministrationPanel"),
 
  109                                 $this->lng->txt(
"basic_commands"));
 
  111                         $GLOBALS[
"tpl"]->addAdminPanelCommand(
"delete",
 
  112                                 $this->lng->txt(
"delete_selected_items"));
 
  116                                 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"cut",
 
  117                                         $this->lng->txt(
"move_selected_items"));
 
  119                                 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"link",
 
  120                                         $this->lng->txt(
"link_selected_items"));
 
  124                                 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"paste",
 
  125                                         $this->lng->txt(
"paste_clipboard_items"));
 
  126                                 $GLOBALS[
"tpl"]->addAdminPanelCommand(
"clear",
 
  127                                         $this->lng->txt(
"clear_clipboard"));
 
  130                 elseif($ilUser->getId() != ANONYMOUS_USER_ID)
 
  132                         $GLOBALS[
"tpl"]->setAdminViewButton(
 
  133                                 $this->ctrl->getLinkTarget($this, 
"enableAdministrationPanel"),
 
  134                                 $this->lng->txt(
"all_commands"));
 
  137                 $this->ctrl->setParameter($this, 
"type", 
"");
 
  138                 $this->ctrl->setParameter($this, 
"item_ref_id", 
"");
 
  139                 $GLOBALS[
"tpl"]->setPageFormAction($this->ctrl->getFormAction($this));
 
  150                 $this->search_cache->setRoot((
int) 
$_POST[
'root_id']);
 
  152                 $this->search_cache->save();
 
  166                 $ilBench->start(
'Lucene',
'1000_savedResults');
 
  167                 $ilBench->start(
'Lucene',
'1000_qp');
 
  169                 if(!strlen($this->search_cache->getQuery()))
 
  175                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
 
  176                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
 
  182                 $ilBench->stop(
'Lucene',
'1000_qp');
 
  184                 $ilBench->start(
'Lucene',
'1100_lr');
 
  186                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
 
  188                 $filter->loadFromDb();
 
  189                 $ilBench->stop(
'Lucene',
'1100_lr');
 
  192                 $ilBench->start(
'Lucene',
'1200_hi');
 
  193                 $searcher->highlight($filter->getResultObjIds());
 
  194                 $ilBench->stop(
'Lucene',
'1200_hi');
 
  196                 $ilBench->start(
'Lucene',
'1300_pr');
 
  197                 include_once 
'./Services/Search/classes/class.ilSearchResultPresentation.php';
 
  199                 $presentation->setResults($filter->getResultIds());
 
  201                 $presentation->setSearcher($searcher);
 
  204                 $ilBench->start(
'Lucene',
'1500_fo');
 
  205                 $this->
addPager($filter,
'max_page');
 
  206                 $ilBench->stop(
'Lucene',
'1500_fo');
 
  208                 $presentation->setPreviousNext($this->prev_link, $this->next_link);
 
  209                 $ilBench->stop(
'Lucene',
'1300_pr');
 
  211                 $ilBench->start(
'Lucene',
'1400_re');
 
  215                 if($presentation->render())
 
  217                         $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
 
  219                 elseif(strlen($this->search_cache->getQuery()))
 
  221                         ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$qp->getQuery()));
 
  223                 $ilBench->stop(
'Lucene',
'1400_re');
 
  225                 $ilBench->stop(
'Lucene',
'1000_savedResults');
 
  236                 if(!$this->form->checkInput())
 
  238                         $this->search_cache->deleteCachedEntries();
 
  240                         include_once 
'./Services/Object/classes/class.ilSubItemListGUI.php';
 
  247                 $this->search_cache->deleteCachedEntries();
 
  250                 include_once 
'./Services/Object/classes/class.ilSubItemListGUI.php';
 
  266                 if($this->search_cache->getItemFilter())
 
  269                         foreach((array) $this->search_cache->getItemFilter() as $obj => $value)
 
  273                                         $filter_query .= 
'+( ';
 
  277                                         $filter_query .= 
'OR';
 
  279                                 $filter_query .= (
' '. (string) $filter_settings[$obj][
'filter'].
' ');
 
  281                         $filter_query .= 
') ';
 
  284                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
 
  285                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneQueryParser.php';
 
  292                 $ilBench->start(
'Lucene',
'ResultFilter');
 
  293                 include_once 
'./Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
 
  294                 include_once 
'./Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
 
  297                 $filter->setCandidates($searcher->getResult());
 
  299                 $ilBench->stop(
'Lucene',
'ResultFilter');
 
  301                 if($filter->getResultObjIds()) {
 
  302                         $searcher->highlight($filter->getResultObjIds());
 
  308                 include_once 
'./Services/Search/classes/class.ilSearchResultPresentation.php';
 
  310                 $presentation->setResults($filter->getResultIds());
 
  311                 $presentation->setSearcher($searcher);
 
  314                 $ilBench->start(
'Lucene',
'1500_fo');
 
  315                 $this->
addPager($filter,
'max_page');
 
  316                 $ilBench->stop(
'Lucene',
'1500_fo');
 
  318                 $presentation->setPreviousNext($this->prev_link, $this->next_link);
 
  320                 if($presentation->render())
 
  322                         $this->tpl->setVariable(
'SEARCH_RESULTS',$presentation->getHTML(
true));
 
  326                         ilUtil::sendInfo(sprintf($this->lng->txt(
'search_no_match_hint'),$this->search_cache->getQuery()));
 
  329                 if($filter->getResultIds())
 
  331                         #$this->fillAdminPanel(); 
  342                 include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
  344                 if(is_object($this->form))
 
  350                 $this->form->setFormAction($this->ctrl->getFormAction($this,
'search'));
 
  351                 $this->form->setTitle($this->lng->txt(
'search'));
 
  352                 $this->form->addCommandButton(
'search',$this->lng->txt(
'search'));
 
  354                 include_once 
'./Services/Search/classes/Form/class.ilLuceneQueryInputGUI.php';
 
  356                 $term->
setValue($this->search_cache->getQuery());
 
  358                 $term->setMaxLength(255);
 
  359                 $term->setRequired(
true);
 
  360                 if($lng->exists(
'search_form_hint'))
 
  362                         $term->setInfo($lng->txt(
'search_form_hint'));
 
  365                 $dsSchema = array(
"resultsList" => 
'response.results',
 
  366                         "fields" => array(
'term'));
 
  367                 $term->setDataSource($ilCtrl->getLinkTarget($this, 
"autoComplete"));
 
  368                 $term->setDataSourceSchema($dsSchema);
 
  369                 $term->setDataSourceResultFormat($dsFormatCallback);
 
  370                 $term->setDataSourceDelimiter($dsDelimiter);
 
  372                 $this->form->addItem($term);
 
  374                 if($ilUser->getId() != ANONYMOUS_USER_ID)
 
  377                         $tpl = 
new ilTemplate(
'tpl.root_selection.html',
true,
true,
'Services/Search');
 
  378                         switch($this->search_cache->getRoot())
 
  381                                         $pathIds = $tree->getPathId($this->search_cache->getRoot(),ROOT_FOLDER_ID);
 
  386                                                         $tpl->touchBlock(
'path_separator');
 
  388                                                 if(($counter % 3) == 0) {
 
  389                                                         $tpl->touchBlock(
'line_break');
 
  391                                                 if($ref_id == ROOT_FOLDER_ID) {
 
  392                                                         $title = $this->lng->txt(
'search_in_magazin');
 
  397                                                 $this->ctrl->setParameter($this,
'root_id',$ref_id);
 
  398                                                 $tpl->setCurrentBlock(
'item');
 
  399                                                 $tpl->setVariable(
'ITEM_LINK',$this->ctrl->getLinkTarget($this,
'selectRoot'));
 
  400                                                 $tpl->setVariable(
'NAME_WITH_DOTS',
$title);
 
  401                                                 $tpl->parseCurrentBlock();
 
  403                                         $tpl->setVariable(
'LINK_SELECT',$this->ctrl->getLinkTarget($this,
'chooseRoot'));
 
  404                                         $tpl->setVariable(
'TXT_CHANGE',$this->lng->txt(
'change'));
 
  408                         $path->setHTML($tpl->get());
 
  409                         $this->form->addItem(
$path);
 
  414                 $currentFilter = $this->search_cache->getItemFilter();
 
  415                 if(count($itemFilter))
 
  417                         $if = 
new ilCheckboxInputGUI($this->lng->txt(
'search_item_filter'),
'item_filter_enabled');
 
  419                         $if->setChecked(count($currentFilter));
 
  420                         $this->form->addItem($if);
 
  421                         foreach($itemFilter as $obj => $def)
 
  424                                 $ch->setChecked(isset($currentFilter[$obj]));
 
  426                                 $if->addSubItem($ch);
 
  445                 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.search_root_selector.html',
'Services/Search');
 
  447                 include_once 
'Services/Search/classes/class.ilSearchRootSelector.php';
 
  453                 $exp->setExpand(
$_GET[
"search_root_expand"] ? 
$_GET[
"search_root_expand"] : $tree->readRootId());
 
  454                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'chooseRoot'));
 
  459                 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
 
  469                 $this->search_cache->setRoot((
int) 
$_GET[
'root_id']);
 
  470                 $this->search_cache->save();
 
  471                 $this->search_cache->deleteCachedEntries();
 
  473                 include_once 
'./Services/Object/classes/class.ilSubItemListGUI.php';
 
  488                 $this->tabs_gui->addTarget(
'search',$this->ctrl->getLinkTarget($this));
 
  489                 if($this->fields->getActiveFields())
 
  491                         $this->tabs_gui->addTarget(
'search_advanced',$this->ctrl->getLinkTargetByClass(
'illuceneAdvancedSearchgui'));
 
  494                 $this->tabs_gui->setTabActive(
'search');
 
  508                 include_once(
'Services/Search/classes/class.ilUserSearchCache.php');
 
  511                 if((
int) 
$_GET[
'page_number'])
 
  513                         $this->search_cache->setResultPageNumber((
int) $_GET[
'page_number']);
 
  515                 if(isset(
$_POST[
'query']))
 
  518                         if(
$_POST[
'item_filter_enabled'])
 
  520                                 $this->search_cache->setItemFilter(
$_POST[
'filter']);
 
  524                                 $this->search_cache->setItemFilter(array());
 
  538                 $adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = 
false;
 
  541                 if ((count($this->admin_panel_commands) > 0))
 
  543                         foreach($this->admin_panel_commands as 
$cmd)
 
  545                                 $this->tpl->setCurrentBlock(
"lucene_admin_panel_cmd");
 
  546                                 $this->tpl->setVariable(
"LUCENE_PANEL_CMD", $cmd[
"cmd"]);
 
  547                                 $this->tpl->setVariable(
"LUCENE_TXT_PANEL_CMD", $cmd[
"txt"]);
 
  548                                 $this->tpl->parseCurrentBlock();
 
  555                         $this->tpl->setCurrentBlock(
"lucene_adm_view_components");
 
  557                         $this->tpl->setVariable(
"LUCENE_ADM_ALT_ARROW", $lng->txt(
"actions"));
 
  558                         $this->tpl->parseCurrentBlock();
 
  559                         $adm_view_cmp = 
true;
 
  563                 if (is_array($this->admin_view_button))
 
  565                         if (is_array($this->admin_view_button))
 
  567                                 $this->tpl->setCurrentBlock(
"lucene_admin_button");
 
  568                                 $this->tpl->setVariable(
"LUCENE_ADMIN_MODE_LINK",
 
  569                                         $this->admin_view_button[
"link"]);
 
  570                                 $this->tpl->setVariable(
"LUCENE_TXT_ADMIN_MODE",
 
  571                                         $this->admin_view_button[
"txt"]);
 
  572                                 $this->tpl->parseCurrentBlock();
 
  574                         $this->tpl->setCurrentBlock(
"lucene_admin_view");
 
  575                         $this->tpl->parseCurrentBlock();
 
  580                 if (is_array($this->creation_selector))
 
  582                         $this->tpl->setCurrentBlock(
"lucene_add_commands");
 
  585                                 $this->tpl->setVariable(
"LUCENE_ADD_COM_WIDTH", 
'width="1"');
 
  587                         $this->tpl->setVariable(
"LUCENE_SELECT_OBJTYPE_REPOS",
 
  588                                 $this->creation_selector[
"options"]);
 
  589                         $this->tpl->setVariable(
"LUCENE_BTN_NAME_REPOS",
 
  590                                 $this->creation_selector[
"command"]);
 
  591                         $this->tpl->setVariable(
"LUCENE_TXT_ADD_REPOS",
 
  592                                 $this->creation_selector[
"txt"]);
 
  593                         $this->tpl->parseCurrentBlock();
 
  594                         $creation_selector = 
true;
 
  596                 if ($adm_view || $creation_selector)
 
  598                         $this->tpl->setCurrentBlock(
"lucene_adm_panel");
 
  601                                 $this->tpl->setVariable(
"LUCENE_ADM_TBL_WIDTH", 
'width:"100%";');
 
  603                         $this->tpl->parseCurrentBlock();
 
  612                 $this->admin_panel_commands[] =
 
  613                         array(
"cmd" => $a_cmd, 
"txt" => $a_txt);
 
  621                 $this->admin_view_button =
 
  622                         array(
"link" => $a_link, 
"txt" => $a_txt);
 
  627                 $this->page_form_action = $a_action;
 
  632                 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.lucene_search.html',
'Services/Search');
 
  634                 $this->tpl->setVariable(
'SEARCH_TABLE',$this->form->getHTML());