ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilShopObjectSearch Class Reference
+ Inheritance diagram for ilShopObjectSearch:
+ Collaboration diagram for ilShopObjectSearch:

Public Member Functions

 __construct ($qp_obj)
 
 setCustomSearchResultObject ($a_search_result_obect)
 
 setFilterShopTopicId ($a_topic_id)
 
 getFilterShopTopicId ()
 
 performSearch ()
 
 __createInStatement ()
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
- Public Member Functions inherited from ilAbstractSearch
 ilAbstractSearch (&$qp_obj)
 Constructor public. More...
 
 setFields ($a_fields)
 Set fields to search. More...
 
 getFields ()
 Get fields to search. More...
 
 setFilter ($a_filter)
 set object type to search in More...
 
 setIdFilter ($a_id_filter)
 Set id filter Filters search by given object id. More...
 
 getIdFilter ()
 Get Id filter. More...
 
 appendToFilter ($a_type)
 Append object type to filter. More...
 
 getFilter ()
 get object type to search in More...
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
performSearch ()
 

Private Attributes

 $filter_shop_topic_id = 0
 

Additional Inherited Members

- Data Fields inherited from ilAbstractSearch
 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Detailed Description

Definition at line 13 of file class.ilShopObjectSearch.php.

Constructor & Destructor Documentation

◆ __construct()

ilShopObjectSearch::__construct (   $qp_obj)

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

References ilAbstractSearch\setFields().

18  {
19  parent::__construct($qp_obj);
20  $this->setFields(array('title', 'description'));
21  }
setFields($a_fields)
Set fields to search.
+ Here is the call graph for this function:

Member Function Documentation

◆ __createInStatement()

ilShopObjectSearch::__createInStatement ( )

Definition at line 72 of file class.ilShopObjectSearch.php.

Referenced by performSearch().

73  {
74  return ' AND ' . $this->db->in('type', $this->object_types, false, 'text');
75  }
+ Here is the caller graph for this function:

◆ __createLocateString()

ilShopObjectSearch::__createLocateString ( )

build locate string in case of AND search

Returns
string public

Definition at line 82 of file class.ilShopObjectSearch.php.

References $ilDB, and fields.

Referenced by performSearch().

83  {
84  global $ilDB;
85 
86  if($this->query_parser->getCombination() == 'or')
87  {
88  return '';
89  }
90 
91  if(!strlen($this->query_parser->getQueryString()))
92  {
93  return '';
94  }
95 
96  $locate = '';
97 
98  if(count($this->fields) > 1)
99  {
100  $tmp_fields = array();
101  foreach($this->fields as $field)
102  {
103  $tmp_fields[] = array($field,'text');
104  }
105  $complete_str = $ilDB->concat($tmp_fields);
106  }
107  else
108  {
109  $complete_str = $this->fields[0];
110  }
111 
112  $counter = 0;
113  foreach($this->query_parser->getQuotedWords() as $word)
114  {
115  $locate .= ',';
116  $locate .= $ilDB->locate($ilDB->quote($word, 'text'), $complete_str, 1);
117  $locate .= (' found'.$counter++);
118  $locate .= ' ';
119  }
120 
121  return $locate;
122  }
$errors fields
Definition: imgupload.php:48
global $ilDB
+ Here is the caller graph for this function:

◆ __prepareFound()

ilShopObjectSearch::__prepareFound ( $row)

Definition at line 124 of file class.ilShopObjectSearch.php.

References $row.

125  {
126  if($this->query_parser->getCombination() == 'or')
127  {
128  return array();
129  }
130 
131  if(!strlen($this->query_parser->getQueryString()))
132  {
133  return array();
134  }
135 
136  $counter = 0;
137  foreach($this->query_parser->getQuotedWords() as $word)
138  {
139  $res_found = 'found'.$counter++;
140  $found[] = $row->$res_found;
141  }
142  return $found ? $found : array();
143  }

◆ getFilterShopTopicId()

ilShopObjectSearch::getFilterShopTopicId ( )

Definition at line 32 of file class.ilShopObjectSearch.php.

References $filter_shop_topic_id.

Referenced by ilLikeShopObjectSearch\__createWhereCondition().

+ Here is the caller graph for this function:

◆ performSearch()

ilShopObjectSearch::performSearch ( )

Definition at line 37 of file class.ilShopObjectSearch.php.

References $in, $query, $row, ilAbstractSearch\$search_result, __createInStatement(), __createLocateString(), and DB_FETCHMODE_OBJECT.

38  {
39  $types = array();
40  $values = array();
41 
42  $in = $this->__createInStatement();
43  $where = $this->__createWhereCondition();
44  $locate = $this->__createLocateString();
45 
46  $query = "SELECT object_reference.ref_id, object_data.obj_id,object_data.type ".$locate."
47  FROM payment_objects
48  INNER JOIN object_reference ON object_reference.ref_id = payment_objects.ref_id
49  INNER JOIN object_data ON object_data.obj_id = object_reference.obj_id ";
50 
51  $query .= $where['query'];
52  $types = array_merge($types, $where['types']);
53  $values = array_merge($values, $where['values']);
54  $query .= $in;
55 
56  $query .= " GROUP BY object_reference.ref_id, object_data.obj_id,object_data.type,object_data.title,object_data.description";
57  $query .= " ORDER BY object_data.obj_id DESC";
58 
59  $statement = $this->db->queryf(
60  $query,
61  $types,
62  $values
63  );
64 
65  while($row = $statement->fetchRow(DB_FETCHMODE_OBJECT))
66  {
67  $this->search_result->addEntry($row->ref_id, $row->type, $this->__prepareFound($row));
68  }
69  return $this->search_result;
70  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
__createLocateString()
build locate string in case of AND search
+ Here is the call graph for this function:

◆ setCustomSearchResultObject()

ilShopObjectSearch::setCustomSearchResultObject (   $a_search_result_obect)

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

24  {
25  $this->search_result = $a_search_result_obect;
26  }

◆ setFilterShopTopicId()

ilShopObjectSearch::setFilterShopTopicId (   $a_topic_id)

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

29  {
30  $this->filter_shop_topic_id = $a_topic_id;
31  }

Field Documentation

◆ $filter_shop_topic_id

ilShopObjectSearch::$filter_shop_topic_id = 0
private

Definition at line 15 of file class.ilShopObjectSearch.php.

Referenced by getFilterShopTopicId().


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