Public Member Functions | Data Fields

ilLPFilter Class Reference

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 wheather 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 = 'lm'
 $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 207 of file class.ilLPFilter.php.

References $query, getHidden(), and getQueryString().

Referenced by __read().

        {
                $query = "INSERT INTO ut_lp_filter ".
                        "SET usr_id = '".$this->getUserId()."', ".
                        "filter_type = '".$this->getFilterType()."', ".
                        "root_node = '".$this->getRootNode()."', ".
                        "hidden = '".addslashes(serialize($this->getHidden()))."', ".
                        "query_string = '".addslashes($this->getQueryString())."'";

                $this->db->query($query);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilLPFilter::__getAllObjects (  ) 

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

References $obj_id, $ref_id, $tree, ilUtil::_getObjectsByOperations(), ilLPObjSettings::_lookupMode(), getLimit(), getRequiredPermission(), getUserId(), isHidden(), and prepareType().

        {
                global $tree,$ilObjDataCache;

                $objects = array();
                foreach(ilUtil::_getObjectsByOperations($this->prepareType(),
                                                                                                $this->getRequiredPermission(),
                                                                                                $this->getUserId(),
                                                                                                $this->getLimit()) as $ref_id)
                {
                        $obj_id = $ilObjDataCache->lookupObjId($ref_id);
                        if($this->isHidden($obj_id))
                        {
                                continue;
                        }
                        if(ilLPObjSettings::_lookupMode($obj_id) == LP_MODE_DEACTIVATED)
                        {
                                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 222 of file class.ilLPFilter.php.

References $query, $res, $row, __add(), and ilUtil::stripSlashes().

Referenced by ilLPFilter().

        {
                $query = "SELECT * FROM ut_lp_filter ".
                        "WHERE usr_id = '".$this->getUserId()."'";

                $res = $this->db->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(ilUtil::stripSlashes($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 275 of file class.ilLPFilter.php.

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

Referenced by getObjects().

        {
                global $ilObjDataCache;

                include_once './Services/Search/classes/class.ilQueryParser.php';

                $query_parser =& new ilQueryParser($this->getQueryString());
                $query_parser->setMinWordLength(0);
                $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 195 of file class.ilLPFilter.php.

References $query.

        {
                global $ilDB;

                $query = "DELETE FROM ut_lp_filter ".
                        "WHERE usr_id = '".$a_usr_id."'";
                $ilDB->query($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.

Referenced by searchFilterListener().

        {
                return $this->anonymized_check;
        }

Here is the caller graph for this function:

ilLPFilter::getFilterType (  ) 

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

Referenced by prepareType().

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

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.

Referenced by __getAllObjects().

        {
                return $this->limit;
        }

Here is the caller graph for this function:

ilLPFilter::getObjects (  ) 

Definition at line 175 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.

Referenced by __getAllObjects(), and __searchObjects().

        {
                return $this->permission;
        }

Here is the caller graph for this function:

ilLPFilter::getRootNode (  ) 

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

Referenced by __searchObjects().

        {
                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.

Referenced by __getAllObjects().

        {
                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 $ilias, 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',50);
        }

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.

        {
                return $this->limit_reached;
        }

ilLPFilter::prepareType (  ) 

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

References getFilterType().

Referenced by __getAllObjects(), and __searchObjects().

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

                        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.

References $obj_id.

        {
                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 wheather the object is hidden and mode is not LP_MODE_DEACTIVATED public.

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

References ilLPObjSettings::_lookupMode(), ilObjTest::_lookupTestType(), checkItemAnonymized(), and isHidden().

        {
                if($this->checkItemAnonymized())
                {
                        switch($a_data['type'])
                        {
                                case 'tst':
                                        include_once 'assessment/classes/class.ilObjTest.php';
                                        if(ilObjTest::_lookupTestType($a_data['obj_id']) == TYPE_SELF_ASSESSMENT)
                                        {
                                                return false;
                                        }
                        }
                }
                if($this->isHidden($a_data['obj_id']))
                {
                        return false;
                }
                if(ilLPObjSettings::_lookupMode($a_data['obj_id']) == LP_MODE_DEACTIVATED)
                {
                        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 $query, $res, getHidden(), and getQueryString().

        {
                $query = "UPDATE ut_lp_filter ".
                        "SET filter_type = '".$this->getFilterType()."', ".
                        "root_node = '".$this->getRootNode()."', ".
                        "hidden = '".addslashes(serialize($this->getHidden()))."', ".
                        "query_string = '".addslashes($this->getQueryString())."' ".
                        "WHERE usr_id = '".$this->getUserId()."'";

                $res = $this->db->query($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.

ilLPFilter::$db = null

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

ilLPFilter::$filter_type = 'lm'

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.

ilLPFilter::$limit_reached = false

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

ilLPFilter::$permission = 'edit_learning_progress'

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

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.


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