diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 599338b68fc..1bfbf232886 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -33,7 +33,7 @@ $QUIZ_QUESTION_TYPE = array ( MULTICHOICE => get_string("multichoice", "quiz") // add remote question types if ($rqp_types = get_records('quiz_rqp_types')) { foreach($rqp_types as $type) { - $QUIZ_QUESTION_TYPE[100+$type->id] = $type->name; + $QUIZ_QUESTION_TYPE[100+$type->id] = $type->name; } } diff --git a/mod/quiz/questiontypes/rqp/editquestion.php b/mod/quiz/questiontypes/rqp/editquestion.php index 1a6b6ee6350..8decd82ffae 100644 --- a/mod/quiz/questiontypes/rqp/editquestion.php +++ b/mod/quiz/questiontypes/rqp/editquestion.php @@ -3,9 +3,9 @@ require_once($CFG->dirroot . '/mod/quiz/questiontypes/rqp/lib.php'); if (empty($question->id)) { - if (!isset($typeid)) { - error('No remote question type specified'); - } + if (!isset($typeid)) { + error('No remote question type specified'); + } $question->options->type = $typeid; $question->options->source = ''; $question->options->format = ''; @@ -15,7 +15,7 @@ } if (!$type = get_record('quiz_rqp_types', 'id', $question->options->type = $typeid)) { - error("Invalid remote question type"); + error("Invalid remote question type"); } print_heading_with_help(get_string('editingrqp', 'quiz', $type->name), 'rqp', 'quiz'); diff --git a/mod/quiz/questiontypes/rqp/lib.php b/mod/quiz/questiontypes/rqp/lib.php index ab00f926c32..9ac8e2528c5 100644 --- a/mod/quiz/questiontypes/rqp/lib.php +++ b/mod/quiz/questiontypes/rqp/lib.php @@ -120,9 +120,9 @@ function quiz_rqp_print_serverinfo($serverinfo) { function quiz_rqp_debug_soap($item) { global $CFG; if ($CFG->debug) { - echo 'Here is the dump of the soap fault:
';
-	var_dump($item);
-	echo '
';
+        echo 'Here is the dump of the soap fault:
';
+        var_dump($item);
+        echo '
';
     }
 }
 ?>
diff --git a/mod/quiz/questiontypes/rqp/questiontype.php b/mod/quiz/questiontypes/rqp/questiontype.php
index 20fe800e7b9..0638e0445e1 100644
--- a/mod/quiz/questiontypes/rqp/questiontype.php
+++ b/mod/quiz/questiontypes/rqp/questiontype.php
@@ -58,7 +58,7 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
 	}
         if (is_soap_fault($item)) {
             $result->notice = get_string('invalidsource', 'quiz', $item);
-	    quiz_rqp_debug_soap($item);
+            quiz_rqp_debug_soap($item);
             return $result;
         }
         if ($item->sourceErrors) {
@@ -238,13 +238,13 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
         } else {
             // Otherwise perform a render operation
             if (!$output = remote_render($question, $state, false,
-	    $options->readonly ? 'readonly' : 'normal')) {
-		notify(get_string('noconnection', 'quiz'));
-		exit;
-	    }
+             $options->readonly ? 'readonly' : 'normal')) {
+                notify(get_string('noconnection', 'quiz'));
+                exit;
+            }
             if (is_soap_fault($output)) {
                 notify(get_string('errorrendering', 'quiz'));
-		quiz_rqp_debug_soap($output);
+                quiz_rqp_debug_soap($output);
                 unset($output);
                 exit;
             }
@@ -402,10 +402,10 @@ class quiz_rqp_qtype extends quiz_default_questiontype {
     function get_config_options() {
         global $CFG;
 
-	// for the time being disable rqp unless we have php 5
-	if(!check_php_version('5.0.0')) {
-	    return false;
-	}
+        // for the time being disable rqp unless we have php 5
+        if(!check_php_version('5.0.0')) {
+            return false;
+        }
 
         $link->name = 'managetypes';
         $link->link = 'types.php';
diff --git a/mod/quiz/questiontypes/rqp/remote.php b/mod/quiz/questiontypes/rqp/remote.php
index 0e9f7b77f92..ba8dff3068f 100644
--- a/mod/quiz/questiontypes/rqp/remote.php
+++ b/mod/quiz/questiontypes/rqp/remote.php
@@ -37,21 +37,21 @@ function remote_connect($typeid) {
     global $remote_connections;
 
     if (!array_key_exists($typeid, $remote_connections)) {
-	// get the available servers
-	if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) {
-	    // we don't have a server for this question type
-	    return false;
-	}
-	// put them in a random order
-	shuffle($servers);
-	// go through them and try to connect to each until we are successful
-        foreach ($servers as $server) {
-	    if ($remote_connections[$typeid] = rqp_connect($server->url)) {
-		break; // we have a connection
-	    } else {
-	        // We have a dead server here, should somehow flag that
-	    }
-	}
+        // get the available servers
+        if (!$servers = get_records('quiz_rqp_servers', 'typeid', $typeid)) {
+            // we don't have a server for this question type
+            return false;
+        }
+        // put them in a random order
+        shuffle($servers);
+        // go through them and try to connect to each until we are successful
+            foreach ($servers as $server) {
+            if ($remote_connections[$typeid] = rqp_connect($server->url)) {
+            break; // we have a connection
+            } else {
+                // We have a dead server here, should somehow flag that
+            }
+        }
     }
     // check that we did get a connection
     if (!$remote_connections[$typeid]) {
@@ -71,11 +71,11 @@ function remote_connect($typeid) {
 function remote_server_info($url) {
 
     if (!$connection = rqp_connect($url)) {
-	return false;
+        return false;
     }
     $return = rqp_server_info($connection);
     if (is_soap_fault($return)) {
-	$return = false;
+        $return = false;
     }
     $return->url = $url;
     return $return;
diff --git a/mod/quiz/questiontypes/rqp/types.php b/mod/quiz/questiontypes/rqp/types.php
index 95fc6b06b0b..50776ad026a 100644
--- a/mod/quiz/questiontypes/rqp/types.php
+++ b/mod/quiz/questiontypes/rqp/types.php
@@ -25,10 +25,10 @@
     $strmodulename = get_string('modulename', 'quiz');
     $stritemtypes = get_string('itemtypes', 'quiz');
     $navigation = '' . get_string('admin') . ' -> ' .
-    '' . get_string('configuration') . ' -> ' .
-    '' . get_string('managemodules') . ' -> ' .
-    '' .
-    get_string('modulename', 'quiz') . ' -> ' . $stritemtypes;
+        '' . get_string('configuration') . ' -> ' .
+        '' . get_string('managemodules') . ' -> ' .
+        '' .
+        get_string('modulename', 'quiz') . ' -> ' . $stritemtypes;
     print_header($site->shortname . ': ' . $strmodulename . ': ' . $stritemtypes, $site->fullname, $navigation, '', '', true, '', '');
 
     $straddtypeurl = 'http://';
@@ -37,75 +37,75 @@
 /// Process submitted data
     if ($form = data_submitted() and confirm_sesskey()) { 
 
-	while (isset($form->add)) { // using like if but with support for break
-	    // check name was given
-	    if (empty($form->name)) {
-		notify(get_string('missingitemtypename', 'quiz'));
-		break;
-	    }
-	    // check url was given
-	    if (empty($form->url)) {
-		notify(get_string('missingitemtypeurl', 'quiz'));
-		break;
-	    }
-	    // Check server exists and works
-	    if (!$serverinfo = remote_server_info($form->url)) {
-		notify(get_string('renderingserverconnectfailed', 'quiz', $form->url));
-		break;
-	    }
-	    // add new type to database unless it exists already
-	    if (!$type = get_record('quiz_rqp_types', 'name', $form->name)) {
-		$type->name = $form->name;
-		if (!$type->id = insert_record('quiz_rqp_types', $type)) {
-		    error("Could not save type $type");
-		}
-	    }
-	    // add new server to database unless it exists already
-	    if (!$server = get_record('quiz_rqp_servers', 'url', $form->url)) {
-		$server->typeid = $type->id;
-		$server->url = $form->url;
-		$server->can_render = $serverinfo->rendering ? 1 : 0;
-		if (!insert_record('quiz_rqp_servers', $server)) {
-		    error("Could not save server $form->url");
-		}
-	    }
-	    // print info about new server
-	    print_heading(get_string('serveradded', 'quiz'));
-	    quiz_rqp_print_serverinfo($serverinfo);
+        while (isset($form->add)) { // using like if but with support for break
+            // check name was given
+            if (empty($form->name)) {
+                notify(get_string('missingitemtypename', 'quiz'));
+                break;
+            }
+            // check url was given
+            if (empty($form->url)) {
+                notify(get_string('missingitemtypeurl', 'quiz'));
+                break;
+            }
+            // Check server exists and works
+            if (!$serverinfo = remote_server_info($form->url)) {
+                notify(get_string('renderingserverconnectfailed', 'quiz', $form->url));
+                break;
+            }
+            // add new type to database unless it exists already
+            if (!$type = get_record('quiz_rqp_types', 'name', $form->name)) {
+                $type->name = $form->name;
+                if (!$type->id = insert_record('quiz_rqp_types', $type)) {
+                    error("Could not save type $type");
+                }
+            }
+            // add new server to database unless it exists already
+            if (!$server = get_record('quiz_rqp_servers', 'url', $form->url)) {
+                $server->typeid = $type->id;
+                $server->url = $form->url;
+                $server->can_render = $serverinfo->rendering ? 1 : 0;
+                if (!insert_record('quiz_rqp_servers', $server)) {
+                    error("Could not save server $form->url");
+                }
+            }
+            // print info about new server
+            print_heading(get_string('serveradded', 'quiz'));
+            quiz_rqp_print_serverinfo($serverinfo);
+        
+            break;
     
-	    break;
-
-	}
+        }
     }
 
     if ($delete and confirm_sesskey()) { // delete server
-	if ($confirm) {
-	    delete_records('quiz_rqp_servers', 'id', $delete);
-	} else {
-	    if (!$server = get_record('quiz_rqp_servers', 'id', $delete)) {
-		error('Invalid server id');
-	    }
-	    if ((count_records('quiz_rqp_servers', 'typeid', $server->typeid) == 1) // this is the last server of its type
-		and record_exists('quiz_rqp', 'type', $server->typeid)) { // and there are questions using it
-		$type = get_record('quiz_rqp_types', 'id', $server->typeid);
-		notify(get_string('serverinuse', 'quiz', $type->name));
-	    }
-	    notice_yesno(get_string('confirmserverdelete', 'quiz', $server->url), 'types.php?delete='.$delete.'&sesskey='.sesskey().'&confirm=true', 'types.php');
-	}
+        if ($confirm) {
+            delete_records('quiz_rqp_servers', 'id', $delete);
+        } else {
+            if (!$server = get_record('quiz_rqp_servers', 'id', $delete)) {
+                error('Invalid server id');
+            }
+            if ((count_records('quiz_rqp_servers', 'typeid', $server->typeid) == 1) // this is the last server of its type
+                    and record_exists('quiz_rqp', 'type', $server->typeid)) { // and there are questions using it
+                $type = get_record('quiz_rqp_types', 'id', $server->typeid);
+                notify(get_string('serverinuse', 'quiz', $type->name));
+            }
+            notice_yesno(get_string('confirmserverdelete', 'quiz', $server->url), 'types.php?delete='.$delete.'&sesskey='.sesskey().'&confirm=true', 'types.php');
+        }
     }
     
     if ($info) { // show info for server
-	if (!$server = get_record('quiz_rqp_servers', 'id', $info)) {
-	    error('Invalid server id');
-	}
-	// Check server exists and works
-	if (!$serverinfo = remote_server_info($server->url)) {
-	    notify(get_string('renderingserverconnectfailed', 'quiz', $server->url));
-	} else {
-	    // print the info
-	    print_heading(get_string('serverinfo', 'quiz'));
-	    quiz_rqp_print_serverinfo($serverinfo);
-	}
+        if (!$server = get_record('quiz_rqp_servers', 'id', $info)) {
+            error('Invalid server id');
+        }
+        // Check server exists and works
+        if (!$serverinfo = remote_server_info($server->url)) {
+            notify(get_string('renderingserverconnectfailed', 'quiz', $server->url));
+        } else {
+            // print the info
+            print_heading(get_string('serverinfo', 'quiz'));
+            quiz_rqp_print_serverinfo($serverinfo);
+        }
     }
 
 
@@ -139,15 +139,15 @@
     if ($types) {
         foreach ($types as $type) {
             if (!$servers = get_records('quiz_rqp_servers', 'typeid', $type->id)) {
-		delete_records('quiz_rqp_types', 'id', $type->id);
-	    } else {
-		foreach ($servers as $server) {
-		    $actions = ''.$strinfo.' '.$strdelete.'';
-		    $serverurl = ($info == $server->id) ? ''.$server->url.'' : $server->url;
-		    $table->add_data(array($type->name, $serverurl, $actions));
-		}
-	        $table->add_data(array('','',''));
-	    }
+                delete_records('quiz_rqp_types', 'id', $type->id);
+            } else {
+                foreach ($servers as $server) {
+                    $actions = ''.$strinfo.' '.$strdelete.'';
+                    $serverurl = ($info == $server->id) ? ''.$server->url.'' : $server->url;
+                    $table->add_data(array($type->name, $serverurl, $actions));
+                }
+                $table->add_data(array('','',''));
+            }
         }
     }