From bce9a8198f9408d1b753cb50125bfc12132376ab Mon Sep 17 00:00:00 2001 From: Penny Leach Date: Sat, 5 Dec 2009 09:42:42 +0000 Subject: [PATCH] portfolio/leap2a MDL-21036 & MDL-21034 : use proper date format in leap2a, and updated forum to use it --- lib/portfolio/formats/leap2a/lib.php | 4 ++-- mod/forum/lib.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/portfolio/formats/leap2a/lib.php b/lib/portfolio/formats/leap2a/lib.php index 2912ccd995..0926a69576 100644 --- a/lib/portfolio/formats/leap2a/lib.php +++ b/lib/portfolio/formats/leap2a/lib.php @@ -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 diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 6c9aa8d3a0..ab8eb069d0 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -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(); -- 2.39.5