24 include_once
"./classes/class.ilObjectGUI.php";
44 $this->webr_ref_id = 0;
45 $this->webr_id = $webr_id;
55 $query =
"SELECT * FROM webr_items ".
56 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
" ".
57 "AND link_id = ".$ilDB->quote($a_link_id ,
'integer');
62 $item[
'title'] =
$row->title;
63 $item[
'description'] =
$row->description;
64 $item[
'target'] =
$row->target;
65 $item[
'active'] = (bool)
$row->active;
66 $item[
'disable_check'] =
$row->disable_check;
67 $item[
'create_date'] =
$row->create_date;
68 $item[
'last_update'] =
$row->last_update;
69 $item[
'last_check'] =
$row->last_check;
70 $item[
'valid'] =
$row->valid;
71 $item[
'link_id'] =
$row->link_id;
73 return $item ? $item : array();
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;
125 return $this->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;
187 include_once
'Modules/WebResource/classes/class.ilParameterAppender.php';
193 $new_item->setTitle($item[
'title']);
194 $new_item->setDescription($item[
'description']);
195 $new_item->setTarget($item[
'target']);
196 $new_item->setActiveStatus($item[
'active']);
197 $new_item->setDisableCheckStatus($item[
'disable_check']);
198 $new_item->setLastCheckDate($item[
'last_check']);
199 $new_item->setValidStatus($item[
'valid']);
200 $new_item->add(
true);
205 $appender->setName(
$data[
'name']);
206 $appender->setValue(
$data[
'value']);
207 $appender->add($new_item->getLinkId());
215 function delete($a_item_id,$a_update_history =
true)
219 $item = $this->
getItem($a_item_id);
221 $query =
"DELETE FROM webr_items ".
223 "AND link_id = ".$ilDB->quote($a_item_id ,
'integer');
226 if($a_update_history)
228 include_once(
"classes/class.ilHistory.php");
236 function update($a_update_history =
true)
246 $query =
"UPDATE webr_items ".
247 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
248 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
249 "target = ".$ilDB->quote($this->
getTarget() ,
'text').
", ".
255 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer').
" ".
259 if($a_update_history)
261 include_once(
"classes/class.ilHistory.php");
273 $query =
"UPDATE webr_items ".
274 "SET valid = ".$ilDB->quote($a_status ,
'integer').
" ".
275 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
285 $query =
"UPDATE webr_items ".
286 "SET active = ".$ilDB->quote($a_status ,
'integer').
" ".
287 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
297 $query =
"UPDATE webr_items ".
298 "SET disable_check = ".$ilDB->quote($a_status ,
'integer').
" ".
299 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
311 $period = $a_offset ? $a_offset : 0;
312 $time = time() - $period;
315 $query =
"UPDATE webr_items ".
316 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
318 "AND disable_check = '0' ".
319 "AND last_check < ".$ilDB->quote($time ,
'integer');
324 $query =
"UPDATE webr_items ".
325 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
327 "AND disable_check = '0' ";
339 $period = $a_offset ? $a_offset : 0;
340 $time = time() - $period;
343 $query =
"UPDATE webr_items ".
345 "WHERE disable_check = '0' ".
347 "AND last_check < ".$ilDB->quote($time ,
'integer');
352 $query =
"UPDATE webr_items ".
354 "WHERE disable_check = '0' ".
362 function add($a_update_history =
true)
369 $next_id = $ilDB->nextId(
'webr_items');
370 $query =
"INSERT INTO webr_items (link_id,title,description,target,active,disable_check,".
371 "last_update,create_date,webr_id) ".
373 $ilDB->quote($next_id ,
'integer').
", ".
374 $ilDB->quote($this->
getTitle() ,
'text').
", ".
376 $ilDB->quote($this->
getTarget() ,
'text').
", ".
388 if($a_update_history)
390 include_once(
"classes/class.ilHistory.php");
401 $query =
"SELECT * FROM webr_items ".
402 "WHERE link_id = ".$ilDB->quote($a_link_id ,
'integer');
426 $query =
"SELECT * FROM webr_items ".
428 "AND link_id = ".$ilDB->quote($a_link_id ,
'integer');
433 $item[
'title'] =
$row->title;
434 $item[
'description'] =
$row->description;
435 $item[
'target'] =
$row->target;
436 $item[
'active'] = (bool)
$row->active;
437 $item[
'disable_check'] =
$row->disable_check;
438 $item[
'create_date'] =
$row->create_date;
439 $item[
'last_update'] =
$row->last_update;
440 $item[
'last_check'] =
$row->last_check;
441 $item[
'valid'] =
$row->valid;
442 $item[
'link_id'] =
$row->link_id;
444 return $item ? $item : array();
456 $query =
"SELECT link_id FROM webr_items ".
457 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer');
461 $link_ids[] =
$row[
'link_id'];
463 return (array) $link_ids;
470 $query =
"SELECT * FROM webr_items ".
476 $items[
$row->link_id][
'title'] =
$row->title;
477 $items[
$row->link_id][
'description'] =
$row->description;
478 $items[
$row->link_id][
'target'] =
$row->target;
479 $items[
$row->link_id][
'active'] = (bool)
$row->active;
480 $items[
$row->link_id][
'disable_check'] =
$row->disable_check;
481 $items[
$row->link_id][
'create_date'] =
$row->create_date;
482 $items[
$row->link_id][
'last_update'] =
$row->last_update;
483 $items[
$row->link_id][
'last_check'] =
$row->last_check;
484 $items[
$row->link_id][
'valid'] =
$row->valid;
485 $items[
$row->link_id][
'link_id'] =
$row->link_id;
487 return $items ? $items : array();
497 include_once
'./Services/Container/classes/class.ilContainer.php';
498 include_once
'./Services/Container/classes/class.ilContainerSortingSettings.php';
510 include_once
'./Services/Container/classes/class.ilContainerSorting.php';
512 foreach($a_items as $link_id => $item)
514 if(isset($pos[$link_id]))
516 $sorted[$link_id] = $item;
517 $sorted[$link_id][
'position'] = $pos[$link_id];
521 $unsorted[$link_id] = $item;
526 $a_items = (array) $sorted + (array) $unsorted;
538 if($item_data[
'active'])
540 $active_items[$id] = $item_data;
543 return $active_items ? $active_items : array();
548 $period = $a_offset ? $a_offset : 0;
549 $time = time() - $period;
553 if(!$item_data[
'disable_check'])
555 if(!$item_data[
'last_check'] or $item_data[
'last_check'] < $time)
557 $check_items[$id] = $item_data;
561 return $check_items ? $check_items : array();
571 $ilDB->manipulate(
"DELETE FROM webr_items WHERE webr_id = ".$ilDB->quote($webr_id ,
'integer'));
588 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
" AND active = '1'");
590 return $res->numRows() == 1 ?
true :
false;
602 $query =
"SELECT COUNT(*) num FROM webr_items ".
603 "WHERE webr_id = ".$ilDB->quote($a_webr_id,
'integer');
621 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".
622 $ilDB->quote($a_webr_id ,
'integer').
" AND active = '1'");
625 $item[
'title'] =
$row->title;
626 $item[
'description'] =
$row->description;
627 $item[
'target'] =
$row->target;
628 $item[
'active'] = (bool)
$row->active;
629 $item[
'disable_check'] =
$row->disable_check;
630 $item[
'create_date'] =
$row->create_date;
631 $item[
'last_update'] =
$row->last_update;
632 $item[
'last_check'] =
$row->last_check;
633 $item[
'valid'] =
$row->valid;
634 $item[
'link_id'] =
$row->link_id;
636 return $item ? $item : array();
663 'id' => $link[
'link_id'],
664 'active' => $link[
'active'] ? 1 : 0,
665 'valid' => $link[
'valid'] ? 1 : 0,
666 'disableValidation' => $link[
'disable_check'] ? 1 : 0,
667 #
'action' =>
'Delete'
670 $writer->
xmlElement(
'Title',array(),$link[
'title']);
671 $writer->
xmlElement(
'Description',array(),$link[
'description']);
672 $writer->
xmlElement(
'Target',array(),$link[
'target']);
675 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
679 switch($param[
'value'])
690 $value =
'matriculation';
704 'name' => $param[
'name'],