5 include_once
"./Services/Object/classes/class.ilObjectGUI.php";
25 $this->webr_ref_id = 0;
26 $this->webr_id = $webr_id;
36 $query =
"SELECT * FROM webr_items ".
37 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
" ".
38 "AND link_id = ".$ilDB->quote($a_link_id ,
'integer');
43 $item[
'title'] =
$row->title;
44 $item[
'description'] =
$row->description;
45 $item[
'target'] =
$row->target;
46 $item[
'active'] = (bool)
$row->active;
47 $item[
'disable_check'] =
$row->disable_check;
48 $item[
'create_date'] =
$row->create_date;
49 $item[
'last_update'] =
$row->last_update;
50 $item[
'last_check'] =
$row->last_check;
51 $item[
'valid'] =
$row->valid;
52 $item[
'link_id'] =
$row->link_id;
53 $item[
'internal'] =
$row->internal;
55 return $item ? $item :
array();
69 $query =
'UPDATE webr_items SET '.
70 'title = '.$ilDB->quote($a_title,
'text').
' '.
71 'WHERE link_id = '.$ilDB->quote($a_link_id,
'integer');
81 $this->webr_ref_id = $a_ref_id;
85 return $this->webr_ref_id;
89 $this->webr_id = $a_id;
93 return $this->webr_id;
105 $this->title = $a_title;
113 $this->description = $a_description;
117 return $this->description;
121 $this->target = $a_target;
129 $this->status = (int) $a_status;
133 return (
bool) $this->status;
137 $this->check = (int) $a_status;
141 return (
bool) $this->check;
146 $this->c_date = $a_date;
150 return $this->c_date;
155 $this->m_date = $a_date;
159 return $this->m_date;
163 $this->last_check = $a_date;
167 return $this->last_check;
171 $this->valid = (int) $a_status;
179 $this->
internal = (bool) $a_status;
183 return (
bool) $this->internal;
195 include_once
'Modules/WebResource/classes/class.ilParameterAppender.php';
201 $new_item->setTitle($item[
'title']);
202 $new_item->setDescription($item[
'description']);
203 $new_item->setTarget($item[
'target']);
204 $new_item->setActiveStatus($item[
'active']);
205 $new_item->setDisableCheckStatus($item[
'disable_check']);
206 $new_item->setLastCheckDate($item[
'last_check']);
207 $new_item->setValidStatus($item[
'valid']);
208 $new_item->setInternal($item[
'internal']);
209 $new_item->add(
true);
214 $appender->setName(
$data[
'name']);
215 $appender->setValue(
$data[
'value']);
216 $appender->add($new_item->getLinkId());
224 function delete($a_item_id,$a_update_history =
true)
228 $item = $this->
getItem($a_item_id);
230 $query =
"DELETE FROM webr_items ".
232 "AND link_id = ".$ilDB->quote($a_item_id ,
'integer');
235 if($a_update_history)
237 include_once(
"./Services/History/classes/class.ilHistory.php");
245 function update($a_update_history =
true)
255 $query =
"UPDATE webr_items ".
256 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
257 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
258 "target = ".$ilDB->quote($this->
getTarget() ,
'text').
", ".
262 "internal = ".$ilDB->quote($this->
getInternal() ,
'integer').
", ".
265 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer').
" ".
269 if($a_update_history)
271 include_once(
"./Services/History/classes/class.ilHistory.php");
283 $query =
"UPDATE webr_items ".
284 "SET valid = ".$ilDB->quote($a_status ,
'integer').
" ".
285 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
295 $query =
"UPDATE webr_items ".
296 "SET active = ".$ilDB->quote($a_status ,
'integer').
" ".
297 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
307 $query =
"UPDATE webr_items ".
308 "SET disable_check = ".$ilDB->quote($a_status ,
'integer').
" ".
309 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
321 $period = $a_offset ? $a_offset : 0;
322 $time =
time() - $period;
325 $query =
"UPDATE webr_items ".
326 "SET last_check = ".$ilDB->quote(
time() ,
'integer').
" ".
328 "AND disable_check = '0' ".
329 "AND last_check < ".$ilDB->quote($time ,
'integer');
334 $query =
"UPDATE webr_items ".
335 "SET last_check = ".$ilDB->quote(
time() ,
'integer').
" ".
337 "AND disable_check = '0' ";
349 $period = $a_offset ? $a_offset : 0;
350 $time =
time() - $period;
353 $query =
"UPDATE webr_items ".
355 "WHERE disable_check = '0' ".
357 "AND last_check < ".$ilDB->quote($time ,
'integer');
362 $query =
"UPDATE webr_items ".
364 "WHERE disable_check = '0' ".
372 function add($a_update_history =
true)
379 $next_id = $ilDB->nextId(
'webr_items');
380 $query =
"INSERT INTO webr_items (link_id,title,description,target,active,disable_check,".
381 "last_update,create_date,webr_id,valid,internal) ".
383 $ilDB->quote($next_id ,
'integer').
", ".
384 $ilDB->quote($this->
getTitle() ,
'text').
", ".
386 $ilDB->quote($this->
getTarget() ,
'text').
", ".
400 if($a_update_history)
402 include_once(
"./Services/History/classes/class.ilHistory.php");
413 $query =
"SELECT * FROM webr_items ".
414 "WHERE link_id = ".$ilDB->quote($a_link_id ,
'integer');
439 $query =
"SELECT * FROM webr_items ".
441 "AND link_id = ".$ilDB->quote($a_link_id ,
'integer');
446 $item[
'title'] =
$row->title;
447 $item[
'description'] =
$row->description;
448 $item[
'target'] =
$row->target;
449 $item[
'active'] = (bool)
$row->active;
450 $item[
'disable_check'] =
$row->disable_check;
451 $item[
'create_date'] =
$row->create_date;
452 $item[
'last_update'] =
$row->last_update;
453 $item[
'last_check'] =
$row->last_check;
454 $item[
'valid'] =
$row->valid;
455 $item[
'link_id'] =
$row->link_id;
456 $item[
'internal'] =
$row->internal;
458 return $item ? $item :
array();
470 $query =
"SELECT link_id FROM webr_items ".
471 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer');
475 $link_ids[] =
$row[
'link_id'];
477 return (
array) $link_ids;
484 $query =
"SELECT * FROM webr_items ".
490 $items[
$row->link_id][
'title'] =
$row->title;
491 $items[
$row->link_id][
'description'] =
$row->description;
492 $items[
$row->link_id][
'target'] =
$row->target;
493 $items[
$row->link_id][
'active'] = (bool)
$row->active;
494 $items[
$row->link_id][
'disable_check'] =
$row->disable_check;
495 $items[
$row->link_id][
'create_date'] =
$row->create_date;
496 $items[
$row->link_id][
'last_update'] =
$row->last_update;
497 $items[
$row->link_id][
'last_check'] =
$row->last_check;
498 $items[
$row->link_id][
'valid'] =
$row->valid;
499 $items[
$row->link_id][
'link_id'] =
$row->link_id;
500 $items[
$row->link_id][
'internal'] =
$row->internal;
502 return $items ? $items :
array();
512 include_once
'./Services/Container/classes/class.ilContainer.php';
513 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
525 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
527 foreach($a_items as $link_id => $item)
529 if(isset($pos[$link_id]))
531 $sorted[$link_id] = $item;
532 $sorted[$link_id][
'position'] = $pos[$link_id];
536 $unsorted[$link_id] = $item;
541 $a_items = (
array) $sorted + (
array) $unsorted;
553 if($item_data[
'active'])
555 $active_items[$id] = $item_data;
558 return $active_items ? $active_items :
array();
563 $period = $a_offset ? $a_offset : 0;
564 $time =
time() - $period;
568 if(!$item_data[
'disable_check'])
570 if(!$item_data[
'last_check']
or $item_data[
'last_check'] < $time)
572 $check_items[$id] = $item_data;
576 return $check_items ? $check_items :
array();
586 $ilDB->manipulate(
"DELETE FROM webr_items WHERE webr_id = ".$ilDB->quote($webr_id ,
'integer'));
603 $query =
"SELECT * FROM webr_items ".
604 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
' '.
605 "AND active = ".$ilDB->quote(1,
'integer').
' ';
607 return $res->numRows() == 1 ? true :
false;
619 $query =
"SELECT COUNT(*) num FROM webr_items ".
620 "WHERE webr_id = ".$ilDB->quote($a_webr_id,
'integer');
638 include_once(
"./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
662 foreach((
array) $items as $item_id => $item)
670 'id' => $link[
'link_id'],
671 'active' => $link[
'active'] ? 1 : 0,
672 'valid' => $link[
'valid'] ? 1 : 0,
673 'disableValidation' => $link[
'disable_check'] ? 1 : 0,
674 'position' => $position,
675 'internal' => $link[
'internal']
683 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
687 switch($param[
'value'])
698 $value =
'matriculation';
712 'name' => $param[
'name'],
validate()
Validate required settings.
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.
setLastCheckDate($a_date)
toXML(ilXmlWriter $writer)
Write link XML.
static updateTitle($a_link_id, $a_title)
Update title.
setDisableCheckStatus($a_status)
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
const LINKS_MATRICULATION
static _deleteAll($webr_id)
cloneItems($a_new_id)
Copy web resource items.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
xmlEndTag($tag)
Writes an endtag.
static getAllItemIds($a_webr_id)
Get all link ids.
setActiveStatus($a_status)
static lookupItem($a_webr_id, $a_link_id)
static _createEntry($a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
Create styles array
The data for the language used.
setLinkResourceRefId($a_ref_id)
updateLastCheck($a_offset=0)
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one...
__construct($webr_id)
Constructor public.
updateValidByCheck($a_offset=0)
__setLastUpdateDate($a_date)
Class ilObjLinkResourceGUI.
getCheckItems($a_offset=0)
Class ilParameterAppender.
static _lookupSortMode($a_obj_id)
lookup sort mode
add($a_update_history=true)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static lookupPositions($a_obj_id)
Get positions of subitems.
setDescription($a_description)
static _getParams($a_link_id)
Get dynamic parameter definitions.
setValidStatus($a_status)
sortItems($a_items)
Sort items (sorting mode depends on sorting setting)
updateDisableCheck($a_status)
update($a_update_history=true)