function getFeedTagUri()
 {
     return "tag:" . AnnotationGlobals::getHost() . ',' . date('2005-07-20', AnnotationGlobals::getInstallDate()) . ":annotation";
 }
Exemple #2
0
     header('HTTP/1.1 400 Bad Request');
     echo '<h1>400 Bad Request</h1>' . htmlspecialchars($query->error);
 } elseif (!MarginaliaHelper::isUrlSafe($summaryUrl)) {
     header('HTTP/1.1 400 Bad Request');
     echo '<h1>400 Bad Request</h1>Bad url parameter';
 } else {
     // Display individual annotations
     // Dunno if the range sorting is working
     $annotations = get_records_sql($query->sql('section_type, section_name, quote_title, start_block, start_word, start_char, end_block, end_word, end_char'));
     $format = array_key_exists('format', $_GET) ? $_GET['format'] : 'html';
     if ('atom' == $format) {
         $annotationObjs = array();
         foreach ($annotations as $annotationRec) {
             $annotationObjs[] = AnnotationGlobals::recordToAnnotation($annotationRec);
         }
         MarginaliaHelper::generateAnnotationFeed($annotationObjs, AnnotationGlobals::getFeedTagUri(), MarginaliaHelper::getLastModified($annotationObjs, AnnotationGlobals::getInstallDate()), AnnotationGlobals::getServicePath(), AnnotationGlobals::getHost(), $query->getFeedUrl('atom'), $CFG->wwwroot);
     } else {
         // Get the course.  This can't be passed as a GET parameter because this URL could be via the
         // Atom feed, and the Atom feed is generated exclusively by annotation code which doesn't know
         // that much about Moodle.  So the handler has to query it based on a discussion ID or the like.
         $course = null;
         $courseId = $query->handler->courseId;
         if (null != $courseId) {
             if (!($course = get_record("course", "id", $courseId))) {
                 error("Course ID is incorrect - discussion is faulty ");
             }
             // Ok, now this is probably very wrong.  If the user looks for annotations within a course,
             // it requires a login.  Without the course (i.e. in a more general search), it doesn't!
             // I would eleminate this, but I don't really know how Moodle security works. #geof#
             if ($course->category) {
                 require_login($course->id);
Exemple #3
0
 function doUpdateAnnotation($annotation)
 {
     $urlQueryStr = '';
     $record = AnnotationGlobals::annotationToRecord($annotation);
     $logUrl = 'annotate.php' . ($urlQueryStr ? '?' . $urlQueryStr : '');
     add_to_log(null, 'annotation', 'update', $logUrl, "{$annotation->id}");
     return update_record('annotation', $record);
 }