ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLinkResourceItems Class Reference

Class ilLinkResourceItems. More...

+ Collaboration diagram for ilLinkResourceItems:

Public Member Functions

 __construct ($webr_id)
 Constructor @access public. More...
 
 setLinkResourceRefId ($a_ref_id)
 
 getLinkResourceRefId ()
 
 setLinkResourceId ($a_id)
 
 getLinkResourceId ()
 
 setLinkId ($a_id)
 
 getLinkId ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setTarget ($a_target)
 
 getTarget ()
 
 setActiveStatus ($a_status)
 
 getActiveStatus ()
 
 setDisableCheckStatus ($a_status)
 
 getDisableCheckStatus ()
 
 __setCreateDate ($a_date)
 
 getCreateDate ()
 
 __setLastUpdateDate ($a_date)
 
 getLastUpdateDate ()
 
 setLastCheckDate ($a_date)
 
 getLastCheckDate ()
 
 setValidStatus ($a_status)
 
 getValidStatus ()
 
 setInternal ($a_status)
 
 getInternal ()
 
 cloneItems ($a_new_id)
 Copy web resource items. More...
 
 delete ($a_item_id, $a_update_history=true)
 
 update ($a_update_history=true)
 
 updateValid ($a_status)
 
 updateActive ($a_status)
 
 updateDisableCheck ($a_status)
 
 updateLastCheck ($a_offset=0)
 
 updateValidByCheck ($a_offset=0)
 
 add ($a_update_history=true)
 
 readItem ($a_link_id)
 
 getItem ($a_link_id)
 
 getAllItems ()
 
 sortItems ($a_items)
 Sort items (sorting mode depends on sorting setting) More...
 
 getActivatedItems ()
 
 getCheckItems ($a_offset=0)
 
 validate ()
 Validate required settings. More...
 
 toXML (ilXmlWriter $writer)
 Write link XML. More...
 

Static Public Member Functions

static lookupItem ($a_webr_id, $a_link_id)
 
static updateTitle ($a_link_id, $a_title)
 Update title. More...
 
static getAllItemIds ($a_webr_id)
 Get all link ids. More...
 
static _deleteAll ($webr_id)
 
static _isSingular ($a_webr_id)
 Check whether there is only one active link in the web resource. More...
 
static lookupNumberOfLinks ($a_webr_id)
 Get number of assigned links. More...
 
static _getFirstLink ($a_webr_id)
 Get first link item Check before with _isSingular() if there is more or less than one. More...
 

Detailed Description

Class ilLinkResourceItems.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 15 of file class.ilLinkResourceItems.php.

Constructor & Destructor Documentation

◆ __construct()

ilLinkResourceItems::__construct (   $webr_id)

Constructor @access public.

Definition at line 21 of file class.ilLinkResourceItems.php.

22 {
23 global $DIC;
24
25 $ilDB = $DIC['ilDB'];
26
27 $this->webr_ref_id = 0;
28 $this->webr_id = $webr_id;
29
30 $this->db = $ilDB;
31 }
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, and $ilDB.

Member Function Documentation

◆ __setCreateDate()

ilLinkResourceItems::__setCreateDate (   $a_date)

Definition at line 148 of file class.ilLinkResourceItems.php.

149 {
150 $this->c_date = $a_date;
151 }

Referenced by add(), and readItem().

+ Here is the caller graph for this function:

◆ __setLastUpdateDate()

ilLinkResourceItems::__setLastUpdateDate (   $a_date)

Definition at line 157 of file class.ilLinkResourceItems.php.

158 {
159 $this->m_date = $a_date;
160 }

Referenced by add(), readItem(), and update().

+ Here is the caller graph for this function:

◆ _deleteAll()

static ilLinkResourceItems::_deleteAll (   $webr_id)
static

Definition at line 592 of file class.ilLinkResourceItems.php.

593 {
594 global $DIC;
595
596 $ilDB = $DIC['ilDB'];
597
598 $ilDB->manipulate("DELETE FROM webr_items WHERE webr_id = " . $ilDB->quote($webr_id, 'integer'));
599
600 return true;
601 }

References $DIC, and $ilDB.

Referenced by ilObjLinkResource\delete().

+ Here is the caller graph for this function:

◆ _getFirstLink()

static ilLinkResourceItems::_getFirstLink (   $a_webr_id)
static

Get first link item Check before with _isSingular() if there is more or less than one.

Parameters
int$a_webr_idobject id of web resource
Returns
array link item data

Definition at line 650 of file class.ilLinkResourceItems.php.

651 {
652 global $DIC;
653
654 $ilDB = $DIC['ilDB'];
655
656 include_once("./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
658 }
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.

References $DIC, $ilDB, and ilObjLinkResourceAccess\_getFirstLink().

Referenced by ilObjLinkResourceListGUI\__readLink(), ilObjLinkResourceGUI\callDirectLink(), ilObjLinkResource\cloneObject(), and ilObjLinkResource\MDUpdateListener().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _isSingular()

static ilLinkResourceItems::_isSingular (   $a_webr_id)
static

Check whether there is only one active link in the web resource.

In this case this link is shown in a new browser window

Parameters
int$a_webr_idobject id of web resource
Returns
boolean success status

Definition at line 611 of file class.ilLinkResourceItems.php.

612 {
613 global $DIC;
614
615 $ilDB = $DIC['ilDB'];
616
617 $query = "SELECT * FROM webr_items " .
618 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer') . ' ' .
619 "AND active = " . $ilDB->quote(1, 'integer') . ' ';
620 $res = $ilDB->query($query);
621 return $res->numRows() == 1 ? true : false;
622 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and true.

Referenced by ilObjLinkResourceAccess\_checkDirectLink(), ilObjLinkResourceGUI\callDirectLink(), and ilObjLinkResource\cloneObject().

+ Here is the caller graph for this function:

◆ add()

ilLinkResourceItems::add (   $a_update_history = true)

Definition at line 385 of file class.ilLinkResourceItems.php.

386 {
387 global $DIC;
388
389 $ilDB = $DIC['ilDB'];
390
391 $this->__setLastUpdateDate(time());
392 $this->__setCreateDate(time());
393
394 $next_id = $ilDB->nextId('webr_items');
395 $query = "INSERT INTO webr_items (link_id,title,description,target,active,disable_check," .
396 "last_update,create_date,webr_id,valid,internal) " .
397 "VALUES( " .
398 $ilDB->quote($next_id, 'integer') . ", " .
399 $ilDB->quote($this->getTitle(), 'text') . ", " .
400 $ilDB->quote($this->getDescription(), 'text') . ", " .
401 $ilDB->quote($this->getTarget(), 'text') . ", " .
402 $ilDB->quote($this->getActiveStatus(), 'integer') . ", " .
403 $ilDB->quote($this->getDisableCheckStatus(), 'integer') . ", " .
404 $ilDB->quote($this->getLastUpdateDate(), 'integer') . ", " .
405 $ilDB->quote($this->getCreateDate(), 'integer') . ", " .
406 $ilDB->quote($this->getLinkResourceId(), 'integer') . ", " .
407 $ilDB->quote($this->getValidStatus(), 'integer') . ', ' .
408 $ilDB->quote($this->getInternal(), 'integer') . ' ' .
409 ")";
410 $res = $ilDB->manipulate($query);
411
412 $link_id = $next_id;
413 $this->setLinkId($link_id);
414
415 if ($a_update_history) {
416 include_once("./Services/History/classes/class.ilHistory.php");
418 $this->getLinkResourceId(),
419 "add",
420 $this->getTitle()
421 );
422 }
423
424 return $link_id;
425 }
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.

References $DIC, $ilDB, $query, $res, __setCreateDate(), __setLastUpdateDate(), ilHistory\_createEntry(), getActiveStatus(), getCreateDate(), getDescription(), getDisableCheckStatus(), getInternal(), getLastUpdateDate(), getLinkResourceId(), getTarget(), getTitle(), getValidStatus(), and setLinkId().

+ Here is the call graph for this function:

◆ cloneItems()

ilLinkResourceItems::cloneItems (   $a_new_id)

Copy web resource items.

@access public

Parameters
intobj_id of new object

Definition at line 197 of file class.ilLinkResourceItems.php.

198 {
199 include_once 'Modules/WebResource/classes/class.ilParameterAppender.php';
200 $appender = new ilParameterAppender($this->getLinkResourceId());
201
202 foreach ($this->getAllItems() as $item) {
203 $new_item = new ilLinkResourceItems($a_new_id);
204 $new_item->setTitle($item['title']);
205 $new_item->setDescription($item['description']);
206 $new_item->setTarget($item['target']);
207 $new_item->setActiveStatus($item['active']);
208 $new_item->setDisableCheckStatus($item['disable_check']);
209 $new_item->setLastCheckDate($item['last_check']);
210 $new_item->setValidStatus($item['valid']);
211 $new_item->setInternal($item['internal']);
212 $new_item->add(true);
213
214 // Add parameters
215 foreach (ilParameterAppender::_getParams($item['link_id']) as $param_id => $data) {
216 $appender->setName($data['name']);
217 $appender->setValue($data['value']);
218 $appender->add($new_item->getLinkId());
219 }
220
221 unset($new_item);
222 }
223 return true;
224 }
Class ilLinkResourceItems.
Class ilParameterAppender.
static _getParams($a_link_id)
Get dynamic parameter definitions.
$data
Definition: storeScorm.php:23

References $data, ilParameterAppender\_getParams(), getAllItems(), and getLinkResourceId().

+ Here is the call graph for this function:

◆ delete()

ilLinkResourceItems::delete (   $a_item_id,
  $a_update_history = true 
)

Definition at line 226 of file class.ilLinkResourceItems.php.

227 {
228 global $DIC;
229
230 $ilDB = $DIC['ilDB'];
231
232 $item = $this->getItem($a_item_id);
233
234 $query = "DELETE FROM webr_items " .
235 "WHERE webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer') . " " .
236 "AND link_id = " . $ilDB->quote($a_item_id, 'integer');
237 $res = $ilDB->manipulate($query);
238
239 if ($a_update_history) {
240 include_once("./Services/History/classes/class.ilHistory.php");
242 $this->getLinkResourceId(),
243 "delete",
244 $item['title']
245 );
246 }
247
248 return true;
249 }

References $DIC, $ilDB, $query, $res, ilHistory\_createEntry(), getItem(), and getLinkResourceId().

+ Here is the call graph for this function:

◆ getActivatedItems()

ilLinkResourceItems::getActivatedItems ( )

Definition at line 564 of file class.ilLinkResourceItems.php.

565 {
566 foreach ($this->getAllItems() as $id => $item_data) {
567 if ($item_data['active']) {
568 $active_items[$id] = $item_data;
569 }
570 }
571 return $active_items ? $active_items : array();
572 }

References getAllItems().

+ Here is the call graph for this function:

◆ getActiveStatus()

ilLinkResourceItems::getActiveStatus ( )

Definition at line 135 of file class.ilLinkResourceItems.php.

136 {
137 return (bool) $this->status;
138 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getAllItemIds()

static ilLinkResourceItems::getAllItemIds (   $a_webr_id)
static

Get all link ids.

Parameters
int$a_webr_id
Returns

Definition at line 485 of file class.ilLinkResourceItems.php.

486 {
487 global $DIC;
488
489 $ilDB = $DIC['ilDB'];
490
491 $query = "SELECT link_id FROM webr_items " .
492 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer');
493 $res = $ilDB->query($query);
494 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
495 $link_ids[] = $row['link_id'];
496 }
497 return (array) $link_ids;
498 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_ASSOC.

◆ getAllItems()

ilLinkResourceItems::getAllItems ( )

Definition at line 500 of file class.ilLinkResourceItems.php.

501 {
502 global $DIC;
503
504 $ilDB = $DIC['ilDB'];
505
506 $query = "SELECT * FROM webr_items " .
507 "WHERE webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer');
508
509 $res = $this->db->query($query);
510 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
511 $items[$row->link_id]['title'] = $row->title;
512 $items[$row->link_id]['description'] = $row->description;
513 $items[$row->link_id]['target'] = $row->target;
514 $items[$row->link_id]['active'] = (bool) $row->active;
515 $items[$row->link_id]['disable_check'] = $row->disable_check;
516 $items[$row->link_id]['create_date'] = $row->create_date;
517 $items[$row->link_id]['last_update'] = $row->last_update;
518 $items[$row->link_id]['last_check'] = $row->last_check;
519 $items[$row->link_id]['valid'] = $row->valid;
520 $items[$row->link_id]['link_id'] = $row->link_id;
521 $items[$row->link_id]['internal'] = $row->internal;
522 }
523 return $items ? $items : array();
524 }

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and getLinkResourceId().

Referenced by cloneItems(), getActivatedItems(), getCheckItems(), and toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCheckItems()

ilLinkResourceItems::getCheckItems (   $a_offset = 0)

Definition at line 574 of file class.ilLinkResourceItems.php.

575 {
576 $period = $a_offset ? $a_offset : 0;
577 $time = time() - $period;
578
579 foreach ($this->getAllItems() as $id => $item_data) {
580 if (!$item_data['disable_check']) {
581 if (!$item_data['last_check'] or $item_data['last_check'] < $time) {
582 $check_items[$id] = $item_data;
583 }
584 }
585 }
586 return $check_items ? $check_items : array();
587 }

References getAllItems().

+ Here is the call graph for this function:

◆ getCreateDate()

ilLinkResourceItems::getCreateDate ( )

Definition at line 152 of file class.ilLinkResourceItems.php.

153 {
154 return $this->c_date;
155 }

Referenced by add().

+ Here is the caller graph for this function:

◆ getDescription()

ilLinkResourceItems::getDescription ( )

Definition at line 119 of file class.ilLinkResourceItems.php.

120 {
121 return $this->description;
122 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getDisableCheckStatus()

ilLinkResourceItems::getDisableCheckStatus ( )

Definition at line 143 of file class.ilLinkResourceItems.php.

144 {
145 return (bool) $this->check;
146 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getInternal()

ilLinkResourceItems::getInternal ( )

Definition at line 185 of file class.ilLinkResourceItems.php.

186 {
187 return (bool) $this->internal;
188 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getItem()

ilLinkResourceItems::getItem (   $a_link_id)

Definition at line 453 of file class.ilLinkResourceItems.php.

454 {
455 global $DIC;
456
457 $ilDB = $DIC['ilDB'];
458
459 $query = "SELECT * FROM webr_items " .
460 "WHERE webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer') . " " .
461 "AND link_id = " . $ilDB->quote($a_link_id, 'integer');
462
463 $res = $this->db->query($query);
464 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
465 $item['title'] = $row->title;
466 $item['description'] = $row->description;
467 $item['target'] = $row->target;
468 $item['active'] = (bool) $row->active;
469 $item['disable_check'] = $row->disable_check;
470 $item['create_date'] = $row->create_date;
471 $item['last_update'] = $row->last_update;
472 $item['last_check'] = $row->last_check;
473 $item['valid'] = $row->valid;
474 $item['link_id'] = $row->link_id;
475 $item['internal'] = $row->internal;
476 }
477 return $item ? $item : array();
478 }

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and getLinkResourceId().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastCheckDate()

ilLinkResourceItems::getLastCheckDate ( )

Definition at line 169 of file class.ilLinkResourceItems.php.

170 {
171 return $this->last_check;
172 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getLastUpdateDate()

ilLinkResourceItems::getLastUpdateDate ( )

Definition at line 161 of file class.ilLinkResourceItems.php.

162 {
163 return $this->m_date;
164 }

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ getLinkId()

ilLinkResourceItems::getLinkId ( )

Definition at line 103 of file class.ilLinkResourceItems.php.

104 {
105 return $this->id;
106 }

Referenced by update(), updateActive(), updateDisableCheck(), and updateValid().

+ Here is the caller graph for this function:

◆ getLinkResourceId()

ilLinkResourceItems::getLinkResourceId ( )

Definition at line 95 of file class.ilLinkResourceItems.php.

96 {
97 return $this->webr_id;
98 }

Referenced by add(), cloneItems(), delete(), getAllItems(), getItem(), sortItems(), toXML(), update(), updateLastCheck(), and updateValidByCheck().

+ Here is the caller graph for this function:

◆ getLinkResourceRefId()

ilLinkResourceItems::getLinkResourceRefId ( )

Definition at line 87 of file class.ilLinkResourceItems.php.

88 {
89 return $this->webr_ref_id;
90 }

◆ getTarget()

ilLinkResourceItems::getTarget ( )

Definition at line 127 of file class.ilLinkResourceItems.php.

128 {
129 return $this->target;
130 }

Referenced by add(), update(), and validate().

+ Here is the caller graph for this function:

◆ getTitle()

ilLinkResourceItems::getTitle ( )

Definition at line 111 of file class.ilLinkResourceItems.php.

112 {
113 return $this->title;
114 }

Referenced by add(), update(), and validate().

+ Here is the caller graph for this function:

◆ getValidStatus()

ilLinkResourceItems::getValidStatus ( )

Definition at line 177 of file class.ilLinkResourceItems.php.

178 {
179 return (bool) $this->valid;
180 }
$valid

References $valid.

Referenced by add(), and update().

+ Here is the caller graph for this function:

◆ lookupItem()

static ilLinkResourceItems::lookupItem (   $a_webr_id,
  $a_link_id 
)
static

Definition at line 34 of file class.ilLinkResourceItems.php.

35 {
36 global $DIC;
37
38 $ilDB = $DIC['ilDB'];
39
40 $query = "SELECT * FROM webr_items " .
41 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer') . " " .
42 "AND link_id = " . $ilDB->quote($a_link_id, 'integer');
43
44 $res = $ilDB->query($query);
45 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
46 $item['title'] = $row->title;
47 $item['description'] = $row->description;
48 $item['target'] = $row->target;
49 $item['active'] = (bool) $row->active;
50 $item['disable_check'] = $row->disable_check;
51 $item['create_date'] = $row->create_date;
52 $item['last_update'] = $row->last_update;
53 $item['last_check'] = $row->last_check;
54 $item['valid'] = $row->valid;
55 $item['link_id'] = $row->link_id;
56 $item['internal'] = $row->internal;
57 }
58 return $item ? $item : array();
59 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjLinkResourceSubItemListGUI\getHTML(), toXML(), and ilObjLinkResourceGUI\updateLinks().

+ Here is the caller graph for this function:

◆ lookupNumberOfLinks()

static ilLinkResourceItems::lookupNumberOfLinks (   $a_webr_id)
static

Get number of assigned links.

Parameters
int$a_webr_id
Returns

Definition at line 629 of file class.ilLinkResourceItems.php.

630 {
631 global $DIC;
632
633 $ilDB = $DIC['ilDB'];
634
635 $query = "SELECT COUNT(*) num FROM webr_items " .
636 "WHERE webr_id = " . $ilDB->quote($a_webr_id, 'integer');
637 $res = $ilDB->query($query);
638 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
639 return $row->num;
640 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilObjLinkResourceGUI\activateTabs(), and ilObjLinkResource\MDUpdateListener().

+ Here is the caller graph for this function:

◆ readItem()

ilLinkResourceItems::readItem (   $a_link_id)

Definition at line 426 of file class.ilLinkResourceItems.php.

427 {
428 global $DIC;
429
430 $ilDB = $DIC['ilDB'];
431
432 $query = "SELECT * FROM webr_items " .
433 "WHERE link_id = " . $ilDB->quote($a_link_id, 'integer');
434
435 $res = $this->db->query($query);
436 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
437 $this->setTitle($row->title);
438 $this->setDescription($row->description);
439 $this->setTarget($row->target);
440 $this->setActiveStatus($row->active);
441 $this->setDisableCheckStatus($row->disable_check);
442 $this->__setCreateDate($row->create_date);
443 $this->__setLastUpdateDate($row->last_update);
444 $this->setLastCheckDate($row->last_check);
445 $this->setValidStatus($row->valid);
446 $this->setLinkId($row->link_id);
447 $this->setInternal($row->internal);
448 }
449 return true;
450 }

References $DIC, $ilDB, $query, $res, __setCreateDate(), __setLastUpdateDate(), ilDBConstants\FETCHMODE_OBJECT, setActiveStatus(), setDescription(), setDisableCheckStatus(), setInternal(), setLastCheckDate(), setLinkId(), setTarget(), setTitle(), and setValidStatus().

+ Here is the call graph for this function:

◆ setActiveStatus()

ilLinkResourceItems::setActiveStatus (   $a_status)

Definition at line 131 of file class.ilLinkResourceItems.php.

132 {
133 $this->status = (int) $a_status;
134 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setDescription()

ilLinkResourceItems::setDescription (   $a_description)

Definition at line 115 of file class.ilLinkResourceItems.php.

116 {
117 $this->description = $a_description;
118 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setDisableCheckStatus()

ilLinkResourceItems::setDisableCheckStatus (   $a_status)

Definition at line 139 of file class.ilLinkResourceItems.php.

140 {
141 $this->check = (int) $a_status;
142 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setInternal()

ilLinkResourceItems::setInternal (   $a_status)

Definition at line 181 of file class.ilLinkResourceItems.php.

182 {
183 $this->internal = (bool) $a_status;
184 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setLastCheckDate()

ilLinkResourceItems::setLastCheckDate (   $a_date)

Definition at line 165 of file class.ilLinkResourceItems.php.

166 {
167 $this->last_check = $a_date;
168 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setLinkId()

ilLinkResourceItems::setLinkId (   $a_id)

Definition at line 99 of file class.ilLinkResourceItems.php.

100 {
101 $this->id = $a_id;
102 }

Referenced by add(), and readItem().

+ Here is the caller graph for this function:

◆ setLinkResourceId()

ilLinkResourceItems::setLinkResourceId (   $a_id)

Definition at line 91 of file class.ilLinkResourceItems.php.

92 {
93 $this->webr_id = $a_id;
94 }

◆ setLinkResourceRefId()

ilLinkResourceItems::setLinkResourceRefId (   $a_ref_id)

Definition at line 83 of file class.ilLinkResourceItems.php.

84 {
85 $this->webr_ref_id = $a_ref_id;
86 }

◆ setTarget()

ilLinkResourceItems::setTarget (   $a_target)

Definition at line 123 of file class.ilLinkResourceItems.php.

124 {
125 $this->target = $a_target;
126 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setTitle()

ilLinkResourceItems::setTitle (   $a_title)

Definition at line 107 of file class.ilLinkResourceItems.php.

108 {
109 $this->title = $a_title;
110 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ setValidStatus()

ilLinkResourceItems::setValidStatus (   $a_status)

Definition at line 173 of file class.ilLinkResourceItems.php.

174 {
175 $this->valid = (int) $a_status;
176 }

Referenced by readItem().

+ Here is the caller graph for this function:

◆ sortItems()

ilLinkResourceItems::sortItems (   $a_items)

Sort items (sorting mode depends on sorting setting)

Parameters
object$a_items
Returns

Definition at line 531 of file class.ilLinkResourceItems.php.

532 {
533 include_once './Services/Container/classes/class.ilContainer.php';
534 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
536
537 if ($mode == ilContainer::SORT_TITLE) {
538 $a_items = ilUtil::sortArray($a_items, 'title', 'asc', false, true);
539 return $a_items;
540 }
541
542
543 if ($mode == ilContainer::SORT_MANUAL) {
544 include_once './Services/Container/classes/class.ilContainerSorting.php';
546 foreach ($a_items as $link_id => $item) {
547 if (isset($pos[$link_id])) {
548 $sorted[$link_id] = $item;
549 $sorted[$link_id]['position'] = $pos[$link_id];
550 } else {
551 $unsorted[$link_id] = $item;
552 }
553 }
554 $sorted = ilUtil::sortArray((array) $sorted, 'position', 'asc', true, true);
555 $unsorted = ilUtil::sortArray((array) $unsorted, 'title', 'asc', false, true);
556 $a_items = (array) $sorted + (array) $unsorted;
557 return $a_items;
558 }
559 return $a_items;
560 }
static _lookupSortMode($a_obj_id)
lookup sort mode
static lookupPositions($a_obj_id)
Get positions of subitems.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References ilContainerSortingSettings\_lookupSortMode(), getLinkResourceId(), ilContainerSorting\lookupPositions(), ilContainer\SORT_MANUAL, ilContainer\SORT_TITLE, and ilUtil\sortArray().

Referenced by toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toXML()

ilLinkResourceItems::toXML ( ilXmlWriter  $writer)

Write link XML.

Parameters
ilXmlWriter$writer
Returns

Definition at line 675 of file class.ilLinkResourceItems.php.

676 {
677 $items = $this->sortItems($this->getAllItems());
678
679 $position = 0;
680 foreach ((array) $items as $item_id => $item) {
681 ++$position;
682 $link = self::lookupItem($this->getLinkResourceId(), $item_id);
683
684 $writer->xmlStartTag(
685 'WebLink',
686 array(
687 'id' => $link['link_id'],
688 'active' => $link['active'] ? 1 : 0,
689 'valid' => $link['valid'] ? 1 : 0,
690 'disableValidation' => $link['disable_check'] ? 1 : 0,
691 'position' => $position,
692 'internal' => $link['internal']
693 )
694 );
695 $writer->xmlElement('Title', array(), $link['title']);
696 $writer->xmlElement('Description', array(), $link['description']);
697 $writer->xmlElement('Target', array(), $link['target']);
698
699 // Dynamic parameters
700 include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
701 foreach (ilParameterAppender::_getParams($link_id) as $param_id => $param) {
702 $value = '';
703 switch ($param['value']) {
704 case LINKS_USER_ID:
705 $value = 'userId';
706 break;
707
708 case LINKS_LOGIN:
709 $value = 'userName';
710 break;
711
713 $value = 'matriculation';
714 break;
715 }
716
717 if (!$value) {
718 // Fix for deprecated LINKS_SESSION
719 continue;
720 }
721
722 $writer->xmlElement(
723 'DynamicParameter',
724 array(
725 'id' => $param_id,
726 'name' => $param['name'],
727 'type' => $value
728 )
729 );
730 }
731
732 $writer->xmlEndTag('WebLink');
733 }
734 return true;
735 }
const LINKS_USER_ID
const LINKS_LOGIN
const LINKS_MATRICULATION
static lookupItem($a_webr_id, $a_link_id)
sortItems($a_items)
Sort items (sorting mode depends on sorting setting)
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
$param
Definition: xapitoken.php:29

References $param, ilParameterAppender\_getParams(), getAllItems(), getLinkResourceId(), LINKS_LOGIN, LINKS_MATRICULATION, LINKS_USER_ID, lookupItem(), sortItems(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilLinkResourceItems::update (   $a_update_history = true)

Definition at line 251 of file class.ilLinkResourceItems.php.

252 {
253 global $DIC;
254
255 $ilDB = $DIC['ilDB'];
256
257 if (!$this->getLinkId()) {
258 return false;
259 }
260
261 $this->__setLastUpdateDate(time());
262 $query = "UPDATE webr_items " .
263 "SET title = " . $ilDB->quote($this->getTitle(), 'text') . ", " .
264 "description = " . $ilDB->quote($this->getDescription(), 'text') . ", " .
265 "target = " . $ilDB->quote($this->getTarget(), 'text') . ", " .
266 "active = " . $ilDB->quote($this->getActiveStatus(), 'integer') . ", " .
267 "valid = " . $ilDB->quote($this->getValidStatus(), 'integer') . ", " .
268 "disable_check = " . $ilDB->quote($this->getDisableCheckStatus(), 'integer') . ", " .
269 "internal = " . $ilDB->quote($this->getInternal(), 'integer') . ", " .
270 "last_update = " . $ilDB->quote($this->getLastUpdateDate(), 'integer') . ", " .
271 "last_check = " . $ilDB->quote($this->getLastCheckDate(), 'integer') . " " .
272 "WHERE link_id = " . $ilDB->quote($this->getLinkId(), 'integer') . " " .
273 "AND webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer');
274 $res = $ilDB->manipulate($query);
275
276 if ($a_update_history) {
277 include_once("./Services/History/classes/class.ilHistory.php");
279 $this->getLinkResourceId(),
280 "update",
281 $this->getTitle()
282 );
283 }
284
285 return true;
286 }

References $DIC, $ilDB, $query, $res, __setLastUpdateDate(), ilHistory\_createEntry(), getActiveStatus(), getDescription(), getDisableCheckStatus(), getInternal(), getLastCheckDate(), getLastUpdateDate(), getLinkId(), getLinkResourceId(), getTarget(), getTitle(), and getValidStatus().

+ Here is the call graph for this function:

◆ updateActive()

ilLinkResourceItems::updateActive (   $a_status)

Definition at line 302 of file class.ilLinkResourceItems.php.

303 {
304 global $DIC;
305
306 $ilDB = $DIC['ilDB'];
307
308 $query = "UPDATE webr_items " .
309 "SET active = " . $ilDB->quote($a_status, 'integer') . " " .
310 "WHERE link_id = " . $ilDB->quote($this->getLinkId(), 'integer');
311
312 $this->db->query($query);
313
314 return true;
315 }

References $DIC, $ilDB, $query, and getLinkId().

+ Here is the call graph for this function:

◆ updateDisableCheck()

ilLinkResourceItems::updateDisableCheck (   $a_status)

Definition at line 316 of file class.ilLinkResourceItems.php.

317 {
318 global $DIC;
319
320 $ilDB = $DIC['ilDB'];
321
322 $query = "UPDATE webr_items " .
323 "SET disable_check = " . $ilDB->quote($a_status, 'integer') . " " .
324 "WHERE link_id = " . $ilDB->quote($this->getLinkId(), 'integer');
325 $res = $ilDB->manipulate($query);
326
327 return true;
328 }

References $DIC, $ilDB, $query, $res, and getLinkId().

+ Here is the call graph for this function:

◆ updateLastCheck()

ilLinkResourceItems::updateLastCheck (   $a_offset = 0)

Definition at line 330 of file class.ilLinkResourceItems.php.

331 {
332 global $DIC;
333
334 $ilDB = $DIC['ilDB'];
335
336 if ($a_offset) {
337 $period = $a_offset ? $a_offset : 0;
338 $time = time() - $period;
339
340
341 $query = "UPDATE webr_items " .
342 "SET last_check = " . $ilDB->quote(time(), 'integer') . " " .
343 "WHERE webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer') . " " .
344 "AND disable_check = '0' " .
345 "AND last_check < " . $ilDB->quote($time, 'integer');
346 $res = $ilDB->manipulate($query);
347 } else {
348 $query = "UPDATE webr_items " .
349 "SET last_check = " . $ilDB->quote(time(), 'integer') . " " .
350 "WHERE webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer') . " " .
351 "AND disable_check = '0' ";
352 $res = $ilDB->manipulate($query);
353 }
354 return true;
355 }

References $DIC, $ilDB, $query, $res, and getLinkResourceId().

+ Here is the call graph for this function:

◆ updateTitle()

static ilLinkResourceItems::updateTitle (   $a_link_id,
  $a_title 
)
static

Update title.

Parameters
type$a_link_id
type$a_title

Definition at line 67 of file class.ilLinkResourceItems.php.

68 {
69 global $DIC;
70
71 $ilDB = $DIC['ilDB'];
72
73 $query = 'UPDATE webr_items SET ' .
74 'title = ' . $ilDB->quote($a_title, 'text') . ' ' .
75 'WHERE link_id = ' . $ilDB->quote($a_link_id, 'integer');
76 $ilDB->manipulate($query);
77 return true;
78 }

References $DIC, $ilDB, and $query.

Referenced by ilObjLinkResource\cloneObject().

+ Here is the caller graph for this function:

◆ updateValid()

ilLinkResourceItems::updateValid (   $a_status)

Definition at line 288 of file class.ilLinkResourceItems.php.

289 {
290 global $DIC;
291
292 $ilDB = $DIC['ilDB'];
293
294 $query = "UPDATE webr_items " .
295 "SET valid = " . $ilDB->quote($a_status, 'integer') . " " .
296 "WHERE link_id = " . $ilDB->quote($this->getLinkId(), 'integer');
297 $res = $ilDB->manipulate($query);
298
299 return true;
300 }

References $DIC, $ilDB, $query, $res, and getLinkId().

+ Here is the call graph for this function:

◆ updateValidByCheck()

ilLinkResourceItems::updateValidByCheck (   $a_offset = 0)

Definition at line 357 of file class.ilLinkResourceItems.php.

358 {
359 global $DIC;
360
361 $ilDB = $DIC['ilDB'];
362
363 if ($a_offset) {
364 $period = $a_offset ? $a_offset : 0;
365 $time = time() - $period;
366
367
368 $query = "UPDATE webr_items " .
369 "SET valid = '1' " .
370 "WHERE disable_check = '0' " .
371 "AND webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer') . " " .
372 "AND last_check < " . $ilDB->quote($time, 'integer');
373 $res = $ilDB->manipulate($query);
374 } else {
375 $query = "UPDATE webr_items " .
376 "SET valid = '1' " .
377 "WHERE disable_check = '0' " .
378 "AND webr_id = " . $ilDB->quote($this->getLinkResourceId(), 'integer');
379 $res = $ilDB->manipulate($query);
380 }
381 return true;
382 }

References $DIC, $ilDB, $query, $res, and getLinkResourceId().

+ Here is the call graph for this function:

◆ validate()

ilLinkResourceItems::validate ( )

Validate required settings.

Returns

Definition at line 664 of file class.ilLinkResourceItems.php.

665 {
666 return $this->getTarget() and $this->getTitle();
667 }

References getTarget(), and getTitle().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: