ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAdvancedSearch Class Reference
+ Inheritance diagram for ilAdvancedSearch:
+ Collaboration diagram for ilAdvancedSearch:

Public Member Functions

 setMode ($a_mode)
 Define meta elements to search. More...
 
 getMode ()
 
 setOptions (&$options)
 
 performSearch ()
 
__searchTitleDescription ()
 
__searchGeneral ()
 
__searchLanguage ()
 
__searchContribute ()
 
__searchEntity ()
 
__searchRequirement ()
 
__searchEducational ()
 
__searchTypicalAgeRange ()
 
__searchRights ()
 
__searchClassification ()
 
__searchTaxon ()
 
__searchKeyword ($a_in_classification=false)
 
__searchLifecycle ()
 
__searchFormat ()
 
 __createRightsWhere ()
 
 __createClassificationWhere ()
 
 __createEducationalWhere ()
 
 __createRequirementWhere ()
 
 __getDifference ($a_val1, $a_val2, $options)
 
 __getInStatement ($a_fields)
 
- Public Member Functions inherited from ilAbstractSearch
 __construct ($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 ()
 

Data Fields

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

Detailed Description

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

Member Function Documentation

◆ __createClassificationWhere()

ilAdvancedSearch::__createClassificationWhere ( )

Definition at line 484 of file class.ilAdvancedSearch.php.

References $DIC, and $ilDB.

Referenced by __searchClassification().

485  {
486  global $DIC;
487 
488  $ilDB = $DIC['ilDB'];
489 
490  $counter = 0;
491  $where = 'WHERE ';
492 
493 
494  if ($this->options['lom_purpose']) {
495  $and = $counter++ ? 'AND ' : ' ';
496  $where .= ($and . "purpose = " . $ilDB->quote($this->options['lom_purpose']) . " ");
497  }
498  return $counter ? $where : '';
499  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ __createEducationalWhere()

ilAdvancedSearch::__createEducationalWhere ( )

Definition at line 500 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, __getDifference(), and __getInStatement().

Referenced by __searchEducational().

501  {
502  global $DIC;
503 
504  $ilDB = $DIC['ilDB'];
505 
506  $counter = 0;
507  $where = 'WHERE ';
508 
509 
510  if ($this->options['lom_interactivity']) {
511  $and = $counter++ ? 'AND ' : ' ';
512  $where .= ($and . "interactivity_type = " . $ilDB->quote($this->options['lom_interactivity'], 'text') . " ");
513  }
514  if ($this->options['lom_resource']) {
515  $and = $counter++ ? 'AND ' : ' ';
516  $where .= ($and . "learning_resource_type = " . $ilDB->quote($this->options['lom_resource'], 'text') . " ");
517  }
518  if ($this->options['lom_user_role']) {
519  $and = $counter++ ? 'AND ' : ' ';
520  $where .= ($and . "intended_end_user_role = " . $ilDB->quote($this->options['lom_user_role'], 'text') . " ");
521  }
522  if ($this->options['lom_context']) {
523  $and = $counter++ ? 'AND ' : ' ';
524  $where .= ($and . "context = " . $ilDB->quote($this->options['lom_context'], 'text') . " ");
525  }
526  if ($this->options['lom_level_start'] or $this->options['lom_level_end']) {
527  $and = $counter++ ? 'AND ' : ' ';
528 
529  $fields = $this->__getDifference(
530  $this->options['lom_level_start'],
531  $this->options['lom_level_end'],
532  array('VeryLow','Low','Medium','High','VeryHigh')
533  );
534 
535  $where .= ($and . "interactivity_level " . $this->__getInStatement($fields));
536  }
537  if ($this->options['lom_density_start'] or $this->options['lom_density_end']) {
538  $and = $counter++ ? 'AND ' : ' ';
539 
540  $fields = $this->__getDifference(
541  $this->options['lom_density_start'],
542  $this->options['lom_density_end'],
543  array('VeryLow','Low','Medium','High','VeryHigh')
544  );
545 
546  $where .= ($and . "semantic_density " . $this->__getInStatement($fields));
547  }
548  if ($this->options['lom_difficulty_start'] or $this->options['lom_difficulty_end']) {
549  $and = $counter++ ? 'AND ' : ' ';
550 
551  $fields = $this->__getDifference(
552  $this->options['lom_difficulty_start'],
553  $this->options['lom_difficulty_end'],
554  array('VeryEasy','Easy','Medium','Difficult','VeryDifficult')
555  );
556 
557  $where .= ($and . "difficulty " . $this->__getInStatement($fields));
558  }
559 
560  return $counter ? $where : '';
561  }
global $DIC
Definition: saml.php:7
__getDifference($a_val1, $a_val2, $options)
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __createRequirementWhere()

ilAdvancedSearch::__createRequirementWhere ( )

Definition at line 562 of file class.ilAdvancedSearch.php.

References $DIC, and $ilDB.

Referenced by __searchRequirement().

563  {
564  global $DIC;
565 
566  $ilDB = $DIC['ilDB'];
567 
568  $counter = 0;
569  $where = 'WHERE ';
570 
571 
572  if ($this->options['lom_operating_system']) {
573  $and = $counter++ ? 'AND ' : ' ';
574  $where .= ($and . "operating_system_name = " . $ilDB->quote($this->options['lom_operating_system']) . " ");
575  }
576  if ($this->options['lom_browser']) {
577  $and = $counter++ ? 'AND ' : ' ';
578  $where .= ($and . "browser_name = " . $ilDB->quote($this->options['lom_browser']) . " ");
579  }
580  return $counter ? $where : '';
581  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ __createRightsWhere()

ilAdvancedSearch::__createRightsWhere ( )

Definition at line 464 of file class.ilAdvancedSearch.php.

References $DIC, and $ilDB.

Referenced by __searchRights().

465  {
466  global $DIC;
467 
468  $ilDB = $DIC['ilDB'];
469 
470  $counter = 0;
471  $where = 'WHERE ';
472 
473 
474  if ($this->options['lom_costs']) {
475  $and = $counter++ ? 'AND ' : ' ';
476  $where .= ($and . "costs = " . $ilDB->quote($this->options['lom_costs'], 'text') . " ");
477  }
478  if ($this->options['lom_copyright']) {
479  $and = $counter++ ? 'AND ' : ' ';
480  $where .= ($and . "cpr_and_or = " . $ilDB->quote($this->options['lom_copyright'], 'text') . " ");
481  }
482  return $counter ? $where : '';
483  }
global $DIC
Definition: saml.php:7
global $ilDB
+ Here is the caller graph for this function:

◆ __getDifference()

ilAdvancedSearch::__getDifference (   $a_val1,
  $a_val2,
  $options 
)

Definition at line 583 of file class.ilAdvancedSearch.php.

References PHPMailer\PHPMailer\$options.

Referenced by __createEducationalWhere().

584  {
585  $a_val2 = $a_val2 ? $a_val2 : count($options);
586  // Call again if a > b
587  if ($a_val1 > $a_val2) {
588  return $this->__getDifference($a_val2, $a_val1, $options);
589  }
590 
591  $counter = 0;
592  foreach ($options as $option) {
593  if ($a_val1 > ++$counter) {
594  continue;
595  }
596  if ($a_val2 < $counter) {
597  break;
598  }
599  $fields[] = $option;
600  }
601  return $fields ? $fields : array();
602  }
__getDifference($a_val1, $a_val2, $options)
+ Here is the caller graph for this function:

◆ __getInStatement()

ilAdvancedSearch::__getInStatement (   $a_fields)

Definition at line 604 of file class.ilAdvancedSearch.php.

References $in.

Referenced by __createEducationalWhere(), __searchClassification(), __searchContribute(), __searchEducational(), __searchEntity(), __searchFormat(), __searchGeneral(), __searchKeyword(), __searchLanguage(), __searchLifecycle(), __searchRequirement(), __searchRights(), __searchTaxon(), and __searchTitleDescription().

605  {
606  if (!$a_fields) {
607  return '';
608  }
609  $in = " IN ('";
610  $in .= implode("','", $a_fields);
611  $in .= "') ";
612 
613  return $in;
614  }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
+ Here is the caller graph for this function:

◆ __searchClassification()

& ilAdvancedSearch::__searchClassification ( )

Definition at line 338 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, __createClassificationWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

339  {
340  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_classification ";
341 
342  if (!strlen($where = $this->__createClassificationWhere())) {
343  return false;
344  }
345  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
346  $query = $query . $where . $and;
347  $res = $this->db->query($query);
348  #var_dump("<pre>",$query,"<pre>");
349  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
350  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
351  }
352  return $this->search_result;
353  }
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchContribute()

& ilAdvancedSearch::__searchContribute ( )

Definition at line 221 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, $query, $res, $row, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

222  {
223  global $DIC;
224 
225  $ilDB = $DIC['ilDB'];
226 
227  if (!$this->options['lom_role']) {
228  return false;
229  }
230 
231  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute " .
232  "WHERE role = " . $ilDB->quote($this->options['lom_role'], 'text') . " " .
233  "AND obj_type " . $this->__getInStatement($this->getFilter());
234 
235  $res = $this->db->query($query);
236  #var_dump("<pre>",$query,"<pre>");
237  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
238  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
239  }
240  return $this->search_result;
241  }
global $DIC
Definition: saml.php:7
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchEducational()

& ilAdvancedSearch::__searchEducational ( )

Definition at line 286 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, __createEducationalWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

287  {
288  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_educational ";
289 
290  if (!strlen($where = $this->__createEducationalWhere())) {
291  return false;
292  }
293  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
294  $query = $query . $where . $and;
295  $res = $this->db->query($query);
296  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
297  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
298  }
299  return $this->search_result;
300  }
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchEntity()

& ilAdvancedSearch::__searchEntity ( )

Definition at line 243 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

244  {
245  $this->setFields(array('entity'));
246 
247  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
248  $where = $this->__createEntityWhereCondition();
249  $locate = $this->__createLocateString();
250 
251  $query = "SELECT rbac_id,obj_id,obj_type " .
252  $locate .
253  "FROM il_meta_entity " .
254  $where . " " . $and . ' ';
255 
256  $res = $this->db->query($query);
257  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
258  $found = $this->__prepareFound($row);
259  if (!in_array(0, $found)) {
260  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $found, $row->obj_id);
261  }
262  }
263 
264  return $this->search_result;
265  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchFormat()

& ilAdvancedSearch::__searchFormat ( )

Definition at line 441 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, $query, $res, $row, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

442  {
443  global $DIC;
444 
445  $ilDB = $DIC['ilDB'];
446 
447  if (!$this->options['lom_format']) {
448  return false;
449  }
450 
451  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_format " .
452  "WHERE format LIKE(" . $ilDB->quote($this->options['lom_format']) . ") " .
453  "AND obj_type " . $this->__getInStatement($this->getFilter());
454 
455  $res = $this->db->query($query);
456  #var_dump("<pre>",$query,"<pre>");
457  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
458  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
459  }
460  return $this->search_result;
461  }
global $DIC
Definition: saml.php:7
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchGeneral()

& ilAdvancedSearch::__searchGeneral ( )

Definition at line 159 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

160  {
161  global $DIC;
162 
163  $ilDB = $DIC['ilDB'];
164 
165  if (!$this->options['lom_coverage'] and !$this->options['lom_structure']) {
166  return false;
167  }
168  if ($this->options['lom_coverage']) {
169  $this->setFields(array('coverage'));
170  $and = $this->__createCoverageAndCondition();
171  $locate = $this->__createLocateString();
172  }
173  if ($this->options['lom_structure']) {
174  $and .= ("AND general_structure = " . $ilDB->quote($this->options['lom_structure'], 'text') . " ");
175  }
176 
177  $query = "SELECT rbac_id,obj_type,obj_id " .
178  $locate . " " .
179  "FROM il_meta_general " .
180  "WHERE obj_type " . $this->__getInStatement($this->getFilter()) . " " .
181  $and;
182 
183  $res = $this->db->query($query);
184  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
185  if ($this->options['lom_coverage']) {
186  $found = $this->__prepareFound($row);
187  if (!in_array(0, $found)) {
188  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $found, $row->obj_id);
189  }
190  } else {
191  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
192  }
193  }
194 
195  return $this->search_result;
196  }
global $DIC
Definition: saml.php:7
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchKeyword()

& ilAdvancedSearch::__searchKeyword (   $a_in_classification = false)

Definition at line 379 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

380  {
381  $this->setFields(array('keyword'));
382 
383  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
384  if ($a_in_classification) {
385  $and .= " AND parent_type = 'meta_classification' ";
386  }
387  $where = $this->__createKeywordWhereCondition();
388  $locate = $this->__createLocateString();
389 
390  $query = "SELECT rbac_id,obj_id,obj_type " .
391  $locate .
392  "FROM il_meta_keyword " .
393  $where . " " . $and . ' ';
394 
395  $res = $this->db->query($query);
396  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
397  $found = $this->__prepareFound($row);
398  if (!in_array(0, $found) or !$a_in_classification) {
399  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $found, $row->obj_id);
400  }
401  }
402 
403  return $this->search_result;
404  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchLanguage()

& ilAdvancedSearch::__searchLanguage ( )

Definition at line 198 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, $query, $res, $row, ilAbstractSearch\$search_result, __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

199  {
200  global $DIC;
201 
202  $ilDB = $DIC['ilDB'];
203 
204  if (!$this->options['lom_language']) {
205  return false;
206  }
207 
208  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_language " .
209  "WHERE language = " . $ilDB->quote($this->options['lom_language'], 'text') . " " .
210  "AND obj_type " . $this->__getInStatement($this->getFilter()) . ' ' .
211  "AND parent_type = 'meta_general'";
212 
213  $res = $this->db->query($query);
214  #var_dump("<pre>",$query,"<pre>");
215  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
216  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
217  }
218  return $this->search_result;
219  }
global $DIC
Definition: saml.php:7
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchLifecycle()

& ilAdvancedSearch::__searchLifecycle ( )

Definition at line 405 of file class.ilAdvancedSearch.php.

References $DIC, $ilDB, $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

406  {
407  global $DIC;
408 
409  $ilDB = $DIC['ilDB'];
410 
411  $this->setFields(array('meta_version'));
412 
413  if ($this->options['lom_version']) {
414  $where = $this->__createLifecycleWhereCondition();
415  $locate = $this->__createLocateString();
416  } else {
417  $where = "WHERE 1 = 1 ";
418  }
419  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
420 
421  if ($this->options['lom_status']) {
422  $and .= (" AND lifecycle_status = " . $ilDB->quote($this->options['lom_status'], 'text') . "");
423  }
424 
425  $query = "SELECT rbac_id,obj_id,obj_type " .
426  $locate .
427  "FROM il_meta_lifecycle " .
428  $where . " " . $and . ' ';
429 
430  $res = $this->db->query($query);
431  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
432  $found = $this->__prepareFound($row);
433  if (!in_array(0, $found)) {
434  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $found, $row->obj_id);
435  }
436  }
437 
438  return $this->search_result;
439  }
global $DIC
Definition: saml.php:7
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchRequirement()

& ilAdvancedSearch::__searchRequirement ( )

Definition at line 269 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, __createRequirementWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

270  {
271  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_requirement ";
272 
273  if (!strlen($where = $this->__createRequirementWhere())) {
274  return false;
275  }
276  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
277  $query = $query . $where . $and;
278  $res = $this->db->query($query);
279  #var_dump("<pre>",$query,"<pre>");
280  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
281  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
282  }
283  return $this->search_result;
284  }
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchRights()

& ilAdvancedSearch::__searchRights ( )

Definition at line 321 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, __createRightsWhere(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, and ilAbstractSearch\getFilter().

Referenced by performSearch().

322  {
323  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_rights ";
324 
325  if (!strlen($where = $this->__createRightsWhere())) {
326  return false;
327  }
328  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
329  $query = $query . $where . $and;
330  $res = $this->db->query($query);
331  #var_dump("<pre>",$query,"<pre>");
332  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
333  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
334  }
335  return $this->search_result;
336  }
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTaxon()

& ilAdvancedSearch::__searchTaxon ( )

Definition at line 355 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilAbstractSearch\__prepareFound(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

356  {
357  $this->setFields(array('taxon'));
358 
359  $and = ("AND obj_type " . $this->__getInStatement($this->getFilter()));
360  $where = $this->__createTaxonWhereCondition();
361  $locate = $this->__createLocateString();
362 
363  $query = "SELECT rbac_id,obj_id,obj_type " .
364  $locate .
365  "FROM il_meta_taxon " .
366  $where . " " . $and . ' ';
367 
368  $res = $this->db->query($query);
369  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
370  $found = $this->__prepareFound($row);
371  if (!in_array(0, $found)) {
372  $this->search_result->addEntry($row->rbac_id, $row->obj_type, $found, $row->obj_id);
373  }
374  }
375 
376  return $this->search_result;
377  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTitleDescription()

& ilAdvancedSearch::__searchTitleDescription ( )

Definition at line 137 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), __getInStatement(), ilDBConstants\FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

138  {
139  $this->setFields(array('title','description'));
140 
141  $and = ("AND type " . $this->__getInStatement($this->getFilter()));
142  $where = $this->__createTitleDescriptionWhereCondition();
143  $locate = $this->__createLocateString();
144 
145  $query = "SELECT obj_id,type " .
146  $locate .
147  "FROM object_data " .
148  $where . " " . $and . ' ' .
149  "ORDER BY obj_id DESC";
150 
151  $res = $this->db->query($query);
152  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
153  $this->search_result->addEntry($row->obj_id, $row->type, $this->__prepareFound($row));
154  }
155 
156  return $this->search_result;
157  }
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __searchTypicalAgeRange()

& ilAdvancedSearch::__searchTypicalAgeRange ( )

Definition at line 302 of file class.ilAdvancedSearch.php.

References $query, $res, $row, ilAbstractSearch\$search_result, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by performSearch().

303  {
304  if (!$this->options['typ_age_1'] or !$this->options['typ_age_2']) {
305  return false;
306  }
307 
308  $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_typical_age_range " .
309  "WHERE typical_age_range_min >= '" . (int) $this->options['typ_age_1'] . "' " .
310  "AND typical_age_range_max <= '" . (int) $this->options['typ_age_2'] . "'";
311 
312 
313  $res = $this->db->query($query);
314  #var_dump("<pre>",$query,"<pre>");
315  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
316  $this->search_result->addEntry($row->rbac_id, $row->obj_type, array(), $row->obj_id);
317  }
318  return $this->search_result;
319  }
foreach($_POST as $key=> $value) $res
$query
$row
+ Here is the caller graph for this function:

◆ getMode()

ilAdvancedSearch::getMode ( )

Definition at line 58 of file class.ilAdvancedSearch.php.

References $mode.

Referenced by performSearch().

59  {
60  return $this->mode;
61  }
+ Here is the caller graph for this function:

◆ performSearch()

ilAdvancedSearch::performSearch ( )

Definition at line 68 of file class.ilAdvancedSearch.php.

References __searchClassification(), __searchContribute(), __searchEducational(), __searchEntity(), __searchFormat(), __searchGeneral(), __searchKeyword(), __searchLanguage(), __searchLifecycle(), __searchRequirement(), __searchRights(), __searchTaxon(), __searchTitleDescription(), __searchTypicalAgeRange(), and getMode().

69  {
70  switch ($this->getMode()) {
71  case 'requirement':
72  return $this->__searchRequirement();
73  break;
74 
75  case 'educational':
76  return $this->__searchEducational();
77  break;
78 
79  case 'typical_age_range':
80  return $this->__searchTypicalAgeRange();
81  break;
82 
83  case 'rights':
84  return $this->__searchRights();
85  break;
86 
87  case 'classification':
88  return $this->__searchClassification();
89  break;
90 
91  case 'taxon':
92  return $this->__searchTaxon();
93  break;
94 
95  case 'keyword':
96  return $this->__searchKeyword();
97  break;
98 
99  case 'format':
100  return $this->__searchFormat();
101  break;
102 
103  case 'lifecycle':
104  return $this->__searchLifecycle();
105  break;
106 
107  case 'contribute':
108  return $this->__searchContribute();
109  break;
110 
111  case 'entity':
112  return $this->__searchEntity();
113  break;
114 
115  case 'general':
116  return $this->__searchGeneral();
117  break;
118 
119  case 'keyword_all':
120  return $this->__searchKeyword(false);
121  break;
122 
123  case 'title_description':
124  return $this->__searchTitleDescription();
125  break;
126 
127  case 'language':
128  return $this->__searchLanguage();
129  break;
130 
131  default:
132  echo "ilMDSearch::performSearch() no mode given";
133  return false;
134  }
135  }
& __searchKeyword($a_in_classification=false)
+ Here is the call graph for this function:

◆ setMode()

ilAdvancedSearch::setMode (   $a_mode)

Define meta elements to search.

Parameters
arrayelements to search in. E.G array('keyword','contribute') public

Definition at line 54 of file class.ilAdvancedSearch.php.

55  {
56  $this->mode = $a_mode;
57  }

◆ setOptions()

ilAdvancedSearch::setOptions ( $options)

Definition at line 63 of file class.ilAdvancedSearch.php.

References PHPMailer\PHPMailer\$options.

64  {
65  $this->options = &$options;
66  }

Field Documentation

◆ $db

ilAdvancedSearch::$db = null

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

◆ $mode

ilAdvancedSearch::$mode = ''

Definition at line 39 of file class.ilAdvancedSearch.php.

Referenced by getMode().

◆ $query_parser

ilAdvancedSearch::$query_parser = null

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


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