Public Member Functions | Data Fields

ilCourseItems Class Reference

Public Member Functions

 ilCourseItems (&$course_obj, $a_parent=0, $user_id=0)
 getUserId ()
 _hasCollectionTimings ($a_ref_id)
 _hasChangeableTimings ($a_ref_id)
 setParentId ($a_parent=0)
 getParentId ()
 setTimingType ($a_type)
 getTimingType ()
 setTimingStart ($a_start)
 getTimingStart ()
 setTimingEnd ($a_end)
 getTimingEnd ()
 setSuggestionStart ($a_start)
 getSuggestionStart ()
 setSuggestionEnd ($a_end)
 getSuggestionEnd ()
 setEarliestStart ($a_start)
 getEarliestStart ()
 setLatestEnd ($a_end)
 getLatestEnd ()
 toggleVisible ($a_status)
 enabledVisible ()
 toggleChangeable ($a_status)
 enabledChangeable ()
 getAllItems ()
 getFilteredItems ($a_container_id)
 getItemsByEvent ($a_event_id)
 getItems ()
 getItem ($a_item_id)
 validateActivation ()
 update ($a_item_id)
 moveUp ($item_id)
 moveDown ($item_id)
 deleteAllEntries ()
 __read ()
 __purgeDeleted ()
 __delete ($a_obj_id)
 __getItemData ($a_item)
 createDefaultEntry ($a_item)
 __getLastPosition ()
 __updateTop ($item_id)
 __updateBottom ($item_id)
 __isMovable ($a_ref_id)
 __switchNodes ($node_a, $node_b)
 __sort ()
 __splitByActivation ()
 _getItem ($a_item_id)
 _isActivated ($a_item_id)

Data Fields

 $course_obj
 $ilErr
 $ilDB
 $tree
 $lng
 $items
 $parent
 $timing_type
 $timing_start
 $timing_end

Detailed Description

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


Member Function Documentation

ilCourseItems::__delete ( a_obj_id  ) 

Definition at line 431 of file class.ilCourseItems.php.

References $query, $res, and $row.

Referenced by __purgeDeleted().

        {
                // READ POSITION
                $query = "SELECT position FROM crs_items ".
                        "WHERE obj_id = '".$a_obj_id."' ".
                        "AND parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $position = $row->position;
                }

                // UPDATE positions
                $query = "UPDATE crs_items SET ".
                        "position = CASE ".
                        "WHEN position > '".$position."' ".
                        "THEN position - 1 ".
                        "ELSE position ".
                        "END ".
                        "WHERE parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);

                // DELETE ENTRY
                $query = "DELETE FROM crs_items ".
                        "WHERE parent_id = '".$this->getParentId()."' ".
                        "AND obj_id = '".$a_obj_id."'";

                $res = $this->ilDB->query($query);

                return true;
        }

Here is the caller graph for this function:

ilCourseItems::__getItemData ( a_item  ) 

Definition at line 465 of file class.ilCourseItems.php.

References $data, $ilDB, $query, $res, $row, ilTimingPlaned::_getPlanedTimings(), createDefaultEntry(), and getUserId().

Referenced by __read(), and getItemsByEvent().

        {
                global $ilDB,$ilUser,$ilObjDataCache;

                $query = "SELECT * FROM crs_items  ".
                        "WHERE obj_id = '".$a_item['child']."' ".
                        "AND parent_id = '".$a_item['parent']."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $a_item["timing_type"] = $row->timing_type;
                        $a_item["timing_start"]         = $row->timing_start;
                        $a_item["timing_end"]           = $row->timing_end;
                        $a_item["suggestion_start"]             = $row->suggestion_start ? $row->suggestion_start :
                                mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
                        $a_item["suggestion_end"]               = $row->suggestion_end ? $row->suggestion_end :
                                mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
                        $a_item['changeable']                   = $row->changeable;
                        $a_item['earliest_start']               = $row->earliest_start ? $row->earliest_start :
                                mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
                        $a_item['latest_end']                   = $row->latest_end ? $row->latest_end : 
                                mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
                        $a_item['visible']                              = $row->visible;
                        $a_item["position"]                             = $row->position;

                        include_once 'course/classes/Timings/class.ilTimingPlaned.php';
                        $data = ilTimingPlaned::_getPlanedTimings($this->getUserId(),$a_item['child']);

                        // Check for user entry
                        if($a_item['changeable'] and 
                           $a_item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
                        {
                                if($data['planed_start'])
                                {
                                        $a_item['start'] = $data['planed_start'];
                                        $a_item['end'] = $data['planed_end'];
                                        $a_item['activation_info'] = 'crs_timings_planed_info';
                                }
                                else
                                {
                                        $a_item['start'] = $row->suggestion_start;
                                        $a_item['end'] = $row->suggestion_end;
                                        $a_item['activation_info'] = 'crs_timings_suggested_info';
                                }
                        }
                        elseif($a_item['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
                        {
                                $a_item['start'] = $row->suggestion_start;
                                $a_item['end'] = $row->suggestion_end;
                                $a_item['activation_info'] = 'crs_timings_suggested_info';
                        }
                        elseif($a_item['timing_type'] == IL_CRS_TIMINGS_ACTIVATION)
                        {
                                $a_item['start'] = $row->timing_start;
                                $a_item['end'] = $row->timing_end;
                                $a_item['activation_info'] = 'activation';
                        }
                        else
                        {
                                $a_item['start'] = 999999999;
                        }
                }

                if(!isset($a_item["position"]))
                {
                        $a_item = $this->createDefaultEntry($a_item);
                }
                return $a_item;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__getLastPosition (  ) 

Definition at line 572 of file class.ilCourseItems.php.

References $query, $res, and $row.

Referenced by createDefaultEntry().

        {
                $query = "SELECT MAX(position) as last_position FROM crs_items ".
                        "WHERE parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $max = $row->last_position;
                }
                return $max ? $max : 0;
        }

Here is the caller graph for this function:

ilCourseItems::__isMovable ( a_ref_id  ) 

Definition at line 652 of file class.ilCourseItems.php.

References ilEventItems::_isAssigned().

Referenced by __updateBottom(), and __updateTop().

        {
                include_once 'course/classes/Event/class.ilEventItems.php';

                global $ilObjDataCache;

                if($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($a_ref_id)) != 'crs')
                {
                        return true;
                }
                if(ilEventItems::_isAssigned($a_ref_id))
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__purgeDeleted (  ) 

Definition at line 412 of file class.ilCourseItems.php.

References $query, $res, $row, $tree, __delete(), and getParentId().

Referenced by __read().

        {
                global $tree;

                $all = array();

                $query = "SELECT obj_id FROM crs_items ".
                        "WHERE parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($tree->getParentId($row->obj_id) != $this->getParentId())
                        {
                                $this->__delete($row->obj_id);
                        }
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__read (  ) 

Definition at line 384 of file class.ilCourseItems.php.

References __getItemData(), __purgeDeleted(), and __sort().

Referenced by ilCourseItems(), moveDown(), moveUp(), setParentId(), and update().

        {
                $this->items = array();
                $all_items = $this->tree->getChilds($this->parent);

                foreach($all_items as $item)
                {
                        if($item["type"] != 'rolf')
                        {
                                $this->items[] = $item;
                        }
                }

                for($i = 0;$i < count($this->items); ++$i)
                {
                        if($this->items[$i]["type"] == 'rolf')
                        {
                                unset($this->items[$i]);
                                continue;
                        }
                        $this->items[$i] = $this->__getItemData($this->items[$i]);
                }
                $this->__purgeDeleted();
                $this->__sort();

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__sort (  ) 

Definition at line 694 of file class.ilCourseItems.php.

References __splitByActivation(), and ilUtil::sortArray().

Referenced by __read().

        {
                switch($this->course_obj->getOrderType())
                {
                        case IL_CRS_SORT_MANUAL:
                                $this->items = ilUtil::sortArray($this->items,"position","asc",true);
                                break;

                        case IL_CRS_SORT_TITLE:
                                $this->items = ilUtil::sortArray($this->items,"title","asc");
                                break;

                        case IL_CRS_SORT_ACTIVATION:
                                // Sort by starting time. If mode is IL_CRS_TIMINGS_DEACTIVATED then sort these items by title and append
                                // them to the array.
                                list($active,$inactive) = $this->__splitByActivation();
                                
                                $sorted_active = ilUtil::sortArray($active,"start","asc");
                                $sorted_inactive = ilUtil::sortArray($inactive,'title','asc');
                                
                                $this->items = array_merge($sorted_active,$sorted_inactive);
                                break;
                }
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__splitByActivation (  ) 

Definition at line 720 of file class.ilCourseItems.php.

Referenced by __sort().

        {
                $inactive = $active = array();
                foreach($this->items as $item)
                {
                        if($item['timing_type'] == IL_CRS_TIMINGS_DEACTIVATED)
                        {
                                $inactive[] = $item;
                        }
                        else
                        {
                                $active[] = $item;
                        }
                }
                return array($active,$inactive);
        }

Here is the caller graph for this function:

ilCourseItems::__switchNodes ( node_a,
node_b 
)

Definition at line 669 of file class.ilCourseItems.php.

References $query, and $res.

Referenced by __updateBottom(), and __updateTop().

        {
                if(!$node_b["obj_id"])
                {
                        return false;
                }

                $query = "UPDATE crs_items SET ".
                        "position = '".$node_a["position"]."' ".
                        "WHERE obj_id = '".$node_b["obj_id"]."' ".
                        "AND parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);

                $query = "UPDATE crs_items SET ".
                        "position = '".$node_b["position"]."' ".
                        "WHERE obj_id = '".$node_a["obj_id"]."' ".
                        "AND parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);

                return true;
        }

Here is the caller graph for this function:

ilCourseItems::__updateBottom ( item_id  ) 

Definition at line 618 of file class.ilCourseItems.php.

References $query, $res, $row, __isMovable(), and __switchNodes().

Referenced by moveDown().

        {
                $query = "SELECT position,obj_id FROM crs_items ".
                        "WHERE obj_id = '".$item_id."' ".
                        "AND parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $node_a["position"] = $row->position;
                        $node_a["obj_id"]         = $row->obj_id;
                        break;
                }
                $query = "SELECT position ,obj_id FROM crs_items ".
                        "WHERE position > '".$node_a["position"]."' ".
                        "AND parent_id = '".$this->getParentId()."' ".
                        "ORDER BY position ASC";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if(!$this->__isMovable($row->obj_id))
                        {
                                continue;
                        }
                        $node_b["position"] = $row->position;
                        $node_b["obj_id"]         = $row->obj_id;
                        break;
                }
                $this->__switchNodes($node_a,$node_b);

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::__updateTop ( item_id  ) 

Definition at line 585 of file class.ilCourseItems.php.

References $query, $res, $row, __isMovable(), and __switchNodes().

Referenced by moveUp().

        {
                $query = "SELECT position,obj_id FROM crs_items ".
                        "WHERE obj_id = '".$item_id."' ".
                        "AND parent_id = '".$this->getParentId()."'";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $node_a["position"] = $row->position;
                        $node_a["obj_id"]         = $row->obj_id;
                }

                $query = "SELECT position, obj_id FROM crs_items ".
                        "WHERE position < '".$node_a["position"]."' ".
                        "AND parent_id = '".$this->getParentId()."' ".
                        "ORDER BY position DESC";

                $res = $this->ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if(!$this->__isMovable($row->obj_id))
                        {
                                continue;
                        }
                        $node_b["position"] = $row->position;
                        $node_b["obj_id"]         = $row->obj_id;
                        break;
                }
                $this->__switchNodes($node_a,$node_b);
                
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::_getItem ( a_item_id  ) 

Definition at line 737 of file class.ilCourseItems.php.

References $data, $ilDB, $query, $res, $row, and ilTimingPlaned::_getPlanedTimings().

Referenced by ilTimingCache::_getTimings(), ilAccessHandler::doActivationCheck(), and ilTimingPlaned::validate().

        {
                include_once 'course/classes/class.ilObjCourse.php';

                global $ilDB,$ilUser;

                $query = "SELECT * FROM crs_items ".
                        "WHERE obj_id = '".$a_item_id."'";
                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $data['parent_id'] = $row->parent_id;
                        $data['obj_id'] = $row->obj_id;
                        $data['timing_type'] = $row->timing_type;
                        $data['timing_start'] = $row->timing_start;
                        $data['timing_end'] = $row->timing_end;
                        $data["suggestion_start"] = $row->suggestion_start ? $row->suggestion_start :
                                mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
                        $data["suggestion_end"] = $row->suggestion_end ? $row->suggestion_end :
                                mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
                        $data['changeable'] = $row->changeable;
                        $data['earliest_start'] = $row->earliest_start ? $row->earliest_start :
                                mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
                        $data['latest_end'] = $row->latest_end ? $row->latest_end : 
                                mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
                        $data['visible'] = $row->visible;
                        $data['position'] = $row->position;


                        include_once 'course/classes/Timings/class.ilTimingPlaned.php';
                        $user_data = ilTimingPlaned::_getPlanedTimings($ilUser->getId(),$a_item['child']);

                        // Check for user entry
                        if($data['changeable'] and 
                           $data['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
                        {
                                if($user_data['planed_start'])
                                {
                                        $data['start'] = $user_data['planed_start'];
                                        $data['end'] = $user_data['planed_end'];
                                        $data['activation_info'] = 'crs_timings_planed_info';
                                }
                                else
                                {
                                        $data['start'] = $row->suggestion_start;
                                        $data['end'] = $row->suggestion_end;
                                        $data['activation_info'] = 'crs_timings_suggested_info';
                                }
                        }
                        elseif($data['timing_type'] == IL_CRS_TIMINGS_PRESETTING)
                        {
                                $data['start'] = $row->suggestion_start;
                                $data['end'] = $row->suggestion_end;
                                $data['activation_info'] = 'crs_timings_suggested_info';
                        }
                        elseif($data['timing_type'] == IL_CRS_TIMINGS_ACTIVATION)
                        {
                                $data['start'] = $row->timing_start;
                                $data['end'] = $row->timing_end;
                                $data['activation_info'] = 'activation';
                        }
                        else
                        {
                                $data['start'] = 999999999;
                        }
                }
                return $data ? $data : array();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::_hasChangeableTimings ( a_ref_id  ) 

Definition at line 109 of file class.ilCourseItems.php.

References $ilDB, $query, $res, and $tree.

Referenced by ilCourseContentGUI::__renderUserItem(), ilCourseContentGUI::editUserTimings(), ilObjCourseGUI::membersObject(), and ilCourseContentGUI::showUserTimings().

        {
                global $tree,$ilDB;

                $subtree = $tree->getSubTree($tree->getNodeData($a_ref_id));
                
                foreach($subtree as $node)
                {
                        $ref_ids[] = $node['ref_id'];
                }

                $query = "SELECT * FROM crs_items ".
                        "WHERE timing_type = '".IL_CRS_TIMINGS_PRESETTING."' ".
                        "AND changeable = '1' ".
                        "AND obj_id IN('".implode("','",$ref_ids)."') ".
                        "AND parent_id IN('".implode("','",$ref_ids)."')";

                $res = $ilDB->query($query);
                return $res->numRows() ? true :false;
        }

Here is the caller graph for this function:

ilCourseItems::_hasCollectionTimings ( a_ref_id  ) 

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

References $ilDB, $obj_id, $query, $res, $tree, ilLPCollectionCache::_getItems(), and ilLPObjSettings::_lookupMode().

Referenced by ilLPListOfProgressGUI::__showContainerList(), ilPDFPresentation::__showItems(), and ilLPListOfObjectsGUI::__showUsersList().

        {
                global $tree,$ilDB,$ilObjDataCache;

                // get all collections
                include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';

                $obj_id = $ilObjDataCache->lookupObjId($a_ref_id);
                switch(ilLPObjSettings::_lookupMode($obj_id))
                {
                        case LP_MODE_COLLECTION:
                                include_once 'Services/Tracking/classes/class.ilLPCollectionCache.php';
                                $ids = ilLPCollectionCache::_getItems($obj_id);
                                break;
                        default:
                                $ids = array($a_ref_id);
                                break;
                } 
                if(!$ids)
                {
                        return false;
                }

                $query = "SELECT * FROM crs_items ".
                        "WHERE timing_type = '".IL_CRS_TIMINGS_PRESETTING."' ".
                        "AND obj_id IN('".implode("','",$ids)."')";

                $res = $ilDB->query($query);
                return $res->numRows() ? true :false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::_isActivated ( a_item_id  ) 

Definition at line 806 of file class.ilCourseItems.php.

References $ilDB, $query, $res, and $row.

Referenced by ilRepositoryExplorer::isVisible().

        {
                global $ilDB;

                $query = "SELECT * FROM crs_items ".
                        "WHERE obj_id = '".$a_item_id."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        if($row->activation_unlimited)
                        {
                                return true;
                        }
                        if(time() > $row->activation_start and time() < $row->activation_end)
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the caller graph for this function:

ilCourseItems::createDefaultEntry ( a_item  ) 

Definition at line 536 of file class.ilCourseItems.php.

References $query, $res, and __getLastPosition().

Referenced by __getItemData().

        {
                $a_item["timing_type"] = IL_CRS_TIMINGS_DEACTIVATED;
                $a_item["timing_start"]         = time();
                $a_item["timing_end"]           = time();
                $a_item["suggestion_start"]             = time();
                $a_item["suggestion_end"]               = time();
                $a_item["position"]                             = $this->__getLastPosition() + 1;
                $a_item['visible']                              = 0;
                $a_item['changeable']                   = 0;
                $a_item['earliest_start']               = time();
                $a_item['latest_end']           = mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
                $a_item['visible']                              = 0;
                $a_item['changeable']                   = 0;
                

                $query = "INSERT INTO crs_items ".
                        "VALUES('".$a_item['parent']."','".
                        $a_item["child"]."','".
                        $a_item["timing_type"]."','".
                        $a_item["timing_start"]."','".
                        $a_item["timing_end"]."','".
                        $a_item["suggestion_start"]."','".
                        $a_item["suggestion_end"]."','".
                        $a_item["changeable"]."','".
                        $a_item['earliest_start']."',' ".
                        $a_item['latest_end']."',' ".
                        $a_item["visible"]."','".
                        $a_item["position"]."')";

                $res = $this->ilDB->query($query);

                return $a_item;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::deleteAllEntries (  ) 

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

References $query.

        {
                $all_items = $this->tree->getChilds($this->parent);

                foreach($all_items as $item)
                {
                        $query = "DELETE FROM crs_items ".
                                "WHERE parent_id = '".$item["child"]."'";

                        $this->ilDB->query($query);
                }
                $query = "DELETE FROM crs_items ".
                        "WHERE parent_id = '".$this->course_obj->getRefId()."'";
                
                $this->ilDB->query($query);

                return true;
        }

ilCourseItems::enabledChangeable (  ) 

Definition at line 212 of file class.ilCourseItems.php.

Referenced by update().

        {
                return (bool) $this->changeable;
        }

Here is the caller graph for this function:

ilCourseItems::enabledVisible (  ) 

Definition at line 204 of file class.ilCourseItems.php.

Referenced by update().

        {
                return (bool) $this->visible;
        }

Here is the caller graph for this function:

ilCourseItems::getAllItems (  ) 

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

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

ilCourseItems::getEarliestStart (  ) 

Definition at line 188 of file class.ilCourseItems.php.

Referenced by update().

        {
                return $this->earliest_start ? $this->earliest_start : mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilCourseItems::getFilteredItems ( a_container_id  ) 

Definition at line 222 of file class.ilCourseItems.php.

References ilEventItems::_getItemsOfContainer().

        {
                include_once 'course/classes/Event/class.ilEventItems.php';

                $event_items = ilEventItems::_getItemsOfContainer($a_container_id);

                foreach($this->items as $item)
                {
                        if(!in_array($item['ref_id'],$event_items))
                        {
                                $filtered[] = $item;
                        }
                }
                return $filtered ? $filtered : array();
        } 

Here is the call graph for this function:

ilCourseItems::getItem ( a_item_id  ) 

Definition at line 275 of file class.ilCourseItems.php.

        {
                foreach($this->items as $item)
                {
                        if($item["child"] == $a_item_id)
                        {
                                return $item;
                        }
                }
                return array();
        }

ilCourseItems::getItems (  ) 

Definition at line 257 of file class.ilCourseItems.php.

References $rbacsystem.

        {
                global $rbacsystem;

                foreach($this->items as $item)
                {
                        if($item["type"] != "rolf" and
                           ($item["timing_type"] or
                                ($item["timing_start"] <= time() and $item["timing_end"] >= time())))
                        {
                                if($rbacsystem->checkAccess('visible',$item['ref_id']))
                                {
                                        $filtered[] = $item;
                                }
                        }
                }
                return $filtered ? $filtered : array();
        }

ilCourseItems::getItemsByEvent ( a_event_id  ) 

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

References $items, and __getItemData().

        {
                include_once 'course/classes/Event/class.ilEventItems.php';

                $event_items_obj = new ilEventItems($a_event_id);
                $event_items = $event_items_obj->getItems();
                foreach($event_items as $item)
                {
                        if($this->tree->isDeleted($item))
                        {
                                continue;
                        }
                        $node = $this->tree->getNodeData($item);
                        $items[] = $this->__getItemData($node);
                }
                return $items ? $items : array();
        }

Here is the call graph for this function:

ilCourseItems::getLatestEnd (  ) 

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

Referenced by update(), and validateActivation().

        {
                return $this->latest_end ? $this->latest_end : mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilCourseItems::getParentId (  ) 

Definition at line 138 of file class.ilCourseItems.php.

Referenced by __purgeDeleted().

        {
                return $this->parent;
        }

Here is the caller graph for this function:

ilCourseItems::getSuggestionEnd (  ) 

Definition at line 180 of file class.ilCourseItems.php.

Referenced by update(), and validateActivation().

        {
                return $this->suggestion_end ? $this->suggestion_end : mktime(23,55,00,date('n',time()),date('j',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilCourseItems::getSuggestionStart (  ) 

Definition at line 172 of file class.ilCourseItems.php.

Referenced by update().

        {
                return $this->suggestion_start ? $this->suggestion_start : mktime(0,0,1,date('n',time()),date('j',time()),date('Y',time()));
        }

Here is the caller graph for this function:

ilCourseItems::getTimingEnd (  ) 

Definition at line 164 of file class.ilCourseItems.php.

Referenced by update(), and validateActivation().

        {
                return $this->timing_end;
        }

Here is the caller graph for this function:

ilCourseItems::getTimingStart (  ) 

Definition at line 156 of file class.ilCourseItems.php.

Referenced by update(), and validateActivation().

        {
                return $this->timing_start;
        }

Here is the caller graph for this function:

ilCourseItems::getTimingType (  ) 

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

Referenced by update(), and validateActivation().

        {
                return $this->timing_type;
        }

Here is the caller graph for this function:

ilCourseItems::getUserId (  ) 

Definition at line 71 of file class.ilCourseItems.php.

Referenced by __getItemData().

        {
                global $ilUser;

                return $this->user_id ? $this->user_id : $ilUser->getId();
        }

Here is the caller graph for this function:

ilCourseItems::ilCourseItems ( &$  course_obj,
a_parent = 0,
user_id = 0 
)

Definition at line 55 of file class.ilCourseItems.php.

References $course_obj, $ilDB, $ilErr, $lng, $tree, $user_id, __read(), and setParentId().

        {
                global $ilErr,$ilDB,$lng,$tree;

                $this->ilErr =& $ilErr;
                $this->ilDB  =& $ilDB;
                $this->lng   =& $lng;
                $this->tree  =& $tree;

                $this->course_obj =& $course_obj;
                $this->setParentId($a_parent);
                $this->user_id = $user_id;

                $this->__read();
        }

Here is the call graph for this function:

ilCourseItems::moveDown ( item_id  ) 

Definition at line 356 of file class.ilCourseItems.php.

References __read(), and __updateBottom().

        {
                $this->__updateBottom($item_id);
                $this->__read();

                return true;
        }

Here is the call graph for this function:

ilCourseItems::moveUp ( item_id  ) 

Definition at line 349 of file class.ilCourseItems.php.

References __read(), and __updateTop().

        {
                $this->__updateTop($item_id);
                $this->__read();
                
                return true;
        }

Here is the call graph for this function:

ilCourseItems::setEarliestStart ( a_start  ) 

Definition at line 184 of file class.ilCourseItems.php.

        {
                $this->earliest_start = $a_start;
        }

ilCourseItems::setLatestEnd ( a_end  ) 

Definition at line 192 of file class.ilCourseItems.php.

        {
                $this->latest_end = $a_end;
        }

ilCourseItems::setParentId ( a_parent = 0  ) 

Definition at line 130 of file class.ilCourseItems.php.

References __read().

Referenced by ilCourseItems().

        {
                $this->parent = $a_parent ? $a_parent : $this->course_obj->getRefId();

                $this->__read();
                
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilCourseItems::setSuggestionEnd ( a_end  ) 

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

        {
                $this->suggestion_end = $a_end;
        }

ilCourseItems::setSuggestionStart ( a_start  ) 

Definition at line 168 of file class.ilCourseItems.php.

        {
                $this->suggestion_start = $a_start;
        }

ilCourseItems::setTimingEnd ( a_end  ) 

Definition at line 160 of file class.ilCourseItems.php.

        {
                $this->timing_end = $a_end;
        }

ilCourseItems::setTimingStart ( a_start  ) 

Definition at line 152 of file class.ilCourseItems.php.

        {
                $this->timing_start = $a_start;
        }

ilCourseItems::setTimingType ( a_type  ) 

Definition at line 143 of file class.ilCourseItems.php.

        {
                $this->timing_type = $a_type;
        }

ilCourseItems::toggleChangeable ( a_status  ) 

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

        {
                $this->changeable = (int) $a_status;
        }

ilCourseItems::toggleVisible ( a_status  ) 

Definition at line 200 of file class.ilCourseItems.php.

        {
                $this->visible = (int) $a_status;
        }

ilCourseItems::update ( a_item_id  ) 

Definition at line 327 of file class.ilCourseItems.php.

References $query, $res, __read(), enabledChangeable(), enabledVisible(), getEarliestStart(), getLatestEnd(), getSuggestionEnd(), getSuggestionStart(), getTimingEnd(), getTimingStart(), and getTimingType().

        {
                $query = "UPDATE crs_items SET ".
                        "timing_type = '".(int) $this->getTimingType()."', ".
                        "timing_start = '".(int) $this->getTimingStart()."', ".
                        "timing_end = '".(int) $this->getTimingEnd()."', ".
                        "suggestion_start = '".(int) $this->getSuggestionStart()."', ".
                        "suggestion_end = '".(int) $this->getSuggestionEnd()."', ".
                        "changeable = '".(int) $this->enabledChangeable()."', ".
                        "earliest_start = '".(int) $this->getEarliestStart()."', ".
                        "latest_end = '".(int) $this->getLatestEnd()."', ".
                        "visible = '".(int) $this->enabledVisible()."' ".
                        "WHERE parent_id = '".$this->getParentId()."' ".
                        "AND obj_id = '".$a_item_id."'";

                $res = $this->ilDB->query($query);
                $this->__read();

                return true;
        }

Here is the call graph for this function:

ilCourseItems::validateActivation (  ) 

Definition at line 287 of file class.ilCourseItems.php.

References $ilErr, getLatestEnd(), getSuggestionEnd(), getTimingEnd(), getTimingStart(), and getTimingType().

        {
                global $ilErr;
                
                $ilErr->setMessage('');

                if($this->getTimingType() == IL_CRS_TIMINGS_ACTIVATION)
                {
                        if($this->getTimingStart() > $this->getTimingEnd())
                        {
                                $ilErr->appendMessage($this->lng->txt("crs_activation_start_invalid"));
                        }
                }
                if($this->getTimingType() == IL_CRS_TIMINGS_PRESETTING)
                {
                        if($this->getSuggestionEnd() > $this->getLatestEnd())
                        {
                                $ilErr->appendMessage($this->lng->txt('crs_latest_end_not_valid'));
                        }
                }
                // Disabled
                #if($this->getTimingType() == IL_CRS_TIMINGS_PRESETTING and 
                #   $this->enabledChangeable())
                #{
                #       if($this->getSuggestionStart() < $this->getEarliestStart() or
                #          $this->getSuggestionEnd() > $this->getLatestEnd() or
                #          $this->getSuggestionStart() > $this->getLatestEnd() or
                #          $this->getSuggestionEnd() < $this->getEarliestStart())
                #       {
                #               $ilErr->appendMessage($this->lng->txt("crs_suggestion_not_within_activation"));
                #       }
                #}

                if($ilErr->getMessage())
                {
                        return false;
                }
                return true;
        }

Here is the call graph for this function:


Field Documentation

ilCourseItems::$course_obj

Definition at line 41 of file class.ilCourseItems.php.

Referenced by ilCourseItems().

ilCourseItems::$ilDB
ilCourseItems::$ilErr

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

Referenced by ilCourseItems(), and validateActivation().

ilCourseItems::$items

Definition at line 47 of file class.ilCourseItems.php.

Referenced by getItemsByEvent().

ilCourseItems::$lng

Definition at line 45 of file class.ilCourseItems.php.

Referenced by ilCourseItems().

ilCourseItems::$parent

Definition at line 48 of file class.ilCourseItems.php.

ilCourseItems::$timing_end

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

ilCourseItems::$timing_start

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

ilCourseItems::$timing_type

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

ilCourseItems::$tree

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