35include_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";
 
  139        $this->
setFields(array(
'title',
'description'));
 
  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));
 
  165        if (!$this->options[
'lom_coverage'] and !$this->options[
'lom_structure']) {
 
  168        if ($this->options[
'lom_coverage']) {
 
  170            $and = $this->__createCoverageAndCondition();
 
  173        if ($this->options[
'lom_structure']) {
 
  174            $and .= (
"AND general_structure = " . 
$ilDB->quote($this->options[
'lom_structure'], 
'text') . 
" ");
 
  177        $query = 
"SELECT rbac_id,obj_type,obj_id " .
 
  179            "FROM il_meta_general " .
 
  185            if ($this->options[
'lom_coverage']) {
 
  187                if (!in_array(0, $found)) {
 
  188                    $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, $found, 
$row->obj_id);
 
  191                $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  204        if (!$this->options[
'lom_language']) {
 
  208        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_language " .
 
  209            "WHERE language = " . 
$ilDB->quote($this->options[
'lom_language'], 
'text') . 
" " .
 
  211            "AND parent_type = 'meta_general'";
 
  214        #var_dump("<pre>",$query,"<pre>");
 
  216            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  227        if (!$this->options[
'lom_role']) {
 
  231        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute " .
 
  232            "WHERE role = " . 
$ilDB->quote($this->options[
'lom_role'], 
'text') . 
" " .
 
  236        #var_dump("<pre>",$query,"<pre>");
 
  238            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  248        $where = $this->__createEntityWhereCondition();
 
  251        $query = 
"SELECT rbac_id,obj_id,obj_type " .
 
  253            "FROM il_meta_entity " .
 
  254            $where . 
" " . $and . 
' ';
 
  259            if (!in_array(0, $found)) {
 
  260                $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, $found, 
$row->obj_id);
 
  271        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_requirement ";
 
  279        #var_dump("<pre>",$query,"<pre>");
 
  281            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  288        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_educational ";
 
  297            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  304        if (!$this->options[
'typ_age_1'] or !$this->options[
'typ_age_2']) {
 
  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'] . 
"'";
 
  314        #var_dump("<pre>",$query,"<pre>");
 
  316            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  323        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_rights ";
 
  331        #var_dump("<pre>",$query,"<pre>");
 
  333            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  340        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_classification ";
 
  348        #var_dump("<pre>",$query,"<pre>");
 
  350            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  360        $where = $this->__createTaxonWhereCondition();
 
  363        $query = 
"SELECT rbac_id,obj_id,obj_type " .
 
  365            "FROM il_meta_taxon " .
 
  366            $where . 
" " . $and . 
' ';
 
  371            if (!in_array(0, $found)) {
 
  372                $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, $found, 
$row->obj_id);
 
  384        if ($a_in_classification) {
 
  385            $and .= 
" AND parent_type = 'meta_classification' ";
 
  387        $where = $this->__createKeywordWhereCondition();
 
  390        $query = 
"SELECT rbac_id,obj_id,obj_type " .
 
  392            "FROM il_meta_keyword " .
 
  393            $where . 
" " . $and . 
' ';
 
  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);
 
  413        if ($this->options[
'lom_version']) {
 
  414            $where = $this->__createLifecycleWhereCondition();
 
  417            $where = 
"WHERE 1 = 1 ";
 
  421        if ($this->options[
'lom_status']) {
 
  422            $and .= (
" AND lifecycle_status = " . 
$ilDB->quote($this->options[
'lom_status'], 
'text') . 
"");
 
  425        $query = 
"SELECT rbac_id,obj_id,obj_type " .
 
  427            "FROM il_meta_lifecycle " .
 
  428            $where . 
" " . $and . 
' ';
 
  433            if (!in_array(0, $found)) {
 
  434                $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, $found, 
$row->obj_id);
 
  447        if (!$this->options[
'lom_format']) {
 
  451        $query = 
"SELECT rbac_id,obj_id,obj_type FROM il_meta_format " .
 
  452            "WHERE format LIKE(" . 
$ilDB->quote($this->options[
'lom_format']) . 
") " .
 
  456        #var_dump("<pre>",$query,"<pre>");
 
  458            $this->search_result->addEntry(
$row->rbac_id, 
$row->obj_type, array(), 
$row->obj_id);
 
  474        if ($this->options[
'lom_costs']) {
 
  475            $and = $counter++ ? 
'AND ' : 
' ';
 
  476            $where .= ($and . 
"costs = " . 
$ilDB->quote($this->options[
'lom_costs'], 
'text') . 
" ");
 
  478        if ($this->options[
'lom_copyright']) {
 
  479            $and = $counter++ ? 
'AND ' : 
' ';
 
  480            $where .= ($and . 
"cpr_and_or = " . 
$ilDB->quote($this->options[
'lom_copyright'], 
'text') . 
" ");
 
  482        return $counter ? $where : 
'';
 
  494        if ($this->options[
'lom_purpose']) {
 
  495            $and = $counter++ ? 
'AND ' : 
' ';
 
  496            $where .= ($and . 
"purpose = " . 
$ilDB->quote($this->options[
'lom_purpose']) . 
" ");
 
  498        return $counter ? $where : 
'';
 
  510        if ($this->options[
'lom_interactivity']) {
 
  511            $and = $counter++ ? 
'AND ' : 
' ';
 
  512            $where .= ($and . 
"interactivity_type = " . 
$ilDB->quote($this->options[
'lom_interactivity'], 
'text') . 
" ");
 
  514        if ($this->options[
'lom_resource']) {
 
  515            $and = $counter++ ? 
'AND ' : 
' ';
 
  516            $where .= ($and . 
"learning_resource_type = " . 
$ilDB->quote($this->options[
'lom_resource'], 
'text') . 
" ");
 
  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') . 
" ");
 
  522        if ($this->options[
'lom_context']) {
 
  523            $and = $counter++ ? 
'AND ' : 
' ';
 
  524            $where .= ($and . 
"context = " . 
$ilDB->quote($this->options[
'lom_context'], 
'text') . 
" ");
 
  526        if ($this->options[
'lom_level_start'] or $this->options[
'lom_level_end']) {
 
  527            $and = $counter++ ? 
'AND ' : 
' ';
 
  530                $this->options[
'lom_level_start'],
 
  531                $this->options[
'lom_level_end'],
 
  532                array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh')
 
  535            $where .= ($and . 
"interactivity_level " . $this->
__getInStatement($fields));
 
  537        if ($this->options[
'lom_density_start'] or $this->options[
'lom_density_end']) {
 
  538            $and = $counter++ ? 
'AND ' : 
' ';
 
  541                $this->options[
'lom_density_start'],
 
  542                $this->options[
'lom_density_end'],
 
  543                array(
'VeryLow',
'Low',
'Medium',
'High',
'VeryHigh')
 
  548        if ($this->options[
'lom_difficulty_start'] or $this->options[
'lom_difficulty_end']) {
 
  549            $and = $counter++ ? 
'AND ' : 
' ';
 
  552                $this->options[
'lom_difficulty_start'],
 
  553                $this->options[
'lom_difficulty_end'],
 
  554                array(
'VeryEasy',
'Easy',
'Medium',
'Difficult',
'VeryDifficult')
 
  560        return $counter ? $where : 
'';
 
  572        if ($this->options[
'lom_operating_system']) {
 
  573            $and = $counter++ ? 
'AND ' : 
' ';
 
  574            $where .= ($and . 
"operating_system_name = " . 
$ilDB->quote($this->options[
'lom_operating_system']) . 
" ");
 
  576        if ($this->options[
'lom_browser']) {
 
  577            $and = $counter++ ? 
'AND ' : 
' ';
 
  578            $where .= ($and . 
"browser_name = " . 
$ilDB->quote($this->options[
'lom_browser']) . 
" ");
 
  580        return $counter ? $where : 
'';
 
  585        $a_val2 = $a_val2 ? $a_val2 : count(
$options);
 
  587        if ($a_val1 > $a_val2) {
 
  593            if ($a_val1 > ++$counter) {
 
  596            if ($a_val2 < $counter) {
 
  601        return $fields ? $fields : array();
 
  610        $in .= implode(
"','", $a_fields);
 
if(php_sapi_name() !='cli') $in
An exception for terminatinating execution or to throw for unit testing.
__createLocateString()
build locate string in case of AND search
setFields($a_fields)
Set fields to search.
getFilter()
get object type to search in
& __searchTypicalAgeRange()
__createClassificationWhere()
__createRequirementWhere()
__createEducationalWhere()
__getInStatement($a_fields)
setMode($a_mode)
Define meta elements to search.
& __searchKeyword($a_in_classification=false)
& __searchTitleDescription()
& __searchClassification()
__getDifference($a_val1, $a_val2, $options)
foreach($_POST as $key=> $value) $res