--- backup/cc/sheets/course_modules_mod_lti.xml Mon Jan 19 22:26:36 1970 +++ backup/cc/sheets/course_modules_mod_lti.xml Mon Jan 19 22:26:36 1970 @@ -14,6 +14,6 @@ 1 $@NULL@$ 100.00000 - 0 + [#mod_basiclti_customparams#] [#mod_basiclti_icon#] --- backup/cc/entity11.lti.class.php Mon Jan 19 22:26:36 1970 +++ backup/cc/entity11.lti.class.php Mon Jan 19 22:26:36 1970 @@ -54,7 +54,8 @@ '[#mod_basiclti_timec#]' , '[#mod_basiclti_timem#]' , '[#mod_basiclti_toolurl#]', - '[#mod_basiclti_icon#]' + '[#mod_basiclti_icon#]', + '[#mod_basiclti_customparams#]' ); $replace_values = array($instance['instance'], @@ -62,7 +63,8 @@ $topic_data['description'], time(),time(), $topic_data['launchurl'], - $topic_data['icon'] + $topic_data['icon'], + $topic_data['customparameters'] ); $result = str_replace($find_tags, $replace_values, $sheet_mod_basiclti); @@ -79,6 +81,23 @@ } return $result; } + + protected function getCustomParams($node, $default = null) { + $result = $default; + if (is_object($node) && ($node->length > 0)) + $result = ""; + for ($i = 0; $i< $node->length; $i++) + { + $currentParam = $node->item($i); + $customParamValue = $currentParam->nodeValue; + if($currentParam->hasAttribute("name") && !empty($customParamValue)) { + $custParamName = $currentParam->getAttribute("name"); + $result .= $custParamName . "="; + $result .= htmlspecialchars(trim($customParamValue), ENT_COMPAT, 'UTF-8', false) . "\n"; + } + } + return $result; + } public function get_basiclti_data($instance) { @@ -99,6 +118,7 @@ $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); + $custom_params = $this->getCustomParams($xpath->query('/xmlns:cartridge_basiclti_link/blti:custom/lticm:property'),null); $topic_data['title' ] = $topic_title; $topic_data['description'] = $blti_description; $topic_data['launchurl' ] = $launch_url; @@ -106,6 +126,7 @@ $topic_data['orgid' ] = $tool_raw; $topic_data['orgurl' ] = $tool_url; $topic_data['orgdesc' ] = $tool_desc; + $topic_data['customparameters'] = $custom_params; } }