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();
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 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
" AND active = '1'");
572 return $res->numRows() == 1 ?
true :
false;
584 $query =
"SELECT COUNT(*) num FROM webr_items ".
585 "WHERE webr_id = ".$ilDB->quote($a_webr_id,
'integer');
603 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".
604 $ilDB->quote($a_webr_id ,
'integer').
" AND active = '1'");
607 $item[
'title'] =
$row->title;
608 $item[
'description'] =
$row->description;
609 $item[
'target'] =
$row->target;
610 $item[
'active'] = (bool)
$row->active;
611 $item[
'disable_check'] =
$row->disable_check;
612 $item[
'create_date'] =
$row->create_date;
613 $item[
'last_update'] =
$row->last_update;
614 $item[
'last_check'] =
$row->last_check;
615 $item[
'valid'] =
$row->valid;
616 $item[
'link_id'] =
$row->link_id;
618 return $item ? $item : array();