Procedural File: mooan_annotea_lib.php
Source Location: /mooan_annotea_lib.php
Page Details:
Library of functions for interfacing with the Annotea server.
Tags:
mooan_add_comment
mixed mooan_add_comment(
string $documentID, string $text, ???? $creatorID, string $place, mixed $category)
[line 108]
Adds a comment to the given document.
Tags:
- return - ID of the created comment on success, false on failure
Parameters
-
string
$documentID
-
URL of the document that the comment is attached to. Should be the output of Moodle qualified_me() function.
-
string
$text
-
Content of the comment.
-
????
$creatorID
-
User who made the comment
-
string
$place
-
XPointer pointing at the region of the document that the comment is attached to
[ Top ]
mooan_add_message
mixed mooan_add_message(
string $rootID, string $text, ???? $creatorID, string $parentID)
[line 192]
Adds a response to the given message.
Tags:
- return - ID of the created response on success, NULL on failure
Parameters
-
string
$rootID
-
ID of the first message in the response tree
-
string
$text
-
Content of the response
-
????
$creatorID
-
User who made the response
-
string
$parentID
-
ID of the message being responded to
[ Top ]
mooan_annotea_request
mixed mooan_annotea_request(
int $method, string $query, array $headers, string $content)
[line 539]
Sends the given request via HTTP to the Annotea server and hands back the reponse.
Tags:
- return - An associative array containing response headers and content, as specified in HttpRequest::getResponseData, with the addition of the response code being stored under 'code'. NULL if the request fails.
Parameters
-
int
$method
-
HTTP_METH_* constant. Annotea uses DELETE, GET, POST, PUT
-
string
$query
-
The query string to send to the Annotea server
-
array
$headers
-
An associative array containing HTTP headers to send. Contents should be in format 'Header name' => 'Header value'
-
string
$content
-
Content of the request
[ Top ]
mooan_delete
boolean mooan_delete(
string $messageID)
[line 267]
Removes an entry with the given ID from Annotea. Will only work on entries that have no responses.
Tags:
- return - true if the removal is successfull, false otherwise
Parameters
-
string
$messageID
-
ID of the entry to remove
[ Top ]
mooan_delete_rec
boolean mooan_delete_rec(
string $messageID)
[line 293]
Removes an entry with the given ID, and all responses to it, from Annotea.
Tags:
- return - true if the whole removal is successfull, false otherwise
Parameters
-
string
$messageID
-
ID of the root of the entry subtree to remove
[ Top ]
mooan_delete_rec_aux
boolean mooan_delete_rec_aux(
object $messagedata)
[line 310]
The actual recursive deletion, separated from mooan_delete_rec due to optimisation reasons.
Tags:
- return - true if the whole removal is successfull, false otherwise
Parameters
-
object
$messagedata
-
MooanMessageData of the message to delete
[ Top ]
mooan_get_body
string mooan_get_body(
string $messageID)
[line 669]
Gets the content of an entry from Annotea.
Tags:
- return - The content of the entry or a blank string on error
Parameters
-
string
$messageID
-
ID of the entry whose body to fetch
[ Top ]
mooan_get_comments
array mooan_get_comments(
string $documentID)
[line 81]
Gets all comments, and replies to those comments, made to the given document.
Tags:
- return - An associative array of $commentID -> $comment_data
Parameters
-
string
$documentID
-
URL of the document to fetch attached comments for
[ Top ]
mooan_get_comment_base_data
array mooan_get_comment_base_data(
string $documentID)
[line 592]
Gets the ID, body URI, creator and position of all the comments attached to the given document.
Tags:
- return - An associative array of commentID => MooanMessageData
Parameters
-
string
$documentID
-
URL of the document to get attached comments' data for
[ Top ]
mooan_get_reply_tree
void mooan_get_reply_tree(
&$parent, [boolean $getbodies = true], object $parent)
[line 691]
Retrieves the response subtree attached to the given entry. The subtree will be attached to the parent node's data structure.
Parameters
-
object
$parent
-
The MooanMessageData of the entry to get responses for.
-
boolean
$getbodies
-
Whether to get the response's bodies
-
&$parent
-
[ Top ]
mooan_get_single_message_base_data
mixed mooan_get_single_message_base_data(
string $messageID)
[line 780]
Retrieves the given message's creator and last modification data from Annotea.
Tags:
- return - A MooanMessageData containing the parsed message on successfull retrieval from Annotea, NULL otherwise.
Parameters
-
string
$messageID
-
ID of the message to retrieve.
[ Top ]
mooan_modify_comment
boolean mooan_modify_comment(
string $messageID, string $documentID, string $text, ???? $creatorID, string $place)
[line 341]
Modifies a comment with the given ID. Works by loading the original message from Annotea and altering it's values based on the parameters. If a parameter is NULL, the original value is kept.
Tags:
- return - true if the modification is successfull, false otherwise
Parameters
-
string
$messageID
-
ID of the comment to modify
-
string
$documentID
-
URL of the comment to which the comment will now be attached to
-
string
$text
-
New content of the comment
-
????
$creatorID
-
The user who will now be listed as the creator of the comment
-
string
$place
-
XPointer pointing at the location where the comment will now be located
[ Top ]
mooan_modify_message
boolean mooan_modify_message(
string $messageID, string $text, ???? $creatorID)
[line 450]
Modifies a response with the given ID. The position of the response in the response tree is not alterable via this function. Works by loading the original message from Annotea and altering it's values based on the parameters. If a parameter is NULL, the original value is kept.
Tags:
- return - true if the modification is successfull, false otherwise
Parameters
-
string
$messageID
-
ID of the reponse to modify
-
string
$text
-
New content of the response
-
????
$creatorID
-
The user who will now be listed as the creator of the response
[ Top ]
mooan_parse_id
string mooan_parse_id(
string $idstring)
[line 766]
Given an Annotea entity ID in the format of an URI, crops off everything preceding the actual entity ID. For example for 'http://localhost/annotea/01234' returns '01234'.
Tags:
- return - The actual ID portion of the given string
Parameters
-
string
$idstring
-
The ID to parse
[ Top ]