/**
  * Get data of first active link resource
  *
  * @return array link data array
  */
 function __readLink()
 {
     include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
     include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
     if (ilParameterAppender::_isEnabled()) {
         return $this->link_data = ilParameterAppender::_append($tmp =& ilLinkResourceItems::_getFirstLink($this->obj_id));
     }
     return $this->link_data = ilLinkResourceItems::_getFirstLink($this->obj_id);
 }
 function callDirectLink()
 {
     $obj_id = $this->object->getId();
     include_once "./Services/Link/classes/class.ilLink.php";
     include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
     if (ilLinkResourceItems::_isSingular($obj_id)) {
         $url = ilLinkResourceItems::_getFirstLink($obj_id);
         // handle internal links
         if (stristr($url["target"], "|")) {
             // #10612
             $parts = explode("|", $url["target"]);
             if ($parts[0] == "page") {
                 $parts[0] = "pg";
             }
             if ($parts[0] == "term") {
                 $parts[0] = "git";
             }
             $url["target"] = ilLink::_getStaticLink($parts[1], $parts[0]);
         }
         include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
         if (ilParameterAppender::_isEnabled()) {
             $url = ilParameterAppender::_append($url);
         }
         $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
     }
 }
 function callDirectLink()
 {
     $obj_id = $this->object->getId();
     include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
     if (ilLinkResourceItems::_isSingular($obj_id)) {
         $url = ilLinkResourceItems::_getFirstLink($obj_id);
         if ($url["target"]) {
             $url["target"] = $this->handleSubItemLinks($url["target"]);
             include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
             if (ilParameterAppender::_isEnabled()) {
                 $url = ilParameterAppender::_append($url);
             }
             $this->redirectToLink($this->ref_id, $obj_id, $url["target"]);
         }
     }
 }
 /**
  * Overwriten Metadata update listener for ECS functionalities
  *
  * @access public
  * 
  */
 public function MDUpdateListener($a_element)
 {
     global $ilLog;
     parent::MDUpdateListener($a_element);
     $md = new ilMD($this->getId(), 0, $this->getType());
     if (!is_object($md_gen = $md->getGeneral())) {
         return false;
     }
     $title = $md_gen->getTitle();
     foreach ($md_gen->getDescriptionIds() as $id) {
         $md_des = $md_gen->getDescription($id);
         $description = $md_des->getDescription();
         break;
     }
     switch ($a_element) {
         case 'General':
             include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
             if (ilLinkResourceItems::lookupNumberOfLinks($this->getId()) == 1) {
                 $link_arr = ilLinkResourceItems::_getFirstLink($this->getId());
                 $link = new ilLinkResourceItems($this->getId());
                 $link->readItem($link_arr['link_id']);
                 $link->setTitle($title);
                 $link->setDescription($description);
                 $link->update();
             }
             break;
         default:
             return true;
     }
     return true;
 }
 /**
  * Clone
  *
  * @access public
  * @param int target id
  * @param int copy id
  * 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($new_obj);
     // object created now copy other settings
     include_once 'Modules/WebResource/classes/class.ilLinkResourceItems.php';
     $links = new ilLinkResourceItems($this->getId());
     $links->cloneItems($new_obj->getId());
     // append copy info weblink title
     if (ilLinkResourceItems::_isSingular($new_obj->getId())) {
         $first = ilLinkResourceItems::_getFirstLink($new_obj->getId());
         ilLinkResourceItems::updateTitle($first['link_id'], $new_obj->getTitle());
     }
     return $new_obj;
 }