5include_once 
"./Services/Object/classes/class.ilObjectGUI.php";
 
   27        $this->webr_ref_id = 0;
 
   28        $this->webr_id = $webr_id;
 
   34    public static function lookupItem($a_webr_id, $a_link_id)
 
   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');
 
   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;
 
   58        return $item ? $item : array();
 
   73        $query = 
'UPDATE webr_items SET ' .
 
   74                'title = ' . 
$ilDB->quote($a_title, 
'text') . 
' ' .
 
   75                'WHERE link_id = ' . 
$ilDB->quote($a_link_id, 
'integer');
 
   85        $this->webr_ref_id = $a_ref_id;
 
   89        return $this->webr_ref_id;
 
   93        $this->webr_id = $a_id;
 
   97        return $this->webr_id;
 
  109        $this->title = $a_title;
 
  117        $this->description = $a_description;
 
  125        $this->target = $a_target;
 
  133        $this->status = (int) $a_status;
 
  137        return (
bool) $this->status;
 
  141        $this->check = (int) $a_status;
 
  145        return (
bool) $this->check;
 
  150        $this->c_date = $a_date;
 
  154        return $this->c_date;
 
  159        $this->m_date = $a_date;
 
  163        return $this->m_date;
 
  167        $this->last_check = $a_date;
 
  171        return $this->last_check;
 
  175        $this->valid = (int) $a_status;
 
  183        $this->
internal = (bool) $a_status;
 
  187        return (
bool) $this->internal;
 
  199        include_once 
'Modules/WebResource/classes/class.ilParameterAppender.php';
 
  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);
 
  216                $appender->setName(
$data[
'name']);
 
  217                $appender->setValue(
$data[
'value']);
 
  218                $appender->add($new_item->getLinkId());
 
  226    public function delete($a_item_id, $a_update_history = 
true)
 
  232        $item = $this->
getItem($a_item_id);
 
  234        $query = 
"DELETE FROM webr_items " .
 
  236            "AND link_id = " . 
$ilDB->quote($a_item_id, 
'integer');
 
  239        if ($a_update_history) {
 
  240            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  251    public function update($a_update_history = 
true)
 
  262        $query = 
"UPDATE webr_items " .
 
  263            "SET title = " . 
$ilDB->quote($this->
getTitle(), 
'text') . 
", " .
 
  272            "WHERE link_id = " . 
$ilDB->quote($this->
getLinkId(), 
'integer') . 
" " .
 
  276        if ($a_update_history) {
 
  277            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  294        $query = 
"UPDATE webr_items " .
 
  295            "SET valid = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  308        $query = 
"UPDATE webr_items " .
 
  309            "SET active = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  322        $query = 
"UPDATE webr_items " .
 
  323            "SET disable_check = " . 
$ilDB->quote($a_status, 
'integer') . 
" " .
 
  337            $period = $a_offset ? $a_offset : 0;
 
  338            $time = time() - $period;
 
  341            $query = 
"UPDATE webr_items " .
 
  342                "SET last_check = " . 
$ilDB->quote(time(), 
'integer') . 
" " .
 
  344                "AND disable_check = '0' " .
 
  345                "AND last_check < " . 
$ilDB->quote(
$time, 
'integer');
 
  348            $query = 
"UPDATE webr_items " .
 
  349                "SET last_check = " . 
$ilDB->quote(time(), 
'integer') . 
" " .
 
  351                "AND disable_check = '0' ";
 
  364            $period = $a_offset ? $a_offset : 0;
 
  365            $time = time() - $period;
 
  368            $query = 
"UPDATE webr_items " .
 
  370                "WHERE disable_check = '0' " .
 
  372                "AND last_check < " . 
$ilDB->quote(
$time, 
'integer');
 
  375            $query = 
"UPDATE webr_items " .
 
  377                "WHERE disable_check = '0' " .
 
  385    public function add($a_update_history = 
true)
 
  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) " .
 
  398            $ilDB->quote($next_id, 
'integer') . 
", " .
 
  415        if ($a_update_history) {
 
  416            include_once(
"./Services/History/classes/class.ilHistory.php");
 
  432        $query = 
"SELECT * FROM webr_items " .
 
  433            "WHERE link_id = " . 
$ilDB->quote($a_link_id, 
'integer');
 
  459        $query = 
"SELECT * FROM webr_items " .
 
  461            "AND link_id = " . 
$ilDB->quote($a_link_id, 
'integer');
 
  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;
 
  477        return $item ? $item : array();
 
  491        $query = 
"SELECT link_id FROM webr_items " .
 
  492            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer');
 
  495            $link_ids[] = 
$row[
'link_id'];
 
  497        return (array) $link_ids;
 
  506        $query = 
"SELECT * FROM webr_items " .
 
  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;
 
  523        return $items ? $items : array();
 
  533        include_once 
'./Services/Container/classes/class.ilContainer.php';
 
  534        include_once 
'./Services/Container/classes/class.ilContainerSortingSettings.php';
 
  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];
 
  551                    $unsorted[$link_id] = $item;
 
  556            $a_items = (array) $sorted + (array) $unsorted;
 
  567            if ($item_data[
'active']) {
 
  568                $active_items[
$id] = $item_data;
 
  571        return $active_items ? $active_items : array();
 
  576        $period = $a_offset ? $a_offset : 0;
 
  577        $time = time() - $period;
 
  580            if (!$item_data[
'disable_check']) {
 
  581                if (!$item_data[
'last_check'] or $item_data[
'last_check'] < 
$time) {
 
  582                    $check_items[
$id] = $item_data;
 
  586        return $check_items ? $check_items : array();
 
  598        $ilDB->manipulate(
"DELETE FROM webr_items WHERE webr_id = " . 
$ilDB->quote($webr_id, 
'integer'));
 
  617        $query = 
"SELECT * FROM webr_items " .
 
  618            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer') . 
' ' .
 
  619            "AND active = " . 
$ilDB->quote(1, 
'integer') . 
' ';
 
  621        return $res->numRows() == 1 ? true : 
false;
 
  635        $query = 
"SELECT COUNT(*) num FROM webr_items " .
 
  636            "WHERE webr_id = " . 
$ilDB->quote($a_webr_id, 
'integer');
 
  656        include_once(
"./Modules/WebResource/classes/class.ilObjLinkResourceAccess.php");
 
  680        foreach ((array) $items as $item_id => $item) {
 
  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']
 
  695            $writer->
xmlElement(
'Title', array(), $link[
'title']);
 
  696            $writer->
xmlElement(
'Description', array(), $link[
'description']);
 
  697            $writer->
xmlElement(
'Target', array(), $link[
'target']);
 
  700            include_once 
'./Modules/WebResource/classes/class.ilParameterAppender.php';
 
  703                switch ($param[
'value']) {
 
  713                        $value = 
'matriculation';
 
  726                        '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