24 include_once
"./classes/class.ilObjectGUI.php";
44 $this->webr_ref_id = 0;
45 $this->webr_id = $webr_id;
53 $this->webr_ref_id = $a_ref_id;
57 return $this->webr_ref_id;
61 $this->webr_id = $a_id;
65 return $this->webr_id;
77 $this->title = $a_title;
85 $this->description = $a_description;
89 return $this->description;
93 $this->target = $a_target;
101 $this->status = (int) $a_status;
105 return (
bool) $this->status;
109 $this->check = (int) $a_status;
113 return (
bool) $this->check;
118 $this->c_date = $a_date;
122 return $this->c_date;
127 $this->m_date = $a_date;
131 return $this->m_date;
135 $this->last_check = $a_date;
139 return $this->last_check;
143 $this->valid = (int) $a_status;
159 include_once
'Modules/WebResource/classes/class.ilParameterAppender.php';
165 $new_item->setTitle($item[
'title']);
166 $new_item->setDescription($item[
'description']);
167 $new_item->setTarget($item[
'target']);
168 $new_item->setActiveStatus($item[
'active']);
169 $new_item->setDisableCheckStatus($item[
'disable_check']);
170 $new_item->setLastCheckDate($item[
'last_check']);
171 $new_item->setValidStatus($item[
'valid']);
172 $new_item->add(
true);
177 $appender->setName(
$data[
'name']);
178 $appender->setValue(
$data[
'value']);
179 $appender->add($new_item->getLinkId());
187 function delete($a_item_id,$a_update_history =
true)
191 $query =
"DELETE FROM webr_items ".
193 "AND link_id = ".$ilDB->quote($a_item_id);
195 $this->db->query($query);
197 if($a_update_history)
199 include_once(
"classes/class.ilHistory.php");
207 function update($a_update_history =
true)
217 $query =
"UPDATE webr_items ".
218 "SET title = ".$ilDB->quote($this->
getTitle()).
", ".
220 "target = ".$ilDB->quote($this->
getTarget()).
", ".
226 "WHERE link_id = ".$ilDB->quote($this->
getLinkId()).
" ".
229 $this->db->query($query);
231 if($a_update_history)
233 include_once(
"classes/class.ilHistory.php");
245 $query =
"UPDATE webr_items ".
246 "SET valid = ".$ilDB->quote($a_status).
" ".
247 "WHERE link_id = ".$ilDB->quote($this->
getLinkId());
249 $this->db->query($query);
258 $query =
"UPDATE webr_items ".
259 "SET active = ".$ilDB->quote($a_status).
" ".
260 "WHERE link_id = ".$ilDB->quote($this->
getLinkId());
262 $this->db->query($query);
270 $query =
"UPDATE webr_items ".
271 "SET disable_check = ".$ilDB->quote($a_status).
" ".
272 "WHERE link_id = ".$ilDB->quote($this->
getLinkId());
274 $this->db->query($query);
285 $period = $a_offset ? $a_offset : 0;
286 $time = time() - $period;
289 $query =
"UPDATE webr_items ".
290 "SET last_check = ".$ilDB->quote(time()).
" ".
292 "AND disable_check = '0' ".
293 "AND last_check < ".$ilDB->quote($time);
295 $this->db->query($query);
299 $query =
"UPDATE webr_items ".
300 "SET last_check = ".$ilDB->quote(time()).
" ".
302 "AND disable_check = '0' ";
304 $this->db->query($query);
315 $period = $a_offset ? $a_offset : 0;
316 $time = time() - $period;
319 $query =
"UPDATE webr_items ".
321 "WHERE disable_check = '0' ".
323 "AND last_check < ".$ilDB->quote($time);
325 $this->db->query($query);
329 $query =
"UPDATE webr_items ".
331 "WHERE disable_check = '0' ".
334 $this->db->query($query);
340 function add($a_update_history =
true)
347 $query =
"INSERT INTO webr_items ".
348 "SET title = ".$ilDB->quote($this->
getTitle()).
", ".
350 "target = ".$ilDB->quote($this->
getTarget()).
", ".
357 $this->db->query($query);
359 $link_id = $this->db->getLastInsertId();
362 if($a_update_history)
364 include_once(
"classes/class.ilHistory.php");
375 $query =
"SELECT * FROM webr_items ".
376 "WHERE link_id = ".$ilDB->quote($a_link_id);
378 $res = $this->db->query($query);
400 $query =
"SELECT * FROM webr_items ".
402 "AND link_id = ".$ilDB->quote($a_link_id);
404 $res = $this->db->query($query);
407 $item[
'title'] = $row->title;
408 $item[
'description'] = $row->description;
409 $item[
'target'] = $row->target;
410 $item[
'active'] = (bool) $row->active;
411 $item[
'disable_check'] = $row->disable_check;
412 $item[
'create_date'] = $row->create_date;
413 $item[
'last_update'] = $row->last_update;
414 $item[
'last_check'] = $row->last_check;
415 $item[
'valid'] = $row->valid;
416 $item[
'link_id'] = $row->link_id;
418 return $item ? $item : array();
426 $query =
"SELECT * FROM webr_items ".
429 $res = $this->db->query($query);
432 $items[$row->link_id][
'title'] = $row->title;
433 $items[$row->link_id][
'description'] = $row->description;
434 $items[$row->link_id][
'target'] = $row->target;
435 $items[$row->link_id][
'active'] = (bool) $row->active;
436 $items[$row->link_id][
'disable_check'] = $row->disable_check;
437 $items[$row->link_id][
'create_date'] = $row->create_date;
438 $items[$row->link_id][
'last_update'] = $row->last_update;
439 $items[$row->link_id][
'last_check'] = $row->last_check;
440 $items[$row->link_id][
'valid'] = $row->valid;
441 $items[$row->link_id][
'link_id'] = $row->link_id;
443 return $items ? $items : array();
450 if($item_data[
'active'])
452 $active_items[$id] = $item_data;
455 return $active_items ? $active_items : array();
460 $period = $a_offset ? $a_offset : 0;
461 $time = time() - $period;
465 if(!$item_data[
'disable_check'])
467 if(!$item_data[
'last_check'] or $item_data[
'last_check'] < $time)
469 $check_items[$id] = $item_data;
473 return $check_items ? $check_items : array();
483 $ilDB->query(
"DELETE FROM webr_items WHERE webr_id = ".$ilDB->quote($webr_id));
500 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".$ilDB->quote($a_webr_id).
" AND active = '1'");
502 return $res->numRows() == 1 ?
true :
false;
517 $res = $ilDB->query(
"SELECT * FROM webr_items WHERE webr_id = ".
518 $ilDB->quote($a_webr_id).
" AND active = '1'");
521 $item[
'title'] = $row->title;
522 $item[
'description'] = $row->description;
523 $item[
'target'] = $row->target;
524 $item[
'active'] = (bool) $row->active;
525 $item[
'disable_check'] = $row->disable_check;
526 $item[
'create_date'] = $row->create_date;
527 $item[
'last_update'] = $row->last_update;
528 $item[
'last_check'] = $row->last_check;
529 $item[
'valid'] = $row->valid;
530 $item[
'link_id'] = $row->link_id;
532 return $item ? $item : array();