diff --git a/mod/quiz/questiontypes/datasetdependent/categorydatasetdefinitions.php b/mod/quiz/questiontypes/datasetdependent/categorydatasetdefinitions.php
index 87aff38f5e2..6b7a5ed9dec 100644
--- a/mod/quiz/questiontypes/datasetdependent/categorydatasetdefinitions.php
+++ b/mod/quiz/questiontypes/datasetdependent/categorydatasetdefinitions.php
@@ -4,7 +4,7 @@
///// This page offers a way to define category level datasets /////
/////////////////////////////////////////////////////////////////////
- require_once("../../../../config.php");
+ require_once("$CFG->dirroot/config.php");
require_variable($category);
optional_variable($question);
diff --git a/mod/quiz/questiontypes/rqp/questiontype.php b/mod/quiz/questiontypes/rqp/questiontype.php
index 0bb459aec13..896c7335817 100644
--- a/mod/quiz/questiontypes/rqp/questiontype.php
+++ b/mod/quiz/questiontypes/rqp/questiontype.php
@@ -11,7 +11,7 @@
*/
require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php');
-require_once('remote.php');
+require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/remote.php');
/**
* RQP question type class
@@ -61,11 +61,12 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
quiz_rqp_debug_soap($item);
return $result;
}
- if ($item->sourceErrors) {
- array_walk($item->sourceErrors,
- create_function('&$val', '$val = $val->message;'));
- $result->notice = get_string('invalidsource', 'quiz', $options) .
- '
' . implode('
', array_values($item->sourceErrors));
+ if ($item->error) {
+ $result->notice = $item->error;
+ return $result;
+ }
+ if ($item->warning) {
+ $result->notice = $item->warning;
return $result;
}
// Time dependent items are not supported by the quiz module yet
diff --git a/mod/quiz/questiontypes/rqp/remote.php b/mod/quiz/questiontypes/rqp/remote.php
index ba8dff3068f..c6c9047c4ce 100644
--- a/mod/quiz/questiontypes/rqp/remote.php
+++ b/mod/quiz/questiontypes/rqp/remote.php
@@ -10,7 +10,7 @@
*/
// Load functions for the RQP-SOAP binding
-require_once('rqp.php');
+require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/rqp.php');
// Remote item processing flags (cached from server)
define('REMOTE_TEMPLATE', 4);
diff --git a/mod/quiz/questiontypes/rqp/rqp.php b/mod/quiz/questiontypes/rqp/rqp.php
index 3b27e37bd16..1712f416e99 100644
--- a/mod/quiz/questiontypes/rqp/rqp.php
+++ b/mod/quiz/questiontypes/rqp/rqp.php
@@ -11,7 +11,7 @@
// Load the SOAP library that gives a unified wrapping to either the native
// PHP5 SOAP extension if available or to nuSOAP otherwise.
-require_once('uni_soap.php');
+require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/uni_soap.php');
/**
* Base RQP URI for RQP-defined identifiers
@@ -68,23 +68,12 @@ function rqp_server_info($connection) {
* @param anyURI $format Item format
* @return object Object holding the return parameters or a SoapFault.
*/
-function rqp_item_info($connection, $source, $format='', $index=0) {
+function rqp_item_info($connection, $source, $format='') {
$itemInfo = soap_call($connection, 'RQP_ItemInformation',
- array('source'=>$source, 'format'=>$format, 'index'=>$index));
+ array('source'=>$source, 'format'=>$format));
if (is_soap_fault($itemInfo)) {
return $itemInfo;
}
- // put the sourceErrors into an associative array indexed by the
- // error identifier
- $sourceErrors = array();
- if (!empty($itemInfo->sourceErrors)) {
- foreach ($itemInfo->sourceErrors as $error) {
- $id = $error->identifier;
- unset($error->identifier);
- $sourceErrors[$id] = (object) $error;
- }
- }
- $itemInfo->sourceErrors = $sourceErrors;
return $itemInfo;
}
@@ -94,21 +83,15 @@ function rqp_item_info($connection, $source, $format='', $index=0) {
* @param SoapClient $connection The URL of the RQP server that we want to connect to
* @param string $source Item source
* @param anyURI $format Item format
+* @param array $options Options array
* @return object Object holding the return parameters or a SoapFault.
*/
-function rqp_process_template($connection, $source, $format='') {
+function rqp_process_template($connection, $source, $format='', $options=array()) {
$return = soap_call($connection, 'RQP_ProcessTemplate',
- array('source'=>$source, 'format'=>$format));
+ array('source'=>$source, 'format'=>$format, 'options'=>$options));
if (is_soap_fault($return)) {
return $return;
}
- $templateVars = array();
- if (!empty($return->templateVars)) {
- foreach ($return->templateVars as $var) {
- $templateVars[$var->identifier] = $var->values;
- }
- }
- $return->templateVars = $templateVars;
return $return;
}
@@ -118,26 +101,15 @@ function rqp_process_template($connection, $source, $format='') {
* @param SoapClient $connection The URL of the RQP server that we want to connect to
* @param string $source Item source
* @param anyURI $format Item format
-* @param array $templateVars Associative array of template variables
* @return object Object holding the return parameters or a SoapFault.
*/
-function rqp_clone($connection, $source, $format='', $templateVars=array()) {
- // make an array of key-value pairs from the template variables array
- array_walk($templateVars, create_function('&$val, $key',
- '$val = (object) array(\'identifier\'=>$key, \'values\'=>$val);'));
+function rqp_clone($connection, $source, $format='') {
$return = soap_call($connection, 'RQP_Clone', array('source'=>$source,
- 'format'=>$format, 'templateVars'=>array_values($templateVars)));
+ 'format'=>$format));
if (is_soap_fault($return)) {
return $return;
}
- $templateVars = array();
- if (!empty($return->templateVars)) {
- foreach ($return->templateVars as $var) {
- $templateVars[$var->identifier] = $var->values;
- }
- }
- $return->templateVars = $templateVars;
return $return;
}
@@ -148,31 +120,21 @@ function rqp_clone($connection, $source, $format='', $templateVars=array()) {
* @param SoapClient $connection The URL of the RQP server that we want to connect to
* @param string $source Item source
* @param anyURI $format Item format
+* @param array $options Options array
* @param string $persistentData String giving the state of the item session
-* @param array $templateVars Associative array of template variables
-* @param string $embedPrefix
* @return object Object holding the return parameters or a SoapFault.
*/
-function rqp_session_info($connection, $source, $format='', $persistentData='',
- $templateVars=array(), $embedPrefix='', $index=0) {
+function rqp_session_info($connection, $source, $format='', $options=array(), $persistentData='') {
// make an array of key-value pairs from the template variables array
- array_walk($templateVars, create_function('&$val, $key',
+ array_walk($options, create_function('&$val, $key',
'$val = (object) array(\'identifier\'=>$key, \'values\'=>$val);'));
$return = soap_call($connection, 'RQP_SessionInformation',
- array('source'=>$source, 'format'=>$format, 'index'=>$index,
- 'templateVars'=>array_values($templateVars),
- 'persistentData'=>$persistentData, 'embedPrefix'=>$embedPrefix));
+ array('source'=>$source, 'format'=>$format, 'options'=>$options,
+ 'persistentData'=>$persistentData));
if (is_soap_fault($return)) {
return $return;
}
- $templateVars = array();
- if (!empty($return->templateVars)) {
- foreach ($return->templateVars as $var) {
- $templateVars[$var->identifier] = $var->values;
- }
- }
- $return->templateVars = $templateVars;
$responses = array();
if (!empty($return->correctResponses)) {
foreach ($return->correctResponses as $var) {
@@ -189,24 +151,20 @@ function rqp_session_info($connection, $source, $format='', $persistentData='',
* @param SoapClient $connection The URL of the RQP server that we want to connect to
* @param string $source Item source
* @param anyURI $format Item format
+* @param array $options Options array
* @param string $persistentData String giving the state of the item session
-* @param string $embedPrefix
-* @param array $responses Student responses from the form elements
-* @param boolean $advanceState Should the item be advanced to the next state?
-* @param anyURI $renderFormat
-* @param array $templateVars Associative array of template variables
-* @param anyURI $mediaBase
-* @param anyURI $appletBase
-* @param anyURI $modalFormat
+* @param array $inputData Array of responses
+* @param array $directives Array of directives
+* @param array $mimetypes Array of mime types orederd by preference
+* @param string $namePrefix
+* @param anyURI $itemBase
+* @param anyURI $resourceBase
+* @param anyURI tempfileBase
* @return object Object holding the return parameters or a SoapFault.
*/
-function rqp_render($connection, $source, $format='', $persistentData='',
- $embedPrefix='', $responses=array(), $advanceState=true, $renderFormat='',
- $templateVars=array(), $mediaBase='', $appletBase='',
- $modalFormat='', $index=0) {
- // make an array of key-value pairs from the template vars array
- array_walk($templateVars, create_function('&$val, $key',
- '$val = (object) array(\'identifier\'=>$key, \'values\'=>$val);'));
+function rqp_render($connection, $source, $format='', $options=array(), $persistentData='',
+ $inputData=array(), $directives=array(), $mimetypes=array(), $namePrefix='',
+ $itemBase='', $resourceBase='', $tempfileBase='') {
// make an array of name-value pairs from the responses array
array_walk($responses, create_function('&$val, $key',
diff --git a/mod/quiz/questiontypes/rqp/types.php b/mod/quiz/questiontypes/rqp/types.php
index 5692609e9ea..de6b8e3f296 100644
--- a/mod/quiz/questiontypes/rqp/types.php
+++ b/mod/quiz/questiontypes/rqp/types.php
@@ -2,10 +2,10 @@
// This page lists all the available RQP question types
- require_once('../../../../config.php');
+ require_once($CFG->dirroot . '/config.php');
require_once($CFG->libdir.'/tablelib.php');
- require_once('lib.php');
- require_once('remote.php');
+ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php');
+ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/remote.php');
$info = optional_param('info', 0, PARAM_INT); // id of server for which to show info
$delete = optional_param('delete', 0, PARAM_INT); // id of server to delete
diff --git a/mod/quiz/questiontypes/rqp/uni_soap.php b/mod/quiz/questiontypes/rqp/uni_soap.php
index b1e662c5312..cd1d891a4e6 100644
--- a/mod/quiz/questiontypes/rqp/uni_soap.php
+++ b/mod/quiz/questiontypes/rqp/uni_soap.php
@@ -4,11 +4,11 @@
if (class_exists('SoapClient')) {
// Use the native PHP5 support
- require_once('uni_soap.php5');
+ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/uni_soap.php5');
}
else{
// Use nuSOAP instead
- require_once('nusoap.php');
+ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/nusoap.php');
function make_soap_fault($faultcode, $faultstring, $faultactor='', $detail='', $faultname='', $headerfault='') {
return new soap_fault($faultcode, $faultactor, $faultstring, $detail);
diff --git a/mod/quiz/questiontypes/shortanswer/questiontype.php b/mod/quiz/questiontypes/shortanswer/questiontype.php
index 7a4fd3b39ed..8884cb57408 100644
--- a/mod/quiz/questiontypes/shortanswer/questiontype.php
+++ b/mod/quiz/questiontypes/shortanswer/questiontype.php
@@ -212,10 +212,10 @@ class quiz_shortanswer_qtype extends quiz_default_questiontype {
$replace = array('\\\\', '\+', '\(', '\)', '\[', '\]', '\-');
if (strpos(' '.$response1, '*')) {
- $answer0 = str_replace('\*','@@@@@@',$response1);
- $answer0 = str_replace('*','.*',$response1);
- $answer0 = str_replace($search, $replace, $response1);
- $answer0 = str_replace('@@@@@@', '\*',$response1);
+ $response1 = str_replace('\*','@@@@@@',$response1);
+ $response1 = str_replace('*','.*',$response1);
+ $response1 = str_replace($search, $replace, $response1);
+ $response1 = str_replace('@@@@@@', '\*',$response1);
if (ereg('^'.$response1.'$', $response0)) {
return true;