ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLuceneAdvancedSearchGUI Class Reference

Meta Data search GUI. More...

+ Inheritance diagram for ilLuceneAdvancedSearchGUI:
+ Collaboration diagram for ilLuceneAdvancedSearchGUI:

Public Member Functions

 __construct ()
 Constructor.
 executeCommand ()
 Execute Command.
 showSavedResults ()
 Show saved results.
 prepareOutput ()
 Add admin panel command.
- Public Member Functions inherited from ilSearchBaseGUI
 ilSearchBaseGUI ()
 Constructor public.
 handleCommand ($a_cmd)
 addToDeskObject ()
 Interface methods.
 removeFromDeskObject ()
 Remove from dektop.
 delete ()
 Show deletion screen.
 cancelDelete ()
 Cancel delete.
 performDelete ()
 Delete objects.
 cut ()
 Interface ilAdministrationCommandHandler.
 link ()
 Interface ilAdministrationCommandHandler.
 paste ()
 Paste.
 showLinkIntoMultipleObjectsTree ()
 Target selection link.
 showMoveIntoObjectTree ()
 Target selection cut.
 performPasteIntoMultipleObjects ()
 Perform paste into multiple objects.
 clear ()
 clear clipboard
 enableAdministrationPanel ()
 Enable administration panel.
 disableAdministrationPanel ()
 Disable administration panel.
 addLocator ()
 Add Locator.
 autoComplete ()
 Data resource for autoComplete.

Protected Member Functions

 initFormSearch ()
 Show search form.
 remoteSearch ()
 Search from main menu.
 search ()
 reset ()
 Reset search form.
 performSearch ()
 Perform search.
 getTabs ()
 get tabs
 initUserSearchCache ()
 Init user search cache.
 fillAdminPanel ()
 addAdminPanelCommand ($a_cmd, $a_txt)
 Add a command to the admin panel.
 setAdminViewButton ($a_link, $a_txt)
 Show admin view button.
 setPageFormAction ($a_action)
- Protected Member Functions inherited from ilSearchBaseGUI
 addPager ($result, $a_session_key)
 Add Pager.
 buildSearchAreaPath ($a_root_node)
 Build path for search area.

Protected Attributes

 $ilTabs
 $fields = null
- Protected Attributes inherited from ilSearchBaseGUI
 $ctrl = null

Additional Inherited Members

- Data Fields inherited from ilSearchBaseGUI
 $settings = null
 $ilias = null
 $lng = null
 $tpl = null

Detailed Description

Constructor & Destructor Documentation

ilLuceneAdvancedSearchGUI::__construct ( )

Constructor.

Definition at line 51 of file class.ilLuceneAdvancedSearchGUI.php.

References $ilTabs, ilLuceneAdvancedSearchFields\getInstance(), and initUserSearchCache().

{
global $ilTabs;
$this->tabs_gui = $ilTabs;
}

+ Here is the call graph for this function:

Member Function Documentation

ilLuceneAdvancedSearchGUI::addAdminPanelCommand (   $a_cmd,
  $a_txt 
)
protected

Add a command to the admin panel.

Definition at line 461 of file class.ilLuceneAdvancedSearchGUI.php.

Referenced by prepareOutput().

{
$this->admin_panel_commands[] =
array("cmd" => $a_cmd, "txt" => $a_txt);
}

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::executeCommand ( )

Execute Command.

Definition at line 65 of file class.ilLuceneAdvancedSearchGUI.php.

References $cmd, ilSearchBaseGUI\handleCommand(), and prepareOutput().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->prepareOutput();
switch($next_class)
{
case 'ilobjectcopygui':
include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
$cp = new ilObjectCopyGUI($this);
$this->ctrl->forwardCommand($cp);
break;
default:
if(!$cmd)
{
$cmd = "showSavedResults";
}
break;
}
return true;
}

+ Here is the call graph for this function:

ilLuceneAdvancedSearchGUI::fillAdminPanel ( )
protected

Definition at line 385 of file class.ilLuceneAdvancedSearchGUI.php.

References $cmd, ilSearchBaseGUI\$lng, and ilUtil\getImagePath().

Referenced by performSearch(), and showSavedResults().

{
global $lng;
$adm_view_cmp = $adm_cmds = $creation_selector = $adm_view = false;
// admin panel commands
if ((count($this->admin_panel_commands) > 0))
{
foreach($this->admin_panel_commands as $cmd)
{
$this->tpl->setCurrentBlock("lucene_admin_panel_cmd");
$this->tpl->setVariable("LUCENE_PANEL_CMD", $cmd["cmd"]);
$this->tpl->setVariable("LUCENE_TXT_PANEL_CMD", $cmd["txt"]);
$this->tpl->parseCurrentBlock();
}
$adm_cmds = true;
}
if ($adm_cmds)
{
$this->tpl->setCurrentBlock("lucene_adm_view_components");
$this->tpl->setVariable("LUCENE_ADM_IMG_ARROW", ilUtil::getImagePath("arrow_upright.gif"));
$this->tpl->setVariable("LUCENE_ADM_ALT_ARROW", $lng->txt("actions"));
$this->tpl->parseCurrentBlock();
$adm_view_cmp = true;
}
// admin view button
if (is_array($this->admin_view_button))
{
if (is_array($this->admin_view_button))
{
$this->tpl->setCurrentBlock("lucene_admin_button");
$this->tpl->setVariable("LUCENE_ADMIN_MODE_LINK",
$this->admin_view_button["link"]);
$this->tpl->setVariable("LUCENE_TXT_ADMIN_MODE",
$this->admin_view_button["txt"]);
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("lucene_admin_view");
$this->tpl->parseCurrentBlock();
$adm_view = true;
}
// creation selector
if (is_array($this->creation_selector))
{
$this->tpl->setCurrentBlock("lucene_add_commands");
if ($adm_cmds)
{
$this->tpl->setVariable("LUCENE_ADD_COM_WIDTH", 'width="1"');
}
$this->tpl->setVariable("LUCENE_SELECT_OBJTYPE_REPOS",
$this->creation_selector["options"]);
$this->tpl->setVariable("LUCENE_BTN_NAME_REPOS",
$this->creation_selector["command"]);
$this->tpl->setVariable("LUCENE_TXT_ADD_REPOS",
$this->creation_selector["txt"]);
$this->tpl->parseCurrentBlock();
$creation_selector = true;
}
if ($adm_view || $creation_selector)
{
$this->tpl->setCurrentBlock("lucene_adm_panel");
if ($adm_view_cmp)
{
$this->tpl->setVariable("LUCENE_ADM_TBL_WIDTH", 'width:"100%";');
}
$this->tpl->parseCurrentBlock();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::getTabs ( )
protected

get tabs

Definition at line 346 of file class.ilLuceneAdvancedSearchGUI.php.

References ilSearchSettings\getInstance().

Referenced by prepareOutput().

{
if(ilSearchSettings::getInstance()->getHideAdvancedSearch())
{
return false;
}
$this->tabs_gui->addTarget('search',$this->ctrl->getLinkTargetByClass('illucenesearchgui'));
if($this->fields->getActiveFields())
{
$this->tabs_gui->addTarget('search_advanced',$this->ctrl->getLinkTarget($this));
}
$this->tabs_gui->setTabActive('search_advanced');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::initFormSearch ( )
protected

Show search form.

Definition at line 152 of file class.ilLuceneAdvancedSearchGUI.php.

References $section.

Referenced by performSearch(), and showSavedResults().

{
global $tree;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($this->ctrl->getFormAction($this,'search'));
$this->form->setTitle($this->lng->txt('search_advanced'));
$this->form->addCommandButton('search',$this->lng->txt('search'));
$this->form->addCommandButton('reset',$this->lng->txt('reset'));
foreach($this->fields->getActiveSections() as $definition)
{
if($definition['name'] != 'default')
{
$section->setTitle($definition['name']);
$this->form->addItem($section);
}
foreach($definition['fields'] as $field_name)
{
if(is_object($element = $this->fields->getFormElement($this->search_cache->getQuery(),$field_name)))
{
$this->form->addItem($element);
}
}
}
return true;
}

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::initUserSearchCache ( )
protected

Init user search cache.

private

Definition at line 369 of file class.ilLuceneAdvancedSearchGUI.php.

References $_GET, $_POST, ilUserSearchCache\_getInstance(), and ilUserSearchCache\LUCENE_ADVANCED.

Referenced by __construct().

{
global $ilUser;
include_once('Services/Search/classes/class.ilUserSearchCache.php');
$this->search_cache = ilUserSearchCache::_getInstance($ilUser->getId());
$this->search_cache->switchSearchType(ilUserSearchCache::LUCENE_ADVANCED);
if((int) $_GET['page_number'])
{
$this->search_cache->setResultPageNumber((int) $_GET['page_number']);
}
if(isset($_POST['query']))
{
$this->search_cache->setQuery($_POST['query']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::performSearch ( )
protected

Perform search.

Definition at line 227 of file class.ilLuceneAdvancedSearchGUI.php.

References $_SESSION, $ilBench, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ilLuceneAdvancedQueryParser\parse(), ilUtil\sendInfo(), and showSavedResults().

Referenced by search().

{
global $ilUser,$ilBench;
unset($_SESSION['vis_references']);
include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
$qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
$qp->parse();
if(!strlen(trim($qp->getQuery())))
{
ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
$this->showSavedResults();
return false;
}
$searcher->search();
// Filter results
$ilBench->start('Lucene','ResultFilter');
include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
include_once './Services/Search/classes/Lucene/class.ilLucenePathFilter.php';
$filter = ilLuceneSearchResultFilter::getInstance($ilUser->getId());
$filter->addFilter(new ilLucenePathFilter($this->search_cache->getRoot()));
$filter->setCandidates($searcher->getResult());
$filter->filter();
$ilBench->stop('Lucene','ResultFilter');
if($filter->getResultObjIds()) {
$searcher->highlight($filter->getResultObjIds());
}
// Show results
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_search.html','Services/Search');
include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
$presentation = new ilSearchResultPresentation($this);
$presentation->setResults($filter->getResultIds());
$presentation->setSearcher($searcher);
// TODO: other handling required
$ilBench->start('Lucene','1500_fo');
$this->addPager($filter,'max_page');
$ilBench->stop('Lucene','1500_fo');
$presentation->setPreviousNext($this->prev_link, $this->next_link);
if($presentation->render())
{
$this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
}
else
{
ilUtil::sendInfo($this->lng->txt('search_no_match'));
}
// and finally add search form
$this->initFormSearch();
$this->tpl->setVariable('SEARCH_TABLE',$this->form->getHTML());
if($filter->getResultIds())
{
$this->fillAdminPanel();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::prepareOutput ( )

Add admin panel command.

Reimplemented from ilSearchBaseGUI.

Definition at line 296 of file class.ilLuceneAdvancedSearchGUI.php.

References $_SESSION, $ilSetting, addAdminPanelCommand(), getTabs(), and setAdminViewButton().

Referenced by executeCommand().

{
$this->getTabs();
return true;
global $ilAccess, $ilSetting;
global $ilUser;
if($_SESSION['il_cont_admin_panel'])
{
$this->ctrl->getLinkTarget($this, "disableAdministrationPanel"),
$this->lng->txt("basic_commands"));
$this->addAdminPanelCommand("delete",
$this->lng->txt("delete_selected_items"));
if(!$_SESSION["clipboard"])
{
$this->addAdminPanelCommand("cut",
$this->lng->txt("move_selected_items"));
$this->addAdminPanelCommand("link",
$this->lng->txt("link_selected_items"));
}
else
{
#$this->addAdminPanelCommand("paste",
# $this->lng->txt("paste_clipboard_items"));
$this->addAdminPanelCommand("clear",
$this->lng->txt("clear_clipboard"));
}
}
elseif($ilUser->getId() != ANONYMOUS_USER_ID)
{
$this->ctrl->getLinkTarget($this, "enableAdministrationPanel"),
$this->lng->txt("all_commands"));
}
$this->ctrl->setParameter($this, "type", "");
$this->ctrl->setParameter($this, "item_ref_id", "");
$this->tpl->setPageFormAction($this->ctrl->getFormAction($this));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::remoteSearch ( )
protected

Search from main menu.

Definition at line 187 of file class.ilLuceneAdvancedSearchGUI.php.

References $_POST, search(), and ilUtil\stripSlashes().

{
$this->search_cache->setRoot((int) $_POST['root_id']);
$this->search_cache->setQuery(array('lom_content' => ilUtil::stripSlashes($_POST['queryString'])));
$this->search_cache->save();
$this->search();
}

+ Here is the call graph for this function:

ilLuceneAdvancedSearchGUI::reset ( )
protected

Reset search form.

Definition at line 217 of file class.ilLuceneAdvancedSearchGUI.php.

References showSavedResults().

{
$this->search_cache->setQuery(array());
$this->search_cache->save();
$this->showSavedResults();
}

+ Here is the call graph for this function:

ilLuceneAdvancedSearchGUI::search ( )
protected

Definition at line 195 of file class.ilLuceneAdvancedSearchGUI.php.

References $_SESSION, performSearch(), ilSubItemListGUI\resetDetails(), ilUtil\sendInfo(), and showSavedResults().

Referenced by remoteSearch().

{
if(!is_array($this->search_cache->getQuery()))
{
// TOD: handle empty advances search
ilUtil::sendInfo($this->lng->txt('msg_no_search_string'));
$this->showSavedResults();
return false;
}
unset($_SESSION['max_page']);
$this->search_cache->deleteCachedEntries();
// Reset details
include_once './Services/Object/classes/class.ilSubItemListGUI.php';
$this->performSearch();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::setAdminViewButton (   $a_link,
  $a_txt 
)
protected

Show admin view button.

Definition at line 470 of file class.ilLuceneAdvancedSearchGUI.php.

Referenced by prepareOutput().

{
$this->admin_view_button =
array("link" => $a_link, "txt" => $a_txt);
}

+ Here is the caller graph for this function:

ilLuceneAdvancedSearchGUI::setPageFormAction (   $a_action)
protected

Definition at line 476 of file class.ilLuceneAdvancedSearchGUI.php.

{
$this->page_form_action = $a_action;
}
ilLuceneAdvancedSearchGUI::showSavedResults ( )

Show saved results.

Returns

Definition at line 96 of file class.ilLuceneAdvancedSearchGUI.php.

References $ilBench, ilSearchBaseGUI\addPager(), fillAdminPanel(), ilLuceneSearcher\getInstance(), ilLuceneSearchResultFilter\getInstance(), initFormSearch(), ilLuceneAdvancedQueryParser\parse(), and ilUtil\sendInfo().

Referenced by performSearch(), reset(), and search().

{
global $ilUser,$ilBench;
include_once './Services/Search/classes/Lucene/class.ilLuceneSearcher.php';
include_once './Services/Search/classes/Lucene/class.ilLuceneAdvancedQueryParser.php';
$qp = new ilLuceneAdvancedQueryParser($this->search_cache->getQuery());
$qp->parse();
$searcher->search();
// Load saved results
include_once './Services/Search/classes/Lucene/class.ilLuceneSearchResultFilter.php';
$filter = ilLuceneSearchResultFilter::getInstance($ilUser->getId());
$filter->loadFromDb();
// Highlight
if($filter->getResultObjIds()) {
$searcher->highlight($filter->getResultObjIds());
}
$this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lucene_adv_search.html','Services/Search');
include_once './Services/Search/classes/class.ilSearchResultPresentation.php';
$presentation = new ilSearchResultPresentation($this);
$presentation->setResults($filter->getResultIds());
$presentation->setSearcher($searcher);
// TODO: other handling required
$ilBench->start('Lucene','1500_fo');
$this->addPager($filter,'max_page');
$ilBench->stop('Lucene','1500_fo');
$presentation->setPreviousNext($this->prev_link, $this->next_link);
if($presentation->render())
{
$this->tpl->setVariable('SEARCH_RESULTS',$presentation->getHTML(true));
}
elseif(strlen(trim($qp->getQuery())))
{
ilUtil::sendInfo($this->lng->txt('search_no_match'));
}
// and finally add search form
$this->initFormSearch();
$this->tpl->setVariable('SEARCH_TABLE',$this->form->getHTML());
if($filter->getResultIds())
{
$this->fillAdminPanel();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilLuceneAdvancedSearchGUI::$fields = null
protected

Definition at line 46 of file class.ilLuceneAdvancedSearchGUI.php.

ilLuceneAdvancedSearchGUI::$ilTabs
protected

Definition at line 44 of file class.ilLuceneAdvancedSearchGUI.php.

Referenced by __construct().


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