Public Member Functions | |
| ilCourseItems (&$course_obj, $a_parent=0) | |
| setParentId ($a_parent=0) | |
| getParentId () | |
| setActivationUnlimitedStatus ($a_value) | |
| getActivationUnlimitedStatus () | |
| setActivationStart ($a_start) | |
| getActivationStart () | |
| setActivationEnd ($a_end) | |
| getActivationEnd () | |
| getAllItems () | |
| 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) | |
| __switchNodes ($node_a, $node_b) | |
| __sort () | |
| _isActivated ($a_item_id) | |
Data Fields | |
| $course_obj | |
| $ilErr | |
| $ilDB | |
| $tree | |
| $lng | |
| $items | |
| $parent | |
| $activation_unlimited | |
| $activation_start | |
| $activation_end | |
Definition at line 35 of file class.ilCourseItems.php.
| ilCourseItems::__delete | ( | $ | a_obj_id | ) |
Definition at line 251 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 285 of file class.ilCourseItems.php.
References $query, $res, $row, and createDefaultEntry().
Referenced by __read().
{
$query = "SELECT * FROM crs_items ".
"WHERE parent_id = '".$this->getParentId()."' ".
"AND obj_id = '".$a_item["child"]."'";
$res = $this->ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$a_item["activation_unlimited"] = $row->activation_unlimited;
$a_item["activation_start"] = $row->activation_start;
$a_item["activation_end"] = $row->activation_end;
$a_item["position"] = $row->position;
}
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 328 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::__purgeDeleted | ( | ) |
Definition at line 234 of file class.ilCourseItems.php.
References $query, $res, $row, and __delete().
Referenced by __read().
{
$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(!$this->tree->isInTree($row->obj_id))
{
$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 206 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 425 of file class.ilCourseItems.php.
References ilUtil::sortArray().
Referenced by __read().
{
switch($this->course_obj->getOrderType())
{
case $this->course_obj->SORT_MANUAL:
$this->items = ilUtil::sortArray($this->items,"position","asc",true);
break;
case $this->course_obj->SORT_TITLE:
$this->items = ilUtil::sortArray($this->items,"title","asc");
break;
case $this->course_obj->SORT_ACTIVATION:
$this->items = ilUtil::sortArray($this->items,"activation_end","asc");
break;
}
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilCourseItems::__switchNodes | ( | $ | node_a, | |
| $ | node_b | |||
| ) |
Definition at line 400 of file class.ilCourseItems.php.
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 370 of file class.ilCourseItems.php.
References $query, $res, $row, 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))
{
$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 341 of file class.ilCourseItems.php.
References $query, $res, $row, 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))
{
$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::_isActivated | ( | $ | a_item_id | ) |
Definition at line 444 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 307 of file class.ilCourseItems.php.
References $query, $res, and __getLastPosition().
Referenced by __getItemData().
{
$a_item["activation_unlimited"] = 1;
$a_item["activation_start"] = time();
$a_item["activation_end"] = time();
$a_item["position"] = $this->__getLastPosition() + 1;
$query = "INSERT INTO crs_items ".
"VALUES('".$this->getParentId()."','".
$a_item["child"]."','".
$a_item["activation_unlimited"]."','".
$a_item["activation_start"]."','".
$a_item["activation_end"]."','".
$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 186 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::getActivationEnd | ( | ) |
Definition at line 97 of file class.ilCourseItems.php.
Referenced by update(), and validateActivation().
{
return $this->activation_end;
}
Here is the caller graph for this function:| ilCourseItems::getActivationStart | ( | ) |
Definition at line 89 of file class.ilCourseItems.php.
Referenced by update(), and validateActivation().
{
return $this->activation_start;
}
Here is the caller graph for this function:| ilCourseItems::getActivationUnlimitedStatus | ( | ) |
Definition at line 81 of file class.ilCourseItems.php.
Referenced by update(), and validateActivation().
{
return (bool) $this->activation_unlimited;
}
Here is the caller graph for this function:| ilCourseItems::getAllItems | ( | ) |
Definition at line 101 of file class.ilCourseItems.php.
{
return $this->items ? $this->items : array();
}
| ilCourseItems::getItem | ( | $ | a_item_id | ) |
Definition at line 123 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 105 of file class.ilCourseItems.php.
References $rbacsystem.
{
global $rbacsystem;
foreach($this->items as $item)
{
if($item["type"] != "rolf" and
($item["activation_unlimited"] or
($item["activation_start"] <= time() and $item["activation_end"] >= time())))
{
if($rbacsystem->checkAccess('visible',$item['ref_id']))
{
$filtered[] = $item;
}
}
}
return $filtered ? $filtered : array();
}
| ilCourseItems::getParentId | ( | ) |
Definition at line 73 of file class.ilCourseItems.php.
{
return $this->parent;
}
| ilCourseItems::ilCourseItems | ( | &$ | course_obj, | |
| $ | a_parent = 0 | |||
| ) |
Definition at line 50 of file class.ilCourseItems.php.
References $course_obj, $ilDB, $ilErr, $lng, $tree, __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->__read();
}
Here is the call graph for this function:| ilCourseItems::moveDown | ( | $ | item_id | ) |
Definition at line 178 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 171 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::setActivationEnd | ( | $ | a_end | ) |
Definition at line 93 of file class.ilCourseItems.php.
{
$this->activation_end = $a_end;
}
| ilCourseItems::setActivationStart | ( | $ | a_start | ) |
Definition at line 85 of file class.ilCourseItems.php.
{
$this->activation_start = $a_start;
}
| ilCourseItems::setActivationUnlimitedStatus | ( | $ | a_value | ) |
Definition at line 77 of file class.ilCourseItems.php.
{
$this->activation_unlimited = $a_value ? 1 : 0;
}
| ilCourseItems::setParentId | ( | $ | a_parent = 0 |
) |
Definition at line 65 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::update | ( | $ | a_item_id | ) |
Definition at line 154 of file class.ilCourseItems.php.
References $query, $res, __read(), getActivationEnd(), getActivationStart(), and getActivationUnlimitedStatus().
{
$query = "UPDATE crs_items SET ".
"activation_unlimited = '".(int) $this->getActivationUnlimitedStatus()."', ".
"activation_start = '".(int) $this->getActivationStart()."', ".
"activation_end = '".(int) $this->getActivationEnd()."' ".
"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 135 of file class.ilCourseItems.php.
References getActivationEnd(), getActivationStart(), and getActivationUnlimitedStatus().
{
$this->course_obj->setMessage('');
if(!$this->getActivationUnlimitedStatus())
{
if($this->getActivationStart() > $this->getActivationEnd())
{
$this->course_obj->appendMessage($this->lng->txt("crs_activation_start_invalid"));
}
}
if($this->course_obj->getMessage())
{
return false;
}
return true;
}
Here is the call graph for this function:| ilCourseItems::$activation_end |
Definition at line 48 of file class.ilCourseItems.php.
| ilCourseItems::$activation_start |
Definition at line 47 of file class.ilCourseItems.php.
| ilCourseItems::$activation_unlimited |
Definition at line 46 of file class.ilCourseItems.php.
| ilCourseItems::$course_obj |
Definition at line 37 of file class.ilCourseItems.php.
Referenced by ilCourseItems().
| ilCourseItems::$ilDB |
Definition at line 39 of file class.ilCourseItems.php.
Referenced by _isActivated(), and ilCourseItems().
| ilCourseItems::$ilErr |
Definition at line 38 of file class.ilCourseItems.php.
Referenced by ilCourseItems().
| ilCourseItems::$items |
Definition at line 43 of file class.ilCourseItems.php.
| ilCourseItems::$lng |
Definition at line 41 of file class.ilCourseItems.php.
Referenced by ilCourseItems().
| ilCourseItems::$parent |
Definition at line 44 of file class.ilCourseItems.php.
| ilCourseItems::$tree |
Definition at line 40 of file class.ilCourseItems.php.
Referenced by ilCourseItems().
1.7.1