35 include_once
'Services/Search/classes/class.ilAbstractSearch.php';
56 $this->mode = $a_mode;
79 case 'typical_age_range':
87 case 'classification':
123 case 'title_description':
132 echo
"ilMDSearch::performSearch() no mode given";
142 $where = $this->__createTitleDescriptionWhereCondition();
145 $query =
"SELECT obj_id,type " .
147 "FROM object_data " .
148 $where .
" " . $and .
' ' .
149 "ORDER BY obj_id DESC";
153 $this->search_result->addEntry(
$row->obj_id,
$row->type, $this->__prepareFound(
$row));
163 if (!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure']) {
166 if ($this->options[
'lom_coverage']) {
168 $and = $this->__createCoverageAndCondition();
171 if ($this->options[
'lom_structure']) {
172 $and .= (
"AND general_structure = " . $ilDB->quote($this->options[
'lom_structure'],
'text') .
" ");
175 $query =
"SELECT rbac_id,obj_type,obj_id " .
177 "FROM il_meta_general " .
183 if ($this->options[
'lom_coverage']) {
185 if (!in_array(0, $found)) {
186 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type, $found,
$row->obj_id);
189 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
200 if (!$this->options[
'lom_language']) {
204 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_language " .
205 "WHERE language = " . $ilDB->quote($this->options[
'lom_language'],
'text') .
" " .
207 "AND parent_type = 'meta_general'";
210 #var_dump("<pre>",$query,"<pre>"); 212 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
221 if (!$this->options[
'lom_role']) {
225 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute " .
226 "WHERE role = " . $ilDB->quote($this->options[
'lom_role'],
'text') .
" " .
230 #var_dump("<pre>",$query,"<pre>"); 232 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
242 $where = $this->__createEntityWhereCondition();
245 $query =
"SELECT rbac_id,obj_id,obj_type " .
247 "FROM il_meta_entity " .
248 $where .
" " . $and .
' ';
253 if (!in_array(0, $found)) {
254 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type, $found,
$row->obj_id);
265 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_requirement ";
273 #var_dump("<pre>",$query,"<pre>"); 275 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
282 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_educational ";
291 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
298 if (!$this->options[
'typ_age_1'] or !$this->options[
'typ_age_2']) {
302 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_typical_age_range " .
303 "WHERE typical_age_range_min >= '" . (int) $this->options[
'typ_age_1'] .
"' " .
304 "AND typical_age_range_max <= '" . (
int) $this->options[
'typ_age_2'] .
"'";
308 #var_dump("<pre>",$query,"<pre>"); 310 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
317 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_rights ";
325 #var_dump("<pre>",$query,"<pre>"); 327 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
334 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_classification ";
342 #var_dump("<pre>",$query,"<pre>"); 344 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
354 $where = $this->__createTaxonWhereCondition();
357 $query =
"SELECT rbac_id,obj_id,obj_type " .
359 "FROM il_meta_taxon " .
360 $where .
" " . $and .
' ';
365 if (!in_array(0, $found)) {
366 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type, $found,
$row->obj_id);
378 if ($a_in_classification) {
379 $and .=
" AND parent_type = 'meta_classification' ";
381 $where = $this->__createKeywordWhereCondition();
384 $query =
"SELECT rbac_id,obj_id,obj_type " .
386 "FROM il_meta_keyword " .
387 $where .
" " . $and .
' ';
392 if (!in_array(0, $found) or !$a_in_classification) {
393 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type, $found,
$row->obj_id);
405 if ($this->options[
'lom_version']) {
406 $where = $this->__createLifecycleWhereCondition();
409 $where =
"WHERE 1 = 1 ";
413 if ($this->options[
'lom_status']) {
414 $and .= (
" AND lifecycle_status = " . $ilDB->quote($this->options[
'lom_status'],
'text') .
"");
417 $query =
"SELECT rbac_id,obj_id,obj_type " .
419 "FROM il_meta_lifecycle " .
420 $where .
" " . $and .
' ';
425 if (!in_array(0, $found)) {
426 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type, $found,
$row->obj_id);
437 if (!$this->options[
'lom_format']) {
441 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_format " .
442 "WHERE format LIKE(" . $ilDB->quote($this->options[
'lom_format']) .
") " .
446 #var_dump("<pre>",$query,"<pre>"); 448 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
462 if ($this->options[
'lom_costs']) {
464 $where .= ($and .
"costs = " . $ilDB->quote($this->options[
'lom_costs'],
'text') .
" ");
466 if ($this->options[
'lom_copyright']) {
468 $where .= ($and .
"cpr_and_or = " . $ilDB->quote($this->options[
'lom_copyright'],
'text') .
" ");
480 if ($this->options[
'lom_purpose']) {
482 $where .= ($and .
"purpose = " . $ilDB->quote($this->options[
'lom_purpose']) .
" ");
494 if ($this->options[
'lom_interactivity']) {
496 $where .= ($and .
"interactivity_type = " . $ilDB->quote($this->options[
'lom_interactivity'],
'text') .
" ");
498 if ($this->options[
'lom_resource']) {
500 $where .= ($and .
"learning_resource_type = " . $ilDB->quote($this->options[
'lom_resource'],
'text') .
" ");
502 if ($this->options[
'lom_user_role']) {
504 $where .= ($and .
"intended_end_user_role = " . $ilDB->quote($this->options[
'lom_user_role'],
'text') .
" ");
506 if ($this->options[
'lom_context']) {
508 $where .= ($and .
"context = " . $ilDB->quote($this->options[
'lom_context'],
'text') .
" ");
510 if ($this->options[
'lom_level_start'] or $this->options[
'lom_level_end']) {
514 $this->options[
'lom_level_start'],
515 $this->options[
'lom_level_end'],
516 array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh')
519 $where .= ($and .
"interactivity_level " . $this->
__getInStatement($fields));
521 if ($this->options[
'lom_density_start'] or $this->options[
'lom_density_end']) {
525 $this->options[
'lom_density_start'],
526 $this->options[
'lom_density_end'],
527 array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh')
532 if ($this->options[
'lom_difficulty_start'] or $this->options[
'lom_difficulty_end']) {
536 $this->options[
'lom_difficulty_start'],
537 $this->options[
'lom_difficulty_end'],
538 array(
'VeryEasy',
'Easy',
'Medium',
'Difficult',
'VeryDifficult')
554 if ($this->options[
'lom_operating_system']) {
556 $where .= ($and .
"operating_system_name = " . $ilDB->quote($this->options[
'lom_operating_system']) .
" ");
558 if ($this->options[
'lom_browser']) {
560 $where .= ($and .
"browser_name = " . $ilDB->quote($this->options[
'lom_browser']) .
" ");
567 $a_val2 = $a_val2 ? $a_val2 : count(
$options);
569 if ($a_val1 > $a_val2) {
583 return $fields ? $fields :
array();
592 $in .= implode(
"','", $a_fields);
setMode($a_mode)
Define meta elements to search.
& __searchTypicalAgeRange()
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
& __searchTitleDescription()
& __searchClassification()
__getDifference($a_val1, $a_val2, $options)
__createEducationalWhere()
foreach($_POST as $key=> $value) $res
__createClassificationWhere()
& __searchKeyword($a_in_classification=false)
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
__getInStatement($a_fields)
__createRequirementWhere()
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options