35 include_once
'Services/Search/classes/class.ilAbstractSearch.php';
56 $this->mode = $a_mode;
80 case 'typical_age_range':
88 case 'classification':
124 case 'title_description':
133 echo "ilMDSearch::performSearch() no mode given";
142 $and = (
"AND type ".$this->__getInStatement($this->
getFilter()));
143 $where = $this->__createTitleDescriptionWhereCondition();
146 $query =
"SELECT obj_id,type ".
150 "ORDER BY obj_id DESC";
155 $this->search_result->addEntry(
$row->obj_id,
$row->type,$this->__prepareFound(
$row));
165 if(!$this->options[
'lom_coverage']
and !$this->options[
'lom_structure'])
169 if($this->options[
'lom_coverage'])
172 $and = $this->__createCoverageAndCondition();
175 if($this->options[
'lom_structure'])
177 $and .= (
"AND general_structure = ".$ilDB->quote($this->options[
'lom_structure'] ,
'text').
" ");
180 $query =
"SELECT rbac_id,obj_type,obj_id ".
182 "FROM il_meta_general ".
183 "WHERE obj_type ".$this->__getInStatement($this->
getFilter()).
" ".
189 if($this->options[
'lom_coverage'])
192 if(!in_array(0,$found))
194 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,$found,
$row->obj_id);
199 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
210 if(!$this->options[
'lom_language'])
215 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_language ".
216 "WHERE language = ".$ilDB->quote($this->options[
'lom_language'] ,
'text').
" ".
217 "AND obj_type ".$this->__getInStatement($this->
getFilter()).
' '.
218 "AND parent_type = 'meta_general'";
221 #var_dump("<pre>",$query,"<pre>"); 224 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
233 if(!$this->options[
'lom_role'])
238 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute ".
239 "WHERE role = ".$ilDB->quote($this->options[
'lom_role'] ,
'text').
" ".
240 "AND obj_type ".$this->__getInStatement($this->
getFilter());
243 #var_dump("<pre>",$query,"<pre>"); 246 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
255 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
256 $where = $this->__createEntityWhereCondition();
259 $query =
"SELECT rbac_id,obj_id,obj_type ".
261 "FROM il_meta_entity ".
268 if(!in_array(0,$found))
270 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,$found,
$row->obj_id);
281 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_requirement ";
287 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
290 #var_dump("<pre>",$query,"<pre>"); 293 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
300 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_educational ";
306 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
311 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
318 if(!$this->options[
'typ_age_1']
or !$this->options[
'typ_age_2'])
323 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_typical_age_range ".
324 "WHERE typical_age_range_min >= '".(int) $this->options[
'typ_age_1'].
"' ".
325 "AND typical_age_range_max <= '".(
int) $this->options[
'typ_age_2'].
"'";
329 #var_dump("<pre>",$query,"<pre>"); 332 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
339 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_rights ";
345 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
348 #var_dump("<pre>",$query,"<pre>"); 351 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
358 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_classification ";
364 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
367 #var_dump("<pre>",$query,"<pre>"); 370 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
379 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
380 $where = $this->__createTaxonWhereCondition();
383 $query =
"SELECT rbac_id,obj_id,obj_type ".
385 "FROM il_meta_taxon ".
392 if(!in_array(0,$found))
394 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,$found,
$row->obj_id);
405 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
406 if($a_in_classification)
408 $and .=
" AND parent_type = 'meta_classification' ";
410 $where = $this->__createKeywordWhereCondition();
413 $query =
"SELECT rbac_id,obj_id,obj_type ".
415 "FROM il_meta_keyword ".
422 if(!in_array(0,$found)
or !$a_in_classification)
424 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,$found,
$row->obj_id);
436 if($this->options[
'lom_version'])
438 $where = $this->__createLifecycleWhereCondition();
443 $where =
"WHERE 1 = 1 ";
445 $and = (
"AND obj_type ".$this->__getInStatement($this->
getFilter()));
447 if($this->options[
'lom_status'])
449 $and .= (
" AND lifecycle_status = ".$ilDB->quote($this->options[
'lom_status'] ,
'text') .
"");
452 $query =
"SELECT rbac_id,obj_id,obj_type ".
454 "FROM il_meta_lifecycle ".
461 if(!in_array(0,$found))
463 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,$found,
$row->obj_id);
474 if(!$this->options[
'lom_format'])
479 $query =
"SELECT rbac_id,obj_id,obj_type FROM il_meta_format ".
480 "WHERE format LIKE(".$ilDB->quote($this->options[
'lom_format']).
") ".
481 "AND obj_type ".$this->__getInStatement($this->
getFilter());
484 #var_dump("<pre>",$query,"<pre>"); 487 $this->search_result->addEntry(
$row->rbac_id,
$row->obj_type,
array(),
$row->obj_id);
501 if($this->options[
'lom_costs'])
504 $where .= ($and.
"costs = ".$ilDB->quote($this->options[
'lom_costs'] ,
'text').
" ");
506 if($this->options[
'lom_copyright'])
509 $where .= ($and.
"cpr_and_or = ".$ilDB->quote($this->options[
'lom_copyright'] ,
'text').
" ");
521 if($this->options[
'lom_purpose'])
524 $where .= ($and.
"purpose = ".$ilDB->quote($this->options[
'lom_purpose']).
" ");
536 if($this->options[
'lom_interactivity'])
539 $where .= ($and.
"interactivity_type = ".$ilDB->quote($this->options[
'lom_interactivity'] ,
'text').
" ");
541 if($this->options[
'lom_resource'])
544 $where .= ($and.
"learning_resource_type = ".$ilDB->quote($this->options[
'lom_resource'] ,
'text').
" ");
546 if($this->options[
'lom_user_role'])
549 $where .= ($and.
"intended_end_user_role = ".$ilDB->quote($this->options[
'lom_user_role'] ,
'text').
" ");
551 if($this->options[
'lom_context'])
554 $where .= ($and.
"context = ".$ilDB->quote($this->options[
'lom_context'] ,
'text').
" ");
556 if($this->options[
'lom_level_start']
or $this->options[
'lom_level_end'])
560 $fields = $this->
__getDifference($this->options[
'lom_level_start'],$this->options[
'lom_level_end'],
561 array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh'));
565 if($this->options[
'lom_density_start']
or $this->options[
'lom_density_end'])
569 $fields = $this->
__getDifference($this->options[
'lom_density_start'],$this->options[
'lom_density_end'],
570 array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh'));
574 if($this->options[
'lom_difficulty_start']
or $this->options[
'lom_difficulty_end'])
578 $fields = $this->
__getDifference($this->options[
'lom_difficulty_start'],$this->options[
'lom_difficulty_end'],
579 array(
'VeryEasy',
'Easy',
'Medium',
'Difficult',
'VeryDifficult'));
594 if($this->options[
'lom_operating_system'])
597 $where .= ($and.
"operating_system_name = ".$ilDB->quote($this->options[
'lom_operating_system']).
" ");
599 if($this->options[
'lom_browser'])
602 $where .= ($and.
"browser_name = ".$ilDB->quote($this->options[
'lom_browser']).
" ");
609 $a_val2 = $a_val2 ? $a_val2 : count(
$options);
611 if($a_val1 > $a_val2)
629 return $fields ? $fields :
array();
639 $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()
if(!is_array($argv)) $options
__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()