ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAdvancedSearch Class Reference
+ Inheritance diagram for ilAdvancedSearch:
+ Collaboration diagram for ilAdvancedSearch:

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)
- Public Member Functions inherited from ilAbstractSearch
 ilAbstractSearch (&$qp_obj)
 Constructor public.
 setFields ($a_fields)
 Set fields to search.
 getFields ()
 Get fields to search.
 setFilter ($a_filter)
 set object type to search in
 appendToFilter ($a_type)
 Append object type to filter.
 getFilter ()
 get object type to search in
 __createLocateString ()
 build locate string in case of AND search
 __prepareFound (&$row)

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

ilAdvancedSearch::__createClassificationWhere ( )

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

References 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 : '';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedSearch::__createEducationalWhere ( )

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

References __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 : '';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedSearch::__createRequirementWhere ( )

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

References 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 : '';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilAdvancedSearch::__createRightsWhere ( )

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

References 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 : '';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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();
}

+ Here is the caller graph for this function:

ilAdvancedSearch::__getInStatement (   $a_fields)

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

References $in.

Referenced by __createEducationalWhere().

{
if(!$a_fields)
{
return '';
}
$in = " IN ('";
$in .= implode("','",$a_fields);
$in .= "') ";
return $in;
}

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchClassification ( )

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

References $res, ilAbstractSearch\$search_result, __createClassificationWhere(), DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchContribute ( )

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

References $res, ilAbstractSearch\$search_result, DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchEducational ( )

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

References $res, ilAbstractSearch\$search_result, __createEducationalWhere(), DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchEntity ( )

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), ilAbstractSearch\__prepareFound(), DB_FETCHMODE_OBJECT, 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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchFormat ( )

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

References $res, ilAbstractSearch\$search_result, DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchGeneral ( )

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), ilAbstractSearch\__prepareFound(), DB_FETCHMODE_OBJECT, 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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchKeyword (   $a_in_classification = false)

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), ilAbstractSearch\__prepareFound(), DB_FETCHMODE_OBJECT, 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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchLanguage ( )

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

References $res, ilAbstractSearch\$search_result, DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchLifecycle ( )

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), ilAbstractSearch\__prepareFound(), DB_FETCHMODE_OBJECT, ilAbstractSearch\getFilter(), and ilAbstractSearch\setFields().

Referenced by performSearch().

{
global $ilDB;
$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 = ".$ilDB->quote($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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchRequirement ( )

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

References $res, ilAbstractSearch\$search_result, __createRequirementWhere(), DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchRights ( )

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

References $res, ilAbstractSearch\$search_result, __createRightsWhere(), DB_FETCHMODE_OBJECT, 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);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchTaxon ( )

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), ilAbstractSearch\__prepareFound(), DB_FETCHMODE_OBJECT, 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);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchTitleDescription ( )

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

References $res, ilAbstractSearch\$search_result, ilAbstractSearch\__createLocateString(), DB_FETCHMODE_OBJECT, 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));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& ilAdvancedSearch::__searchTypicalAgeRange ( )

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

References $res, ilAbstractSearch\$search_result, and DB_FETCHMODE_OBJECT.

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);
}
}

+ Here is the caller graph for this function:

ilAdvancedSearch::getMode ( )

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

References $mode.

Referenced by performSearch().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilAdvancedSearch::ilAdvancedSearch ( $qp_obj)

Constructor public.

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

References ilAbstractSearch\ilAbstractSearch().

Referenced by ilFulltextAdvancedSearch\ilFulltextAdvancedSearch().

{
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

& 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;
}
}

+ Here is the call graph for this function:

ilAdvancedSearch::setMode (   $a_mode)

Define meta elements to search.

Parameters
arrayelements 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;
}

Field Documentation

ilAdvancedSearch::$db = null

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

ilAdvancedSearch::$mode = ''

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

Referenced by getMode().

ilAdvancedSearch::$query_parser = null

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


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