]> git.mjollnir.org Git - moodle.git/commitdiff
portfolio/leap2a MDL-21036 & MDL-21034 : use proper date format in leap2a, and update...
authorPenny Leach <penny@liip.ch>
Sat, 5 Dec 2009 09:42:42 +0000 (09:42 +0000)
committerPenny Leach <penny@liip.ch>
Sat, 5 Dec 2009 09:42:42 +0000 (09:42 +0000)
lib/portfolio/formats/leap2a/lib.php
mod/forum/lib.php

index 2912ccd995479e73a4d4256b608e0a6c9a70431d..0926a69576af81d8c5854620710d2b7800affaf4 100644 (file)
@@ -377,8 +377,8 @@ class portfolio_format_leap2a_entry {
         // selectively add uncomplicated optional elements
         foreach (array('updated', 'published') as $field) {
             if ($this->{$field}) {
-                // TODO get the proper date format
-                $entry->appendChild($dom->createElement($field, $this->{$field}));
+                $date = date(DATE_ATOM, $this->{$field});
+                $entry->appendChild($dom->createElement($field, $date));
             }
         }
         // deal with referenced files first since it's simple
index 6c9aa8d3a0f89f76f234be16506ebbcaeb17bec4..ab8eb069d0f6598e2c06e92fc1f58800653af095 100644 (file)
@@ -8133,7 +8133,7 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
                 $leapwriter->add_entry($selection);
                 $leapwriter->make_selection($selection, $ids, 'Grouping');
                 $content = $leapwriter->to_xml();
-                $name = $this->exporter->get('format')->manifest_name();
+                $name = $this->get('exporter')->get('format')->manifest_name();
             }
             $this->get('exporter')->write_new_file($content, $name, $manifest);
 
@@ -8169,6 +8169,9 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
      */
     private function prepare_post_leap2a(portfolio_format_leap2a_writer $leapwriter, $post, $posthtml) {
         $entry = new portfolio_format_leap2a_entry('forumpost' . $post->id,  $post->subject, 'resource', $posthtml);
+        $entry->published = $post->created;
+        $entry->updated = $post->modified;
+        $entry->author = $post->author;
         if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id])) {
             foreach ($this->keyedfiles[$post->id] as $file) {
                 // copying the file into the package area is handled elsewhere
@@ -8215,6 +8218,8 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
         if (!array_key_exists($post->userid, $users)) {
             $users[$post->userid] = $DB->get_record('user', array('id' => $post->userid));
         }
+        // add the user object on to the post so we can pass it to the leap writer if necessary
+        $post->author = $users[$post->userid];
         $viewfullnames = true;
         // format the post body
         $options = new object();