ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopAdvancedSearchGUI Class Reference

Class ilShopAdvancedSearchGUI. More...

+ Inheritance diagram for ilShopAdvancedSearchGUI:
+ Collaboration diagram for ilShopAdvancedSearchGUI:

Public Member Functions

 __construct ()
 setSorting ()
 executeCommand ()
 setFilter ()
 resetFilter ()
 performSearch ()
 showForm ($result=null)
 setCombination ($a_combination)
 getCombination ()
 setString ($a_str)
 getString ()
 setDetails ($a_details)
 getDetails ()
 setTopicId ($a_topic)
 getTopicId ()
 setSortDirection ($a_sort_direction)
 getSortDirection ()
 setSortField ($a_field)
 getSortField ()
 setSortingTypeTopics ($a_field)
 getSortingTypeTopics ()
 setSortingDirectionTopics ($a_sort_direction)
 getSortingDirectionTopics ()

Data Fields

const SEARCH_OR = 'or'
const SEARCH_AND = 'and'

Protected Member Functions

 prepareOutput ()
- Protected Member Functions inherited from ilShopBaseGUI
 addPager ($result)

Private Member Functions

 parseQueryString ()
 searchObjects ($query_parser)
 getFilter ()

Private Attributes

 $string = ''
 $combination = ''
 $details = array()
 $topic_id = 0
 $sort_type_topics = ''
 $sort_direction_topics = ''
 $sort_field = ''
 $sort_direction = ''

Additional Inherited Members

- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 $lng = null
 $tpl = null
 $settings = null

Detailed Description

Class ilShopAdvancedSearchGUI.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 14 of file class.ilShopAdvancedSearchGUI.php.

Constructor & Destructor Documentation

ilShopAdvancedSearchGUI::__construct ( )

Reimplemented from ilShopBaseGUI.

Definition at line 28 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION, setCombination(), setDetails(), setSortDirection(), setSortField(), setSortingDirectionTopics(), setSortingTypeTopics(), setString(), and setTopicId().

{
if($this->cmd == 'setFilter')
{
// set filter
$this->setCombination($_SESSION['shop_advanced_search']['combination']);
$this->setString($_SESSION['shop_advanced_search']['string']);
$this->setDetails($_SESSION['shop_advanced_search']['details']);
$this->setTopicId($_SESSION['shop_advanced_search']['topic']);
// set sorting
$this->setSortingTypeTopics($_SESSION['shop_advanced_search']['order_topics_sorting_type']);
$this->setSortingDirectionTopics($_SESSION['shop_advanced_search']['shop_topics_sorting_direction']);
$this->setSortField($_SESSION['shop_advanced_search']['shop_order_field']);
$this->setSortDirection($_SESSION['shop_advanced_search']['shop_order_direction']);
}
}

+ Here is the call graph for this function:

Member Function Documentation

ilShopAdvancedSearchGUI::executeCommand ( )

Definition at line 61 of file class.ilShopAdvancedSearchGUI.php.

References $_POST, $cmd, and prepareOutput().

{
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
if(isset($_POST['cmd']) && $_POST['cmd'] == 'setFilter')
{
$this->cmd = 'setFilter';
}
else
{
$this->cmd = $this->ctrl->getCmd();
}
switch($next_class)
{
default:
if(!$cmd)
{
$cmd = 'performSearch';
}
$this->prepareOutput();
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilShopAdvancedSearchGUI::getCombination ( )

Definition at line 295 of file class.ilShopAdvancedSearchGUI.php.

References SEARCH_OR.

Referenced by parseQueryString().

{
return $this->combination ? $this->combination : self::SEARCH_OR;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getDetails ( )

Definition at line 311 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getFilter(), and performSearch().

{
return $this->details ? $this->details : array();
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getFilter ( )
private

Definition at line 229 of file class.ilShopAdvancedSearchGUI.php.

References getDetails().

Referenced by searchObjects().

{
foreach($this->getDetails() as $key => $detail_type)
{
switch($detail_type)
{
case 'crs':
$filter[] = 'crs';
break;
case 'lms':
$filter[] = 'lm';
$filter[] = 'sahs';
$filter[] = 'htlm';
break;
case 'tst':
$filter[] = 'tst';
break;
case 'fil':
$filter[] = 'file';
break;
}
}
return $filter ? $filter : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getSortDirection ( )

Definition at line 328 of file class.ilShopAdvancedSearchGUI.php.

References $sort_direction.

{
}
ilShopAdvancedSearchGUI::getSortField ( )

Definition at line 336 of file class.ilShopAdvancedSearchGUI.php.

References $sort_field.

{
}
ilShopAdvancedSearchGUI::getSortingDirectionTopics ( )

Definition at line 368 of file class.ilShopAdvancedSearchGUI.php.

References $sort_direction_topics.

Referenced by searchObjects().

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getSortingTypeTopics ( )

Definition at line 352 of file class.ilShopAdvancedSearchGUI.php.

References $ilUser, $sort_type_topics, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by searchObjects().

{
global $ilUser;
if(ANONYMOUS_USER_ID == $ilUser->getId() &&
$this->sort_type_topics == ilShopTopics::TOPICS_SORT_MANUALLY)
{
$this->sort_type_topics = ilShopTopics::TOPICS_SORT_BY_TITLE;
}
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getString ( )

Definition at line 303 of file class.ilShopAdvancedSearchGUI.php.

References $string.

Referenced by parseQueryString().

{
return $this->string;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::getTopicId ( )

Definition at line 319 of file class.ilShopAdvancedSearchGUI.php.

References $topic_id.

Referenced by searchObjects().

{
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::parseQueryString ( )
private

Definition at line 157 of file class.ilShopAdvancedSearchGUI.php.

References getCombination(), getString(), and ilUtil\stripSlashes().

Referenced by performSearch().

{
include_once 'Services/Search/classes/class.ilQueryParser.php';
$query_parser = new ilQueryParser(ilUtil::stripSlashes($this->getString()));
$query_parser->setCombination($this->getCombination());
$query_parser->parse();
if (!$query_parser->validate())
{
return $query_parser->getMessage();
}
return $query_parser;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::performSearch ( )

Definition at line 120 of file class.ilShopAdvancedSearchGUI.php.

References $result, ilShopSearchResult\_getInstance(), getDetails(), parseQueryString(), searchObjects(), ilUtil\sendInfo(), SHOP_ADVANCED_SEARCH, and showForm().

Referenced by setFilter(), and setSorting().

{
if(!$this->getDetails())
{
if(method_exists($this, $this->ctrl->getCmd()))
ilUtil::sendInfo($this->lng->txt('search_choose_object_type'));
return false;
}
// Step 1: parse query string
if(!is_object($query_parser = $this->parseQueryString()))
{
ilUtil::sendInfo($query_parser);
return false;
}
// Step 2: perform object search. Get an ObjectSearch object via factory. Depends on fulltext or like search type.
$result = $this->searchObjects($query_parser);
// Step 3:
$result->filter(ROOT_FOLDER_ID, $query_parser->getCombination() == 'and');
$result->save();
if(!count($result->getResults()))
{
ilUtil::sendInfo($this->lng->txt('payment_shop_not_objects_found'));
}
$this->showForm($result);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::prepareOutput ( )
protected

Reimplemented from ilShopBaseGUI.

Definition at line 373 of file class.ilShopAdvancedSearchGUI.php.

Referenced by executeCommand().

{
global $ilTabs;
$ilTabs->setTabActive('advanced_search');
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::resetFilter ( )

Definition at line 114 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION, and showForm().

{
unset($_SESSION['shop_advanced_search']);
return $this->showForm();
}

+ Here is the call graph for this function:

ilShopAdvancedSearchGUI::searchObjects (   $query_parser)
private

Definition at line 173 of file class.ilShopAdvancedSearchGUI.php.

References $_GET, $res, ilShopSearchResult\_getInstance(), ilShopTopics\_getInstance(), ilObjectSearchFactory\_getShopMetaDataSearchInstance(), ilObjectSearchFactory\_getShopObjectSearchInstance(), getFilter(), getSortingDirectionTopics(), getSortingTypeTopics(), getTopicId(), and SHOP_ADVANCED_SEARCH.

Referenced by performSearch().

{
// create new search result object and assign the sorted topics
if((bool)$this->settings->get('topics_allow_custom_sorting'))
{
ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
ilShopTopics::_getInstance()->enableCustomSorting(true);
ilShopTopics::_getInstance()->setSortingType((int)$this->getSortingTypeTopics());
ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->getSortingDirectionTopics()));
}
else
{
ilShopTopics::_getInstance()->setIdFilter((int)$this->getTopicId());
ilShopTopics::_getInstance()->enableCustomSorting(false);
ilShopTopics::_getInstance()->setSortingType((int)$this->settings->get('topics_sorting_type'));
ilShopTopics::_getInstance()->setSortingDirection(strtoupper($this->settings->get('topics_sorting_direction')));
}
$oSearchResult->setTopics(ilShopTopics::_getInstance()->getTopics());
$oSearchResult->setResultPageNumber((int)$_GET['page_number']);
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
$res = null;
$obj_search->setFilterShopTopicId((int)$this->getTopicId());
$obj_search->setFilter($this->getFilter());
$obj_search->setCustomSearchResultObject($oSearchResult);
$res = $obj_search->performSearch();
$meta_search_c->setMode('contribute');
$meta_search_c->setFilter($this->getFilter());
$meta_search_c->setFilterShopTopicId((int)$this->getTopicId());
$meta_search_c->setCustomSearchResultObject($oSearchResult);
$res->mergeEntries($meta_search_c->performSearch());
$meta_search_t->setMode('title');
$meta_search_t->setFilter($this->getFilter());
$meta_search_t->setCustomSearchResultObject($oSearchResult);
$meta_search_t->setFilterShopTopicId((int)$this->getTopicId());
$res->mergeEntries($meta_search_t->performSearch());
$meta_search_k->setMode('keyword');
$meta_search_k->setFilter($this->getFilter());
$meta_search_k->setCustomSearchResultObject($oSearchResult);
$meta_search_k->setFilterShopTopicId((int)$this->getTopicId());
$res->mergeEntries($meta_search_k->performSearch());
return $res;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setCombination (   $a_combination)

Definition at line 291 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setFilter().

{
$_SESSION['shop_advanced_search']['combination'] = $this->combination = $a_combination;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setDetails (   $a_details)

Definition at line 307 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setFilter().

{
$_SESSION['shop_advanced_search']['details'] = $this->details = $a_details;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setFilter ( )

Definition at line 91 of file class.ilShopAdvancedSearchGUI.php.

References $_POST, performSearch(), setCombination(), setDetails(), setString(), and setTopicId().

{
if(isset($_POST['search_combination']))
{
$this->setCombination($_POST['search_combination']);
}
if(isset($_POST['search_string']))
{
$this->setString($_POST['search_string']);
}
if(isset($_POST['search_details']))
{
$this->setDetails($_POST['search_details']);
}
if(isset($_POST['search_topic']))
{
$this->setTopicId($_POST['search_topic']);
}
$this->performSearch();
}

+ Here is the call graph for this function:

ilShopAdvancedSearchGUI::setSortDirection (   $a_sort_direction)

Definition at line 324 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setSorting().

{
$_SESSION['shop_advanced_search']['order_direction'] = $this->sort_direction = $a_sort_direction;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setSortField (   $a_field)

Definition at line 332 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setSorting().

{
$_SESSION['shop_advanced_search']['shop_order_field'] = $this->sort_field = $a_field;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setSorting ( )

Definition at line 49 of file class.ilShopAdvancedSearchGUI.php.

References $_POST, performSearch(), setSortDirection(), setSortField(), setSortingDirectionTopics(), and setSortingTypeTopics().

{
$this->setSortingTypeTopics($_POST['topics_sorting_type']);
$this->setSortingDirectionTopics($_POST['topics_sorting_direction']);
$this->setSortField($_POST['order_field']);
$this->setSortDirection($_POST['order_direction']);
$this->performSearch();
return true;
}

+ Here is the call graph for this function:

ilShopAdvancedSearchGUI::setSortingDirectionTopics (   $a_sort_direction)

Definition at line 364 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setSorting().

{
$_SESSION['shop_advanced_search']['shop_topics_sorting_direction'] = $this->sort_direction_topics = $a_sort_direction;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setSortingTypeTopics (   $a_field)

Definition at line 340 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION, $ilUser, ilShopTopics\TOPICS_SORT_BY_TITLE, and ilShopTopics\TOPICS_SORT_MANUALLY.

Referenced by __construct(), and setSorting().

{
global $ilUser;
if(ANONYMOUS_USER_ID == $ilUser->getId() &&
{
}
$_SESSION['shop_advanced_search']['order_topics_sorting_type'] = $this->sort_type_topics = $a_field;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setString (   $a_str)

Definition at line 299 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setFilter().

{
$_SESSION['shop_advanced_search']['string'] = $this->string = $a_str;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::setTopicId (   $a_topic)

Definition at line 315 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION.

Referenced by __construct(), and setFilter().

{
$_SESSION['shop_advanced_search']['topic'] = $this->topic_id = $a_topic;
}

+ Here is the caller graph for this function:

ilShopAdvancedSearchGUI::showForm (   $result = null)

Definition at line 254 of file class.ilShopAdvancedSearchGUI.php.

References $_SESSION, $result, and ilShopBaseGUI\addPager().

Referenced by performSearch(), and resetFilter().

{
$this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_advanced_search.html', 'Services/Payment');
include_once 'Services/Payment/classes/class.ilAdvancedSearchFilterGUI.php';
$filterGUI = new ilAdvancedSearchFilterGUI($this, $this->cmd);
$filterGUI->initFilter();
if($this->cmd == 'setFilter')
{
$filterGUI->writeFilterToSession();
}
else
{
$_SESSION['shop_advanced_search'] = array();
$filterGUI->resetFilter();
}
$this->tpl->setVariable('FILTER', $filterGUI->getHtml());
// show results
if($result && count($result->getResults()))
{
include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
$search_result_presentation = new ilShopResultPresentationGUI($result);
$this->tpl->setVariable('RESULTS', $search_result_presentation->showAdvancedSearchResults());
}
else
{
$this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
}
if($result)
{
$this->addPager($result);
}
// return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilShopAdvancedSearchGUI::$combination = ''
private

Definition at line 20 of file class.ilShopAdvancedSearchGUI.php.

ilShopAdvancedSearchGUI::$details = array()
private

Definition at line 21 of file class.ilShopAdvancedSearchGUI.php.

ilShopAdvancedSearchGUI::$sort_direction = ''
private

Definition at line 26 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortDirection().

ilShopAdvancedSearchGUI::$sort_direction_topics = ''
private

Definition at line 24 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortingDirectionTopics().

ilShopAdvancedSearchGUI::$sort_field = ''
private

Definition at line 25 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortField().

ilShopAdvancedSearchGUI::$sort_type_topics = ''
private

Definition at line 23 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getSortingTypeTopics().

ilShopAdvancedSearchGUI::$string = ''
private

Definition at line 19 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getString().

ilShopAdvancedSearchGUI::$topic_id = 0
private

Definition at line 22 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getTopicId().

const ilShopAdvancedSearchGUI::SEARCH_AND = 'and'

Definition at line 17 of file class.ilShopAdvancedSearchGUI.php.

const ilShopAdvancedSearchGUI::SEARCH_OR = 'or'

Definition at line 16 of file class.ilShopAdvancedSearchGUI.php.

Referenced by getCombination().


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