Public Member Functions | |
ilAdvancedSearch (&$qp_obj) | |
Constructor public. | |
setMode ($a_mode) | |
Define meta elements to search. | |
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) | |
Data Fields | |
$mode = '' | |
$query_parser = null | |
$db = null |
Definition at line 37 of file class.ilAdvancedSearch.php.
ilAdvancedSearch::__createClassificationWhere | ( | ) |
Definition at line 515 of file class.ilAdvancedSearch.php.
References $counter, and ilUtil::prepareDBString().
Referenced by __searchClassification().
{ $counter = 0; $where = 'WHERE '; if($this->options['purpose']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."purpose = '".ilUtil::prepareDBString($this->options['purpose'])."' "); } return $counter ? $where : ''; }
ilAdvancedSearch::__createEducationalWhere | ( | ) |
Definition at line 528 of file class.ilAdvancedSearch.php.
References $counter, $fields, __getDifference(), __getInStatement(), and ilUtil::prepareDBString().
Referenced by __searchEducational().
{ $counter = 0; $where = 'WHERE '; if($this->options['int_type']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."interactivity_type = '".ilUtil::prepareDBString($this->options['int_type'])."' "); } if($this->options['lea_type']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."learning_resource_type = '".ilUtil::prepareDBString($this->options['lea_type'])."' "); } if($this->options['int_role']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."intended_end_user_role = '".ilUtil::prepareDBString($this->options['int_role'])."' "); } if($this->options['con']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."context = '".ilUtil::prepareDBString($this->options['con'])."' "); } if($this->options['int_level_1'] or $this->options['int_level_2']) { $and = $counter++ ? 'AND ' : ' '; $fields = $this->__getDifference($this->options['int_level_1'],$this->options['int_level_2'], array('VeryLow','Low','Medium','High','VeryHigh')); $where .= ($and."interactivity_level ".$this->__getInStatement($fields)); } if($this->options['sem_1'] or $this->options['sem_2']) { $and = $counter++ ? 'AND ' : ' '; $fields = $this->__getDifference($this->options['sem_1'],$this->options['sem_2'], array('VeryLow','Low','Medium','High','VeryHigh')); $where .= ($and."semantic_density ".$this->__getInStatement($fields)); } if($this->options['dif_1'] or $this->options['dif_2']) { $and = $counter++ ? 'AND ' : ' '; $fields = $this->__getDifference($this->options['dif_1'],$this->options['dif_2'], array('VeryEasy','Easy','Medium','Difficult','VeryDifficult')); $where .= ($and."difficulty ".$this->__getInStatement($fields)); } return $counter ? $where : ''; }
ilAdvancedSearch::__createRequirementWhere | ( | ) |
Definition at line 584 of file class.ilAdvancedSearch.php.
References $counter, and ilUtil::prepareDBString().
Referenced by __searchRequirement().
{ $counter = 0; $where = 'WHERE '; if($this->options['os']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."operating_system_name = '".ilUtil::prepareDBString($this->options['os'])."' "); } if($this->options['browser']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."browser_name = '".ilUtil::prepareDBString($this->options['browser'])."' "); } return $counter ? $where : ''; }
ilAdvancedSearch::__createRightsWhere | ( | ) |
Definition at line 497 of file class.ilAdvancedSearch.php.
References $counter, and ilUtil::prepareDBString().
Referenced by __searchRights().
{ $counter = 0; $where = 'WHERE '; if($this->options['costs']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."costs = '".ilUtil::prepareDBString($this->options['costs'])."' "); } if($this->options['copyright']) { $and = $counter++ ? 'AND ' : ' '; $where .= ($and."copyright_and_other_restrictions = '".ilUtil::prepareDBString($this->options['copyright'])."' "); } return $counter ? $where : ''; }
ilAdvancedSearch::__getDifference | ( | $ | a_val1, | |
$ | a_val2, | |||
$ | options | |||
) |
Definition at line 603 of file class.ilAdvancedSearch.php.
References $counter, and $fields.
Referenced by __createEducationalWhere().
{ $a_val2 = $a_val2 ? $a_val2 : count($options); // Call again if a > b if($a_val1 > $a_val2) { return $this->__getDifference($a_val2,$a_val1,$options); } $counter = 0; foreach($options as $option) { if($a_val1 > ++$counter) { continue; } if($a_val2 < $counter) { break; } $fields[] = $option; } return $fields ? $fields : array(); }
ilAdvancedSearch::__getInStatement | ( | $ | a_fields | ) |
Definition at line 628 of file class.ilAdvancedSearch.php.
Referenced by __createEducationalWhere().
{ if(!$a_fields) { return ''; } $in = " IN ('"; $in .= implode("','",$a_fields); $in .= "') "; return $in; }
& ilAdvancedSearch::__searchClassification | ( | ) |
Definition at line 364 of file class.ilAdvancedSearch.php.
References $query, $res, $row, __createClassificationWhere(), and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_classification "; if(!strlen($where = $this->__createClassificationWhere())) { return false; } $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $query = $query.$where.$and; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchContribute | ( | ) |
Definition at line 238 of file class.ilAdvancedSearch.php.
References $query, $res, $row, and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ if(!$this->options['role']) { return false; } $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_contribute ". "WHERE role = '".ilUtil::prepareDBString($this->options['role'])."' ". "AND obj_type ".$this->__getInStatement($this->getFilter()); $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchEducational | ( | ) |
Definition at line 305 of file class.ilAdvancedSearch.php.
References $query, $res, $row, __createEducationalWhere(), and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_educational "; if(!strlen($where = $this->__createEducationalWhere())) { return false; } $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $query = $query.$where.$and; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchEntity | ( | ) |
Definition at line 258 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::__prepareFound(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ $this->setFields(array('entity')); $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $where = $this->__createEntityWhereCondition(); $locate = $this->__createLocateString(); $query = "SELECT rbac_id,obj_id,obj_type ". $locate. "FROM il_meta_entity ". $where." ".$and.' '; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $found = $this->__prepareFound($row); if(!in_array(0,$found)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,$found,$row->obj_id); } } return $this->search_result; }
& ilAdvancedSearch::__searchFormat | ( | ) |
Definition at line 476 of file class.ilAdvancedSearch.php.
References $query, $res, $row, and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ if(!$this->options['format']) { return false; } $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_format ". "WHERE format LIKE('".ilUtil::prepareDBString($this->options['format'])."') ". "AND obj_type ".$this->__getInStatement($this->getFilter()); $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchGeneral | ( | ) |
Definition at line 174 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::__prepareFound(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ if(!$this->options['coverage'] and !$this->options['structure']) { return false; } if($this->options['coverage']) { $this->setFields(array('coverage')); $and = $this->__createCoverageAndCondition(); $locate = $this->__createLocateString(); } if($this->options['structure']) { $and .= ("AND general_structure = '".ilUtil::prepareDBString($this->options['structure'])."' "); } $query = "SELECT rbac_id,obj_type,obj_id ". $locate." ". "FROM il_meta_general ". "WHERE obj_type ".$this->__getInStatement($this->getFilter())." ". $and; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { if($this->options['coverage']) { $found = $this->__prepareFound($row); if(!in_array(0,$found)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,$found,$row->obj_id); } } else { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } } return $this->search_result; }
& ilAdvancedSearch::__searchKeyword | ( | $ | a_in_classification = false |
) |
Definition at line 409 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::__prepareFound(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ $this->setFields(array('keyword')); $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); if($a_in_classification) { $and .= " AND parent_type = 'meta_classification' "; } $where = $this->__createKeywordWhereCondition(); $locate = $this->__createLocateString(); $query = "SELECT rbac_id,obj_id,obj_type ". $locate. "FROM il_meta_keyword ". $where." ".$and.' '; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $found = $this->__prepareFound($row); if(!in_array(0,$found) or !$a_in_classification) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,$found,$row->obj_id); } } return $this->search_result; }
& ilAdvancedSearch::__searchLanguage | ( | ) |
Definition at line 217 of file class.ilAdvancedSearch.php.
References $query, $res, $row, and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ if(!$this->options['language']) { return false; } $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_language ". "WHERE language = '".ilUtil::prepareDBString($this->options['language'])."' ". "AND obj_type ".$this->__getInStatement($this->getFilter()).' '. "AND parent_type = 'meta_general'"; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchLifecycle | ( | ) |
Definition at line 438 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::__prepareFound(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ $this->setFields(array('meta_version')); if($this->options['version']) { $where = $this->__createLifecycleWhereCondition(); $locate = $this->__createLocateString(); } else { $where = "WHERE 1 "; } $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); if($this->options['status']) { $and .= (" AND lifecycle_status = '".$this->options['status']."'"); } $query = "SELECT rbac_id,obj_id,obj_type ". $locate. "FROM il_meta_lifecycle ". $where." ".$and.' '; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $found = $this->__prepareFound($row); if(!in_array(0,$found)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,$found,$row->obj_id); } } return $this->search_result; }
& ilAdvancedSearch::__searchRequirement | ( | ) |
Definition at line 286 of file class.ilAdvancedSearch.php.
References $query, $res, $row, __createRequirementWhere(), and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_requirement "; if(!strlen($where = $this->__createRequirementWhere())) { return false; } $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $query = $query.$where.$and; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchRights | ( | ) |
Definition at line 345 of file class.ilAdvancedSearch.php.
References $query, $res, $row, __createRightsWhere(), and ilAbstractSearch::getFilter().
Referenced by performSearch().
{ $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_rights "; if(!strlen($where = $this->__createRightsWhere())) { return false; } $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $query = $query.$where.$and; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
& ilAdvancedSearch::__searchTaxon | ( | ) |
Definition at line 383 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::__prepareFound(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ $this->setFields(array('taxon')); $and = ("AND obj_type ".$this->__getInStatement($this->getFilter())); $where = $this->__createTaxonWhereCondition(); $locate = $this->__createLocateString(); $query = "SELECT rbac_id,obj_id,obj_type ". $locate. "FROM il_meta_taxon ". $where." ".$and.' '; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $found = $this->__prepareFound($row); if(!in_array(0,$found)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,$found,$row->obj_id); } } return $this->search_result; }
& ilAdvancedSearch::__searchTitleDescription | ( | ) |
Definition at line 147 of file class.ilAdvancedSearch.php.
References $query, $res, $row, ilAbstractSearch::__createLocateString(), ilAbstractSearch::getFilter(), and ilAbstractSearch::setFields().
Referenced by performSearch().
{ if(!$this->options['title']) { return false; } $this->setFields(array('title','description')); $and = ("AND type ".$this->__getInStatement($this->getFilter())); $where = $this->__createTitleDescriptionWhereCondition(); $locate = $this->__createLocateString(); $query = "SELECT obj_id,type ". $locate. "FROM object_data ". $where." ".$and.' '. "ORDER BY obj_id DESC"; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->obj_id,$row->type,$this->__prepareFound($row)); } return $this->search_result; }
& ilAdvancedSearch::__searchTypicalAgeRange | ( | ) |
Definition at line 324 of file class.ilAdvancedSearch.php.
References $query, $res, and $row.
Referenced by performSearch().
{ if(!$this->options['typ_age_1'] or !$this->options['typ_age_2']) { return false; } $query = "SELECT rbac_id,obj_id,obj_type FROM il_meta_typical_age_range ". "WHERE typical_age_range_min >= '".(int) $this->options['typ_age_1']."' ". "AND typical_age_range_max <= '".(int) $this->options['typ_age_2']."'"; $res = $this->db->query($query); #var_dump("<pre>",$query,"<pre>"); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->search_result->addEntry($row->rbac_id,$row->obj_type,array(),$row->obj_id); } return $this->search_result; }
ilAdvancedSearch::getMode | ( | ) |
Definition at line 67 of file class.ilAdvancedSearch.php.
Referenced by performSearch().
{
return $this->mode;
}
ilAdvancedSearch::ilAdvancedSearch | ( | &$ | qp_obj | ) |
Constructor public.
Definition at line 52 of file class.ilAdvancedSearch.php.
References ilAbstractSearch::ilAbstractSearch().
Referenced by ilFulltextAdvancedSearch::ilFulltextAdvancedSearch().
{ parent::ilAbstractSearch($qp_obj); }
& ilAdvancedSearch::performSearch | ( | ) |
Reimplemented from ilAbstractSearch.
Definition at line 77 of file class.ilAdvancedSearch.php.
References __searchClassification(), __searchContribute(), __searchEducational(), __searchEntity(), __searchFormat(), __searchGeneral(), __searchKeyword(), __searchLanguage(), __searchLifecycle(), __searchRequirement(), __searchRights(), __searchTaxon(), __searchTitleDescription(), __searchTypicalAgeRange(), and getMode().
{ switch($this->getMode()) { case 'requirement': return $this->__searchRequirement(); break; case 'educational': return $this->__searchEducational(); break; case 'typical_age_range': return $this->__searchTypicalAgeRange(); break; case 'rights': return $this->__searchRights(); break; case 'classification': return $this->__searchClassification(); break; case 'taxon': return $this->__searchTaxon(); break; case 'keyword': return $this->__searchKeyword(true); break; case 'format': return $this->__searchFormat(); break; case 'lifecycle': return $this->__searchLifecycle(); break; case 'contribute': return $this->__searchContribute(); break; case 'entity': return $this->__searchEntity(); break; case 'general': return $this->__searchGeneral(); break; case 'keyword_all': return $this->__searchKeyword(false); break; case 'title_description': return $this->__searchTitleDescription(); break; case 'language': return $this->__searchLanguage(); break; default: echo "ilMDSearch::performSearch() no mode given"; return false; } }
ilAdvancedSearch::setMode | ( | $ | a_mode | ) |
Define meta elements to search.
array | elements to search in. E.G array('keyword','contribute') public |
Definition at line 63 of file class.ilAdvancedSearch.php.
{ $this->mode = $a_mode; }
ilAdvancedSearch::setOptions | ( | &$ | options | ) |
Definition at line 72 of file class.ilAdvancedSearch.php.
{ $this->options =& $options; }
ilAdvancedSearch::$db = null |
Reimplemented from ilAbstractSearch.
Definition at line 46 of file class.ilAdvancedSearch.php.
ilAdvancedSearch::$mode = '' |
Definition at line 39 of file class.ilAdvancedSearch.php.
ilAdvancedSearch::$query_parser = null |
Reimplemented from ilAbstractSearch.
Definition at line 44 of file class.ilAdvancedSearch.php.