5include_once 
"./Services/Object/classes/class.ilObjectGUI.php";
 
   25        $this->webr_ref_id = 0;
 
   26        $this->webr_id = $webr_id;
 
   32    public static function lookupItem($a_webr_id, $a_link_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');
 
   42            $item[
'title']                              = 
$row->title;
 
   43            $item[
'description']                = 
$row->description;
 
   44            $item[
'target']                             = 
$row->target;
 
   45            $item[
'active']                             = (bool) 
$row->active;
 
   46            $item[
'disable_check']              = 
$row->disable_check;
 
   47            $item[
'create_date']                = 
$row->create_date;
 
   48            $item[
'last_update']                = 
$row->last_update;
 
   49            $item[
'last_check']                 = 
$row->last_check;
 
   50            $item[
'valid']                              = 
$row->valid;
 
   51            $item[
'link_id']                    = 
$row->link_id;
 
   52            $item[
'internal']                   = 
$row->internal;
 
   54        return $item ? $item : array();
 
   67        $query = 
'UPDATE webr_items SET ' .
 
   68                'title = ' . 
$ilDB->quote($a_title, 
'text') . 
' ' .
 
   69                'WHERE link_id = ' . 
$ilDB->quote($a_link_id, 
'integer');
 
   79        $this->webr_ref_id = $a_ref_id;
 
   83        return $this->webr_ref_id;
 
   87        $this->webr_id = $a_id;
 
   91        return $this->webr_id;
 
  103        $this->title = $a_title;
 
  111        $this->description = $a_description;
 
  119        $this->target = $a_target;
 
  127        $this->status = (int) $a_status;
 
  131        return (
bool) $this->status;
 
  135        $this->check = (int) $a_status;
 
  139        return (
bool) $this->check;
 
  144        $this->c_date = $a_date;
 
  148        return $this->c_date;
 
  153        $this->m_date = $a_date;
 
  157        return $this->m_date;
 
  161        $this->last_check = $a_date;
 
  165        return $this->last_check;
 
  169        $this->valid = (int) $a_status;
 
  177        $this->
internal = (bool) $a_status;
 
  181        return (
bool) $this->internal;
 
  193        include_once 
'Modules/WebResource/classes/class.ilParameterAppender.php';
 
  198            $new_item->setTitle($item[
'title']);
 
  199            $new_item->setDescription($item[
'description']);
 
  200            $new_item->setTarget($item[
'target']);
 
  201            $new_item->setActiveStatus($item[
'active']);
 
  202            $new_item->setDisableCheckStatus($item[
'disable_check']);
 
  203            $new_item->setLastCheckDate($item[
'last_check']);
 
  204            $new_item->setValidStatus($item[
'valid']);
 
  205            $new_item->setInternal($item[
'internal']);
 
  206            $new_item->add(
true);
 
  210                $appender->setName(
$data[
'name']);
 
  211                $appender->setValue(
$data[
'value']);
 
  212                $appender->add($new_item->getLinkId());
 
  220    public function delete($a_item_id, $a_update_history = 
true)
 
  224        $item = $this->
getItem($a_item_id);
 
  226        $query = 
"DELETE FROM webr_items " .
 
  228            "AND link_id = " . $ilDB->quote($a_item_id, 
'integer');
 
  231        if ($a_update_history) {
 
  232            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  243    public function update($a_update_history = 
true)
 
  252        $query = 
"UPDATE webr_items " .
 
  253            "SET title = " . 
$ilDB->quote($this->
getTitle(), 
'text') . 
", " .
 
  254            "description = " . $ilDB->quote($this->
getDescription(), 
'text') . 
", " .
 
  255            "target = " . $ilDB->quote($this->
getTarget(), 
'text') . 
", " .
 
  256            "active = " . $ilDB->quote($this->
getActiveStatus(), 
'integer') . 
", " .
 
  257            "valid = " . $ilDB->quote($this->
getValidStatus(), 
'integer') . 
", " .
 
  259            "internal = " . $ilDB->quote($this->
getInternal(), 
'integer') . 
", " .
 
  261            "last_check = " . $ilDB->quote($this->
getLastCheckDate(), 
'integer') . 
" " .
 
  262            "WHERE link_id = " . $ilDB->quote($this->
getLinkId(), 
'integer') . 
" " .
 
  266        if ($a_update_history) {
 
  267            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  282        $query = 
"UPDATE webr_items " .
 
  283            "SET valid = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  294        $query = 
"UPDATE webr_items " .
 
  295            "SET active = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  306        $query = 
"UPDATE webr_items " .
 
  307            "SET disable_check = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  319            $period = $a_offset ? $a_offset : 0;
 
  320            $time = time() - $period;
 
  323            $query = 
"UPDATE webr_items " .
 
  324                "SET last_check = " . 
$ilDB->quote(time(), 
'integer') . 
" " .
 
  326                "AND disable_check = '0' " .
 
  327                "AND last_check < " . $ilDB->quote(
$time, 
'integer');
 
  330            $query = 
"UPDATE webr_items " .
 
  331                "SET last_check = " . 
$ilDB->quote(time(), 
'integer') . 
" " .
 
  333                "AND disable_check = '0' ";
 
  344            $period = $a_offset ? $a_offset : 0;
 
  345            $time = time() - $period;
 
  348            $query = 
"UPDATE webr_items " .
 
  350                "WHERE disable_check = '0' " .
 
  352                "AND last_check < " . $ilDB->quote(
$time, 
'integer');
 
  355            $query = 
"UPDATE webr_items " .
 
  357                "WHERE disable_check = '0' " .
 
  365    public function add($a_update_history = 
true)
 
  372        $next_id = 
$ilDB->nextId(
'webr_items');
 
  373        $query = 
"INSERT INTO webr_items (link_id,title,description,target,active,disable_check," .
 
  374            "last_update,create_date,webr_id,valid,internal) " .
 
  376            $ilDB->quote($next_id, 
'integer') . 
", " .
 
  379            $ilDB->quote($this->
getTarget(), 
'text') . 
", " .
 
  386            $ilDB->quote($this->
getInternal(), 
'integer') . 
' ' .
 
  393        if ($a_update_history) {
 
  394            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  408        $query = 
"SELECT * FROM webr_items " .
 
  409            "WHERE link_id = " . 
$ilDB->quote($a_link_id, 
'integer');
 
  433        $query = 
"SELECT * FROM webr_items " .
 
  435            "AND link_id = " . $ilDB->quote($a_link_id, 
'integer');
 
  439            $item[
'title']                              = 
$row->title;
 
  440            $item[
'description']                = 
$row->description;
 
  441            $item[
'target']                             = 
$row->target;
 
  442            $item[
'active']                             = (bool) 
$row->active;
 
  443            $item[
'disable_check']              = 
$row->disable_check;
 
  444            $item[
'create_date']                = 
$row->create_date;
 
  445            $item[
'last_update']                = 
$row->last_update;
 
  446            $item[
'last_check']                 = 
$row->last_check;
 
  447            $item[
'valid']                              = 
$row->valid;
 
  448            $item[
'link_id']                    = 
$row->link_id;
 
  449            $item[
'internal']                   = 
$row->internal;
 
  451        return $item ? $item : array();
 
  463        $query = 
"SELECT link_id FROM webr_items " .
 
  464            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer');
 
  467            $link_ids[] = 
$row[
'link_id'];
 
  469        return (array) $link_ids;
 
  476        $query = 
"SELECT * FROM webr_items " .
 
  481            $items[
$row->link_id][
'title']                              = 
$row->title;
 
  482            $items[
$row->link_id][
'description']                = 
$row->description;
 
  483            $items[
$row->link_id][
'target']                             = 
$row->target;
 
  484            $items[
$row->link_id][
'active']                             = (bool) 
$row->active;
 
  485            $items[
$row->link_id][
'disable_check']              = 
$row->disable_check;
 
  486            $items[
$row->link_id][
'create_date']                = 
$row->create_date;
 
  487            $items[
$row->link_id][
'last_update']                = 
$row->last_update;
 
  488            $items[
$row->link_id][
'last_check']                 = 
$row->last_check;
 
  489            $items[
$row->link_id][
'valid']                              = 
$row->valid;
 
  490            $items[
$row->link_id][
'link_id']                    = 
$row->link_id;
 
  491            $items[
$row->link_id][
'internal']                   = 
$row->internal;
 
  493        return $items ? $items : array();
 
  503        include_once 
'./Services/Container/classes/class.ilContainer.php';
 
  504        include_once 
'./Services/Container/classes/class.ilContainerSortingSettings.php';
 
  514            include_once 
'./Services/Container/classes/class.ilContainerSorting.php';
 
  516            foreach ($a_items as $link_id => $item) {
 
  517                if (isset($pos[$link_id])) {
 
  518                    $sorted[$link_id] = $item;
 
  519                    $sorted[$link_id][
'position'] = $pos[$link_id];
 
  521                    $unsorted[$link_id] = $item;
 
  526            $a_items = (array) $sorted + (array) $unsorted;
 
  537            if ($item_data[
'active']) {
 
  538                $active_items[
$id] = $item_data;
 
  541        return $active_items ? $active_items : array();
 
  546        $period = $a_offset ? $a_offset : 0;
 
  547        $time = time() - $period;
 
  550            if (!$item_data[
'disable_check']) {
 
  551                if (!$item_data[
'last_check'] or $item_data[
'last_check'] < 
$time) {
 
  552                    $check_items[
$id] = $item_data;
 
  556        return $check_items ? $check_items : array();
 
  566        $ilDB->manipulate(
"DELETE FROM webr_items WHERE webr_id = " . 
$ilDB->quote($webr_id, 
'integer'));
 
  583        $query = 
"SELECT * FROM webr_items " .
 
  584            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer') . 
' ' .
 
  585            "AND active = " . 
$ilDB->quote(1, 
'integer') . 
' ';
 
  587        return $res->numRows() == 1 ? true : 
false;
 
  599        $query = 
"SELECT COUNT(*) num FROM webr_items " .
 
  600            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer');
 
  618        include_once(
"./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
 
  642        foreach ((array) $items as $item_id => $item) {
 
  649                    'id'                                => $link[
'link_id'],
 
  650                    'active'                    => $link[
'active'] ? 1 : 0,
 
  651                    'valid'                             => $link[
'valid'] ? 1 : 0,
 
  652                    'disableValidation' => $link[
'disable_check'] ? 1 : 0,
 
  653                    'position'                  => $position,
 
  654                    'internal'                  => $link[
'internal']
 
  657            $writer->
xmlElement(
'Title', array(), $link[
'title']);
 
  658            $writer->
xmlElement(
'Description', array(), $link[
'description']);
 
  659            $writer->
xmlElement(
'Target', array(), $link[
'target']);
 
  662            include_once 
'./Modules/WebResource/classes/class.ilParameterAppender.php';
 
  665                switch ($param[
'value']) {
 
  675                        $value = 
'matriculation';
 
  688                        'name'  => $param[
'name'],
 
An exception for terminatinating execution or to throw for unit testing.
const LINKS_MATRICULATION
static _lookupSortMode($a_obj_id)
lookup sort mode
static lookupPositions($a_obj_id)
Get positions of subitems.
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.
Class ilObjLinkResourceGUI.
setValidStatus($a_status)
setActiveStatus($a_status)
updateLastCheck($a_offset=0)
setDescription($a_description)
setDisableCheckStatus($a_status)
validate()
Validate required settings.
static updateTitle($a_link_id, $a_title)
Update title.
getCheckItems($a_offset=0)
__setLastUpdateDate($a_date)
updateValidByCheck($a_offset=0)
update($a_update_history=true)
static getAllItemIds($a_webr_id)
Get all link ids.
static lookupItem($a_webr_id, $a_link_id)
toXML(ilXmlWriter $writer)
Write link XML.
__construct($webr_id)
Constructor @access public.
static _deleteAll($webr_id)
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
add($a_update_history=true)
updateDisableCheck($a_status)
cloneItems($a_new_id)
Copy web resource items.
sortItems($a_items)
Sort items (sorting mode depends on sorting setting)
setLastCheckDate($a_date)
static _isSingular($a_webr_id)
Check whether there is only one active link in the web resource.
static lookupNumberOfLinks($a_webr_id)
Get number of assigned links.
setLinkResourceRefId($a_ref_id)
static _getFirstLink($a_webr_id)
Get first link item Check before with _isSingular() if there is more or less than one.
Class ilParameterAppender.
static _getParams($a_link_id)
Get dynamic parameter definitions.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
foreach($_POST as $key=> $value) $res