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();
68 $query =
'UPDATE webr_items SET '.
69 'title = '.$ilDB->quote($a_title,
'text').
' '.
70 'WHERE link_id = '.$ilDB->quote($a_link_id,
'integer');
80 $this->webr_ref_id = $a_ref_id;
84 return $this->webr_ref_id;
88 $this->webr_id = $a_id;
92 return $this->webr_id;
104 $this->title = $a_title;
112 $this->description = $a_description;
116 return $this->description;
120 $this->target = $a_target;
124 return $this->target;
128 $this->status = (int) $a_status;
132 return (
bool) $this->status;
136 $this->check = (int) $a_status;
140 return (
bool) $this->check;
145 $this->c_date = $a_date;
149 return $this->c_date;
154 $this->m_date = $a_date;
158 return $this->m_date;
162 $this->last_check = $a_date;
166 return $this->last_check;
170 $this->valid = (int) $a_status;
186 include_once
'Modules/WebResource/classes/class.ilParameterAppender.php';
192 $new_item->setTitle($item[
'title']);
193 $new_item->setDescription($item[
'description']);
194 $new_item->setTarget($item[
'target']);
195 $new_item->setActiveStatus($item[
'active']);
196 $new_item->setDisableCheckStatus($item[
'disable_check']);
197 $new_item->setLastCheckDate($item[
'last_check']);
198 $new_item->setValidStatus($item[
'valid']);
199 $new_item->add(
true);
204 $appender->setName($data[
'name']);
205 $appender->setValue($data[
'value']);
206 $appender->add($new_item->getLinkId());
214 function delete($a_item_id,$a_update_history =
true)
218 $item = $this->
getItem($a_item_id);
220 $query =
"DELETE FROM webr_items ".
222 "AND link_id = ".$ilDB->quote($a_item_id ,
'integer');
225 if($a_update_history)
227 include_once(
"./Services/History/classes/class.ilHistory.php");
235 function update($a_update_history =
true)
245 $query =
"UPDATE webr_items ".
246 "SET title = ".$ilDB->quote($this->
getTitle() ,
'text').
", ".
247 "description = ".$ilDB->quote($this->
getDescription() ,
'text').
", ".
248 "target = ".$ilDB->quote($this->
getTarget() ,
'text').
", ".
254 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer').
" ".
258 if($a_update_history)
260 include_once(
"./Services/History/classes/class.ilHistory.php");
272 $query =
"UPDATE webr_items ".
273 "SET valid = ".$ilDB->quote($a_status ,
'integer').
" ".
274 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
284 $query =
"UPDATE webr_items ".
285 "SET active = ".$ilDB->quote($a_status ,
'integer').
" ".
286 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
296 $query =
"UPDATE webr_items ".
297 "SET disable_check = ".$ilDB->quote($a_status ,
'integer').
" ".
298 "WHERE link_id = ".$ilDB->quote($this->
getLinkId() ,
'integer');
310 $period = $a_offset ? $a_offset : 0;
311 $time = time() - $period;
314 $query =
"UPDATE webr_items ".
315 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
317 "AND disable_check = '0' ".
318 "AND last_check < ".$ilDB->quote($time ,
'integer');
323 $query =
"UPDATE webr_items ".
324 "SET last_check = ".$ilDB->quote(time() ,
'integer').
" ".
326 "AND disable_check = '0' ";
338 $period = $a_offset ? $a_offset : 0;
339 $time = time() - $period;
342 $query =
"UPDATE webr_items ".
344 "WHERE disable_check = '0' ".
346 "AND last_check < ".$ilDB->quote($time ,
'integer');
351 $query =
"UPDATE webr_items ".
353 "WHERE disable_check = '0' ".
361 function add($a_update_history =
true)
368 $next_id = $ilDB->nextId(
'webr_items');
369 $query =
"INSERT INTO webr_items (link_id,title,description,target,active,disable_check,".
370 "last_update,create_date,webr_id,valid) ".
372 $ilDB->quote($next_id ,
'integer').
", ".
373 $ilDB->quote($this->
getTitle() ,
'text').
", ".
375 $ilDB->quote($this->
getTarget() ,
'text').
", ".
388 if($a_update_history)
390 include_once(
"./Services/History/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 $query =
"SELECT * FROM webr_items ".
589 "WHERE webr_id = ".$ilDB->quote($a_webr_id ,
'integer').
' '.
590 "AND active = ".$ilDB->quote(1,
'integer').
' ';
592 return $res->numRows() == 1 ?
true :
false;
604 $query =
"SELECT COUNT(*) num FROM webr_items ".
605 "WHERE webr_id = ".$ilDB->quote($a_webr_id,
'integer');
623 include_once(
"./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
651 'id' => $link[
'link_id'],
652 'active' => $link[
'active'] ? 1 : 0,
653 'valid' => $link[
'valid'] ? 1 : 0,
654 'disableValidation' => $link[
'disable_check'] ? 1 : 0,
655 #
'action' =>
'Delete'
658 $writer->
xmlElement(
'Title',array(),$link[
'title']);
659 $writer->
xmlElement(
'Description',array(),$link[
'description']);
660 $writer->
xmlElement(
'Target',array(),$link[
'target']);
663 include_once
'./Modules/WebResource/classes/class.ilParameterAppender.php';
667 switch($param[
'value'])
678 $value =
'matriculation';
692 'name' => $param[
'name'],