portfolio/leap2a MDL-23955 updated leap2a support to 2010-07 version

This commit is contained in:
Penny Leach 2010-08-28 10:00:27 +00:00
parent 7817d7c65b
commit ebb7e78267
8 changed files with 98 additions and 95 deletions

View file

@ -98,15 +98,11 @@ class assignment_portfolio_caller extends portfolio_module_caller_base {
$baseid = 'assignment' . $this->assignment->assignment->assignmenttype . $this->assignment->assignment->id . 'submission';
$entryids = array();
foreach ($files as $file) {
$id = $baseid . $file->get_id();
$entry = new portfolio_format_leap2a_entry($id, $file->get_filename(), 'resource', $file);
$entry->add_category('offline', 'resource_type');
$entry->published = $file->get_timecreated();
$entry->updated = $file->get_timemodified();
$entry = new portfolio_format_leap2a_file($file->get_filename(), $file);
$entry->author = $this->user;
$leapwriter->add_entry($entry);
$this->exporter->copy_existing_file($file);
$entryids[] = $id;
$entryids[] = $entry->id;
}
if (count($files) > 1) {
// if we have multiple files, they should be grouped together into a folder

View file

@ -311,9 +311,9 @@ class assignment_online extends assignment_base {
$entry->author = $user;
$leapwriter->add_entry($entry);
if ($files = $exporter->get('caller')->get('multifiles')) {
$leapwriter->link_files($entry, $files, 'assignmentonline' . $this->assignment->id . 'file');
foreach ($files as $f) {
$exporter->copy_existing_file($f);
$entry->add_attachment($f);
}
}
$exporter->write_new_file($leapwriter->to_xml(), $exporter->get('format')->manifest_name(), true);

View file

@ -203,9 +203,7 @@ class data_portfolio_caller extends portfolio_module_caller_base {
$entry->author = $users[$record->userid];
}
$ids[] = $entry->id;
foreach ($files as $file) {
$entry->add_attachment($file);
}
$leapwriter->link_files($entry, $files, 'dataentry' . $record->id . 'file');
$leapwriter->add_entry($entry);
}
}

View file

@ -181,11 +181,7 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
if ($this->attachment) { // simplest case first - single file attachment
$this->copy_files(array($this->singlefile), $this->attachment);
if ($writingleap) { // if we're writing leap, make the manifest to go along with the file
$entry = new portfolio_format_leap2a_entry('forumattachment' . $this->singlefile->get_id(),
$this->singlefile->get_filename(), 'resource', $this->singlefile);
$entry->published = $this->singlefile->get_timecreated();
$entry->updated = $this->singlefile->get_timemodified();
$entry->add_category('offline', 'resource_type');
$entry = new portfolio_format_leap2a_file($this->singlefile->get_filename(), $this->singlefile);
$leapwriter->add_entry($entry);
return $this->exporter->write_new_file($leapwriter->to_xml(), $this->exporter->get('format')->manifest_name(), true);
}
@ -251,10 +247,7 @@ class forum_portfolio_caller extends portfolio_module_caller_base {
$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
$entry->add_attachment($file);
}
$leapwriter->link_files($entry, $this->keyedfiles[$post->id], 'forumpost' . $post->id . 'attachment');
}
$entry->add_category('web', 'resource_type');
$leapwriter->add_entry($entry);

View file

@ -155,7 +155,7 @@ class glossary_full_portfolio_caller extends portfolio_module_caller_base {
$entry->published = $e->timecreated;
$entry->updated = $e->timemodified;
if (!empty($this->keyedfiles[$e->id])) {
$entry->add_attachments($this->keyedfiles[$e->id]);
$writer->link_files($entry, $this->keyedfiles[$e->id], 'glossaryentry' . $e->id . 'file');
foreach ($this->keyedfiles[$e->id] as $file) {
$this->exporter->copy_existing_file($file);
}
@ -259,7 +259,7 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
$context = get_context_instance(CONTEXT_MODULE, $maincm->id);
}
}
$this->aliases = $DB->get_records('glossary_alias', array('entryid'=>$this->entryid));
$this->aliases = $DB->get_record('glossary_alias', array('entryid'=>$this->entryid));
$fs = get_file_storage();
$this->multifiles = array_merge(
$fs->get_area_files($context->id, 'mod_glossary', 'attachment', $this->entry->id, "timemodified", false),
@ -315,7 +315,7 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
$entry->published = $this->entry->timecreated;
$entry->updated = $this->entry->timemodified;
if ($this->multifiles) {
$entry->add_attachments($this->multifiles);
$writer->link_files($entry, $this->multifiles, 'glossaryentry' . $this->entry->id . 'file');
}
if ($this->categories) {
foreach ($this->categories as $cat) {
@ -374,9 +374,11 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
public static function entry_content($course, $cm, $glossary, $entry, $aliases, $format) {
global $OUTPUT, $DB;
$entry = clone $entry;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$options = new object();
$options->para = false;
$options->trusted = $entry->definitiontrust;
$options->context = $context;
$output = '<table class="glossarypost dictionary" cellspacing="0">' . "\n";
$output .= '<tr valign="top">' . "\n";
@ -386,7 +388,6 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
$output .= format_text($OUTPUT->heading('<span class="nolink">' . $entry->concept . '</span>', 3, 'nolink'), FORMAT_MOODLE, $options);
$output .= '</div> ' . "\n";
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$entry->definition = portfolio_rewrite_pluginfile_urls($entry->definition, $context->id, 'mod_glossary', 'entry', $entry->id, $format);
@ -398,13 +399,14 @@ class glossary_entry_portfolio_caller extends portfolio_module_caller_base {
$output .= '</td></tr>' . "\n";
if (!empty($aliases)) {
$aliases = explode(',', $aliases->alias);
$output .= '<tr valign="top"><td class="entrylowersection">';
$key = (count($aliases) == 1) ? 'alias' : 'aliases';
$output .= get_string($key, 'glossary') . ': ';
foreach ($aliases as $alias) {
$output .= s($alias) . ',';
}
$output .= substr($output, 0, -1);
$output = substr($output, 0, -1);
$output .= '</td></tr>' . "\n";
}