/** * Export the artefacts */ private function export_artefacts() { $progressstart = 30; $progressend = 70; $artefacts = $this->get('artefacts'); $artefactcount = count($artefacts); $i = 0; foreach ($artefacts as $artefact) { if ($i++ % 10 == 1) { $percent = intval($progressstart + $i / $artefactcount * ($progressend - $progressstart)); $this->notify_progress_callback($percent, "Exporting artefacts: {$i}/{$artefactcount}"); } $element = null; // go see if we have to do anything special for this artefact type. try { safe_require('export', 'leap/' . $artefact->get_plugin_name()); $classname = 'LeapExportElement' . ucfirst($artefact->get('artefacttype')); if (class_exists($classname)) { $element = new $classname($artefact, $this); } } catch (Exception $e) { } // overriding this is not required. if (is_null($element)) { $element = new LeapExportElement($artefact, $this); } if (array_key_exists($artefact->get_plugin_name(), $this->specialcases) && !$element->override_plugin_specialcase()) { $this->specialcases[$artefact->get_plugin_name()][] = $artefact; continue; } if (!$element->is_leap()) { continue; } $element->add_attachments(); $element->assign_smarty_vars(); $this->xml .= $element->get_export_xml(); } }
/** * Export the artefacts */ private function export_artefacts() { $progressstart = 50; $progressend = 80; $artefacts = $this->get('artefacts'); $artefactcount = count($artefacts); $i = 0; foreach ($artefacts as $artefact) { if ($i++ % 3 == 0) { $percent = intval($progressstart + $i / $artefactcount * ($progressend - $progressstart)); $this->notify_progress_callback($percent, get_string('exportingartefactsprogress', 'export', $i, $artefactcount)); } $element = null; // go see if we have to do anything special for this artefact type. if (safe_require('export', 'leap/' . $artefact->get_plugin_name(), 'lib.php', 'require_once', true)) { $classname = 'LeapExportElement' . ucfirst($artefact->get('artefacttype')); if (class_exists($classname)) { $element = new $classname($artefact, $this); } if (is_null($element)) { $element = new LeapExportElement($artefact, $this); } if (array_key_exists($artefact->get_plugin_name(), $this->specialcases) && !$element->override_plugin_specialcase()) { $this->specialcases[$artefact->get_plugin_name()][] = $artefact; continue; } if (!$element->is_leap()) { continue; } $element->add_attachments(); $element->assign_smarty_vars(); $this->xml .= $element->get_export_xml(); } } }
/** * Export the artefacts */ private function export_artefacts() { $progressstart = 50; $progressend = 80; $artefacts = $this->get('artefacts'); $artefactcount = count($artefacts); $i = 0; foreach ($artefacts as $artefact) { if ($i++ % 3 == 0) { $percent = intval($progressstart + $i / $artefactcount * ($progressend - $progressstart)); $this->notify_progress_callback($percent, get_string('exportingartefactsprogress', 'export', $i, $artefactcount)); } $element = null; // go see if we have to do anything special for this artefact type. if (safe_require('export', 'leap/' . $artefact->get_plugin_name(), 'lib.php', 'require_once', true)) { $classname = 'LeapExportElement' . ucfirst($artefact->get('artefacttype')); if (class_exists($classname)) { $element = new $classname($artefact, $this); } if (is_null($element)) { $element = new LeapExportElement($artefact, $this); } if (array_key_exists($artefact->get_plugin_name(), $this->specialcases) && !$element->override_plugin_specialcase()) { $this->specialcases[$artefact->get_plugin_name()][] = $artefact; continue; } if (!$element->is_leap()) { continue; } try { $element->add_attachments(); $element->assign_smarty_vars(); $this->xml .= $element->get_export_xml(); } catch (FileNotFoundException $e) { // If we don't find a file on disk, just continue the export, // but leave this artefact out. $this->messages[] = $e->getMessage(); log_debug('Missing file in leap2a export for artefact ' . $artefact->get('id')); } } } }