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;
54 return $item ? $item : array();
62 $this->webr_ref_id = $a_ref_id;
66 return $this->webr_ref_id;
70 $this->webr_id = $a_id;
74 return $this->webr_id;
86 $this->title = $a_title;
94 $this->description = $a_description;
98 return $this->description;
102 $this->target = $a_target;
106 return $this->target;
110 $this->status = (int) $a_status;
114 return (
bool) $this->status;
118 $this->check = (int) $a_status;
122 return (
bool) $this->check;
127 $this->c_date = $a_date;
131 return $this->c_date;
136 $this->m_date = $a_date;
140 return $this->m_date;
144 $this->last_check = $a_date;
148 return $this->last_check;
152 $this->valid = (int) $a_status;
168 include_once
'Modules/WebResource/classes/class.ilParameterAppender.php';
174 $new_item->setTitle($item[
'title']);
175 $new_item->setDescription($item[
'description']);
176 $new_item->setTarget($item[
'target']);
177 $new_item->setActiveStatus($item[
'active']);
178 $new_item->setDisableCheckStatus($item[
'disable_check']);
179 $new_item->setLastCheckDate($item[
'last_check']);
180 $new_item->setValidStatus($item[
'valid']);
181 $new_item->add(
true);
186 $appender->setName(
$data[
'name']);
187 $appender->setValue(
$data[
'value']);
188 $appender->add($new_item->getLinkId());
196 function delete($a_item_id,$a_update_history =
true)
200 $item = $this->
getItem($a_item_id);
202 $query =
"DELETE FROM webr_items ".
204 "AND link_id = ".$ilDB->quote($a_item_id ,
'integer');
207 if($a_update_history)
209 include_once(
"./Services/History/classes/class.ilHistory.php");
217 function update($a_update_history =
true)
227 $query =
"UPDATE webr_items ".
228 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
229 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
230 "target = ".$ilDB->quote($this->
getTarget() ,
'text').
", ".
236 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer').
" ".
240 if($a_update_history)
242 include_once(
"./Services/History/classes/class.ilHistory.php");
254 $query =
"UPDATE webr_items ".
255 "SET valid = ".$ilDB->quote($a_status ,
'integer').
" ".
256 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
266 $query =
"UPDATE webr_items ".
267 "SET active = ".$ilDB->quote($a_status ,
'integer').
" ".
268 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
278 $query =
"UPDATE webr_items ".
279 "SET disable_check = ".$ilDB->quote($a_status ,
'integer').
" ".
280 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
292 $period = $a_offset ? $a_offset : 0;
293 $time = time() - $period;
296 $query =
"UPDATE webr_items ".
297 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
299 "AND disable_check = '0' ".
300 "AND last_check < ".$ilDB->quote($time ,
'integer');
305 $query =
"UPDATE webr_items ".
306 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
308 "AND disable_check = '0' ";
320 $period = $a_offset ? $a_offset : 0;
321 $time = time() - $period;
324 $query =
"UPDATE webr_items ".
326 "WHERE disable_check = '0' ".
328 "AND last_check < ".$ilDB->quote($time ,
'integer');
333 $query =
"UPDATE webr_items ".
335 "WHERE disable_check = '0' ".
343 function add($a_update_history =
true)
350 $next_id = $ilDB->nextId(
'webr_items');
351 $query =
"INSERT INTO webr_items (link_id,title,description,target,active,disable_check,".
352 "last_update,create_date,webr_id,valid) ".
354 $ilDB->quote($next_id ,
'integer').
", ".
355 $ilDB->quote($this->
getTitle() ,
'text').
", ".
357 $ilDB->quote($this->
getTarget() ,
'text').
", ".
370 if($a_update_history)
372 include_once(
"./Services/History/classes/class.ilHistory.php");
383 $query =
"SELECT * FROM webr_items ".
384 "WHERE link_id = ".$ilDB->quote($a_link_id ,
'integer');
408 $query =
"SELECT * FROM webr_items ".
410 "AND link_id = ".$ilDB->quote($a_link_id ,
'integer');
415 $item[
'title'] =
$row->title;
416 $item[
'description'] =
$row->description;
417 $item[
'target'] =
$row->target;
418 $item[
'active'] = (bool)
$row->active;
419 $item[
'disable_check'] =
$row->disable_check;
420 $item[
'create_date'] =
$row->create_date;
421 $item[
'last_update'] =
$row->last_update;
422 $item[
'last_check'] =
$row->last_check;
423 $item[
'valid'] =
$row->valid;
424 $item[
'link_id'] =
$row->link_id;
426 return $item ? $item : array();
438 $query =
"SELECT link_id FROM webr_items ".
439 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer');
443 $link_ids[] =
$row[
'link_id'];
445 return (array) $link_ids;
452 $query =
"SELECT * FROM webr_items ".
458 $items[
$row->link_id][
'title'] =
$row->title;
459 $items[
$row->link_id][
'description'] =
$row->description;
460 $items[
$row->link_id][
'target'] =
$row->target;
461 $items[
$row->link_id][
'active'] = (bool)
$row->active;
462 $items[
$row->link_id][
'disable_check'] =
$row->disable_check;
463 $items[
$row->link_id][
'create_date'] =
$row->create_date;
464 $items[
$row->link_id][
'last_update'] =
$row->last_update;
465 $items[
$row->link_id][
'last_check'] =
$row->last_check;
466 $items[
$row->link_id][
'valid'] =
$row->valid;
467 $items[
$row->link_id][
'link_id'] =
$row->link_id;
469 return $items ? $items : array();
479 include_once
'./Services/Container/classes/class.ilContainer.php';
480 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
492 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
494 foreach($a_items as $link_id => $item)
496 if(isset($pos[$link_id]))
498 $sorted[$link_id] = $item;
499 $sorted[$link_id][
'position'] = $pos[$link_id];
503 $unsorted[$link_id] = $item;
508 $a_items = (array) $sorted + (array) $unsorted;
520 if($item_data[
'active'])
522 $active_items[$id] = $item_data;
525 return $active_items ? $active_items : array();
530 $period = $a_offset ? $a_offset : 0;
531 $time = time() - $period;
535 if(!$item_data[
'disable_check'])
537 if(!$item_data[
'last_check'] or $item_data[
'last_check'] < $time)
539 $check_items[$id] = $item_data;
543 return $check_items ? $check_items : array();
553 $ilDB->manipulate(
"DELETE FROM webr_items WHERE webr_id = ".$ilDB->quote($webr_id ,
'integer'));
570 $query =
"SELECT * FROM webr_items ".
571 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
' '.
572 "AND active = ".$ilDB->quote(1,
'integer').
' ';
574 return $res->numRows() == 1 ?
true :
false;
586 $query =
"SELECT COUNT(*) num FROM webr_items ".
587 "WHERE webr_id = ".$ilDB->quote($a_webr_id,
'integer');
605 include_once(
"./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
633 'id' => $link[
'link_id'],
634 'active' => $link[
'active'] ? 1 : 0,
635 'valid' => $link[
'valid'] ? 1 : 0,
636 'disableValidation' => $link[
'disable_check'] ? 1 : 0,
637 #
'action' =>
'Delete'
640 $writer->
xmlElement(
'Title',array(),$link[
'title']);
641 $writer->
xmlElement(
'Description',array(),$link[
'description']);
642 $writer->
xmlElement(
'Target',array(),$link[
'target']);
645 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
649 switch($param[
'value'])
660 $value =
'matriculation';
674 'name' => $param[
'name'],