ÿØÿà JFIF    ÿÛ „  ( %!1"%)+...383-7(-.+  -%%--------+------------/----------------------------ÿÀ  ¶" ÿÄ     ÿÄ @    !1AQaq‘¡"±ÁÑð2’BRráS‚ñ3b¢CT²Ò #cÿÄ    ÿÄ '   1!AQ2a"‘±#ÿÚ   ? ò(/p‘—–¢·,M|¯G»R£üešT. ôŸEoCFñ‡ 4ÔkåóxR|µÁ¨ÓDà!Ç´µ˜‡p ÍQ‹§!þž^õWsŒy  åÁ§$á«%ºq˜™JyyË0y«^Ϗ -3ÃÏËÈ£Æ\P’ä„s&•‹Üs üô'àWt¹pñCp$bÚF`·7.^)¾!)ÒÙ˜–ÅÏš^h¾ø³·ìe±ŒaeÖ—Í,e=B}Jéߦ$$½—šÙÜCC¯¶è8β–Åkèwx LÉngT±æ¹£Ócœ¿Í/©Éÿ ‰ÚCÒ­mq;Tt¶–}0"zÖPcd1š­¤tˆ„ÐÓâqú[™öUCŠ2޿د­É(¸ßúçšmW,Ò ºf‹Ån™ÄLêÁ8üÁkÁ€L¥ÍuJ1œôrÂSŒÓöt!7EUíïb)AËi¬â-ÙHk8òÁiXYwÅ)O^"ÇØriÛô{»wRUKÙÏÚlÓ¬€‚’שT ] ªb—ÊîKC^×M“xùäñz¬zJ× {4[¹M'IÆeH1LCWÕ]œûº WDæà°OÅ‚¹c²ÞuA–rL`HšpCez‡V’— Ž‚Ë„–ñ­'µR0ÕÖ=À:±G»C\nÆÉ5*¢ †3šhQ4ýÒi$Õ1"Ü]¢p-q3zcQ$ªö¨¥æf›‘»´ÝÚHá„e²JÇ–iÊ:·à¬Øc5Åk»Laª*wi [0Ówk ¦a¦0Õ²ÅÅ‚T¸’³q:Æ<¹ú Ò˜Æ}2VE•Ѐp¡Ô3Úº …h³^LJºçì¥Ánó|˜ÖˆÎˆ+« ¦dø‘Mº–d\ªDðÛ„Ì×LÝ——Ð9Ç|•FèçVm™¨€™3õS–9Äå¢<̉Ìm¢±`·º˜&Z²ž Ë®D«¶»6™‰©­HÈ Àá«h­i³04æ’hxœi3ï¨(ÓL·†‹¶ËpŒ ƒÜÒ? :õdsÀ –3æÓ·Üjâ¬9—]8n¼&]I F£¼…ì–—Œ0v°LǐÅfÛ2TÖ’aµ˜N@ÖBSÏ^à´4-±°b×nÈÈœÆD=KdŒø…ÄÈK,›ÖR§fjü$^ÔÎ!„6^ s:Üun\ôkCÞò÷<—Lúl Í›G¹ÀPá¼Nc¡šÒ…ÙWͳœ±vÊáЄ×9‹P‰cEØ‘™›µŸP<×g1 º©Ø¬wiÁ^l5× I/';Ë+´Z‡ÓÄFÕp[Èð’ HÄ ó 9¬Dl4“é±Ï”V=^Hð;žLädÉa‚°Ë,#/Ž~²BÔÛ QãñQtIeórVB,ÏÂf‹4#Μc‹É3ZIÖ Œ¢¥·üxa‡Ãçè„jŠ[5 Ä!U?,3žÎ×…ðdÓ÷háŠA‰ìÄ4÷ÃÜZÃE{‰®+W\ZÍE[‰»µk»MÝ­`¢©†˜ÃV‹-f¢¡†¢a«eŠ%«Y¨©q%jâd,Ôq`) ¤¦…šˆ ¦E>0Ùb²t–Ÿ  ÷jsςҒKÈcø(é›;k(’#ôŒQ ™C> õ³M9óºÆµ¤çâ;uÀ)5>RÔ¸fÓ~Ȧ—’-$fe«"FâUˆÊwµPÏu w+"åÉó¨6s™Û9(À¨ù©hE°½†n`m~“@©›p!Vkhµ Á1šbEqqÊ@ºèl›2 –Yã%‘‚hÛ{a¶‡ÅÞM²¬çL34®Çl]®‹ŽØŒm'RÜe35æöˆ­Á­ cP9šeÁköo´L³Ì=p8]”‡B¶,šº|ɏdzXˆØk*ÇÚ{#ñ‰pã(€¶‡9ý'šÜ³½¯kƒ†Â’ëSOƒ•Å®H6+a¢µˆ‹Y¨b˜b+XˆÖ!°u!¢"µˆˆn2ˆ Å0Ä`Å Ô®c(ÓÜGº•Ä»Œ âWî%q.áÐÄ÷î%umÍ£+ÜQ,Vn¦-GphU¸¢X­&,Gt ·K¢ÅÅ·¥RÄÊÉbKn N­R2g$VµÕó Qr#–ÓZUÏð0ÎtÙÀœz ëöo“Îk¯n„T°"SÞ+³/…€½"ižãO%Í%&Δâ‘ËØ´IˆÓ°Ë‰ÞM3.™yçÁzit›`4C`k¢¼á!álÄï sÂ[×!¤l¾æo"ƒIÔ'@ªu)3›ô®“@Z à¾] üœ'‡4¸PÞkÁ-qÄH‰ÓÍBd´ÿ —¹°ÄA&ÊUC„öz‚‚RæŠtf¬>˜ÑidšEçÑL÷áý¡V±h§­c¿¥¨ƒ@g¼…Ýö^ÞËc.ž„æ“I[ ª+·zÐÒÚ,½Ð»¶€C›7jk$๖€Ž¾ÅÙpp¶ÍþéΤ ½ØÎŒq ñpæžÅ¥#Øâ49ÃÂK^MYV“,¶Éz_òæ:…;Õ«¦I3âJ£¤û5$7Èxün\â]Êe¯(Ÿ&Ž‹¶2<6Ćf× æ¢ƱqWı[(ÙÂŽç‚T7¨@ÈÉÍß‚ïÙ"&3TYlGށ†)†#5ŠA©^T2ÆÁ†)©†©†¤yGXÁ†©"†)©¼ÅV WS†#©]R–r‹q5ÕbâWþBh¯u+ªÅÄ×ü„nÑ^êkªÁj‰jeœWˆÕÕ`µDµ2Ì+Ä µDµµ5Ô{¤Þ0RF’H÷AÛ<ÊÁ§ ƈæ0Ñ£ê4 öÚµ[¬/1²€â<-¬šö²r×0o×w ´xÐÒË„ g01¬„åEM蛇Ã\6µE›‘fÙO k÷CºnÓ1`iîÒ² áÂ!ÑLÄÿ ³¬\õ*:M=Ç»c‹2[‰ØsÕLò\ŒK L^™üÄN\¶#» Ç\……ßïIœÉ$¸ÎñÍ®ÔHÇ Ûí/´>Li”„†g^$ 7NÍÑÑ2M2ªNg=k½Ð}Ÿl6‡ —JWˆ”ÞéT·+µ¦üÂFè¢Vs6ýÆ4»2+2IÝ9ô9®ÇGÙÇ1+Ä8;*Õ§ž½D*îÑWÚçá3Ma¤·ˆ¥t}š²Ü…Q+Æüµ8HíS”üxGéÁˆ¦Ël„éÈ 5 µÄƒ6äÜ(kIš¯S†fÖ&¸®×v|Äyˆ*禌Éù@7-®Ä[]ÎÖ¿ê`º…=:…žJVnݳvðÖKE¼‚ »mà ÷f®:Ë ™–4rð¡4` ܹçž~‹C=œ…¾Ïj|VDtK.ƒ"9 Ï ­–éXá³6WÒïIL-Ї Ç PK\MUOr r entity.label.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc_label extends entities { public function generate_node() { cc2moodle::log_action('Creating Labels mods'); $response = ''; $sheet_mod_label = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL); if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_LABEL] as $instance) { $response .= $this->create_node_course_modules_mod_label($sheet_mod_label, $instance); } } return $response; } private function create_node_course_modules_mod_label($sheet_mod_label, $instance) { if ($instance['deep'] <= ROOT_DEEP) { return ''; } $find_tags = array('[#mod_instance#]', '[#mod_name#]', '[#mod_content#]', '[#date_now#]'); $title = isset($instance['title']) && !empty($instance['title']) ? $instance['title'] : 'Untitled'; $content = "\"Folder\" {$title}"; $replace_values = array($instance['instance'], self::safexml($title), self::safexml($content), time()); return str_replace($find_tags, $replace_values, $sheet_mod_label); } } PK\v:entity11.lti.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc11_lti extends entities11 { public function generate_node() { cc2moodle::log_action('Creating BasicLTI mods'); $response = ''; if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_LTI])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_LTI] as $instance) { $response .= $this->create_node_course_modules_mod_basiclti($instance); } } return $response; } private function create_node_course_modules_mod_basiclti($instance) { $sheet_mod_basiclti = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LTI); $topic_data = $this->get_basiclti_data($instance); $result = ''; if (!empty($topic_data)) { $find_tags = array('[#mod_instance#]' , '[#mod_basiclti_name#]' , '[#mod_basiclti_intro#]' , '[#mod_basiclti_timec#]' , '[#mod_basiclti_timem#]' , '[#mod_basiclti_toolurl#]', '[#mod_basiclti_icon#]' ); $replace_values = array($instance['instance'], $topic_data['title'], $topic_data['description'], time(),time(), $topic_data['launchurl'], $topic_data['icon'] ); $result = str_replace($find_tags, $replace_values, $sheet_mod_basiclti); } return $result; } protected function getValue($node, $default = '') { $result = $default; if (is_object($node) && ($node->length > 0) && !empty($node->item(0)->nodeValue)) { $result = htmlspecialchars(trim($node->item(0)->nodeValue), ENT_COMPAT, 'UTF-8', false); } return $result; } public function get_basiclti_data($instance) { $topic_data = array(); $basiclti_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($basiclti_file)) { $basiclti_file_path = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $basiclti_file; $basiclti_file_dir = dirname($basiclti_file_path); $basiclti = $this->load_xml_resource($basiclti_file_path); if (!empty($basiclti)) { $xpath = cc2moodle::newx_path($basiclti, cc112moodle::$basicltins); $topic_title = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:title'),'Untitled'); $blti_description = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:description')); $launch_url = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:launch_url')); $launch_icon = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:icon')); $tool_raw = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:code'),null); $tool_url = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:url'),null); $tool_desc = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:description'),null); $topic_data['title' ] = $topic_title; $topic_data['description'] = $blti_description; $topic_data['launchurl' ] = $launch_url; $topic_data['icon' ] = $launch_icon; $topic_data['orgid' ] = $tool_raw; $topic_data['orgurl' ] = $tool_url; $topic_data['orgdesc' ] = $tool_desc; } } return $topic_data; } } PK\ entity11.resource.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc11_resource extends entities11 { public function generate_node() { cc112moodle::log_action('Creating Resource mods'); $response = ''; $sheet_mod_resource = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE); if (!empty(cc112moodle::$instances['instances'][MOODLE_TYPE_RESOURCE])) { foreach (cc112moodle::$instances['instances'][MOODLE_TYPE_RESOURCE] as $instance) { $response .= $this->create_node_course_modules_mod_resource($sheet_mod_resource, $instance); } } return $response; } private function create_node_course_modules_mod_resource($sheet_mod_resource, $instance) { global $CFG; require_once($CFG->libdir.'/validateurlsyntax.php'); $link = ''; $mod_alltext = ''; $mod_summary = ''; $xpath = cc112moodle::newx_path(cc112moodle::$manifest, cc112moodle::$namespaces); if ($instance['common_cartriedge_type'] == cc112moodle::CC_TYPE_WEBCONTENT || $instance['common_cartriedge_type'] == cc112moodle::CC_TYPE_ASSOCIATED_CONTENT) { $resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/@href'); if ($resource->length > 0) { $resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : ''; } else { $resource = ''; } if (empty($resource)) { unset($resource); $resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href'); if ($resource->length > 0) { $resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : ''; } else { $resource = ''; } } if (!empty($resource)) { $link = $resource; } } if ($instance['common_cartriedge_type'] == cc112moodle::CC_TYPE_WEBLINK) { $external_resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href')->item(0)->nodeValue; if ($external_resource) { $resource = $this->load_xml_resource(cc112moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $external_resource); if (!empty($resource)) { $xpath = cc112moodle::newx_path($resource, cc112moodle::$resourcens); $resource = $xpath->query('/wl:webLink/wl:url/@href'); if ($resource->length > 0) { $rawlink = $resource->item(0)->nodeValue; if (!validateUrlSyntax($rawlink, 's+')) { $changed = rawurldecode($rawlink); if (validateUrlSyntax($changed, 's+')) { $link = $changed; } else { $link = 'http://invalidurldetected/'; } } else { $link = htmlspecialchars(trim($rawlink), ENT_COMPAT, 'UTF-8', false); } } } } } $find_tags = array('[#mod_instance#]', '[#mod_name#]', '[#mod_type#]', '[#mod_reference#]', '[#mod_summary#]', '[#mod_alltext#]', '[#mod_options#]', '[#date_now#]'); $mod_type = 'file'; $mod_options = 'objectframe'; $mod_reference = $link; //detected if we are dealing with html file if (!empty($link) && ($instance['common_cartriedge_type'] == cc112moodle::CC_TYPE_WEBCONTENT)) { $ext = strtolower(pathinfo($link, PATHINFO_EXTENSION)); if (in_array($ext, array('html', 'htm', 'xhtml'))) { $mod_type = 'html'; //extract the content of the file $rootpath = realpath(cc112moodle::$path_to_manifest_folder); $htmlpath = realpath($rootpath . DIRECTORY_SEPARATOR . $link); $dirpath = dirname($htmlpath); if (file_exists($htmlpath)) { $fcontent = file_get_contents($htmlpath); $mod_alltext = clean_param($this->prepare_content($fcontent), PARAM_CLEANHTML); $mod_reference = ''; $mod_options = ''; /** * try to handle embedded resources * images, linked static resources, applets, videos */ $doc = new DOMDocument(); $cdir = getcwd(); chdir($dirpath); try { $doc->loadHTML($mod_alltext); $xpath = new DOMXPath($doc); $attributes = array('href', 'src', 'background', 'archive', 'code'); $qtemplate = "//*[@##][not(contains(@##,'://'))]/@##"; $query = ''; foreach ($attributes as $attrname) { if (!empty($query)) { $query .= " | "; } $query .= str_replace('##', $attrname, $qtemplate); } $list = $xpath->query($query); $searches = array(); $replaces = array(); foreach ($list as $resrc) { $rpath = $resrc->nodeValue; $rtp = realpath($rpath); if (($rtp !== false) && is_file($rtp)) { //file is there - we are in business $strip = str_replace("\\", "/", str_ireplace($rootpath, '', $rtp)); $encoded_file = '$@FILEPHP@$'.str_replace('/', '$@SLASH@$', $strip); $searches[] = $resrc->nodeValue; $replaces[] = $encoded_file; } } $mod_alltext = str_replace($searches, $replaces, $mod_alltext); } catch (Exception $e) { //silence the complaints } chdir($cdir); $mod_alltext = self::safexml($mod_alltext); } } } $replace_values = array($instance['instance'], self::safexml($instance['title']), $mod_type, $mod_reference, '', $mod_alltext, $mod_options, time()); return str_replace($find_tags, $replace_values, $sheet_mod_resource); } } PK\wP$H,H,entities.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class entities { /** * Prepares convert for inclusion into XML * * @param string $value * @return string */ public static function safexml($value) { $result = htmlspecialchars(html_entity_decode($value, ENT_QUOTES, 'UTF-8'), ENT_NOQUOTES, 'UTF-8', false); return $result; } protected function prepare_content($content) { $result = $content; if (empty($result)) { return ''; } $encoding = null; $xml_error = new libxml_errors_mgr(); $dom = new DOMDocument(); $dom->validateOnParse = false; $dom->strictErrorChecking = false; if ($dom->loadHTML($content)) { $encoding = $dom->xmlEncoding; } if (empty($encoding)) { $encoding = mb_detect_encoding($content, 'auto', true); } if (!empty($encoding) && !mb_check_encoding($content, 'UTF-8')) { $result = mb_convert_encoding($content, 'UTF-8', $encoding); } // See if we can strip off body tag and anything outside of it. foreach (array('body', 'html') as $tagname) { $regex = str_replace('##', $tagname, "/<##[^>]*>(.+)<\/##>/is"); if (preg_match($regex, $result, $matches)) { $result = $matches[1]; break; } } return $result; } public function load_xml_resource($path_to_file) { $resource = new DOMDocument(); cc2moodle::log_action('Load the XML resource file: '.$path_to_file); if (!$resource->load($path_to_file)) { cc2moodle::log_action('Cannot load the XML resource file: ' . $path_to_file, false); } return $resource; } public function update_sources($html, $root_path = '') { $document = $this->load_html($html); $tags = array('img' => 'src' , 'a' => 'href'); foreach ($tags as $tag => $attribute) { $elements = $document->getElementsByTagName($tag); foreach ($elements as $element) { $attribute_value = $element->getAttribute($attribute); $protocol = parse_url($attribute_value, PHP_URL_SCHEME); if (empty($protocol)) { $attribute_value = str_replace("\$IMS-CC-FILEBASE\$", "", $attribute_value); $attribute_value = $this->full_path($root_path . "/" . $attribute_value, "/"); $attribute_value = "\$@FILEPHP@\$" . "/" . $attribute_value; } $element->setAttribute($attribute, $attribute_value); } } $html = $this->html_insidebody($document); return $html; } public function full_path($path, $dir_sep = DIRECTORY_SEPARATOR) { $token = '$IMS-CC-FILEBASE$'; $path = str_replace($token, '', $path); if (is_string($path) && ($path != '')) { $dot_dir = '.'; $up_dir = '..'; $length = strlen($path); $rtemp = trim($path); $start = strrpos($path, $dir_sep); $can_continue = ($start !== false); $result = $can_continue ? '' : $path; $rcount = 0; while ($can_continue) { $dir_part = ($start !== false) ? substr($rtemp, $start + 1, $length - $start) : $rtemp; $can_continue = ($dir_part !== false); if ($can_continue) { if ($dir_part != $dot_dir) { if ($dir_part == $up_dir) { $rcount++; } else { if ($rcount > 0) { $rcount --; } else { $result = ($result == '') ? $dir_part : $dir_part . $dir_sep . $result; } } } $rtemp = substr($path, 0, $start); $start = strrpos($rtemp, $dir_sep); $can_continue = (($start !== false) || (strlen($rtemp) > 0)); } } } return $result; } public function include_titles($html) { $document = $this->load_html($html); $images = $document->getElementsByTagName('img'); foreach ($images as $image) { $src = $image->getAttribute('src'); $alt = $image->getAttribute('alt'); $title = $image->getAttribute('title'); $filename = pathinfo($src); $filename = $filename['filename']; $alt = empty($alt) ? $filename : $alt; $title = empty($title) ? $filename : $title; $image->setAttribute('alt', $alt); $image->setAttribute('title', $title); } $html = $this->html_insidebody($document); return $html; } public function get_external_xml($identifier) { $xpath = cc2moodle::newx_path(cc2moodle::$manifest, cc2moodle::$namespaces); $files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="'. $identifier.'"]/imscc:file/@href'); if (empty($files)) { $response = ''; } else { $response = $files->item(0)->nodeValue; } return $response; } public function move_files($files, $destination_folder) { global $CFG, $OUTPUT; if (!empty($files)) { foreach ($files as $file) { $source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file; $destination = $destination_folder . DIRECTORY_SEPARATOR . $file; $destination_directory = dirname($destination); cc2moodle::log_action('Copy the file: ' . $source . ' to ' . $destination); if (!file_exists($destination_directory)) { mkdir($destination_directory, $CFG->directorypermissions, true); } $copy_success = true; if (is_file($source)) { $copy_success = @copy($source, $destination); } if (!$copy_success) { echo $OUTPUT->notification('WARNING: Cannot copy the file ' . $source . ' to ' . $destination); cc2moodle::log_action('Cannot copy the file ' . $source . ' to ' . $destination, false); } } } } protected function get_all_files() { global $CFG; $all_files = array(); $xpath = cc2moodle::newx_path(cc2moodle::$manifest, cc2moodle::$namespaces); foreach (cc2moodle::$restypes as $type) { $files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@type="' . $type . '"]/imscc:file/@href'); if (!empty($files) && ($files->length > 0)) { foreach ($files as $file) { // Omit html files. $ext = strtolower(pathinfo($file->nodeValue, PATHINFO_EXTENSION)); if (in_array($ext, array('html', 'htm', 'xhtml'))) { continue; } $all_files[] = $file->nodeValue; } } unset($files); } // Are there any labels? $xquery = "//imscc:item/imscc:item/imscc:item[imscc:title][not(@identifierref)]"; $labels = $xpath->query($xquery); if (!empty($labels) && ($labels->length > 0)) { $tname = 'course_files'; $dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname; $rfpath = 'files.gif'; $fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath; if (!file_exists($dpath)) { mkdir($dpath, $CFG->directorypermissions, true); } // Copy the folder.gif file. $folder_gif = "{$CFG->dirroot}/pix/i/files.gif"; copy($folder_gif, $fpath); $all_files[] = $rfpath; } $all_files = empty($all_files) ? '' : $all_files; return $all_files; } public function move_all_files() { $files = $this->get_all_files(); if (!empty($files)) { $this->move_files($files, cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files', true); } } /** * @param string $html * @return DOMDocument */ private function load_html($html) { // Need to make sure that the html passed has charset meta tag. $metatag = ''; if (strpos($html, $metatag) === false) { $html = ''.$metatag.''.$html.''; } $document = new DOMDocument(); @$document->loadHTML($html); return $document; } /** * @param DOMDocument $domdocument * @return string */ private function html_insidebody($domdocument) { $html = ''; $bodyitems = $domdocument->getElementsByTagName('body'); if ($bodyitems->length > 0) { $body = $bodyitems->item(0); $html = str_ireplace(array('', ''), '', $body->C14N()); } return $html; } public function generate_random_string($length = 6) { $response = ''; $source = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; if ($length > 0) { $response = ''; $source = str_split($source, 1); for ($i = 1; $i <= $length; $i++) { $num = mt_rand(1, count($source)); $response .= $source[$num - 1]; } } return $response; } public function truncate_text($text, $max, $remove_html) { if ($max > 10) { $text = substr($text, 0, ($max - 6)) . ' [...]'; } else { $text = substr($text, 0, $max); } $text = $remove_html ? strip_tags($text) : $text; return $text; } } PK\Q-RRcc_lib/cc_version1.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_utils.php'); require_once('cc_version_base.php'); require_once('cc_organization.php'); /** * Version 1 class of Common Cartridge * */ class cc_version1 extends cc_version_base { const webcontent = 'webcontent'; const questionbank = 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank'; const assessment = 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment'; const associatedcontent = 'associatedcontent/imscc_xmlv1p0/learning-application-resource'; const discussiontopic = 'imsdt_xmlv1p0'; const weblink = 'imswl_xmlv1p0'; /** @var array CC URL profiles. */ protected $ccnsnames = []; public static $checker = array(self::webcontent, self::assessment, self::associatedcontent, self::discussiontopic, self::questionbank, self::weblink); /** * Validate if the type are valid or not * * @param string $type * @return bool */ public function valid($type) { return in_array($type, self::$checker); } public function __construct() { $this->ccnamespaces = array('imscc' => 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1', 'lomimscc' => 'http://ltsc.ieee.org/xsd/imscc/LOM', 'lom' => 'http://ltsc.ieee.org/xsd/LOM', 'voc' => 'http://ltsc.ieee.org/xsd/LOM/vocab', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance' ); $this->ccnsnames = array( 'imscc' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/imscp_v1p2_localised.xsd', 'lom' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_2/lomLoose_localised.xsd', 'lomimscc' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_1/lomLoose_localised.xsd', 'voc' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_2/vocab/loose.xsd' ); $this->ccversion = '1.0.0'; $this->camversion = '1.0.0'; $this->_generator = 'Moodle 2 Common Cartridge generator'; } protected function on_create(DOMDocument &$doc, $rootmanifestnode = null, $nmanifestID = null) { $doc->formatOutput = true; $doc->preserveWhiteSpace = true; $this->manifestID = is_null($nmanifestID) ? cc_helpers::uuidgen('M_') : $nmanifestID; $mUUID = $doc->createAttribute('identifier'); $mUUID->nodeValue = $this->manifestID; if (is_null($rootmanifestnode)) { if (!empty($this->_generator)) { $comment = $doc->createComment($this->_generator); $doc->appendChild($comment); } $rootel = $doc->createElementNS($this->ccnamespaces['imscc'], 'manifest'); $rootel->appendChild($mUUID); $doc->appendChild($rootel); // Add all namespaces. foreach ($this->ccnamespaces as $key => $value) { $dummy_attr = $key.":dummy"; $doc->createAttributeNS($value, $dummy_attr); } // Add location of schemas. $schemaLocation = ''; foreach ($this->ccnsnames as $key => $value) { $vt = empty($schemaLocation) ? '' : ' '; $schemaLocation .= $vt.$this->ccnamespaces[$key].' '.$value; } $aSchemaLoc = $doc->createAttributeNS($this->ccnamespaces['xsi'], 'xsi:schemaLocation'); $aSchemaLoc->nodeValue = $schemaLocation; $rootel->appendChild($aSchemaLoc); } else { $rootel = $doc->createElementNS($this->ccnamespaces['imscc'], 'imscc:manifest'); $rootel->appendChild($mUUID); } $metadata = $doc->createElementNS($this->ccnamespaces['imscc'], 'metadata'); $schema = $doc->createElementNS($this->ccnamespaces['imscc'], 'schema', 'IMS Common Cartridge'); $schemaversion = $doc->createElementNS($this->ccnamespaces['imscc'], 'schemaversion', $this->ccversion); $metadata->appendChild($schema); $metadata->appendChild($schemaversion); $rootel->appendChild($metadata); if (!is_null($rootmanifestnode)) { $rootmanifestnode->appendChild($rootel); } $organizations = $doc->createElementNS($this->ccnamespaces['imscc'], 'organizations'); $rootel->appendChild($organizations); $resources = $doc->createElementNS($this->ccnamespaces['imscc'], 'resources'); $rootel->appendChild($resources); return true; } protected function update_attribute(DOMDocument &$doc, $attrname, $attrvalue, DOMElement &$node) { $busenew = (is_object($node) && $node->hasAttribute($attrname)); $nResult = null; if (!$busenew && is_null($attrvalue)) { $node->removeAttribute($attrname); } else { $nResult = $busenew ? $node->getAttributeNode($attrname) : $doc->createAttribute($attrname); $nResult->nodeValue = $attrvalue; if (!$busenew) { $node->appendChild($nResult); } } return $nResult; } protected function update_attribute_ns(DOMDocument &$doc, $attrname, $attrnamespace,$attrvalue, DOMElement &$node) { $busenew = (is_object($node) && $node->hasAttributeNS($attrnamespace, $attrname)); $nResult = null; if (!$busenew && is_null($attrvalue)) { $node->removeAttributeNS($attrnamespace, $attrname); } else { $nResult = $busenew ? $node->getAttributeNodeNS($attrnamespace, $attrname) : $doc->createAttributeNS($attrnamespace, $attrname); $nResult->nodeValue = $attrvalue; if (!$busenew) { $node->appendChild($nResult); } } return $nResult; } protected function get_child_node(DOMDocument &$doc, $itemname, DOMElement &$node) { $nlist = $node->getElementsByTagName($itemname); $item = is_object($nlist) && ($nlist->length > 0) ? $nlist->item(0) : null; return $item; } protected function update_child_item(DOMDocument &$doc, $itemname, $itemvalue, DOMElement &$node, $attrtostore=null) { $tnode = $this->get_child_node($doc, 'title', $node); $usenew = is_null($tnode); $tnode = $usenew ? $doc->createElementNS($this->ccnamespaces['imscc'], $itemname) : $tnode; if (!is_null($attrtostore)) { foreach ($attrtostore as $key => $value) { $this->update_attribute($doc, $key, $value, $tnode); } } $tnode->nodeValue = $itemvalue; if ($usenew) { $node->appendChild($tnode); } } protected function update_items($items, DOMDocument &$doc, DOMElement &$xmlnode) { foreach ($items as $key => $item) { $itemnode = $doc->createElementNS($this->ccnamespaces['imscc'], 'item'); $this->update_attribute($doc, 'identifier' , $key , $itemnode); $this->update_attribute($doc, 'identifierref', $item->identifierref, $itemnode); $this->update_attribute($doc, 'parameters' , $item->parameters , $itemnode); if (!empty($item->title)) { $titlenode = $doc->createElementNS($this->ccnamespaces['imscc'], 'title', $item->title); $itemnode->appendChild($titlenode); } if ($item->has_child_items()) { $this->update_items($item->childitems, $doc, $itemnode); } $xmlnode->appendChild($itemnode); } } /** * Create a Resource (How to) * * @param cc_i_resource $res * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_resource(cc_i_resource &$res, DOMDocument &$doc, $xmlnode=null) { $usenew = is_object($xmlnode); $dnode = $usenew ? $xmlnode : $doc->createElementNS($this->ccnamespaces['imscc'], "resource"); $this->update_attribute($doc, 'identifier', $res->identifier, $dnode); $this->update_attribute($doc, 'type', $res->type, $dnode); !is_null($res->href) ? $this->update_attribute($doc, 'href', $res->href, $dnode) : null; $this->update_attribute($doc, 'base', $res->base, $dnode); foreach ($res->files as $file) { $nd = $doc->createElementNS($this->ccnamespaces['imscc'], 'file'); $ndatt = $doc->createAttribute('href'); $ndatt->nodeValue = $file; $nd->appendChild($ndatt); $dnode->appendChild($nd); } $this->resources[$res->identifier] = $res; $this->resources_ind[$res->files[0]] = $res->identifier; foreach ($res->dependency as $dependency) { $nd = $doc->createElementNS($this->ccnamespaces['imscc'], 'dependency'); $ndatt = $doc->createAttribute('identifierref'); $ndatt->nodeValue = $dependency; $nd->appendChild($ndatt); $dnode->appendChild($nd); } return $dnode; } /** * Create an Item Folder (How To) * * @param cc_i_organization $org * @param DOMDocument $doc * @param DOMElement $xmlnode */ protected function create_item_folder(cc_i_organization &$org, DOMDocument &$doc, ?DOMElement &$xmlnode = null) { $itemfoldernode = $doc->createElementNS($this->ccnamespaces['imscc'], 'item'); $this->update_attribute($doc, 'identifier', "root", $itemfoldernode); if ($org->has_items()) { $this->update_items($org->itemlist, $doc, $itemfoldernode); } if (is_null($this->organizations)) { $this->organizations = array(); } $this->organizations[$org->identifier] = $org; $xmlnode->appendChild($itemfoldernode); } /** * Create an Organization (How To) * * @param cc_i_organization $org * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_organization(cc_i_organization &$org, DOMDocument &$doc, $xmlnode = null) { $usenew = is_object($xmlnode); $dnode = $usenew ? $xmlnode : $doc->createElementNS($this->ccnamespaces['imscc'], "organization"); $this->update_attribute($doc, 'identifier', $org->identifier, $dnode); $this->update_attribute($doc, 'structure', $org->structure, $dnode); $this->create_item_folder($org, $doc, $dnode); return $dnode; } /** * Create Metadata For Manifest (How To) * * @param cc_i_metadata_manifest $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_manifest(cc_i_metadata_manifest $met, DOMDocument &$doc, $xmlnode = null) { $dnode = $doc->createElementNS($this->ccnamespaces['lomimscc'], "lom"); if (!empty($xmlnode)) { $xmlnode->appendChild($dnode); } $dnodegeneral = empty($met->arraygeneral) ? null : $this->create_metadata_general($met, $doc, $xmlnode); $dnodetechnical = empty($met->arraytech) ? null : $this->create_metadata_technical($met, $doc, $xmlnode); $dnoderights = empty($met->arrayrights) ? null : $this->create_metadata_rights($met, $doc, $xmlnode); $dnodelifecycle = empty($met->arraylifecycle) ? null : $this->create_metadata_lifecycle($met, $doc, $xmlnode); !is_null($dnodegeneral) ? $dnode->appendChild($dnodegeneral) : null; !is_null($dnodetechnical) ? $dnode->appendChild($dnodetechnical) : null; !is_null($dnoderights) ? $dnode->appendChild($dnoderights) : null; !is_null($dnodelifecycle) ? $dnode->appendChild($dnodelifecycle) : null; return $dnode; } /** * Create Metadata For Resource (How To) * * @param cc_i_metadata_resource $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_resource(cc_i_metadata_resource $met, DOMDocument &$doc, $xmlnode = null) { $dnode = $doc->createElementNS($this->ccnamespaces['lom'], "lom"); !empty($xmlnode) ? $xmlnode->appendChild($dnode) : null; !empty($met->arrayeducational) ? $this->create_metadata_educational($met, $doc, $dnode) : null; return $dnode; } /** * Create Metadata For File (How To) * * @param cc_i_metadata_file $met * @param DOMDocument $doc * @param Object $xmlnode * @return DOMNode */ protected function create_metadata_file(cc_i_metadata_file $met, DOMDocument &$doc, $xmlnode = null) { $dnode = $doc->createElementNS($this->ccnamespaces['lom'], "lom"); !empty($xmlnode) ? $xmlnode->appendChild($dnode) : null; !empty($met->arrayeducational) ? $this->create_metadata_educational($met, $doc, $dnode) : null; return $dnode; } /** * Create General Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_general($met, DOMDocument &$doc, $xmlnode) { $nd = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'general'); foreach ($met->arraygeneral as $name => $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { if ($name != 'language' && $name != 'catalog' && $name != 'entry') { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name); $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'string', $v[1]); $ndatt = $doc->createAttribute('language'); $ndatt->nodeValue = $v[0]; $nd3->appendChild($ndatt); $nd2->appendChild($nd3); $nd->appendChild($nd2); } else { if ($name == 'language') { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name, $v[0]); $nd->appendChild($nd2); } } } } if (!empty($met->arraygeneral['catalog']) || !empty($met->arraygeneral['entry'])) { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'identifier'); $nd->appendChild($nd2); if (!empty($met->arraygeneral['catalog'])) { $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'catalog', $met->arraygeneral['catalog'][0][0]); $nd2->appendChild($nd3); } if (!empty($met->arraygeneral['entry'])) { $nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'entry', $met->arraygeneral['entry'][0][0]); $nd2->appendChild($nd4); } } return $nd; } /** * Create Technical Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_technical($met, DOMDocument &$doc, $xmlnode) { $nd = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'technical'); $xmlnode->appendChild($nd); foreach ($met->arraytech as $name => $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name, $v[0]); $nd->appendChild($nd2); } } return $nd; } /** * Create Rights Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_rights($met, DOMDocument &$doc, $xmlnode) { $nd = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'rights'); foreach ($met->arrayrights as $name => $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { if ($name == 'description') { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name); $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'string', $v[1]); $ndatt = $doc->createAttribute('language'); $ndatt->nodeValue = $v[0]; $nd3->appendChild($ndatt); $nd2->appendChild($nd3); $nd->appendChild($nd2); } else if ($name == 'copyrightAndOtherRestrictions' || $name == 'cost') { $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name); $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'value', $v[0]); $nd2->appendChild($nd3); $nd->appendChild($nd2); } } } return $nd; } /** * Create Lifecycle Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ protected function create_metadata_lifecycle($met, DOMDocument &$doc, $xmlnode) { $nd = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'lifeCycle'); $nd2 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'contribute'); $nd->appendChild($nd2); $xmlnode->appendChild($nd); foreach ($met->arraylifecycle as $name => $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { if ($name == 'role') { $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name); $nd2->appendChild($nd3); $nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'value', $v[0]); $nd3->appendChild($nd4); } else { if ($name == 'date') { $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name); $nd2->appendChild($nd3); $nd4 = $doc->createElementNS($this->ccnamespaces['lomimscc'], 'dateTime', $v[0]); $nd3->appendChild($nd4); } else { $nd3 = $doc->createElementNS($this->ccnamespaces['lomimscc'], $name, $v[0]); $nd2->appendChild($nd3); } } } } return $nd; } /** * Create Education Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ public function create_metadata_educational($met, DOMDocument &$doc, $xmlnode) { $nd = $doc->createElementNS($this->ccnamespaces['lom'], 'educational'); $nd2 = $doc->createElementNS($this->ccnamespaces['lom'], 'intendedEndUserRole'); $nd3 = $doc->createElementNS($this->ccnamespaces['voc'], 'vocabulary'); $xmlnode->appendChild($nd); $nd->appendChild($nd2); $nd2->appendChild($nd3); foreach ($met->arrayeducational as $name => $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { $nd4 = $doc->createElementNS($this->ccnamespaces['voc'], $name, $v[0]); $nd3->appendChild($nd4); } } return $nd; } }PK\c\tcc_lib/cc_weblink.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_general.php'; class url1_resurce_file extends general_cc_file { const deafultname = 'weblink.xml'; protected $rootns = 'wl'; protected $rootname = 'wl:webLink'; protected $ccnamespaces = array('wl' => 'http://www.imsglobal.org/xsd/imswl_v1p0', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('wl' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_5/imswl_v1p0_localised.xsd'); protected $url = null; protected $title = null; protected $href = null; protected $target = '_self'; protected $window_features = null; /** * * Set the url title * @param string $title */ public function set_title($title) { $this->title = self::safexml($title); } /** * * Set the url specifics * @param string $url * @param string $target * @param string $window_features */ public function set_url($url, $target='_self', $window_features=null) { $this->url = $url; $this->target = $target; $this->window_features = $window_features; } protected function on_save() { $this->append_new_element($this->root, 'title', $this->title); $url = $this->append_new_element($this->root, 'url'); $this->append_new_attribute($url, 'href', $this->url); if (!empty($this->target)) { $this->append_new_attribute($url, 'target', $this->target); } if (!empty($this->window_features)) { $this->append_new_attribute($url, 'windowFeatures', $this->window_features); } return true; } } class url11_resurce_file extends url1_resurce_file { protected $rootname = 'webLink'; protected $ccnamespaces = array('wl' => 'http://www.imsglobal.org/xsd/imsccv1p1/imswl_v1p1', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('wl' => 'http://www.imsglobal.org/profile/cc/ccv1p1/ccv1p1_imswl_v1p1.xsd'); protected function on_save() { $rns = $this->ccnamespaces[$this->rootns]; $this->append_new_element_ns($this->root, $rns, 'title', $this->title); $url = $this->append_new_element_ns($this->root, $rns, 'url'); $this->append_new_attribute_ns($url, $rns, 'href', $this->url); if (!empty($this->target)) { $this->append_new_attribute_ns($url, $rns, 'target', $this->target); } if (!empty($this->window_features)) { $this->append_new_attribute_ns($url, $rns, 'windowFeatures', $this->window_features); } return true; } } PK\ejcc_lib/cc_version11.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_version1.php'); /** * Version 1.1 class of Common Cartridge * */ class cc_version11 extends cc_version1 { const webcontent = 'webcontent'; const questionbank = 'imsqti_xmlv1p2/imscc_xmlv1p1/question-bank'; const assessment = 'imsqti_xmlv1p2/imscc_xmlv1p1/assessment'; const associatedcontent = 'associatedcontent/imscc_xmlv1p1/learning-application-resource'; const discussiontopic = 'imsdt_xmlv1p1'; const weblink = 'imswl_xmlv1p1'; const basiclti = 'imsbasiclti_xmlv1p0'; public static $checker = array(self::webcontent, self::assessment, self::associatedcontent, self::discussiontopic, self::questionbank, self::weblink, self::basiclti); /** * Validate if the type are valid or not * * @param string $type * @return bool */ public function valid($type) { return in_array($type, self::$checker); } public function __construct() { $this->ccnamespaces = array('imscc' => 'http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1', 'lomimscc' => 'http://ltsc.ieee.org/xsd/imsccv1p1/LOM/manifest' , 'lom' => 'http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource' , 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance' ); $this->ccnsnames = array('imscc' => 'http://www.imsglobal.org/profile/cc/ccv1p1/ccv1p1_imscp_v1p2_v1p0.xsd' , 'lomimscc' => 'http://www.imsglobal.org/profile/cc/ccv1p1/LOM/ccv1p1_lommanifest_v1p0.xsd', 'lom' => 'http://www.imsglobal.org/profile/cc/ccv1p1/LOM/ccv1p1_lomresource_v1p0.xsd' ); $this->ccversion = '1.1.0'; $this->camversion = '1.1.0'; $this->_generator = 'Moodle 2 Common Cartridge generator'; } protected function update_items($items, DOMDocument &$doc, DOMElement &$xmlnode) { foreach ($items as $key => $item) { $itemnode = $doc->createElementNS($this->ccnamespaces['imscc'], 'item'); $this->update_attribute($doc, 'identifier' , $key , $itemnode); $this->update_attribute($doc, 'identifierref', $item->identifierref, $itemnode); if (!is_null($item->title)) { $titlenode = $doc->createElementNS($this->ccnamespaces['imscc'], 'title'); $titlenode->appendChild(new DOMText($item->title)); $itemnode->appendChild($titlenode); } if ($item->has_child_items()) { $this->update_items($item->childitems, $doc, $itemnode); } $xmlnode->appendChild($itemnode); } } /** * Create Education Metadata (How To) * * @param object $met * @param DOMDocument $doc * @param object $xmlnode * @return DOMNode */ public function create_metadata_educational($met, DOMDocument &$doc, $xmlnode) { $metadata = $doc->createElementNS($this->ccnamespaces['imscc'], 'metadata'); $xmlnode->insertBefore($metadata, $xmlnode->firstChild); $lom = $doc->createElementNS($this->ccnamespaces['lom'], 'lom'); $metadata->appendChild($lom); $educational = $doc->createElementNS($this->ccnamespaces['lom'], 'educational'); $lom->appendChild($educational); foreach ($met->arrayeducational as $value) { !is_array($value) ? $value = array($value) : null; foreach ($value as $v) { $userrole = $doc->createElementNS($this->ccnamespaces['lom'], 'intendedEndUserRole'); $educational->appendChild($userrole); $nd4 = $doc->createElementNS($this->ccnamespaces['lom'], 'source', 'IMSGLC_CC_Rolesv1p1'); $nd5 = $doc->createElementNS($this->ccnamespaces['lom'], 'value', $v[0]); $userrole->appendChild($nd4); $userrole->appendChild($nd5); } } return $metadata; } } PK\_ cc_lib/cc_converter_page.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; require_once 'cc_page.php'; class cc_converter_page extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->cc_type = cc_version11::webcontent; $this->defaultfile = 'page.xml'; $this->defaultname = uniqid().'.html'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new page11_resurce_file(); $title = $this->doc->nodeValue('/activity/page/name'); $intro = $this->doc->nodeValue('/activity/page/intro'); $contextid = $this->doc->nodeValue('/activity/@contextid'); $pagecontent = $this->doc->nodeValue('/activity/page/content'); $rt->set_title($title); $rawname = str_replace(' ', '_', strtolower(trim(clean_param($title, PARAM_FILE)))); if (!empty($rawname)) { $this->defaultname = $rawname.".html"; } $result = cc_helpers::process_linked_files( $pagecontent, $this->manifest, $this->rootpath, $contextid, $outdir, true); $rt->set_content($result[0]); $rt->set_intro($intro); //store everything $this->store($rt, $outdir, $title, $result[1]); return true; } } PK\ cc_lib/cc_general.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'gral_lib/cssparser.php'; require_once 'xmlbase.php'; class general_cc_file extends XMLGenericDocument { /** * * Root element * @var DOMElement */ protected $root = null; protected $rootns = null; protected $rootname = null; protected $ccnamespaces = array(); protected $ccnsnames = array(); public function __construct() { parent::__construct(); foreach ($this->ccnamespaces as $key => $value){ $this->registerNS($key,$value); } } protected function on_create() { $rootel = $this->append_new_element_ns($this->doc, $this->ccnamespaces[$this->rootns], $this->rootname); //add all namespaces foreach ($this->ccnamespaces as $key => $value) { $dummy_attr = "{$key}:dummy"; $this->doc->createAttributeNS($value,$dummy_attr); } // add location of schemas $schemaLocation=''; foreach ($this->ccnsnames as $key => $value) { $vt = empty($schemaLocation) ? '' : ' '; $schemaLocation .= $vt.$this->ccnamespaces[$key].' '.$value; } if (!empty($schemaLocation) && isset($this->ccnamespaces['xsi'])) { $this->append_new_attribute_ns($rootel, $this->ccnamespaces['xsi'], 'xsi:schemaLocation', $schemaLocation); } $this->root = $rootel; } } PK\ecc_lib/cc_converter_quiz.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_converters.php'); require_once('cc_general.php'); require_once('cc_asssesment.php'); require_once('cc_assesment_truefalse.php'); require_once('cc_assesment_essay.php'); require_once('cc_assesment_sfib.php'); class cc_converter_quiz extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path) { $this->cc_type = cc_version11::assessment; $this->defaultfile = 'quiz.xml'; $this->defaultname = assesment11_resurce_file::deafultname; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new assesment11_resurce_file(); $title = $this->doc->nodeValue('/activity/quiz/name'); $rt->set_title($title); // Metadata. $metadata = new cc_assesment_metadata(); $rt->set_metadata($metadata); $metadata->enable_feedback(); $metadata->enable_hints(); $metadata->enable_solutions(); // Attempts. $max_attempts = (int)$this->doc->nodeValue('/activity/quiz/attempts_number'); if ($max_attempts > 0) { // Qti does not support number of specific attempts bigger than 5 (??) if ($max_attempts > 5) { $max_attempts = cc_qti_values::unlimited; } $metadata->set_maxattempts($max_attempts); } // Time limit must be converted into minutes. $timelimit = (int)floor((int)$this->doc->nodeValue('/activity/quiz/timelimit') / 60); if ($timelimit > 0) { $metadata->set_timelimit($timelimit); $metadata->enable_latesubmissions(false); } $contextid = $this->doc->nodeValue('/activity/@contextid'); $result = cc_helpers::process_linked_files( $this->doc->nodeValue('/activity/quiz/intro'), $this->manifest, $this->rootpath, $contextid, $outdir); cc_assesment_helper::add_assesment_description($rt, $result[0], cc_qti_values::htmltype); // Section. $section = new cc_assesment_section(); $rt->set_section($section); // Process the actual questions. $ndeps = cc_assesment_helper::process_questions($this->doc, $this->manifest, $section, $this->rootpath, $contextid, $outdir); if ($ndeps === false) { // No exportable questions in quiz or quiz has no questions // so just skip it. return true; } // Store any additional dependencies. $deps = array_merge($result[1], $ndeps); // Store everything. $this->store($rt, $outdir, $title, $deps); return true; } } PK\9a|cc_lib/cc_basiclti.phpnu[. /** * @package backup-convert * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_general.php'; class basicltil1_resurce_file extends general_cc_file { const deafultname = 'basiclti.xml'; protected $rootns = 'xmlns'; protected $rootname = 'cartridge_basiclti_link'; protected $ccnamespaces = array('xmlns' => 'http://www.imsglobal.org/xsd/imslticc_v1p0', 'blti' => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0', 'lticm' => 'http://www.imsglobal.org/xsd/imslticm_v1p0', 'lticp' => 'http://www.imsglobal.org/xsd/imslticp_v1p0', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('xmlns' => 'http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd', 'blti' => 'http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0p1.xsd', 'lticm' => 'http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd', 'lticp' => 'http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd'); protected $title = 'Untitled'; protected $description = 'description'; protected $custom_properties = array(); protected $extension_properties = array(); protected $extension_platform = null; protected $launch_url = null; protected $secure_launch_url = null; protected $icon = null; protected $secure_icon = null; protected $vendor = false; protected $vendor_code = 'I'; protected $vendor_name = null; protected $vendor_description = null; protected $vendor_url = null; protected $vendor_contact = null; protected $cartridge_bundle = null; protected $cartridge_icon = null; public function set_title($title) { $this->title = self::safexml($title); } public function set_description($description) { $this->description = self::safexml($description); } public function set_launch_url($url) { $this->launch_url = $url; } public function set_secure_launch_url($url) { $this->secure_launch_url = $url; } public function set_launch_icon($icon) { $this->icon = $icon; } public function set_secure_launch_icon($icon) { $this->secure_icon = $icon; } public function set_vendor_code($code) { $this->vendor_code = $code; $this->vendor = true; } public function set_vendor_name($name) { $this->vendor_name = self::safexml($name); $this->vendor = true; } public function set_vendor_description($desc) { $this->vendor_description = self::safexml($desc); $this->vendor = true; } public function set_vendor_url($url) { $this->vendor_url = $url; $this->vendor = true; } public function set_vendor_contact($email) { $this->vendor_contact = array('email' => $email); $this->vendor = true; } public function add_custom_property($property, $value) { $this->custom_properties[$property] = $value; } public function add_extension($extension, $value) { $this->extension_properties[$extension] = $value; } public function set_extension_platform($value) { $this->extension_platform = $value; } public function set_cartridge_bundle($value) { $this->cartridge_bundle = $value; } public function set_cartridge_icon($value) { $this->cartridge_icon = $value; } protected function on_save() { //this has to be done like this since order of apearance of the tags is also mandatory //and specified in basiclti schema files //main items $rns = $this->ccnamespaces['blti']; $this->append_new_element_ns($this->root, $rns, 'title' , $this->title ); $this->append_new_element_ns($this->root, $rns, 'description', $this->description); //custom properties if (!empty($this->custom_properties)) { $custom = $this->append_new_element_ns($this->root, $rns, 'custom'); foreach ($this->custom_properties as $property => $value) { $node = $this->append_new_element_ns($custom, $this->ccnamespaces['lticm'], 'property' , $value); $this->append_new_attribute_ns($node, $this->ccnamespaces['xmlns'],'name', $property); } } //extension properties if (!empty($this->extension_properties)) { $extension = $this->append_new_element_ns($this->root, $rns, 'extensions'); if (!empty($this->extension_platform)) { $this->append_new_attribute_ns($extension, $this->ccnamespaces['xmlns'], 'platform', $this->extension_platform); } foreach ($this->extension_properties as $property => $value) { $node = $this->append_new_element_ns($extension, $this->ccnamespaces['lticm'], 'property' , $value); $this->append_new_attribute_ns($node, $this->ccnamespaces['xmlns'], 'name', $property); } } $this->append_new_element_ns($this->root, $rns, 'launch_url' , $this->launch_url ); if (!empty($this->secure_launch_url)) { $this->append_new_element_ns($this->root, $rns, 'secure_launch_url' , $this->secure_launch_url); } $this->append_new_element_ns($this->root, $rns, 'icon' , $this->icon ); if (!empty($this->secure_icon)) { $this->append_new_element_ns($this->root, $rns, 'secure_icon' , $this->secure_icon); } //vendor info $vendor = $this->append_new_element_ns($this->root, $rns, 'vendor'); $vcode = empty($this->vendor_code) ? 'I' : $this->vendor_code; $this->append_new_element_ns($vendor, $this->ccnamespaces['lticp'], 'code', $vcode); $this->append_new_element_ns($vendor, $this->ccnamespaces['lticp'], 'name', $this->vendor_name); if (!empty($this->vendor_description)) { $this->append_new_element_ns($vendor, $this->ccnamespaces['lticp'], 'description', $this->vendor_description); } if (!empty($this->vendor_url)) { $this->append_new_element_ns($vendor, $this->ccnamespaces['lticp'], 'url', $this->vendor_url); } if (!empty($this->vendor_contact)) { $vcontact = $this->append_new_element_ns($vendor, $this->ccnamespaces['lticp'], 'contact'); $this->append_new_element_ns($vcontact, $this->ccnamespaces['lticp'], 'email', $this->vendor_contact['email']); } //cartridge bundle and icon if (!empty($this->cartridge_bundle)) { $cbundle = $this->append_new_element_ns($this->root, $this->ccnamespaces['xmlns'], 'cartridge_bundle'); $this->append_new_attribute_ns($cbundle, $this->ccnamespaces['xmlns'], 'identifierref', $this->cartridge_bundle); } if (!empty($this->cartridge_icon)) { $cicon = $this->append_new_element_ns($this->root, $this->ccnamespaces['xmlns'], 'cartridge_icon'); $this->append_new_attribute_ns($cicon, $this->ccnamespaces['xmlns'], 'identifierref', $this->cartridge_icon); } return true; } } PK\qι!!cc_lib/cc_organization.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_utils.php'; require_once 'cc_version_base.php'; require_once 'cc_resources.php'; require_once 'cc_manifest.php'; /** * Organization Class * */ class cc_organization implements cc_i_organization { public $title = null; public $identifier = null; public $structure = null; public $itemlist = null; private $metadata = null; private $sequencing = null; /** @var bool true if empty, otherwise false. */ protected $isempty; public function __construct($node=null, $doc=null) { if (is_object($node) && is_object($doc)) { $this->process_organization($node,$doc); } else { $this->init_new(); } } /** * Add one Item into the Organization * * @param cc_i_item $item */ public function add_item(cc_i_item &$item) { if (is_null($this->itemlist)) { $this->itemlist = array(); } $this->itemlist[$item->identifier] = $item; } /** * Add new Item into the Organization * * @param string $title * @return cc_i_item */ public function add_new_item($title='') { $nitem = new cc_item(); $nitem->title = $title; $this->add_item($nitem); return $nitem; } public function has_items() { return is_array($this->itemlist) && (count($this->itemlist) > 0); } public function attr_value(&$nod, $name, $ns=null) { return is_null($ns) ? ($nod->hasAttribute($name) ? $nod->getAttribute($name) : null) : ($nod->hasAttributeNS($ns, $name) ? $nod->getAttributeNS($ns, $name) : null); } public function process_organization(&$node,&$doc) { $this->identifier = $this->attr_value($node,"identifier"); $this->structure = $this->attr_value($node,"structure"); $this->title = ''; $nlist = $node->getElementsByTagName('title'); if (is_object($nlist) && ($nlist->length > 0) ) { $this->title = $nlist->item(0)->nodeValue; } $nlist = $doc->nodeList("//imscc:organization[@identifier='".$this->identifier."']/imscc:item"); $this->itemlist=array(); foreach ($nlist as $item) { $this->itemlist[$item->getAttribute("identifier")] = new cc_item($item,$doc); } $this->isempty=false; } public function init_new() { $this->title = null; $this->identifier = cc_helpers::uuidgen('O_'); $this->structure = 'rooted-hierarchy'; $this->itemlist = null; $this->metadata = null; $this->sequencing = null; } public function uuidgen() { $uuid = sprintf('%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535)); return strtoupper(trim($uuid)); } } /** * Item Class * */ class cc_item implements cc_i_item { public $identifier = null; public $identifierref = null; public $isvisible = null; public $title = null; public $parameters = null; public $childitems = null; private $parentItem = null; private $isempty = true; /** @var mixed node structure. */ public $structure; public function __construct($node=null,$doc=null) { if (is_object($node)) { $clname = get_class($node); if ($clname =='cc_resource') { $this->init_new_item(); $this->identifierref = $node->identifier; $this->title = is_string($doc) && (!empty($doc)) ? $doc : 'item'; } else if ($clname =='cc_manifest') { $this->init_new_item(); $this->identifierref = $node->manifestID(); $this->title = is_string($doc) && (!empty($doc)) ? $doc : 'item'; } else if ( is_object($doc)){ $this->process_item($node,$doc); } else { $this->init_new_item(); } } else { $this->init_new_item(); } } public function attr_value(&$nod, $name, $ns=null) { return is_null($ns) ? ($nod->hasAttribute($name) ? $nod->getAttribute($name) : null) : ($nod->hasAttributeNS($ns, $name) ? $nod->getAttributeNS($ns, $name) : null); } public function process_item(&$node,&$doc) { $this->identifier = $this->attr_value($node,"identifier"); $this->structure = $this->attr_value($node,"structure"); $this->identifierref = $this->attr_value($node,"identifierref"); $atr = $this->attr_value($node,"isvisible"); $this->isvisible = is_null($atr) ? true : $atr; $nlist = $node->getElementsByTagName('title'); if (is_object($nlist) && ($nlist->length > 0) ) { $this->title = $nlist->item(0)->nodeValue; } $nlist = $doc->nodeList("//imscc:item[@identifier='".$this->identifier."']/imscc:item"); if ($nlist->length > 0) { $this->childitems=array(); foreach ($nlist as $item) { $key=$this->attr_value($item,"identifier"); $this->childitems[$key] = new cc_item($item,$doc); } } $this->isempty = false; } /** * Add one Child Item * * @param cc_i_item $item */ public function add_child_item(cc_i_item &$item) { if (is_null($this->childitems)) { $this->childitems = array(); } $this->childitems[$item->identifier] = $item; } /** * Add new child Item * * @param string $title * @return cc_i_item */ public function add_new_child_item($title='') { $sc = new cc_item(); $sc->title = $title; $this->add_child_item($sc); return $sc; } public function attach_resource($resource) { if ($this->has_child_items()) { throw new Exception("Can not attach resource to item that contains other items!"); } $resident = null; if (is_string($resource)) { $resident = $resource; } else if (is_object($resource)) { $clname = get_class($resource); if ($clname == 'cc_resource') { $resident = $resource->identifier; } else if ($clname == 'cc_manifest') { $resident = $resource->manifestID(); } else { throw new Exception("Unable to attach resource. Invalid object."); } } if (is_null($resident) || (empty($resident))) { throw new Exception("Resource must have valid identifier!"); } $this->identifierref = $resident; } public function has_child_items() { return is_array($this->childitems) && (count($this->childitems) > 0); } public function child_item($identifier) { return $this->has_child_items() ? $this->childitems[$identifier] : null; } public function init_clean() { $this->identifier = null; $this->isvisible = null; $this->title = null; $this->parameters = null; $this->childitems = null; $this->parentItem = null; $this->isempty = true; } public function init_new_item() { $this->identifier = cc_helpers::uuidgen('I_'); $this->isvisible = true; //default is true $this->title = null; $this->parameters = null; $this->childitems = null; $this->parentItem = null; $this->isempty = false; } }PK\W6  cc_lib/cc_converter_url.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; require_once 'cc_weblink.php'; class cc_converter_url extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->cc_type = cc_version11::weblink; $this->defaultfile = 'url.xml'; $this->defaultname = 'weblink.xml'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new url11_resurce_file(); $title = $this->doc->nodeValue('/activity/url/name'); $rt->set_title($title); $url = $this->doc->nodeValue('/activity/url/externalurl'); if (!empty($url)) { /** * * Display value choices * 0 - automatic (system chooses what to do) (usualy defaults to the open) * 1 - embed - display within a frame * 5 - open - just open it full in the same frame * 6 - in popup - popup - new frame */ $display = intval($this->doc->nodeValue('/activity/forum/display')); $target = ($display == 6) ? '_blank' : '_self'; //TODO: Moodle also supports custom parameters //this should be transformed somehow into url where possible $rt->set_url($url, $target); } $this->store($rt, $outdir, $title); return true; } } PK\Ev / /cc_lib/cc_manifest.phpnu[. /** * Manifest management * * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_utils.php'); require_once('xmlbase.php'); require_once('cc_resources.php'); require_once('cc_version_base.php'); require_once('gral_lib/pathutils.php'); /** * Manifest Class * */ class cc_manifest extends XMLGenericDocument implements cc_i_manifest { private $ccversion = null; private $ccobj = null; private $rootmanifest = null; private $activemanifest = null; private $parentmanifest = null; private $parentparentmanifest = null; private $ares = array(); private $mainidentifier = null; public function __construct($ccver = cc_version::v1, $activemanifest=null, $parentmanifest=null, $parentparentmanifest=null) { if (is_int($ccver)) { $this->ccversion=$ccver; $classname = "cc_version{$ccver}"; $this->ccobj = new $classname; parent::__construct('UTF-8', true); } else if (is_object($ccver) && (get_class($ccver)=='cc_manifest')) { $this->doc = $ccver->doc; $this->rootmanifest = $ccver->rootmanifest; $this->activemanifest = $activemanifest; $this->parentmanifest = $parentmanifest; $this->parentparentmanifest = $parentparentmanifest; $this->ccversion = $ccver->ccversion; $this->ccobj = $ccver; $this->register_namespaces_for_xpath(); } } /** * Register Namespace for use XPATH * */ public function register_namespaces_for_xpath() { $scnam = $this->activemanifest->get_cc_namespaces(); foreach ($scnam as $key => $value) { $this->registerNS($key, $value); } } /** * TODO - implement this method - critical * Enter description here ... */ private function fill_manifest() { } /** * Add Metadata For Manifest * * @param cc_i_metadata_manifest $met */ public function add_metadata_manifest(cc_i_metadata_manifest $met) { $metanode = $this->node("//imscc:manifest[@identifier='". $this->activemanifest->manifestID(). "']/imscc:metadata"); $nmeta = $this->activemanifest->create_metadata_node($met, $this->doc, $metanode); $metanode->appendChild($nmeta); } /** * Add Metadata For Resource * * @param cc_i_metadata_resource $met * @param string $identifier */ public function add_metadata_resource(cc_i_metadata_resource $met, $identifier) { $metanode = $this->node("//imscc:resource". "[@identifier='". $identifier. "']"); $metanode2 = $this->node("//imscc:resource". "[@identifier='". $identifier. "']/imscc:file"); $nspaces = $this->activemanifest->get_cc_namespaces(); $dnode = $this->append_new_element_ns($metanode2, $nspaces['imscc'], 'metadata'); $this->activemanifest->create_metadata_resource_node($met, $this->doc, $dnode); } /** * Add Metadata For File * * @param cc_i_metadata_file $met * @param string $identifier * @param string $filename */ public function add_metadata_file(cc_i_metadata_file $met, $identifier, $filename) { if (empty($met) || empty($identifier) || empty($filename)) { throw new Exception('Try to add a metadata file with nulls values given!'); } $metanode = $this->node("//imscc:resource". "[@identifier='". $identifier. "']/imscc:file". "[@href='". $filename. "']"); $nspaces = $this->activemanifest->get_cc_namespaces(); $dnode = $this->doc->createElementNS($nspaces['imscc'], "metadata"); $metanode->appendChild($dnode); $this->activemanifest->create_metadata_file_node($met, $this->doc, $dnode); } public function on_create() { $this->activemanifest = cc_builder_creator::factory($this->ccversion); $this->rootmanifest = $this->activemanifest; $result = $this->activemanifest->create_manifest($this->doc); $this->register_namespaces_for_xpath(); return $result; } public function get_relative_base_path() { return $this->activemanifest->base(); } public function parent_manifest() { return new cc_manifest($this, $this->parentmanifest, $this->parentparentmanifest); } public function root_manifest() { return new cc_manifest($this, $this->rootmanifest); } public function manifestID() { return $this->activemanifest->manifestID(); } public function get_manifest_namespaces() { return $this->rootmanifest->get_cc_namespaces(); } /** * Add a new organization * * @param cc_i_organization $org */ public function add_new_organization(cc_i_organization &$org) { $norg = $this->activemanifest->create_organization_node($org, $this->doc); $orgnode = $this->node("//imscc:manifest[@identifier='". $this->activemanifest->manifestID(). "']/imscc:organizations"); $orgnode->appendChild($norg); } public function get_resources($searchspecific='') { $reslist = $this->get_resource_list($searchspecific); $resourcelist = array(); foreach ($reslist as $resourceitem) { $resourcelist[] = new cc_resource($this, $resourceitem); } return $resourcelist; } public function get_cc_namespace_path($nsname) { if (is_string($nsname) && (!empty($nsname))) { $scnam = $this->activemanifest->get_cc_namespaces(); return $scnam[$nsname]; } return null; } public function get_resource_list($searchspecific = '') { return $this->nodeList("//imscc:manifest[@identifier='". $this->activemanifest->manifestID(). "']/imscc:resources/imscc:resource".$searchspecific); } public function on_load() { $this->register_namespaces_for_xpath(); $this->fill_manifest(); return true; } public function on_save() { return true; } /** * Add a resource to the manifest * * @param cc_i_resource $res * @param string $identifier * @param string $type * @return array */ public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') { if (!$this->ccobj->valid($type)) { throw new Exception("Type invalid..."); } if ($res == null) { throw new Exception('Invalid Resource or dont give it'); } $rst = $res; // TODO: This has to be reviewed since it does not handle multiple files properly. // Dependencies. if (is_object($identifier)) { $this->activemanifest->create_resource_node($rst, $this->doc, $identifier); } else { $nresnode = null; $rst->type = $type; if (!cc_helpers::is_html($rst->filename)) { $rst->href = null; } $this->activemanifest->create_resource_node($rst, $this->doc, $nresnode); foreach ($rst->files as $file) { $ident = $this->get_identifier_by_filename($file); if ($ident == null) { $newres = new cc_resource($rst->manifestroot, $file); if (!cc_helpers::is_html($file)) { $newres->href = null; } $newres->type = 'webcontent'; $this->activemanifest->create_resource_node($newres, $this->doc, $nresnode); } } } $tmparray = array($rst->identifier, $rst->files[0]); return $tmparray; } private function check_if_exist_in_other($name, $identifier) { $status = array(); foreach ($this->activemanifest->resources as $value) { if (($value->identifier != $identifier) && isset($value->files[$name])) { $status[] = $value->identifier; } } return $status; } private function replace_file_x_dependency($depen, $name) { foreach ($depen as $key => $value) { ($key); $ident = $this->get_identifier_by_filename($name); $this->activemanifest->resources[$value]->files = $this->array_remove_by_value($this->activemanifest->resources[$value]->files, $name); if (!in_array($ident, $this->activemanifest->resources[$value]->dependency)) { array_push($this->activemanifest->resources[$value]->dependency, $ident); } } return true; } private function get_identifier_by_filename($name) { $result = null; if (isset($this->activemanifest->resources_ind[$name])) { $result = $this->activemanifest->resources_ind[$name]; } return $result; } private function array_remove_by_value($arr, $value) { return array_values(array_diff($arr, array($value))); } private function array_remove_by_key($arr, $key) { return array_values(array_diff_key($arr, array($key))); } public function update_instructoronly($identifier, $value = false) { if (isset($this->activemanifest->resources[$identifier])) { $resource = $this->activemanifest->resources[$identifier]; $resource->instructoronly = $value; } } /** * Append the resources nodes in the Manifest * * @return DOMNode */ public function put_nodes() { $resnodestr = "//imscc:manifest[@identifier='".$this->activemanifest->manifestID(). "']/imscc:resources"; $resnode = $this->node($resnodestr); foreach ($this->activemanifest->resources as $k => $v) { ($k); $depen = $this->check_if_exist_in_other($v->files[0], $v->identifier); if (!empty($depen)) { $this->replace_file_x_dependency($depen, $v->files[0]); $v->type = 'webcontent'; } } foreach ($this->activemanifest->resources as $node) { $rnode = $this->activemanifest->create_resource_node($node, $this->doc, null); $resnode->appendChild($rnode); if ($node->instructoronly) { $metafileceduc = new cc_metadata_resouce_educational(); $metafileceduc->set_value(intended_user_role::INSTRUCTOR); $metafile = new cc_metadata_resouce(); $metafile->add_metadata_resource_educational($metafileceduc); $this->activemanifest->create_metadata_educational($metafile, $this->doc, $rnode); } } return $resnode; } } PK\y250 0 cc_lib/cc_resources.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_interfaces.php'); require_once('xmlbase.php'); require_once('gral_lib/pathutils.php'); require_once('gral_lib/ccdependencyparser.php'); require_once('cc_version_base.php'); require_once('cc_version1.php'); require_once('cc_manifest.php'); /** * Common Cartridge Version * */ class cc_version{ const v1 = 1; const v11 = 11; } class cc1_resource_type { const webcontent = 'webcontent'; const questionbank = 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank'; const assessment = 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment'; const associatedcontent = 'associatedcontent/imscc_xmlv1p0/learning-application-resource'; const discussiontopic = 'imsdt_xmlv1p0'; const weblink = 'imswl_xmlv1p0'; public static $checker = array(self::webcontent, self::assessment, self::associatedcontent, self::discussiontopic, self::questionbank, self::weblink); } class cc11_resource_type { const webcontent = 'webcontent'; const questionbank = 'imsqti_xmlv1p2/imscc_xmlv1p1/question-bank'; const assessment = 'imsqti_xmlv1p2/imscc_xmlv1p1/assessment'; const associatedcontent = 'associatedcontent/imscc_xmlv1p1/learning-application-resource'; const discussiontopic = 'imsdt_xmlv1p1'; const weblink = 'imswl_xmlv1p1'; const basiclti = 'imsbasiclti_xmlv1p0'; public static $checker = array(self::webcontent, self::assessment, self::associatedcontent, self::discussiontopic, self::questionbank, self::weblink, self::basiclti); } /** * Resource Class * */ class cc_resource implements cc_i_resource { public $identifier = null; public $type = null; public $dependency = array(); public $identifierref = null; public $href = null; public $base = null; public $persiststate = null; public $metadata = array(); public $filename = null; public $files = array(); public $isempty = null; public $manifestroot = null; public $folder = null; public $instructoronly = false; private $throwonerror = true; public function __construct($manifest, $file, $folder='', $throwonerror = true) { $this->throwonerror = $throwonerror; if (is_string($manifest)) { $this->folder = $folder; $this->process_resource($manifest, $file, $folder); $this->manifestroot = $manifest; } else if (is_object($manifest)) { $this->import_resource($file, $manifest); } } /** * Add resource * * @param string $fname * @param string $location */ public function add_resource($fname, $location ='') { $this->process_resource($fname, $location, null); } /** * Import a resource * * @param DOMElement $node * @param cc_i_manifest $doc */ public function import_resource(DOMElement &$node, cc_i_manifest &$doc) { $searchstr = "//imscc:manifest[@identifier='".$doc->manifestID(). "']/imscc:resources/imscc:resource"; $this->identifier = $this->get_attr_value($node, "identifier"); $this->type = $this->get_attr_value($node, "type"); $this->href = $this->get_attr_value($node, "href"); $this->base = $this->get_attr_value($node, "base"); $this->persiststate = null; $nodo = $doc->nodeList($searchstr."[@identifier='". $this->identifier."']/metadata/@href"); $this->metadata = $nodo->nodeValue; $this->filename = $this->href; $nlist = $doc->nodeList($searchstr."[@identifier='". $this->identifier."']/imscc:file/@href"); $this->files = array(); foreach ($nlist as $file) { $this->files[] = $file->nodeValue; } $nlist = $doc->nodeList($searchstr."[@identifier='". $this->identifier."']/imscc:dependency/@identifierref"); $this->dependency = array(); foreach ($nlist as $dependency) { $this->dependency[] = $dependency->nodeValue; } $this->isempty = false; } /** * Get a attribute value * * @param DOMElement $nod * @param string $name * @param string $ns * @return string */ public function get_attr_value(&$nod, $name, $ns=null) { if (is_null($ns)) { return ($nod->hasAttribute($name) ? $nod->getAttribute($name) : null); } return ($nod->hasAttributeNS($ns, $name) ? $nod->getAttributeNS($ns, $name) : null); } /** * Process a resource * * @param string $manifestroot * @param string $fname * @param string $folder */ public function process_resource($manifestroot, &$fname, $folder) { $file = empty($folder) ? $manifestroot.'/'.$fname : $manifestroot.'/'.$folder.'/'.$fname; if (!file_exists($file) && $this->throwonerror) { throw new Exception('The file doesnt exist!'); } GetDepFiles($manifestroot, $fname, $this->folder, $this->files); array_unshift($this->files, $folder.$fname); $this->init_empty_new(); $this->href = $folder.$fname; $this->identifierref = $folder.$fname; $this->filename = $fname; $this->isempty = false; $this->folder = $folder; } public function adjust_path($mroot, $fname) { $result = null; if (file_exists($fname->filename)) { $result = pathDiff($fname->filename, $mroot); } else if (file_exists($mroot.$fname->filename) || file_exists($mroot.DIRECTORY_SEPARATOR.$fname->filename)) { $result = $fname->filename; toUrlPath($result); $result = trim($result, "/"); } return $result; } public function init_clean() { $this->identifier = null; $this->type = null; $this->href = null; $this->base = null; $this->metadata = array(); $this->dependency = array(); $this->identifierref = null; $this->persiststate = null; $this->filename = ''; $this->files = array(); $this->isempty = true; } public function init_empty_new() { $this->identifier = cc_helpers::uuidgen('I_', '_R'); $this->type = null; $this->href = null; $this->persiststate = null; $this->filename = null; $this->isempty = false; $this->identifierref = null; } public function get_manifestroot() { return $this->manifestroot; } }PK\l7#cc_lib/cc_converter_label.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; class cc_converter_label extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->defaultfile = 'label.xml'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $resitem = new cc_item(); $resitem->title = $this->doc->nodeValue('/activity/label/name'); $this->item->add_child_item($resitem); return true; } }PK\?88cc_lib/cc_metadata.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** Defined as specified in CC 1.1 */ class intended_user_role { const LEARNER = 'Learner'; const INSTRUCTOR = 'Instructor'; const MENTOR = 'Mentor'; } class technical_role { const AUTHOR = 'author'; const PUBLISHER = 'publisher'; const UNKNOWN = 'unknown'; const INITIATOR = 'initiator'; const TERMINATOR = 'terminator'; const VALIDATOR = 'validator'; const EDITOR = 'editor'; const GRAPHICAL_DESIGNER = 'graphical designer'; const TECHNICAL_IMPLEMENTER = 'technical implementer'; const CONTENT_PROVIDER = 'content provider'; const TECHNICAL_VALIDATOR = 'technical validator'; const EDUCATION_VALIDATOR = 'educational validator'; const SCRIPT_WRITER = 'script writer'; const INSTRUCTIONAL_DESIGNER= 'instructional designer'; const SUBJET_MATTER_EXPERT = 'subject matter expert'; } class rights_copyright { const YES = 'yes'; const NO = 'no'; } class rights_cost { const YES = 'yes'; const NO = 'no'; } // Language identifier (as defined in ISO 639-1, ISO 639-2, and ISO 3166-1) class language_lom { const US_ENGLISH = 'en-US'; const GB_ENGLISH = 'en-GB'; const AR_SPANISH = 'es-AR'; const GR_GREEK = 'el-GR'; } /** * Metadata Manifest * */ class cc_metadata_manifest implements cc_i_metadata_manifest { public $arraygeneral = array(); public $arraytech = array(); public $arrayrights = array(); public $arraylifecycle = array(); public function add_metadata_general($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->title)? $this->arraygeneral['title']=$obj->title:null; !is_null($obj->language)? $this->arraygeneral['language']=$obj->language:null; !is_null($obj->description)? $this->arraygeneral['description']=$obj->description:null; !is_null($obj->keyword)? $this->arraygeneral['keyword']=$obj->keyword:null; !is_null($obj->coverage)? $this->arraygeneral['coverage']=$obj->coverage:null; !is_null($obj->catalog)? $this->arraygeneral['catalog']=$obj->catalog:null; !is_null($obj->entry)? $this->arraygeneral['entry']=$obj->entry:null; } public function add_metadata_technical($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->format)? $this->arraytech['format']=$obj->format:null; } public function add_metadata_rights($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->copyright)? $this->arrayrights['copyrightAndOtherRestrictions']=$obj->copyright:null; !is_null($obj->description)? $this->arrayrights['description']=$obj->description:null; !is_null($obj->cost)? $this->arrayrights['cost']=$obj->cost:null; } public function add_metadata_lifecycle($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->role)? $this->arraylifecycle['role']=$obj->role:null; !is_null($obj->entity)? $this->arraylifecycle['entity']=$obj->entity:null; !is_null($obj->date)? $this->arraylifecycle['date']=$obj->date:null; } } /** * Metadata Lifecycle Type * */ class cc_metadata_lifecycle{ public $role = array(); public $entity = array(); public $date = array(); public function set_role($role){ $this->role[] = array($role); } public function set_entity($entity){ $this->entity[] = array($entity); } public function set_date($date){ $this->date[] = array($date); } } /** * Metadata Rights Type * */ class cc_metadata_rights { public $copyright = array(); public $description = array(); public $cost = array(); public function set_copyright($copy){ $this->copyright[] = array($copy); } public function set_description($des,$language){ $this->description[] = array($language,$des); } public function set_cost($cost){ $this->cost[] = array($cost); } } /** * Metadata Technical Type * */ class cc_metadata_technical { public $format = array(); public function set_format($format){ $this->format[] = array($format); } } /** * Metadata General Type * */ class cc_metadata_general { public $title = array(); public $language = array(); public $description = array(); public $keyword = array(); public $coverage = array(); public $catalog = array(); public $entry = array(); public function set_coverage($coverage,$language){ $this->coverage[] = array($language,$coverage); } public function set_description($description,$language){ $this->description[] = array($language,$description); } public function set_keyword($keyword,$language){ $this->keyword[] = array($language,$keyword); } public function set_language($language){ $this->language[] = array($language); } public function set_title($title,$language){ $this->title[] = array($language,$title); } public function set_catalog($cat){ $this->catalog[] = array($cat); } public function set_entry($entry){ $this->entry[] = array($entry); } }PK\ 9 9 cc_lib/gral_lib/functions.phpnu[. /** * Librería de funciones básicas V1.0 (June, 16th 2009) * * * @author Daniel Mühlrad * @link daniel.muhlrad@uvcms.com * @version 1.0 * @copyright 2009 * */ /** * Make a Handler error with an exception msg error * * @param integer $errno * @param string $errstr * @param string $errfile * @param string $errline */ function errorHandler($errno, $errstr, $errfile, $errline) { // si deseas podes guardarlos en un archivo ($errfile);($errline); throw new Exception($errstr, $errno); } /** * Return de mime-type of a file * * @param string $file * @param string $default_type * */ function file_mime_type ($file, $default_type = 'application/octet-stream'){ $ftype = $default_type; $magic_path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'magic' . DIRECTORY_SEPARATOR . 'magic'; $finfo = @finfo_open(FILEINFO_MIME , $magic_path); if ($finfo !== false) { $fres = @finfo_file($finfo, $file); if ( is_string($fres) && !empty($fres) ) { $ftype = $fres; } @finfo_close($finfo); } return $ftype; } function array_remove_by_value($arr,$value) { return array_values(array_diff($arr,array($value))); } function array_remove_by_key($arr,$key) { return array_values(array_diff_key($arr,array($key))); } function cc_print_object($object) { echo '
' . htmlspecialchars(print_r($object,true), ENT_COMPAT) . '
'; } /** * IndexOf - first version of find an element in the Array given * returns the index of the *first* occurance * @param mixed $needle * @param array $haystack * @return mixed The element or false if the function didnt find it */ function indexOf($needle, $haystack) { for ($i = 0; $i < count($haystack) ; $i++) { if ($haystack[$i] == $needle) { return $i; } } return false; } /** * IndexOf2 - second version of find an element in the Array given * * @param mixed $needle * @param array $haystack * @return mixed The index of the element or false if the function didnt find it */ function indexOf2($needle, $haystack) { for($i = 0,$z = count($haystack); $i < $z; $i++){ if ($haystack[$i] == $needle) { //finds the needle return $i; } } return false; } PK\ϼя cc_lib/gral_lib/cssparser.phpnu[. class cssparser { private $css; private $html; public function __construct($html = true) { // Register "destructor" core_shutdown_manager::register_function(array(&$this, "finalize")); $this->html = ($html != false); $this->Clear(); } /** * Old syntax of class constructor. Deprecated in PHP7. * * @deprecated since Moodle 3.1 */ public function cssparser($html = true) { debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER); self::__construct($html); } function finalize() { unset($this->css); } function Clear() { unset($this->css); $this->css = array(); if($this->html) { $this->Add("ADDRESS", ""); $this->Add("APPLET", ""); $this->Add("AREA", ""); $this->Add("A", "text-decoration : underline; color : Blue;"); $this->Add("A:visited", "color : Purple;"); $this->Add("BASE", ""); $this->Add("BASEFONT", ""); $this->Add("BIG", ""); $this->Add("BLOCKQUOTE", ""); $this->Add("BODY", ""); $this->Add("BR", ""); $this->Add("B", "font-weight: bold;"); $this->Add("CAPTION", ""); $this->Add("CENTER", ""); $this->Add("CITE", ""); $this->Add("CODE", ""); $this->Add("DD", ""); $this->Add("DFN", ""); $this->Add("DIR", ""); $this->Add("DIV", ""); $this->Add("DL", ""); $this->Add("DT", ""); $this->Add("EM", ""); $this->Add("FONT", ""); $this->Add("FORM", ""); $this->Add("H1", ""); $this->Add("H2", ""); $this->Add("H3", ""); $this->Add("H4", ""); $this->Add("H5", ""); $this->Add("H6", ""); $this->Add("HEAD", ""); $this->Add("HR", ""); $this->Add("HTML", ""); $this->Add("IMG", ""); $this->Add("INPUT", ""); $this->Add("ISINDEX", ""); $this->Add("I", "font-style: italic;"); $this->Add("KBD", ""); $this->Add("LINK", ""); $this->Add("LI", ""); $this->Add("MAP", ""); $this->Add("MENU", ""); $this->Add("META", ""); $this->Add("OL", ""); $this->Add("OPTION", ""); $this->Add("PARAM", ""); $this->Add("PRE", ""); $this->Add("P", ""); $this->Add("SAMP", ""); $this->Add("SCRIPT", ""); $this->Add("SELECT", ""); $this->Add("SMALL", ""); $this->Add("STRIKE", ""); $this->Add("STRONG", ""); $this->Add("STYLE", ""); $this->Add("SUB", ""); $this->Add("SUP", ""); $this->Add("TABLE", ""); $this->Add("TD", ""); $this->Add("TEXTAREA", ""); $this->Add("TH", ""); $this->Add("TITLE", ""); $this->Add("TR", ""); $this->Add("TT", ""); $this->Add("UL", ""); $this->Add("U", "text-decoration : underline;"); $this->Add("VAR", ""); } } function SetHTML($html) { $this->html = ($html != false); } function Add($key, $codestr) { $key = strtolower($key); $codestr = strtolower($codestr); if(!isset($this->css[$key])) { $this->css[$key] = array(); } $codes = explode(";",$codestr); if(count($codes) > 0) { $codekey=''; $codevalue=''; foreach($codes as $code) { $code = trim($code); $this->assignValues(explode(":",$code),$codekey,$codevalue); if(strlen($codekey) > 0) { $this->css[$key][trim($codekey)] = trim($codevalue); } } } } private function assignValues($arr,&$val1,&$val2) { $n = count($arr); if ($n > 0) { $val1=$arr[0]; $val2=($n > 1) ? $arr[1] : ''; } } function Get($key, $property) { $key = strtolower($key); $property = strtolower($property); $tag='';$subtag='';$class='';$id=''; $this->assignValues(explode(":",$key),$tag,$subtag); $this->assignValues(explode(".",$tag),$tag,$class); $this->assignValues(explode("#",$tag),$tag,$id); $result = ""; $_subtag=''; $_class=''; $_id=''; foreach($this->css as $_tag => $value) { $this->assignValues(explode(":",$_tag),$_tag,$_subtag); $this->assignValues(explode(".",$_tag),$_tag,$_class); $this->assignValues(explode("#",$_tag),$_tag,$_id); $tagmatch = (strcmp($tag, $_tag) == 0) | (strlen($_tag) == 0); $subtagmatch = (strcmp($subtag, $_subtag) == 0) | (strlen($_subtag) == 0); $classmatch = (strcmp($class, $_class) == 0) | (strlen($_class) == 0); $idmatch = (strcmp($id, $_id) == 0); if($tagmatch & $subtagmatch & $classmatch & $idmatch) { $temp = $_tag; if((strlen($temp) > 0) & (strlen($_class) > 0)) { $temp .= ".".$_class; } elseif(strlen($temp) == 0) { $temp = ".".$_class; } if((strlen($temp) > 0) & (strlen($_subtag) > 0)) { $temp .= ":".$_subtag; } elseif(strlen($temp) == 0) { $temp = ":".$_subtag; } if(isset($this->css[$temp][$property])) { $result = $this->css[$temp][$property]; } } } return $result; } function GetSection($key) { $key = strtolower($key); $tag='';$subtag='';$class='';$id=''; $_subtag=''; $_class=''; $_id=''; $this->assignValues(explode(":",$key),$tag,$subtag); $this->assignValues(explode(".",$tag),$tag,$class); $this->assignValues(explode("#",$tag),$tag,$id); $result = array(); foreach($this->css as $_tag => $value) { $this->assignValues(explode(":",$_tag),$_tag,$_subtag); $this->assignValues(explode(".",$_tag),$_tag,$_class); $this->assignValues(explode("#",$_tag),$_tag,$_id); $tagmatch = (strcmp($tag, $_tag) == 0) | (strlen($_tag) == 0); $subtagmatch = (strcmp($subtag, $_subtag) == 0) | (strlen($_subtag) == 0); $classmatch = (strcmp($class, $_class) == 0) | (strlen($_class) == 0); $idmatch = (strcmp($id, $_id) == 0); if($tagmatch & $subtagmatch & $classmatch & $idmatch) { $temp = $_tag; if((strlen($temp) > 0) & (strlen($_class) > 0)) { $temp .= ".".$_class; } elseif(strlen($temp) == 0) { $temp = ".".$_class; } if((strlen($temp) > 0) & (strlen($_subtag) > 0)) { $temp .= ":".$_subtag; } elseif(strlen($temp) == 0) { $temp = ":".$_subtag; } foreach($this->css[$temp] as $property => $value) { $result[$property] = $value; } } } return $result; } function ParseStr($str) { $this->Clear(); // Remove comments $str = preg_replace("/\/\*(.*)?\*\//Usi", "", $str); // Parse this damn csscode $parts = explode("}",$str); if(count($parts) > 0) { foreach($parts as $part) { $keystr='';$codestr=''; $this->assignValues(explode("{",$part),$keystr,$codestr); $keys = explode(",",trim($keystr)); if(count($keys) > 0) { foreach($keys as $key) { if(strlen($key) > 0) { $key = str_replace("\n", "", $key); $key = str_replace("\\", "", $key); $this->Add($key, trim($codestr)); } } } } } // return (count($this->css) > 0); } function Parse($filename) { $this->Clear(); if(file_exists($filename)) { return $this->ParseStr(file_get_contents($filename)); } else { return false; } } function GetCSS() { $result = ""; foreach($this->css as $key => $values) { $result .= $key." {\n"; foreach($values as $key => $value) { $result .= " $key: $value;\n"; } $result .= "}\n\n"; } return $result; } } PK\jj&cc_lib/gral_lib/ccdependencyparser.phpnu[. require_once(__DIR__ .'/../xmlbase.php'); require_once('cssparser.php'); require_once('pathutils.php'); /** * * Older version better suited for PHP < 5.2 * @deprecated * @param mixed $url * @return boolean */ function is_url_deprecated($url) { if ( !preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) && !preg_match('#^https\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) && !preg_match('#^ftp\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) ) { $status = false; } else { $status = true; } return $status; } /** * * validates URL * @param string $url * @return boolean */ function is_url($url) { $result = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED) !== false; return $result; } function GetDepFiles($manifestroot, $fname, $folder, &$filenames) { static $types = array('xhtml' => true, 'html' => true, 'htm' => true); $extension = strtolower(trim(pathinfo($fname, PATHINFO_EXTENSION))); $filenames = array(); if (isset($types[$extension])) { $dcx = new XMLGenericDocument(); $filename = $manifestroot.$folder.$fname; if (!file_exists($filename)) { $filename = $manifestroot.DIRECTORY_SEPARATOR.$folder.DIRECTORY_SEPARATOR.$fname; } if (file_exists($filename)) { $res = $dcx->loadHTMLFile($filename); if ($res) { GetDepFilesHTML($manifestroot, $fname, $filenames, $dcx, $folder); } } } } function GetDepFilesHTML($manifestroot, $fname, &$filenames, &$dcx, $folder) { $dcx->resetXpath(); $nlist = $dcx->nodeList("//img/@src | //link/@href | //script/@src | //a[not(starts-with(@href,'#'))]/@href"); $css_obj_array = array(); foreach ($nlist as $nl) { $item = $folder.$nl->nodeValue; $path_parts = pathinfo($item); $fname = $path_parts['basename']; $ext = array_key_exists('extension', $path_parts) ? $path_parts['extension'] : ''; if (!is_url($folder.$nl->nodeValue) && !is_url($nl->nodeValue)) { $path = $folder.$nl->nodeValue; $file = fullPath($path, "/"); toNativePath($file); if (file_exists($manifestroot.DIRECTORY_SEPARATOR.$file)) { $filenames[$file] = $file; } } if ($ext == 'css') { $css = new cssparser(); $css->Parse($dcx->filePath().$nl->nodeValue); $css_obj_array[$item] = $css; } } $nlist = $dcx->nodeList("//*/@class"); foreach ($nlist as $nl) { $item = $folder.$nl->nodeValue; foreach ($css_obj_array as $csskey => $cssobj) { $bimg = $cssobj->Get($item, "background-image"); $limg = $cssobj->Get($item, "list-style-image"); $npath = pathinfo($csskey); if ((!empty($bimg)) && ($bimg != 'none')) { $value = stripUrl($bimg, $npath['dirname'].'/'); $filenames[$value] = $value; } else if ((!empty($limg)) && ($limg != 'none')) { $value = stripUrl($limg, $npath['dirname'].'/'); $filenames[$value] = $value; } } } $elems_to_check = array("body", "p", "ul", "h4", "a", "th"); $do_we_have_it = array(); foreach ($elems_to_check as $elem) { $do_we_have_it[$elem] = ($dcx->nodeList("//".$elem)->length > 0); } foreach ($elems_to_check as $elem) { if ($do_we_have_it[$elem]) { foreach ($css_obj_array as $csskey => $cssobj) { $sb = $cssobj->Get($elem, "background-image"); $sbl = $cssobj->Get($elem, "list-style-image"); $npath = pathinfo($csskey); if ((!empty($sb)) && ($sb != 'none')) { $value = stripUrl($sb, $npath['dirname'].'/'); $filenames[$value] = $value; } else if ((!empty($sbl)) && ($sbl != 'none')) { $value = stripUrl($sbl, $npath['dirname'].'/'); $filenames[$value] = $value; } } } } }PK\v__cc_lib/gral_lib/parser.phpnu[. require_once $CFG->dirroot .'/backup/cc/cc_lib/xmlbase.php'; require_once 'cssparser.php'; require_once 'pathutils.php'; function is_url($url) { if ( !preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) && !preg_match('#^https\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) && !preg_match('#^ftp\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url) ) { $status = false; } else { $status = true; } return $status; } function GetDepFiles($manifestroot, $fname,$folder,&$filenames) { $extension = end(explode('.',$fname)); $filenames = array(); $dcx = new XMLGenericDocument(); $result = true; switch ($extension){ case 'xml': $result = @$dcx->loadXMLFile($manifestroot.$folder.$fname); if (!$result) { $result = @$dcx->loadXMLFile($manifestroot.DIRECTORY_SEPARATOR.$folder.DIRECTORY_SEPARATOR.$fname); } GetDepFilesXML($manifestroot, $fname,$filenames,$dcx, $folder); break; case 'html': case 'htm': $result = @$dcx->loadHTMLFile($manifestroot.$folder.$fname); if (!$result) { $result = @$dcx->loadHTMLFile($manifestroot.DIRECTORY_SEPARATOR.$folder.DIRECTORY_SEPARATOR.$fname); } GetDepFilesHTML($manifestroot, $fname,$filenames,$dcx, $folder); break; } return $result; } function GetDepFilesXML ($manifestroot, $fname,&$filenames,&$dcx, $folder){ $nlist = $dcx->nodeList("//img/@src | //attachments/attachment/@href | //link/@href | //script/@src"); $css_obj_array = array(); foreach ($nlist as $nl) { $item = $nl->nodeValue; $path_parts = pathinfo($item); $fname = $path_parts['basename']; $ext = array_key_exists('extension',$path_parts) ? $path_parts['extension'] : ''; if (!is_url($nl->nodeValue)) { //$file = $folder.$nl->nodeValue; // DEPENDERA SI SE QUIERE Q SEA RELATIVO O ABSOLUTO $file = $nl->nodeValue; toNativePath($file); $filenames[]=$file; } } $dcx->registerNS('qti','http://www.imsglobal.org/xsd/imscc/ims_qtiasiv1p2.xsd'); $dcx->resetXpath(); $nlist = $dcx->nodeList("//qti:mattext | //text"); $dcx2 = new XMLGenericDocument(); foreach ($nlist as $nl) { if ($dcx2->loadString($nl->nodeValue)){ GetDepFilesHTML($manifestroot,$fname,$filenames,$dcx2,$folder); } } } function GetDepFilesHTML ($manifestroot, $fname,&$filenames,&$dcx, $folder){ $dcx->resetXpath(); $nlist = $dcx->nodeList("//img/@src | //link/@href | //script/@src | //a[not(starts-with(@href,'#'))]/@href"); $css_obj_array=array(); foreach ($nlist as $nl) { $item = $nl->nodeValue; $path_parts = pathinfo($item); $fname = $path_parts['basename']; $ext = array_key_exists('extension',$path_parts) ? $path_parts['extension'] : ''; if (!is_url($folder.$nl->nodeValue) && !is_url($nl->nodeValue)) { $path = $nl->nodeValue; //$file = fullPath($path,"/"); toNativePath($path); $filenames[]= $path; } if ($ext == 'css') { $css = new cssparser(); $css->Parse($dcx->filePath().$nl->nodeValue); $css_obj_array[$item]=$css; } } $nlist = $dcx->nodeList("//*/@class"); foreach ($nlist as $nl) { $item = $nl->nodeValue; foreach ($css_obj_array as $csskey => $cssobj) { $bimg = $cssobj->Get($item,"background-image"); $limg = $cssobj->Get($item,"list-style-image"); $npath = pathinfo($csskey); if ((!empty($bimg))&& ($bimg != 'none')) { $filenames[] = stripUrl($bimg,$npath['dirname'].'/'); } else if ((!empty($limg))&& ($limg != 'none')) { $filenames[] = stripUrl($limg,$npath['dirname'].'/'); } } } $elems_to_check = array("body","p","ul","h4","a","th"); $do_we_have_it = array(); foreach ($elems_to_check as $elem) { $do_we_have_it[$elem]=($dcx->nodeList("//".$elem)->length > 0); } foreach ($elems_to_check as $elem) { if ($do_we_have_it[$elem]) { foreach ($css_obj_array as $csskey => $cssobj) { $sb = $cssobj->Get($elem, "background-image"); $sbl = $cssobj->Get($elem,"list-style-image"); $npath = pathinfo($csskey); if ((!empty($sb)) && ($sb != 'none')) { $filenames[] = stripUrl($sb,$npath['dirname'].'/'); } else if ((!empty($sbl)) && ($sbl != 'none')) { $filenames[] = stripUrl($sbl,$npath['dirname'].'/'); } } } } }PK\OaLc0c0cc_lib/gral_lib/pathutils.phpnu[. /** * Function expands all relative parts of supplied path string thus * removing things like ../../ or ./../. * * @param string $path * @param string $dirsep Character that represents directory separator should be * specified here. Default is DIRECTORY_SEPARATOR. * @return string */ function fullPath($path,$dirsep=DIRECTORY_SEPARATOR) { $token = '$IMS-CC-FILEBASE$'; $path = str_replace($token,'',$path); if ( is_string($path) && ($path != '') ) { $sep = $dirsep; $dotDir= '.'; $upDir = '..'; $length= strlen($path); $rtemp= trim($path); $start = strrpos($path, $sep); $canContinue = ($start !== false); $result= $canContinue ? '': $path; $rcount=0; while ($canContinue) { $dirPart = ($start !== false) ? substr($rtemp,$start+1,$length-$start) : $rtemp; $canContinue = ($dirPart !== false); if ($canContinue) { if ($dirPart != $dotDir) { if ($dirPart == $upDir) { $rcount++; } else { if ($rcount > 0) { $rcount--; } else { $result = ($result == '') ? $dirPart : $dirPart.$sep.$result; } } } $rtemp = substr($path,0,$start); $start = strrpos($rtemp, $sep); $canContinue = (($start !== false) || (strlen($rtemp) > 0)); } } //end while } return $result; } /** * Function strips url part from css link * * @param string $path * @param string $rootDir * @return string */ function stripUrl($path, $rootDir='') { $result = $path; if ( is_string($path) && ($path != '') ) { $start=strpos($path,'(')+1; $length=strpos($path,')')-$start; $rut = $rootDir.substr($path,$start,$length); $result=fullPath($rut,'/'); } return $result; } /** * Converts direcotry separator in given path to / to validate in CC * Value is passed byref hence variable itself is changed * * @param string $path */ function toNativePath(&$path) { for ($count = 0 ; $count < strlen($path); ++$count) { $chr = $path[$count]; if (($chr == '\\') || ($chr == '/')) { $path[$count] = '/'; } } } /** * Converts direcotry separator in given path to the one on the server platform * Value is passed byref hence variable itself is changed * * @param string $path */ function toNativePath2(&$path) { for ($count = 0 ; $count < strlen($path); ++$count) { $chr = $path[$count]; if (($chr == '\\') || ($chr == '/')) { $path[$count] = DIRECTORY_SEPARATOR; } } } /** * Converts \ Directory separator to the / more suitable for URL * * @param string $path */ function toUrlPath(&$path) { for ($count = 0 ; $count < strlen($path); ++$count) { $chr = $path[$count]; if (($chr == '\\')) { $path[$count] = '/'; } } } /** * Returns relative path from two directories with full path * * @param string $path1 * @param string $path2 * @return string */ function pathDiff($path1, $path2) { toUrlPath($path1); toUrlPath($path2); $result = ""; $bl2 = strlen($path2); $a = strpos($path1,$path2); if ($a !== false) { $result = trim(substr($path1,$bl2+$a),'/'); } return $result; } /** * Copy a file, or recursively copy a folder and its contents * * @author Aidan Lister * @version 1.0.1 * @link http://aidanlister.com/repos/v/function.copyr.php * @param string $source Source path * @param string $dest Destination path * @return bool Returns TRUE on success, FALSE on failure */ function copyr($source, $dest) { global $CFG; // Simple copy for a file if (is_file($source)) { return copy($source, $dest); } // Make destination directory if (!is_dir($dest)) { mkdir($dest, $CFG->directorypermissions, true); } // Loop through the folder $dir = dir($source); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Deep copy directories if ($dest !== "$source/$entry") { copyr("$source/$entry", "$dest/$entry"); } } // Clean up $dir->close(); return true; } /** * Function returns array with directories contained in folder (only first level) * * @param string $rootDir directory to look into * @param string $contains which string to look for * @param array $excludeitems array of names to be excluded * @param bool $startswith should the $contains value be searched only from * beginning * @return array Returns array of sub-directories. In case $rootDir path is * invalid it returns FALSE. */ function getDirectories($rootDir, $contains, $excludeitems = null, $startswith = true) { $result = is_dir($rootDir); if ($result) { $dirlist = dir($rootDir); $entry = null; $result = array(); while(false !== ($entry = $dirlist->read())) { $currdir = $rootDir.$entry; if (is_dir($currdir)) { $bret = strpos($entry,$contains); if (($bret !== false)) { if (($startswith && ($bret == 0)) || !$startswith) { if (!( is_array($excludeitems) && in_array($entry,$excludeitems) )) { $result[] = $entry; } } } } } } return $result; } function getFilesOnly($rootDir, $contains, $excludeitems = null, $startswith = true,$extension=null) { $result = is_dir($rootDir); if ($result) { $filelist = dir($rootDir); $entry = null; $result = array(); while(false !== ($entry = $filelist->read())) { $curritem = $rootDir.$entry; $pinfo = pathinfo($entry); $ext = array_key_exists('extension',$pinfo) ? $pinfo['extension'] : null; if (is_file($curritem) && (is_null($extension) || ($ext == $extension) )) { $bret = strpos($entry,$contains); if (($bret !== false)) { if (($startswith && ($bret == 0)) || !$startswith) { if (!( is_array($excludeitems) && in_array($entry,$excludeitems) )) { $result[] = $entry; } } } } } } natcasesort($result); return $result; } /** * Search an identifier in array * * @param array $array * @param string $name * */ function search_ident_by_name($array,$name){ if (empty($array)){ throw new Exception('The array given is null'); } $ident = null; foreach ($array as $k => $v){ ($k); if ($v[1] == $name){ $ident = $v[0]; break; } } return $ident; } /** * Function returns files recursivly with appeneded relative path * * @param string $startDir * @param string $rootDir * @param array $excludedirs * @param array $excludefileext * @return array */ function getRawFiles($startDir, &$fhandle, $rootDir='', $excludedirs = null, $excludefileext = null) { $result = is_dir($startDir); if ($result) { $dirlist = dir($startDir); $entry = null; while(false !== ($entry = $dirlist->read())) { $curritem = $startDir.$entry; if (($entry=='.') || ($entry =='..')) { continue; } if (is_dir($curritem)) { if (!( is_array($excludedirs) && in_array($entry,$excludedirs) )) { getRawFiles($startDir.$entry."/",$fhandle,$rootDir.$entry."/",$excludedirs,$excludefileext); } continue; } if (is_file($curritem)){ $pinfo = pathinfo($entry); $ext = array_key_exists('extension',$pinfo) ? $pinfo['extension'] : ''; if (!is_array($excludefileext) || (is_array($excludefileext) && !in_array($ext,$excludefileext))) { fwrite($fhandle,$rootDir.$entry."\n"); } } } } return $result; } function getRawFiles2($startDir,&$arr, $rootDir='', $excludedirs = null, $excludefileext = null) { $result = is_dir($startDir); if ($result) { $dirlist = dir($startDir); $entry = null; while(false !== ($entry = $dirlist->read())) { $curritem = $startDir.$entry; if (($entry=='.') || ($entry =='..')) { continue; } if (is_dir($curritem)) { if (!( is_array($excludedirs) && in_array($entry,$excludedirs) )) { getRawFiles2($startDir.$entry."/",$arr,$rootDir.$entry."/",$excludedirs,$excludefileext); } continue; } if (is_file($curritem)){ $pinfo = pathinfo($entry); $ext = array_key_exists('extension',$pinfo) ? $pinfo['extension'] : ''; if (!is_array($excludefileext) || (is_array($excludefileext) && !in_array($ext,$excludefileext))) { array_push($arr,$rootDir.$entry); // fwrite($fhandle,$rootDir.$entry."\n"); } } } } return $result; } function GetFiles($startDir, $outfile, $rootDir='', $excludedirs = null, $excludefileext = null) { $fh = @fopen($outfile,"w+"); if ($fh !== FALSE) { getRawFiles($startDir,$fh,$rootDir,$excludedirs,$excludefileext); @fclose($fh); @chmod($outfile,0777); } } /** * Function to get an array with all files in a directory and subdirectories * * @param string $startDir * @param string $rootDir * @param string $excludedirs * @param string $excludefileext * @return array */ function GetFilesArray($startDir, $rootDir='', $excludedirs = null, $excludefileext = null) { $arr = array(); getRawFiles2($startDir,$arr,$rootDir,$excludedirs,$excludefileext); return $arr; } /** * Function returns array with directories contained in folder (only first level) * simmilar to getDirectories but returned items are naturally sorted. * * @param string $rootDir * @param string $contains * @param array $excludeitems * @param bool $startswith * @return array */ function getCourseDirs ($rootDir, $contains, $excludeitems=null, $startswith=true) { $result = getDirectories($rootDir,$contains,$excludeitems,$startswith); if ($result !== false) { natcasesort($result); $result = array_values($result); } return $result; } /** * Delete a directory recursive with files inside * * @param string $dirname * @return bool */ function rmdirr($dirname) { if (!file_exists($dirname)) { return false; } if (is_file($dirname) || is_link($dirname)) { return unlink($dirname); } $dir = dir($dirname); while (false !== $entry = $dir->read()) { if ($entry == '.' || $entry == '..') { continue; } rmdirr($dirname . DIRECTORY_SEPARATOR . $entry); } $dir->close(); return rmdir($dirname); } PK\Ǻppcc_lib/cc_asssesment.phpnu[. /** * @package backup-convert * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once('cc_utils.php'); require_once('cc_general.php'); abstract class cc_xml_namespace { const xml = 'http://www.w3.org/XML/1998/namespace'; } abstract class cc_qti_metadata { // Assessment. const qmd_assessmenttype = 'qmd_assessmenttype'; const qmd_scoretype = 'qmd_scoretype'; const qmd_feedbackpermitted = 'qmd_feedbackpermitted'; const qmd_hintspermitted = 'qmd_hintspermitted'; const qmd_solutionspermitted = 'qmd_solutionspermitted'; const qmd_timelimit = 'qmd_timelimit'; const cc_allow_late_submission = 'cc_allow_late_submission'; const cc_maxattempts = 'cc_maxattempts'; const cc_profile = 'cc_profile'; // Items. const cc_weighting = 'cc_weighting'; const qmd_scoringpermitted = 'qmd_scoringpermitted'; const qmd_computerscored = 'qmd_computerscored'; const cc_question_category = 'cc_question_category'; } abstract class cc_qti_profiletype { const multiple_choice = 'cc.multiple_choice.v0p1'; const multiple_response = 'cc.multiple_response.v0p1'; const true_false = 'cc.true_false.v0p1'; const field_entry = 'cc.fib.v0p1'; const pattern_match = 'cc.pattern_match.v0p1'; const essay = 'cc.essay.v0p1'; /** * * validates a profile value * @param string $value * @return boolean */ public static function valid($value) { static $verification_values = array( self::essay, self::field_entry, self::multiple_choice, self::multiple_response, self::pattern_match, self::true_false ); return in_array($value, $verification_values); } } abstract class cc_qti_values { const exam_profile = 'cc.exam.v0p1'; const Yes = 'Yes'; const No = 'No'; const Response = 'Response'; const Solution = 'Solution'; const Hint = 'Hint'; const Examination = 'Examination'; const Percentage = 'Percentage'; const unlimited = 'unlimited'; const Single = 'Single'; const Multiple = 'Multiple'; const Ordered = 'Ordered'; const Asterisk = 'Asterisk'; const Box = 'Box'; const Dashline = 'Dashline'; const Underline = 'Underline'; const Decimal = 'Decimal'; const Integer = 'Integer'; const Scientific = 'Scientific'; const String = 'String'; const SCORE = 'SCORE'; const Set = 'Set'; const Complete = 'Complete'; const texttype = 'text/plain'; const htmltype = 'text/html'; } abstract class cc_qti_tags { const questestinterop = 'questestinterop'; const assessment = 'assessment'; const qtimetadata = 'qtimetadata'; const qtimetadatafield = 'qtimetadatafield'; const fieldlabel = 'fieldlabel'; const fieldentry = 'fieldentry'; const section = 'section'; const ident = 'ident'; const item = 'item'; const title = 'title'; const itemmetadata = 'itemmetadata'; const presentation = 'presentation'; const material = 'material'; const mattext = 'mattext'; const matref = 'matref'; const matbreak = 'matbreak'; const texttype = 'texttype'; const response_lid = 'response_lid'; const render_choice = 'render_choice'; const response_label = 'response_label'; const resprocessing = 'resprocessing'; const outcomes = 'outcomes'; const decvar = 'decvar'; const respcondition = 'respcondition'; const conditionvar = 'conditionvar'; const other = 'other'; const displayfeedback = 'displayfeedback'; const maxvalue = 'maxvalue'; const minvalue = 'minvalue'; const varname = 'varname'; const vartype = 'vartype'; const continue_ = 'continue'; const feedbacktype = 'feedbacktype'; const linkrefid = 'linkrefid'; const varequal = 'varequal'; const respident = 'respident'; const itemfeedback = 'itemfeedback'; const flow_mat = 'flow_mat'; const rcardinality = 'rcardinality'; const charset = 'charset'; const label = 'label'; const uri = 'uri'; const width = 'width'; const height = 'height'; const x0 = 'x0'; const y0 = 'y0'; const xml_lang = 'lang'; const xml_space = 'space'; const rubric = 'rubric'; const altmaterial = 'altmaterial'; const presentation_material = 'presentation_material'; const t_class = 'class'; const material_ref = 'material_ref'; const rtiming = 'rtiming'; const render_fib = 'render_fib'; const shuffle = 'shuffle'; const minnumber = 'minnumber'; const maxnumber = 'maxnumber'; const encoding = 'encoding'; const maxchars = 'maxchars'; const prompt = 'prompt'; const fibtype = 'fibtype'; const rows = 'rows'; const columns = 'columns'; const labelrefid = 'labelrefid'; const rshuffle = 'rshuffle'; const match_group = 'match_group'; const match_max = 'match_max'; const flow = 'flow'; const response_str = 'response_str'; const flow_label = 'flow_label'; const setvar = 'setvar'; const action = 'action'; const and_ = 'and'; const not_ = 'not'; const case_ = 'case'; const varsubstring = 'varsubstring'; const hint = 'hint'; const solution = 'solution'; const feedbackstyle = 'feedbackstyle'; const solutionmaterial = 'solutionmaterial'; const hintmaterial = 'hintmaterial'; } class cc_question_metadata_base { /** * @var array */ protected $metadata = array(); /** * @param string $setting * @param mixed $value */ protected function set_setting($setting, $value = null) { $this->metadata[$setting] = $value; } /** * @param string $setting * @return mixed */ protected function get_setting($setting) { $result = null; if (array_key_exists($setting, $this->metadata)) { $result = $this->metadata[$setting]; } return $result; } /** * @param string $setting * @param string $namespace * @param string $value */ protected function set_setting_wns($setting, $namespace, $value = null) { $this->metadata[$setting] = array($namespace => $value); } /** * @param string $setting * @param boolean $value */ protected function enable_setting_yesno($setting, $value = true) { $svalue = $value ? cc_qti_values::Yes : cc_qti_values::No; $this->set_setting($setting, $svalue); } /** * @param XMLGenericDocument $doc * @param DOMNode $item * @param string $namespace */ public function generate_attributes(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { foreach ($this->metadata as $attribute => $value) { if (!is_null($value)) { if (!is_array($value)) { $doc->append_new_attribute_ns($item, $namespace, $attribute, $value); } else { $ns = key($value); $nval = current($value); if (!is_null($nval)) { $doc->append_new_attribute_ns($item, $ns, $attribute, $nval); } } } } } /** * @param XMLGenericDocument $doc * @param DOMNode $item * @param string $namespace */ public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $qtimetadata = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::qtimetadata); foreach ($this->metadata as $label => $entry) { if (!is_null($entry)) { $qtimetadatafield = $doc->append_new_element_ns($qtimetadata, $namespace, cc_qti_tags::qtimetadatafield); $doc->append_new_element_ns($qtimetadatafield, $namespace, cc_qti_tags::fieldlabel, $label); $doc->append_new_element_ns($qtimetadatafield, $namespace, cc_qti_tags::fieldentry, $entry); } } } } class cc_question_metadata extends cc_question_metadata_base { public function set_category($value) { $this->set_setting(cc_qti_metadata::cc_question_category, $value); } public function set_weighting($value) { $this->set_setting(cc_qti_metadata::cc_weighting, $value); } public function enable_scoringpermitted($value = true) { $this->enable_setting_yesno(cc_qti_metadata::qmd_scoringpermitted, $value); } public function enable_computerscored($value = true) { $this->enable_setting_yesno(cc_qti_metadata::qmd_computerscored, $value); } /** * * Constructs metadata * @param string $profile * @throws InvalidArgumentException */ public function __construct($profile) { if (!cc_qti_profiletype::valid($profile)) { throw new InvalidArgumentException('Invalid profile type!'); } $this->set_setting(cc_qti_metadata::cc_profile, $profile); $this->set_setting(cc_qti_metadata::cc_question_category); $this->set_setting(cc_qti_metadata::cc_weighting ); $this->set_setting(cc_qti_metadata::qmd_scoringpermitted); $this->set_setting(cc_qti_metadata::qmd_computerscored ); } } class cc_assesment_metadata extends cc_question_metadata_base { public function enable_hints($value = true) { $this->enable_setting_yesno(cc_qti_metadata::qmd_hintspermitted, $value); } public function enable_solutions($value = true) { $this->enable_setting_yesno(cc_qti_metadata::qmd_solutionspermitted, $value); } public function enable_latesubmissions($value = true) { $this->enable_setting_yesno(cc_qti_metadata::cc_allow_late_submission, $value); } public function enable_feedback($value = true) { $this->enable_setting_yesno(cc_qti_metadata::qmd_feedbackpermitted, $value); } public function set_timelimit($value) { $ivalue = (int)$value; if (($ivalue < 0) || ($ivalue > 527401)) { throw new OutOfRangeException('Time limit value out of permitted range!'); } $this->set_setting(cc_qti_metadata::qmd_timelimit, $value); } public function set_maxattempts($value) { $valid_values = array(cc_qti_values::Examination, cc_qti_values::unlimited, 1, 2, 3, 4, 5); if (!in_array($value, $valid_values)) { throw new OutOfRangeException('Max attempts has invalid value'); } $this->set_setting(cc_qti_metadata::cc_maxattempts, $value); } public function __construct() { //prepared default values $this->set_setting(cc_qti_metadata::cc_profile , cc_qti_values::exam_profile); $this->set_setting(cc_qti_metadata::qmd_assessmenttype, cc_qti_values::Examination ); $this->set_setting(cc_qti_metadata::qmd_scoretype , cc_qti_values::Percentage ); //optional empty values $this->set_setting(cc_qti_metadata::qmd_feedbackpermitted ); $this->set_setting(cc_qti_metadata::qmd_hintspermitted ); $this->set_setting(cc_qti_metadata::qmd_solutionspermitted ); $this->set_setting(cc_qti_metadata::qmd_timelimit ); $this->set_setting(cc_qti_metadata::cc_allow_late_submission); $this->set_setting(cc_qti_metadata::cc_maxattempts ); } } class cc_assesment_mattext extends cc_question_metadata_base { protected $value = null; public function __construct($value = null) { $this->set_setting(cc_qti_tags::texttype, cc_qti_values::texttype); $this->set_setting(cc_qti_tags::charset);//, 'ascii-us'); $this->set_setting(cc_qti_tags::label); $this->set_setting(cc_qti_tags::uri); $this->set_setting(cc_qti_tags::width); $this->set_setting(cc_qti_tags::height); $this->set_setting(cc_qti_tags::x0); $this->set_setting(cc_qti_tags::y0); $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml); $this->set_setting_wns(cc_qti_tags::xml_space, cc_xml_namespace::xml);//, 'default'); $this->value = $value; } public function set_label($value) { $this->set_setting(cc_qti_tags::label, $value); } public function set_uri($value) { $this->set_setting(cc_qti_tags::uri, $value); } public function set_width_height($width = null, $height = null) { $this->set_setting(cc_qti_tags::width, $width); $this->set_setting(cc_qti_tags::height, $height); } public function set_coor($x = null, $y = null) { $this->set_setting(cc_qti_tags::x0, $x); $this->set_setting(cc_qti_tags::y0, $y); } public function set_lang($lang = null) { $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml, $lang); } public function set_content($content, $type = cc_qti_values::texttype, $charset = null) { $this->value = $content; $this->set_setting(cc_qti_tags::texttype, $type); $this->set_setting(cc_qti_tags::charset, $charset); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $mattext = $doc->append_new_element_ns_cdata($item, $namespace, cc_qti_tags::mattext, $this->value); $this->generate_attributes($doc, $mattext, $namespace); } } class cc_assesment_matref { protected $linkref = null; public function __construct($linkref) { $this->linkref = $linkref; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $doc->append_new_element_ns($item, $namespace, cc_qti_tags::matref, $this->linkref); $doc->append_new_attribute_ns($node, $namespace, cc_qti_tags::linkrefid, $this->linkref); } } class cc_assesment_response_matref extends cc_assesment_matref { public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::material_ref); $doc->append_new_attribute_ns($node, $namespace, cc_qti_tags::linkrefid, $this->linkref); } } class cc_assesment_matbreak { public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $doc->append_new_element_ns($item, $namespace, cc_qti_tags::matbreak); } } abstract class cc_assesment_material_base extends cc_question_metadata_base { /** * @var mixed */ protected $mattag = null; protected $tagname = null; protected function set_tag_value($object) { $this->mattag = $object; } public function set_mattext(cc_assesment_mattext $object) { $this->set_tag_value($object); } public function set_matref(cc_assesment_matref $object) { $this->set_tag_value($object); } public function set_matbreak(cc_assesment_matbreak $object) { $this->set_tag_value($object); } public function set_lang($value) { $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml, $value); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $material = $doc->append_new_element_ns($item, $namespace, $this->tagname); $this->generate_attributes($doc, $material, $namespace); if (!empty($this->mattag)) { $this->mattag->generate($doc, $material, $namespace); } return $material; } } class cc_assesment_altmaterial extends cc_assesment_material_base { public function __construct($value = null) { $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml); $this->tagname = cc_qti_tags::altmaterial; } } class cc_assesment_material extends cc_assesment_material_base { protected $altmaterial = null; public function __construct($value = null) { $this->set_setting(cc_qti_tags::label); $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml); $this->tagname = cc_qti_tags::material; } public function set_label($value) { $this->set_setting(cc_qti_tags::label, $value); } public function set_altmaterial(cc_assesment_altmaterial $object) { $this->altmaterial = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $material = parent::generate($doc, $item, $namespace); if (!empty($this->altmaterial)) { $this->altmaterial->generate($doc, $material, $namespace); } } } class cc_assesment_rubric_base extends cc_question_metadata_base { protected $material = null; public function set_material($object) { $this->material = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $rubric = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::rubric); if (!empty($this->material)) { $this->material->generate($doc, $rubric, $namespace); } } } class cc_assesment_presentation_material_base extends cc_question_metadata_base { protected $flowmats = array(); public function add_flow_mat($object) { $this->flowmats[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::presentation_material); if (!empty($this->flowmats)) { foreach ($this->flowmats as $flow_mat) { $flow_mat->generate($doc, $node, $namespace); } } } } class cc_assesment_flow_mat_base extends cc_question_metadata_base { protected $mattag = null; protected function set_tag_value($object) { $this->mattag = $object; } public function set_flow_mat(cc_assesment_flow_mat_base $object) { $this->set_tag_value($object); } public function set_material(cc_assesment_material $object) { $this->set_tag_value($object); } public function set_material_ref(cc_assesment_matref $object) { $this->set_tag_value($object); } public function __construct($value = null) { $this->set_setting(cc_qti_tags::t_class); } public function set_class($value) { $this->set_setting(cc_qti_tags::t_class, $value); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::flow_mat); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->mattag)) { $this->mattag->generate($doc, $node, $namespace); } } } class cc_assesment_section extends cc_question_metadata_base { /** * @var array */ protected $items = array(); public function __construct() { $this->set_setting(cc_qti_tags::ident, cc_helpers::uuidgen('I_')); $this->set_setting(cc_qti_tags::title); $this->set_setting_wns(cc_qti_tags::xml_lang, cc_xml_namespace::xml); } public function set_ident($value) { $this->set_setting(cc_qti_tags::ident, $value); } public function set_title($value) { $this->set_setting(cc_qti_tags::title, $value); } public function set_lang($value) { $this->set_setting_wns(cc_qti_tags::xml_lang, cc_xml_namespace::xml, $value); } public function add_item(cc_assesment_section_item $object) { $this->items[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::section); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->items)) { foreach ($this->items as $item) { $item->generate($doc, $node, $namespace); } } } } class cc_assesment_itemmetadata extends cc_question_metadata_base { public function add_metadata($object) { $this->metadata[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::itemmetadata); if (!empty($this->metadata)) { foreach ($this->metadata as $metaitem) { $metaitem->generate($doc, $node, $namespace); } } } } class cc_assesment_decvartype extends cc_question_metadata_base { public function __construct() { $this->set_setting(cc_qti_tags::varname, cc_qti_values::SCORE); $this->set_setting(cc_qti_tags::vartype, cc_qti_values::Integer); $this->set_setting(cc_qti_tags::minvalue); $this->set_setting(cc_qti_tags::maxvalue); } public function set_vartype($value) { $this->set_setting(cc_qti_tags::vartype, $value); } public function set_limits($min = null, $max = null) { $this->set_setting(cc_qti_tags::minvalue, $min); $this->set_setting(cc_qti_tags::maxvalue, $max); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::decvar); $this->generate_attributes($doc, $node, $namespace); } } class cc_assignment_conditionvar_othertype extends cc_question_metadata_base { public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $doc->append_new_element_ns($item, $namespace, cc_qti_tags::other); } } class cc_assignment_conditionvar_varequaltype extends cc_question_metadata_base { protected $tagname = null; protected $answerid = null; public function __construct($value = null) { if (is_null($value)) { throw new InvalidArgumentException('Must not pass null!'); } $this->answerid = $value; $this->set_setting(cc_qti_tags::respident); $this->set_setting(cc_qti_tags::case_);//, cc_qti_values::No ); $this->tagname = cc_qti_tags::varequal; } public function set_respident($value) { $this->set_setting(cc_qti_tags::respident, $value); } public function enable_case($value = true) { $this->enable_setting_yesno(cc_qti_tags::case_, $value); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, $this->tagname, $this->answerid); $this->generate_attributes($doc, $node, $namespace); } } class cc_assignment_conditionvar_varsubstringtype extends cc_assignment_conditionvar_varequaltype { public function __construct($value) { parent::__construct($value); $this->tagname = cc_qti_tags::varsubstring; } } class cc_assignment_conditionvar_andtype extends cc_question_metadata_base { protected $nots = array(); protected $varequals = array(); public function set_not(cc_assignment_conditionvar_varequaltype $object) { $this->nots[] = $object; } public function set_varequal(cc_assignment_conditionvar_varequaltype $object) { $this->varequals[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::and_); if (!empty($this->nots)) { foreach ($this->nots as $notv) { $not = $doc->append_new_element_ns($node, $namespace, cc_qti_tags::not_); $notv->generate($doc, $not, $namespace); } } if (!empty($this->varequals)) { foreach ($this->varequals as $varequal) { $varequal->generate($doc, $node, $namespace); } } } } class cc_assignment_conditionvar extends cc_question_metadata_base { /** * @var cc_assignment_conditionvar_andtype */ protected $and = null; /** * @var cc_assignment_conditionvar_othertype */ protected $other = null; /** * @var array */ protected $varequal = array(); /** * @var cc_assignment_conditionvar_varsubstringtype */ protected $varsubstring = null; public function set_and(cc_assignment_conditionvar_andtype $object) { $this->and = $object; } public function set_other(cc_assignment_conditionvar_othertype $object) { $this->other = $object; } public function set_varequal(cc_assignment_conditionvar_varequaltype $object) { $this->varequal[] = $object; } public function set_varsubstring(cc_assignment_conditionvar_varsubstringtype $object) { $this->varsubstring = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::conditionvar); if (!empty($this->and)) { $this->and->generate($doc, $node, $namespace); } if (!empty($this->other)) { $this->other->generate($doc, $node, $namespace); } if (!empty($this->varequal)) { foreach ($this->varequal as $varequal) { $varequal->generate($doc, $node, $namespace); } } if (!empty($this->varsubstring)) { $this->varsubstring->generate($doc, $node, $namespace); } } } class cc_assignment_displayfeedbacktype extends cc_question_metadata_base { public function __construct() { $this->set_setting(cc_qti_tags::feedbacktype); $this->set_setting(cc_qti_tags::linkrefid); } public function set_feedbacktype($value) { $this->set_setting(cc_qti_tags::feedbacktype, $value); } public function set_linkrefid($value) { $this->set_setting(cc_qti_tags::linkrefid, $value); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::displayfeedback); $this->generate_attributes($doc, $node, $namespace); } } class cc_assignment_setvartype extends cc_question_metadata_base { /** * @var integer */ protected $tagvalue = null; public function __construct($tagvalue = 100) { $this->set_setting(cc_qti_tags::varname, cc_qti_values::SCORE); $this->set_setting(cc_qti_tags::action , cc_qti_values::Set ); $this->tagvalue = $tagvalue; } public function set_varname($value) { $this->set_setting(cc_qti_tags::varname, $value); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::setvar, $this->tagvalue); $this->generate_attributes($doc, $node, $namespace); } } class cc_assesment_respconditiontype extends cc_question_metadata_base { /** * @var cc_assignment_conditionvar */ protected $conditionvar = null; protected $setvar = array(); protected $displayfeedback = array(); public function __construct() { $this->set_setting(cc_qti_tags::title); $this->set_setting(cc_qti_tags::continue_, cc_qti_values::No); } public function set_title($value) { $this->set_setting(cc_qti_tags::title, $value); } public function enable_continue($value = true) { $this->enable_setting_yesno(cc_qti_tags::continue_, $value); } public function set_conditionvar(cc_assignment_conditionvar $object) { $this->conditionvar = $object; } public function add_setvar(cc_assignment_setvartype $object) { $this->setvar[] = $object; } public function add_displayfeedback(cc_assignment_displayfeedbacktype $object) { $this->displayfeedback[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::respcondition); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->conditionvar)) { $this->conditionvar->generate($doc, $node, $namespace); } if (!empty($this->setvar)) { foreach ($this->setvar as $setvar) { $setvar->generate($doc, $node, $namespace); } } if (!empty($this->displayfeedback)) { foreach ($this->displayfeedback as $displayfeedback) { $displayfeedback->generate($doc, $node, $namespace); } } } } class cc_assesment_resprocessingtype extends cc_question_metadata_base { /** * @var cc_assesment_decvartype */ protected $decvar = null; /** * @var array */ protected $respconditions = array(); public function set_decvar(cc_assesment_decvartype $object) { $this->decvar = $object; } public function add_respcondition(cc_assesment_respconditiontype $object) { $this->respconditions[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::resprocessing); $outcomes = $doc->append_new_element_ns($node, $namespace, cc_qti_tags::outcomes); if (!empty($this->decvar)) { $this->decvar->generate($doc, $outcomes, $namespace); } if (!empty($this->respconditions)) { foreach ($this->respconditions as $rcond) { $rcond->generate($doc, $node, $namespace); } } } } class cc_assesment_itemfeedback_shintmaterial_base extends cc_question_metadata_base { /** * @var string */ protected $tagname = null; /** * @var array */ protected $flow_mats = array(); /** * @var array */ protected $materials = array(); /** * @param cc_assesment_flow_mattype $object */ public function add_flow_mat(cc_assesment_flow_mattype $object) { $this->flow_mats[] = $object; } /** * @param cc_assesment_material $object */ public function add_material(cc_assesment_material $object) { $this->materials[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, $this->tagname); if (!empty($this->flow_mats)) { foreach ($this->flow_mats as $flow_mat) { $flow_mat->generate($doc, $node, $namespace); } } if (!empty($this->materials)) { foreach ($this->materials as $material) { $material->generate($doc, $node, $namespace); } } } } class cc_assesment_itemfeedback_hintmaterial extends cc_assesment_itemfeedback_shintmaterial_base { public function __construct() { $this->tagname = cc_qti_tags::hint; } } class cc_assesment_itemfeedback_solutionmaterial extends cc_assesment_itemfeedback_shintmaterial_base { public function __construct() { $this->tagname = cc_qti_tags::solutionmaterial; } } class cc_assesment_itemfeedback_shintype_base extends cc_question_metadata_base { /** * @var string */ protected $tagname = null; /** * @var array */ protected $items = array(); public function __construct() { $this->set_setting(cc_qti_tags::feedbackstyle, cc_qti_values::Complete); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, $this->tagname); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->items)) { foreach ($this->items as $telement) { $telement->generate($doc, $node, $namespace); } } } } class cc_assesment_itemfeedback_solutiontype extends cc_assesment_itemfeedback_shintype_base { public function __construct() { parent::__construct(); $this->tagname = cc_qti_tags::solution; } /** * @param cc_assesment_itemfeedback_solutionmaterial $object */ public function add_solutionmaterial(cc_assesment_itemfeedback_solutionmaterial $object) { $this->items[] = $object; } } class cc_assesment_itemfeedbac_hinttype extends cc_assesment_itemfeedback_shintype_base { public function __construct() { parent::__construct(); $this->tagname = cc_qti_tags::hint; } /** * @param cc_assesment_itemfeedback_hintmaterial $object */ public function add_hintmaterial(cc_assesment_itemfeedback_hintmaterial $object) { $this->items[] = $object; } } class cc_assesment_itemfeedbacktype extends cc_question_metadata_base { /** * @var cc_assesment_flow_mattype */ protected $flow_mat = null; /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_itemfeedback_solutiontype */ protected $solution = null; protected $hint = null; /** @var cc_assignment_displayfeedbacktype item feedback. */ protected $itemfeedback; public function __construct() { $this->set_setting(cc_qti_tags::ident, cc_helpers::uuidgen('I_')); $this->set_setting(cc_qti_tags::title); } /** * @param string $value */ public function set_ident($value) { $this->set_setting(cc_qti_tags::ident, $value); } /** * @param string $value */ public function set_title($value) { $this->set_setting(cc_qti_tags::title, $value); } /** * @param cc_assesment_flow_mattype $object */ public function set_flow_mat(cc_assesment_flow_mattype $object) { $this->flow_mat = $object; } /** * @param cc_assesment_material $object */ public function set_material(cc_assesment_material $object) { $this->material = $object; } /** * @param cc_assesment_itemfeedback_solutiontype $object */ public function set_solution(cc_assesment_itemfeedback_solutiontype $object) { $this->solution = $object; } public function set_hint($object) { $this->hint = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::itemfeedback); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->flow_mat) && empty($this->material)) { $this->flow_mat->generate($doc, $node, $namespace); } if (!empty($this->material) && empty($this->flow_mat)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->solution)) { $this->solution->generate($doc, $node, $namespace); } if (!empty($this->itemfeedback)) { $this->itemfeedback->generate($doc, $node, $namespace); } } } class cc_assesment_section_item extends cc_assesment_section { /** * @var cc_assesment_itemmetadata */ protected $itemmetadata = null; /** * @var cc_assesment_presentation */ protected $presentation = null; protected $resprocessing = array(); protected $itemfeedback = array(); public function set_itemmetadata(cc_assesment_itemmetadata $object) { $this->itemmetadata = $object; } public function set_presentation(cc_assesment_presentation $object) { $this->presentation = $object; } public function add_resprocessing(cc_assesment_resprocessingtype $object) { $this->resprocessing[] = $object; } public function add_itemfeedback(cc_assesment_itemfeedbacktype $object) { $this->itemfeedback[] = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::item); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->itemmetadata)) { $this->itemmetadata->generate($doc, $node, $namespace); } if (!empty($this->presentation)) { $this->presentation->generate($doc, $node, $namespace); } if (!empty($this->resprocessing)) { foreach ($this->resprocessing as $resprocessing) { $resprocessing->generate($doc, $node, $namespace); } } if (!empty($this->itemfeedback)) { foreach ($this->itemfeedback as $itemfeedback) { $itemfeedback->generate($doc, $node, $namespace); } } } } class cc_assesment_render_choicetype extends cc_question_metadata_base { /** * @var array */ protected $materials = array(); /** * @var array */ protected $material_refs = array(); /** * @var array */ protected $response_labels = array(); /** * @var array */ protected $flow_labels = array(); public function __construct() { $this->set_setting(cc_qti_tags::shuffle, cc_qti_values::No); $this->set_setting(cc_qti_tags::minnumber); $this->set_setting(cc_qti_tags::maxnumber); } public function add_material(cc_assesment_material $object) { $this->materials[] = $object; } public function add_material_ref(cc_assesment_response_matref $object) { $this->material_refs[] = $object; } public function add_response_label(cc_assesment_response_labeltype $object) { $this->response_labels[] = $object; } public function add_flow_label($object) { $this->flow_labels[] = $object; } public function enable_shuffle($value = true) { $this->enable_setting_yesno(cc_qti_tags::shuffle, $value); } public function set_limits($min = null, $max = null) { $this->set_setting(cc_qti_tags::minnumber, $min); $this->set_setting(cc_qti_tags::maxnumber, $max); } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::render_choice); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->materials)) { foreach ($this->materials as $mattag) { $mattag->generate($doc, $node, $namespace); } } if (!empty($this->material_refs)) { foreach ($this->material_refs as $matreftag) { $matreftag->generate($doc, $node, $namespace); } } if (!empty($this->response_labels)) { foreach ($this->response_labels as $resplabtag) { $resplabtag->generate($doc, $node, $namespace); } } if (!empty($this->flow_labels)) { foreach ($this->flow_labels as $flowlabtag) { $flowlabtag->generate($doc, $node, $namespace); } } } } class cc_assesment_flow_mattype extends cc_question_metadata_base { /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_response_matref */ protected $material_ref = null; /** * @var cc_assesment_flow_mattype */ protected $flow_mat = null; public function __construct() { $this->set_setting(cc_qti_tags::t_class); } public function set_class($value) { $this->set_setting(cc_qti_tags::t_class, $value); } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_material_ref(cc_assesment_response_matref $object) { $this->material_ref = $object; } public function set_flow_mat(cc_assesment_flow_mattype $object) { $this->flow_mat = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::flow_mat); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->flow_mat)) { $this->flow_mat->generate($doc, $node, $namespace); } if (!empty($this->material)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->material_ref)) { $this->material_ref->generate($doc, $node, $namespace); } } } class cc_assesment_response_labeltype extends cc_question_metadata_base { /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_response_matref */ protected $material_ref = null; /** * @var cc_assesment_flow_mattype */ protected $flow_mat = null; public function __construct() { $this->set_setting(cc_qti_tags::ident, cc_helpers::uuidgen('I_')); $this->set_setting(cc_qti_tags::labelrefid); $this->set_setting(cc_qti_tags::rshuffle); $this->set_setting(cc_qti_tags::match_group); $this->set_setting(cc_qti_tags::match_max); } public function set_ident($value) { $this->set_setting(cc_qti_tags::ident, $value); } public function get_ident() { return $this->get_setting(cc_qti_tags::ident); } public function set_labelrefid($value) { $this->set_setting(cc_qti_tags::labelrefid, $value); } public function enable_rshuffle($value = true) { $this->enable_setting_yesno(cc_qti_tags::rshuffle, $value); } public function set_match_group($value) { $this->set_setting(cc_qti_tags::match_group, $value); } public function set_match_max($value) { $this->set_setting(cc_qti_tags::match_max, $value); } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_material_ref(cc_assesment_response_matref $object) { $this->material_ref = $object; } public function set_flow_mat(cc_assesment_flow_mattype $object) { $this->flow_mat = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::response_label); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->material)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->material_ref)) { $this->material_ref->generate($doc, $node, $namespace); } if (!empty($this->flow_mat)) { $this->flow_mat->generate($doc, $node, $namespace); } } } class cc_assesment_flow_labeltype extends cc_question_metadata_base { /** * @var cc_assesment_flow_labeltype */ protected $flow_label = null; /** * @var cc_assesment_response_labeltype */ protected $response_label = null; /** @var cc_assesment_material assesment material. */ protected $material; /** @var cc_assesment_response_matref assesment response material ref. */ protected $material_ref; public function __construct() { $this->set_setting(cc_qti_tags::t_class); } public function set_class($value) { $this->set_setting(cc_qti_tags::t_class, $value); } public function set_flow_label(cc_assesment_flow_labeltype $object) { $this->flow_label = $object; } public function set_response_label(cc_assesment_response_labeltype $object) { $this->response_label = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::flow_label); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->material)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->material_ref)) { $this->material_ref->generate($doc, $node, $namespace); } if (!empty($this->response_label)) { $this->response_label->generate($doc, $node, $namespace); } if (!empty($this->flow_label)) { $this->flow_label->generate($doc, $node, $namespace); } } } class cc_assesment_render_fibtype extends cc_question_metadata_base { /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_response_matref */ protected $material_ref = null; /** * @var cc_assesment_response_labeltype */ protected $response_label = null; /** * * Enter description here ... * @var unknown_type */ protected $flow_label = null; public function __construct() { $this->set_setting(cc_qti_tags::encoding ); $this->set_setting(cc_qti_tags::charset ); $this->set_setting(cc_qti_tags::rows ); $this->set_setting(cc_qti_tags::columns ); $this->set_setting(cc_qti_tags::maxchars ); $this->set_setting(cc_qti_tags::minnumber); $this->set_setting(cc_qti_tags::maxnumber); $this->set_setting(cc_qti_tags::prompt, cc_qti_values::Box); $this->set_setting(cc_qti_tags::fibtype, cc_qti_values::String); } public function set_encoding($value) { $this->set_setting(cc_qti_tags::encoding, $value); } public function set_charset($value) { $this->set_setting(cc_qti_tags::charset, $value); } public function set_rows($value) { $this->set_setting(cc_qti_tags::rows, $value); } public function set_columns($value) { $this->set_setting(cc_qti_tags::columns, $value); } public function set_maxchars($value) { $this->set_setting(cc_qti_tags::columns, $value); } public function set_limits($min = null, $max = null) { $this->set_setting(cc_qti_tags::minnumber, $min); $this->set_setting(cc_qti_tags::maxnumber, $max); } public function set_prompt($value) { $this->set_setting(cc_qti_tags::prompt, $value); } public function set_fibtype($value) { $this->set_setting(cc_qti_tags::fibtype, $value); } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_material_ref(cc_assesment_response_matref $object) { $this->material_ref = $object; } public function set_response_label(cc_assesment_response_labeltype $object) { $this->response_label = $object; } public function set_flow_label($object) { $this->flow_label = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::render_fib); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->material) && empty($this->material_ref)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->material_ref) && empty($this->material)) { $this->material_ref->generate($doc, $node, $namespace); } if (!empty($this->response_label)) { $this->response_label->generate($doc, $node, $namespace); } if (!empty($this->flow_label)) { $this->flow_label->generate($doc, $node, $namespace); } } } class cc_response_lidtype extends cc_question_metadata_base { /** * @var string */ protected $tagname = null; /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_response_matref */ protected $material_ref = null; /** * @var cc_assesment_render_choicetype */ protected $render_choice = null; /** * @var cc_assesment_render_fibtype */ protected $render_fib = null; public function __construct() { $this->set_setting(cc_qti_tags::rcardinality, cc_qti_values::Single); $this->set_setting(cc_qti_tags::rtiming); $this->set_setting(cc_qti_tags::ident, cc_helpers::uuidgen('I_')); $this->tagname = cc_qti_tags::response_lid; } public function set_rcardinality($value) { $this->set_setting(cc_qti_tags::rcardinality, $value); } public function enable_rtiming($value = true) { $this->enable_setting_yesno(cc_qti_tags::rtiming, $value); } public function set_ident($value) { $this->set_setting(cc_qti_tags::ident, $value); } public function get_ident() { return $this->get_setting(cc_qti_tags::ident); } public function set_material_ref(cc_assesment_response_matref $object) { $this->material_ref = $object; } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_render_choice(cc_assesment_render_choicetype $object) { $this->render_choice = $object; } public function set_render_fib(cc_assesment_render_fibtype $object) { $this->render_fib = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, $this->tagname); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->material) && empty($this->material_ref)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->material_ref) && empty($this->material)) { $this->material_ref->generate($doc, $node, $namespace); } if (!empty($this->render_choice) && empty($this->render_fib)) { $this->render_choice->generate($doc, $node, $namespace); } if (!empty($this->render_fib) && empty($this->render_choice)) { $this->render_fib->generate($doc, $node, $namespace); } } } class cc_assesment_response_strtype extends cc_response_lidtype { public function __construct() { $rtt = parent::__construct(); $this->tagname = cc_qti_tags::response_str; } } class cc_assesment_flowtype extends cc_question_metadata_base { /** * @var cc_assesment_flowtype */ protected $flow = null; /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_assesment_response_matref */ protected $material_ref = null; /** * @var cc_response_lidtype */ protected $response_lid = null; /** * @var cc_assesment_response_strtype */ protected $response_str = null; public function __construct() { $this->set_setting(cc_qti_tags::t_class); } public function set_class($value) { $this->set_setting(cc_qti_tags::t_class, $value); } public function set_flow(cc_assesment_flowtype $object) { $this->flow = $object; } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_material_ref(cc_assesment_response_matref $object) { $this->material_ref = $object; } public function set_response_lid(cc_response_lidtype $object) { $this->response_lid = $object; } public function set_response_str(cc_assesment_response_strtype $object) { $this->response_str = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::flow); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->flow)) { $this->flow->generate($doc, $node, $namespace); } if (!empty($this->material)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->response_lid)) { $this->response_lid->generate($doc, $node, $namespace); } if (!empty($this->response_str)) { $this->response_str->generate($doc, $node, $namespace); } } } class cc_assesment_presentation extends cc_question_metadata_base { /** * @var cc_assesment_flowtype */ protected $flow = null; /** * @var cc_assesment_material */ protected $material = null; /** * @var cc_response_lidtype */ protected $response_lid = null; /** * @var cc_assesment_response_strtype */ protected $response_str = null; public function __construct() { $this->set_setting(cc_qti_tags::label); $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml); $this->set_setting(cc_qti_tags::x0); $this->set_setting(cc_qti_tags::y0); $this->set_setting(cc_qti_tags::width); $this->set_setting(cc_qti_tags::height); } public function set_label($value) { $this->set_setting(cc_qti_tags::label, $value); } public function set_lang($value) { $this->set_setting_wns(cc_qti_tags::xml_lang , cc_xml_namespace::xml, $value); } public function set_coor($x = null, $y = null) { $this->set_setting(cc_qti_tags::x0, $x); $this->set_setting(cc_qti_tags::y0, $y); } public function set_size($width = null, $height = null) { $this->set_setting(cc_qti_tags::width, $width); $this->set_setting(cc_qti_tags::height, $height); } public function set_flow(cc_assesment_flowtype $object) { $this->flow = $object; } public function set_material(cc_assesment_material $object) { $this->material = $object; } public function set_response_lid(cc_response_lidtype $object) { $this->response_lid = $object; } public function set_response_str(cc_assesment_response_strtype $object) { $this->response_str = $object; } public function generate(XMLGenericDocument &$doc, DOMNode &$item, $namespace) { $node = $doc->append_new_element_ns($item, $namespace, cc_qti_tags::presentation); $this->generate_attributes($doc, $node, $namespace); if (!empty($this->flow)) { $this->flow->generate($doc, $node, $namespace); } if (!empty($this->material) && empty($this->flow)) { $this->material->generate($doc, $node, $namespace); } if (!empty($this->response_lid) && empty($this->flow)) { $this->response_lid->generate($doc, $node, $namespace); } if (!empty($this->response_str) && empty($this->flow)) { $this->response_str->generate($doc, $node, $namespace); } } } class assesment1_resurce_file extends general_cc_file { const deafultname = 'assesment.xml'; protected $rootns = 'xmlns'; protected $rootname = cc_qti_tags::questestinterop; protected $ccnamespaces = array('xmlns' => 'http://www.imsglobal.org/xsd/ims_qtiasiv1p2', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('xmlns' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_4/ims_qtiasiv1p2_localised.xsd'); /** * @var string */ protected $assessment_title = 'Untitled'; /** * @var cc_assesment_metadata */ protected $metadata = null; /** * @var cc_assesment_rubric_base */ protected $rubric = null; /** * @var cc_assesment_presentation_material_base */ protected $presentation_material = null; /** * @var cc_assesment_section */ protected $section = null; public function set_metadata(cc_assesment_metadata $object) { $this->metadata = $object; } public function set_rubric(cc_assesment_rubric_base $object) { $this->rubric = $object; } public function set_presentation_material(cc_assesment_presentation_material_base $object) { $this->presentation_material = $object; } public function set_section(cc_assesment_section $object) { $this->section = $object; } public function set_title($value) { $this->assessment_title = self::safexml($value); } protected function on_save() { $rns = $this->ccnamespaces[$this->rootns]; //root assesment element - required $assessment = $this->append_new_element_ns($this->root, $rns, cc_qti_tags::assessment); $this->append_new_attribute_ns($assessment, $rns, cc_qti_tags::ident, cc_helpers::uuidgen('QDB_')); $this->append_new_attribute_ns($assessment, $rns, cc_qti_tags::title, $this->assessment_title); //metadata - optional if (!empty($this->metadata)) { $this->metadata->generate($this, $assessment, $rns); } //rubric - optional if (!empty($this->rubric)) { $this->rubric->generate($this, $assessment, $rns); } //presentation_material - optional if (!empty($this->presentation_material)) { $this->presentation_material->generate($this, $assessment, $rns); } //section - required if (!empty($this->section)) { $this->section->generate($this, $assessment, $rns); } return true; } } class assesment11_resurce_file extends assesment1_resurce_file { protected $ccnsnames = array('xmlns' => 'http://www.imsglobal.org/profile/cc/ccv1p1/ccv1p1_qtiasiv1p2p1_v1p0.xsd'); } abstract class cc_assesment_helper { public static $correct_fb = null; public static $incorrect_fb = null; public static function add_feedback($qitem, $content, $content_type, $ident) { if (empty($content)) { return false; } $qitemfeedback = new cc_assesment_itemfeedbacktype(); $qitem->add_itemfeedback($qitemfeedback); if (!empty($ident)) { $qitemfeedback->set_ident($ident); } $qflowmat = new cc_assesment_flow_mattype(); $qitemfeedback->set_flow_mat($qflowmat); $qmaterialfb = new cc_assesment_material(); $qflowmat->set_material($qmaterialfb); $qmattext = new cc_assesment_mattext(); $qmaterialfb->set_mattext($qmattext); $qmattext->set_content($content, $content_type); return true; } public static function add_answer($qresponse_choice, $content, $content_type) { $qresponse_label = new cc_assesment_response_labeltype(); $qresponse_choice->add_response_label($qresponse_label); $qrespmaterial = new cc_assesment_material(); $qresponse_label->set_material($qrespmaterial); $qrespmattext = new cc_assesment_mattext(); $qrespmaterial->set_mattext($qrespmattext); $qrespmattext->set_content($content, $content_type); return $qresponse_label; } public static function add_response_condition($node, $title, $ident, $feedback_refid, $respident) { $qrespcondition = new cc_assesment_respconditiontype(); $node->add_respcondition($qrespcondition); //define rest of the conditions $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qvarequal = new cc_assignment_conditionvar_varequaltype($ident); $qvarequal->enable_case(); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident($respident); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($feedback_refid); } public static function add_assesment_description($rt, $content, $contenttype) { if (empty($rt) || empty($content)) { return; } $activity_rubric = new cc_assesment_rubric_base(); $rubric_material = new cc_assesment_material(); $activity_rubric->set_material($rubric_material); $rubric_mattext = new cc_assesment_mattext(); $rubric_material->set_label('Summary'); $rubric_material->set_mattext($rubric_mattext); $rubric_mattext->set_content($content, $contenttype); $rt->set_rubric($activity_rubric); } public static function add_respcondition($node, $title, $feedback_refid, $grade_value = null, $continue = false ) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title($title); $node->add_respcondition($qrespcondition); $qrespcondition->enable_continue($continue); //Add setvar if grade present if ($grade_value !== null) { $qsetvar = new cc_assignment_setvartype($grade_value); $qrespcondition->add_setvar($qsetvar); } //define the condition for success $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($feedback_refid); } /** * * Enter description here ... * @param XMLGenericDocument $qdoc * @param unknown_type $manifest * @param cc_assesment_section $section * @param unknown_type $rootpath * @param unknown_type $contextid * @param unknown_type $outdir */ public static function process_questions(&$qdoc, &$manifest, cc_assesment_section &$section, $rootpath, $contextid, $outdir) { $question_file = $rootpath . DIRECTORY_SEPARATOR . 'questions.xml'; //load questions file $questions = new XMLGenericDocument(); if (!$questions->load($question_file)) { return false; } pkg_resource_dependencies::instance()->reset(); $questioncount = 0; $questionforexport = 0; $qids = $qdoc->nodeList('//question_instances//questionid'); foreach ($qids as $qid) { /** @var DOMNode $qid */ $value = $qid->nodeValue; if (intval($value) == 0) { continue; } $question_node = $questions->node("//question_category/questions/question[@id='{$value}']"); if (empty($question_node)) { continue; } ++$questionforexport; //process question //question type $qtype = $questions->nodeValue('qtype', $question_node); $question_processor = null; switch ($qtype) { case 'multichoice': $single_correct_answer = (int)$questions->nodeValue('plugin_qtype_multichoice_question/multichoice/single', $question_node) > 0; //TODO: Add checking for the nunmber of valid responses //If question is marked as multi response but contains only one valid answer it //should be handle as single response - classic multichoice if ($single_correct_answer) { $question_processor = new cc_assesment_question_multichoice($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); } else { $question_processor = new cc_assesment_question_multichoice_multiresponse($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); } $question_processor->generate(); ++$questioncount; break; case 'truefalse': $question_processor = new cc_assesment_question_truefalse($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $question_processor->generate(); ++$questioncount; break; case 'essay': $question_processor = new cc_assesment_question_essay($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $question_processor->generate(); ++$questioncount; break; case 'shortanswer': //This is rather ambiguos since shortanswer supports partial pattern match //In order to detect pattern match we need to scan for all the responses //if at least one of the responses uses wildcards it should be treated as //pattern match, otherwise it should be simple fill in the blank if (self::has_matching_element($questions, $question_node)) { //$question_processor = new cc_assesment_question_patternmatch($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $questionforexport--; } else { $question_processor = new cc_assesment_question_sfib($qdoc, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); } if (!empty($question_processor)) { $question_processor->generate(); ++$questioncount; } break; default: ; break; } } //return dependencies return ($questioncount == 0) || ($questioncount != $questionforexport)? false: pkg_resource_dependencies::instance()->get_deps(); } /** * * Checks if question has matching element * @param XMLGenericDocument $questions * @param object $question_node * @return bool */ public static function has_matching_element(XMLGenericDocument $questions, $question_node) { $answers = $questions->nodeList('plugin_qtype_shortanswer_question//answertext', $question_node); $result = false; foreach ($answers as $answer) { $prepare = str_replace('\*', '\#', $answer->nodeValue); $result = (strpos($prepare, '*') !== false); if ($result) { break; } } return $result; } } class cc_assesment_question_proc_base { /** * @var XMLGenericDocument */ protected $quiz = null; /** * @var XMLGenericDocument */ protected $questions = null; /** * @var cc_manifest */ protected $manifest = null; /** * @var cc_assesment_section */ protected $section = null; /** * @var DOMElement */ protected $question_node = null; /** * @var string */ protected $rootpath = null; /** * @var string */ protected $contextid = null; /** * @var string */ protected $outdir = null; /** * @var string */ protected $qtype = null; /** * @var cc_question_metadata */ protected $qmetadata = null; /** * @var cc_assesment_section_item */ protected $qitem = null; /** * @var cc_assesment_presentation */ protected $qpresentation = null; /** * @var cc_response_lidtype */ protected $qresponse_lid = null; protected $qresprocessing = null; protected $correct_grade_value = null; protected $correct_answer_node_id = null; protected $correct_answer_ident = null; protected $total_grade_value = null; protected $answerlist = null; protected $general_feedback = null; protected $correct_feedbacks = array(); protected $incorrect_feedbacks = array(); /** * @param XMLGenericDocument $questions * @param cc_manifest $manifest * @param cc_assesment_section $section * @param DOMElement $question_node * @param string $rootpath * @param string $contextid * @param string $outdir */ public function __construct(XMLGenericDocument &$quiz, XMLGenericDocument &$questions, cc_manifest &$manifest, cc_assesment_section &$section, &$question_node, $rootpath, $contextid, $outdir) { $this->quiz = $quiz; $this->questions = $questions; $this->manifest = $manifest; $this->section = $section; $this->question_node = $question_node; $this->rootpath = $rootpath; $this->contextid = $contextid; $this->outdir = $outdir; // $qitem = new cc_assesment_section_item(); $this->section->add_item($qitem); $qitem->set_title($this->questions->nodeValue('name', $this->question_node)); $this->qitem = $qitem; } public function on_generate_metadata() { if (empty($this->qmetadata)) { $this->qmetadata = new cc_question_metadata($this->qtype); //Get weighting value $weighting_value = (int)$this->questions->nodeValue('defaultmark', $this->question_node); if ($weighting_value > 1) { $this->qmetadata->set_weighting($weighting_value); } //Get category $question_category = $this->questions->nodeValue('../../name', $this->question_node); if (!empty($question_category)) { $this->qmetadata->set_category($question_category); } $rts = new cc_assesment_itemmetadata(); $rts->add_metadata($this->qmetadata); $this->qitem->set_itemmetadata($rts); } } public function on_generate_presentation() { if (empty($this->qpresentation)) { $qpresentation = new cc_assesment_presentation(); $this->qitem->set_presentation($qpresentation); //add question text $qmaterial = new cc_assesment_material(); $qmattext = new cc_assesment_mattext(); $question_text = $this->questions->nodeValue('questiontext', $this->question_node); $result = cc_helpers::process_linked_files( $question_text, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); $qmattext->set_content($result[0], cc_qti_values::htmltype); $qmaterial->set_mattext($qmattext); $qpresentation->set_material($qmaterial); $this->qpresentation = $qpresentation; pkg_resource_dependencies::instance()->add($result[1]); } } public function on_generate_answers() {} public function on_generate_feedbacks() { $general_question_feedback = $this->questions->nodeValue('generalfeedback', $this->question_node); if (empty($general_question_feedback)) { return; } $name = 'general_fb'; //Add question general feedback - the one that should be always displayed $result = cc_helpers::process_linked_files( $general_question_feedback, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback($this->qitem, $result[0], cc_qti_values::htmltype, $name); pkg_resource_dependencies::instance()->add($result[1]); $this->general_feedback = $name; } public function on_generate_response_processing() { $qresprocessing = new cc_assesment_resprocessingtype(); $this->qitem->add_resprocessing($qresprocessing); $qdecvar = new cc_assesment_decvartype(); $qresprocessing->set_decvar($qdecvar); //according to the Common Cartridge 1.1 Profile: Implementation document //this should always be set to 0, 100 in case of question type that is not essay $qdecvar->set_limits(0,100); $qdecvar->set_vartype(cc_qti_values::Decimal); $this->qresprocessing = $qresprocessing; } public function generate() { $this->on_generate_metadata(); $this->on_generate_presentation(); $this->on_generate_answers(); $this->on_generate_feedbacks(); $this->on_generate_response_processing(); } } class cc_assesment_question_multichoice extends cc_assesment_question_proc_base { public function __construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir) { parent::__construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $this->qtype = cc_qti_profiletype::multiple_choice; /** * * What is needed is a maximum grade value taken from the answer fraction * It is supposed to always be between 1 and 0 in decimal representation, * however that is not always the case so a change in test was needed * but since we support here one correct answer type * correct answer would always have to be 1 */ $correct_answer_node = $this->questions->node("plugin_qtype_multichoice_question/answers/answer[fraction > 0]", $this->question_node); if (empty($correct_answer_node)) { throw new RuntimeException('No correct answer!'); } $this->correct_answer_node_id = $this->questions->nodeValue('@id', $correct_answer_node); $maximum_quiz_grade = (int)$this->quiz->nodeValue('/activity/quiz/grade'); $this->total_grade_value = ($maximum_quiz_grade + 1).'.0000000'; } public function on_generate_answers() { //add responses holder $qresponse_lid = new cc_response_lidtype(); $this->qresponse_lid = $qresponse_lid; $this->qpresentation->set_response_lid($qresponse_lid); $qresponse_choice = new cc_assesment_render_choicetype(); $qresponse_lid->set_render_choice($qresponse_choice); //Mark that question has only one correct answer - //which applies for multiple choice and yes/no questions $qresponse_lid->set_rcardinality(cc_qti_values::Single); //are we to shuffle the responses? $shuffle_answers = (int)$this->quiz->nodeValue('/activity/quiz/shuffleanswers') > 0; $qresponse_choice->enable_shuffle($shuffle_answers); $answerlist = array(); $qa_responses = $this->questions->nodeList('plugin_qtype_multichoice_question/answers/answer', $this->question_node); foreach ($qa_responses as $node) { $answer_content = $this->questions->nodeValue('answertext', $node); $id = ((int)$this->questions->nodeValue('@id', $node) == $this->correct_answer_node_id); $result = cc_helpers::process_linked_files( $answer_content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); $qresponse_label = cc_assesment_helper::add_answer( $qresponse_choice, $result[0], cc_qti_values::htmltype); pkg_resource_dependencies::instance()->add($result[1]); $answer_ident = $qresponse_label->get_ident(); $feedback_ident = $answer_ident.'_fb'; if (empty($this->correct_answer_ident) && $id) { $this->correct_answer_ident = $answer_ident; } //add answer specific feedbacks if not empty $content = $this->questions->nodeValue('feedback', $node); if (!empty($content)) { $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $feedback_ident); pkg_resource_dependencies::instance()->add($result[1]); $answerlist[$answer_ident] = $feedback_ident; } } $this->answerlist = $answerlist; } public function on_generate_feedbacks() { parent::on_generate_feedbacks(); //Question combined feedbacks $correct_question_fb = $this->questions->nodeValue('plugin_qtype_multichoice_question/multichoice/correctfeedback', $this->question_node); $incorrect_question_fb = $this->questions->nodeValue('plugin_qtype_multichoice_question/multichoice/incorrectfeedback', $this->question_node); $proc = array('correct_fb' => $correct_question_fb, 'general_incorrect_fb' => $incorrect_question_fb); foreach ($proc as $ident => $content) { if (empty($content)) { continue; } $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $ident); pkg_resource_dependencies::instance()->add($result[1]); if ($ident == 'correct_fb') { $this->correct_feedbacks[] = $ident; } else { $this->incorrect_feedbacks[] = $ident; } } } public function on_generate_response_processing() { parent::on_generate_response_processing(); //respconditions /** * General unconditional feedback must be added as a first respcondition * without any condition and just displayfeedback (if exists) */ if (!empty($this->general_feedback)) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('General feedback'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(); //define the condition for success $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid('general_fb'); } //success condition /** * For all question types outside of the Essay question, scoring is done in a * single with a continue flag set to No. The outcome is always * a variable named SCORE which value must be set to 100 in case of correct answer. * Partial scores (not 0 or 100) are not supported. */ $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('Correct'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(false); $qsetvar = new cc_assignment_setvartype(100); $qrespcondition->add_setvar($qsetvar); //define the condition for success $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qvarequal = new cc_assignment_conditionvar_varequaltype($this->correct_answer_ident); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident($this->qresponse_lid->get_ident()); if (array_key_exists($this->correct_answer_ident, $this->answerlist)) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($this->answerlist[$this->correct_answer_ident]); } foreach ($this->correct_feedbacks as $ident) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($ident); } //rest of the conditions foreach ($this->answerlist as $ident => $refid) { if ($ident == $this->correct_answer_ident) { continue; } $qrespcondition = new cc_assesment_respconditiontype(); $this->qresprocessing->add_respcondition($qrespcondition); $qsetvar = new cc_assignment_setvartype(0); $qrespcondition->add_setvar($qsetvar); //define the condition for fail $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qvarequal = new cc_assignment_conditionvar_varequaltype($ident); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident($this->qresponse_lid->get_ident()); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($refid); foreach ($this->incorrect_feedbacks as $ident) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($ident); } } } } class cc_assesment_question_multichoice_multiresponse extends cc_assesment_question_proc_base { /** * @var DOMNodeList */ protected $correct_answers = null; public function __construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir) { parent::__construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $this->qtype = cc_qti_profiletype::multiple_response; $correct_answer_nodes = $this->questions->nodeList("plugin_qtype_multichoice_question/answers/answer[fraction > 0]", $this->question_node); if ($correct_answer_nodes->length == 0) { throw new RuntimeException('No correct answer!'); } $this->correct_answers = $correct_answer_nodes; //$this->correct_answer_node_id = $this->questions->nodeValue('@id', $correct_answer_node); $maximum_quiz_grade = (int)$this->quiz->nodeValue('/activity/quiz/grade'); $this->total_grade_value = ($maximum_quiz_grade + 1).'.0000000'; } public function on_generate_answers() { //add responses holder $qresponse_lid = new cc_response_lidtype(); $this->qresponse_lid = $qresponse_lid; $this->qpresentation->set_response_lid($qresponse_lid); $qresponse_choice = new cc_assesment_render_choicetype(); $qresponse_lid->set_render_choice($qresponse_choice); //Mark that question has more than one correct answer $qresponse_lid->set_rcardinality(cc_qti_values::Multiple); //are we to shuffle the responses? $shuffle_answers = (int)$this->quiz->nodeValue('/activity/quiz/shuffleanswers') > 0; $qresponse_choice->enable_shuffle($shuffle_answers); $answerlist = array(); $qa_responses = $this->questions->nodeList('plugin_qtype_multichoice_question/answers/answer', $this->question_node); foreach ($qa_responses as $node) { $answer_content = $this->questions->nodeValue('answertext', $node); $answer_grade_fraction = (float)$this->questions->nodeValue('fraction', $node); $result = cc_helpers::process_linked_files( $answer_content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); $qresponse_label = cc_assesment_helper::add_answer( $qresponse_choice, $result[0], cc_qti_values::htmltype); pkg_resource_dependencies::instance()->add($result[1]); $answer_ident = $qresponse_label->get_ident(); $feedback_ident = $answer_ident.'_fb'; //add answer specific feedbacks if not empty $content = $this->questions->nodeValue('feedback', $node); if (!empty($content)) { $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $feedback_ident); pkg_resource_dependencies::instance()->add($result[1]); } $answerlist[$answer_ident] = array($feedback_ident, ($answer_grade_fraction > 0)); } $this->answerlist = $answerlist; } public function on_generate_feedbacks() { parent::on_generate_feedbacks(); //Question combined feedbacks $correct_question_fb = $this->questions->nodeValue('plugin_qtype_multichoice_question/multichoice/correctfeedback', $this->question_node); $incorrect_question_fb = $this->questions->nodeValue('plugin_qtype_multichoice_question/multichoice/incorrectfeedback', $this->question_node); if (empty($correct_question_fb)) { //Hardcode some text for now $correct_question_fb = 'Well done!'; } if (empty($incorrect_question_fb)) { //Hardcode some text for now $incorrect_question_fb = 'Better luck next time!'; } $proc = array('correct_fb' => $correct_question_fb, 'incorrect_fb' => $incorrect_question_fb); foreach ($proc as $ident => $content) { if (empty($content)) { continue; } $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $ident); pkg_resource_dependencies::instance()->add($result[1]); if ($ident == 'correct_fb') { $this->correct_feedbacks[$ident] = $ident; } else { $this->incorrect_feedbacks[$ident] = $ident; } } } public function on_generate_response_processing() { parent::on_generate_response_processing(); //respconditions /** * General unconditional feedback must be added as a first respcondition * without any condition and just displayfeedback (if exists) */ cc_assesment_helper::add_respcondition( $this->qresprocessing, 'General feedback', $this->general_feedback, null, true ); //success condition /** * For all question types outside of the Essay question, scoring is done in a * single with a continue flag set to No. The outcome is always * a variable named SCORE which value must be set to 100 in case of correct answer. * Partial scores (not 0 or 100) are not supported. */ $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('Correct'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(false); $qsetvar = new cc_assignment_setvartype(100); $qrespcondition->add_setvar($qsetvar); //define the condition for success $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); //create root and condition $qandcondition = new cc_assignment_conditionvar_andtype(); $qconditionvar->set_and($qandcondition); foreach ($this->answerlist as $ident => $refid) { $qvarequal = new cc_assignment_conditionvar_varequaltype($ident); $qvarequal->enable_case(); if ($refid[1]) { $qandcondition->set_varequal($qvarequal); } else { $qandcondition->set_not($qvarequal); } $qvarequal->set_respident($this->qresponse_lid->get_ident()); } $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); //TODO: this needs to be fixed reset($this->correct_feedbacks); $ident = key($this->correct_feedbacks); $qdisplayfeedback->set_linkrefid($ident); //rest of the conditions foreach ($this->answerlist as $ident => $refid) { cc_assesment_helper::add_response_condition( $this->qresprocessing, 'Incorrect feedback', $refid[0], $this->general_feedback, $this->qresponse_lid->get_ident() ); } //Final element for incorrect feedback reset($this->incorrect_feedbacks); $ident = key($this->incorrect_feedbacks); cc_assesment_helper::add_respcondition( $this->qresprocessing, 'Incorrect feedback', $ident, 0 ); } } PK\I};;cc_lib/cc_utils.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('xmlbase.php'); /** * * Various helper utils * @author Darko Miletic dmiletic@moodlerooms.com * */ abstract class cc_helpers { /** * Checks extension of the supplied filename * * @param string $filename */ public static function is_html($filename) { $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); return in_array($extension, array('htm', 'html')); } /** * Generates unique identifier * @param string $prefix * @param string $suffix * @return string */ public static function uuidgen($prefix = '', $suffix = '', $uppercase = true) { $uuid = trim(sprintf('%s%04x%04x%s', $prefix, mt_rand(0, 65535), mt_rand(0, 65535), $suffix)); $result = $uppercase ? strtoupper($uuid) : strtolower($uuid); return $result; } /** * Creates new folder with random name * @param string $where * @param string $prefix * @param string $suffix * @return mixed - directory short name or false in case of failure */ public static function randomdir($where, $prefix = '', $suffix = '') { global $CFG; $dirname = false; $randomname = self::uuidgen($prefix, $suffix, false); $newdirname = $where.DIRECTORY_SEPARATOR.$randomname; if (mkdir($newdirname)) { chmod($newdirname, $CFG->directorypermissions); $dirname = $randomname; } return $dirname; } public static function build_query($attributes, $search) { $result = ''; foreach ($attributes as $attribute) { if ($result != '') { $result .= ' | '; } $result .= "//*[starts-with(@{$attribute},'{$search}')]/@{$attribute}"; } return $result; } public static function process_embedded_files(&$doc, $attributes, $search, $customslash = null) { $result = array(); $query = self::build_query($attributes, $search); $list = $doc->nodeList($query); foreach ($list as $filelink) { $rvalue = str_replace($search, '', $filelink->nodeValue); if (!empty($customslash)) { $rvalue = str_replace($customslash, '/', $rvalue); } $result[] = rawurldecode($rvalue); } return $result; } /** * * Get list of embedded files * @param string $html * @return multitype:mixed */ public static function embedded_files($html) { $result = array(); $doc = new XMLGenericDocument(); $doc->doc->validateOnParse = false; $doc->doc->strictErrorChecking = false; if (!empty($html) && $doc->loadHTML($html)) { $attributes = array('src', 'href'); $result1 = self::process_embedded_files($doc, $attributes, '@@PLUGINFILE@@'); $result2 = self::process_embedded_files($doc, $attributes, '$@FILEPHP@$', '$@SLASH@$'); $result = array_merge($result1, $result2); } return $result; } public static function embedded_mapping($packageroot, $contextid = null) { $main_file = $packageroot . DIRECTORY_SEPARATOR . 'files.xml'; $mfile = new XMLGenericDocument(); if (!$mfile->load($main_file)) { return false; } $query = "/files/file[filename!='.']"; if (!empty($contextid)) { $query .= "[contextid='{$contextid}']"; } $files = $mfile->nodeList($query); $depfiles = array(); foreach ($files as $node) { $mainfile = intval($mfile->nodeValue('sortorder', $node)); $filename = $mfile->nodeValue('filename', $node); $filepath = $mfile->nodeValue('filepath', $node); $source = $mfile->nodeValue('source', $node); $author = $mfile->nodeValue('author', $node); $license = $mfile->nodeValue('license', $node); $hashedname = $mfile->nodeValue('contenthash', $node); $hashpart = substr($hashedname, 0, 2); $location = 'files'.DIRECTORY_SEPARATOR.$hashpart.DIRECTORY_SEPARATOR.$hashedname; $type = $mfile->nodeValue('mimetype', $node); $depfiles[$filepath.$filename] = array( $location, ($mainfile == 1), strtolower(str_replace(' ', '_', $filename)), $type, $source, $author, $license, strtolower(str_replace(' ', '_', $filepath))); } return $depfiles; } public static function add_files(cc_i_manifest &$manifest, $packageroot, $outdir, $allinone = true) { global $CFG; if (pkg_static_resources::instance()->finished) { return; } $files = cc_helpers::embedded_mapping($packageroot); $rdir = $allinone ? new cc_resource_location($outdir) : null; foreach ($files as $virtual => $values) { $clean_filename = $values[2]; if (!$allinone) { $rdir = new cc_resource_location($outdir); } $rtp = $rdir->fullpath().$values[7].$clean_filename; //Are there any relative virtual directories? //let us try to recreate them $justdir = $rdir->fullpath(false).$values[7]; if (!file_exists($justdir)) { if (!mkdir($justdir, $CFG->directorypermissions, true)) { throw new RuntimeException('Unable to create directories!'); } } $source = $packageroot.DIRECTORY_SEPARATOR.$values[0]; if (!copy($source, $rtp)) { throw new RuntimeException('Unable to copy files!'); } $resource = new cc_resource($rdir->rootdir(), $values[7].$clean_filename, $rdir->dirname(false)); $res = $manifest->add_resource($resource, null, cc_version11::webcontent); pkg_static_resources::instance()->add($virtual, $res[0], $rdir->dirname(false).$values[7].$clean_filename, $values[1], $resource); } pkg_static_resources::instance()->finished = true; } /** * * Excerpt from IMS CC 1.1 overview : * No spaces in filenames, directory and file references should * employ all lowercase or all uppercase - no mixed case * * @param cc_i_manifest $manifest * @param string $packageroot * @param integer $contextid * @param string $outdir * @param boolean $allinone * @throws RuntimeException */ public static function handle_static_content(cc_i_manifest &$manifest, $packageroot, $contextid, $outdir, $allinone = true) { self::add_files($manifest, $packageroot, $outdir, $allinone); return pkg_static_resources::instance()->get_values(); } public static function handle_resource_content(cc_i_manifest &$manifest, $packageroot, $contextid, $outdir, $allinone = true) { $result = array(); self::add_files($manifest, $packageroot, $outdir, $allinone); $files = self::embedded_mapping($packageroot, $contextid); $rootnode = null; $rootvals = null; $depfiles = array(); $depres = array(); $flocation = null; foreach ($files as $virtual => $values) { $vals = pkg_static_resources::instance()->get_identifier($virtual); $resource = $vals[3]; $identifier = $resource->identifier; $flocation = $vals[1]; if ($values[1]) { $rootnode = $resource; $rootvals = $flocation; continue; } $depres[] = $identifier; $depfiles[] = $vals[1]; $result[$virtual] = array($identifier, $flocation, false); } if (!empty($rootnode)) { $rootnode->files = array_merge($rootnode->files, $depfiles); $result[$virtual] = array($rootnode->identifier, $rootvals, true); } return $result; } public static function process_linked_files($content, cc_i_manifest &$manifest, $packageroot, $contextid, $outdir, $webcontent = false) { // Detect all embedded files // locate their physical counterparts in moodle 2 backup // copy all files in the cc package stripping any spaces and using only lowercase letters // add those files as resources of the type webcontent to the manifest // replace the links to the resource using $IMS-CC-FILEBASE$ and their new locations // cc_resource has array of files and array of dependencies // most likely we would need to add all files as independent resources and than // attach them all as dependencies to the forum tag. $lfiles = self::embedded_files($content); $text = $content; $deps = array(); if (!empty($lfiles)) { $files = self::handle_static_content($manifest, $packageroot, $contextid, $outdir); $replaceprefix = $webcontent ? '' : '$IMS-CC-FILEBASE$'; foreach ($lfiles as $lfile) { if (isset($files[$lfile])) { $filename = str_replace('%2F', '/', rawurlencode($lfile)); $content = str_replace('@@PLUGINFILE@@'.$filename, $replaceprefix.'../'.$files[$lfile][1], $content); // For the legacy stuff. $content = str_replace('$@FILEPHP@$'.str_replace('/', '$@SLASH@$', $filename), $replaceprefix.'../'.$files[$lfile][1], $content); $deps[] = $files[$lfile][0]; } } $text = $content; } return array($text, $deps); } public static function relative_location($originpath, $linkingpath) { return false; } } final class cc_resource_location { /** * * Root directory * @var string */ private $rootdir = null; /** * * new directory * @var string */ private $dir = null; /** * * Full precalculated path * @var string */ private $fullpath = null; /** * * ctor * @param string $rootdir - path to the containing directory * @throws InvalidArgumentException * @throws RuntimeException */ public function __construct($rootdir) { $rdir = realpath($rootdir); if (empty($rdir)) { throw new InvalidArgumentException('Invalid path!'); } $dir = cc_helpers::randomdir($rdir, 'i_'); if ($dir === false) { throw new RuntimeException('Unable to create directory!'); } $this->rootdir = $rdir; $this->dir = $dir; $this->fullpath = $rdir.DIRECTORY_SEPARATOR.$dir; } /** * * Newly created directory * @return string */ public function dirname($endseparator=false) { return $this->dir.($endseparator ? '/' : ''); } /** * * Full path to the new directory * @return string */ public function fullpath($endseparator=false) { return $this->fullpath.($endseparator ? DIRECTORY_SEPARATOR : ''); } /** * Returns containing dir * @return string */ public function rootdir($endseparator=false) { return $this->rootdir.($endseparator ? DIRECTORY_SEPARATOR : ''); } } class pkg_static_resources { /** * @var array */ private $values = array(); /** * @var boolean */ public $finished = false; /** * @var pkg_static_resources */ private static $instance = null; private function __clone() { } private function __construct() { } /** * @return pkg_static_resources */ public static function instance() { if (empty(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } /** * * add new element * @param string $identifier * @param string $file * @param boolean $main */ public function add($key, $identifier, $file, $main, $node = null) { $this->values[$key] = array($identifier, $file, $main, $node); } /** * @return array */ public function get_values() { return $this->values; } public function get_identifier($location) { return isset($this->values[$location]) ? $this->values[$location] : false; } public function reset() { $this->values = array(); $this->finished = false; } } class pkg_resource_dependencies { /** * @var array */ private $values = array(); /** * @var pkg_resource_dependencies */ private static $instance = null; private function __clone() { } private function __construct() { } /** * @return pkg_resource_dependencies */ public static function instance() { if (empty(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } /** * @param array $deps */ public function add(array $deps) { $this->values = array_merge($this->values, $deps); } public function reset() { $this->values = array(); } /** * @return array */ public function get_deps() { return $this->values; } } PK\ cc_lib/cc_converter_folder.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_converters.php'); require_once('cc_general.php'); class cc_converter_folder extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path) { $this->defaultfile = 'folder.xml'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $resitem = new cc_item(); $resitem->title = $this->doc->nodeValue('/activity/folder/name'); $this->item->add_child_item($resitem); $contextid = $this->doc->nodeValue('/activity/@contextid'); cc_helpers::handle_static_content($this->manifest, $this->rootpath, $contextid, $outdir); return true; } } PK\,rs"s"cc_lib/cc_assesment_sfib.phpnu[. /** * @package backup-convert * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once('cc_asssesment.php'); class cc_assesment_question_sfib extends cc_assesment_question_proc_base { public function __construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir) { parent::__construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $this->qtype = cc_qti_profiletype::field_entry; $this->correct_answer_node_id = $this->questions->nodeValue( 'plugin_qtype_truefalse_question/truefalse/trueanswer', $this->question_node ); $maximum_quiz_grade = (int)$this->quiz->nodeValue('/activity/quiz/grade'); $this->total_grade_value = ($maximum_quiz_grade + 1).'.0000000'; } public function on_generate_metadata() { parent::on_generate_metadata(); $category = $this->questions->nodeValue('../../name', $this->question_node); if (!empty($category)) { $this->qmetadata->set_category($category); } } public function on_generate_presentation() { parent::on_generate_presentation(); $response_str = new cc_assesment_response_strtype(); $response_fib = new cc_assesment_render_fibtype(); // The standard requires that only rows attribute must be set, // the rest may or may not be configured. For the sake of brevity we leave it empty. $response_fib->set_rows(1); $response_str->set_render_fib($response_fib); $this->qpresentation->set_response_str($response_str); } public function on_generate_feedbacks() { parent::on_generate_feedbacks(); // Question combined feedback. $responsenodes = $this->questions->nodeList('plugin_qtype_shortanswer_question//answer', $this->question_node); $count = 0; foreach ($responsenodes as $respnode) { $content = $this->questions->nodeValue('feedback', $respnode); if (empty($content)) { continue; } $correct = (int)$this->questions->nodeValue('fraction', $respnode) == 1; $answerid = (int)$this->questions->nodeValue('@id', $respnode); $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); $ident = $correct ? 'correct' : 'incorrect'; $ident .= '_'.$count.'_fb'; cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $ident); pkg_resource_dependencies::instance()->add($result[1]); if ($correct) { $this->correct_feedbacks[$answerid] = $ident; } else { $this->incorrect_feedbacks[$answerid] = $ident; } ++$count; } } public function on_generate_response_processing() { parent::on_generate_response_processing(); // General unconditional feedback must be added as a first respcondition // without any condition and just displayfeedback (if exists). if (!empty($this->general_feedback)) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('General feedback'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(); // Define the condition for success. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid('general_fb'); } // Answer separate conditions. $correct_responses = $this->questions->nodeList( 'plugin_qtype_shortanswer_question//answer[fraction=1]', $this->question_node); $incorrect_responses = $this->questions->nodeList( 'plugin_qtype_shortanswer_question//answer[fraction<1]', $this->question_node); $items = array( array($correct_responses, $this->correct_feedbacks), array($incorrect_responses, $this->incorrect_feedbacks) ); foreach ($items as $respfeed) { foreach ($respfeed[0] as $coresponse) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->enable_continue(); $this->qresprocessing->add_respcondition($qrespcondition); $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $respc = $this->questions->nodeValue('answertext', $coresponse); $resid = $this->questions->nodeValue('@id', $coresponse); $qvarequal = new cc_assignment_conditionvar_varequaltype($respc); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident('response'); $qvarequal->enable_case(false); if (!empty($respfeed[1][$resid])) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($respfeed[1][$resid]); } } } // Success condition. // For all question types outside of the Essay question, scoring is done in a // single with a continue flag set to No. The outcome is always // a variable named SCORE which value must be set to 100 in case of correct answer. // Partial scores (not 0 or 100) are not supported. $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('Correct'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(false); $qsetvar = new cc_assignment_setvartype(100); $qrespcondition->add_setvar($qsetvar); // Define the condition for success. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); foreach ($correct_responses as $coresponse) { $respc = $this->questions->nodeValue('answertext', $coresponse); $qvarequal = new cc_assignment_conditionvar_varequaltype($respc); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident('response'); $qvarequal->enable_case(false); } // Add incorrect handling. $qrespcondition = new cc_assesment_respconditiontype(); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(false); // Define the condition for failure. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qsetvar = new cc_assignment_setvartype(0); $qrespcondition->add_setvar($qsetvar); } } PK\ҟcc_lib/cc_converter_lti.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; require_once 'cc_basiclti.php'; class cc_converter_lti extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->cc_type = cc_version11::basiclti; $this->defaultfile = 'lti.xml'; $this->defaultname = basicltil1_resurce_file::deafultname; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new basicltil1_resurce_file(); $contextid = $this->doc->nodeValue('/activity/@contextid'); $title = $this->doc->nodeValue('/activity/lti/name'); $text = $this->doc->nodeValue('/activity/lti/intro'); $rt->set_title($title); $result = cc_helpers::process_linked_files($text, $this->manifest, $this->rootpath, $contextid, $outdir); $rt->set_description($result[0]); $rt->set_launch_url($this->doc->nodeValue('/activity/lti/toolurl')); $rt->set_launch_icon(''); $this->store($rt, $outdir, $title, $result[1]); return true; } } PK\KMMcc_lib/cc_builder_creator.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Factory pattern class * Create the version class to use * */ class cc_builder_creator { public static function factory($version){ if (is_null($version)) { throw new Exception("Version is null!"); } if (include_once 'cc_version' . $version . '.php') { $classname = 'cc_version' . $version; return new $classname; } else { throw new Exception ("Dont find cc version class!"); } } }PK\f8: cc_lib/cc_converter_basiclti.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; require_once 'cc_basiclti.php'; class cc_converter_basiclti extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->cc_type = cc_version11::basiclti; $this->defaultfile = 'basiclti.xml'; $this->defaultname = basicltil1_resurce_file::deafultname; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new basicltil1_resurce_file(); $title = $this->doc->nodeValue('/activity/basiclti/name'); $rt->set_title($title); $rt->set_launch_url($this->doc->nodeValue('/activity/basiclti/toolurl')); $rt->set_launch_icon(''); $rt->set_vendor_code($this->doc->nodeValue('/activity/basiclti/organizationid')); $rt->set_vendor_description($this->doc->nodeValue('/activity/basiclti/organizationdescr')); $rt->set_vendor_url($this->doc->nodeValue('/activity/basiclti/organizationurl')); $this->store($rt, $outdir, $title); return true; } } PK\1IZ cc_lib/cc_interfaces.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * CC Manifest Interface */ interface cc_i_manifest { public function on_create(); public function on_load(); public function on_save(); public function add_new_organization(cc_i_organization &$org); public function get_resources(); public function get_resource_list(); public function add_resource(cc_i_resource $res, $identifier=null, $type='webcontent'); public function add_metadata_manifest(cc_i_metadata_manifest $met); public function add_metadata_resource(cc_i_metadata_resource $met,$identifier); public function add_metadata_file(cc_i_metadata_file $met,$identifier,$filename); public function put_nodes(); } /** * CC Organization Interface */ interface cc_i_organization { public function add_item(cc_i_item &$item); public function has_items(); public function attr_value(&$nod, $name, $ns=null); public function process_organization(&$node,&$doc); } /** * CC Item Interface */ interface cc_i_item { public function add_child_item(cc_i_item &$item); public function attach_resource($res); // can be object or value public function has_child_items(); public function attr_value(&$nod, $name, $ns=null); public function process_item(&$node,&$doc); } /** * CC Resource Interface */ interface cc_i_resource { public function get_attr_value(&$nod, $name, $ns=null); public function add_resource($fname, $location=''); public function import_resource(DOMElement &$node, cc_i_manifest &$doc); public function process_resource($manifestroot, &$fname,$folder); } /** * CC Metadata Manifest Interface */ interface cc_i_metadata_manifest { public function add_metadata_general($obj); public function add_metadata_technical($obj); public function add_metadata_rights($obj); public function add_metadata_lifecycle($obj); } /** * CC Metadata Resource Interface */ interface cc_i_metadata_resource { public function add_metadata_resource_educational($obj); } /** * CC Metadata File Interface */ interface cc_i_metadata_file { public function add_metadata_file_educational($obj); } PK\Ecc_lib/cc_version_base.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_organization.php'; /** * Abstract Version Base class * */ abstract class cc_version_base { protected $_generator = null; protected $ccnamespaces = array(); protected $isrootmanifest = false; protected $manifestID = null; protected $organizationid = null; public $resources = null; public $resources_ind = null; protected $metadata = null; public $organizations = null; protected $base = null; public $ccversion = null; public $camversion = null; abstract protected function on_create(DOMDocument &$doc, $rootmanifestnode = null, $nmanifestID = null); abstract protected function create_metadata_manifest(cc_i_metadata_manifest $met, DOMDocument &$doc, $xmlnode = null); abstract protected function create_metadata_resource(cc_i_metadata_resource $met, DOMDocument &$doc, $xmlnode = null); abstract protected function create_metadata_file(cc_i_metadata_file $met, DOMDocument &$doc, $xmlnode = null); abstract protected function create_resource(cc_i_resource &$res, DOMDocument &$doc, $xmlnode=null); abstract protected function create_organization(cc_i_organization &$org, DOMDocument &$doc, $xmlnode=null); public function get_cc_namespaces() { return $this->ccnamespaces; } public function create_manifest(DOMDocument &$doc, $rootmanifestnode = null) { return $this->on_create($doc, $rootmanifestnode); } public function create_resource_node(cc_i_resource &$res, DOMDocument &$doc, $xmlnode = null) { return $this->create_resource($res, $doc, $xmlnode); } public function create_metadata_node(&$met, DOMDocument &$doc, $xmlnode = null) { return $this->create_metadata_manifest($met, $doc, $xmlnode); } public function create_metadata_resource_node(&$met, DOMDocument &$doc, $xmlnode = null) { return $this->create_metadata_resource($met, $doc, $xmlnode); } public function create_metadata_file_node(&$met, DOMDocument &$doc, $xmlnode = null) { return $this->create_metadata_file($met, $doc, $xmlnode); } public function create_organization_node(cc_i_organization &$org, DOMDocument &$doc, $xmlnode = null) { return $this->create_organization($org, $doc, $xmlnode); } public function manifestID() { return $this->manifestID; } public function set_manifestID($id) { $this->manifestID = $id; } public function get_base() { return $this->base; } public function set_base($baseval) { $this->base = $baseval; } public function import_resources(DOMElement &$node, cc_i_manifest &$doc) { if (is_null($this->resources)) { $this->resources = array(); } $nlist = $node->getElementsByTagNameNS($this->ccnamespaces['imscc'], 'resource'); if (is_object($nlist)) { foreach ($nlist as $nd) { $sc = new cc_resource($doc, $nd); $this->resources[$sc->identifier] = $sc; } } } public function import_organization_items(DOMElement &$node, cc_i_manifest &$doc) { if (is_null($this->organizations)) { $this->organizations = array(); } $nlist = $node->getElementsByTagNameNS($this->ccnamespaces['imscc'], 'organization'); if (is_object($nlist)) { foreach ($nlist as $nd) { $sc = new cc_organization($nd, $doc); $this->organizations[$sc->identifier] = $sc; } } } public function set_generator($value) { $this->_generator = $value; } }PK\cc_lib/cc_page.phpnu[. /** * @package backup-convert * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_general.php'); class page11_resurce_file extends general_cc_file { protected $rootns = 'xmlns'; protected $rootname = 'html'; protected $ccnamespaces = array('xmlns' => 'http://www.w3.org/1999/xhtml'); protected $content = null; protected $title = null; protected $intro = null; public function set_content($value) { // We are not cleaning up this one on purpose. $this->content = $value; } public function set_title($value) { $this->title = self::safexml($value); } public function set_intro($value) { $this->intro = self::safexml(strip_tags($value)); } protected function on_create() { $impl = new DOMImplementation(); $dtd = $impl->createDocumentType( 'html', '-//W3C//DTD XHTML 1.0 Strict//EN', 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'); $doc = $impl->createDocument($this->ccnamespaces[$this->rootns], null, $dtd); $doc->formatOutput = true; $doc->preserveWhiteSpace = true; $this->doc = $doc; parent::on_create(); } public function on_save() { $rns = $this->ccnamespaces[$this->rootns]; // Add the basic tags. $head = $this->append_new_element_ns($this->root, $rns, 'head'); $this->append_new_attribute_ns($head, $rns, 'profile', 'http://dublincore.org/documents/dc-html/'); // Linking Dublin Core Metadata 1.1. $link_dc = $this->append_new_element_ns($head, $rns, 'link'); $this->append_new_attribute_ns($link_dc, $rns, 'rel', 'schema.DC'); $this->append_new_attribute_ns($link_dc, $rns, 'href', 'http://purl.org/dc/elements/1.1/'); $link_dcterms = $this->append_new_element_ns($head, $rns, 'link'); $this->append_new_attribute_ns($link_dcterms, $rns, 'rel', 'schema.DCTERMS'); $this->append_new_attribute_ns($link_dcterms, $rns, 'href', 'http://purl.org/dc/terms/'); // Content type. $meta_type = $this->append_new_element_ns($head, $rns, 'meta'); $this->append_new_attribute_ns($meta_type, $rns, 'name', 'DC.type'); $this->append_new_attribute_ns($meta_type, $rns, 'scheme', 'DCTERMS.DCMIType'); $this->append_new_attribute_ns($meta_type, $rns, 'content', 'Text'); // Content description. if (!empty($this->intro)) { $meta_description = $this->append_new_element_ns($head, $rns, 'meta'); $this->append_new_attribute_ns($meta_description, $rns, 'name', 'DC.description'); $this->append_new_attribute_ns($meta_description, $rns, 'content', $this->intro); } $meta = $this->append_new_element_ns($head, $rns, 'meta'); $this->append_new_attribute_ns($meta, $rns, 'http-equiv', 'Content-type'); $this->append_new_attribute_ns($meta, $rns, 'content', 'text/html; charset=UTF-8'); // Set the title. $title = $this->append_new_element_ns($head, $rns, 'title', $this->title); $body = $this->append_new_element_ns($this->root, $rns, 'body'); // We are unable to use DOM for embedding HTML due to numerous content errors. // Therefore we place a dummy tag that will be later replaced with the real content. $this->append_new_element_ns($body, $rns, 'div', '##REPLACE##'); return true; } public function saveTo($fname) { $result = $this->on_save(); if ($result) { $dret = str_replace(''."\n", '', $this->viewXML()); $dret = str_replace('
##REPLACE##
', $this->content, $dret); $result = (file_put_contents($fname, $dret) !== false); if ($result) { $this->filename = $fname; $this->processPath(); } } return $result; } }PK\_>!>!cc_lib/cc_convert_moodle2.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ if (!extension_loaded('fileinfo')) { die('You must install fileinfo extension!'); } abstract class cc_convert_moodle2 { /** * * Enter description here ... * @param unknown_type $packagedir * @param unknown_type $outdir * @throws DOMException * @throws InvalidArgumentException */ public static function convert($packagedir, $outdir) { $dir = realpath($packagedir); if (empty($dir)) { throw new InvalidArgumentException('Directory does not exist!'); } $odir = realpath($outdir); if (empty($odir)) { throw new InvalidArgumentException('Directory does not exist!'); } $coursefile = $dir.DIRECTORY_SEPARATOR.'course'.DIRECTORY_SEPARATOR.'course.xml'; $doc = new XMLGenericDocument(); if ($doc->load($coursefile)) { $course_name = $doc->nodeValue('/course/fullname'); $course_desc = $doc->nodeValue('/course/summary'); $course_language = $doc->nodeValue('/course/lang'); $course_language = empty($course_language) ? 'en' : $course_language; $course_category = $doc->nodeValue('/course/category/name'); //Initialize the manifest metadata class $meta = new cc_metadata_manifest(); //Package metadata $metageneral = new cc_metadata_general(); $metageneral->set_language($course_language); $metageneral->set_title($course_name, $course_language); $metageneral->set_description($course_desc, $course_language); $metageneral->set_catalog('category'); $metageneral->set_entry($course_category); $meta->add_metadata_general($metageneral); // Create the manifest $manifest = new cc_manifest(cc_version::v11); $manifest->add_metadata_manifest($meta); $organization = null; //Package structure - default organization and resources //Get the course structure - this will be transformed into organization //Step 1 - Get the list and order of sections/topics $moodle_backup = $dir . DIRECTORY_SEPARATOR . 'moodle_backup.xml'; $secp = new XMLGenericDocument(); $docp = new XMLGenericDocument(); if ($docp->load($moodle_backup)) { //sections $sections = array(); $coursef = new XMLGenericDocument(); $course_file = $dir . DIRECTORY_SEPARATOR .'course' . DIRECTORY_SEPARATOR . 'course.xml'; $coursef->load($course_file); //$numsections = (int)$coursef->nodeValue('/course/numsections'); // TODO MDL-35781, this is commented because numsections is now optional attribute $section_list = $docp->nodeList('/moodle_backup/information/contents/sections/section'); if (!empty($section_list)) { $count = 0; foreach ($section_list as $node) { //if ($count > $numsections) { // break; //} $sectionid = $docp->nodeValue('sectionid', $node); $sectiontitle = $docp->nodeValue('title' , $node); $sectionpath = $docp->nodeValue('directory', $node); $sequence = array(); //Get section stuff $section_file = $dir . DIRECTORY_SEPARATOR . $sectionpath . DIRECTORY_SEPARATOR . 'section.xml'; if ($secp->load($section_file)) { $rawvalue = $secp->nodeValue('/section/sequence'); if ($rawvalue != '$@NULL@$') { $sequence = explode(',', $rawvalue); } } $sections[$sectionid] = array($sectiontitle, $sequence); $count++; } } //organization title $organization = new cc_organization(); //Add section/topic items foreach ($sections as $sectionid => $values) { $item = new cc_item(); $item->title = $values[0]; self::process_sequence($item, $manifest, $values[1], $dir, $odir); $organization->add_item($item); } $manifest->put_nodes(); } if (!empty($organization)) { $manifest->add_new_organization($organization); } $manifestpath = $outdir.DIRECTORY_SEPARATOR.'imsmanifest.xml'; $manifest->saveTo($manifestpath); } } /** * * Process the activites and create item structure * @param cc_i_item $item * @param array $sequence * @param string $packageroot - directory path * @throws DOMException */ protected static function process_sequence(cc_i_item &$item, cc_i_manifest &$manifest, array $sequence, $packageroot, $outdir) { $moodle_backup = $packageroot . DIRECTORY_SEPARATOR . 'moodle_backup.xml'; $doc = new XMLGenericDocument(); if(!$doc->load($moodle_backup)) { return; } $activities = $doc->nodeList('/moodle_backup/information/contents/activities/activity'); if (!empty($activities)) { $dpp = new XMLGenericDocument(); foreach ($activities as $activity) { $moduleid = $doc->nodeValue('moduleid', $activity); if (in_array($moduleid, $sequence)) { //detect activity type $directory = $doc->nodeValue('directory', $activity); $path = $packageroot . DIRECTORY_SEPARATOR . $directory; $module_file = $path . DIRECTORY_SEPARATOR . 'module.xml'; if ($dpp->load($module_file)) { $activity_type = $dpp->nodeValue('/module/modulename'); $activity_indentation = $dpp->nodeValue('/module/indent'); $aitem = self::item_indenter($item, $activity_indentation); $caller = "cc_converter_{$activity_type}"; if (class_exists($caller)) { $obj = new $caller($aitem, $manifest, $packageroot, $path); if (!$obj->convert($outdir)) { throw new RuntimeException("failed to convert {$activity_type}"); } } } } } } } protected static function item_indenter(cc_i_item &$item, $level = 0) { $indent = (int)$level; $indent = ($indent) <= 0 ? 0 : $indent; $nprev = null; $nfirst = null; for ($pos = 0, $size = $indent; $pos < $size; $pos++) { $nitem = new cc_item(); $nitem->title = ''; if (empty($nfirst)) { $nfirst = $nitem; } if (!empty($nprev)) { $nprev->add_child_item($nitem); } $nprev = $nitem; } $result = $item; if (!empty($nfirst)) { $item->add_child_item($nfirst); $result = $nprev; } return $result; } }PK\LZ$Z$!cc_lib/cc_assesment_truefalse.phpnu[. /** * @package backup-convert * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once('cc_asssesment.php'); class cc_assesment_question_truefalse extends cc_assesment_question_proc_base { public function __construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir) { parent::__construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $this->qtype = cc_qti_profiletype::true_false; // Determine the correct answer by finding out which answer has the non zero fraction... // This is because a true / false question type can have 'false' as the correct answer. $answers = $this->questions->nodeList('plugin_qtype_truefalse_question/answers/answer', $this->question_node); foreach ($answers as $answer) { $fraction = $this->questions->nodeValue('fraction', $answer); if ($fraction != 0) { $this->correct_answer_node_id = (int)$this->questions->nodeValue('@id', $answer); } } $maximum_quiz_grade = (int)$this->quiz->nodeValue('/activity/quiz/grade'); $this->total_grade_value = ($maximum_quiz_grade + 1).'.0000000'; } public function on_generate_answers() { // Add responses holder. $qresponse_lid = new cc_response_lidtype(); $this->qresponse_lid = $qresponse_lid; $this->qpresentation->set_response_lid($qresponse_lid); $qresponse_choice = new cc_assesment_render_choicetype(); $qresponse_lid->set_render_choice($qresponse_choice); // Mark that question has only one correct answer - // which applies for multiple choice and yes/no questions. $qresponse_lid->set_rcardinality(cc_qti_values::Single); // Are we to shuffle the responses? $shuffle_answers = (int)$this->quiz->nodeValue('/activity/quiz/shuffleanswers') > 0; $qresponse_choice->enable_shuffle($shuffle_answers); $answerlist = array(); $qa_responses = $this->questions->nodeList('plugin_qtype_truefalse_question/answers/answer', $this->question_node); foreach ($qa_responses as $node) { $answer_content = $this->questions->nodeValue('answertext', $node); $id = ((int)$this->questions->nodeValue('@id', $node) == $this->correct_answer_node_id); $qresponse_label = cc_assesment_helper::add_answer( $qresponse_choice, $answer_content, cc_qti_values::htmltype); $answer_ident = strtolower(trim($answer_content)); $qresponse_label->set_ident($answer_ident); $feedback_ident = ($id) ? 'correct_fb' : 'incorrect_fb'; if (empty($this->correct_answer_ident) && $id) { $this->correct_answer_ident = $answer_ident; } // Add answer specific feedback if not empty. $content = $this->questions->nodeValue('feedback', $node); if (!empty($content)) { $result = cc_helpers::process_linked_files( $content, $this->manifest, $this->rootpath, $this->contextid, $this->outdir); cc_assesment_helper::add_feedback( $this->qitem, $result[0], cc_qti_values::htmltype, $feedback_ident); pkg_resource_dependencies::instance()->add($result[1]); $answerlist[$answer_ident] = $feedback_ident; } } $this->answerlist = $answerlist; } public function on_generate_response_processing() { parent::on_generate_response_processing(); // Response conditions. // General unconditional feedback must be added as a first respcondition // without any condition and just displayfeedback (if exists). if (!empty($this->general_feedback)) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('General feedback'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(); // Define the condition for success. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid('general_fb'); } // Success condition. // For all question types outside of the Essay question, scoring is done in a // single with a continue flag set to No. The outcome is always // a variable named SCORE which value must be set to 100 in case of correct answer. // Partial scores (not 0 or 100) are not supported. $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('Correct'); $this->qresprocessing->add_respcondition($qrespcondition); $qrespcondition->enable_continue(false); $qsetvar = new cc_assignment_setvartype(100); $qrespcondition->add_setvar($qsetvar); // Define the condition for success. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); // TODO: recheck this. $qvarequal = new cc_assignment_conditionvar_varequaltype($this->correct_answer_ident); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident($this->qresponse_lid->get_ident()); if (array_key_exists($this->correct_answer_ident, $this->answerlist)) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($this->answerlist[$this->correct_answer_ident]); } foreach ($this->correct_feedbacks as $ident) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($ident); } // Rest of the conditions. foreach ($this->answerlist as $ident => $refid) { if ($ident == $this->correct_answer_ident) { continue; } $qrespcondition = new cc_assesment_respconditiontype(); $this->qresprocessing->add_respcondition($qrespcondition); $qsetvar = new cc_assignment_setvartype(0); $qrespcondition->add_setvar($qsetvar); // Define the condition for fail. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qvarequal = new cc_assignment_conditionvar_varequaltype($ident); $qconditionvar->set_varequal($qvarequal); $qvarequal->set_respident($this->qresponse_lid->get_ident()); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($refid); foreach ($this->incorrect_feedbacks as $ident) { $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid($ident); } } } } PK\7cc_lib/cc_metadata_file.phpnu[. /** * Metadata management * * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Metadata File Education Type * */ class cc_metadata_file_educational{ public $value = array(); public function set_value($value){ $arr = array($value); $this->value[] = $arr; } } /** * Metadata File * */ class cc_metadata_file implements cc_i_metadata_file { public $arrayeducational = array(); public function add_metadata_file_educational($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->value)? $this->arrayeducational['value']=$obj->value:null; } }PK\5*--cc_lib/xmlbase.phpnu[charset = $ch; $this->documentInit(); $this->doc->validateOnParse = $validatenow; } function __destruct() { $this->dxpath = null; $this->doc = null; } private function documentInit($withonCreate = true) { $hg = false; if ($this->isloaded) { $guardstate = $this->doc->validateOnParse; $hg = true; unset($this->dxpath); unset($this->doc); $this->isloaded = false; } $this->doc = new DOMDocument("1.0", $this->charset); $this->doc->strictErrorChecking = true; if ($hg) { $this->doc->validateOnParse = $guardstate; } $this->doc->formatOutput = true; $this->doc->preserveWhiteSpace = true; if ($withonCreate) { $this->on_create(); } } public function viewXML() { return $this->doc->saveXML(); } public function registerNS($prefix, $nsuri) { $this->arrayPrefixNS[$prefix] = $nsuri; } public function load($fname) { // Sine xml will remain loaded should the repeated load fail we should recreate document to be empty. $this->documentInit(false); $this->isloaded = $this->doc->load($fname); if ($this->isloaded) { $this->filename = $fname; $this->processPath(); $this->is_html = false; } return $this->on_load(); } public function loadUrl($url) { $this->documentInit(); $this->isloaded = true; $this->doc->loadXML( file_get_contents($url) ); $this->is_html = false; return $this->on_load(); } public function loadHTML($content) { $this->documentInit(); $this->doc->validateOnParse = false; $this->isloaded = true; $this->doc->loadHTML($content); $this->is_html = true; return $this->on_load(); } public function loadXML($content) { $this->documentInit(); $this->doc->validateOnParse = false; $this->isloaded = true; $this->doc->load($content); $this->is_html = true; return $this->on_load(); } public function loadHTMLFile($fname) { // Sine xml will remain loaded should the repeated load fail // we should recreate document to be empty. $this->documentInit(); $this->doc->validateOnParse = false; $this->isloaded = $this->doc->loadHTMLFile($fname); if ($this->isloaded) { $this->filename = $fname; $this->processPath(); $this->is_html=true; } return $this->on_load(); } public function loadXMLFile($fname) { // Sine xml will remain loaded should the repeated load fail // we should recreate document to be empty. $this->documentInit(); $this->doc->validateOnParse = false; $this->isloaded = $this->doc->load($fname); if ($this->isloaded) { $this->filename = $fname; $this->processPath(); $this->is_html = true; } return $this->on_load(); } public function loadString($content) { $this->doc = new DOMDocument("1.0", $this->charset); $content = ''.$content.''; $this->doc->loadXML($content); return true; } public function save() { $this->saveTo($this->filename); } public function saveTo($fname) { $status = false; if ($this->on_save()) { if ($this->is_html) { $this->doc->saveHTMLFile($fname); } else { $this->doc->save($fname); } $this->filename = $fname; $this->processPath(); $status = true; } return $status; } public function validate() { return $this->doc->validate(); } public function attributeValue($path, $attrname, $node = null) { $this->chkxpath(); $result = null; $resultlist = null; if (is_null($node)) { $resultlist = $this->dxpath->query($path); } else { $resultlist = $this->dxpath->query($path, $node); } if (is_object($resultlist) && ($resultlist->length > 0) && $resultlist->item(0)->hasAttribute($attrname)) { $result = $resultlist->item(0)->getAttribute($attrname); } return $result; } /** * * Get's text value of the node based on xpath query * @param string $path * @param DOMNode $node * @param int $count * @return string */ public function nodeValue($path, $node = null, $count = 1) { $nd = $this->node($path, $node, $count); return $this->nodeTextValue($nd); } /** * * Get's text value of the node * @param DOMNode $node * @return string */ public function nodeTextValue($node) { $result = ''; if (is_object($node)) { if ($node->hasChildNodes()) { $chnodesList = $node->childNodes; $types = array(XML_TEXT_NODE, XML_CDATA_SECTION_NODE); foreach ($chnodesList as $chnode) { if (in_array($chnode->nodeType, $types)) { $result .= $chnode->wholeText; } } } } return $result; } /** * * Enter description here ... * @param string $path * @param DOMNode $nd * @param int $count * @return DOMNode */ public function node($path, $nd = null, $count = 1) { $result = null; $resultlist = $this->nodeList($path,$nd); if (is_object($resultlist) && ($resultlist->length > 0)) { $result = $resultlist->item($count - 1); } return $result; } /** * * Enter description here ... * @param string $path * @param DOMNode $node * @return DOMNodeList */ public function nodeList($path, $node = null) { $this->chkxpath(); $resultlist = null; if (is_null($node)) { $resultlist = $this->dxpath->query($path); } else { $resultlist = $this->dxpath->query($path, $node); } return $resultlist; } /** * * Create new attribute * @param string $namespace * @param string $name * @param string $value * @return DOMAttr */ public function create_attribute_ns($namespace, $name, $value = null) { $result = $this->doc->createAttributeNS($namespace, $name); if (!is_null($value)) { $result->nodeValue = $value; } return $result; } /** * * Create new attribute * @param string $name * @param string $value * @return DOMAttr */ public function create_attribute($name, $value = null) { $result = $this->doc->createAttribute($name); if (!is_null($value)) { $result->nodeValue = $value; } return $result; } /** * * Adds new node * @param DOMNode $parentnode * @param string $namespace * @param string $name * @param string $value * @return DOMNode */ public function append_new_element_ns(DOMNode &$parentnode, $namespace, $name, $value = null) { $newnode = null; if (is_null($value)) { $newnode = $this->doc->createElementNS($namespace, $name); } else { $newnode = $this->doc->createElementNS($namespace, $name, $value); } return $parentnode->appendChild($newnode); } /** * * New node with CDATA content * @param DOMNode $parentnode * @param string $namespace * @param string $name * @param string $value */ public function append_new_element_ns_cdata(DOMNode &$parentnode, $namespace, $name, $value = null) { $newnode = $this->doc->createElementNS($namespace, $name); if (!is_null($value)) { $cdata = $this->doc->createCDATASection($value); $newnode->appendChild($cdata); } return $parentnode->appendChild($newnode); } /** * * Adds new node * @param DOMNode $parentnode * @param string $name * @param string $value * @return DOMNode */ public function append_new_element(DOMNode &$parentnode, $name, $value = null) { $newnode = null; if (is_null($value)) { $newnode = $this->doc->createElement($name); } else { $newnode = $this->doc->createElement($name, $value); } return $parentnode->appendChild($newnode); } /** * * Adds new attribute * @param DOMNode $node * @param string $name * @param string $value * @return DOMNode */ public function append_new_attribute(DOMNode &$node, $name, $value = null) { return $node->appendChild($this->create_attribute($name, $value)); } /** * * Adds new attribute * @param DOMNode $node * @param string $namespace * @param string $name * @param string $value * @return DOMNode */ public function append_new_attribute_ns(DOMNode &$node, $namespace, $name, $value = null) { return $node->appendChild($this->create_attribute_ns($namespace, $name, $value)); } public function fileName() { return $this->filename; } public function filePath() { return $this->filepath; } protected function on_load() { return $this->isloaded; } protected function on_save() { return true; } protected function on_create() { return true; } public function resetXpath() { $this->dxpath = null; $this->chkxpath(); } private function chkxpath() { if (!isset($this->dxpath) || is_null($this->dxpath)) { $this->dxpath = new DOMXPath($this->doc); foreach ($this->arrayPrefixNS as $nskey => $nsuri) { $this->dxpath->registerNamespace($nskey, $nsuri); } } } protected function processPath() { $path_parts = pathinfo($this->filename); $this->filepath = array_key_exists('dirname', $path_parts) ? $path_parts['dirname']."/" : ''; } } PK\Q Q cc_lib/cc_converter_forum.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_converters.php'; require_once 'cc_general.php'; require_once 'cc_forum.php'; class cc_converter_forum extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){ $this->cc_type = cc_version11::discussiontopic; $this->defaultfile = 'forum.xml'; $this->defaultname = 'discussion.xml'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $rt = new forum11_resurce_file(); $title = $this->doc->nodeValue('/activity/forum/name'); $rt->set_title($title); $text = $this->doc->nodeValue('/activity/forum/intro'); $deps = null; if (!empty($text)) { $textformat = intval($this->doc->nodeValue('/activity/forum/introformat')); $contextid = $this->doc->nodeValue('/activity/@contextid'); $result = cc_helpers::process_linked_files($text, $this->manifest, $this->rootpath, $contextid, $outdir); $textformat = ($textformat == 1) ? 'text/html' : 'text/plain'; $rt->set_text($result[0], $textformat); $deps = $result[1]; } $this->store($rt, $outdir, $title, $deps); return true; } } PK\{__cc_lib/cc_forum.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once 'cc_general.php'; class forum1_resurce_file extends general_cc_file { const deafultname = 'discussion.xml'; protected $rootns = 'dt'; protected $rootname = 'dt:topic'; protected $ccnamespaces = array('dt' => 'http://www.imsglobal.org/xsd/imsdt_v1p0', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('dt' => 'http://www.imsglobal.org/profile/cc/ccv1p0/derived_schema/domainProfile_6/imsdt_v1p0_localised.xsd'); protected $title = null; protected $text_type = 'text/plain'; protected $text = null; protected $attachments = array(); public function set_title($title) { $this->title = self::safexml($title); } public function set_text($text, $type='text/plain') { $this->text = self::safexml($text); $this->text_type = $type; } public function set_attachments(array $attachments) { $this->attachments = $attachments; } protected function on_save() { $this->append_new_element($this->root, 'title', $this->title); $text = $this->append_new_element($this->root, 'text', $this->text); $this->append_new_attribute($text, 'texttype', $this->text_type); if (!empty($this->attachments)) { $attachments = $this->append_new_element($this->root, 'attachments'); foreach ($this->attachments as $value) { $att = $this->append_new_element($attachments, 'attachment'); $this->append_new_attribute($att, 'href', $value); } } return true; } } class forum11_resurce_file extends forum1_resurce_file { protected $rootns = 'dt'; protected $rootname = 'topic'; protected $ccnamespaces = array('dt' => 'http://www.imsglobal.org/xsd/imsccv1p1/imsdt_v1p1', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance'); protected $ccnsnames = array('dt' => 'http://www.imsglobal.org/profile/cc/ccv1p1/ccv1p1_imsdt_v1p1.xsd'); protected function on_save() { $rns = $this->ccnamespaces[$this->rootns]; $this->append_new_element_ns($this->root, $rns, 'title', $this->title); $text = $this->append_new_element_ns($this->root, $rns, 'text', $this->text); $this->append_new_attribute_ns($text, $rns, 'texttype', $this->text_type); if (!empty($this->attachments)) { $attachments = $this->append_new_element_ns($this->root, $rns, 'attachments'); foreach ($this->attachments as $value) { $att = $this->append_new_element_ns($attachments, $rns, 'attachment'); $this->append_new_attribute_ns($att, $rns, 'href', $value); } } return true; } } PK\qcc_lib/cc_converters.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_interfaces.php'); abstract class cc_converter { /** * * Enter description here ... * @var cc_item */ protected $item = null; /** * * Enter description here ... * @var cc_manifest */ protected $manifest = null; /** * * Enter description here ... * @var string */ protected $rootpath = null; /** * * Enter description here ... * @var string */ protected $path = null; /** * * Enter description here ... * @var string */ protected $defaultfile = null; /** * * Enter description here ... * @var string */ protected $defaultname = null; /** * * Enter description here ... * @var string */ protected $cc_type = null; /** * * Document * @var XMLGenericDocument */ protected $doc = null; /** * * ctor * @param cc_i_item $item * @param cc_i_manifest $manifest * @param string $rootpath * @param string $path * @throws InvalidArgumentException */ public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path) { $rpath = realpath($rootpath); if (empty($rpath)) { throw new InvalidArgumentException('Invalid path!'); } $rpath2 = realpath($path); if (empty($rpath)) { throw new InvalidArgumentException('Invalid path!'); } $doc = new XMLGenericDocument(); if (!$doc->load($path . DIRECTORY_SEPARATOR . $this->defaultfile)) { throw new RuntimeException('File does not exist!'); } $this->doc = $doc; $this->item = $item; $this->manifest = $manifest; $this->rootpath = $rpath; $this->path = $rpath2; } /** * * performs conversion * @param string $outdir - root directory of common cartridge * @return boolean */ abstract public function convert($outdir); /** * * Is the element visible in the course? * @throws RuntimeException * @return bool */ protected function is_visible() { $tdoc = new XMLGenericDocument(); if (!$tdoc->load($this->path . DIRECTORY_SEPARATOR . 'module.xml')) { throw new RuntimeException('File does not exist!'); } $visible = (int)$tdoc->nodeValue('/module/visible'); return ($visible > 0); } /** * * Stores any files that need to be stored */ protected function store(general_cc_file $doc, $outdir, $title, $deps = null) { $rdir = new cc_resource_location($outdir); $rtp = $rdir->fullpath(true).$this->defaultname; if ( $doc->saveTo($rtp) ) { $resource = new cc_resource($rdir->rootdir(), $this->defaultname, $rdir->dirname(true)); $resource->dependency = empty($deps) ? array() : $deps; $resource->instructoronly = !$this->is_visible(); $res = $this->manifest->add_resource($resource, null, $this->cc_type); $resitem = new cc_item(); $resitem->attach_resource($res[0]); $resitem->title = $title; $this->item->add_child_item($resitem); } else { throw new RuntimeException("Unable to save file {$rtp}!"); } } } PK\z z cc_lib/cc_assesment_essay.phpnu[. /** * @package backup-convert * @copyright 2012 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc_assesment_question_essay extends cc_assesment_question_proc_base { public function __construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir) { parent::__construct($quiz, $questions, $manifest, $section, $question_node, $rootpath, $contextid, $outdir); $this->qtype = cc_qti_profiletype::essay; $maximum_quiz_grade = (int)$this->quiz->nodeValue('/activity/quiz/grade'); $this->total_grade_value = ($maximum_quiz_grade + 1).'.0000000'; } public function on_generate_metadata() { parent::on_generate_metadata(); // Mark essay for manual grading. $this->qmetadata->enable_scoringpermitted(); $this->qmetadata->enable_computerscored(false); } public function on_generate_presentation() { parent::on_generate_presentation(); $response_str = new cc_assesment_response_strtype(); $response_fib = new cc_assesment_render_fibtype(); $row_value = (int)$this->questions->nodeValue('plugin_qtype_essay_question//responsefieldlines', $this->question_node); $response_fib->set_rows($row_value); $response_str->set_render_fib($response_fib); $this->qpresentation->set_response_str($response_str); } public function on_generate_response_processing() { parent::on_generate_response_processing(); // Response conditions. if (!empty($this->general_feedback)) { $qrespcondition = new cc_assesment_respconditiontype(); $qrespcondition->set_title('General feedback'); $this->qresprocessing->add_respcondition($qrespcondition); // Define the condition for success. $qconditionvar = new cc_assignment_conditionvar(); $qrespcondition->set_conditionvar($qconditionvar); $qother = new cc_assignment_conditionvar_othertype(); $qconditionvar->set_other($qother); $qdisplayfeedback = new cc_assignment_displayfeedbacktype(); $qrespcondition->add_displayfeedback($qdisplayfeedback); $qdisplayfeedback->set_feedbacktype(cc_qti_values::Response); $qdisplayfeedback->set_linkrefid('general_fb'); } } } PK\t׵cc_lib/cc_metadata_resource.phpnu[. /** * Metadata managing * * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Metadata Resource Educational Type * */ class cc_metadata_resouce_educational{ public $value = array(); public function set_value($value){ $arr = array($value); $this->value[] = $arr; } } /** * Metadata Resource * */ class cc_metadata_resouce implements cc_i_metadata_resource { public $arrayeducational = array(); public function add_metadata_resource_educational($obj){ if (empty($obj)){ throw new Exception('Medatada Object given is invalid or null!'); } !is_null($obj->value)? $this->arrayeducational['value']=$obj->value:null; } }PK\SM cc_lib/cc_converter_resource.phpnu[. /** * @package backup-convert * @subpackage cc-library * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once('cc_converters.php'); require_once('cc_general.php'); class cc_converter_resource extends cc_converter { public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path) { $this->cc_type = cc_version11::webcontent; $this->defaultfile = 'resource.xml'; parent::__construct($item, $manifest, $rootpath, $path); } public function convert($outdir) { $title = $this->doc->nodeValue('/activity/resource/name'); $contextid = $this->doc->nodeValue('/activity/@contextid'); $files = cc_helpers::handle_resource_content($this->manifest, $this->rootpath, $contextid, $outdir); $deps = null; $resvalue = null; foreach ($files as $values) { if ($values[2]) { $resvalue = $values[0]; break; } } $resitem = new cc_item(); $resitem->identifierref = $resvalue; $resitem->title = $title; $this->item->add_child_item($resitem); // Checking the visibility. $this->manifest->update_instructoronly($resvalue, !$this->is_visible()); return true; } } PK\ݑ OOrestore_cc.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/backup/cc/includes/constants.php'); require_once($CFG->dirroot . '/backup/cc/cc2moodle.php'); function cc_convert ($dir) { global $OUTPUT; $manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml'; $moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml'; $schema_file = 'cc' . DIRECTORY_SEPARATOR . '' . DIRECTORY_SEPARATOR . 'schemas' . DIRECTORY_SEPARATOR . 'cclibxml2validator.xsd'; if (is_readable($manifest_file) && !is_readable($moodle_file)) { $is_cc = detect_cc_format($manifest_file); if ($is_cc) { $detected_requirements = detect_requirements(); if (!$detected_requirements["dom"]) { echo $OUTPUT->notification(get_string('cc_import_req_dom', 'imscc')); return false; } if (!$detected_requirements["libxml"]) { echo $OUTPUT->notification(get_string('cc_import_req_libxml', 'imscc')); return false; } if (!$detected_requirements["libxmlminversion"]) { echo $OUTPUT->notification(get_string('cc_import_req_libxmlminversion', 'imscc')); return false; } if (!$detected_requirements["xsl"]) { echo $OUTPUT->notification(get_string('cc_import_req_xsl', 'imscc')); return false; } echo get_string('cc2moodle_checking_schema', 'imscc') . '
'; $cc_manifest = new DOMDocument(); if ($cc_manifest->load($manifest_file)) { if ($cc_manifest->schemaValidate($schema_file)) { echo get_string('cc2moodle_valid_schema', 'imscc') . '
'; $cc2moodle = new cc2moodle($manifest_file); if (!$cc2moodle->is_auth()) { return $cc2moodle->generate_moodle_xml(); } else { echo $OUTPUT->notification(get_string('cc2moodle_req_auth', 'imscc')); return false; } } else { echo $OUTPUT->notification(get_string('cc2moodle_invalid_schema', 'imscc')); return false; } } else { echo $OUTPUT->notification(get_string('cc2moodle_manifest_dont_load', 'imscc')); return false; } } } return true; } function detect_requirements () { $detected["xsl"] = extension_loaded('xsl'); $detected['dom'] = extension_loaded('dom'); $detected['libxml'] = extension_loaded('libxml'); $detected['libxmlminversion'] = extension_loaded('libxml') && version_compare(LIBXML_DOTTED_VERSION, '2.6.30', '>='); return $detected; } function detect_cc_format ($xml_file) { $inpos = 0; $xml_snippet = file_get_contents($xml_file, 0, NULL, 0, 500); if (!empty($xml_snippet)) { $xml_snippet = strtolower($xml_snippet); $xml_snippet = preg_replace('/\s*/m', '', $xml_snippet); $xml_snippet = str_replace("'", '', $xml_snippet); $xml_snippet = str_replace('"', '', $xml_snippet); $search_string = "xmlns=" . NS_COMMON_CARTRIDGE; $inpos = strpos($xml_snippet, $search_string); if ($inpos) { return true; } else { return false; } } else { return false; } } PK\CT)??entity11.forum.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc11_forum extends entities11 { public function full_path($path, $dir_sep = DIRECTORY_SEPARATOR) { $token = '$IMS-CC-FILEBASE$'; $path = str_replace($token, '', $path); if (is_string($path) && ($path != '')) { $dir_sep; $dot_dir = '.'; $up_dir = '..'; $length = strlen($path); $rtemp = trim($path); $start = strrpos($path, $dir_sep); $can_continue = ($start !== false); $result = $can_continue ? '' : $path; $rcount = 0; while ($can_continue) { $dir_part = ($start !== false) ? substr($rtemp, $start + 1, $length - $start) : $rtemp; $can_continue = ($dir_part !== false); if ($can_continue) { if ($dir_part != $dot_dir) { if ($dir_part == $up_dir) { $rcount++; } else { if ($rcount > 0) { $rcount --; } else { $result = ($result == '') ? $dir_part : $dir_part . $dir_sep . $result; } } } $rtemp = substr($path, 0, $start); $start = strrpos($rtemp, $dir_sep); $can_continue = (($start !== false) || (strlen($rtemp) > 0)); } } } return $result; } public function generate_node() { cc2moodle::log_action('Creating Forum mods'); $response = ''; if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM] as $instance) { $response .= $this->create_node_course_modules_mod_forum($instance); } } return $response; } private function create_node_course_modules_mod_forum($instance) { $sheet_mod_forum = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_FORUM); $topic_data = $this->get_topic_data($instance); $result = ''; if (!empty($topic_data)) { $find_tags = array('[#mod_instance#]', '[#mod_forum_title#]', '[#mod_forum_intro#]', '[#date_now#]'); $replace_values = array($instance['instance'], //To be more true to the actual forum name we use only forum title self::safexml($topic_data['title']), self::safexml($topic_data['description']), time()); $result = str_replace($find_tags, $replace_values, $sheet_mod_forum); } return $result; } public function get_topic_data($instance) { $topic_data = array(); $topic_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($topic_file)) { $topic_file_path = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $topic_file; $topic_file_dir = dirname($topic_file_path); $topic = $this->load_xml_resource($topic_file_path); if (!empty($topic)) { $xpath = cc2moodle::newx_path($topic, cc112moodle::$forumns); $topic_title = $xpath->query('/dt:topic/dt:title'); if ($topic_title->length > 0 && !empty($topic_title->item(0)->nodeValue)) { $topic_title = $topic_title->item(0)->nodeValue; } else { $topic_title = 'Untitled Topic'; } $topic_text = $xpath->query('/dt:topic/dt:text'); $topic_text = !empty($topic_text->item(0)->nodeValue) ? $this->update_sources($topic_text->item(0)->nodeValue, dirname($topic_file)) : ''; $topic_text = !empty($topic_text) ? str_replace("%24", "\$", $this->include_titles($topic_text)) : ''; if (!empty($topic_title)) { $topic_data['title'] = $topic_title; $topic_data['description'] = $topic_text; } } $topic_attachments = $xpath->query('/dt:topic/dt:attachments/dt:attachment/@href'); if ($topic_attachments->length > 0) { $attachment_html = ''; foreach ($topic_attachments as $file) { $attachment_html .= $this->generate_attachment_html($this->full_path($file->nodeValue,'/')); } $topic_data['description'] = !empty($attachment_html) ? $topic_text . '

Attachments:

' . $attachment_html : $topic_text; } } return $topic_data; } private function generate_attachment_html($filename) { $images_extensions = array('gif' , 'jpeg' , 'jpg' , 'jif' , 'jfif' , 'png' , 'bmp'); $fileinfo = pathinfo($filename); if (in_array($fileinfo['extension'], $images_extensions)) { return '' . $fileinfo['basename'] . '
'; } else { return '' . $fileinfo['basename'] . '
'; } return ''; } } PK\B entities11.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/backup/cc/entities.class.php'); class entities11 extends entities { public function get_external_xml($identifier) { $xpath = cc2moodle::newx_path(cc112moodle::$manifest, cc112moodle::$namespaces); $files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]/imscc:file/@href'); $response = empty($files) || ($files->length == 0) ? '' : $files->item(0)->nodeValue; return $response; } protected function get_all_files() { global $CFG; $all_files = array(); $xpath = cc2moodle::newx_path(cc112moodle::$manifest, cc112moodle::$namespaces); foreach (cc112moodle::$restypes as $type) { $files = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@type="' . $type . '"]/imscc:file/@href'); if (empty($files) || ($files->length == 0)) { continue; } foreach ($files as $file) { //omit html files //this is a bit too simplistic $ext = strtolower(pathinfo($file->nodeValue, PATHINFO_EXTENSION)); if (in_array($ext, array('html', 'htm', 'xhtml'))) { continue; } $all_files[] = $file->nodeValue; } unset($files); } //are there any labels? $xquery = "//imscc:item/imscc:item/imscc:item[imscc:title][not(@identifierref)]"; $labels = $xpath->query($xquery); if (!empty($labels) && ($labels->length > 0)) { $tname = 'course_files'; $dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname; $rfpath = 'files.gif'; $fpath = $dpath . DIRECTORY_SEPARATOR . 'files.gif'; if (!file_exists($dpath)) { mkdir($dpath, $CFG->directorypermissions, true); } //copy the folder.gif file $folder_gif = "{$CFG->dirroot}/pix/i/files.gif"; copy($folder_gif, $fpath); $all_files[] = $rfpath; } $all_files = empty($all_files) ? '' : $all_files; return $all_files; } } PK\Fq validator.phpnu[. /** * Provides validation classes used by the imscc converters * * @package backup-convert * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ final class error_messages { /** * * @static error_messages */ private static $instance = null; private function __construct(){} private function __clone(){} /** * @return error_messages */ public static function instance() { if (empty(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } return self::$instance; } /** * @var array */ private $items = array(); /** * @param string $msg */ public function add($msg) { if (!empty($msg)) { $this->items[] = $msg; } } /** * @return array */ public function errors() { $this->items; } /** * Empties the error content */ public function reset() { $this->items = array(); } /** * @param boolean $web * @return string */ public function to_string($web = false) { $result = ''; if ($web) { $result .= '
    '.PHP_EOL; } foreach ($this->items as $error) { if ($web) { $result .= '
  1. '; } $result .= $error.PHP_EOL; if ($web) { $result .= '
  2. '.PHP_EOL; } } if ($web) { $result .= '
'.PHP_EOL; } return $result; } /** * Casting to string method * @return string */ public function __toString() { return $this->to_string(false); } } final class libxml_errors_mgr { /** * @var boolean */ private $previous = false; /** * @param boolean $reset */ public function __construct($reset=false){ if ($reset) { error_messages::instance()->reset(); } $this->previous = libxml_use_internal_errors(true); libxml_clear_errors(); } private function collect_errors($filename=''){ $errors = libxml_get_errors(); static $error_types = array( LIBXML_ERR_ERROR => 'Error' ,LIBXML_ERR_FATAL => 'Fatal Error' ,LIBXML_ERR_WARNING => 'Warning' ); $result = array(); foreach($errors as $error){ $add = ''; if (!empty($filename)) { $add = " in {$filename}"; } elseif (!empty($error->file)) { $add = " in {$error->file}"; } $line = ''; if (!empty($error->line)) { $line = " at line {$error->line}"; } $err = "{$error_types[$error->level]}{$add}: {$error->message}{$line}"; error_messages::instance()->add($err); } libxml_clear_errors(); return $result; } public function __destruct(){ $this->collect_errors(); if (!$this->previous) { libxml_use_internal_errors($this->previous); } } public function collect() { $this->collect_errors(); } } function validate_xml($xml, $schema){ $result = false; $manifest_file = realpath($xml); $schema_file = realpath($schema); if (empty($manifest_file) || empty($schema_file)) { return false; } $xml_error = new libxml_errors_mgr(); $manifest = new DOMDocument(); $doc->validateOnParse = false; $result = $manifest->load($manifest_file, LIBXML_NONET) && $manifest->schemaValidate($schema_file); return $result; } class cc_validate_type { const manifest_validator1 = 'cclibxml2validator.xsd' ; const assesment_validator1 = '/domainProfile_4/ims_qtiasiv1p2_localised.xsd'; const discussion_validator1 = '/domainProfile_6/imsdt_v1p0_localised.xsd' ; const weblink_validator1 = '/domainProfile_5/imswl_v1p0_localised.xsd' ; const manifest_validator11 = 'cc11libxml2validator.xsd' ; const blti_validator11 = 'imslticc_v1p0p1.xsd' ; const assesment_validator11 = 'ccv1p1_qtiasiv1p2p1_v1p0.xsd'; const discussion_validator11 = 'ccv1p1_imsdt_v1p1.xsd' ; const weblink_validator11 = 'ccv1p1_imswl_v1p1.xsd' ; /** * @var string */ protected $type = null; /** * @var string */ protected $location = null; public function __construct($type, $location){ $this->type = $type; $this->location = $location; } /** * Validates the item * @param string $element - File path for the xml * @return boolean */ public function validate($element) { $celement = realpath($element); $cvalidator = realpath($this->location.DIRECTORY_SEPARATOR.$this->type); $result = (empty($celement) || empty($cvalidator)); if (!$result) { $xml_error = new libxml_errors_mgr(); $doc = new DOMDocument(); $doc->validateOnParse = false; $result = $doc->load($celement, LIBXML_NONET) && $doc->schemaValidate($cvalidator); } return $result; } } class manifest_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::manifest_validator11, $location); } } class manifest10_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::manifest_validator1, $location); } } class blti_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::blti_validator11, $location); } } class assesment_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::assesment_validator11, $location); } } class discussion_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::discussion_validator11, $location); } } class weblink_validator extends cc_validate_type { public function __construct($location){ parent::__construct(self::weblink_validator11, $location); } } PK\Ju99schemas/cclibxml2validator.xsdnu[ PK\ //+schemas/imscp_v1p2_constraintsDocument.scmtnu[ Assertion failed for pattern_2. If an item is invisible, its descendants must be invisible too.(#S02) Assertion failed for pattern_3. A Resource object which is a Learning Object associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent'.(#S03) Assertion failed for pattern_4. An Item object which represents a folder is indicated by the absence of an IdentifierRef characteristic object. Folder Items support unlimited nesting of other folder Items and learning object link Items. Learning Application Resource Item objects may be nested by folder Item object but may not nest other folder or Learning Application resource Item objects.(#S04) Error: Assertion failed for pattern_5: If a cartridge web content or associated content resource is linked from a Learning Application Object link Item object it must have an Href characteristic object which represents the launchable resource.(#S05) Error: Assertion failed for pattern_5: For Discussion Topic Resources the Resource object must contain a single File object which references the Discussion Topic descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imsdt_v1p0 schema. Discussion Topic resources must not contain href (#S06) Error: Assertion validation failed for pattern_7: For Web Link Resources the Resource object must contain a single File object which references the Web Link descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imswl_v1p0 schema.It must contain neither Dependency objects nor an href attribute.(#S07) Error: Assertion validation failed for pattern_11a: For Assessment resources the Resource object must contain a single File object which references the QTI XML file. This file must conform to the IMS CC profile of QTI 1.2.1. The profile is contained in the package of this profile as imscc_q*.zip. The derived schema of this QTI profile is in the package of this profile with the name ims_qtiasiv1p2_localised.xsd. The resource must not have an href attribute(#S11a) Error: Assertion validation failed for pattern_11b1: For Question Bank resources the Resource object must contain a single File object which references the QTI XML file. (#S11b1) Error: Assertion validation failed for pattern_11b2: A Question Bank Resource must not have an href attribute. (#S11b2) Error: Assertion validation failed for pattern_11b3: A Question Bank Resource must not be referenced from an item. (#S11b3) Error: Assertion validation failed for pattern_11b4: There can be only one Questionbank Resource in a cartridge.(#S11b4) Assertion failed for pattern_12. A Resource object which is a Discussion Topic associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S12) Assertion failed for pattern_14. A Resource object which is an assessment may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S14) Assertion failed for pattern_15. A Resource object which is a Question Bank may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S15) PK\6y 0schemas/domainProfile_2/anyElement_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\G/schemas/domainProfile_2/dataTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data types defined in the LOMv1.0 base schema. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\ W!schemas/domainProfile_2/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides attribute group declarations for LOM data elements to support schema-based validation of uniqueness constraints within a LOM XML instance where the exact set of attributes associated with each element has to be as specified by the LOM XML Schema binding (i.e., where extra attributes to enforce uniqueness have to be avoided). Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. NOTE: The absence of the enforcement of the uniqueness constraints does not relieve a particular LOM XML instance from satisfying the uniqueness constraints described in the LOMv1.0 base schema. Applications that require the use of the unique/loose.xsd component XSD have to enforce those uniqueness constraints by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\occ(schemas/domainProfile_2/unique/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides attribute group declarations for LOM data elements to support schema-based validation of uniqueness constraints within a LOM XML instance where the exact set of attributes associated with each element has to be as specified by the LOM XML Schema binding (i.e., where extra attributes to enforce uniqueness have to be avoided). Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. NOTE: The absence of the enforcement of the uniqueness constraints does not relieve a particular LOM XML instance from satisfying the uniqueness constraints described in the LOMv1.0 base schema. Applications that require the use of the unique/loose.xsd component XSD have to enforce those uniqueness constraints by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\+= 1schemas/domainProfile_2/rootElement_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides the element name declaration for the root element for all LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\ݷ,schemas/domainProfile_2/common/dataTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data types defined in the LOMv1.0 base schema. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\d>&&.schemas/domainProfile_2/common/vocabValues.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides global type declarations for the standard LOMv1.0 vocabulary tokens for those LOM data elements whose values are taken from a Vocabulary data type. This component schema defintion defines the stanard vocabulary value declarations as defined in the LOMv1.0 base schema. These vocabulary value declarations are used in conjunction with both vocab/custom.xsd and vocab/loose.xsd. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\icaa.schemas/domainProfile_2/common/rootElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides the element name declaration for the root element for all LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\Шm2626-schemas/domainProfile_2/common/vocabTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides global type declarations for those LOM data elements whose values are taken from a Vocabulary data type. This component XSD requires schema components from other schemas that are defined in other namespaces. These statements import the appropriate components. The xsi:schemaLocation attribute is used to specify the location of the file that contains the schema that defines the namespace. The xsi:schemaLocation attribute is optional and is ommitted. By definition of the composite schemas the appropriate namespaces and related files where those namespaces are defined are brought into scope. Some XML parsers may require these import statements to contain the optional xsi:schemaLocation attribute. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\omGee/schemas/domainProfile_2/common/elementTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data elements defined in the LOMv1.0 base schema. This component XSD defines the aggregation relationship among the LOM data elements. These aggregation relationships enforce the LOMv1.0 base schema requirement that elements can only be present in a LOM XML instance as elements of the aggregate element to which they belong. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\10ZZ/schemas/domainProfile_2/common/elementNames.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global element declarations for each of the data elements defined in the LOMv1.0 base schema. This component schema definition is used to check for the uniqueness of elements declared to be unique within their parent elements by the presence of the "uniqueElementName" attribute. The XML Schema constraint "unique" is used to enforce uniqueness constraints. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\-schemas/domainProfile_2/common/anyElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\0?))1schemas/domainProfile_2/vocabValues_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides global type declarations for the standard LOMv1.0 vocabulary tokens for those LOM data elements whose values are taken from a Vocabulary data type. This component schema defintion defines the stanard vocabulary value declarations as defined in the LOMv1.0 base schema. These vocabulary value declarations are used in conjunction with both vocab/custom.xsd and vocab/loose.xsd. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\H 'schemas/domainProfile_2/vocab/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides simple type declarations for LOM data elements that are defined as Vocabulary data types. This component schema definition enforces that vocabulary sources and values are character strings, which simplifies the schema validation process for those applications that perform vocabulary source/value validation using post-schema-validation. This component schema definition relaxes the validation constraints by allowing both sources and values to be arbitrary character strings. NOTE: The absence of the enforcement of vocabulary values does not relieve a particular LOM XML instance from satisfying vocabulary requirements defined in the LOMv1.0 base schema. Applications that require the use of vocab/loose.xsd component XSD should enforce those vocabulary requirements by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\qt@@0schemas/domainProfile_2/vocabTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides global type declarations for those LOM data elements whose values are taken from a Vocabulary data type. This component XSD requires schema components from other schemas that are defined in other namespaces. These statements import the appropriate components. The xsi:schemaLocation attribute is used to specify the location of the file that contains the schema that defines the namespace. The xsi:schemaLocation attribute is optional and is ommitted. By definition of the composite schemas the appropriate namespaces and related files where those namespaces are defined are brought into scope. Some XML parsers may require these import statements to contain the optional xsi:schemaLocation attribute. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" explanation: The vocabulary for intendedEndUserRole is 'IMSGLC_CC_Rolesv1p0'. explanation: The source for a context object is fixed to 'LOMv1.0' explanation: Possible intendedEndUserRoles are only 'Learner' and 'Instructor'. explanation: The value of context is fixed to 'higher education'. PK\ $schemas/domainProfile_2/lomLoose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This file represents a composite schema for validating LOM XML Instances. This file is built by default to represent a composite schema for validation of the following: 1) The use of LOMv1.0 base schema (i.e., 1484.12.1-2002) vocabulary source/value pairs only 2) Uniqueness constraints defined by LOMv1.0 base schema 3) No existenace of any defined extensions: LOMv1.0 base schema XML element extension, LOMv1.0 base schema XML attribute extension and LOMv1.0 base schema vocabulary data type extension Alternative composite schemas can be assembled by selecting from the various alternative component schema listed below. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\Bkk2schemas/domainProfile_2/elementTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data elements defined in the LOMv1.0 base schema. This component XSD defines the aggregation relationship among the LOM data elements. These aggregation relationships enforce the LOMv1.0 base schema requirement that elements can only be present in a LOM XML instance as elements of the aggregate element to which they belong. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\)schemas/domainProfile_2/extend/custom.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defines the XML Schema content model groups customElements and customAttributes to support validation of extension XML elements and attributes. This component XSD should be used if extensions are to be supported in LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\g"&schemas/domainProfile_2/anyElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\//schemas/domainProfile_2/imscc_mR_definition.xsdnu[ PK\ R]R]2schemas/domainProfile_2/elementNames_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global element declarations for each of the data elements defined in the LOMv1.0 base schema. This component schema definition is used to check for the uniqueness of elements declared to be unique within their parent elements by the presence of the "uniqueElementName" attribute. The XML Schema constraint "unique" is used to enforce uniqueness constraints. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\%q\ 9schemas/domainProfile_2/lomLoose_constraintsDocument.scmtnu[ Assertion failed for pattern_1. An Item object which represents a folder is indicated by the absence of an IdentifierRef characteristic object. Folder Items support unlimited nesting of other folder Items and learning object link Items. Learning Application Resource Item objects may be nested by folder Item object but may not nest other folder or Learning Application resource Item objects.(#S04) Assertion failed for pattern_2. A Resource object which is a Learning Object Web Content may contain Dependency objects which reference Resource objects with Type 'webcontent'.(#S03) Assertion failed for pattern_3. If an item is invisible, its descendants must be invisible too.(#S02) Assertion failed for pattern_4. A Resource object which is a Discussion Topic associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S12) Assertion failed for pattern_5. The test was: . The context was: ims:resources/ims:resource/ims:dependency | ims:manifest/ims:resources/ims:resource/ims:dependency Assertion failed for pattern_6. A Resource object which is an assessment may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S14) Assertion failed for pattern_7. If a cartridge web content or associated content resource is linked from a Learning Application Object link Item object it must have an Href characteristic object which represents the launchable resource.(#S05) Assertion failed for pattern_8. For Discussion Topic Resources the Resource object must contain a single File object which references the Discussion Topic descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imsdt_v1p0 schema. It must not have any href attribute.(#S06) Assertion failed for pattern_9. For Web Link Resources the Resource object must contain a single File object which references the Web Link descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imswl_v1p0 schema. It must contain neither Dependency objects nor an href attribute.(#S07) Assertion failed for pattern_10. For Assessment or Question Bank Resources the Resource object must contain a single File object which references the QTI XML file. This file must conform to the IMS CC profile of QTI 1.2.1. The profile is contained in the package of this profile as imscc_q*.xdm. The derived schema of this QTI profile is in the package of this profile with the name ims_qtiasiv1p2_localised.xsd. The resource must not have an href attribute(#S11) PK\Rׂ.schemas/domainProfile_2/lomLoose_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This file represents a composite schema for validating LOM XML Instances. This file is built by default to represent a composite schema for validation of the following: 1) The use of LOMv1.0 base schema (i.e., 1484.12.1-2002) vocabulary source/value pairs only 2) Uniqueness constraints defined by LOMv1.0 base schema 3) No existenace of any defined extensions: LOMv1.0 base schema XML element extension, LOMv1.0 base schema XML attribute extension and LOMv1.0 base schema vocabulary data type extension Alternative composite schemas can be assembled by selecting from the various alternative component schema listed below. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\J@@4schemas/domainProfile_0/imsccauth_v1p0_localised.xsdnu[ general: This specification defines the authorizations for Common Cartridges and the roles to be used for selective display of resources to Learner or Instructor. This group is defined exactly as in IMS Content Packaging v 1.2. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. PK\`**schemas/domainProfile_0/imsccauth_v1p0.xsdnu[ This group is defined exactly as in IMS Content Packaging v 1.2. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. PK\%q\ ?schemas/domainProfile_0/imsccauth_v1p0_constraintsDocument.scmtnu[ Assertion failed for pattern_1. An Item object which represents a folder is indicated by the absence of an IdentifierRef characteristic object. Folder Items support unlimited nesting of other folder Items and learning object link Items. Learning Application Resource Item objects may be nested by folder Item object but may not nest other folder or Learning Application resource Item objects.(#S04) Assertion failed for pattern_2. A Resource object which is a Learning Object Web Content may contain Dependency objects which reference Resource objects with Type 'webcontent'.(#S03) Assertion failed for pattern_3. If an item is invisible, its descendants must be invisible too.(#S02) Assertion failed for pattern_4. A Resource object which is a Discussion Topic associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S12) Assertion failed for pattern_5. The test was: . The context was: ims:resources/ims:resource/ims:dependency | ims:manifest/ims:resources/ims:resource/ims:dependency Assertion failed for pattern_6. A Resource object which is an assessment may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S14) Assertion failed for pattern_7. If a cartridge web content or associated content resource is linked from a Learning Application Object link Item object it must have an Href characteristic object which represents the launchable resource.(#S05) Assertion failed for pattern_8. For Discussion Topic Resources the Resource object must contain a single File object which references the Discussion Topic descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imsdt_v1p0 schema. It must not have any href attribute.(#S06) Assertion failed for pattern_9. For Web Link Resources the Resource object must contain a single File object which references the Web Link descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imswl_v1p0 schema. It must contain neither Dependency objects nor an href attribute.(#S07) Assertion failed for pattern_10. For Assessment or Question Bank Resources the Resource object must contain a single File object which references the QTI XML file. This file must conform to the IMS CC profile of QTI 1.2.1. The profile is contained in the package of this profile as imscc_q*.xdm. The derived schema of this QTI profile is in the package of this profile with the name ims_qtiasiv1p2_localised.xsd. The resource must not have an href attribute(#S11) PK\31 0schemas/domainProfile_1/anyElement_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\ R/schemas/domainProfile_1/dataTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data types defined in the LOMv1.0 base schema. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" explanation: No custom elements are allowed. PK\΋.schemas/domainProfile_1/imscc_m_definition.xsdnu[ PK\Ep!schemas/domainProfile_1/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides attribute group declarations for LOM data elements to support schema-based validation of uniqueness constraints within a LOM XML instance where the exact set of attributes associated with each element has to be as specified by the LOM XML Schema binding (i.e., where extra attributes to enforce uniqueness have to be avoided). Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. NOTE: The absence of the enforcement of the uniqueness constraints does not relieve a particular LOM XML instance from satisfying the uniqueness constraints described in the LOMv1.0 base schema. Applications that require the use of the unique/loose.xsd component XSD have to enforce those uniqueness constraints by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\gNoo(schemas/domainProfile_1/unique/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides attribute group declarations for LOM data elements to support schema-based validation of uniqueness constraints within a LOM XML instance where the exact set of attributes associated with each element has to be as specified by the LOM XML Schema binding (i.e., where extra attributes to enforce uniqueness have to be avoided). Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. NOTE: The absence of the enforcement of the uniqueness constraints does not relieve a particular LOM XML instance from satisfying the uniqueness constraints described in the LOMv1.0 base schema. Applications that require the use of the unique/loose.xsd component XSD have to enforce those uniqueness constraints by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\~3 1schemas/domainProfile_1/rootElement_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides the element name declaration for the root element for all LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\hTk$$,schemas/domainProfile_1/common/dataTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data types defined in the LOMv1.0 base schema. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\ h''.schemas/domainProfile_1/common/vocabValues.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides global type declarations for the standard LOMv1.0 vocabulary tokens for those LOM data elements whose values are taken from a Vocabulary data type. This component schema defintion defines the stanard vocabulary value declarations as defined in the LOMv1.0 base schema. These vocabulary value declarations are used in conjunction with both vocab/custom.xsd and vocab/loose.xsd. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\\mm.schemas/domainProfile_1/common/rootElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides the element name declaration for the root element for all LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\0Mb6b6-schemas/domainProfile_1/common/vocabTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides global type declarations for those LOM data elements whose values are taken from a Vocabulary data type. This component XSD requires schema components from other schemas that are defined in other namespaces. These statements import the appropriate components. The xsi:schemaLocation attribute is used to specify the location of the file that contains the schema that defines the namespace. The xsi:schemaLocation attribute is optional and is ommitted. By definition of the composite schemas the appropriate namespaces and related files where those namespaces are defined are brought into scope. Some XML parsers may require these import statements to contain the optional xsi:schemaLocation attribute. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\N"dee/schemas/domainProfile_1/common/elementTypes.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data elements defined in the LOMv1.0 base schema. This component XSD defines the aggregation relationship among the LOM data elements. These aggregation relationships enforce the LOMv1.0 base schema requirement that elements can only be present in a LOM XML instance as elements of the aggregate element to which they belong. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\g>ZZ/schemas/domainProfile_1/common/elementNames.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global element declarations for each of the data elements defined in the LOMv1.0 base schema. This component schema definition is used to check for the uniqueness of elements declared to be unique within their parent elements by the presence of the "uniqueElementName" attribute. The XML Schema constraint "unique" is used to enforce uniqueness constraints. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\dss""-schemas/domainProfile_1/common/anyElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\))1schemas/domainProfile_1/vocabValues_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides global type declarations for the standard LOMv1.0 vocabulary tokens for those LOM data elements whose values are taken from a Vocabulary data type. This component schema defintion defines the stanard vocabulary value declarations as defined in the LOMv1.0 base schema. These vocabulary value declarations are used in conjunction with both vocab/custom.xsd and vocab/loose.xsd. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\'ܮ))'schemas/domainProfile_1/vocab/loose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides simple type declarations for LOM data elements that are defined as Vocabulary data types. This component schema definition enforces that vocabulary sources and values are character strings, which simplifies the schema validation process for those applications that perform vocabulary source/value validation using post-schema-validation. This component schema definition relaxes the validation constraints by allowing both sources and values to be arbitrary character strings. NOTE: The absence of the enforcement of vocabulary values does not relieve a particular LOM XML instance from satisfying vocabulary requirements defined in the LOMv1.0 base schema. Applications that require the use of vocab/loose.xsd component XSD should enforce those vocabulary requirements by other means. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\Q-==0schemas/domainProfile_1/vocabTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion provides global type declarations for those LOM data elements whose values are taken from a Vocabulary data type. This component XSD requires schema components from other schemas that are defined in other namespaces. These statements import the appropriate components. The xsi:schemaLocation attribute is used to specify the location of the file that contains the schema that defines the namespace. The xsi:schemaLocation attribute is optional and is ommitted. By definition of the composite schemas the appropriate namespaces and related files where those namespaces are defined are brought into scope. Some XML parsers may require these import statements to contain the optional xsi:schemaLocation attribute. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" explanation: learningResourceType must be 'IMS Common Cartridge' explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. PK\+q$schemas/domainProfile_1/lomLoose.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This file represents a composite schema for validating LOM XML Instances. This file is built by default to represent a composite schema for validation of the following: 1) The use of LOMv1.0 base schema (i.e., 1484.12.1-2002) vocabulary source/value pairs only 2) Uniqueness constraints defined by LOMv1.0 base schema 3) No existenace of any defined extensions: LOMv1.0 base schema XML element extension, LOMv1.0 base schema XML attribute extension and LOMv1.0 base schema vocabulary data type extension Alternative composite schemas can be assembled by selecting from the various alternative component schema listed below. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\M'rr2schemas/domainProfile_1/elementTypes_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global schema data type declarations for data elements defined in the LOMv1.0 base schema. This component XSD defines the aggregation relationship among the LOM data elements. These aggregation relationships enforce the LOMv1.0 base schema requirement that elements can only be present in a LOM XML instance as elements of the aggregate element to which they belong. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" explanation: metaMetadata is unused. explanation: lom.annotation is unused. explanation: No custom elements are allowed. explanation: General.structure is unused. explanation: General.aggregationLevel is unused. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: liveCycle.version is unused. explanation: lifeCycle.status is unused. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: technical.size is unused. explanation: technical.location is unused. explanation: technical.requirement is unused. explanation: technical.installationRemarks is unused. explanation: technical.otherPlatformRequirements is unused. explanation: technical.duration is unused. explanation: No custom elements are allowed. explanation: interactivityType is unused. explanation: interactivityLevel is unused. explanation: semanticDensity is unused. explanation: intendedEndUserRole is unused. explanation: Context is unused. explanation: typicalAgeRange is unused. explanation: difficulty is unused. explanation: typicalLearningTime is unused. explanation: description is unused in educational context. explanation: language unused in technical context, only in general context. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. explanation: No custom elements are allowed. PK\k@D)schemas/domainProfile_1/extend/custom.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defines the XML Schema content model groups customElements and customAttributes to support validation of extension XML elements and attributes. This component XSD should be used if extensions are to be supported in LOM XML instances. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\4Ex&schemas/domainProfile_1/anyElement.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema definition provides the element group declaration and the attribute group declaration used for extension XML elements and attributes. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\\^]^]2schemas/domainProfile_1/elementNames_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This component schema defintion defines global element declarations for each of the data elements defined in the LOMv1.0 base schema. This component schema definition is used to check for the uniqueness of elements declared to be unique within their parent elements by the presence of the "uniqueElementName" attribute. The XML Schema constraint "unique" is used to enforce uniqueness constraints. Duplicate declarations are included as comments for completeness. These declarations should remain commented out or they can be removed completely. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" PK\%q\ 9schemas/domainProfile_1/lomLoose_constraintsDocument.scmtnu[ Assertion failed for pattern_1. An Item object which represents a folder is indicated by the absence of an IdentifierRef characteristic object. Folder Items support unlimited nesting of other folder Items and learning object link Items. Learning Application Resource Item objects may be nested by folder Item object but may not nest other folder or Learning Application resource Item objects.(#S04) Assertion failed for pattern_2. A Resource object which is a Learning Object Web Content may contain Dependency objects which reference Resource objects with Type 'webcontent'.(#S03) Assertion failed for pattern_3. If an item is invisible, its descendants must be invisible too.(#S02) Assertion failed for pattern_4. A Resource object which is a Discussion Topic associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S12) Assertion failed for pattern_5. The test was: . The context was: ims:resources/ims:resource/ims:dependency | ims:manifest/ims:resources/ims:resource/ims:dependency Assertion failed for pattern_6. A Resource object which is an assessment may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S14) Assertion failed for pattern_7. If a cartridge web content or associated content resource is linked from a Learning Application Object link Item object it must have an Href characteristic object which represents the launchable resource.(#S05) Assertion failed for pattern_8. For Discussion Topic Resources the Resource object must contain a single File object which references the Discussion Topic descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imsdt_v1p0 schema. It must not have any href attribute.(#S06) Assertion failed for pattern_9. For Web Link Resources the Resource object must contain a single File object which references the Web Link descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imswl_v1p0 schema. It must contain neither Dependency objects nor an href attribute.(#S07) Assertion failed for pattern_10. For Assessment or Question Bank Resources the Resource object must contain a single File object which references the QTI XML file. This file must conform to the IMS CC profile of QTI 1.2.1. The profile is contained in the package of this profile as imscc_q*.xdm. The derived schema of this QTI profile is in the package of this profile with the name ims_qtiasiv1p2_localised.xsd. The resource must not have an href attribute(#S11) PK\.schemas/domainProfile_1/lomLoose_localised.xsdnu[ This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, see the file license.txt, visit http://creativecommons.org/licenses/by-sa/2.0 or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. This file represents a composite schema for validating LOM XML Instances. This file is built by default to represent a composite schema for validation of the following: 1) The use of LOMv1.0 base schema (i.e., 1484.12.1-2002) vocabulary source/value pairs only 2) Uniqueness constraints defined by LOMv1.0 base schema 3) No existenace of any defined extensions: LOMv1.0 base schema XML element extension, LOMv1.0 base schema XML attribute extension and LOMv1.0 base schema vocabulary data type extension Alternative composite schemas can be assembled by selecting from the various alternative component schema listed below. This file has been modified by the Knowledge Media Institute of the University Koblenz-Landau (http://iwm.uni-koblenz.de). It contains the following changes: 1) Instead of "unique/strict.xsd" the schema "unique/loose.xsd" is imported because this reflects what is said in 1484.12.3-2005, page 35 (section C.1.3) 2) In all component XSDs the schemaLocation attribute was amended to the xs:import and xs:include statements. This enables the usage of the schemas with tools which don't deal well with missing schemaLocation informations. This file is available at "http://iwm.uni-koblenz.de/xsd/IEEE-LOM/loose" conformance: This profile restricts 'IEEE LOM 1.0 loose' to the elements needed to cover unqualified Dublin Core. dc:contributor, dc:creator, dc:publisher map to lifeCycle.contribute.entity with appropriate value of lifeCycle.contribute.role, dc:coverage maps to general.coverage, dc:date maps to lifeCycle.contribute.date, dc:description maps to general.description, dc:format maps to technical.format, dc:identifier maps to general.identifier, dc:language maps to general.language, dc:relation maps to Relation, dc:rights maps to Rights, dc:source is not mapped, dc:subject maps to general.keyword (see also classification.keyword), dc:title maps to general.title dc:type maps to Educational.learningResourceType scope: This profile is used within the Common Cartridge specification. name: IMS Common Cartridge profile of IEEE LOM V1.0 loose for unqualified Dublin Core PK\Q%@g_g_schemas/imscp_v1p2.xsdnu[ XSD Data File Information ------------------------- Author: CP1.2 Project Team Date: 31st October, 2006 Version: 2.0 Status: CM/DN Release Description: This is a normative representation of the IMS CP 1.2 Information Model for binding purposes. Read the corresponding IMS CP Information Model for the Platform Independent Model representation. History: This is version 1 of the IMS CP v1.2 XSD. It directly supercedes IMS CP v1.1.4 XSD. Note that the target namespace has NOT been changed. Apart from the functional additions, the main structural changes are: (1) All of the elements and attributes are defined as local to their host object; (2) Comments have been added to the complexType definitions. Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. IMS Global Learning Consortium, Inc. (IMS/GLC) is publishing the information contained in this binding ("Specification") for purposes of scientific experimental and scholarly collaboration only. IMS/GLC makes no warranty or representation regarding the accuracy or completeness of the Specification. This material is provided on an "As Is" and "As Available basis". The Specification is at all times subject to change and revision without notice. It is your sole responsibility to evaluate the usefulness, accuracy and completeness of the Specification as it relates to you. IMS/GLC would appreciate receiving your comments and suggestions. Please contact IMS/GLC through our website at: http://www.imsglobal.org. Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p7.xsl XSLT Processor: Xalan Release: 1.0 Beta 1 Date: 30th November, 2005 Auto-generation Tool -------------------- This WSDL/XSD was auto-generated using the IMS WSDL/XSD auto-generation tool. While every attempt has been made to ensure that this tool auto-generates the XSDs correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS document: "IMS General Web Services: WSDL/XSD Binding Auto-generation" available at the IMS web-site. Tool Copyright: 2005 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. A manifest element is a container for data structures whose contents describe a semantically complete instance of the IMS Content Packaging Information Model. A manifest element may contain and reference child manifest elements in the same IMS Manifest document. The root manifest element defines an entire IMS Package. A child manifest element defines a semantically complete subset of that Package.

Represents a binding of the kinds of objects defined as children of ims-cp-imManifest : Manifest.[ ManifestMetadata, Organizations, Resources, Manifest, Extension ].

An instance of the metadata element contains data structures that declare descriptive information about a metadata element's parent only. One or more different metadata models may be declared as child extensions of a metadata element.

Represents a binding of the kinds of child objects defined for ims-cp-imMetadata: Metadata.[ Extension ].

The organizations element is a container for all data structures that describe the way or ways that information encapsulated by its parent manifest element is structured.

Represents of binding of the child objects of ims-cp-imOrganizations: Organizations.[ Organization, Extension ].

The Resources element is a container for data structures containing references to one or more assets. Asset references may be grouped within a containing resources element in whatever manner seems best. The scope of referenced assets is specific to a resources element's parent manifest element only.

Represents a binding of the kinds of child objects defined for ims-cp-imResources: Resources.[ Resource, Extension ].

An organization element is a container for all data structures relating to a particular way or view that information encapsulated by a grandparent manifest object is structured. Multiple organization elements within the same parent organizations element are equivalent in purpose: Each shows a different way for structuring the same information declared within a grandparent manifest object.

Represents a binding of the kinds of child objects defined for ims-cp-Organization: Organization[ Title, Item, Metadata, Extension ].

A resource element is a container for a particular asset or collection of assets. A resource may contain references to assets that are all of the same type or different types (i.e., file formats). The scope or boundary of an IMS Package is defined by the asset references collected into all resources containers associated with the root manifest element, whether as a child, direcdt descendant, or externally linked descendant.

Represents a binding of the kinds of child objects defined for ims-cp-imResource: Resource.[ Metadata, File, Dependency, Extension ].

An item element represents a structural node in a particular organization. An item element may be a parent or sibling of other Item elements, each one representing a unique structural node. An organization has no meaning unless it has at least one Item element.

Represents a binding of the kinds of child objects of ims-cp-imItem: Item.[ Title, Item, Metadata, Extension ].

A file element declares a reference to a single asset. The reference may be relative to the Package containing the file element or absolute (external to the Package). A file element may contain child extensions declaring alternative references to the same asset as that referenced by the file element's href attribute.

Represents a binding of the kinds of child objects defined for ims-cp-imFile: File.[ Metadata, Extension ].

A dependency element provides a way to associate another collection of asset references within the scope of the dependency element's parent resource element. This element allows the parsimonious declaration of asset references. Shared asset references can be declared once and associated many times through a Dependency element.

Represents a binding of the kinds of child objects defined for ims-cp-imDependency: Dependency.[ Extension ].

This metadata element contains data structures that declare descriptive information about an entire Package. One or more different metadata models may be declared as child extensions of a metadata element. The schema and schemaversion children define the kind or collection of metadata models being used.

Represents a binding of the kinds of child objects defined for ims-cp-imManifestMetadata: ManifestMetadata.[ Schema, SchemaVersion, MetadataModel ]..

PK\tD"D"schemas/xml.xsdnu[

About the XML namespace

This schema document describes the XML namespace, in a form suitable for import by other schema documents.

See http://www.w3.org/XML/1998/namespace.html and http://www.w3.org/TR/REC-xml for information about this namespace.

Note that local names in this namespace are intended to be defined only by the World Wide Web Consortium or its subgroups. The names currently defined in this namespace are listed below. They should not be used with conflicting semantics by any Working Group, specification, or document instance.

See further below in this document for more information about how to refer to this schema document from your own XSD schema documents and about the namespace-versioning policy governing this schema document.

lang (as an attribute name)

denotes an attribute whose value is a language code for the natural language of the content of any element; its value is inherited. This name is reserved by virtue of its definition in the XML specification.

Notes

Attempting to install the relevant ISO 2- and 3-letter codes as the enumerated possible values is probably never going to be a realistic possibility.

See BCP 47 at http://www.rfc-editor.org/rfc/bcp/bcp47.txt and the IANA language subtag registry at http://www.iana.org/assignments/language-subtag-registry for further information.

The union allows for the 'un-declaration' of xml:lang with the empty string.

space (as an attribute name)

denotes an attribute whose value is a keyword indicating what whitespace processing discipline is intended for the content of the element; its value is inherited. This name is reserved by virtue of its definition in the XML specification.

base (as an attribute name)

denotes an attribute whose value provides a URI to be used as the base for interpreting any relative URIs in the scope of the element on which it appears; its value is inherited. This name is reserved by virtue of its definition in the XML Base specification.

See http://www.w3.org/TR/xmlbase/ for information about this attribute.

id (as an attribute name)

denotes an attribute whose value should be interpreted as if declared to be of type ID. This name is reserved by virtue of its definition in the xml:id specification.

See http://www.w3.org/TR/xml-id/ for information about this attribute.

Father (in any context at all)

denotes Jon Bosak, the chair of the original XML Working Group. This name is reserved by the following decision of the W3C XML Plenary and XML Coordination groups:

In appreciation for his vision, leadership and dedication the W3C XML Plenary on this 10th day of February, 2000, reserves for Jon Bosak in perpetuity the XML name "xml:Father".

About this schema document

This schema defines attributes and an attribute group suitable for use by schemas wishing to allow xml:base, xml:lang, xml:space or xml:id attributes on elements they define.

To enable this, such a schema must import this schema for the XML namespace, e.g. as follows:

          <schema . . .>
           . . .
           <import namespace="http://www.w3.org/XML/1998/namespace"
                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
     

or

           <import namespace="http://www.w3.org/XML/1998/namespace"
                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
     

Subsequently, qualified reference to any of the attributes or the group defined below will have the desired effect, e.g.

          <type . . .>
           . . .
           <attributeGroup ref="xml:specialAttrs"/>
     

will define a type which will schema-validate an instance element with any of those attributes.

Versioning policy for this schema document

In keeping with the XML Schema WG's standard versioning policy, this schema document will persist at http://www.w3.org/2009/01/xml.xsd.

At the date of issue it can also be found at http://www.w3.org/2001/xml.xsd.

The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XML Schema itself, or with the XML namespace itself. In other words, if the XML Schema or XML namespaces change, the version of this document at http://www.w3.org/2001/xml.xsd will change accordingly; the version at http://www.w3.org/2009/01/xml.xsd will not change.

Previous dated (and unchanging) versions of this schema document are at:

PK\r)p;;&schemas/domainProfile_5/imswl_v1p0.xsdnu[ PK\0schemas/domainProfile_5/imswl_v1p0_localised.xsdnu[ PK\ &NNschemas/config.xmlnu[ http://www.imsglobal.org/xsd/imscc/imscp_v1p1 imscp_v1p2_localised.xsd http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p2.xsd http://www.imsglobal.org/xsd/imsccauth_v1p0 domainProfile_0/imsccauth_v1p0_localised.xsd http://ltsc.ieee.org/xsd/imscc/LOM domainProfile_1/lomLoose_localised.xsd http://ltsc.ieee.org/xsd/imscc/LOM/unique domainProfile_1/loose.xsd http://ltsc.ieee.org/xsd/imscc/LOM/vocab domainProfile_1/vocab/loose.xsd http://ltsc.ieee.org/xsd/imscc/LOM/extend domainProfile_1/extend/custom.xsd http://ltsc.ieee.org/xsd/LOM domainProfile_2/lomLoose_localised.xsd http://ltsc.ieee.org/xsd/LOM/unique domainProfile_2/loose.xsd http://ltsc.ieee.org/xsd/LOM/vocab domainProfile_2/vocab/loose.xsd http://ltsc.ieee.org/xsd/LOM/extend domainProfile_2/extend/custom.xsd http://www.imsglobal.org/xsd/imscp_extensionv1p2 domainProfile_3/imscp_extensionv1p2_localised.xsd http://www.imsglobal.org/xsd/ims_qtiasiv1p2 domainProfile_4/ims_qtiasiv1p2_localised.xsd http://www.imsglobal.org/xsd/imswl_v1p0 domainProfile_5/imswl_v1p0_localised.xsd http://www.imsglobal.org/xsd/imsdt_v1p0 domainProfile_6/imsdt_v1p0_localised.xsd PK\k )schemas/imscc_c1p2maeV0p15_definition.xsdnu[ PK\1avv schemas/imscp_v1p2_localised.xsdnu[ XSD Data File Information ------------------------- Author: CP1.2 Project Team Date: 31st October, 2006 Version: 2.0 Status: CM/DN Release Description: This is a normative representation of the IMS CP 1.2 Information Model for binding purposes. Read the corresponding IMS CP Information Model for the Platform Independent Model representation. History: This is version 1 of the IMS CP v1.2 XSD. It directly supercedes IMS CP v1.1.4 XSD. Note that the target namespace has NOT been changed. Apart from the functional additions, the main structural changes are: (1) All of the elements and attributes are defined as local to their host object; (2) Comments have been added to the complexType definitions. Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. IMS Global Learning Consortium, Inc. (IMS/GLC) is publishing the information contained in this binding ("Specification") for purposes of scientific experimental and scholarly collaboration only. IMS/GLC makes no warranty or representation regarding the accuracy or completeness of the Specification. This material is provided on an "As Is" and "As Available basis". The Specification is at all times subject to change and revision without notice. It is your sole responsibility to evaluate the usefulness, accuracy and completeness of the Specification as it relates to you. IMS/GLC would appreciate receiving your comments and suggestions. Please contact IMS/GLC through our website at: http://www.imsglobal.org. Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p7.xsl XSLT Processor: Xalan Release: 1.0 Beta 1 Date: 30th November, 2005 Auto-generation Tool -------------------- This WSDL/XSD was auto-generated using the IMS WSDL/XSD auto-generation tool. While every attempt has been made to ensure that this tool auto-generates the XSDs correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS document: "IMS General Web Services: WSDL/XSD Binding Auto-generation" available at the IMS web-site. Tool Copyright: 2005 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. A manifest element is a container for data structures whose contents describe a semantically complete instance of the IMS Content Packaging Information Model. A manifest element may contain and reference child manifest elements in the same IMS Manifest document. The root manifest element defines an entire IMS Package. A child manifest element defines a semantically complete subset of that Package.

Represents a binding of the kinds of objects defined as children of ims-cp-imManifest : Manifest.[ ManifestMetadata, Organizations, Resources, Manifest, Extension ].

An instance of the metadata element contains data structures that declare descriptive information about a metadata element's parent only. One or more different metadata models may be declared as child extensions of a metadata element.

Represents a binding of the kinds of child objects defined for ims-cp-imMetadata: Metadata.[ Extension ].

The organizations element is a container for all data structures that describe the way or ways that information encapsulated by its parent manifest element is structured.

Represents of binding of the child objects of ims-cp-imOrganizations: Organizations.[ Organization, Extension ].

The Resources element is a container for data structures containing references to one or more assets. Asset references may be grouped within a containing resources element in whatever manner seems best. The scope of referenced assets is specific to a resources element's parent manifest element only.

Represents a binding of the kinds of child objects defined for ims-cp-imResources: Resources.[ Resource, Extension ].

An organization element is a container for all data structures relating to a particular way or view that information encapsulated by a grandparent manifest object is structured. Multiple organization elements within the same parent organizations element are equivalent in purpose: Each shows a different way for structuring the same information declared within a grandparent manifest object.

Represents a binding of the kinds of child objects defined for ims-cp-Organization: Organization[ Title, Item, Metadata, Extension ].

A resource element is a container for a particular asset or collection of assets. A resource may contain references to assets that are all of the same type or different types (i.e., file formats). The scope or boundary of an IMS Package is defined by the asset references collected into all resources containers associated with the root manifest element, whether as a child, direcdt descendant, or externally linked descendant.

Represents a binding of the kinds of child objects defined for ims-cp-imResource: Resource.[ Metadata, File, Dependency, Extension ].

An item element represents a structural node in a particular organization. An item element may be a parent or sibling of other Item elements, each one representing a unique structural node. An organization has no meaning unless it has at least one Item element.

Represents a binding of the kinds of child objects of ims-cp-imItem: Item.[ Title, Item, Metadata, Extension ].

An item element represents a structural node in a particular organization. An item element may be a parent or sibling of other Item elements, each one representing a unique structural node. An organization has no meaning unless it has at least one Item element.

Represents a binding of the kinds of child objects of ims-cp-imItem: Item.[ Title, Item, Metadata, Extension ].

A file element declares a reference to a single asset. The reference may be relative to the Package containing the file element or absolute (external to the Package). A file element may contain child extensions declaring alternative references to the same asset as that referenced by the file element's href attribute.

Represents a binding of the kinds of child objects defined for ims-cp-imFile: File.[ Metadata, Extension ].

A dependency element provides a way to associate another collection of asset references within the scope of the dependency element's parent resource element. This element allows the parsimonious declaration of asset references. Shared asset references can be declared once and associated many times through a Dependency element.

Represents a binding of the kinds of child objects defined for ims-cp-imDependency: Dependency.[ Extension ].

This metadata element contains data structures that declare descriptive information about an entire Package. One or more different metadata models may be declared as child extensions of a metadata element. The schema and schemaversion children define the kind or collection of metadata models being used.

Represents a binding of the kinds of child objects defined for ims-cp-imManifestMetadata: ManifestMetadata.[ Schema, SchemaVersion, MetadataModel ]..

PK\:))0schemas/domainProfile_6/imsdt_v1p0_localised.xsdnu[ PK\n&schemas/domainProfile_6/imsdt_v1p0.xsdnu[ PK\{``schemas/domainProfile_4/xml.xsdnu[ See http://www.w3.org/XML/1998/namespace.html and http://www.w3.org/TR/REC-xml for information about this namespace. This schema document describes the XML namespace, in a form suitable for import by other schema documents. Note that local names in this namespace are intended to be defined only by the World Wide Web Consortium or its subgroups. The following names are currently defined in this namespace and should not be used with conflicting semantics by any Working Group, specification, or document instance: base (as an attribute name): denotes an attribute whose value provides a URI to be used as the base for interpreting any relative URIs in the scope of the element on which it appears; its value is inherited. This name is reserved by virtue of its definition in the XML Base specification. id (as an attribute name): denotes an attribute whose value should be interpreted as if declared to be of type ID. This name is reserved by virtue of its definition in the xml:id specification. lang (as an attribute name): denotes an attribute whose value is a language code for the natural language of the content of any element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. space (as an attribute name): denotes an attribute whose value is a keyword indicating what whitespace processing discipline is intended for the content of the element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. Father (in any context at all): denotes Jon Bosak, the chair of the original XML Working Group. This name is reserved by the following decision of the W3C XML Plenary and XML Coordination groups: In appreciation for his vision, leadership and dedication the W3C XML Plenary on this 10th day of February, 2000 reserves for Jon Bosak in perpetuity the XML name xml:Father This schema defines attributes and an attribute group suitable for use by schemas wishing to allow xml:base, xml:lang, xml:space or xml:id attributes on elements they define. To enable this, such a schema must import this schema for the XML namespace, e.g. as follows: <schema . . .> . . . <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> Subsequently, qualified reference to any of the attributes or the group defined below will have the desired effect, e.g. <type . . .> . . . <attributeGroup ref="xml:specialAttrs"/> will define a type which will schema-validate an instance element with any of those attributes In keeping with the XML Schema WG's standard versioning policy, this schema document will persist at http://www.w3.org/2007/08/xml.xsd. At the date of issue it can also be found at http://www.w3.org/2001/xml.xsd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XML Schema itself, or with the XML namespace itself. In other words, if the XML Schema or XML namespaces change, the version of this document at http://www.w3.org/2001/xml.xsd will change accordingly; the version at http://www.w3.org/2007/08/xml.xsd will not change. Attempting to install the relevant ISO 2- and 3-letter codes as the enumerated possible values is probably never going to be a realistic possibility. See RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry at http://www.iana.org/assignments/lang-tag-apps.htm for further information. The union allows for the 'un-declaration' of xml:lang with the empty string. See http://www.w3.org/TR/xmlbase/ for information about this attribute. See http://www.w3.org/TR/xml-id/ for information about this attribute. PK\ {{3schemas/domainProfile_4/ims_qtiasiv1p2_def_copy.xsdnu[ PK\: o(o(.schemas/domainProfile_4/imscc_q_definition.xsdnu[ PK\cc*schemas/domainProfile_4/ims_qtiasiv1p2.xsdnu[ PK\XEmkmk4schemas/domainProfile_4/ims_qtiasiv1p2_localised.xsdnu[ PK\4<</schemas/domainProfile_3/imscp_extensionv1p2.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe (IMS, UK) Date: 31st October, 2006 Version: 2.0 Status: Public Draft Description: This is a normative representation of the IMS Packaging Extension 1.0 Information Model for binding purposes. Read the corresponding IMS Content Packaging Information Model for the Platform Independent Model representation. History: Version 2 includes the modified definition of LingualTitle. Version 1 of the IMS Packaging Utility v1.2 XSD for public draft release. It has a target namespace of http://www.imsglobal.org/xsd/imscp_extensionv1p2. This Utility uses this general approach to modeling: (1) All of the elements and attributes are defined as local to their host object; (2) There are multiple host objects; (3) Comments have been added to the complexType definitions. Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. IMS Global Learning Consortium, Inc. (IMS/GLC) is publishing the information contained in this binding ("Specification") for purposes of scientific experimental and scholarly collaboration only. IMS/GLC makes no warranty or representation regarding the accuracy or completeness of the Specification. This material is provided on an "As Is" and "As Available basis". The Specification is at all times subject to change and revision without notice. It is your sole responsibility to evaluate the usefulness, accuracy and completeness of the Specification as it relates to you. IMS/GLC would appreciate receiving your comments and suggestions. Please contact IMS/GLC through our website at: http://www.imsglobal.org. Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p7.xsl XSLT Processor: Xalan Release: 1.0 Beta 1 Date: 30th November, 2005 Auto-generation Tool -------------------- This WSDL/XSD was auto-generated using the IMS WSDL/XSD auto-generation tool. While every attempt has been made to ensure that this tool auto-generates the XSDs correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS document: "IMS General Web Services: WSDL/XSD Binding Auto-generation" available at the IMS web-site. Tool Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. A bound instance of an IPointer object allows a packager to associate a specific XML node set in the same IMS Manifest Document that contains it or an XML node set in a different IMS Manifest Document instance with the parent object containing an IMS Pointer instance. A referenced node set must be a valid child of the referencing parent element, both as to kind and multiplicity in a referencing parent's context.

Represents a binding of the kinds of objects defined as children of ims-cp-imManifest : Manifest.[ ManifestMetadata, Organizations, Resources, Manifest, Extension ].

An instance of the metadata element contains data structures that declare descriptive information about a metadata element's parent only. One or more different metadata models may be declared as child extensions of a metadata element.

Represents a binding of the kinds of child objects defined for ims-cp-imMetadata: Metadata.[ Extension ].

A variant element is closely analogous to a resource element in the IMS Content Packaging Information Model. Variant is a container for a an alternative resource. A resource may contain references to assets that are all of the same type or different types (i.e., file formats). The Variant class points to the alternatibe resource. Metadata is used to describe the nature of a collection of alternative assets and their intended use. Examples include, but are not limited to, use as lingual variants, visual or auditory variants, remediation variants, or platform delivery variants. The scope of referenced assets is specific to a Variant object. Their use is in the context of the parent object containing a variant instance, typically a bound instance of a Resource object from the IMS CP namespace.

Represents a binding of the kinds of child objects defined for ims-cp-imResource: Resource.[ Metadata, File, Dependency, Extension ].

PK\^??9schemas/domainProfile_3/imscp_extensionv1p2_localised.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe (IMS, UK) Date: 31st October, 2006 Version: 2.0 Status: Public Draft Description: This is a normative representation of the IMS Packaging Extension 1.0 Information Model for binding purposes. Read the corresponding IMS Content Packaging Information Model for the Platform Independent Model representation. History: Version 2 includes the modified definition of LingualTitle. Version 1 of the IMS Packaging Utility v1.2 XSD for public draft release. It has a target namespace of http://www.imsglobal.org/xsd/imscp_extensionv1p2. This Utility uses this general approach to modeling: (1) All of the elements and attributes are defined as local to their host object; (2) There are multiple host objects; (3) Comments have been added to the complexType definitions. Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. IMS Global Learning Consortium, Inc. (IMS/GLC) is publishing the information contained in this binding ("Specification") for purposes of scientific experimental and scholarly collaboration only. IMS/GLC makes no warranty or representation regarding the accuracy or completeness of the Specification. This material is provided on an "As Is" and "As Available basis". The Specification is at all times subject to change and revision without notice. It is your sole responsibility to evaluate the usefulness, accuracy and completeness of the Specification as it relates to you. IMS/GLC would appreciate receiving your comments and suggestions. Please contact IMS/GLC through our website at: http://www.imsglobal.org. Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p7.xsl XSLT Processor: Xalan Release: 1.0 Beta 1 Date: 30th November, 2005 Auto-generation Tool -------------------- This WSDL/XSD was auto-generated using the IMS WSDL/XSD auto-generation tool. While every attempt has been made to ensure that this tool auto-generates the XSDs correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS document: "IMS General Web Services: WSDL/XSD Binding Auto-generation" available at the IMS web-site. Tool Copyright: 2006 (c) IMS Global Learning Consortium Inc. All Rights Reserved. general: This profile of the extension schema of IMS CP 1.2 restricts extensions to use the variant element only. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. A bound instance of an IPointer object allows a packager to associate a specific XML node set in the same IMS Manifest Document that contains it or an XML node set in a different IMS Manifest Document instance with the parent object containing an IMS Pointer instance. A referenced node set must be a valid child of the referencing parent element, both as to kind and multiplicity in a referencing parent's context.

Represents a binding of the kinds of objects defined as children of ims-cp-imManifest : Manifest.[ ManifestMetadata, Organizations, Resources, Manifest, Extension ].

An instance of the metadata element contains data structures that declare descriptive information about a metadata element's parent only. One or more different metadata models may be declared as child extensions of a metadata element.

Represents a binding of the kinds of child objects defined for ims-cp-imMetadata: Metadata.[ Extension ].

A variant element is closely analogous to a resource element in the IMS Content Packaging Information Model. Variant is a container for a an alternative resource. A resource may contain references to assets that are all of the same type or different types (i.e., file formats). The Variant class points to the alternatibe resource. Metadata is used to describe the nature of a collection of alternative assets and their intended use. Examples include, but are not limited to, use as lingual variants, visual or auditory variants, remediation variants, or platform delivery variants. The scope of referenced assets is specific to a Variant object. Their use is in the context of the parent object containing a variant instance, typically a bound instance of a Resource object from the IMS CP namespace.

Represents a binding of the kinds of child objects defined for ims-cp-imResource: Resource.[ Metadata, File, Dependency, Extension ].

PK\%q\ Dschemas/domainProfile_3/imscp_extensionv1p2_constraintsDocument.scmtnu[ Assertion failed for pattern_1. An Item object which represents a folder is indicated by the absence of an IdentifierRef characteristic object. Folder Items support unlimited nesting of other folder Items and learning object link Items. Learning Application Resource Item objects may be nested by folder Item object but may not nest other folder or Learning Application resource Item objects.(#S04) Assertion failed for pattern_2. A Resource object which is a Learning Object Web Content may contain Dependency objects which reference Resource objects with Type 'webcontent'.(#S03) Assertion failed for pattern_3. If an item is invisible, its descendants must be invisible too.(#S02) Assertion failed for pattern_4. A Resource object which is a Discussion Topic associated resource may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S12) Assertion failed for pattern_5. The test was: . The context was: ims:resources/ims:resource/ims:dependency | ims:manifest/ims:resources/ims:resource/ims:dependency Assertion failed for pattern_6. A Resource object which is an assessment may contain Dependency objects which reference Resource objects with Type 'webcontent' or 'associatedcontent/imscc_xmlv1p0/learning-application-resource'.(#S14) Assertion failed for pattern_7. If a cartridge web content or associated content resource is linked from a Learning Application Object link Item object it must have an Href characteristic object which represents the launchable resource.(#S05) Assertion failed for pattern_8. For Discussion Topic Resources the Resource object must contain a single File object which references the Discussion Topic descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imsdt_v1p0 schema. It must not have any href attribute.(#S06) Assertion failed for pattern_9. For Web Link Resources the Resource object must contain a single File object which references the Web Link descriptor XML file which conforms to the http://www.imsglobal.org/xsd/imswl_v1p0 schema. It must contain neither Dependency objects nor an href attribute.(#S07) Assertion failed for pattern_10. For Assessment or Question Bank Resources the Resource object must contain a single File object which references the QTI XML file. This file must conform to the IMS CC profile of QTI 1.2.1. The profile is contained in the package of this profile as imscc_q*.xdm. The derived schema of this QTI profile is in the package of this profile with the name ims_qtiasiv1p2_localised.xsd. The resource must not have an href attribute(#S11) PK\D( ( entity.resource.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc_resource extends entities { public function generate_node() { cc2moodle::log_action('Creating Resource mods'); $response = ''; $sheet_mod_resource = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE); if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_RESOURCE] as $instance) { $response .= $this->create_node_course_modules_mod_resource($sheet_mod_resource, $instance); } } return $response; } private function create_node_course_modules_mod_resource($sheet_mod_resource, $instance) { global $CFG; require_once($CFG->libdir.'/validateurlsyntax.php'); $link = ''; $mod_alltext = ''; $mod_summary = ''; $xpath = cc2moodle::newx_path(cc2moodle::$manifest, cc2moodle::$namespaces); if ($instance['common_cartriedge_type'] == cc2moodle::CC_TYPE_WEBCONTENT || $instance['common_cartriedge_type'] == cc2moodle::CC_TYPE_ASSOCIATED_CONTENT) { $resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/@href'); $resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : ''; if (empty($resource)) { unset($resource); $resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href'); $resource = !empty($resource->item(0)->nodeValue) ? $resource->item(0)->nodeValue : ''; } if (!empty($resource)) { $link = $resource; } } if ($instance['common_cartriedge_type'] == cc2moodle::CC_TYPE_WEBLINK) { $external_resource = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $instance['resource_indentifier'] . '"]/imscc:file/@href')->item(0)->nodeValue; if ($external_resource) { $resource = $this->load_xml_resource(cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $external_resource); if (!empty($resource)) { $xpath = cc2moodle::newx_path($resource, cc2moodle::getresourcens()); $resource = $xpath->query('//url/@href'); if ($resource->length > 0) { $rawlink = $resource->item(0)->nodeValue; if (!validateUrlSyntax($rawlink, 's+')) { $changed = rawurldecode($rawlink); if (validateUrlSyntax($changed, 's+')) { $link = $changed; } else { $link = 'http://invalidurldetected/'; } } else { $link = $rawlink; } } } } } $find_tags = array('[#mod_instance#]', '[#mod_name#]', '[#mod_type#]', '[#mod_reference#]', '[#mod_summary#]', '[#mod_alltext#]', '[#mod_options#]', '[#date_now#]'); $mod_type = 'file'; $mod_options = 'objectframe'; $mod_reference = $link; //detected if we are dealing with html file if (!empty($link) && ($instance['common_cartriedge_type'] == cc2moodle::CC_TYPE_WEBCONTENT)) { $ext = strtolower(pathinfo($link, PATHINFO_EXTENSION)); if (in_array($ext, array('html', 'htm', 'xhtml'))) { $mod_type = 'html'; //extract the content of the file $rootpath = realpath(cc112moodle::$path_to_manifest_folder); $htmlpath = realpath($rootpath . DIRECTORY_SEPARATOR . $link); $dirpath = dirname($htmlpath); if (file_exists($htmlpath)) { $fcontent = file_get_contents($htmlpath); $mod_alltext = clean_param($this->prepare_content($fcontent), PARAM_CLEANHTML); $mod_reference = ''; $mod_options = ''; //TODO: try to handle embedded resources /** * images, linked static resources, applets, videos */ $doc = new DOMDocument(); $cdir = getcwd(); chdir($dirpath); try { if (!empty($mod_alltext) && $doc->loadHTML($mod_alltext)) { $xpath = new DOMXPath($doc); $attributes = array('href', 'src', 'background', 'archive', 'code'); $qtemplate = "//*[@##][not(contains(@##,'://'))]/@##"; $query = ''; foreach ($attributes as $attrname) { if (!empty($query)) { $query .= " | "; } $query .= str_replace('##', $attrname, $qtemplate); } $list = $xpath->query($query); $searches = array(); $replaces = array(); foreach ($list as $resrc) { $rpath = $resrc->nodeValue; $rtp = realpath($rpath); if (($rtp !== false) && is_file($rtp)) { //file is there - we are in business $strip = str_replace("\\", "/", str_ireplace($rootpath, '', $rtp)); $encoded_file = '$@FILEPHP@$'.str_replace('/', '$@SLASH@$', $strip); $searches[] = $resrc->nodeValue; $replaces[] = $encoded_file; } } $mod_alltext = str_replace($searches, $replaces, $mod_alltext); } } catch (Exception $e) { //silence the complaints } chdir($cdir); $mod_alltext = self::safexml($mod_alltext); } } } $replace_values = array($instance['instance'], self::safexml($instance['title']), $mod_type, $mod_reference, '', $mod_alltext, $mod_options, time()); return str_replace($find_tags, $replace_values, $sheet_mod_resource); } } PK\9P0sheets/info_details_mod.xmlnu[ [#mod_type#] true false [#node_info_details_mod_instances_instance#] PK\"tt!sheets/course_modules_mod_lti.xmlnu[ [#mod_instance#] lti [#mod_basiclti_name#] [#mod_basiclti_intro#] 1 [#mod_basiclti_timec#] [#mod_basiclti_timem#] 1 [#mod_basiclti_toolurl#] 1 0 1 1 $@NULL@$ 100.00000 0 [#mod_basiclti_icon#] PK\\ sheets/moodle_blti_export.xmlnu[ backup-cf101-20110815-0949.zip 2007101591 1.9.10 (Build: 20101025) 2009111300 1.9.7 1313412551 http://localhost/mdl191 9d9e34b447116860361beeca0191299f internal
forum false false basiclti true false 2 Yeah2 true false false none false false false false false false false instances
3 Teacher editingteacher report/courseoverview:view 1 1311692228 0 moodle/user:viewhiddendetails 1 1311692105 0 moodle/user:viewdetails 1 1311692105 0 moodle/user:readuserposts 1 1311692108 0 moodle/user:readuserblogs 1 1311692109 0 moodle/tag:manage 1 1311692111 0 moodle/tag:editblocks 1 1311692112 0 moodle/site:viewreports 1 1311692104 0 moodle/site:viewfullnames 1 1311692104 0 moodle/site:trustcontent 1 1311692104 0 moodle/site:restore 1 1311692103 0 moodle/site:readallmessages 1 1311692103 0 moodle/site:manageblocks 1 1311692104 0 moodle/site:import 1 1311692103 0 moodle/site:doclinks 1 1311692110 0 moodle/site:backup 1 1311692103 0 moodle/site:accessallgroups 1 1311692104 0 moodle/role:viewhiddenassigns 1 1311692105 0 moodle/role:unassignself 1 1311692105 0 moodle/role:switchroles 1 1311692105 0 moodle/role:safeoverride 1 1311692105 0 moodle/role:assign 1 1311692105 0 moodle/question:viewmine 1 1311692109 0 moodle/question:viewall 1 1311692109 0 moodle/question:usemine 1 1311692109 0 moodle/question:useall 1 1311692109 0 moodle/question:movemine 1 1311692109 0 moodle/question:moveall 1 1311692109 0 moodle/question:managecategory 1 1311692109 0 moodle/question:editmine 1 1311692109 0 moodle/question:editall 1 1311692109 0 moodle/question:add 1 1311692109 0 moodle/notes:view 1 1311692111 0 moodle/notes:manage 1 1311692111 0 moodle/legacy:editingteacher 1 1311692103 0 moodle/grade:viewhidden 1 1311692110 0 moodle/grade:viewall 1 1311692110 0 moodle/grade:unlock 1 1311692111 0 moodle/grade:manageoutcomes 1 1311692110 0 moodle/grade:manageletters 1 1311692111 0 moodle/grade:manage 1 1311692110 0 moodle/grade:lock 1 1311692111 0 moodle/grade:import 1 1311692110 0 moodle/grade:hide 1 1311692111 0 moodle/grade:export 1 1311692110 0 moodle/grade:edit 1 1311692110 0 moodle/course:visibility 1 1311692106 0 moodle/course:viewscales 1 1311692107 0 moodle/course:viewparticipants 1 1311692107 0 moodle/course:viewhiddenuserfields 1 1311692106 0 moodle/course:viewhiddensections 1 1311692110 0 moodle/course:viewhiddencourses 1 1311692106 0 moodle/course:viewhiddenactivities 1 1311692106 0 moodle/course:view 1 1311692106 0 moodle/course:useremail 1 1311692110 0 moodle/course:update 1 1311692106 0 moodle/course:setcurrentsection 1 1311692110 0 moodle/course:sectionvisibility 1 1311692110 0 moodle/course:reset 1 1311692107 0 moodle/course:managescales 1 1311692107 0 moodle/course:managemetacourse 1 1311692106 0 moodle/course:managegroups 1 1311692107 0 moodle/course:managefiles 1 1311692106 0 moodle/course:manageactivities 1 1311692106 0 moodle/course:changesummary 1 1311692107 0 moodle/course:changeshortname 1 1311692107 0 moodle/course:changeidnumber 1 1311692107 0 moodle/course:changefullname 1 1311692107 0 moodle/course:changecategory 1 1311692107 0 moodle/course:bulkmessaging 1 1311692106 0 moodle/course:activityvisibility 1 1311692106 0 moodle/calendar:managegroupentries 1 1311692108 0 moodle/calendar:manageentries 1 1311692108 0 moodle/blog:view 1 1311692108 0 moodle/blog:manageentries 1 1311692108 0 moodle/block:view 1 1311692112 0 mod/workshop:manage 1 1311692191 0 mod/wiki:participate 1 1311692184 0 mod/wiki:overridelock 1 1311692185 0 mod/wiki:manage 1 1311692185 0 mod/scorm:viewscores 1 1311692177 0 mod/scorm:viewreport 1 1311692176 0 mod/scorm:savetrack 1 1311692176 0 mod/scorm:deleteresponses 1 1311692177 0 mod/quiz:viewreports 1 1311692167 0 mod/quiz:view 1 1311692167 0 mod/quiz:preview 1 1311692167 0 mod/quiz:manage 1 1311692167 0 mod/quiz:grade 1 1311692167 0 mod/quiz:deleteattempts 1 1311692167 0 mod/lesson:manage 1 1311692156 0 mod/lesson:edit 1 1311692155 0 mod/lams:manage 1 1311692150 0 mod/hotpot:viewreport 1 1311692147 0 mod/hotpot:grade 1 1311692147 0 mod/hotpot:deleteattempt 1 1311692148 0 mod/hotpot:attempt 1 1311692147 0 mod/glossary:write 1 1311692143 0 mod/glossary:viewrating 1 1311692144 0 mod/glossary:rate 1 1311692144 0 mod/glossary:manageentries 1 1311692143 0 mod/glossary:managecomments 1 1311692144 0 mod/glossary:managecategories 1 1311692143 0 mod/glossary:import 1 1311692144 0 mod/glossary:export 1 1311692144 0 mod/glossary:comment 1 1311692143 0 mod/glossary:approve 1 1311692144 0 mod/forum:viewsubscribers 1 1311692138 0 mod/forum:viewrating 1 1311692137 0 mod/forum:viewqandawithoutposting 1 1311692138 0 mod/forum:viewhiddentimedposts 1 1311692137 0 mod/forum:viewdiscussion 1 1311692137 0 mod/forum:viewanyrating 1 1311692137 0 mod/forum:startdiscussion 1 1311692137 0 mod/forum:splitdiscussions 1 1311692138 0 mod/forum:replypost 1 1311692137 0 mod/forum:replynews 1 1311692137 0 mod/forum:rate 1 1311692138 0 mod/forum:movediscussions 1 1311692138 0 mod/forum:managesubscriptions 1 1311692138 0 mod/forum:initialsubscriptions 1 1311692139 0 mod/forum:editanypost 1 1311692138 0 mod/forum:deleteownpost 1 1311692138 0 mod/forum:deleteanypost 1 1311692138 0 mod/forum:createattachment 1 1311692138 0 mod/forum:addnews 1 1311692137 0 mod/data:writeentry 1 1311692130 0 mod/data:viewrating 1 1311692131 0 mod/data:viewentry 1 1311692130 0 mod/data:viewalluserpresets 1 1311692131 0 mod/data:rate 1 1311692131 0 mod/data:managetemplates 1 1311692131 0 mod/data:manageentries 1 1311692131 0 mod/data:approve 1 1311692131 0 mod/choice:readresponses 1 1311692127 0 mod/choice:downloadresponses 1 1311692127 0 mod/choice:deleteresponses 1 1311692127 0 mod/choice:choose 1 1311692127 0 mod/assignment:view 1 1311692122 0 mod/assignment:grade 1 1311692122 0 mod/assess:viewreport 1 1311965861 2 mod/assess:manage 1 1311965861 2 gradereport/user:view 1 1311692221 0 gradereport/outcomes:view 1 1311692220 0 gradereport/grader:view 1 1311692220 0 gradeimport/xml:view 1 1311692217 0 gradeimport/csv:view 1 1311692216 0 gradeexport/xml:view 1 1311692213 0 gradeexport/xls:view 1 1311692213 0 gradeexport/txt:view 1 1311692212 0 gradeexport/ods:view 1 1311692212 0 coursereport/stats:view 1 1311692225 0 coursereport/participation:view 1 1311692225 0 coursereport/outline:view 1 1311692225 0 coursereport/log:viewtoday 1 1311692225 0 coursereport/log:viewlive 1 1311692225 0 coursereport/log:view 1 1311692224 0 block/rss_client:manageownfeeds 1 1311692204 0 block/rss_client:createsharedfeeds 1 1311692204 0 block/rss_client:createprivatefeeds 1 1311692204 0 block/online_users:viewlist 1 1311692203 0 block/homework:view -1 1312038862 2 block/email_list:sendmessage 1 1311965874 2 block/email_list:editsettings 1 1311965874 2 block/email_list:createfolder 1 1311965874 2 5 Student student moodle/user:viewdetails 1 1311692105 0 moodle/user:readuserposts 1 1311692108 0 moodle/user:readuserblogs 1 1311692109 0 moodle/legacy:student 1 1311692103 0 moodle/grade:view 1 1311692110 0 moodle/course:viewscales 1 1311692107 0 moodle/course:viewparticipants 1 1311692107 0 moodle/course:view 1 1311692106 0 moodle/blog:view 1 1311692108 0 moodle/block:view 1 1311692112 0 mod/workshop:participate 1 1311692191 0 mod/wiki:participate 1 1311692184 0 mod/scorm:viewscores 1 1311692176 0 mod/scorm:skipview 1 1311692176 0 mod/scorm:savetrack 1 1311692176 0 mod/quiz:view 1 1311692167 0 mod/quiz:reviewmyattempts 1 1311692167 0 mod/quiz:attempt 1 1311692167 0 mod/lams:participate 1 1311692150 0 mod/hotpot:attempt 1 1311692147 0 mod/glossary:write 1 1311692143 0 mod/glossary:comment 1 1311692143 0 mod/forum:viewrating 1 1311692137 0 mod/forum:viewdiscussion 1 1311692137 0 mod/forum:startdiscussion 1 1311692137 0 mod/forum:replypost 1 1311692137 0 mod/forum:initialsubscriptions 1 1311692139 0 mod/forum:deleteownpost 1 1311692138 0 mod/forum:createattachment 1 1311692138 0 mod/data:writeentry 1 1311692130 0 mod/data:viewentry 1 1311692130 0 mod/choice:choose 1 1311692127 0 mod/assignment:view 1 1311692122 0 mod/assignment:submit 1 1311692122 0 mod/assess:submit 1 1311965860 2 gradereport/user:view 1 1311692221 0 gradereport/overview:view 1 1311692220 0 block/online_users:viewlist 1 1311692203 0 block/homework:view 1 1312038862 2 block/email_list:sendmessage 1 1311965874 2 block/email_list:editsettings 1 1311965874 2 block/email_list:createfolder 1 1311965874 2
2 1 Category 1 Course Fullname 101 CF101 test weeks 1 5 Teacher Teachers Student Students 0 1311735600 10 83886080 0 0 0 0 USD 0 1 0 1311696225 1311702033 0 0 0 864000 1 0 0 0
7 participants 2 course-view l 0 1 Tjs= 8 activity_modules 2 course-view l 1 1 Tjs= 9 search_forums 2 course-view l 2 1 Tjs= 10 admin 2 course-view l 3 1 Tjs= 11 course_list 2 course-view l 4 1 Tjs= 12 news_items 2 course-view r 0 1 Tjs= 13 calendar_upcoming 2 course-view r 1 1 Tjs= 14 recent_activity 2 course-view r 2 1 Tjs= 18 email_list 2 course-view r 3 1 Tjs= 27 homework 2 course-view r 4 1 Tjs= 28 groups_list 2 course-view r 5 1 Tzo2OiJvYmplY3QiOjE6e3M6MjQ6ImJsb2NrX2dyb3Vwc19saXN0X2Zvb3RlciI7czoxMDM6IjxzdHJvbmc+PGZvbnQgY29sb3I9IiNmZjAwMDAiIGZhY2U9InZlcmRhbmEsYXJpYWwsaGVsdmV0aWNhLHNhbnMtc2VyaWYiPlNvbWUgZHVtbXkgdGV4dDwvZm9udD48L3N0cm9uZz4iO30= 29 calendar_month 2 course-view r 6 1 Tjs=
1 0 $@NULL@$ 1
2 1 1 4 basiclti 2 1313173537 0 0 1 0 0 0
3 2 1
4 3 1
5 4 1
6 5 1
7 6 1
8 7 1
9 8 1
10 9 1
11 10 1
1 agroup a 0 0 1311696376 1312545299 2 bgroup b 0 0 1311696386 1312545319 3 cgroup c 0 0 1311696395 1311696404 5 egroup 0 0 1312547386 1312547508 6 fgroup 0 0 1312547420 1312547528 7 kgroup 0 0 1312547435 1312547546 8 ggroup g 0 0 1312838855 1312838870 1 $@NULL@$ ? 11 0 0 1 0 0 1313083852 1313083852 1 $@NULL@$ $@NULL@$ course $@NULL@$ 1 $@NULL@$ $@NULL@$ $@NULL@$ $@NULL@$ 1 100.00000 0.00000 $@NULL@$ $@NULL@$ 0.00000 1.00000 0.00000 0.00000 0 $@NULL@$ 0 0 0 0 1313083852 1313083852 2 Yeah2 dddd 1 1313173537 1 http://www.imsglobal.org/developers/BLTI/tool.php 1024 1 1 0 0 $@NULL@$ 0 100 4e457021202cb7.92784742 1313173537 $@NULL@$ lmsng.school.edu University of School (LMSng) 0 1 0 0
PK\&sheets/course_modules_mod_basiclti.xmlnu[ [#mod_instance#] basiclti [#mod_basiclti_name#] [#mod_basiclti_intro#] 1 [#mod_basiclti_timec#] [#mod_basiclti_timem#] 0 [#mod_basiclti_toolurl#] 0 0 0 0 0 $@NULL@$ 0 0 100 $@NULL@$ $@NULL@$ $@NULL@$ [#mod_basiclti_orgid#] [#mod_basiclti_orgurl#] [#mod_basiclti_orgdesc#] 0 0 0 0 PK\;#sheets/course_modules_mod_forum.xmlnu[ [#mod_instance#] forum general [#mod_forum_title#] [#mod_forum_intro#] 0 0 0 0 1 1 1 0 0 [#date_now#] 0 0 0 PK\w*;Gsheets/course_question_categories_question_category_question_answer.xmlnu[ [#answer_id#] [#answer_text#] [#answer_score#] [#answer_feedback#] PK\C)@sheets/course_header.xmlnu[ 1 1 Category 1 [#course_name#] [#course_short_name#] [#course_description#] topics 1 5 Teacher Teachers Student Students 0 [#date_now#] [#section_count#] 268435456 0 0 0 0 0 USD 0 1 0 [#date_now#] [#date_now#] 0 0 0 864000 1 0 0 0 PK\ 0 [#answer_string#] [#is_single#] 0 abc [#node_course_question_categories_question_category_question_answer#] PK\[dTTsheets/base.xmlnu[ [#zip_filename#] 2007101540 1.9.4 (Build: 20090128) 2008030301 1.9.3 1244044665 [#www_root#] e9e0cd91fb39442e3baef853f645b2a3 internal
[#node_info_details_mod#] false none false false true false false false false instances
[#node_course_header#]
[#node_course_blocks_block#] [#node_course_sections_section#] [#node_course_question_categories#] [#node_course_modules#]
PK\  "sheets/course_sections_section.xmlnu[
[#section_id#] [#section_number#] [#section_summary#] 1 [#node_course_sections_section_mods_mod#]
PK\AncJ@sheets/course_question_categories_question_category_question.xmlnu[ [#question_id#] 0 [#question_title#] [#question_text#] 1 [#question_general_feedback#] [#question_defaultgrade#] 0 [#question_type#] 1 [#question_stamp#] [#question_version#] 0 [#date_now#] [#date_now#] [#logged_user#] [#logged_user#] [#question_type_nodes#] PK\{:Fsheets/course_question_categories_question_category_question_eesay.xmlnu[ [#node_course_question_categories_question_category_question_answer#] PK\_Lsheets/course_question_categories_question_category_question_shortanswer.xmlnu[ [#answers_string#] [#use_case#] [#node_course_question_categories_question_category_question_answer#] PK\>?#sheets/course_modules_mod_label.xmlnu[ [#mod_instance#] label [#mod_name#] [#mod_content#] [#date_now#] PK\\+sheets/course_modules_mod_quiz_feedback.xmlnu[ 1 1 0 11 PK\Zs|qq%sheets/course_question_categories.xmlnu[ [#node_course_question_categories_question_category#] PK\a(&sheets/course_modules_mod_resource.xmlnu[ [#mod_instance#] resource [#mod_name#] [#mod_type#] [#mod_reference#] [#mod_summary#] [#mod_alltext#] [#mod_options#] [#date_now#] PK\0))Ksheets/course_question_categories_question_category_question_true_false.xmlnu[ [#true_answer_id#] [#false_answer_id#] [#node_course_question_categories_question_category_question_answer#] PK\0?+$sheets/info_details_mod_instance.xmlnu[ [#mod_instance_id#] [#mod_name#] true false PK\BAA+sheets/course_sections_section_mods_mod.xmlnu[ [#mod_id#] [#mod_type#] [#mod_instance_id#] [#date_now#] 0 [#mod_indent#] [#mod_visible#] 0 0 0 PK\ 7sheets/course_question_categories_question_category.xmlnu[ [#quiz_id#] Quiz Bank '[#quiz_name#]' Questions in quiz '[#quiz_name#]'. course [#quiz_stamp#] 0 999 [#node_course_question_categories_question_category_questions#] PK\;q sheets/course_blocks_block.xmlnu[ [#block_id#] [#block_name#] 2 course-view [#block_position#] [#block_weight#] 1 Tjs= PK\4v"sheets/course_modules_mod_quiz.xmlnu[ [#mod_id#] quiz [#mod_name#] [#mod_intro#] 0 0 1 0 [#mod_max_attempts#] 0 1 0 0 30 0 0 [#question_string#] 4 10 [#date_now#] [#date_now#] [#mod_timelimit#] 0 0 0 [#node_question_instance#] [#node_questions_feedback#] PK\!4sheets/course_modules_mod_quiz_question_instance.xmlnu[ [#instance_id#] [#question_id#] 1 PK\FIҪҪentity.quiz.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc_quiz extends entities { public function generate_node_question_categories() { $instances = $this->generate_instances(); $node_course_question_categories = $this->create_node_course_question_categories($instances); $node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories; return $node_course_question_categories; } public function generate_node_course_modules_mod() { cc2moodle::log_action('Creating Quiz mods'); $node_course_modules_mod = ''; $instances = $this->generate_instances(); if (!empty($instances)) { foreach ($instances as $instance) { if ($instance['is_question_bank'] == 0) { $node_course_modules_mod .= $this->create_node_course_modules_mod($instance); } } } return $node_course_modules_mod; } private function create_node_course_modules_mod_quiz_feedback() { $sheet_question_mod_feedback = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_FEEDBACK); return $sheet_question_mod_feedback; } private function generate_instances() { $last_instance_id = 0; $last_question_id = 0; $last_answer_id = 0; $instances = array(); $types = array(MOODLE_TYPE_QUIZ, MOODLE_TYPE_QUESTION_BANK); foreach ($types as $type) { if (!empty(cc2moodle::$instances['instances'][$type])) { foreach (cc2moodle::$instances['instances'][$type] as $instance) { if ($type == MOODLE_TYPE_QUIZ) { $is_question_bank = 0; } else { $is_question_bank = 1; } $assessment_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($assessment_file)) { $assessment = $this->load_xml_resource( cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $assessment_file ); if (!empty($assessment)) { $replace_values = array('unlimited' => 0); $questions = $this->get_questions( $assessment, $last_question_id, $last_answer_id, dirname($assessment_file), $is_question_bank ); $question_count = count($questions); if (!empty($question_count)) { $last_instance_id++; $instances[$instance['resource_indentifier']]['questions'] = $questions; $instances[$instance['resource_indentifier']]['id'] = $last_instance_id; $instances[$instance['resource_indentifier']]['title'] = $instance['title']; $instances[$instance['resource_indentifier']]['is_question_bank'] = $is_question_bank; $instances[$instance['resource_indentifier']]['options']['timelimit'] = $this->get_global_config($assessment, 'qmd_timelimit', 0); $instances[$instance['resource_indentifier']]['options']['max_attempts'] = $this->get_global_config($assessment, 'cc_maxattempts', 0, $replace_values); } } } } } } return $instances; } private function create_node_course_modules_mod($instance) { $sheet_question_mod = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ); $node_course_modules_quiz_question_instances = $this->create_node_course_modules_mod_quiz_question_instances($instance); $node_course_modules_quiz_feedback = $this->create_node_course_modules_mod_quiz_feedback($instance); $questions_strings = $this->get_questions_string($instance); $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $find_tags = array('[#mod_id#]', '[#mod_name#]', '[#mod_intro#]', '[#mod_stamp#]', '[#question_string#]', '[#date_now#]', '[#mod_max_attempts#]', '[#mod_timelimit#]', '[#node_question_instance#]', '[#node_questions_feedback#]'); $replace_values = array($instance['id'], self::safexml($instance['title']), self::safexml($instance['title']), self::safexml($quiz_stamp), self::safexml($questions_strings), time(), $instance['options']['max_attempts'], $instance['options']['timelimit'], $node_course_modules_quiz_question_instances, $node_course_modules_quiz_feedback); // This one has tags. $node_question_mod = str_replace($find_tags, $replace_values, $sheet_question_mod); return $node_question_mod; } private function get_global_config($assessment, $option, $default_value, $replace_values = '') { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $metadata = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:qtimetadata/xmlns:qtimetadatafield'); foreach ($metadata as $field) { $field_label = $xpath->query('xmlns:fieldlabel', $field); $field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : ''; if (strtolower($field_label) == strtolower($option)) { $field_entry = $xpath->query('xmlns:fieldentry', $field); $response = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : ''; } } $response = !empty($response) ? trim($response) : ''; if (!empty($replace_values)) { foreach ($replace_values as $key => $value) { $response = ($key == $response) ? $value : $response; } } $response = empty($response) ? $default_value : $response; return $response; } private function create_node_course_modules_mod_quiz_question_instances($instance) { $node_course_module_mod_quiz_questions_instances = ''; $sheet_question_mod_instance = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_QUESTION_INSTANCE); $find_tags = array('[#question_id#]' , '[#instance_id#]'); if (!empty($instance['questions'])) { foreach ($instance['questions'] as $question) { $replace_values = array($question['id'] , $question['id']); $node_course_module_mod_quiz_questions_instances .= str_replace( $find_tags, $replace_values, $sheet_question_mod_instance ); } $node_course_module_mod_quiz_questions_instances = str_replace( $find_tags, $replace_values, $node_course_module_mod_quiz_questions_instances ); } return $node_course_module_mod_quiz_questions_instances; } private function get_questions_string($instance) { $questions_string = ''; if (!empty($instance['questions'])) { foreach ($instance['questions'] as $question) { $questions_string .= $question['id'] . ','; } } $questions_string = !empty($questions_string) ? substr($questions_string, 0, strlen($questions_string) - 1) : ''; return $questions_string; } private function create_node_course_question_categories($instances) { $sheet_question_categories = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES); if (!empty($instances)) { $node_course_question_categories_question_category = ''; foreach ($instances as $instance) { $node_course_question_categories_question_category .= $this->create_node_course_question_categories_question_category($instance); } $find_tags = array('[#node_course_question_categories_question_category#]'); $replace_values = array($node_course_question_categories_question_category); $node_course_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories); } $node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories; return $node_course_question_categories; } private function create_node_course_question_categories_question_category($instance) { $sheet_question_categories_quetion_category = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY); $find_tags = array('[#quiz_id#]', '[#quiz_name#]', '[#quiz_stamp#]', '[#node_course_question_categories_question_category_questions#]'); $node_course_question_categories_questions = $this->create_node_course_question_categories_question_category_question($instance); $node_course_question_categories_questions = empty($node_course_question_categories_questions) ? '' : $node_course_question_categories_questions; $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $replace_values = array($instance['id'], self::safexml($instance['title']), $quiz_stamp, $node_course_question_categories_questions); $node_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories_quetion_category); return $node_question_categories; } private function create_node_course_question_categories_question_category_question($instance) { global $USER; $node_course_question_categories_question = ''; $find_tags = array('[#question_id#]', '[#question_title#]', '[#question_text#]', '[#question_type#]', '[#question_general_feedback#]', '[#question_defaultgrade#]', '[#date_now#]', '[#question_type_nodes#]', '[#question_stamp#]', '[#question_version#]', '[#logged_user#]'); $sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION); $questions = $instance['questions']; if (!empty($questions)) { foreach ($questions as $question) { $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $quiz_version = 'localhost+' . time() . '+' . $this->generate_random_string(6); $question_moodle_type = $question['moodle_type']; $question_cc_type = $question['cc_type']; $question_type_node = ''; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_MULTIPLE_CHOICE) ? $this->create_node_course_question_categories_question_category_question_multiple_choice($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_TRUE_FALSE) ? $this->create_node_course_question_categories_question_category_question_true_false($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_ESSAY) ? $this->create_node_course_question_categories_question_category_question_eesay($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_SHORTANSWER) ? $this->create_node_course_question_categories_question_category_question_shortanswer($question) : $question_type_node; $replace_values = array($question['id'], self::safexml($this->truncate_text($question['title'], 255, true)), self::safexml($question['title']), $question_moodle_type, self::safexml($question['feedback']), $question['defaultgrade'], //default grade time(), $question_type_node, $quiz_stamp, $quiz_version, $USER->id); $node_course_question_categories_question .= str_replace($find_tags, $replace_values, $sheet_question_categories_question); } } $node_course_question_categories_question = empty($node_course_question_categories_question) ? '' : $node_course_question_categories_question; return $node_course_question_categories_question; } private function get_questions($assessment, &$last_question_id, &$last_answer_id, $root_path, $is_question_bank) { $questions = array(); $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); if (!$is_question_bank) { $questions_items = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:section/xmlns:item'); } else { $questions_items = $xpath->query('/xmlns:questestinterop/xmlns:objectbank/xmlns:item'); } foreach ($questions_items as $question_item) { $count_questions = $xpath->evaluate('count(xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext)', $question_item); if ($count_questions == 0) { $question_title = $xpath->query('xmlns:presentation/xmlns:material/xmlns:mattext', $question_item); } else { $question_title = $xpath->query('xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext', $question_item); } $question_title = !empty($question_title->item(0)->nodeValue) ? $question_title->item(0)->nodeValue : ''; $question_identifier = $xpath->query('@ident', $question_item); $question_identifier = !empty($question_identifier->item(0)->nodeValue) ? $question_identifier->item(0)->nodeValue : ''; if (!empty($question_identifier)) { $question_type = $this->get_question_type($question_identifier, $assessment); if (!empty($question_type['moodle'])) { $last_question_id++; $questions[$question_identifier]['id'] = $last_question_id; $question_title = $this->update_sources($question_title, $root_path); $question_title = !empty($question_title) ? str_replace("%24", "\$", $this->include_titles($question_title)) : ''; $questions[$question_identifier]['title'] = $question_title; $questions[$question_identifier]['identifier'] = $question_identifier; $questions[$question_identifier]['moodle_type'] = $question_type['moodle']; $questions[$question_identifier]['cc_type'] = $question_type['cc']; $questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier); $questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier); $questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id); } } } $questions = !empty($questions) ? $questions : ''; return $questions; } private function str_replace_once($search, $replace, $subject) { $first_char = strpos($subject, $search); if ($first_char !== false) { $before_str = substr($subject, 0, $first_char); $after_str = substr($subject, $first_char + strlen($search)); return $before_str . $replace . $after_str; } else { return $subject; } } private function get_defaultgrade($assessment, $question_identifier) { $result = 1; $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $query = '//xmlns:item[@ident="' . $question_identifier . '"]'; $query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry'; $defgrade = $xpath->query($query); if (!empty($defgrade) && ($defgrade->length > 0)) { $resp = (int)$defgrade->item(0)->nodeValue; if ($resp >= 0 && $resp <= 99) { $result = $resp; } } return $result; } private function get_general_feedback($assessment, $question_identifier) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $respconditions = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($respconditions)) { foreach ($respconditions as $respcondition) { $continue = $respcondition->getAttributeNode('continue'); $continue = !empty($continue->nodeValue) ? strtolower($continue->nodeValue) : ''; if ($continue == 'yes') { $display_feedback = $xpath->query('xmlns:displayfeedback', $respcondition); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } return $feedback; } private function get_feedback($assessment, $identifier, $item_identifier, $question_type) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $resource_processing = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($resource_processing)) { foreach ($resource_processing as $response) { $varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response); $varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : ''; if (strtolower($varequal) == strtolower($identifier) || ($question_type == CC_QUIZ_ESSAY)) { $display_feedback = $xpath->query('xmlns:displayfeedback', $response); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } return $feedback; } private function get_answers_fib($question_identifier, $identifier, $assessment, &$last_answer_id) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $answers_fib = array(); $response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); foreach ($response_items as $response_item) { $setvar = $xpath->query('xmlns:setvar', $response_item); $setvar = is_object($setvar->item(0)) ? $setvar->item(0)->nodeValue : ''; if ($setvar != '') { $last_answer_id++; $answer_title = $xpath->query('xmlns:conditionvar/xmlns:varequal[@respident="' . $identifier . '"]', $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : ''; $case = $xpath->query('xmlns:conditionvar/xmlns:varequal/@case', $response_item); $case = is_object($case->item(0)) ? $case->item(0)->nodeValue : 'no' ; $case = strtolower($case) == 'yes' ? 1 : 0; $display_feedback = $xpath->query('xmlns:displayfeedback', $response_item); unset($feedbacks_identifiers); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } $answers_fib[] = array('id' => $last_answer_id, 'title' => $answer_title, 'score' => $setvar, 'feedback' => $feedback, 'case' => $case); } } $answers_fib = empty($answers_fib) ? '' : $answers_fib; return $answers_fib; } private function get_answers_pattern_match($question_identifier, $identifier, $assessment, &$last_answer_id) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $answers_fib = array(); $response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); foreach ($response_items as $response_item) { $setvar = $xpath->query('xmlns:setvar', $response_item); $setvar = is_object($setvar->item(0)) ? $setvar->item(0)->nodeValue : ''; if ($setvar != '') { $last_answer_id++; $answer_title = $xpath->query('xmlns:conditionvar/xmlns:varequal[@respident="' . $identifier . '"]', $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : ''; if (empty($answer_title)) { $answer_title = $xpath->query('xmlns:conditionvar/xmlns:varsubstring[@respident="' . $identifier . '"]', $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? '*' . $answer_title->item(0)->nodeValue . '*' : ''; } if (empty($answer_title)) { $answer_title = '*'; } $case = $xpath->query('xmlns:conditionvar/xmlns:varequal/@case', $response_item); $case = is_object($case->item(0)) ? $case->item(0)->nodeValue : 'no' ; $case = strtolower($case) == 'yes' ? 1 : 0; $display_feedback = $xpath->query('xmlns:displayfeedback', $response_item); unset($feedbacks_identifiers); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } $answers_fib[] = array('id' => $last_answer_id, 'title' => $answer_title, 'score' => $setvar, 'feedback' => $feedback, 'case' => $case); } } $answers_fib = empty($answers_fib) ? '' : $answers_fib; return $answers_fib; } private function get_answers($identifier, $assessment, &$last_answer_id) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $answers = array(); $question_cc_type = $this->get_question_type($identifier, $assessment); $question_cc_type = $question_cc_type['cc']; $is_multiresponse = ($question_cc_type == CC_QUIZ_MULTIPLE_RESPONSE); if ($question_cc_type == CC_QUIZ_MULTIPLE_CHOICE || $is_multiresponse || $question_cc_type == CC_QUIZ_TRUE_FALSE) { $query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_lid/xmlns:render_choice/xmlns:response_label'; $query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_lid/xmlns:render_choice/xmlns:response_label'; $query_indentifer = '@ident'; $query_title = 'xmlns:material/xmlns:mattext'; } if ($question_cc_type == CC_QUIZ_ESSAY) { $query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str'; $query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str'; $query_indentifer = '@ident'; $query_title = 'xmlns:render_fib'; } if ($question_cc_type == CC_QUIZ_FIB || $question_cc_type == CC_QUIZ_PATTERN_MACHT) { $xpath_query = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str/@ident'; $xpath_query_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str/@ident'; $count_response = $xpath->evaluate('count(' . $xpath_query_with_flow . ')'); if ($count_response == 0) { $answer_identifier = $xpath->query($xpath_query); } else { $answer_identifier = $xpath->query($xpath_query_with_flow); } $answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : ''; if ($question_cc_type == CC_QUIZ_FIB) { $answers = $this->get_answers_fib ($identifier, $answer_identifier, $assessment, $last_answer_id); } else { $answers = $this->get_answers_pattern_match ($identifier, $answer_identifier, $assessment, $last_answer_id); } } else { $count_response = $xpath->evaluate('count(' . $query_answers_with_flow . ')'); if ($count_response == 0) { $response_items = $xpath->query($query_answers); } else { $response_items = $xpath->query($query_answers_with_flow); } if (!empty($response_items)) { if ($is_multiresponse) { $correct_answer_score = 0; //get the correct answers count $canswers_query = "//xmlns:item[@ident='{$identifier}']//xmlns:setvar[@varname='SCORE'][.=100]/../xmlns:conditionvar//xmlns:varequal[@case='Yes'][not(parent::xmlns:not)]"; $canswers = $xpath->query($canswers_query); if ($canswers->length > 0) { $correct_answer_score = round(1.0 / (float)$canswers->length, 7); //weird $correct_answers_ident = array(); foreach ($canswers as $cnode) { $correct_answers_ident[$cnode->nodeValue] = true; } } } foreach ($response_items as $response_item) { $last_answer_id++; $answer_identifier = $xpath->query($query_indentifer, $response_item); $answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : ''; $answer_title = $xpath->query($query_title, $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : ''; $answer_feedback = $this->get_feedback($assessment, $answer_identifier, $identifier, $question_cc_type); $answer_score = $this->get_score($assessment, $answer_identifier, $identifier); if ($is_multiresponse && isset($correct_answers_ident[$answer_identifier])) { $answer_score = $correct_answer_score; } $answers[] = array('id' => $last_answer_id, 'title' => $answer_title, 'score' => $answer_score, 'identifier' => $answer_identifier, 'feedback' => $answer_feedback); } } } $answers = empty($answers) ? '' : $answers; return $answers; } private function get_score($assessment, $identifier, $question_identifier) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $resource_processing = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($resource_processing)) { foreach ($resource_processing as $response) { $question_cc_type = $this->get_question_type($question_identifier, $assessment); $question_cc_type = $question_cc_type['cc']; $varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response); $varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : ''; if (strtolower($varequal) == strtolower($identifier)) { $score = $xpath->query('xmlns:setvar', $response); $score = !empty($score->item(0)->nodeValue) ? $score->item(0)->nodeValue : ''; } } } $score = empty($score) ? 0 : sprintf("%.7F", $score); return $score; } private function create_node_course_question_categories_question_category_question_multiple_choice($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_MULTIPLE_CHOICE); if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $answer_string = $this->get_answers_string($question['answers']); $is_single = ($question['cc_type'] == CC_QUIZ_MULTIPLE_CHOICE) ? 1 : 0; $find_tags = array('[#node_course_question_categories_question_category_question_answer#]', '[#answer_string#]', '[#is_single#]'); $replace_values = array($node_course_question_categories_question_answer, self::safexml($answer_string), $is_single); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_eesay($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_EESAY); if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $find_tags = array('[#node_course_question_categories_question_category_question_answer#]'); $replace_values = array($node_course_question_categories_question_answer); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_shortanswer($question) { //, &$fib_questions) { $sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_SHORTANSWER); $node_course_question_categories_question_answer = ''; if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $answers_string = $this->get_answers_string($question['answers']); $use_case = 0; foreach ($question['answers'] as $answer) { if ($answer['case'] == 1) { $use_case = 1; } } $find_tags = array('[#answers_string#]', '[#use_case#]', '[#node_course_question_categories_question_category_question_answer#]'); $replace_values = array(self::safexml($answers_string), self::safexml($use_case), $node_course_question_categories_question_answer); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_true_false($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_TRUE_FALSE); $trueanswer = null; $falseanswer = null; if (!empty($question['answers'])) { // Identify the true and false answers. foreach ($question['answers'] as $answer) { if ($answer['identifier'] == 'true') { $trueanswer = $answer; } else if ($answer['identifier'] == 'false') { $falseanswer = $answer; } else { // Should not happen, but just in case. throw new coding_exception("Unknown answer identifier detected" . " in true/false quiz question with id {$question['id']}."); } $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } // Make sure the true and false answer was found. if (is_null($trueanswer) || is_null($falseanswer)) { throw new coding_exception("Unable to correctly identify the " . "true and false answers in the question with id {$question['id']}."); } } $find_tags = array('[#node_course_question_categories_question_category_question_answer#]', '[#true_answer_id#]', '[#false_answer_id#]'); $replace_values = array($node_course_question_categories_question_answer, $trueanswer['id'], $falseanswer['id']); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function get_answers_string($answers) { $answer_string = ''; if (!empty($answers)) { foreach ($answers as $answer) { $answer_string .= $answer['id'] . ','; } } $answer_string = !empty($answer_string) ? substr($answer_string, 0, strlen($answer_string) - 1) : ''; return $answer_string; } private function create_node_course_question_categories_question_category_question_answer($answer) { $sheet_question_categories_question_answer = cc2moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_ANSWER); $find_tags = array('[#answer_id#]', '[#answer_text#]', '[#answer_score#]', '[#answer_feedback#]'); $replace_values = array($answer['id'], self::safexml($answer['title']), $answer['score'], self::safexml($answer['feedback'])); $node_question_categories_question_answer = str_replace($find_tags, $replace_values, $sheet_question_categories_question_answer); return $node_question_categories_question_answer; } private function get_question_type($identifier, $assessment) { $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $metadata = $xpath->query('//xmlns:item[@ident="' . $identifier . '"]/xmlns:itemmetadata/xmlns:qtimetadata/xmlns:qtimetadatafield'); foreach ($metadata as $field) { $field_label = $xpath->query('xmlns:fieldlabel', $field); $field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : ''; if ($field_label == 'cc_profile') { $field_entry = $xpath->query('xmlns:fieldentry', $field); $type = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : ''; } } $return_type = array(); $return_type['moodle'] = ''; $return_type['cc'] = $type; if ($type == CC_QUIZ_MULTIPLE_CHOICE) { $return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE; } if ($type == CC_QUIZ_MULTIPLE_RESPONSE) { $return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE; } if ($type == CC_QUIZ_TRUE_FALSE) { $return_type['moodle'] = MOODLE_QUIZ_TRUE_FALSE; } if ($type == CC_QUIZ_ESSAY) { $return_type['moodle'] = MOODLE_QUIZ_ESSAY; } if ($type == CC_QUIZ_FIB) { $return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER; } if ($type == CC_QUIZ_PATTERN_MACHT) { $return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER; } return $return_type; } } PK\Fo o cc_includes.phpnu[. /** * Main include for IMS Common Cartridge export classes * * @package backup-convert * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once($CFG->dirroot .'/backup/cc/cc_lib/xmlbase.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_resources.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_builder_creator.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_manifest.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_metadata.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_metadata_resource.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_metadata_file.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_version11.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/gral_lib/pathutils.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/gral_lib/functions.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_organization.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_basiclti.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_lti.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_forum.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_url.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_resource.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_quiz.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_page.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_label.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_converter_folder.php'); require_once($CFG->dirroot .'/backup/cc/cc_lib/cc_convert_moodle2.php'); PK\Ch֙ppentity11.basiclti.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc11_basiclti extends entities11 { public function generate_node() { cc2moodle::log_action('Creating BasicLTI mods'); $response = ''; if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_BASICLTI])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_BASICLTI] as $instance) { $response .= $this->create_node_course_modules_mod_basiclti($instance); } } return $response; } private function create_node_course_modules_mod_basiclti($instance) { $sheet_mod_basiclti = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_BASICLTI); $topic_data = $this->get_basiclti_data($instance); $result = ''; if (!empty($topic_data)) { $find_tags = array('[#mod_instance#]' , '[#mod_basiclti_name#]' , '[#mod_basiclti_intro#]' , '[#mod_basiclti_timec#]' , '[#mod_basiclti_timem#]' , '[#mod_basiclti_toolurl#]', '[#mod_basiclti_orgid#]' , '[#mod_basiclti_orgurl#]' , '[#mod_basiclti_orgdesc#]' ); $replace_values = array($instance['instance'], $topic_data['title'], $topic_data['description'], time(),time(), $topic_data['launchurl'], $topic_data['orgid'], $topic_data['orgurl'], $topic_data['orgdesc'] ); $result = str_replace($find_tags, $replace_values, $sheet_mod_basiclti); } return $result; } protected function getValue($node, $default = '') { $result = $default; if (is_object($node) && ($node->length > 0) && !empty($node->item(0)->nodeValue)) { $result = htmlspecialchars(trim($node->item(0)->nodeValue), ENT_COMPAT, 'UTF-8', false); } return $result; } public function get_basiclti_data($instance) { $topic_data = array(); $basiclti_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($basiclti_file)) { $basiclti_file_path = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $basiclti_file; $basiclti_file_dir = dirname($basiclti_file_path); $basiclti = $this->load_xml_resource($basiclti_file_path); if (!empty($basiclti)) { $xpath = cc2moodle::newx_path($basiclti, cc112moodle::$basicltins); $topic_title = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:title'),'Untitled'); $blti_description = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:description')); $launch_url = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:launch_url')); $tool_raw = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:code'),null); $tool_url = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:url'),null); $tool_desc = $this->getValue($xpath->query('/xmlns:cartridge_basiclti_link/blti:vendor/lticp:description'),null); $topic_data['title' ] = $topic_title; $topic_data['description'] = $blti_description; $topic_data['launchurl' ] = $launch_url; $topic_data['orgid' ] = $tool_raw; $topic_data['orgurl' ] = $tool_url; $topic_data['orgdesc' ] = $tool_desc; } } return $topic_data; } } PK\; U2U2schemas11/imslticm_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Chuck Severance (IMS GLC) and Colin Smythe (IMS GLC) Date: 30th April, 2010 Version: 1.0 Status: Final Release Description: This is the description of the Common Messaging objects in LTI. This version was created for the BasicLTI Final release. History: V1.0 - First final release. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Basic Learning Tools Interoperability Version 1.0 found at http://www.imsglobal.org/lti and the original IMS GLC schema binding or code base http://www.imsglobal.org/lti. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2010. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. The PropertySet complexType is the container for the set of properties. The Platform complexType is the container for the set of properties for the platform. The Property complexType is the container for each property. PK\C=CC%schemas11/ccv1p1_lomresource_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st January, 2011 Version: 1.1 Status: Final Description: This is the IMS GLC Meta-data v1.3 binding of the IEEE LOMv1.0 for the Common Cartridge v1.1 Resource Metadata. This is based on the LOM strict binding. The core changes are: a) General complexType removed; b) LifeCycle complexType removed; c) Metametadata complexType removed; d) Technical complexType removed; e) Rights complexType removed; f) Annotation complexType removed; g) Classification complexType removed; h) The educational element is required at least once in the metadata instance; i) For Educational the context is required once and intendedEndUserRole at least once; j) All order is now imposed using sequence; k) All vocabs are constrained as required for the context and intendedEndUserRole elements. History: Version 1.0 - the first release of this profile for the CC Resource metadata; Version 1.1 - the 'mentor' enumeration value is added and the 'school' enumeration value are added License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2011 (c) IMS Global Learning Consortium Inc. All Rights Reserved. The Context complexType is the container for the information about the principal environment within which the learning and use of this learning object is intended to take place. Suggested good practice is to use one of the values of the value space and to use an additional instance of this data element for further refinement. The Educational complexType is the container for the information that describes the key educational or pedagogic characteristics of this learning object. This is pedagogical informtion essential to those involved in achieving a quality learning experience. The audience for this metadata includes teachers, managers, authors and learners. CC Resource Profile: Only single context and intendedUserRole elements are permitted. The IntendedEndUserRole complexType is the container for the information about the principal user(s) for which this learning object was designed, most dominant first. For Strict LOM binding this has an enumerated vocabulary. The Classification element can be used to describe the role through the skills the user is intended to master, or the tasks he or she is intended to be able to accomplish. CC Resource Profile: Only the 'Instructor', 'Mentor' and 'Learner' vocab values are permitted. The LangString complexType is the container for a group of language specific characterstrings. The LOM complexType is the container for the metadata instance. CC Resource Profile - only a single Educational element is permitted. PK\%schemas11/ccv1p1_lommanifest_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st January, 2011 Version: 1.1 Status: Final Description: This is the IMS GLC Meta-data v1.3 binding of the IEEE LOMv1.0 for the Common Cartridge v1.1 Manifest Metadata. This is based on the LOM Strict bindings. The core changes are: a) MetaMetadata complexType is removed; b) Annotation complexType is removed; c) In the Technical complexType only the format element is permitted; d) In the Educational complexType only the 'learningResourceType' element and 'intendedEndUserRole' are permitted; e) In the General complexType the 'structure' and 'aggregationLevel' elements are prohibited; f) Only the 'contribute' element in the 'LifeCycle' complexType are permitted; History: Version 1.1: The first usage of this XSD for the CC Manifest Profile. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2011 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Schematron Strict Selection Validation Rules -------------------------------------------- This is the set of Schematron rules that have been created to enforce the use of the "Unordered" stereotype. These rules ensure that the number of entries in an unordered complexType of an element obey the multiplicity constraints. This is required so that any-order/any-multiplicity complexTypes can be constructed and validated. Schematron validation rules for the enforcement of the Unordered stereotype. [RULESET] For the LOM.Type complexType. [RULE for Root Class Attribute 1] Invalid number of "general" elements: . [RULE for Root Class Attribute 2] Invalid number of "lifeCycle" elements: . [RULE for Root Class Attribute 3] Invalid number of "technical" elements: . [RULE for Root Class Attribute 5] Invalid number of "rights" elements: . [RULESET] For the Rights.Type complexType. [RULE for Local Attribute 1] Invalid number of "cost" elements: . [RULE for Local Attribute 2] Invalid number of "copyrightAndOtherRestrictions" elements: . [RULE for Local Attribute 3] Invalid number of "description" elements: . [RULESET] For the General.Type complexType. [RULE for Local Attribute 2] Invalid number of "title" elements: . [RULESET] For the ContributeLifeCycle.Type complexType. [RULE for Local Attribute 1] Invalid number of "role" elements: . [RULE for Local Attribute 3] Invalid number of "date" elements: . [RULESET] For the Relation.Type complexType. [RULE for Local Attribute 1] Invalid number of "kind" elements: . [RULE for Local Attribute 2] Invalid number of "resource" elements: . [RULESET] For the Resource.Type complexType. [RULESET] For the Classification.Type complexType. [RULE for Local Attribute 1] Invalid number of "purpose" elements: . [RULE for Local Attribute 3] Invalid number of "description" elements: . [RULESET] For the Taxon.Type complexType. [RULE for Local Attribute 1] Invalid number of "id" elements: . [RULE for Local Attribute 2] Invalid number of "entry" elements: . [RULESET] For the DateTime.Type complexType. [RULE for Local Attribute 1] Invalid number of "dateTime" elements: . [RULE for Local Attribute 2] Invalid number of "description" elements: . [RULESET] For the Identifier.Type complexType. [RULE for Local Attribute 1] Invalid number of "catalog" elements: . [RULE for Local Attribute 2] Invalid number of "entry" elements: . [RULE for Local Attribute 1] Invalid number of "catalog" elements: . [RULE for Local Attribute 2] Invalid number of "entry" elements: . The Classification complexType is the container for information which describes where this learning object falls within a particular classification system. To define multiple classifications, there may be multiple instances of this category. The Context complexType is the container for the information about the principal environment within which the learning and use of this learning object is intended to take place. Suggested good practice is to use one of the values of the value space and to use an additional instance of this data element for further refinement. The Contribute complexType is the container for the entities (i.e. people, organizations) that have contributed to the state of the learning object. The CopyrightAndOtherRestrictions complexType defines whether copyright or other restrictions apply to the use of this learning object. The Cost complexType is the container for whether use of this learning object requires payment. The DateTime abstract complexType is the container for the annotated date/time. An accuracy of at least one second is supported. The ISO 8601 format is used. An associated description is also provided. The Educational complexType is the container for the information that describes the key educational or pedagogic characteristics of this learning object. This is pedagogical informtion essential to those involved in achieving a quality learning experience. The audience for this metadata includes teachers, managers, authors and learners. CC MANIFEST PROFILE Only a single instance of the 'learningResourceType' and multple instances of the 'ntendedEnduserRole' are permitted. CC AMANIFEST PROFILE The 'structure' and aggregationLevel' elements are prohibited. The Identifier complexType is the container for the globally unique idenitifer that identifies the associated parent object. The IntendedEndUserRole complexType is the container for the information about the principal user(s) for which this learning object was designed, most dominant first. For Strict LOM binding this has an enumerated vocabulary. The Classification element can be used to describe the role through the skills the user is intended to master, or the tasks he or she is intended to be able to accomplish. CC Manifest Profile: Only the Iinstructor' 'Mentor' and 'Teacher' vocab values are permitted. The Kind complexType is the container for the nature of the relationship between this learning object and the target learning object, identified by information in the associated Resource complexType. In LOMv1.0 (Strict) this is an enumerated vocabulary. CC MANIFEST PROFILE Only the 'value' element is permitted. The LangString complexType is the container for a group of language specific characterstrings. The LearningResourceType complexType is the container for the information about the specific kind of learning object. The most dominant kind shall be first. The vocabulary terms are defined as in OED:1989 and as used by any educational communties of practice. CC MANIFEST PROFILE Only 'value' is permited and this is fixed as 'IMS Common Cartridge'. The LifeCycle complexType is the container for the history and current state of this learning object and those entities that have affected this learning object during its evolution. CC MANIFEST PROFILE Only the 'contribite' element is permitted. The LOM complexType is the container for the metadata instance. CC MANIFEST PROFILE The MetaMetadata and Annotation complexTypes are prohibited. The Purpose complexType is the container for the information on the purpose of classifying this learning obect. For the Strict LOM binding this is an enumerated vocabulary. The Relation complexType is the container for the information that defines the relationship between this learning object and other learning objects, if any. To define multiple relationships, there may be multiple instances of this category. If there is more than one target learning object the each object shall have a new relationship instance. The Resource complexType is the container for the information about the target learning object that this relationship references. The Rights complexType describes the intellectual property rights and conditions of use for this learning object. NOTE: The intent is to reuse results of ongoing work in the Intellectual Property Rights and e-commerce communities. This category currently provides the absolute minimum level of detail only. The Role complexType is the container for the kind of contribution. CC MANIFEST PROFILE Only the 'value' elemet is permitted. The Taxon complexType is the container for the information about a particular term within a taxonomy. A taxon is a node that has a defined label or term. A taxon may also have an alphanumeric designation or identifier for standardized reference. Either or both the label and the entry may be used to designate a particular taxon. An ordered list of taxons creates a taxonomic path i.e. 'taxononomic stairway': this is a path from a more general to more specific entry in a classification. The TaxonPath complexType is the container for the information about the taxonomic path in a specific classification system. Each succeeding level is a refinement in the definition of the preceding level. There may be different paths in the same or different classifications, which describe the same characteristic. The Technical complexType is the container for the information that describes the technical requirements and characteristics of this learning object. CC MANIFEST PROFILE Only the 'format' element is permitted. PK\.uaBaBschemas11/imslticp_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Chuck Severance (IMS GLC) and Colin Smythe (IMS GLC) Date: 30th April, 2010 Version: 1.0 Status: Final Release Description: This is the set of Common Profile objects used in LTI. This XSD was created as part of the BasicLTI Final Release. History: V1.0 - the first Final Release. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Basic Learning Tools Interoperability Version 1.0 found at http://www.imsglobal.org/lti and the original IMS GLC schema binding or code base http://www.imsglobal.org/lti. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2010. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. The Vendor complexType is the container for the information about the vendor of the tool to be launched/used using BasicLTI. The Contact class is the container for the vendor contact information. The productInfo complexType is the container for the information about the tool itself. The ToolLocator complexType is the container for information about the electronic location of the tool. The Localized complexType is the container for localized string entries. The Icon complexType is the container for information about an icon to be used with the tool. PK\ /"schemas11/cc11libxml2validator.xsdnu[ PK\{``schemas11/xml.xsdnu[ See http://www.w3.org/XML/1998/namespace.html and http://www.w3.org/TR/REC-xml for information about this namespace. This schema document describes the XML namespace, in a form suitable for import by other schema documents. Note that local names in this namespace are intended to be defined only by the World Wide Web Consortium or its subgroups. The following names are currently defined in this namespace and should not be used with conflicting semantics by any Working Group, specification, or document instance: base (as an attribute name): denotes an attribute whose value provides a URI to be used as the base for interpreting any relative URIs in the scope of the element on which it appears; its value is inherited. This name is reserved by virtue of its definition in the XML Base specification. id (as an attribute name): denotes an attribute whose value should be interpreted as if declared to be of type ID. This name is reserved by virtue of its definition in the xml:id specification. lang (as an attribute name): denotes an attribute whose value is a language code for the natural language of the content of any element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. space (as an attribute name): denotes an attribute whose value is a keyword indicating what whitespace processing discipline is intended for the content of the element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. Father (in any context at all): denotes Jon Bosak, the chair of the original XML Working Group. This name is reserved by the following decision of the W3C XML Plenary and XML Coordination groups: In appreciation for his vision, leadership and dedication the W3C XML Plenary on this 10th day of February, 2000 reserves for Jon Bosak in perpetuity the XML name xml:Father This schema defines attributes and an attribute group suitable for use by schemas wishing to allow xml:base, xml:lang, xml:space or xml:id attributes on elements they define. To enable this, such a schema must import this schema for the XML namespace, e.g. as follows: <schema . . .> . . . <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> Subsequently, qualified reference to any of the attributes or the group defined below will have the desired effect, e.g. <type . . .> . . . <attributeGroup ref="xml:specialAttrs"/> will define a type which will schema-validate an instance element with any of those attributes In keeping with the XML Schema WG's standard versioning policy, this schema document will persist at http://www.w3.org/2007/08/xml.xsd. At the date of issue it can also be found at http://www.w3.org/2001/xml.xsd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XML Schema itself, or with the XML namespace itself. In other words, if the XML Schema or XML namespaces change, the version of this document at http://www.w3.org/2001/xml.xsd will change accordingly; the version at http://www.w3.org/2007/08/xml.xsd will not change. Attempting to install the relevant ISO 2- and 3-letter codes as the enumerated possible values is probably never going to be a realistic possibility. See RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry at http://www.iana.org/assignments/lang-tag-apps.htm for further information. The union allows for the 'un-declaration' of xml:lang with the empty string. See http://www.w3.org/TR/xmlbase/ for information about this attribute. See http://www.w3.org/TR/xml-id/ for information about this attribute. PK\w4h3h3 schemas11/imsbasiclti_v1p0p1.xsdnu[ XSD Data File Information ------------------------- Author: Chuck Severance (IMS GLC) and Colin Smythe (IMS GLC) Date: 9th June, 2010 Version: 1.0.1 Status: Final Release Description: This is the description of the basicLTI link description. History: V1.0 - the first final release. V1.0.1 - the multiplicity for the extensions attribute has been changed from 0..1 to 0..*. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Basic Learning Tools Interoperability Version 1.0 found at http://www.imsglobal.org/lti and the original IMS GLC schema binding or code base http://www.imsglobal.org/lti. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2010. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. The BasicLTILink class is the container for information required to use the BasicLTI mechanism. PK\Ee$schemas11/ccv1p1_imscp_v1p2_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st January, 2011 Version: 1.1 Status: Final Release Description: This model forms a part of the IMS GLC Common Catrtridge specification. This model is the profile of the IMS GLC Content Package Core specification (v1.2). The changes made to create the profile are: (a) The 'default' characteristic for the 'Organizations' class has been removed; (b) The 'isvisible' characteristic for the Item class has been removed; (c) The 'parameters' characteristic for the Item class has been removed; (d) The 'structure' characteristic for the Organization class has been fixed to 'rooted-hierarchy'; (e) The 'extension' and 'version' characteristics for the Manifest class have been removed; (f) The 'extension' attribute and 'extension' characteristic have been removed the Organizations class; (g) The 'extension' attribute and 'extension' characteristic have been removed the Organization class; (h) The 'extension' attribute and 'extension' characteristic have been removed from the Resources class; (i) The 'extension' attribute and the 'extension' characteristic have been removed from the Resource class; (j) The 'extension' attribute and 'extension' characteristic have been removed from the Item class; (k) The 'extension' attribute and the 'extension' characteristic have been removed from the File class; (l) The 'extension' attribute and 'extension' characteristic have been removed from the Dependency class; (m) The 'type' characteristic of the Resource class has a new enumerated list of 'PredfinedContentTypes'; (n) The 'title' attribute for the Item class has its multiplicity changed to '1' except for the top-level item attribute in the Orgaization class where it must not occur; (o) Manifests are NO longer allowed to contain sub-manifests; (p) The multiplicity of the Organization class in the Organizations class has been made '0..1'; (q) Only the metadata in the Manifest class is permitted to have the 'schema' and 'schemaversion' attributes; (r) The 'schema', 'schemaversion' and 'title' attributes are redefined directly as 'String' primitiveTypes; (s) The multiplicity of the 'item' attribute in the Organization class has been made '1'; (t) The value for the 'schema' attribute has been set as 'IMS Common Cartridge'; (u) The value for the 'schemaversion' attribute has been set to '1.1.0'; (v) The authorizations attribute has been added as an imported extension to the manifest; (w) The protect attribute has been added as an imported extension to the resource; (x) The IEEE LOM attribute has been added as an imported extension to the manifest metadata; (y) The 'intendeduse' attribute has been added to the ResourceType complexType. History: This profile is taken from the formal representation in UML of the IMS CP v1.2 core specification. This is the second version of the profile for the CCv1.1. The two changes are the addition of the ResourceMetadata class and the vocabulary for the permitted resource types. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2011 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Schematron Validation Rules Information --------------------------------------- Author: Colin Smythe Date: 29th November, 2010 Version: 1.1 Status: Final Release Description: This set of schematron rules have been created to increase the validation capability of the CPv1.2 XSD for CCv1.1. A total of 10 rule sets have been created to ensure that: [1] The set of rules to ensure that resources for Discussion Topics are correctly provided; [2] The set of rules to ensure that resources for Web Links are correctly provided; [3] The set of rules to ensure that resources for Assessments are correctly provided; [4] The set of rules to ensure that resources for Question Banks are correctly provided; [5] The set of rules to ensure that resources for Web Content are correctly provided; [6] The set of rules to ensure that resources for Associated Content are correctly provided; [7] The set of general rules to ensure that Dependencies are used correctly; [8] The set of general rules to ensure that Items are defined correctly; [9] The set of general rules to ensure that Files are used correctly; [10] The set of general rules to ensure that Resources are used correctly; [11] The set of rules to ensure that resources for BasicLTI are correctly provided. Rule Set: [1] The set of rules to ensure that resources for Discussion Topics are correctly provided. The rules are: (a) Detect for the Discussion Topic Resource when the required 'file' element is missing; (b) Detect for the Discussion Topic Resource when too many 'file' elements are declared; (c) Ensure for the Discussion Topic Resource that the 'href' attribute is not used on the 'resource' element; (d) Detect for the Discussion Topic Resource when it has a prohibited dependency on a Discussion Topic; (e) Detect for the Discussion Topic Resource when it has a prohibited dependency on a Web Link; (f) Detect for the Discussion Topic Resource when it has a prohibited dependency on an Assessment; (g) Detect for the Discussion Topic Resource when it has a prohibited dependency on a Question Bank; (h) Detect for the Discussion Topic Resource when it has a prohibited dependency on a BasicLTI link; [2] The set of rules to ensure that resources for Web Links are correctly provided. The rules are: (a) Detect for the Web Links Resource when the required 'file' element is missing; (b) Detect for the Web Links Resource when too many 'file' elements are declared; (c) Ensure for the Web Links Resource that the 'href' attribute is not used on the 'resource' element; (d) Ensure for the Web Links Resource that the 'dependency' element is not used; [3] The set of rules to ensure that resources for Assessments are correctly provided. The rules are: (a) Detect for the Assessment Resource when the required 'file' element is missing; (b) Detect for the Assessment Resource when too many 'file' elements are declared; (c) Ensure for the Assessment Resource that the 'href' attribute is not used on the 'resource' element; (d) Detect for the Assessment Resource when it has a prohibited dependency on a Discussion Topic; (e) Detect for the Assessment Resource when it has a prohibited dependency on a Web Link; (f) Detect for the Assessment Resource when it has a prohibited dependency on an Assessment; (g) Detect for the Assessment Resource when it has a prohibited dependency on a Question Bank; (h) Detect for the Assessment Resource when it has a prohibited dependency on a BasicLTI link; [4] The set of rules to ensure that resources for Question Banks are correctly provided. The rules are: (a) Ensure that no more than one Qestion Bank is defiend as a resource; (b) Detect for the Question Bank Resource when the required 'file' element is missing; (c) Detect for the Question Bank Resource when too many 'file' elements are declared; (d) Ensure for the Question Bank Resource that the 'href' attribute is not used on the 'resource' element; (e) Detect for the Question Bank Resource when it has a prohibited dependency on a Discussion Topic; (f) Detect for the Question Bank Resource when it has a prohibited dependency on a Web Link; (g) Detect for the Question Bank Resource when it has a prohibited dependency on an Assessment; (h) Detect for the Question Bank Resource when it has a prohibited dependency on a Question Bank; (i) Detect for the Question Bank Resource when it has a prohibited dependency on a BasicLTI link; [5] The set of rules to ensure that resources for Web Content are correctly provided. The rules are: (a) Detect for the Web Content Resource when it has a prohibited dependency on a Discussion Topic; (b) Detect for the Web Content Resource when it has a prohibited dependency on a Web Link; (c) Detect for the Web Content Resource when it has a prohibited dependency on an Assessment; (d) Detect for the Web Content Resource when it has a prohibited dependency on a Question Bank; (e) Detect for the Web Content Resource when it has a prohibited dependency on a Associated Content; (f) Detect for the Web Content Resource when it has a prohibited dependency on a BasicLTI link; (g) A Web Content Resource has a missing 'href' attribute (required because the resource is directly referenced by an Item). [TO BE VERIFIED] [6] The set of rules to ensure that resources for Associated Content are correctly provided. The rules are: (a) Detect for the Associated Content Resource when it has a prohibited dependency on a Discussion Topic; (b) Detect for the Associated Content Resource when it has a prohibited dependency on a Web Link; (c) Detect for the Associated Content Resource when it has a prohibited dependency on an Assessment; (d) Detect for the Associated Content Resource when it has a prohibited dependency on a Question Bank; (e) Detect for the Associated Content Resource when it has a prohibited dependency on a Associated Content; (f) Detect for the Associated Content Resource when it has a prohibited dependency on a BasicLTI link; (g) An Associated Content Resource has a missing 'href' attribute (required because the resource is directly referenced by an Item). [TO BE VERIFIED] [7] The set of general rules to ensure that Dependencies are used correctly. The rules are: (a) A 'dependency' element has a circular reference to its host 'resource' element with identifier; (b) In a 'resource' element at least two 'dependency' elements reference the same 'resource' element. [8] The set of general rules to ensure that Items are defined correctly. The rules are: (a) An Item has a prohibited reference(s) to a Question Bank Resource; (b) A Learning Object Item contains prohibited child Item(s). [9] The set of general rules to ensure that Files are used correctly. The rules are: (a) In a 'resource' element at least two 'file' elements have the same 'href' attribute; [10] The set of general rules to ensure that Resources are used correctly. The rules are: (a) For a 'resource' element with the 'href' attribute the 'file' element is missing; (b) For a 'resource' element with the 'href' attribute there is no 'file' element with the correct 'href' attribute. [11] The set of rules to ensure that resources for BasicLTI are correctly provided. The rules are: (a) Detect for the BasicLTI Resource when it has a prohibited dependency on a Discussion Topic; (b) Detect for the BasicLTI Resource when it has a prohibited dependency on a Web Link; (c) Detect for the BasicLTI Resource when it has a prohibited dependency on an Assessment; (d) Detect for the BasicLTI Resource when it has a prohibited dependency on a Question Bank; (e) Detect for the BasicLTI Resource when it has a prohibited dependency on a Web Content; (f) Detect for the BasicLTI Resource when it has a prohibited dependency on a BasicLTI link. Schematron validation rules for the Common Cartridge v1p1 profile of CP v1.1.4/1.2 RULE SET 1: The set of rules to ensure that resources for Discussion Topics are correctly provided [RULE 1a] For the Discussion Topic Resource the required 'file' element is missing. [RULE 1b] For the Discussion Topic Resource there are too many 'file' element references: . [RULE 1c] For the Discussion Topic Resource the 'href' attribute must not be used on the 'resource' element. [RULE 1d] The Discussion Topic Resource has a prohibited dependency on a Discussion Topic: [RULE 1e] The Discussion Topic Resource has a prohibited dependency on a Web Link: [RULE 1f] The Discussion Topic Resource has a prohibited dependency on an Assessment: [RULE 1g] The Discussion Topic Resource has a prohibited dependency on a Question Bank: [RULE 1h] The Discussion Topic Resource has a prohibited dependency on a BasicLTI: RULE SET 2: The set of rules to ensure that resources for Web Links are correctly provided [RULE 2a] For the Web Link Resource the required 'file' element is missing. [RULE 2b] For the Web Link Resource there are too many 'file' element references: . [RULE 2c] For the Web Link Resource the 'href' attribute must not be used on the 'resource' element. [RULE 2d] For the Web Link Resource the prohibited 'dependency' element is used: . RULE SET 3: The set of rules to ensure that resources for Assessments are correctly provided [RULE 3a] For the Assessments Resource the required 'file' element is missing. [RULE 3b] For the Assessments Resource there are too many 'file' element references: . [RULE 3c] For the Assessments Resource the 'href' attribute must not be used on the 'resource' element. [RULE 3d] The Assessment Resource has a prohibited dependency on a Discussion Topic: [RULE 3e] The Assessment Resource has a prohibited dependency on a Web Link: [RULE 3f] The Assessment Resource has a prohibited dependency on an Assessment: [RULE 3g] The Assessment Resource has a prohibited dependency on a Question Bank: [RULE 3h] The Assessment Resource has a prohibited dependency on a BasicLTI: RULE SET 4: The set of rules to ensure that resources for Question Banks are correctly provided [RULE 4a] The are too many Question Bank Resources (a maximum of one is permitted). Number of Question Bank Resources is: . [RULE 4b] For the Question Bank Resource the required 'file' element is missing. [RULE 4c] For the Question Bank Resource there are too many 'file' element references: . [RULE 4d] For the Question Bank Resource the 'href' attribute must not be used on the 'resource' element. [RULE 4e] The Question Bank Resource has a prohibited dependency on a Discussion Topic: [RULE 4f] The Question Bank Resource has a prohibited dependency on a Web Link: [RULE 4g] The Question Bank Resource has a prohibited dependency on an Assessment: [RULE 4h] The Question Bank Resource has a prohibited dependency on a Question Bank: [RULE 4i] The Question Bank Resource has a prohibited dependency on a BasicLTI: RULE SET 5: The set of rules to ensure that resources for Web Content are correctly provided [RULE 5a] The Web Content has a prohibited dependency on a Discussion Topic: . [RULE 5b] The Web Content has a prohibited dependency on a Web Link: . [RULE 5c] The Web Content has a prohibited dependency on an Assessment: . [RULE 5d] The Web Content has a prohibited dependency on a Question Bank: . [RULE 5e] The Web Content has a prohibited dependency on an Associated Content: . [RULE 5f] The Web Content has a prohibited dependency on a BasicLTI: . RULE SET 6: The set of rules to ensure that resources for Associated Content are correctly provided [RULE 6a] The Associated Content Resource has a prohibited dependency on a Discussion Topic: . [RULE 6b] The Associated Content Resource has a prohibited dependency on a Web Link: . [RULE 6c] The Associated Content Resource has a prohibited dependency on an Assessment: . [RULE 6d] The Associated Content Resource has a prohibited dependency on a Question Bank: . [RULE 6e] The Associated Content Resource has a prohibited dependency on an Associated Content: . [RULE 6f] The Associated Content Resource has a prohibited dependency on a BasicLTI: . RULE SET 7: The set of rules to ensure that Dependencies are used correctly. [RULE 7a] A 'dependency' element has a circular reference to its host 'resource' element with identifier: . [RULE 7b] In a 'resource' element at least two 'dependency' elements reference the same 'resource' element. . RULE SET 8: The set of rules to ensure that Items are defined correctly. [RULE 8a] An Item has a prohibited reference(s) to a Question Bank Resource: . [RULE 8b] A Learning Object Item contains prohibited child Item(s): . RULE SET 9: The set of rules to ensure that Files are used correctly. [RULE 9a] In a 'resource' element at least two 'file' elements have the same 'href' attribute: . RULE SET 10: The set of general rules to ensure that Resources are used correctly. [RULE 10a] For a 'resource' element with the 'href' attribute the 'file' element is missing: . [RULE 10b] For a 'resource' element with the 'href' attribute there is no 'file' element with the correct 'href' attribute: . RULE SET 11: The set of rules to ensure that resources for BasicLTI are correctly provided [RULE 11a] The BasicLTI has a prohibited dependency on a Discussion Topic: . [RULE 11b] The BasicLTI has a prohibited dependency on a Web Link: . [RULE 11c] The Web Content has a prohibited dependency on an Assessment: . [RULE 11d] The Web Content has a prohibited dependency on a Question Bank: . [RULE 11e] The Web Content has a prohibited dependency on an Associated Content: . [RULE 11f] The Web Content has a prohibited dependency on a BasicLTI: . Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace.

This identifies a resource whose files this resource depends upon. The reference to an identifier in the resources section is contained in the Identifierref attribute.

A listing of file that this resource is dependent on. The href attribute identifies the location of the file. This may have some meta-data.

This is the structure that describes the shape of the organization. It is used in a hierarchical organizational scheme by ordering and nesting. Each Item has an identifier that is unique within the Manifest file. Identifierref acts as a reference to an identifier in the resources section. An Item has a title and may have meta-data. The parameters and isvisible attributes have been removed for this profile.

This is the structure that describes the top-level shape of the organization and so only a single Item is permitted. The top-level has an identifier that is unique within the Manifest file. It may have meta-data but it has not title. It can contain any number of Items. The parameters and isvisible attributes have been removed for this profile

A reusable unit of instruction. It encapsulates meta-data, organizations, resource references and authorization.
It must have an identifier that is unique within the Manifest. The version and reference base is optional.
The base provides the relative path offset for the content file(s).

This is the meta-data describing the Manifest. The schema describes the schema that defines and controls the Manifest.
Schemaversion describes the version of the above schema (e.g., 1,0, 1.1). In Common Cartridge all of the meta-data is described
using the iEEE LOM standard format. CC manifest metadata is required.

This is the meta-data describing the associated class (but not the manifest which has its own meta-data structure).
In Common Cartridge all of the meta-data is described using the IEEE LOM standard format.

This is the meta-data describing the associated class (but not the manifest which has its own meta-data structure).
In Common Cartridge all of the meta-data is described using the IEEE LOM standard format.

This is the meta-data describing the associated class (but not the manifest which has its own meta-data structure).
In Common Cartridge all of the meta-data is described using the IEEE LOM standard format.

Describes a particular hierarchical organization in this profile; this is the only type of oranization that is permitted. The identifier, for the organization, that is unique within the Manifest file. The organization may have meta-data.

Describes zero or one structures or organizations for the Cartridge. Only one organization is permitted so the default attribute has been removed for this Profile.

A reference to a resource which consists of one or more physical files. The Identifer of the resource is unique within the scope of its containing Manifest file. The Type attribute indicates the type of resource - for the Cartridge this is an enumerated set. The resource may have meta-data, zero or more files references, and zero or more dependencies.

CCV1.1 PROFILE: The authorizations 'protected' attribute and the 'intendedUse' attribute are added.

This is the container for resource specific metadata..

A collection of references to resources. There is no assumption of order or hierarchy. The base attribute provides the relative path offset for the content file(s).

PK\//&schemas11/ccv1p1_qtiasiv1p2p1_v1p0.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st October, 2010 Version: 1.1 Status: Final Release Description: This model forms part of the IMS Common Cartridge v1.1 specification. This model is the profile of the IMS QTI v1.2.1 specification. The changes made to the original specification to create this profile are: Root (a) Only one Assessment or one ObjectBank can be exchanged i.e. not Sections or Items; (b) The qticomment attribute has been removed. Assessment (a) Only a single Section must be contained in the Assessment; (b) The metadata is mandatory (see the specification for the fields that must be defined) with a multiplicity of 1; (c) All of the other Assessment fields have been removed apart from the optional PresentationMaterial; (d) The title attribute has been made mandatory. Object Bank (a) Only Items can be containd in the object bank; (b) The Qticomment structure has been removed. Section (a) All of the internal structure has been removed except the containment of Items (at least one is required); (b) The language attribute has been removed. Item (a) The deprecated attributes have been removed from the ItemMetadata class; (b) All qticomment attributes have been removed from various classes; (c) The Item pre and post condition attributes have been removed from the Item class; (d) The itemproc_extension structure has been removed from the Item class; (e) The reference structure has been removed from the Item class; (f) The objectives attribute has been removed from the Item class; (g) The itemcontrol attribute has been removed from the Item class; (h) The item rubric attribute and its associated classes have been removed from the Item class; (i) The duration attribute has been removed from the Item class; (j) The itemmetadata attribute has been made mandatory in the Item class; (k) The label, language and maxattempts attributes have been removed from the Item class; (l) The interpretvar attribute has been removed frm the Outcomes class; (m) The response_xy, response_num, response_grp and response_extension attributes have been removed from the Presentation class; (n) All extension attributes have been removed from various classes; (o) The ItemType, LevelofDifficulty, RenderingType, ResponseMultiplicity, Status and TypeofSolution have been deleted; (p) The ItemFeedback Class has been restructured as only flow_mat is used; (q) A single decvar is required i.e. for the default variable SCORE. Item-Response (a) The Rrange and Rarea attributes have been removed from the ResponseLabel Class. Item-Render (a) The render_hotspot attributes and the RenderHotspot class have been removed; (b) The render_slider attributes and the RenderSlider class have been removed; (c) The render_extension attribute has been removed from the ResponseType class; (d) The response_na attribute has been removed; (e) The qticomment attribute has been removed from the ResponseLabel class; Item-General (a) The Interpretvar class has been removed; (b) The DurationBase class has been removed and all derived attributes from the Conditionvar and CompositionLogic classes; (c) The var_extension attribute has been removed from the Conditionvar class; (d) The qticomment attributes have been removed from the Hint and Solution classes; (e) Setvar is restricted to the Set action; (f) Variable types are restricted to 'Integer' and 'Decimal'; (g) The defaultval and cutvalue, attributes for decvar have been removed; (h) Outcomes is limtied to a single decvar which must have only the variable "SCORE" declared; (i) The classes or, varlt, varlte, vargt, vargte, varinside, varsubset and unanswered have been removed; (j) The classes 'and', 'not' and 'conditionvar' have been significantly simplied i.e. see clause above for detail; (k) The feedbacktype attribute for the displayfeedback element is now mandatory with no default value. Selection and Ordering (a) The entire Selection and Ordering (Package) has been removed. Outcomes (a) The entire Outcomes Processing (Package) has been removed. Material (a) The Reference Class has been removed as this is not required; (b) All entityref attributes have been removed; (c) Extensions have been removed; (d) Only 'mattext', 'matref' and 'matbreak' are permitted as types of material. Common (a) The Rubric class has been removed Items and Sections and it is only permitted to contain a single instance of material; (b) The ContextControl class has been removed i.e. no Control switches required; (c) The QtiComment Class has been removed; (d) The MetadataRule Class has been removed; (e) the Parameterization Class has been removed; (f) The 'view' attribute has been removed; (g) The Vocabulary Class has been removed and its attribute in the QtiMetadata Class also removed. History: Version 1.0: This profile is taken from the UML description of the QTIv1.2.1 specification. Version 1.1: Material has been returned as an alternative to flow_mat in ItemFeedback, SolutionMaterial and HintMaterial. Also, Assessment Rubric has been permitted but it must only contain a single instance of material. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Schematron Validation Rules Information --------------------------------------- Author: Colin Smythe Date: 5th January, 2011 Version: 1.1 Status: Final Release Description: This set of schematron rules have been created to increase the validation capability of the QTIv1.2.1 XSD. A total of 12 rule sets have been created to ensure that: [1] Only valid Assessment metadata is defined; [2] Only valid Question types are defined in the Itemmetatadata fields; [3] The structure of a True/False question is correct; [4] The structure of a Multiple-Choice (Single Response) question is correct; [5] The structure of a Multiple-Choice (Multiple Response) question is correct; [6] The structure of a Fill In Blank question is correct; [7] The structure of a Pattern Match question is correct; [8] The structure of an Essay question is correct; [9] The structures of the response processing/response-label are correct; [10] The structure of a Hint in an Item is correct; [11] The structure of a Solution in an Item is correct; [12] The structure of the response processing feedback structure in an Item is correct; [13] Generic features of an Item are correctly implemented. Rule Set: [1] The set of rules to ensure that only valid Assessment metadata is defined. The rules are: (a) Only valid entries are defined for the Assessment metadata fieldlabel values; (b) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_assessmenttype'; (c) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_scoretype'; (d) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_feedbackpermitted'; (e) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_hintspermitted'; (f) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_solutionspermitted'; (g) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'qmd_timelimit'; (h) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'cc_allow_late_submission'; (i) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'cc_maxattempts'; (j) Only valid entries are defined for the Assessment metadata fieldentry values for fieldlabel = 'cc_profile'; (k) There must be no more than one Assessment metadata field with fieldlabel='cc_profile'; (l) There must be no more than one Assessment metadata field with fieldlabel='qmd_assessmenttype'; (m) There must be no more than one Assessment metadata field with fieldlabel='qmd_scoretype'; (n) There must be no more than one Assessment metadata field with fieldlabel='qmd_feedbackpermitted'; (o) There must be no more than one Assessment metadata field with fieldlabel='qmd_hintspermitted'; (p) There must be no more than one Assessment metadata field with fieldlabel='qmd_solutionspermitted'; (q) There must be no more than one Assessment metadata field with fieldlabel='qmd_timelimit'; (r) There must be no more than one Assessment metadata field with fieldlabel='cc_allow_late_submission'; (s) There must be no more than one Assessment metadata field with fieldlabel='cc_maxattempts'. [2] The set of rules to ensure that only valid Question types are defined in the Itemmetatadata fields. The rules are: (a) Only valid entries are defined for the Itemmetadata fieldlabel values; (b) Only valid entries are defined for the Itemmetadata fieldentry values for fieldlabel = 'cc_profile'; (c) Only valid entries are defined for the Itemmetadata fieldentry values for fieldlabel = 'cc_weighting'; (d) Only valid entries are defined for the Itemmetadata fieldentry values for fieldlabel = 'qmd_scoringpermitted'; (e) Only valid entries are defined for the Itemmetadata fieldentry values for fieldlabel = 'qmd_computerscored'; (f) The Item metadata field with fieldlabel='cc_profile' must be present; (g) There must only be one Item metadata fields with fieldlabel='cc_profile'for each Item; (h) There must be no more than one Item metadata field with fieldlabel='cc_weighting'for each Item; (i) There must be no more than one Item metadata field with fieldlabel='qmd_scoringpermitted' for each Item; (j) There must be no more than one Item metadata field with fieldlabel='qmd_computerscored'for each Item. [3] The set of rules to ensure that the structure of a True/False question is correct. The rules are: (a) That @rcardinality='Single'; (b) The element 'response_str' is not used; (c) The element 'render_fib' is not used; (d) That there are zero or two response labels; (e) That the response processing uses the correct identifiers i.e. varequal/@respident value is equal to the response_lid/@ident; (f) The varsubstring element must not be used. [4] The set of rules to ensure that the structure of a Multiple-Choice (Single Response) question is correct. The rules are: (a) That @rcardinality='Single'; (b) The element 'response_str' is not used; (c) The element 'render_fib' is not used; (d) That there are at least three response labels; (e) That the response processing uses the correct identifiers i.e. varequal/@respident value is equal to the response_lid/@ident; (f) The varsubstring element must not be used. [5] The set of rules to ensure that the structure of a Multiple-Choice (Multiple Response) question is correct. The rules are: (a) That @rcardinality='Multiple'; (b) The element 'response_str' is not used; (c) The element 'render_fib' is not used; (d) That there are at least two response labels; (e) That the response processing uses the correct identifiers i.e. varequal/@respident value is equal to the response_lid/@ident; (f) The varsubstring element must not be used.. [6] The set of rules to ensure that the structure of a Fill-in-Blank question is correct. The rules are: (a) The element 'response_lid' is not used; (b) The element 'render_choice' is not used; (c) That the response processing uses the correct identifiers i.e. varequal/@respident value is equal to the response_str/@ident; (d) There is no use of the 'varsubstring' element. [7] The set of rules to ensure that the structure of a Pattern Match question is correct. The rules are: (a) The element 'response_lid' is not used; (b) The element 'render_choice' is not used; (c) That the response processing uses the correct identifiers i.e. varequal/@respident value is equal to the response_str/@ident. [8] The set of rules to ensure that the structure of an Essay question is correct. The rules are: (a) The element 'response_lid' is not used; (b) The element 'render_choice' is not used; (c) There is no use of the 'varequal' element; (d) There is no use of the 'varsubstring' element; (e) No more than a single Solution feedback can be supplied; (f) The fieldentry Item metadata for an Essay question with the fieldlabel='qmd_computerscored' must be set as 'No'. [9] The set of rules to ensure that the Response Processing/Response-Label structures are valid. The rules are: (a) There are no invalid response labels used in the 'varequal' element for T/F and MC questions. [10] The set of rules to ensure that the structure of a Hint in an Item is correct. The rules are: (a) The element 'displayfeedback@feedbacktype=Hint' is accompanied by the @linkrefid='hint' attribute; (b) The element 'itemfeedback@ident=hint' is not followed by the 'solution' element; (c) The element 'itemfeedback@ident=hint' is not followed by the 'flow_mat' element; (d) If the element 'displayfeedback@feedbacktype=Hint' is used it must be accompanied by hint feedback. [11] The set of rules to ensure that the structure of a Solution in an Item is correct. The rules are: (a) The element 'displayfeedback@feedbacktype=Solution' is accompanied by the @linkrefid='solution' attribute; (b) The element 'itemfeedback@ident=solution' is not followed by the 'hint' element; (c) The element 'itemfeedback@ident=solution' is not followed by the 'flow_mat' element; (d) If the element 'displayfeedback@feedbacktype=Solution' is used it must be accompanied by solution feedback. [12] The set of rules to ensure that the general structure of the Response Processing in an Item is correct. The rules are: (a) The element 'displayfeedback@feedbacktype=Response' is not accompanied by the @linkrefid='solution' attribute; (b) The element 'displayfeedback@feedbacktype=Response' is not accompanied by the @linkrefid='hint' attribute; (c) To check that for each element 'displayfeedback@feedbacktype=Response' the corresponding 'itemfeedback' element exists; (d) To check that a given response processing itemfeedback identifier there is a corresponding displayfeedback trigger for that identifier. [13] The set of rules to ensure that the general features in an Item are correct. The rules are: (a) To ensure that each Item has a unique @ident attribute. Schematron validation rules for the Common Cartridge v1p1 profile of QTI v1.2.1 RULE SET 1: Ensure that only valid metadata is defined in the Assessment metadata fields [RULE 1a] Invalid Assessment metadata fieldlabel value: . [RULE 1b] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_assessmenttype' value: . [RULE 1c] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_scoretype' value: . [RULE 1d] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_feedbackpermitted' value: . [RULE 1e] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_hintspermitted' value: . [RULE 1f] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_solutionspermitted' value: . [RULE 1g] Invalid fieldentry Assessment metadata for the fieldlabel='qmd_timelimit' i.e. not a valid integer with value: . [RULE 1h] Invalid fieldentry Assessment metadata for the fieldlabel='cc_allow_late_submission' value: . [RULE 1i] Invalid fieldentry Assessment metadata for the fieldlabel='cc_maxattempts' value: . [RULE 1j] Invalid fieldentry Assessment metadata for the fieldlabel='cc_profile' value: . [RULE 1k] There are repeated assessment metadata fields of fieldlabel='cc_profile' with count=. [RULE 1l] There are repeated assessment metadata fields of fieldlabel='qmd_assessmenttype' with count=. [RULE 1m] There are repeated assessment metadata fields of fieldlabel='qmd_scoretype' with count=. [RULE 1n] There are repeated assessment metadata fields of fieldlabel='qmd_feedbackpermitted' with count=. [RULE 1o] There are repeated assessment metadata fields of fieldlabel='qmd_hintspermitted' with count=. [RULE 1p] There are repeated assessment metadata fields of fieldlabel='qmd_solutionspermitted' with count=. [RULE 1q] There are repeated assessment metadata fields of fieldlabel='qmd_timelimit' with count=. [RULE 1r] There are repeated assessment metadata fields of fieldlabel='cc_allow_late_submission' with count=. [RULE 1s] There are repeated assessment metadata fields of fieldlabel='cc_maxattempts' with count=. RULE SET 2: Ensure that only valid metadata is defined in the Itemmetatadata fields [RULE 2a] Invalid Itemmetadata fieldlabel value: . [RULE 2b] Invalid fieldentry Question Type (fieldlabel='cc_profile') value: . [RULE 2c] Invalid fieldentry Item metadata weighting for the fieldlabel='cc_weighting' i.e. not an integer in the range 1..99, with value: . [RULE 2d] Invalid fieldentry Item metadata for the fieldlabel='qmd_scoringpermitted' with value: . [RULE 2e] Invalid fieldentry Item metadata for the fieldlabel='qmd_computerscored' with value: . [RULE 2f] The Item metadata field with fieldlabel='cc_profile' is missing. [RULE 2g] There are too many Item metadata fields with fieldlabel='cc_profile' i.e. count=. [RULE 2h] There are too many Item metadata fields with fieldlabel='cc_weighting' i.e. count=. [RULE 2i] There are too many Item metadata fields with fieldlabel='qmd_scoringpermitted' i.e. count=. [RULE 2j] There are too many Item metadata fields with fieldlabel='qmd_computerscored' i.e. count=. RULE SET 3: Ensure that the structure of a True/False question is correct [RULE 3a] Incorrect cardinality attribute value for the T/F question: [RULE 3b] The invalid 'response_str' element has been used for a T/F question. [RULE 3c] The invalid 'render_fib' element has been used for a T/F question. [RULE 3d] There are too many or too few response labels for the T/F question. [RULE 3e] The T/F response processing Varequal respident attribute () value is not equal to the corresonding Response_lid ident () attribute for the True/False question. [RULE 3f] There is an invalid use of the varsubstring element in a T/F question. RULE SET 4: Ensure that the structure of a MC-SR question is correct [RULE 4a] Incorrect cardinality attribute value for the MC-SR question: . [RULE 4b] The invalid 'response_str' element has been used for a MC-SR question. [RULE 4c] The invalid 'render_fib' element has been used for a MC-SR question. [RULE 4d] There are too too few response labels for the MC-SR question. [RULE 4e] The MC-SR response processing Varequal respident attribute () value is not equal to the corresonding Response_lid ident () attribute for the Multiple Choice single response question. [RULE 4f] There is an invalid use of the varsubstring element in a MC-SR question. RULE SET 5: Ensure that the structure of a MC-MR question is correct [RULE 5a] Incorrect cardinality attribute value for the MC-MR question: . [RULE 5b] The invalid 'response_str' element has been used for a MC-MR question. [RULE 5c] The invalid 'render_fib' element has been used for a MC-MR question. [RULE 5d] There are too too few response labels for the MC-MR question. [RULE 5e] The MC-MR response processing Varequal respident attribute () value is not equal to the corresonding Response_lid ident () attribute for the Multiple Choice multiple response question. [RULE 5f] There is an invalid use of the varsubstring element in a MC-MR question. RULE SET 6: Ensure that the structure of a FIB question is correct [RULE 6a] The invalid 'response_lid' element has been used for a FIB question. [RULE 6b] The invalid 'render_choice' element has been used for a FIB question. [RULE 6c] The FIB response processing Varequal respident attribute () value is not equal to the corresonding Response_str ident () attribute for the FIB question. [RULE 6d] There is an invalid use of the 'varsubstring' element in the FIB question. RULE SET 7: Ensure that the structure of a Pattern Match question is correct [RULE 7a] The invalid 'response_lid' element has been used for a Pattern Match question. [RULE 7b] The invalid 'render_choice' element has been used for a Pattern Match question. [RULE 7c] The FIB response processing Varequal respident attribute () value is not equal to the corresonding Response_str ident () attribute for the Pattern Match question. RULE SET 8: Ensure that the structure of a Essay question is correct [RULE 8a] The invalid 'response_lid' element has been used for an Essay question. [RULE 8b] The invalid 'render_choice' element has been used for an Essay question. [RULE 8c] There is an invalid use of the 'varequal' element in an Essay question. [RULE 8d] There is an invalid use of the 'varsubstring' element in an Essay question. [RULE 8e] Too many Solution feedback structures are supplied. [RULE 8f] Invalid fieldentry Item metadata for an Essay question with the fieldlabel='qmd_computerscored' with value: . RULE SET 10: Ensure that the structure of a Hint in an Item is correct [RULE 10a] The displayfeedback@feedbacktype='Solution' has been used to identify a Hint. [RULE 10b] The itemfeedback@ident='hint' has been used to identify a Solution. [RULE 10c] The itemfeedback@ident='hint' has been used to identify Response feedback. [RULE 10d] A displayfeedback[@feedbacktype='Hint'] trigger has no accompanying hint feedback. RULE SET 11: Ensure that the structure of a Solution in an Item is correct [RULE 11a] The displayfeedback@feedbacktype='Hint' has been used to identify a Solution. [RULE 11b] The itemfeedback@ident='solution' has been used to identify a Hint. [RULE 11c] The itemfeedback@ident='solution' has been used to identify Response feedback. [RULE 11d] A displayfeedback[@feedbacktype='Solution'] trigger has no accompanying solution feedback. RULE SET 12: Ensure that the structure of the response processing feedback structure in an Item is correct [RULE 12a] The displayfeedback@feedbacktype='Response' has been used to identify a Solution. [RULE 12b] The displayfeedback@feedbacktype='Response' has been used to identify a Hint. [RULE 12c] For the given displayfeedback identifier () there is no itemfeedback with the correct identifier (). [RULE 12d] For the given response processing itemfeedback identifier () there is no displayfeedback trigger with the correct identifier (). RULE SET 13: Ensure that the generic features of an Item are correct [RULE 13a] There are Items that have common identifiers: . The root structure can consist of either: * A single object bank; * An assessment; * A set of item(s); * A set of section(s); * Any combination of items and sections. As the root this is mandatory and can occur once. Common Cartridge Profile A Commn Cartridge is allowed to contain only an objectbank or an assessement. QTI General An Assessment object is the logical construction of the test. An Assessment must contain at least one Section which in turn will contain Items and/or Sections. An Assessment must eventually be constructed from a set of Items i.e. questions that are to be offered in the test. An Assessment object contains all of the information to make the use of individual Items meaningful i.e. apart from the Sections the object includes the relationships between the Sections, the group evaluation processing and the corresponding feedback. Common Cartridge Profile The Assessment must consist of only one Section. The only other permitted attributes are the mandatory identifier and title. Optional language, metadata, rubric and presentation_material is also supported. QTI General An object bank is an unordered set of items and sections. It is recommended that there is a metadata description for the object bank as a whole. The object bank should have a globally unique identifier. Common Cartridge Profile In the Common Cartridge the object-bank can only contain Items. Meta-data support is available but the profile has no mandated entries. QTI General A Section is the core grouping concept within QTI. A Section consists of one or more Items or Sections (or references to Items and Sections). In general, the objects contained within a Secton will have some relationship either in terms of content or content delivery. The Section data structure is used to define arbitrarily complex hierarchical section and item data structures. It may contain meta-data, objectives, rubric control switches, assessment-level processing, feedback and selection and sequencing information for sections and items. Common Cartridge Profile In Common Cartridge the Section can only contain a list of Items. No metadata is permitted. The identifier is mandatory but the title and language are optional. An Item the smallest exchangeable object within QTI-XML. An Item is more than a ‘Question’ in that it contains the ‘Question’, the presentation/rendering instructions, the response processing to be applied to the participant’s response(s), the feedback that may be presented (including hints and solutions) and the meta-data describing the Item. Contains all of the QTI-specific metada-data to be applied to the Item. This meta-data can consist of either entries defined using an external vocabulary or the individually named entries. Usage of the contained attributes are deprecated apart from the 'qtimetadata' attribute. Contains all of the instructions for the presentation of the question during an evaluation. This information includes the actual material to be presented. The labels for the possible responses are also identified and these are used by the response processing element defined elsewhere in the Item. This contains all of the instructions for the response processing. This includes the scoring variables to contain the associated scores and the set of response condition tests that are to be applied to the received user response. Contains all of the variable declarations that are to be made available to the scoring algorithm. Each variable is declared using the 'decvar' structure apart from the default variable called ‘SCORE’ that is an integer and has a default value of zero (0). Common Cartridge Profile A single variable is permitted. This is "SCORE". The container for the feedback that is to be presented as a result of the user’s responses. The feedback can include hints and solutions and both of these can be revealed in a variety of different ways. Contains the actual test to be applied to the user responses to determine their correctness or otherwise. Each 'respcondition' contains an actual test, the assignment of a value to the associate scoring variables and the identification of the feedback to be associated with the test. This is the information that is to be presented to set the context for the contained objects. This can be used to contain question-based material that is common to all of the child objects. This is used in Assessment and Section objects. This is the information that is used to describe the solution. This allows the materials to be displayed to the users to be grouped together using flows. The manner in which these flows are handled is dependent upon the display-engine. This is the container for any content that is to be displayed by the question-engine. The supported content types are text (emphasised or not), images, audio, video, application and applet. The content can be internally referenced to avoid the need for duplicate copies. Alternative information can be defined – this is used if the primary content cannot be displayed. Common Cartridge Profile Only the 'mattext', 'matref' and 'matbreak' types are permitted. This is the container for alternative content. This content is to be displayed if, for whatever reason, the primary content cannot be rendered. Alternative language implementations of the host 'material' element are also supported using this structure. This is the container for all of the instructions for the presentation with flow blocking of the question during a test. This information includes the actual material to be presented. The labels for the possible responses are also identified and these are used by the response processing element defined elsewhere in the Item. Contains the instructions for the question-engine to render the question using a classical multiple choice format. The number of possible responses is determined by the 'response_label' structures contained. Both flowed and non-flowed formats are supported Contains the instructions for the question-engine to render the question using a classical fill-in blank format. The number of possible responses is determined by the 'response_label' structures contained. Both flowed and non-flowed formats are supported. QTI General The QTI-specific meta-data assigned to the parent object i.e. Assessment, Section, Item or Object-bank. This approach requires that the approriate external vocabulary is defined and referenced in label/field tuple. Common Cartridge Profile The Vocabulary structure has been removed. The structure responsible for containing each of the QTI-specific meta-data fields. The label should appear in the vocabulary. If no vocabulary is used then external validation cannot take place. This is used to contain contextual information i.e. rubric that is important to the object e.g. it could contain standard data values that might or might not be useful for answering the question. Common Cartridge Profile This is used in assessments to provide instructions. Only a single mattext is permitted in the material. This contains the possible response choices that are presented to the user. This information includes the material to be shown to the user and the logical label that is associated with that response. The label is used in the response processing. Flow and non-flow approaches are supported. This is the blocking/paragraph equivalent to the 'response_label' structure. This structure shold always be used to encapsulate the 'response_label construct. QTI General This contains the instructions for the presentation of questions whose response will be either a 'response_lid' (logical identifier), 'response_xy' (xy-co-ordinate), 'response_str' (a string), 'response_num' (a number) and 'response_grp' ( a group of logical identifiers). The question can be rendered in a variety of ways depending on the way in which the material is to be presented to the participant. Common Cartridge Profile Only the response_lid and response_str response types are supported with render_choice and render_fib rendering. QTI General This contains the instructions for the presentation of questions whose response will be either a 'response_lid' (logical identifier), 'response_xy' (xy-co-ordinate), 'response_str' (a string), 'response_num' (a number) and 'response_grp' ( a group of logical identifiers). The question can be rendered in a variety of ways depending on the way in which the material is to be presented to the participant. Common Cartridge Profile Only the response_lid and response_str response types are supported with render_choice and render_fib rendering. QTI General Contains the solution(s) that are to be revealed to the participant. When these solutions are revealed is outside the scope of the specification. The information can be revealed in several manners. The default mode is to show the 'Complete' solution. Common Cartridge Profile The material is presented in the form of flow_mat only. The only form of feedback is 'Complete'. QTI General Contains the hints(s) that are to be revealed to the participant. When these hints are revealed is outside the scope of the specification. The information can be revealed in several manners. The default mode is to show the 'Complete' hint. Common Cartridge Profile The material is presented in the form of flow_mat only. The only form of feedback is 'Complete'. QTI General The conditional test that is to be applied to the user’s response. A wide range of separate and combinatorial tests can be applied. Common Cartridge Profile The extension has been removed. All of the conditions operating on duration have been removed. The only permited conditions are 'varequal', 'varsubstring', 'and', 'other'. This is the information that is used to describe the solution. This is the information that is presented as a hint. QTI General This defines the set of clauses that can be used within the logic statements of 'and', 'or' and 'not'. These logic statements enable the construction of complex conditional tests. Common Cartridge Profile The extension has been removed. All of the conditions operating on duration have been removed. The 'or' conditional has been removed and 'and' and 'not' have been considerably simplified. QTI General This defines the set of clauses that can be used within the logic statements of 'and', 'or' and 'not'. These logic statements enable the construction of complex conditional tests. Common Cartridge Profile The extension has been removed. All of the conditions operating on duration have been removed. The 'or' conditional has been removed and 'and' and 'not' have been considerably simplified. This is the container of any text that is to be displayed to the users. It is the base type for normal and emphasised text. This is used to contain a reference to the required full material block. This material will have had an identifier assigned to enable such a reference to be reconciled when the instance is parsed into the system. This is used to contain a reference to the required full material block. This material will have had an identifier assigned to enable such a reference to be reconciled when the instance is parsed into the system. QTI General This is used for the declaration of the scoring variables. The name of the variable that is to be declared. The default name is ‘SCORE’. All numeric variables have the associated ‘x.min’, ‘x.max’ and ‘x.normalised’ variables declared. Several of the optional attributes depend upon the type of variable that is declared. Common Cartridge Profile Only the variable types of decimal and integer are permitted. Only a single "SCORE" variable is permitted. QTI General This is responsible for changing the value of the scoring variable as a result of the associated response processing test. The default action is to 'Set' the 'SCORE' variable to the value given in the string. Common Cartridge Profile Only the actons Set, Add and Subtract are premitted. This is the test of equivalence. The data for the test is contained as a string. The accompanying attributes are the identifier for the associated 'response_label', the ordinal 'index' of the response and whether or not the value is case-sensitive when processing strings. This is used for assigning an associated feedback to the aggregated scoring if the ‘True’ state results. Feedback for hints, solutions and response processing are supported. The feedback is identified using the pointer 'linkrefid'. This is the test for a contained substring. The data for comparison is presented as a string. The associated attributes are the response label identifier, the ordinal index of the response and whether or not the value is case-sensitive when processing the strings. PK\c>88schemas11/imslticc_v1p0p1.xsdnu[ XSD Data File Information ------------------------- Author: Chuck Severance (IMS GLC) and Colin Smythe (IMS GLC) Date: 9th June, 2010 Version: 1.0.1 Status: Final Release Description: This is the description of the resource linkfile that is to be placed inside a Common Cartridge. History: V1.0 - the first Final Release. V1.0.1 - changed to use the imsbasiclti_v1p0p1.xsd. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. The CartridgeBasicLTILink class is the container for the information about the use of BasicLTI with a Common Cartridge. The ToolLocator complexType is the container for the tool locator information for the cartridge BasicLTI resource. The ResourceRef complexType is the container for the resource reference. PK\x=22schemas11/ccv1p1_imswl_v1p1.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st August, 2010 Version: 1.1 Status: Final Description: This is the IMS GLC Web Links Data Model for the Common Cartridge. History: Version 1.0 - the first release of this data model; Version 1.1 - updates made to the namespace. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. The WebLink complexType for the associated object. The URL for the web link. PK\22#schemas11/ccv1p1_imsccauth_v1p1.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st August, 2010 Version: 1.1 Status: Final Description: This is the IMS GLC Authorization Data Model for the Common Cartridge. History: Version 1.0 - the first release of this data model; Version 1.1 - updates made to the namespace. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. The set of authorizations for the associated object. The authorization detail for the cartridge in terms of the web service. PK\n44schemas11/ccv1p1_imsdt_v1p1.xsdnu[ XSD Data File Information ------------------------- Author: Colin Smythe Date: 31st August, 2010 Version: 1.1 Status: Final Description: This is the IMS GLC Discussion Topics Data Model for the Common Cartridge. History: Version 1.0 - the first release of this data model; Version 1.1 - updates made to the namespace. License: IPR, License and Distribution Notices This machine readable file is derived from IMS Global Learning Consortium (GLC) specification IMS Common Cartridge Version 1.1 found at http://www.imsglobal.org/cc and the original IMS GLC schema binding or code base http://www.imsglobal.org/cc. Recipients of this document are requested to submit, with their comments, notification of any relevant patent claims or other intellectual property rights of which they may be aware that might be infringed by the schema binding contained in this document. IMS GLC takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on IMS GLCs procedures with respect to rights in IMS GLC specifications can be found at the IMS GLC Intellectual Property Rights web page: http://www.imsglobal.org/ipr/imsipr_policyFinal.pdf. Copyright (c) IMS Global Learning Consortium 1999-2011. All Rights Reserved. License Notice for Users Users of products or services that include this document are hereby granted a worldwide, royalty-free, non-exclusive license to use this document. Distribution Notice for Developers Developers of products or services that are not original incorporators of this document and have not changed this document, that is, are distributing a software product that incorporates this document as is from a third-party source other than IMS, are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof. Developers of products or services that are original incorporators of this document and wish to provide distribution of this document as is or with modifications and developers of products and services that are not original incorporators of this document and have changed this document, are required to register with the IMS GLC community on the IMS GLC website as described in the following two paragraphs:- * If you wish to distribute this document as is, with no modifications, you are hereby granted permission to copy, display and distribute the contents of this document in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid license registration with IMS and receive an email from IMS granting the license. To register, follow the instructions on the IMS website: http://www.imsglobal.org/specificationdownload.cfm. Once registered you are granted permission to transfer unlimited distribution rights of this document for the purposes of third-party or other distribution of your product or service that incorporates this document as long as this IPR, License and Distribution notice remains in place in its entirety; * If you wish to create and distribute a derived work from this document, you are hereby granted permission to copy, display and distribute the contents of the derived work in any medium for any purpose without fee or royalty provided that you include this IPR, License and Distribution notice in its entirety on ALL copies, or portions thereof, that you make and you complete a valid profile registration with IMS GLC and receive an email from IMS GLC granting the license. To register, follow the instructions on the IMS GLC website: http://www.imsglobal.org/profile/. Once registered you are granted permission to transfer unlimited distribution rights of the derived work for the purposes of third-party or other distribution of your product or service that incorporates the derived work as long as this IPR, License and Distribution notice remains in place in its entirety. The limited permissions granted above are perpetual and will not be revoked by IMS GLC or its successors or assigns. THIS SPECIFICATION IS BEING OFFERED WITHOUT ANY WARRANTY WHATSOEVER, AND IN PARTICULAR, ANY WARRANTY OF NONINFRINGEMENT IS EXPRESSLY DISCLAIMED. ANY USE OF THIS SPECIFICATION SHALL BE MADE ENTIRELY AT THE IMPLEMENTERS OWN RISK, AND NEITHER THE CONSORTIUM NOR ANY OF ITS MEMBERS OR SUBMITTERS, SHALL HAVE ANY LIABILITY WHATSOEVER TO ANY IMPLEMENTER OR THIRD PARTY FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, DIRECTLY OR INDIRECTLY, ARISING FROM THE USE OF THIS SPECIFICATION. Source UML File Information --------------------------- The source file information must be supplied as an XMI file (without diagram layout information). The supported UML authoring tools are: (a) Poseidon – v6 (and later) Source XSLT File Information ---------------------------- XSL Generator: UMLtoXSDTransformv0p9.xsl XSLT Processor: Xalan Release: 1.0 Beta 3 Date: 31st May, 2009 IMS GLC Auto-generation Binding Tool-kit (I-BAT) ------------------------------------------------ This file was auto-generated using the IMS GLC Binding Auto-generation Tool-kit (I-BAT). While every attempt has been made to ensure that this tool auto-generates the files correctly, users should be aware that this is an experimental tool. Permission is given to make use of this tool. IMS GLC makes no claim on the materials created by third party users of this tool. Details on how to use this tool are contained in the IMS GLC "I-BAT" Documentation available at the IMS GLC web-site. Tool Copyright: 2005-2010 (c) IMS Global Learning Consortium Inc. All Rights Reserved. Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. The extension has a definition of "strict" i.e. they must have their own namespace. The Topic complexType for the discussion topic object. The Text for the discussion topic. PK\޶FFentity.forum.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc_forum extends entities { public function full_path($path, $dir_sep = DIRECTORY_SEPARATOR) { $token = '$IMS-CC-FILEBASE$'; $path = str_replace($token, '', $path); if (is_string($path) && ($path != '')) { $dir_sep; $dot_dir = '.'; $up_dir = '..'; $length = strlen($path); $rtemp = trim($path); $start = strrpos($path, $dir_sep); $can_continue = ($start !== false); $result = $can_continue ? '' : $path; $rcount = 0; while ($can_continue) { $dir_part = ($start !== false) ? substr($rtemp, $start + 1, $length - $start) : $rtemp; $can_continue = ($dir_part !== false); if ($can_continue) { if ($dir_part != $dot_dir) { if ($dir_part == $up_dir) { $rcount++; } else { if ($rcount > 0) { $rcount --; } else { $result = ($result == '') ? $dir_part : $dir_part . $dir_sep . $result; } } } $rtemp = substr($path, 0, $start); $start = strrpos($rtemp, $dir_sep); $can_continue = (($start !== false) || (strlen($rtemp) > 0)); } } } return $result; } public function generate_node() { cc2moodle::log_action('Creating Forum mods'); $response = ''; if (!empty(cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM])) { foreach (cc2moodle::$instances['instances'][MOODLE_TYPE_FORUM] as $instance) { $response .= $this->create_node_course_modules_mod_forum($instance); } } return $response; } private function create_node_course_modules_mod_forum($instance) { $sheet_mod_forum = cc2moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_FORUM); $topic_data = $this->get_topic_data($instance); $result = ''; if (!empty($topic_data)) { $find_tags = array('[#mod_instance#]', '[#mod_forum_title#]', '[#mod_forum_intro#]', '[#date_now#]'); $replace_values = array($instance['instance'], //To be more true to the actual forum name we use only forum title self::safexml($topic_data['title']), self::safexml($topic_data['description']), time()); $result = str_replace($find_tags, $replace_values, $sheet_mod_forum); } return $result; } public function get_topic_data($instance) { $topic_data = array(); $topic_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($topic_file)) { $topic_file_path = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $topic_file; $topic_file_dir = dirname($topic_file_path); $topic = $this->load_xml_resource($topic_file_path); if (!empty($topic)) { $xpath = cc2moodle::newx_path($topic, cc2moodle::getforumns()); $topic_title = $xpath->query('/dt:topic/title'); $topic_title = !empty($topic_title->item(0)->nodeValue) ? $topic_title->item(0)->nodeValue : 'Untitled Topic'; $topic_text = $xpath->query('/dt:topic/text'); $topic_text = !empty($topic_text->item(0)->nodeValue) ? $this->update_sources($topic_text->item(0)->nodeValue, dirname($topic_file)) : ''; $topic_text = !empty($topic_text) ? str_replace("%24", "\$", $this->include_titles($topic_text)) : ''; if (!empty($topic_title)) { $topic_data['title'] = $topic_title; $topic_data['description'] = $topic_text; } } $topic_attachments = $xpath->query('/dt:topic/attachments/attachment/@href'); if ($topic_attachments->length > 0) { $attachment_html = ''; foreach ($topic_attachments as $file) { $attachment_html .= $this->generate_attachment_html($this->full_path($file->nodeValue,'/')); } $topic_data['description'] = !empty($attachment_html) ? $topic_text . '

Attachments:

' . $attachment_html : $topic_text; } } return $topic_data; } private function generate_attachment_html($filename) { $images_extensions = array('gif' , 'jpeg' , 'jpg' , 'jif' , 'jfif' , 'png' , 'bmp'); $fileinfo = pathinfo($filename); if (in_array($fileinfo['extension'], $images_extensions)) { return '' . $fileinfo['basename'] . '
'; } else { return '' . $fileinfo['basename'] . '
'; } return ''; } } PK\Lw%%cc112moodle.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2011 Darko Miletic (dmiletic@moodlerooms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/backup/cc/cc2moodle.php'); require_once($CFG->dirroot . '/backup/cc/entities11.class.php'); require_once($CFG->dirroot . '/backup/cc/entity11.resource.class.php'); require_once($CFG->dirroot . '/backup/cc/entity11.forum.class.php'); require_once($CFG->dirroot . '/backup/cc/entity11.quiz.class.php'); require_once($CFG->dirroot . '/backup/cc/entity11.lti.class.php'); class cc112moodle extends cc2moodle { const CC_TYPE_FORUM = 'imsdt_xmlv1p1'; const CC_TYPE_QUIZ = 'imsqti_xmlv1p2/imscc_xmlv1p1/assessment'; const CC_TYPE_QUESTION_BANK = 'imsqti_xmlv1p2/imscc_xmlv1p1/question-bank'; const CC_TYPE_WEBLINK = 'imswl_xmlv1p1'; const CC_TYPE_ASSOCIATED_CONTENT = 'associatedcontent/imscc_xmlv1p1/learning-application-resource'; const CC_TYPE_BASICLTI = 'imsbasiclti_xmlv1p0'; public static $namespaces = array('imscc' => 'http://www.imsglobal.org/xsd/imsccv1p1/imscp_v1p1', 'lomimscc' => 'http://ltsc.ieee.org/xsd/imsccv1p1/LOM/manifest', 'lom' => 'http://ltsc.ieee.org/xsd/imsccv1p1/LOM/resource', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'cc' => 'http://www.imsglobal.org/xsd/imsccv1p1/imsccauth_v1p1'); public static $restypes = array('associatedcontent/imscc_xmlv1p1/learning-application-resource', 'webcontent'); public static $forumns = array('dt' => 'http://www.imsglobal.org/xsd/imsccv1p1/imsdt_v1p1'); public static $quizns = array('xmlns' => 'http://www.imsglobal.org/xsd/ims_qtiasiv1p2'); public static $resourcens = array('wl' => 'http://www.imsglobal.org/xsd/imsccv1p1/imswl_v1p1'); public static $basicltins = array( 'xmlns' => 'http://www.imsglobal.org/xsd/imslticc_v1p0', 'blti' => 'http://www.imsglobal.org/xsd/imsbasiclti_v1p0', 'lticm' => 'http://www.imsglobal.org/xsd/imslticm_v1p0', 'lticp' => 'http://www.imsglobal.org/xsd/imslticp_v1p0' ); public function __construct($path_to_manifest) { parent::__construct($path_to_manifest); } public function generate_moodle_xml() { global $CFG; $cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files'; if (!file_exists($cdir)) { mkdir($cdir, $CFG->directorypermissions, true); } $sheet_base = static::loadsheet(SHEET_BASE); // MOODLE_BACKUP / INFO / DETAILS / MOD $node_info_details_mod = $this->create_code_info_details_mod(); // MOODLE_BACKUP / BLOCKS / BLOCK $node_course_blocks_block = $this->create_node_course_blocks_block(); // MOODLE_BACKUP / COURSES / SECTIONS / SECTION $node_course_sections_section = $this->create_node_course_sections_section(); // MOODLE_BACKUP / COURSES / QUESTION_CATEGORIES $node_course_question_categories = $this->create_node_question_categories(); // MOODLE_BACKUP / COURSES / MODULES / MOD $node_course_modules_mod = $this->create_node_course_modules_mod(); // MOODLE_BACKUP / COURSE / HEADER $node_course_header = $this->create_node_course_header(); // GENERAL INFO $filename = optional_param('file', 'not_available.zip', PARAM_RAW); $filename = basename($filename); $www_root = $CFG->wwwroot; $find_tags = array('[#zip_filename#]', '[#www_root#]', '[#node_course_header#]', '[#node_info_details_mod#]', '[#node_course_blocks_block#]', '[#node_course_sections_section#]', '[#node_course_question_categories#]', '[#node_course_modules#]'); $replace_values = array($filename, $www_root, $node_course_header, $node_info_details_mod, $node_course_blocks_block, $node_course_sections_section, $node_course_question_categories, $node_course_modules_mod); $result_xml = str_replace($find_tags, $replace_values, $sheet_base); // COPY RESOURSE FILES $entities = new entities11(); $entities->move_all_files(); if (array_key_exists("index", self::$instances)) { if (!file_put_contents(static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) { static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true); } else { $status = true; } } else { $status = false; static::log_action('The course is empty', false); } return $status; } public function convert_to_moodle_type($cc_type) { $type = parent::convert_to_moodle_type($cc_type); if ($type == TYPE_UNKNOWN) { if ($cc_type == static::CC_TYPE_BASICLTI) { $type = MOODLE_TYPE_LTI; } } return $type; } protected function create_node_question_categories() { $quiz = new cc11_quiz(); static::log_action('Creating node: QUESTION_CATEGORIES'); $node_course_question_categories = $quiz->generate_node_question_categories(); return $node_course_question_categories; } protected function create_code_info_details_mod() { $result = parent::create_code_info_details_mod(); $count_blti = $this->count_instances(MOODLE_TYPE_LTI); $sheet_info_details_mod_instances_instance = static::loadsheet(SHEET_INFO_DETAILS_MOD_INSTANCE); $blti_mod = ''; if ($count_blti > 0) { $blti_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_blti, static::$instances['instances'][MOODLE_TYPE_LTI]); $blti_mod = $blti_instance ? $this->create_mod_info_details_mod(MOODLE_TYPE_LTI, $blti_instance) : ''; } return $result . $blti_mod; } /** * (non-PHPdoc) * @see cc2moodle::get_module_visible() */ protected function get_module_visible($identifier) { //Should item be hidden or not $mod_visible = 1; if (!empty($identifier)) { $xpath = static::newx_path(static::$manifest, static::$namespaces); $query = '/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]'; $query .= '//lom:intendedEndUserRole/lom:value'; $intendeduserrole = $xpath->query($query); if (!empty($intendeduserrole) && ($intendeduserrole->length > 0)) { $role = trim($intendeduserrole->item(0)->nodeValue); if ((strcasecmp('Instructor', $role) === 0) || (strcasecmp('Mentor', $role) === 0)) { $mod_visible = 0; } } } return $mod_visible; } protected function create_node_course_modules_mod() { $labels = new cc_label(); $resources = new cc11_resource(); $forums = new cc11_forum(); $quiz = new cc11_quiz(); $basiclti = new cc11_lti(); static::log_action('Creating node: COURSE/MODULES/MOD'); // LABELS $node_course_modules_mod_label = $labels->generate_node(); // RESOURCES (WEB CONTENT AND WEB LINK) $node_course_modules_mod_resource = $resources->generate_node(); // FORUMS $node_course_modules_mod_forum = $forums->generate_node(); // QUIZ $node_course_modules_mod_quiz = $quiz->generate_node_course_modules_mod(); //BasicLTI $node_course_modules_mod_basiclti = $basiclti->generate_node(); $node_course_modules = $node_course_modules_mod_label. $node_course_modules_mod_resource . $node_course_modules_mod_forum . $node_course_modules_mod_quiz . $node_course_modules_mod_basiclti; return $node_course_modules; } } PK\UUentity11.quiz.class.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @copyright 2011 Darko Miletic * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); class cc11_quiz extends entities11 { public function generate_node_question_categories() { $instances = $this->generate_instances(); $node_course_question_categories = $this->create_node_course_question_categories($instances); $node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories; return $node_course_question_categories; } public function generate_node_course_modules_mod() { cc112moodle::log_action('Creating Quiz mods'); $node_course_modules_mod = ''; $instances = $this->generate_instances(); if (!empty($instances)) { foreach ($instances as $instance) { if ($instance['is_question_bank'] == 0) { $node_course_modules_mod .= $this->create_node_course_modules_mod($instance); } } } return $node_course_modules_mod; } private function create_node_course_modules_mod_quiz_feedback() { $sheet_question_mod_feedback = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_FEEDBACK); return $sheet_question_mod_feedback; } private function generate_instances() { $last_instance_id = 0; $last_question_id = 0; $last_answer_id = 0; $instances = array(); $types = array(MOODLE_TYPE_QUIZ, MOODLE_TYPE_QUESTION_BANK); foreach ($types as $type) { if (!empty(cc112moodle::$instances['instances'][$type])) { foreach (cc112moodle::$instances['instances'][$type] as $instance) { if ($type == MOODLE_TYPE_QUIZ) { $is_question_bank = 0; } else { $is_question_bank = 1; } $assessment_file = $this->get_external_xml($instance['resource_indentifier']); if (!empty($assessment_file)) { $assessment = $this->load_xml_resource(cc112moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $assessment_file); if (!empty($assessment)) { $replace_values = array('unlimited' => 0); $questions = $this->get_questions($assessment, $last_question_id, $last_answer_id, dirname($assessment_file), $is_question_bank); $question_count = count($questions); if (!empty($question_count)) { $last_instance_id++; $instances[$instance['resource_indentifier']]['questions'] = $questions; $instances[$instance['resource_indentifier']]['id'] = $last_instance_id; $instances[$instance['resource_indentifier']]['title'] = $instance['title']; $instances[$instance['resource_indentifier']]['is_question_bank'] = $is_question_bank; $instances[$instance['resource_indentifier']]['options']['timelimit'] = $this->get_global_config($assessment, 'qmd_timelimit', 0); $instances[$instance['resource_indentifier']]['options']['max_attempts'] = $this->get_global_config($assessment, 'cc_maxattempts', 0, $replace_values); } } } } } } return $instances; } private function create_node_course_modules_mod($instance) { $sheet_question_mod = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ); $node_course_modules_quiz_question_instances = $this->create_node_course_modules_mod_quiz_question_instances($instance); $node_course_modules_quiz_feedback = $this->create_node_course_modules_mod_quiz_feedback($instance); $questions_strings = $this->get_questions_string($instance); $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $find_tags = array('[#mod_id#]', '[#mod_name#]', '[#mod_intro#]', '[#mod_stamp#]', '[#question_string#]', '[#date_now#]', '[#mod_max_attempts#]', '[#mod_timelimit#]', '[#node_question_instance#]', '[#node_questions_feedback#]'); $replace_values = array($instance['id'], self::safexml($instance['title']), self::safexml($instance['title']), self::safexml($quiz_stamp), self::safexml($questions_strings), time(), $instance['options']['max_attempts'], $instance['options']['timelimit'], $node_course_modules_quiz_question_instances, $node_course_modules_quiz_feedback); //this one has tags $node_question_mod = str_replace($find_tags, $replace_values, $sheet_question_mod); return $node_question_mod; } private function get_global_config($assessment, $option, $default_value, $replace_values = '') { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $metadata = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:qtimetadata/xmlns:qtimetadatafield'); foreach ($metadata as $field) { $field_label = $xpath->query('xmlns:fieldlabel', $field); $field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : ''; if (strtolower($field_label) == strtolower($option)) { $field_entry = $xpath->query('xmlns:fieldentry', $field); $response = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : ''; } } $response = !empty($response) ? trim($response) : ''; if (!empty($replace_values)) { foreach ($replace_values as $key => $value) { $response = ($key == $response) ? $value : $response; } } $response = empty($response) ? $default_value : $response; return $response; } private function create_node_course_modules_mod_quiz_question_instances($instance) { $node_course_module_mod_quiz_questions_instances = ''; $sheet_question_mod_instance = cc112moodle::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_QUESTION_INSTANCE); $find_tags = array('[#question_id#]' , '[#instance_id#]'); if (!empty($instance['questions'])) { foreach ($instance['questions'] as $question) { $replace_values = array($question['id'] , $question['id']); $node_course_module_mod_quiz_questions_instances .= str_replace($find_tags, $replace_values, $sheet_question_mod_instance); } $node_course_module_mod_quiz_questions_instances = str_replace($find_tags, $replace_values, $node_course_module_mod_quiz_questions_instances); } return $node_course_module_mod_quiz_questions_instances; } private function get_questions_string($instance) { $questions_string = ''; if (!empty($instance['questions'])) { foreach ($instance['questions'] as $question) { $questions_string .= $question['id'] . ','; } } $questions_string = !empty($questions_string) ? substr($questions_string, 0, strlen($questions_string) - 1) : ''; return $questions_string; } private function create_node_course_question_categories($instances) { $sheet_question_categories = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES); if (!empty($instances)) { $node_course_question_categories_question_category = ''; foreach ($instances as $instance) { $node_course_question_categories_question_category .= $this->create_node_course_question_categories_question_category($instance); } $find_tags = array('[#node_course_question_categories_question_category#]'); $replace_values = array($node_course_question_categories_question_category); $node_course_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories); } $node_course_question_categories = empty($node_course_question_categories) ? '' : $node_course_question_categories; return $node_course_question_categories; } private function create_node_course_question_categories_question_category($instance) { $sheet_question_categories_quetion_category = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY); $find_tags = array('[#quiz_id#]', '[#quiz_name#]', '[#quiz_stamp#]', '[#node_course_question_categories_question_category_questions#]'); $node_course_question_categories_questions = $this->create_node_course_question_categories_question_category_question($instance); $node_course_question_categories_questions = empty($node_course_question_categories_questions) ? '' : $node_course_question_categories_questions; $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $replace_values = array($instance['id'], self::safexml($instance['title']), $quiz_stamp, $node_course_question_categories_questions); $node_question_categories = str_replace($find_tags, $replace_values, $sheet_question_categories_quetion_category); return $node_question_categories; } private function create_node_course_question_categories_question_category_question($instance) { global $USER; $node_course_question_categories_question = ''; $find_tags = array('[#question_id#]', '[#question_title#]', '[#question_text#]', '[#question_type#]', '[#question_general_feedback#]', '[#question_defaultgrade#]', '[#date_now#]', '[#question_type_nodes#]', '[#question_stamp#]', '[#question_version#]', '[#logged_user#]'); $sheet_question_categories_question = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION); $questions = $instance['questions']; if (!empty($questions)) { foreach ($questions as $question) { $quiz_stamp = 'localhost+' . time() . '+' . $this->generate_random_string(6); $quiz_version = 'localhost+' . time() . '+' . $this->generate_random_string(6); $question_moodle_type = $question['moodle_type']; $question_cc_type = $question['cc_type']; $question_type_node = ''; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_MULTIPLE_CHOICE) ? $this->create_node_course_question_categories_question_category_question_multiple_choice($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_TRUE_FALSE) ? $this->create_node_course_question_categories_question_category_question_true_false($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_ESSAY) ? $this->create_node_course_question_categories_question_category_question_eesay($question) : $question_type_node; $question_type_node = ($question_moodle_type == MOODLE_QUIZ_SHORTANSWER) ? $this->create_node_course_question_categories_question_category_question_shortanswer($question) : $question_type_node; $questionname = !empty($question['name']) ? self::safexml($question['name']) : self::safexml($this->truncate_text($question['title'], 255, true)); $replace_values = array($question['id'], $questionname, self::safexml($question['title']), $question_moodle_type, self::safexml($question['feedback']), $question['defaultgrade'], time(), $question_type_node, $quiz_stamp, $quiz_version, $USER->id); $node_course_question_categories_question .= str_replace($find_tags, $replace_values, $sheet_question_categories_question); } } $node_course_question_categories_question = empty($node_course_question_categories_question) ? '' : $node_course_question_categories_question; return $node_course_question_categories_question; } private function get_questions($assessment, &$last_question_id, &$last_answer_id, $root_path, $is_question_bank) { $questions = array(); $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); if (!$is_question_bank) { $questions_items = $xpath->query('/xmlns:questestinterop/xmlns:assessment/xmlns:section/xmlns:item'); } else { $questions_items = $xpath->query('/xmlns:questestinterop/xmlns:objectbank/xmlns:item'); } foreach ($questions_items as $question_item) { $count_questions = $xpath->evaluate('count(xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext)', $question_item); if ($count_questions == 0) { $question_title = $xpath->query('xmlns:presentation/xmlns:material/xmlns:mattext', $question_item); } else { $question_title = $xpath->query('xmlns:presentation/xmlns:flow/xmlns:material/xmlns:mattext', $question_item); } $question_title = !empty($question_title->item(0)->nodeValue) ? $question_title->item(0)->nodeValue : ''; $question_identifier = $xpath->query('@ident', $question_item); $question_identifier = !empty($question_identifier->item(0)->nodeValue) ? $question_identifier->item(0)->nodeValue : ''; if (!empty($question_identifier)) { $question_type = $this->get_question_type($question_identifier, $assessment); if (!empty($question_type['moodle'])) { $last_question_id++; $questions[$question_identifier]['id'] = $last_question_id; $question_title = $this->update_sources($question_title, $root_path); $question_title = !empty($question_title) ? str_replace("%24", "\$", $this->include_titles($question_title)) : ''; // This attribute is not IMSCC spec, but it is included in Moodle 2.x export of IMS1.1 $questionname = $xpath->query('@title', $question_item); $questionname = !empty($questionname->item(0)->nodeValue) ? $questionname->item(0)->nodeValue : ''; $questions[$question_identifier]['title'] = $question_title; $questions[$question_identifier]['name'] = $questionname; $questions[$question_identifier]['identifier'] = $question_identifier; $questions[$question_identifier]['moodle_type'] = $question_type['moodle']; $questions[$question_identifier]['cc_type'] = $question_type['cc']; $questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier); $questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier); $questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id); } } } $questions = !empty($questions) ? $questions : ''; return $questions; } private function str_replace_once($search, $replace, $subject) { $first_char = strpos($subject, $search); if ($first_char !== false) { $before_str = substr($subject, 0, $first_char); $after_str = substr($subject, $first_char + strlen($search)); return $before_str . $replace . $after_str; } else { return $subject; } } private function get_defaultgrade($assessment, $question_identifier) { $result = 1; $xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns()); $query = '//xmlns:item[@ident="' . $question_identifier . '"]'; $query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry'; $defgrade = $xpath->query($query); if (!empty($defgrade) && ($defgrade->length > 0)) { $resp = (int)$defgrade->item(0)->nodeValue; if ($resp >= 0 && $resp <= 99) { $result = $resp; } } return $result; } private function get_general_feedback($assessment, $question_identifier) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $respconditions = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($respconditions)) { foreach ($respconditions as $respcondition) { $continue = $respcondition->getAttributeNode('continue'); $continue = !empty($continue->nodeValue) ? strtolower($continue->nodeValue) : ''; if ($continue == 'yes') { $display_feedback = $xpath->query('xmlns:displayfeedback', $respcondition); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } return $feedback; } private function get_feedback($assessment, $identifier, $item_identifier, $question_type) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $resource_processing = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($resource_processing)) { foreach ($resource_processing as $response) { $varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response); $varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : ''; if (strtolower($varequal) == strtolower($identifier) || ($question_type == CC_QUIZ_ESSAY)) { $display_feedback = $xpath->query('xmlns:displayfeedback', $response); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $item_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } return $feedback; } private function get_answers_fib($question_identifier, $identifier, $assessment, &$last_answer_id) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $correctanswersfib = array(); $incorrectanswersfib = array(); $response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); $correctrespcond = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition/xmlns:setvar[text()="100"]/..'); $correctanswers = $xpath->query('xmlns:conditionvar/xmlns:varequal', $correctrespcond->item(0)); // Correct answers. foreach ($correctanswers as $correctans) { $answertitle = !empty($correctans->nodeValue) ? $correctans->nodeValue : ''; if (empty($answertitle)) { continue; } $last_answer_id++; $correctanswersfib[$answertitle] = array( 'id' => $last_answer_id, 'title' => $answertitle, 'score' => 1, 'feedback' => '', 'case' => 0); } // Handle incorrect answers and feedback for all items. foreach ($response_items as $response_item) { $setvar = $xpath->query('xmlns:setvar', $response_item); if (!empty($setvar->length) && $setvar->item(0)->nodeValue == '100') { // Skip the correct answer responsecondition. continue; } $varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response_item); if (empty($varequal->length)) { // Skip respcondition elements that don't have varequal containing an answer continue; } $answer_title = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : ''; $display_feedback = $xpath->query('xmlns:displayfeedback', $response_item); unset($feedbacks_identifiers); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } if (array_key_exists($answer_title, $correctanswersfib)) { // Already a correct answer, just need the feedback for the correct answer. $correctanswerfib[$answer_title]['feedback'] = $feedback; } else { // Need to add an incorrect answer. $last_answer_id++; $incorrectanswersfib[] = array( 'id' => $last_answer_id, 'title' => $answer_title, 'score' => 0, 'feedback' => $feedback, 'case' => 0); } } $answers_fib = array_merge($correctanswersfib, $incorrectanswersfib); $answers_fib = empty($answers_fib) ? '' : $answers_fib; return $answers_fib; } private function get_answers_pattern_match($question_identifier, $identifier, $assessment, &$last_answer_id) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $answers_fib = array(); $response_items = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); foreach ($response_items as $response_item) { $setvar = $xpath->query('xmlns:setvar', $response_item); $setvar = is_object($setvar->item(0)) ? $setvar->item(0)->nodeValue : ''; if ($setvar != '') { $last_answer_id++; $answer_title = $xpath->query('xmlns:conditionvar/xmlns:varequal[@respident="' . $identifier . '"]', $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : ''; if (empty($answer_title)) { $answer_title = $xpath->query('xmlns:conditionvar/xmlns:varsubstring[@respident="' . $identifier . '"]', $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? '*' . $answer_title->item(0)->nodeValue . '*' : ''; } if (empty($answer_title)) { $answer_title = '*'; } $case = $xpath->query('xmlns:conditionvar/xmlns:varequal/@case', $response_item); $case = is_object($case->item(0)) ? $case->item(0)->nodeValue : 'no' ; $case = strtolower($case) == 'yes' ? 1 : 0; $display_feedback = $xpath->query('xmlns:displayfeedback', $response_item); unset($feedbacks_identifiers); if (!empty($display_feedback)) { foreach ($display_feedback as $feedback) { $feedback_identifier = $feedback->getAttributeNode('linkrefid'); $feedback_identifier = !empty($feedback_identifier->nodeValue) ? $feedback_identifier->nodeValue : ''; if (!empty($feedback_identifier)) { $feedbacks_identifiers[] = $feedback_identifier; } } } $feedback = ''; $feedbacks_identifiers = empty($feedbacks_identifiers) ? '' : $feedbacks_identifiers; if (!empty($feedbacks_identifiers)) { foreach ($feedbacks_identifiers as $feedback_identifier) { $feedbacks = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:itemfeedback[@ident="' . $feedback_identifier . '"]/xmlns:flow_mat/xmlns:material/xmlns:mattext'); $feedback .= !empty($feedbacks->item(0)->nodeValue) ? $feedbacks->item(0)->nodeValue . ' ' : ''; } } $answers_fib[] = array('id' => $last_answer_id, 'title' => $answer_title, 'score' => $setvar, 'feedback' => $feedback, 'case' => $case); } } $answers_fib = empty($answers_fib) ? '' : $answers_fib; return $answers_fib; } private function get_answers($identifier, $assessment, &$last_answer_id) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $answers = array(); $question_cc_type = $this->get_question_type($identifier, $assessment); $question_cc_type = $question_cc_type['cc']; $is_multiresponse = ($question_cc_type == CC_QUIZ_MULTIPLE_RESPONSE); if ($question_cc_type == CC_QUIZ_MULTIPLE_CHOICE || $is_multiresponse || $question_cc_type == CC_QUIZ_TRUE_FALSE) { $query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_lid/xmlns:render_choice/xmlns:response_label'; $query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_lid/xmlns:render_choice/xmlns:response_label'; $query_indentifer = '@ident'; $query_title = 'xmlns:material/xmlns:mattext'; } if ($question_cc_type == CC_QUIZ_ESSAY) { $query_answers = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str'; $query_answers_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str'; $query_indentifer = '@ident'; $query_title = 'xmlns:render_fib'; } if ($question_cc_type == CC_QUIZ_FIB || $question_cc_type == CC_QUIZ_PATTERN_MACHT) { $xpath_query = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:response_str/@ident'; $xpath_query_with_flow = '//xmlns:item[@ident="' . $identifier . '"]/xmlns:presentation/xmlns:flow/xmlns:response_str/@ident'; $count_response = $xpath->evaluate('count(' . $xpath_query_with_flow . ')'); if ($count_response == 0) { $answer_identifier = $xpath->query($xpath_query); } else { $answer_identifier = $xpath->query($xpath_query_with_flow); } $answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : ''; if ($question_cc_type == CC_QUIZ_FIB) { $answers = $this->get_answers_fib ($identifier, $answer_identifier, $assessment, $last_answer_id); } else { $answers = $this->get_answers_pattern_match ($identifier, $answer_identifier, $assessment, $last_answer_id); } } else { $count_response = $xpath->evaluate('count(' . $query_answers_with_flow . ')'); if ($count_response == 0) { $response_items = $xpath->query($query_answers); } else { $response_items = $xpath->query($query_answers_with_flow); } if (!empty($response_items)) { if ($is_multiresponse) { $correct_answer_score = 0; //get the correct answers count $canswers_query = "//xmlns:item[@ident='{$identifier}']//xmlns:setvar[@varname='SCORE'][.=100]/../xmlns:conditionvar//xmlns:varequal[@case='Yes'][not(parent::xmlns:not)]"; $canswers = $xpath->query($canswers_query); if ($canswers->length > 0) { $correct_answer_score = round(1.0 / (float)$canswers->length, 7); //weird $correct_answers_ident = array(); foreach ($canswers as $cnode) { $correct_answers_ident[$cnode->nodeValue] = true; } } } foreach ($response_items as $response_item) { $last_answer_id++; $answer_identifier = $xpath->query($query_indentifer, $response_item); $answer_identifier = !empty($answer_identifier->item(0)->nodeValue) ? $answer_identifier->item(0)->nodeValue : ''; $answer_title = $xpath->query($query_title, $response_item); $answer_title = !empty($answer_title->item(0)->nodeValue) ? $answer_title->item(0)->nodeValue : ''; $answer_feedback = $this->get_feedback($assessment, $answer_identifier, $identifier, $question_cc_type); $answer_score = $this->get_score($assessment, $answer_identifier, $identifier); if ($is_multiresponse && isset($correct_answers_ident[$answer_identifier])) { $answer_score = $correct_answer_score; } $answers[] = array('id' => $last_answer_id, 'title' => $answer_title, 'score' => $answer_score, 'identifier' => $answer_identifier, 'feedback' => $answer_feedback); } } } $answers = empty($answers) ? '' : $answers; return $answers; } private function get_score($assessment, $identifier, $question_identifier) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $resource_processing = $xpath->query('//xmlns:item[@ident="' . $question_identifier . '"]/xmlns:resprocessing/xmlns:respcondition'); if (!empty($resource_processing)) { foreach ($resource_processing as $response) { $question_cc_type = $this->get_question_type($question_identifier, $assessment); $question_cc_type = $question_cc_type['cc']; $varequal = $xpath->query('xmlns:conditionvar/xmlns:varequal', $response); $varequal = !empty($varequal->item(0)->nodeValue) ? $varequal->item(0)->nodeValue : ''; if (strtolower($varequal) == strtolower($identifier)) { $score = $xpath->query('xmlns:setvar', $response); $score = !empty($score->item(0)->nodeValue) ? $score->item(0)->nodeValue : ''; } } } // This method (get_score) is only used by T/F & M/C questions in CC, therefore it's either 0 or 1 in Moodle. $score = empty($score) ? "0.0000000" : '1.0000000'; return $score; } private function create_node_course_question_categories_question_category_question_multiple_choice($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_MULTIPLE_CHOICE); if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $answer_string = $this->get_answers_string($question['answers']); $is_single = ($question['cc_type'] == CC_QUIZ_MULTIPLE_CHOICE) ? 1 : 0; $find_tags = array('[#node_course_question_categories_question_category_question_answer#]', '[#answer_string#]', '[#is_single#]'); $replace_values = array($node_course_question_categories_question_answer, self::safexml($answer_string), $is_single); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_eesay($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_EESAY); if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $find_tags = array('[#node_course_question_categories_question_category_question_answer#]'); $replace_values = array($node_course_question_categories_question_answer); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_shortanswer($question) { //, &$fib_questions) { $sheet_question_categories_question = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_SHORTANSWER); $node_course_question_categories_question_answer = ''; if (!empty($question['answers'])) { foreach ($question['answers'] as $answer) { $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } } $answers_string = $this->get_answers_string($question['answers']); $use_case = 0; foreach ($question['answers'] as $answer) { if ($answer['case'] == 1) { $use_case = 1; } } $find_tags = array('[#answers_string#]', '[#use_case#]', '[#node_course_question_categories_question_category_question_answer#]'); $replace_values = array(self::safexml($answers_string), self::safexml($use_case), $node_course_question_categories_question_answer); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function create_node_course_question_categories_question_category_question_true_false($question) { $node_course_question_categories_question_answer = ''; $sheet_question_categories_question = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_TRUE_FALSE); $trueanswer = null; $falseanswer = null; if (!empty($question['answers'])) { // Identify the true and false answers. foreach ($question['answers'] as $answer) { if ($answer['identifier'] == 'true') { $trueanswer = $answer; } else if ($answer['identifier'] == 'false') { $falseanswer = $answer; } else { // Should not happen, but just in case. throw new coding_exception("Unknown answer identifier detected " . "in true/false quiz question with id {$question['id']}."); } $node_course_question_categories_question_answer .= $this->create_node_course_question_categories_question_category_question_answer($answer); } // Make sure the true and false answer was found. if (is_null($trueanswer) || is_null($falseanswer)) { throw new coding_exception("Unable to correctly identify the " . "true and false answers in the question with id {$question['id']}."); } } $find_tags = array('[#node_course_question_categories_question_category_question_answer#]', '[#true_answer_id#]', '[#false_answer_id#]'); $replace_values = array($node_course_question_categories_question_answer, $trueanswer['id'], $falseanswer['id']); $node_question_categories_question = str_replace($find_tags, $replace_values, $sheet_question_categories_question); return $node_question_categories_question; } private function get_answers_string($answers) { $answer_string = ''; if (!empty($answers)) { foreach ($answers as $answer) { $answer_string .= $answer['id'] . ','; } } $answer_string = !empty($answer_string) ? substr($answer_string, 0, strlen($answer_string) - 1) : ''; return $answer_string; } private function create_node_course_question_categories_question_category_question_answer($answer) { $sheet_question_categories_question_answer = cc112moodle::loadsheet(SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_ANSWER); $find_tags = array('[#answer_id#]', '[#answer_text#]', '[#answer_score#]', '[#answer_feedback#]'); $replace_values = array($answer['id'], self::safexml($answer['title']), $answer['score'], self::safexml($answer['feedback'])); $node_question_categories_question_answer = str_replace($find_tags, $replace_values, $sheet_question_categories_question_answer); return $node_question_categories_question_answer; } private function get_question_type($identifier, $assessment) { $xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns()); $metadata = $xpath->query('//xmlns:item[@ident="' . $identifier . '"]/xmlns:itemmetadata/xmlns:qtimetadata/xmlns:qtimetadatafield'); foreach ($metadata as $field) { $field_label = $xpath->query('xmlns:fieldlabel', $field); $field_label = !empty($field_label->item(0)->nodeValue) ? $field_label->item(0)->nodeValue : ''; if ($field_label == 'cc_profile') { $field_entry = $xpath->query('xmlns:fieldentry', $field); $type = !empty($field_entry->item(0)->nodeValue) ? $field_entry->item(0)->nodeValue : ''; } } $return_type = array(); $return_type['moodle'] = ''; $return_type['cc'] = $type; if ($type == CC_QUIZ_MULTIPLE_CHOICE) { $return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE; } if ($type == CC_QUIZ_MULTIPLE_RESPONSE) { $return_type['moodle'] = MOODLE_QUIZ_MULTIPLE_CHOICE; } if ($type == CC_QUIZ_TRUE_FALSE) { $return_type['moodle'] = MOODLE_QUIZ_TRUE_FALSE; } if ($type == CC_QUIZ_ESSAY) { $return_type['moodle'] = MOODLE_QUIZ_ESSAY; } if ($type == CC_QUIZ_FIB) { $return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER; } if ($type == CC_QUIZ_PATTERN_MACHT) { $return_type['moodle'] = MOODLE_QUIZ_SHORTANSWER; } return $return_type; } } PK\7fincludes/constants.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); // GENERAL PARAMETERS ************************************************************************************************* // define('ROOT_DEEP', 2); // PACKAGES FORMATS *************************************************************************************************** // define('FORMAT_UNKNOWN', 'NA'); define('FORMAT_COMMON_CARTRIDGE', 'CC'); define('FORMAT_BLACK_BOARD', 'BB'); // FORMATS NAMESPACES ************************************************************************************************* // define('NS_COMMON_CARTRIDGE', 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1'); define('NS_BLACK_BOARD', 'http://www.blackboard.com/content-packaging'); // SHEET FILES ******************************************************************************************************** // define('SHEET_BASE', 'cc/sheets/base.xml'); define('SHEET_INFO_DETAILS_MOD', 'cc/sheets/info_details_mod.xml'); define('SHEET_INFO_DETAILS_MOD_INSTANCE', 'cc/sheets/info_details_mod_instance.xml'); define('SHEET_COURSE_BLOCKS_BLOCK', 'cc/sheets/course_blocks_block.xml'); define('SHEET_COURSE_HEADER', 'cc/sheets/course_header.xml'); define('SHEET_COURSE_SECTIONS_SECTION', 'cc/sheets/course_sections_section.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD', 'cc/sheets/course_sections_section_mods_mod.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_FORUM', 'cc/sheets/course_modules_mod_forum.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LABEL', 'cc/sheets/course_modules_mod_label.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_RESOURCE', 'cc/sheets/course_modules_mod_resource.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ', 'cc/sheets/course_modules_mod_quiz.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_QUESTION_INSTANCE', 'cc/sheets/course_modules_mod_quiz_question_instance.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_QUIZ_FEEDBACK', 'cc/sheets/course_modules_mod_quiz_feedback.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES', 'cc/sheets/course_question_categories.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY', 'cc/sheets/course_question_categories_question_category.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION', 'cc/sheets/course_question_categories_question_category_question.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_MULTIPLE_CHOICE', 'cc/sheets/course_question_categories_question_category_question_multiple_choice.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_TRUE_FALSE', 'cc/sheets/course_question_categories_question_category_question_true_false.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_EESAY', 'cc/sheets/course_question_categories_question_category_question_eesay.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_SHORTANSWER', 'cc/sheets/course_question_categories_question_category_question_shortanswer.xml'); define('SHEET_COURSE_QUESTION_CATEGORIES_QUESTION_CATEGORY_QUESTION_ANSWER', 'cc/sheets/course_question_categories_question_category_question_answer.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_BASICLTI', 'cc/sheets/course_modules_mod_basiclti.xml'); define('SHEET_COURSE_SECTIONS_SECTION_MODS_MOD_LTI', 'cc/sheets/course_modules_mod_lti.xml'); // CC RESOURCES TYPE ************************************************************************************************** // define('CC_TYPE_FORUM', 'imsdt_xmlv1p0'); define('CC_TYPE_QUIZ', 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment'); define('CC_TYPE_QUESTION_BANK', 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank'); define('CC_TYPE_WEBLINK', 'imswl_xmlv1p0'); define('CC_TYPE_WEBCONTENT', 'webcontent'); define('CC_TYPE_ASSOCIATED_CONTENT', 'associatedcontent/imscc_xmlv1p0/learning-application-resource'); define('CC_TYPE_EMPTY', ''); // MOODLE RESOURCES TYPE ********************************************************************************************** // define('MOODLE_TYPE_FORUM', 'forum'); define('MOODLE_TYPE_QUIZ', 'quiz'); define('MOODLE_TYPE_QUESTION_BANK', 'question_bank'); define('MOODLE_TYPE_RESOURCE', 'resource'); define('MOODLE_TYPE_LABEL', 'label'); define('MOODLE_TYPE_BASICLTI', 'basiclti'); define('MOODLE_TYPE_LTI', 'lti'); // UNKNOWN TYPE ******************************************************************************************************* // define('TYPE_UNKNOWN', '[UNKNOWN]'); // CC QUESTIONS TYPES ************************************************************************************************* // define('CC_QUIZ_MULTIPLE_CHOICE', 'cc.multiple_choice.v0p1'); define('CC_QUIZ_TRUE_FALSE', 'cc.true_false.v0p1'); define('CC_QUIZ_FIB', 'cc.fib.v0p1'); define('CC_QUIZ_MULTIPLE_RESPONSE', 'cc.multiple_response.v0p1'); define('CC_QUIZ_PATTERN_MACHT', 'cc.pattern_match.v0p1'); define('CC_QUIZ_ESSAY', 'cc.essay.v0p1'); //MOODLE QUESTIONS TYPES ********************************************************************************************** // define('MOODLE_QUIZ_MULTIPLE_CHOICE', 'multichoice'); define('MOODLE_QUIZ_TRUE_FALSE', 'truefalse'); define('MOODLE_QUIZ_MULTIANSWER', 'multianswer'); define('MOODLE_QUIZ_MULTIPLE_RESPONSE', 'multichoice'); define('MOODLE_QUIZ_MACHT', 'match'); define('MOODLE_QUIZ_ESSAY', 'essay'); define('MOODLE_QUIZ_SHORTANSWER', 'shortanswer'); PK\} btbt cc2moodle.phpnu[. /** * @package moodlecore * @subpackage backup-imscc * @copyright 2009 Mauro Rondinelli (mauro.rondinelli [AT] uvcms.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.'); require_once($CFG->dirroot . '/backup/cc/entities.class.php'); require_once($CFG->dirroot . '/backup/cc/entity.label.class.php'); require_once($CFG->dirroot . '/backup/cc/entity.resource.class.php'); require_once($CFG->dirroot . '/backup/cc/entity.forum.class.php'); require_once($CFG->dirroot . '/backup/cc/entity.quiz.class.php'); class cc2moodle { const CC_TYPE_FORUM = 'imsdt_xmlv1p0'; const CC_TYPE_QUIZ = 'imsqti_xmlv1p2/imscc_xmlv1p0/assessment'; const CC_TYPE_QUESTION_BANK = 'imsqti_xmlv1p2/imscc_xmlv1p0/question-bank'; const CC_TYPE_WEBLINK = 'imswl_xmlv1p0'; const CC_TYPE_WEBCONTENT = 'webcontent'; const CC_TYPE_ASSOCIATED_CONTENT = 'associatedcontent/imscc_xmlv1p0/learning-application-resource'; const CC_TYPE_EMPTY = ''; public static $restypes = array('associatedcontent/imscc_xmlv1p0/learning-application-resource', 'webcontent'); public static $forumns = array('dt' => 'http://www.imsglobal.org/xsd/imsdt_v1p0'); public static $quizns = array('xmlns' => 'http://www.imsglobal.org/xsd/ims_qtiasiv1p2'); public static $resourcens = array('wl' => 'http://www.imsglobal.org/xsd/imswl_v1p0'); /** * * @return array */ public static function getquizns() { return static::$quizns; } /** * * @return array */ public static function getforumns() { return static::$forumns; } /** * * @return array */ public static function getresourcens() { return static::$resourcens; } public static function get_manifest($folder) { if (!is_dir($folder)) { return false; } // Before iterate over directories, try to find one manifest at top level if (file_exists($folder . '/imsmanifest.xml')) { return $folder . '/imsmanifest.xml'; } $result = false; try { $dirIter = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::KEY_AS_PATHNAME); $recIter = new RecursiveIteratorIterator($dirIter, RecursiveIteratorIterator::CHILD_FIRST); foreach ($recIter as $info) { if ($info->isFile() && ($info->getFilename() == 'imsmanifest.xml')) { $result = $info->getPathname(); break; } } } catch (Exception $e) {} return $result; } public static $instances = array(); public static $manifest; public static $path_to_manifest_folder; public static $namespaces = array('imscc' => 'http://www.imsglobal.org/xsd/imscc/imscp_v1p1', 'lomimscc' => 'http://ltsc.ieee.org/xsd/imscc/LOM', 'lom' => 'http://ltsc.ieee.org/xsd/LOM', 'voc' => 'http://ltsc.ieee.org/xsd/LOM/vocab', 'xsi' => 'http://www.w3.org/2001/XMLSchema-instance', 'cc' => 'http://www.imsglobal.org/xsd/imsccauth_v1p0'); function __construct($path_to_manifest) { static::$manifest = new DOMDocument(); static::$manifest->validateOnParse = false; static::$path_to_manifest_folder = dirname($path_to_manifest); static::log_action('Proccess start'); static::log_action('Load the manifest file: ' . $path_to_manifest); if (!static::$manifest->load($path_to_manifest, LIBXML_NONET)) { static::log_action('Cannot load the manifest file: ' . $path_to_manifest, true); } } public function is_auth() { $xpath = static::newx_path(static::$manifest, static::$namespaces); $count_auth = $xpath->evaluate('count(/imscc:manifest/cc:authorizations)'); if ($count_auth > 0) { $response = true; } else { $response = false; } return $response; } protected function get_metadata($section, $key) { $xpath = static::newx_path(static::$manifest, static::$namespaces); $metadata = $xpath->query('/imscc:manifest/imscc:metadata/lomimscc:lom/lomimscc:' . $section . '/lomimscc:' . $key . '/lomimscc:string'); $value = !empty($metadata->item(0)->nodeValue) ? $metadata->item(0)->nodeValue : ''; return $value; } public function generate_moodle_xml() { global $CFG, $OUTPUT; $cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files'; if (!file_exists($cdir)) { mkdir($cdir, $CFG->directorypermissions, true); } $sheet_base = static::loadsheet(SHEET_BASE); // MOODLE_BACKUP / INFO / DETAILS / MOD $node_info_details_mod = $this->create_code_info_details_mod(); // MOODLE_BACKUP / BLOCKS / BLOCK $node_course_blocks_block = $this->create_node_course_blocks_block(); // MOODLE_BACKUP / COURSES / SECTIONS / SECTION $node_course_sections_section = $this->create_node_course_sections_section(); // MOODLE_BACKUP / COURSES / QUESTION_CATEGORIES $node_course_question_categories = $this->create_node_question_categories(); // MOODLE_BACKUP / COURSES / MODULES / MOD $node_course_modules_mod = $this->create_node_course_modules_mod(); // MOODLE_BACKUP / COURSE / HEADER $node_course_header = $this->create_node_course_header(); // GENERAL INFO $filename = optional_param('file', 'not_available.zip', PARAM_RAW); $filename = basename($filename); $www_root = $CFG->wwwroot; $find_tags = array('[#zip_filename#]', '[#www_root#]', '[#node_course_header#]', '[#node_info_details_mod#]', '[#node_course_blocks_block#]', '[#node_course_sections_section#]', '[#node_course_question_categories#]', '[#node_course_modules#]'); $replace_values = array($filename, $www_root, $node_course_header, $node_info_details_mod, $node_course_blocks_block, $node_course_sections_section, $node_course_question_categories, $node_course_modules_mod); $result_xml = str_replace($find_tags, $replace_values, $sheet_base); // COPY RESOURSE FILES $entities = new entities(); $entities->move_all_files(); if (array_key_exists("index", self::$instances)) { if (!file_put_contents(static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', $result_xml)) { static::log_action('Cannot save the moodle manifest file: ' . static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'moodle.xml', true); } else { $status = true; } } else { $status = false; echo $OUTPUT->notification('The course is empty'); static::log_action('The course is empty', false); } return $status; } protected function get_sections_numbers($instances) { $count = 0; if (array_key_exists("index", $instances)) { foreach ($instances["index"] as $instance) { if ($instance["deep"] == ROOT_DEEP) { $count++; } } } return $count; } protected function create_node_course_header() { $node_course_header = ''; $sheet_course_header = static::loadsheet(SHEET_COURSE_HEADER); $course_title = trim($this->get_metadata('general', 'title')); $course_title = empty($course_title) ? 'Untitled Course' : $course_title; $course_description = $this->get_metadata('general', 'description'); $section_count = $this->get_sections_numbers(static::$instances) - 1; if ($section_count == -1) { $section_count = 0; } if (empty($course_title)) { $this->log_action('The course title not found', true); } $course_short_name = $this->create_course_code($course_title); $find_tags = array('[#course_name#]', '[#course_short_name#]', '[#course_description#]', '[#date_now#]', '[#section_count#]'); $replace_values = array(entities::safexml($course_title), entities::safexml($course_short_name), entities::safexml($course_description), time(), $section_count); $node_course_header = str_replace($find_tags, $replace_values, $sheet_course_header); return $node_course_header; } protected function create_node_question_categories() { $quiz = new cc_quiz(); static::log_action('Creating node: QUESTION_CATEGORIES'); $node_course_question_categories = $quiz->generate_node_question_categories(); return $node_course_question_categories; } protected function create_node_course_modules_mod() { $labels = new cc_label(); $resources = new cc_resource(); $forums = new cc_forum(); $quiz = new cc_quiz(); static::log_action('Creating node: COURSE/MODULES/MOD'); // LABELS $node_course_modules_mod_label = $labels->generate_node(); // RESOURCES (WEB CONTENT AND WEB LINK) $node_course_modules_mod_resource = $resources->generate_node(); // FORUMS $node_course_modules_mod_forum = $forums->generate_node(); // QUIZ $node_course_modules_mod_quiz = $quiz->generate_node_course_modules_mod(); //TODO: label $node_course_modules = $node_course_modules_mod_label . $node_course_modules_mod_resource . $node_course_modules_mod_forum . $node_course_modules_mod_quiz; return $node_course_modules; } protected function create_node_course_sections_section() { static::log_action('Creating node: COURSE/SECTIONS/SECTION'); $node_course_sections_section = ''; $sheet_course_sections_section = static::loadsheet(SHEET_COURSE_SECTIONS_SECTION); $topics = $this->get_nodes_by_criteria('deep', ROOT_DEEP); $i = 0; if (!empty($topics)) { foreach ($topics as $topic) { $i++; $node_node_course_sections_section_mods_mod = $this->create_node_course_sections_section_mods_mod($topic['index']); if ($topic['moodle_type'] == MOODLE_TYPE_LABEL) { $find_tags = array('[#section_id#]', '[#section_number#]', '[#section_summary#]', '[#node_course_sections_section_mods_mod#]'); $replace_values = array($i, $i - 1, entities::safexml($topic['title']), $node_node_course_sections_section_mods_mod); } else { $find_tags = array('[#section_id#]', '[#section_number#]', '[#section_summary#]', '[#node_course_sections_section_mods_mod#]'); $replace_values = array($i, $i - 1, '', $node_node_course_sections_section_mods_mod); } $node_course_sections_section .= str_replace($find_tags, $replace_values, $sheet_course_sections_section); } } return $node_course_sections_section; } protected function create_node_course_blocks_block() { global $CFG; static::log_action('Creating node: COURSE/BLOCKS/BLOCK'); $sheet_course_blocks_block = static::loadsheet(SHEET_COURSE_BLOCKS_BLOCK); $node_course_blocks_block = ''; $format_config = $CFG->dirroot . '/course/format/weeks/config.php'; if (@is_file($format_config) && is_readable($format_config)) { require ($format_config); } if (!empty($format['defaultblocks'])) { $blocknames = $format['defaultblocks']; } else { if (isset($CFG->defaultblocks)) { $blocknames = $CFG->defaultblocks; } else { $blocknames = 'activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity'; } } $blocknames = explode(':', $blocknames); $blocks_left = explode(',', $blocknames[0]); $blocks_right = explode(',', $blocknames[1]); $find_tags = array('[#block_id#]', '[#block_name#]', '[#block_position#]', '[#block_weight#]'); $i = 0; $weight = 0; foreach ($blocks_left as $block) { $i++; $weight++; $replace_values = array($i, $block, 'l', $weight); $node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block); } $weight = 0; foreach ($blocks_right as $block) { $i++; $weight ++; $replace_values = array($i, $block, 'r', $weight); $node_course_blocks_block .= str_replace($find_tags, $replace_values, $sheet_course_blocks_block); } return $node_course_blocks_block; } /** * * Is activity visible or not * @param string $identifier * @return number */ protected function get_module_visible($identifier) { //Should item be hidden or not $mod_visible = 1; if (!empty($identifier)) { $xpath = static::newx_path(static::$manifest, static::$namespaces); $query = '/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]'; $query .= '//lom:intendedEndUserRole/voc:vocabulary/lom:value'; $intendeduserrole = $xpath->query($query); if (!empty($intendeduserrole) && ($intendeduserrole->length > 0)) { $role = trim($intendeduserrole->item(0)->nodeValue); if (strcasecmp('Instructor', $role) == 0) { $mod_visible = 0; } } } return $mod_visible; } protected function create_node_course_sections_section_mods_mod($root_parent) { $sheet_course_sections_section_mods_mod = static::loadsheet(SHEET_COURSE_SECTIONS_SECTION_MODS_MOD); $childs = $this->get_nodes_by_criteria('root_parent', $root_parent); if ($childs) { $node_course_sections_section_mods_mod = ''; foreach ($childs as $child) { if ($child['moodle_type'] == MOODLE_TYPE_LABEL) { if ($child['index'] == $child['root_parent']) { $is_summary = true; } else { $is_summary = false; } } else { $is_summary = false; } if (!$is_summary) { $indent = $child['deep'] - ROOT_DEEP; if ($indent > 0) { $indent = $indent - 1; } $find_tags = array('[#mod_id#]', '[#mod_instance_id#]', '[#mod_type#]', '[#date_now#]', '[#mod_indent#]', '[#mod_visible#]'); $replace_values = array($child['index'], $child['instance'], $child['moodle_type'], time(), $indent, $this->get_module_visible($child['resource_indentifier'])); $node_course_sections_section_mods_mod .= str_replace($find_tags, $replace_values, $sheet_course_sections_section_mods_mod); } } $response = $node_course_sections_section_mods_mod; } else { $response = ''; } return $response; } public function get_nodes_by_criteria($key, $value) { $response = array(); if (array_key_exists('index', static::$instances)) { foreach (static::$instances['index'] as $item) { if ($item[$key] == $value) { $response[] = $item; } } } return $response; } //Modified here protected function create_code_info_details_mod() { static::log_action('Creating node: INFO/DETAILS/MOD'); $xpath = static::newx_path(static::$manifest, static::$namespaces); $items = $xpath->query('/imscc:manifest/imscc:organizations/imscc:organization/imscc:item | /imscc:manifest/imscc:resources/imscc:resource[@type="' . static::CC_TYPE_QUESTION_BANK . '"]'); $this->create_instances($items); $count_quiz = $this->count_instances(MOODLE_TYPE_QUIZ); $count_forum = $this->count_instances(MOODLE_TYPE_FORUM); $count_resource = $this->count_instances(MOODLE_TYPE_RESOURCE); $count_label = $this->count_instances(MOODLE_TYPE_LABEL); $sheet_info_details_mod_instances_instance = static::loadsheet(SHEET_INFO_DETAILS_MOD_INSTANCE); if ($count_resource > 0) { $resource_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_resource, static::$instances['instances'][MOODLE_TYPE_RESOURCE]); } if ($count_quiz > 0) { $quiz_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_quiz, static::$instances['instances'][MOODLE_TYPE_QUIZ]); } if ($count_forum > 0) { $forum_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_forum, static::$instances['instances'][MOODLE_TYPE_FORUM]); } if ($count_label > 0) { $label_instance = $this->create_mod_info_details_mod_instances_instance($sheet_info_details_mod_instances_instance, $count_label, static::$instances['instances'][MOODLE_TYPE_LABEL]); } $resource_mod = $count_resource ? $this->create_mod_info_details_mod(MOODLE_TYPE_RESOURCE, $resource_instance) : ''; $quiz_mod = $count_quiz ? $this->create_mod_info_details_mod(MOODLE_TYPE_QUIZ, $quiz_instance) : ''; $forum_mod = $count_forum ? $this->create_mod_info_details_mod(MOODLE_TYPE_FORUM, $forum_instance) : ''; $label_mod = $count_label ? $this->create_mod_info_details_mod(MOODLE_TYPE_LABEL, $label_instance) : ''; //TODO: label return $label_mod . $resource_mod . $quiz_mod . $forum_mod; } protected function create_mod_info_details_mod($mod_type, $node_info_details_mod_instances_instance) { $sheet_info_details_mod = static::loadsheet(SHEET_INFO_DETAILS_MOD); $find_tags = array('[#mod_type#]' ,'[#node_info_details_mod_instances_instance#]'); $replace_values = array($mod_type , $node_info_details_mod_instances_instance); return str_replace($find_tags, $replace_values, $sheet_info_details_mod); } protected function create_mod_info_details_mod_instances_instance($sheet, $instances_quantity, $instances) { $instance = ''; $find_tags = array('[#mod_instance_id#]', '[#mod_name#]', '[#mod_user_info#]'); for ($i = 1; $i <= $instances_quantity; $i++) { $user_info = ($instances[$i - 1]['common_cartriedge_type'] == static::CC_TYPE_FORUM) ? 'true' : 'false'; if ($instances[$i - 1]['common_cartriedge_type'] == static::CC_TYPE_EMPTY) { if ($instances[$i - 1]['deep'] <= ROOT_DEEP ) { continue; } } $replace_values = array($instances[$i - 1]['instance'], entities::safexml($instances[$i - 1]['title']), $user_info); $instance .= str_replace($find_tags, $replace_values, $sheet); } return $instance; } protected function create_instances($items, $level = 0, &$array_index = 0, $index_root = 0) { $level++; $i = 1; if ($items) { $xpath = self::newx_path(static::$manifest, static::$namespaces); foreach ($items as $item) { $array_index++; if ($item->nodeName == "item") { $identifierref = ''; if ($item->hasAttribute('identifierref')) { $identifierref = $item->getAttribute('identifierref'); } $title = ''; $titles = $xpath->query('imscc:title', $item); if ($titles->length > 0) { $title = $titles->item(0)->nodeValue; } $cc_type = $this->get_item_cc_type($identifierref); $moodle_type = $this->convert_to_moodle_type($cc_type); //Fix the label issue - MDL-33523 if (empty($identifierref) && empty($title)) { $moodle_type = TYPE_UNKNOWN; } } elseif ($item->nodeName == "resource") { $identifierref = $xpath->query('@identifier', $item); $identifierref = !empty($identifierref->item(0)->nodeValue) ? $identifierref->item(0)->nodeValue : ''; $cc_type = $this->get_item_cc_type($identifierref); $moodle_type = $this->convert_to_moodle_type($cc_type); $title = 'Quiz Bank ' . ($this->count_instances($moodle_type) + 1); } if ($level == ROOT_DEEP) { $index_root = $array_index; } static::$instances['index'][$array_index]['common_cartriedge_type'] = $cc_type; static::$instances['index'][$array_index]['moodle_type'] = $moodle_type; static::$instances['index'][$array_index]['title'] = $title ? $title : ''; static::$instances['index'][$array_index]['root_parent'] = $index_root; static::$instances['index'][$array_index]['index'] = $array_index; static::$instances['index'][$array_index]['deep'] = $level; static::$instances['index'][$array_index]['instance'] = $this->count_instances($moodle_type); static::$instances['index'][$array_index]['resource_indentifier'] = $identifierref; static::$instances['instances'][$moodle_type][] = array('title' => $title, 'instance' => static::$instances['index'][$array_index]['instance'], 'common_cartriedge_type' => $cc_type, 'resource_indentifier' => $identifierref, 'deep' => $level); $more_items = $xpath->query('imscc:item', $item); if ($more_items->length > 0) { $this->create_instances($more_items, $level, $array_index, $index_root); } $i++; } } } public function count_instances($type) { $quantity = 0; if (array_key_exists('index', static::$instances)) { if (static::$instances['index'] && $type) { foreach (static::$instances['index'] as $instance) { if (!empty($instance['moodle_type'])) { $types[] = $instance['moodle_type']; } } $quantity_instances = array_count_values($types); $quantity = array_key_exists($type, $quantity_instances) ? $quantity_instances[$type] : 0; } } return $quantity; } public function convert_to_moodle_type($cc_type) { $type = TYPE_UNKNOWN; if ($cc_type == static::CC_TYPE_FORUM) { $type = MOODLE_TYPE_FORUM; } if ($cc_type == static::CC_TYPE_QUIZ) { $type = MOODLE_TYPE_QUIZ; } if ($cc_type == static::CC_TYPE_WEBLINK) { $type = MOODLE_TYPE_RESOURCE; } if ($cc_type == static::CC_TYPE_WEBCONTENT) { $type = MOODLE_TYPE_RESOURCE; } if ($cc_type == static::CC_TYPE_ASSOCIATED_CONTENT) { $type = MOODLE_TYPE_RESOURCE; } if ($cc_type == static::CC_TYPE_QUESTION_BANK) { $type = MOODLE_TYPE_QUESTION_BANK; } //TODO: label if ($cc_type == static::CC_TYPE_EMPTY) { $type = MOODLE_TYPE_LABEL; } return $type; } public function get_item_cc_type($identifier) { $xpath = static::newx_path(static::$manifest, static::$namespaces); $nodes = $xpath->query('/imscc:manifest/imscc:resources/imscc:resource[@identifier="' . $identifier . '"]/@type'); if ($nodes && !empty($nodes->item(0)->nodeValue)) { return $nodes->item(0)->nodeValue; } else { return ''; } } public static function newx_path(DOMDocument $manifest, $namespaces = '') { $xpath = new DOMXPath($manifest); if (!empty($namespaces)) { foreach ($namespaces as $prefix => $ns) { if (!$xpath->registerNamespace($prefix, $ns)) { static::log_action('Cannot register the namespace: ' . $prefix . ':' . $ns, true); } } } return $xpath; } public static function loadsheet($file) { $content = (is_readable($file) && ($content = file_get_contents($file))) ? $content : false; static::log_action('Loading sheet: ' . $file); if (!$content) { static::log_action('Cannot load the xml sheet: ' . $file, true); } static::log_action('Load OK!'); return $content; } public static function log_file() { return static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'cc2moodle.log'; } public static function log_action($text, $critical_error = false) { $full_message = strtoupper(date("j/n/Y g:i:s a")) . " - " . $text . "\r"; file_put_contents(static::log_file(), $full_message, FILE_APPEND); if ($critical_error) { static::critical_error($text); } } protected static function critical_error($text) { $path_to_log = static::log_file(); echo '


A critical error has been found!

' . $text . '

The process has been stopped. Please see the log file for more information.

Log: ' . $path_to_log . '


'; die(); } protected function create_course_code($title) { //Making sure that text of the short name does not go over the DB limit. //and leaving the space to add additional characters by the platform $code = substr(strtoupper(str_replace(' ', '', trim($title))),0,94); return $code; } } PK \-G-G-Dccb726244b12924b146fd2ecb99d5c0d41d0dce15d84681f00c0aab5af9d43a6.phpnu[parent = false; $this->blocks = [ ]; } protected function doDisplay(array $context, array $blocks = []) { // line 1 echo " "; // line 5 ob_start(function () { return ''; }); // line 6 echo _ngettext("%s table", "%s tables", abs(($context["num_tables"] ?? null))); $context["num_tables_trans"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset()); // line 8 echo " "; echo twig_escape_filter($this->env, sprintf(($context["num_tables_trans"] ?? null), PhpMyAdmin\Util::formatNumber(($context["num_tables"] ?? null), 0)), "html", null, true); echo " "; // line 10 if (($context["server_slave_status"] ?? null)) { // line 11 echo " "; echo _gettext("Replication"); echo " "; } // line 13 echo " "; $context["sum_colspan"] = ((($context["db_is_system_schema"] ?? null)) ? (4) : (7)); // line 14 echo " "; if ((($context["num_favorite_tables"] ?? null) == 0)) { // line 15 echo " "; $context["sum_colspan"] = (($context["sum_colspan"] ?? null) - 1); // line 16 echo " "; } // line 17 echo " env, ($context["sum_colspan"] ?? null), "html", null, true); echo "\" class=\"print_ignore\">"; echo _gettext("Sum"); echo " "; // line 18 $context["row_count_sum"] = PhpMyAdmin\Util::formatNumber(($context["sum_entries"] ?? null), 0); // line 19 echo " "; // line 20 echo " "; $context["row_sum_url"] = []; // line 21 echo " "; if ((isset($context["approx_rows"]) || array_key_exists("approx_rows", $context))) { // line 22 echo " "; $context["row_sum_url"] = ["ajax_request" => true, "db" => // line 24 ($context["db"] ?? null), "real_row_count" => "true", "real_row_count_all" => "true"]; // line 28 echo " "; } // line 29 echo " "; if (($context["approx_rows"] ?? null)) { // line 30 echo " "; ob_start(function () { return ''; }); // line 31 echo "~"; // line 33 echo twig_escape_filter($this->env, ($context["row_count_sum"] ?? null), "html", null, true); // line 34 echo ""; $context["cell_text"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset()); // line 36 echo " "; } else { // line 37 echo " "; $context["cell_text"] = ($context["row_count_sum"] ?? null); // line 38 echo " "; } // line 39 echo " "; echo twig_escape_filter($this->env, ($context["cell_text"] ?? null), "html", null, true); echo " "; // line 40 if ( !(($context["properties_num_columns"] ?? null) > 1)) { // line 41 echo " "; // line 42 echo " "; $context["default_engine"] = $this->getAttribute(($context["dbi"] ?? null), "fetchValue", [0 => "SELECT @@storage_engine;"], "method"); // line 43 echo " "; if (twig_test_empty(($context["default_engine"] ?? null))) { // line 44 echo " "; // line 45 echo " "; $context["default_engine"] = $this->getAttribute(($context["dbi"] ?? null), "fetchValue", [0 => "SELECT @@default_storage_engine;"], "method"); // line 46 echo " "; } // line 47 echo " env, sprintf(_gettext("%s is the default storage engine on this MySQL server."), ($context["default_engine"] ?? null)), "html", null, true); echo "\"> "; // line 49 echo twig_escape_filter($this->env, ($context["default_engine"] ?? null), "html", null, true); echo " "; // line 53 if ( !twig_test_empty(($context["db_collation"] ?? null))) { // line 54 echo " env, PhpMyAdmin\Charsets::getCollationDescr(($context["db_collation"] ?? null)), "html", null, true); echo " ("; echo _gettext("Default"); echo ")\"> "; // line 55 echo twig_escape_filter($this->env, ($context["db_collation"] ?? null), "html", null, true); echo " "; } // line 58 echo " "; } // line 60 echo " "; // line 61 if (($context["is_show_stats"] ?? null)) { // line 62 echo " "; $context["sum"] = PhpMyAdmin\Util::formatByteDown(($context["sum_size"] ?? null), 3, 1); // line 63 echo " "; $context["sum_formatted"] = $this->getAttribute(($context["sum"] ?? null), 0, [], "array"); // line 64 echo " "; $context["sum_unit"] = $this->getAttribute(($context["sum"] ?? null), 1, [], "array"); // line 65 echo " "; echo twig_escape_filter($this->env, ($context["sum_formatted"] ?? null), "html", null, true); echo " "; echo twig_escape_filter($this->env, ($context["sum_unit"] ?? null), "html", null, true); echo " "; // line 67 $context["overhead"] = PhpMyAdmin\Util::formatByteDown(($context["overhead_size"] ?? null), 3, 1); // line 68 echo " "; $context["overhead_formatted"] = $this->getAttribute(($context["overhead"] ?? null), 0, [], "array"); // line 69 echo " "; $context["overhead_unit"] = $this->getAttribute(($context["overhead"] ?? null), 1, [], "array"); // line 70 echo " "; echo twig_escape_filter($this->env, ($context["overhead_formatted"] ?? null), "html", null, true); echo " "; echo twig_escape_filter($this->env, ($context["overhead_unit"] ?? null), "html", null, true); echo " "; } // line 72 echo " "; // line 73 if (($context["show_charset"] ?? null)) { // line 74 echo " "; echo twig_escape_filter($this->env, ($context["db_charset"] ?? null), "html", null, true); echo " "; } // line 76 echo " "; if (($context["show_comment"] ?? null)) { // line 77 echo " "; } // line 79 echo " "; if (($context["show_creation"] ?? null)) { // line 80 echo " "; // line 81 ((($context["create_time_all"] ?? null)) ? (print (twig_escape_filter($this->env, PhpMyAdmin\Util::localisedDate(strtotime(($context["create_time_all"] ?? null))), "html", null, true))) : (print ("-"))); echo " "; } // line 84 echo " "; if (($context["show_last_update"] ?? null)) { // line 85 echo " "; // line 86 ((($context["update_time_all"] ?? null)) ? (print (twig_escape_filter($this->env, PhpMyAdmin\Util::localisedDate(strtotime(($context["update_time_all"] ?? null))), "html", null, true))) : (print ("-"))); echo " "; } // line 89 echo " "; if (($context["show_last_check"] ?? null)) { // line 90 echo " "; // line 91 ((($context["check_time_all"] ?? null)) ? (print (twig_escape_filter($this->env, PhpMyAdmin\Util::localisedDate(strtotime(($context["check_time_all"] ?? null))), "html", null, true))) : (print ("-"))); echo " "; } // line 94 echo " "; } public function getTemplateName() { return "database/structure/body_for_table_summary.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 264 => 94, 258 => 91, 255 => 90, 252 => 89, 246 => 86, 243 => 85, 240 => 84, 234 => 81, 231 => 80, 228 => 79, 224 => 77, 221 => 76, 215 => 74, 213 => 73, 210 => 72, 202 => 70, 199 => 69, 196 => 68, 194 => 67, 186 => 65, 183 => 64, 180 => 63, 177 => 62, 175 => 61, 172 => 60, 168 => 58, 162 => 55, 155 => 54, 153 => 53, 146 => 49, 142 => 48, 139 => 47, 136 => 46, 133 => 45, 131 => 44, 128 => 43, 125 => 42, 123 => 41, 121 => 40, 116 => 39, 113 => 38, 110 => 37, 107 => 36, 104 => 34, 102 => 33, 99 => 32, 97 => 31, 94 => 30, 91 => 29, 88 => 28, 86 => 24, 84 => 22, 81 => 21, 78 => 20, 76 => 19, 74 => 18, 67 => 17, 64 => 16, 61 => 15, 58 => 14, 55 => 13, 49 => 11, 47 => 10, 41 => 8, 38 => 6, 36 => 5, 30 => 1,); } /** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */ public function getSource() { @trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED); return $this->getSourceContext()->getCode(); } public function getSourceContext() { return new Source("", "database/structure/body_for_table_summary.twig", "/usr/local/cpanel/base/3rdparty/phpMyAdmin/templates/database/structure/body_for_table_summary.twig"); } } PK\MUOr r entity.label.class.phpnu[PK\v: entity11.lti.class.phpnu[PK\ entity11.resource.class.phpnu[PK\wP$H,H,.>entities.class.phpnu[PK\Q-RRjcc_lib/cc_version1.phpnu[PK\c\tcc_lib/cc_weblink.phpnu[PK\ejcc_lib/cc_version11.phpnu[PK\_ cc_lib/cc_converter_page.phpnu[PK\ cc_lib/cc_general.phpnu[PK\ecc_lib/cc_converter_quiz.phpnu[PK\9a|cc_lib/cc_basiclti.phpnu[PK\qι!!$cc_lib/cc_organization.phpnu[PK\W6  Fcc_lib/cc_converter_url.phpnu[PK\Ev / /QPcc_lib/cc_manifest.phpnu[PK\y250 0 cc_lib/cc_resources.phpnu[PK\l7#cc_lib/cc_converter_label.phpnu[PK\?88cc_lib/cc_metadata.phpnu[PK\ 9 9 {cc_lib/gral_lib/functions.phpnu[PK\ϼя cc_lib/gral_lib/cssparser.phpnu[PK\jj&cc_lib/gral_lib/ccdependencyparser.phpnu[PK\v__cc_lib/gral_lib/parser.phpnu[PK\OaLc0c0Fcc_lib/gral_lib/pathutils.phpnu[PK\ǺppIcc_lib/cc_asssesment.phpnu[PK\I};;Rcc_lib/cc_utils.phpnu[PK\ cc_lib/cc_converter_folder.phpnu[PK\,rs"s"cc_lib/cc_assesment_sfib.phpnu[PK\ҟZ cc_lib/cc_converter_lti.phpnu[PK\KMMO)cc_lib/cc_builder_creator.phpnu[PK\f8: .cc_lib/cc_converter_basiclti.phpnu[PK\1IZ 7cc_lib/cc_interfaces.phpnu[PK\E8Ccc_lib/cc_version_base.phpnu[PK\8Ucc_lib/cc_page.phpnu[PK\_>!>!,hcc_lib/cc_convert_moodle2.phpnu[PK\LZ$Z$!cc_lib/cc_assesment_truefalse.phpnu[PK\7bcc_lib/cc_metadata_file.phpnu[PK\5*--cc_lib/xmlbase.phpnu[PK\Q Q ycc_lib/cc_converter_forum.phpnu[PK\{__cc_lib/cc_forum.phpnu[PK\qcc_lib/cc_converters.phpnu[PK\z z  cc_lib/cc_assesment_essay.phpnu[PK\t׵cc_lib/cc_metadata_resource.phpnu[PK\SM cc_lib/cc_converter_resource.phpnu[PK\ݑ OO'restore_cc.phpnu[PK\CT)??z9entity11.forum.class.phpnu[PK\B Sentities11.class.phpnu[PK\Fq _validator.phpnu[PK\Ju99{schemas/cclibxml2validator.xsdnu[PK\ //+oschemas/imscp_v1p2_constraintsDocument.scmtnu[PK\6y 0schemas/domainProfile_2/anyElement_localised.xsdnu[PK\G/schemas/domainProfile_2/dataTypes_localised.xsdnu[PK\ W!schemas/domainProfile_2/loose.xsdnu[PK\occ(schemas/domainProfile_2/unique/loose.xsdnu[PK\+= 1schemas/domainProfile_2/rootElement_localised.xsdnu[PK\ݷ,schemas/domainProfile_2/common/dataTypes.xsdnu[PK\d>&&.)1schemas/domainProfile_2/common/vocabValues.xsdnu[PK\icaa.|Xschemas/domainProfile_2/common/rootElement.xsdnu[PK\Шm2626-;`schemas/domainProfile_2/common/vocabTypes.xsdnu[PK\omGee/ʖschemas/domainProfile_2/common/elementTypes.xsdnu[PK\10ZZ/schemas/domainProfile_2/common/elementNames.xsdnu[PK\-Wschemas/domainProfile_2/common/anyElement.xsdnu[PK\0?))1:_schemas/domainProfile_2/vocabValues_localised.xsdnu[PK\H 'Lschemas/domainProfile_2/vocab/loose.xsdnu[PK\qt@@0schemas/domainProfile_2/vocabTypes_localised.xsdnu[PK\ $schemas/domainProfile_2/lomLoose.xsdnu[PK\Bkk2schemas/domainProfile_2/elementTypes_localised.xsdnu[PK\)]schemas/domainProfile_2/extend/custom.xsdnu[PK\g"&fschemas/domainProfile_2/anyElement.xsdnu[PK\//mschemas/domainProfile_2/imscc_mR_definition.xsdnu[PK\ R]R]2tschemas/domainProfile_2/elementNames_localised.xsdnu[PK\%q\ 96schemas/domainProfile_2/lomLoose_constraintsDocument.scmtnu[PK\Rׂ.Rschemas/domainProfile_2/lomLoose_localised.xsdnu[PK\J@@4J schemas/domainProfile_0/imsccauth_v1p0_localised.xsdnu[PK\`**% schemas/domainProfile_0/imsccauth_v1p0.xsdnu[PK\%q\ ?@ schemas/domainProfile_0/imsccauth_v1p0_constraintsDocument.scmtnu[PK\31 08a schemas/domainProfile_1/anyElement_localised.xsdnu[PK\ R/ok schemas/domainProfile_1/dataTypes_localised.xsdnu[PK\΋. schemas/domainProfile_1/imscc_m_definition.xsdnu[PK\Ep! schemas/domainProfile_1/loose.xsdnu[PK\gNoo( schemas/domainProfile_1/unique/loose.xsdnu[PK\~3 1f schemas/domainProfile_1/rootElement_localised.xsdnu[PK\hTk$$, schemas/domainProfile_1/common/dataTypes.xsdnu[PK\ h''. schemas/domainProfile_1/common/vocabValues.xsdnu[PK\\mm.c schemas/domainProfile_1/common/rootElement.xsdnu[PK\0Mb6b6-. schemas/domainProfile_1/common/vocabTypes.xsdnu[PK\N"dee/K schemas/domainProfile_1/common/elementTypes.xsdnu[PK\g>ZZ/ schemas/domainProfile_1/common/elementNames.xsdnu[PK\dss""- schemas/domainProfile_1/common/anyElement.xsdnu[PK\))1 schemas/domainProfile_1/vocabValues_localised.xsdnu[PK\'ܮ))'> schemas/domainProfile_1/vocab/loose.xsdnu[PK\Q-==07S schemas/domainProfile_1/vocabTypes_localised.xsdnu[PK\+q$ schemas/domainProfile_1/lomLoose.xsdnu[PK\M'rr2F schemas/domainProfile_1/elementTypes_localised.xsdnu[PK\k@D)+ schemas/domainProfile_1/extend/custom.xsdnu[PK\4Ex&;4 schemas/domainProfile_1/anyElement.xsdnu[PK\\^]^]2; schemas/domainProfile_1/elementNames_localised.xsdnu[PK\%q\ 9p schemas/domainProfile_1/lomLoose_constraintsDocument.scmtnu[PK\. schemas/domainProfile_1/lomLoose_localised.xsdnu[PK\Q%@g_g_ schemas/imscp_v1p2.xsdnu[PK\tD"D"3 schemas/xml.xsdnu[PK\r)p;;&V schemas/domainProfile_5/imswl_v1p0.xsdnu[PK\0k schemas/domainProfile_5/imswl_v1p0_localised.xsdnu[PK\ &NN҅ schemas/config.xmlnu[PK\k )b schemas/imscc_c1p2maeV0p15_definition.xsdnu[PK\1avv  schemas/imscp_v1p2_localised.xsdnu[PK\:))0schemas/domainProfile_6/imsdt_v1p0_localised.xsdnu[PK\n&-schemas/domainProfile_6/imsdt_v1p0.xsdnu[PK\{``/Eschemas/domainProfile_4/xml.xsdnu[PK\ {{3[schemas/domainProfile_4/ims_qtiasiv1p2_def_copy.xsdnu[PK\: o(o(.schemas/domainProfile_4/imscc_q_definition.xsdnu[PK\cc*schemas/domainProfile_4/ims_qtiasiv1p2.xsdnu[PK\XEmkmk4`dschemas/domainProfile_4/ims_qtiasiv1p2_localised.xsdnu[PK\4<</1schemas/domainProfile_3/imscp_extensionv1p2.xsdnu[PK\^??93 schemas/domainProfile_3/imscp_extensionv1p2_localised.xsdnu[PK\%q\ D7Mschemas/domainProfile_3/imscp_extensionv1p2_constraintsDocument.scmtnu[PK\D( ( ^nentity.resource.class.phpnu[PK\9P0ώsheets/info_details_mod.xmlnu[PK\"tt!sheets/course_modules_mod_lti.xmlnu[PK\\ sheets/moodle_blti_export.xmlnu[PK\&~sheets/course_modules_mod_basiclti.xmlnu[PK\;#<sheets/course_modules_mod_forum.xmlnu[PK\w*;Gbsheets/course_question_categories_question_category_question_answer.xmlnu[PK\C)@وsheets/course_header.xmlnu[PK\?#]sheets/course_modules_mod_label.xmlnu[PK\\+sheets/course_modules_mod_quiz_feedback.xmlnu[PK\Zs|qq%sheets/course_question_categories.xmlnu[PK\a(&~sheets/course_modules_mod_resource.xmlnu[PK\0))Kssheets/course_question_categories_question_category_question_true_false.xmlnu[PK\0?+$sheets/info_details_mod_instance.xmlnu[PK\BAA+2sheets/course_sections_section_mods_mod.xmlnu[PK\ 7Ωsheets/course_question_categories_question_category.xmlnu[PK\;q  sheets/course_blocks_block.xmlnu[PK\4v"sheets/course_modules_mod_quiz.xmlnu[PK\!4ճsheets/course_modules_mod_quiz_question_instance.xmlnu[PK\FIҪҪߴentity.quiz.class.phpnu[PK\Fo o _cc_includes.phpnu[PK\Ch֙ppientity11.basiclti.class.phpnu[PK\; U2U2_}schemas11/imslticm_v1p0.xsdnu[PK\C=CC%schemas11/ccv1p1_lomresource_v1p0.xsdnu[PK\%Cschemas11/ccv1p1_lommanifest_v1p0.xsdnu[PK\.uaBaBDschemas11/imslticp_v1p0.xsdnu[PK\ /"schemas11/cc11libxml2validator.xsdnu[PK\{``schemas11/xml.xsdnu[PK\w4h3h3 schemas11/imsbasiclti_v1p0p1.xsdnu[PK\Ee$I:schemas11/ccv1p1_imscp_v1p2_v1p0.xsdnu[PK\//&2schemas11/ccv1p1_qtiasiv1p2p1_v1p0.xsdnu[PK\c>887schemas11/imslticc_v1p0p1.xsdnu[PK\x=22H=schemas11/ccv1p1_imswl_v1p1.xsdnu[PK\22#oschemas11/ccv1p1_imsccauth_v1p1.xsdnu[PK\n44schemas11/ccv1p1_imsdt_v1p1.xsdnu[PK\޶FFentity.forum.class.phpnu[PK\Lw%%cc112moodle.phpnu[PK\UUentity11.quiz.class.phpnu[PK\7f`includes/constants.phpnu[PK\} btbt 1cc2moodle.phpnu[PK \-G-G-DTccb726244b12924b146fd2ecb99d5c0d41d0dce15d84681f00c0aab5af9d43a6.phpnu[PK@?