/** * Creates a link between two documents * * @author KnowledgeTree Team * @access public * @param KTAPI_Document $document The document object * @param string $type The link relationship type: depended on|Attachment|Reference|Copy|Default * @return PEAR_Error|void Returns nothing on success | a PEAR_Error object on failure * */ function link_document($document, $type) { $typeid = $this->ktapi->get_link_type_id($type); if (PEAR::isError($typeid)) { return $typeid; } $link = new DocumentLink($this->get_documentid(), $document->get_documentid(), $typeid); $created = $link->create(); if ($created === false || PEAR::isError($created)) { return new PEAR_Error(_kt('Could not create link')); } }