ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilLPFilter Class Reference
+ Collaboration diagram for ilLPFilter:

Public Member Functions

 ilLPFilter ($a_usr_id)
 getLimit ()
 limitReached ()
 setRequiredPermission ($a_permission)
 getRequiredPermission ()
 getUserId ()
 getFilterType ()
 setFilterType ($a_type)
 getRootNode ()
 setRootNode ($a_root)
 getQueryString ()
 setQueryString ($a_query)
 getHidden ()
 isHidden ($a_obj_id)
 setHidden ($a_hidden)
 addHidden ($a_hide)
 removeHidden ($a_show)
 toggleAnonymizedCheck ($a_status)
 checkItemAnonymized ()
 update ()
 getObjects ()
 _delete ($a_usr_id)
 __add ()
 __read ()
 __getAllObjects ()
 __searchObjects ()
 prepareType ()
 searchFilterListener ($a_ref_id, $a_data)
 Listener for SearchResultFilter Checks whether the object is hidden and mode is not LP_MODE_DEACTIVATED public.

Data Fields

 $permission = 'edit_learning_progress'
 $limit = 0
 $limit_reached = false
 $anonymized_check = false
 $root_node = ROOT_FOLDER_ID
 $filter_type = 'crs'
 $hidden = array()
 $usr_id = null
 $db = null

Detailed Description

Definition at line 40 of file class.ilLPFilter.php.

Member Function Documentation

ilLPFilter::__add ( )

Definition at line 208 of file class.ilLPFilter.php.

References $ilDB, $query, $res, getFilterType(), getHidden(), getQueryString(), getRootNode(), and getUserId().

Referenced by __read().

{
global $ilDB;
$query = "INSERT INTO ut_lp_filter (usr_id,filter_type,root_node,hidden,query_string) ".
"VALUES( ".
$ilDB->quote($this->getUserId() ,'integer').", ".
$ilDB->quote($this->getFilterType() ,'text').", ".
$ilDB->quote($this->getRootNode() ,'integer').", ".
$ilDB->quote(serialize($this->getHidden()) ,'text').", ".
$ilDB->quote($this->getQueryString() ,'text').
")";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPFilter::__getAllObjects ( )

Definition at line 248 of file class.ilLPFilter.php.

References $ref_id, ilUtil\_getObjectsByOperations(), ilLPObjSettings\_lookupMode(), getLimit(), getRequiredPermission(), getUserId(), isHidden(), LP_MODE_DEACTIVATED, and prepareType().

{
global $tree,$ilObjDataCache;
$objects = array();
$this->getUserId(),
$this->getLimit()) as $ref_id)
{
$obj_id = $ilObjDataCache->lookupObjId($ref_id);
if($this->isHidden($obj_id))
{
continue;
}
{
continue;
}
if($tree->isGrandChild($this->getRootNode(),$ref_id))
{
$objects[$obj_id]['ref_ids'][] = $ref_id;
$objects[$obj_id]['title'] = $ilObjDataCache->lookupTitle($obj_id);
$objects[$obj_id]['description'] = $ilObjDataCache->lookupDescription($obj_id);
}
}
return $objects ? $objects : array();
}

+ Here is the call graph for this function:

ilLPFilter::__read ( )

Definition at line 225 of file class.ilLPFilter.php.

References $ilDB, $query, $res, $row, __add(), DB_FETCHMODE_OBJECT, and getUserId().

Referenced by ilLPFilter().

{
global $ilDB;
$query = "SELECT * FROM ut_lp_filter ".
"WHERE usr_id = ".$ilDB->quote($this->getUserId() ,'integer');
$res = $ilDB->query($query);
if(!$res->numRows())
{
$this->__add();
}
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->filter_type = $row->filter_type;
$this->root_node = $row->root_node;
$this->hidden = unserialize($row->hidden);
$this->query_string = $row->query_string;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPFilter::__searchObjects ( )

Definition at line 279 of file class.ilLPFilter.php.

References $res, getQueryString(), getRequiredPermission(), getRootNode(), prepareType(), and QP_COMBINATION_OR.

Referenced by getObjects().

{
global $ilObjDataCache;
include_once './Services/Search/classes/class.ilQueryParser.php';
$query_parser =& new ilQueryParser($this->getQueryString());
$query_parser->setMinWordLength(0,true);
$query_parser->setCombination(QP_COMBINATION_OR);
$query_parser->parse();
if(!$query_parser->validate())
{
echo $query_parser->getMessage();
}
// only like search since fulltext does not support search with less than 3 characters
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$object_search =& new ilLikeObjectSearch($query_parser);
#include_once './Services/Search/classes/class.ilObjectSearchFactory.php';
#$object_search =& ilObjectSearchFactory::_getObjectSearchInstance($query_parser);
$object_search->setFilter($this->prepareType());
$res =& $object_search->performSearch();
$res->setRequiredPermission($this->getRequiredPermission());
// Add callback functions to receive only search_max_hits valid results
$res->addObserver($this,'searchFilterListener');
$res->filter($this->getRootNode(),false);
foreach($res->getResults() as $obj_data)
{
$objects[$obj_data['obj_id']]['ref_ids'][] = $obj_data['ref_id'];
$objects[$obj_data['obj_id']]['title'] = $ilObjDataCache->lookupTitle($obj_data['obj_id']);
$objects[$obj_data['obj_id']]['description'] = $ilObjDataCache->lookupDescription($obj_data['obj_id']);
}
// Check if search max hits is reached
$this->limit_reached = $res->isLimitReached();
return $objects ? $objects : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPFilter::_delete (   $a_usr_id)

Definition at line 196 of file class.ilLPFilter.php.

References $ilDB, $query, and $res.

{
global $ilDB;
$query = "DELETE FROM ut_lp_filter ".
"WHERE usr_id = ".$ilDB->quote($a_usr_id ,'integer');
$res = $ilDB->manipulate($query);
return true;
}
ilLPFilter::addHidden (   $a_hide)

Definition at line 131 of file class.ilLPFilter.php.

{
if(!in_array($a_hide,$this->hidden))
{
$this->hidden[] = $a_hide;
return true;
}
return false;
}
ilLPFilter::checkItemAnonymized ( )

Definition at line 157 of file class.ilLPFilter.php.

References $anonymized_check.

Referenced by searchFilterListener().

+ Here is the caller graph for this function:

ilLPFilter::getFilterType ( )

Definition at line 92 of file class.ilLPFilter.php.

Referenced by __add(), prepareType(), and update().

{
return $this->filter_type ? $this->filter_type : 'crs';
}

+ Here is the caller graph for this function:

ilLPFilter::getHidden ( )

Definition at line 119 of file class.ilLPFilter.php.

Referenced by __add(), and update().

{
return $this->hidden ? $this->hidden : array();
}

+ Here is the caller graph for this function:

ilLPFilter::getLimit ( )

Definition at line 68 of file class.ilLPFilter.php.

References $limit.

Referenced by __getAllObjects().

{
return $this->limit;
}

+ Here is the caller graph for this function:

ilLPFilter::getObjects ( )

Definition at line 176 of file class.ilLPFilter.php.

References __searchObjects().

{
return $this->__searchObjects();
// All is done by search class
/*
if(strlen($this->getQueryString()))
{
return $this->__searchObjects();
}
else
{
return $this->__getAllObjects();
}
*/
}

+ Here is the call graph for this function:

ilLPFilter::getQueryString ( )

Definition at line 110 of file class.ilLPFilter.php.

Referenced by __add(), __searchObjects(), and update().

{
return $this->query_string;
}

+ Here is the caller graph for this function:

ilLPFilter::getRequiredPermission ( )

Definition at line 82 of file class.ilLPFilter.php.

References $permission.

Referenced by __getAllObjects(), and __searchObjects().

{
}

+ Here is the caller graph for this function:

ilLPFilter::getRootNode ( )

Definition at line 101 of file class.ilLPFilter.php.

Referenced by __add(), __searchObjects(), and update().

{
return $this->root_node ? $this->root_node : ROOT_FOLDER_ID;
}

+ Here is the caller graph for this function:

ilLPFilter::getUserId ( )

Definition at line 87 of file class.ilLPFilter.php.

References $usr_id.

Referenced by __add(), __getAllObjects(), __read(), and update().

{
return $this->usr_id;
}

+ Here is the caller graph for this function:

ilLPFilter::ilLPFilter (   $a_usr_id)

Definition at line 56 of file class.ilLPFilter.php.

References $ilDB, and __read().

{
global $ilDB,$ilias;
$this->usr_id = $a_usr_id;
$this->db =& $ilDB;
$this->__read();
// Limit of filtered objects is search max hits
$this->limit = $ilias->getSetting('search_max_hits',10);
}

+ Here is the call graph for this function:

ilLPFilter::isHidden (   $a_obj_id)

Definition at line 123 of file class.ilLPFilter.php.

Referenced by __getAllObjects(), and searchFilterListener().

{
return in_array($a_obj_id,$this->hidden);
}

+ Here is the caller graph for this function:

ilLPFilter::limitReached ( )

Definition at line 73 of file class.ilLPFilter.php.

References $limit_reached.

{
}
ilLPFilter::prepareType ( )

Definition at line 323 of file class.ilLPFilter.php.

References getFilterType().

Referenced by __getAllObjects(), and __searchObjects().

{
switch($this->getFilterType())
{
case 'lm':
return array('lm','sahs','htlm','dbk');
default:
return array($this->getFilterType());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilLPFilter::removeHidden (   $a_show)

Definition at line 141 of file class.ilLPFilter.php.

{
foreach($this->hidden as $obj_id)
{
if($obj_id != $a_show)
{
$tmp[] = $obj_id;
}
}
$this->hidden = $tmp ? $tmp : array();
}
ilLPFilter::searchFilterListener (   $a_ref_id,
  $a_data 
)

Listener for SearchResultFilter Checks whether the object is hidden and mode is not LP_MODE_DEACTIVATED public.

Definition at line 340 of file class.ilLPFilter.php.

References ilObjTest\_lookupAnonymity(), ilLPObjSettings\_lookupMode(), checkItemAnonymized(), isHidden(), and LP_MODE_DEACTIVATED.

{
if($this->checkItemAnonymized())
{
switch($a_data['type'])
{
case 'tst':
include_once './Modules/Test/classes/class.ilObjTest.php';
if(ilObjTest::_lookupAnonymity($a_data['obj_id']))
{
return false;
}
}
}
if($this->isHidden($a_data['obj_id']))
{
return false;
}
{
return false;
}
return true;
}

+ Here is the call graph for this function:

ilLPFilter::setFilterType (   $a_type)

Definition at line 96 of file class.ilLPFilter.php.

{
return $this->filter_type = $a_type;
}
ilLPFilter::setHidden (   $a_hidden)

Definition at line 127 of file class.ilLPFilter.php.

{
$this->hidden = $a_hidden;
}
ilLPFilter::setQueryString (   $a_query)

Definition at line 114 of file class.ilLPFilter.php.

{
$this->query_string = $a_query;
}
ilLPFilter::setRequiredPermission (   $a_permission)

Definition at line 78 of file class.ilLPFilter.php.

{
$this->permission = $a_permission;
}
ilLPFilter::setRootNode (   $a_root)

Definition at line 105 of file class.ilLPFilter.php.

{
$this->root_node = $a_root;
}
ilLPFilter::toggleAnonymizedCheck (   $a_status)

Definition at line 153 of file class.ilLPFilter.php.

{
$this->anonymized_check = $a_status;
}
ilLPFilter::update ( )

Definition at line 162 of file class.ilLPFilter.php.

References $ilDB, $query, $res, getFilterType(), getHidden(), getQueryString(), getRootNode(), and getUserId().

{
global $ilDB;
$query = "UPDATE ut_lp_filter ".
"SET filter_type = ".$ilDB->quote($this->getFilterType() ,'text').", ".
"root_node = ".$ilDB->quote($this->getRootNode() ,'integer').", ".
"hidden = ".$ilDB->quote(serialize($this->getHidden()) ,'text').", ".
"query_string = ".$ilDB->quote($this->getQueryString() ,'text')." ".
"WHERE usr_id = ".$ilDB->quote($this->getUserId() ,'integer');
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilLPFilter::$anonymized_check = false

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

Referenced by checkItemAnonymized().

ilLPFilter::$db = null

Definition at line 54 of file class.ilLPFilter.php.

ilLPFilter::$filter_type = 'crs'

Definition at line 50 of file class.ilLPFilter.php.

ilLPFilter::$hidden = array()

Definition at line 51 of file class.ilLPFilter.php.

ilLPFilter::$limit = 0

Definition at line 43 of file class.ilLPFilter.php.

Referenced by getLimit().

ilLPFilter::$limit_reached = false

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

Referenced by limitReached().

ilLPFilter::$permission = 'edit_learning_progress'

Definition at line 42 of file class.ilLPFilter.php.

Referenced by getRequiredPermission().

ilLPFilter::$root_node = ROOT_FOLDER_ID

Definition at line 49 of file class.ilLPFilter.php.

ilLPFilter::$usr_id = null

Definition at line 53 of file class.ilLPFilter.php.

Referenced by getUserId().


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