Permalink
Browse files

Tidy up of import/export function layout to match coding standard

  • Loading branch information...
thepurpleblob
thepurpleblob committed Jul 21, 2005
1 parent b586f7c commit 96157e798654605e3148554f6dfd725f7c2d8c5d
Showing with 32 additions and 30 deletions.
  1. +32 −30 mod/quiz/locallib.php
View
@@ -2635,40 +2635,42 @@ function quiz_upgrade_states($attempt) {
/**
* Get list of available import or export formats
+ * @param string $type 'import' if import list, otherwise export list assumed
+ * @return array sorted list of import/export formats available
**/
function get_import_export_formats( $type ) {
- global $CFG;
- $fileformats = get_list_of_plugins("mod/quiz/format");
-
- $fileformatname=array();
- require_once( "format.php" );
- foreach ($fileformats as $key => $fileformat) {
- $format_file = $CFG->dirroot . "/mod/quiz/format/$fileformat/format.php";
- if (file_exists( $format_file ) ) {
- require_once( $format_file );
- }
- else {
- continue;
- }
- $classname = "quiz_format_$fileformat";
- $format_class = new $classname();
- if ($type=='import') {
- $provided = $format_class->provide_import();
- }
- else {
- $provided = $format_class->provide_export();
- }
- if ($provided) {
- $formatname = get_string($fileformat, 'quiz');
- if ($formatname == "[[$fileformat]]") {
- $formatname = $fileformat; // Just use the raw folder name
- }
- $fileformatnames[$fileformat] = $formatname;
+ global $CFG;
+ $fileformats = get_list_of_plugins("mod/quiz/format");
+
+ $fileformatname=array();
+ require_once( "format.php" );
+ foreach ($fileformats as $key => $fileformat) {
+ $format_file = $CFG->dirroot . "/mod/quiz/format/$fileformat/format.php";
+ if (file_exists( $format_file ) ) {
+ require_once( $format_file );
+ }
+ else {
+ continue;
+ }
+ $classname = "quiz_format_$fileformat";
+ $format_class = new $classname();
+ if ($type=='import') {
+ $provided = $format_class->provide_import();
+ }
+ else {
+ $provided = $format_class->provide_export();
+ }
+ if ($provided) {
+ $formatname = get_string($fileformat, 'quiz');
+ if ($formatname == "[[$fileformat]]") {
+ $formatname = $fileformat; // Just use the raw folder name
+ }
+ $fileformatnames[$fileformat] = $formatname;
+ }
}
- }
- natcasesort($fileformatnames);
+ natcasesort($fileformatnames);
- return $fileformatnames;
+ return $fileformatnames;
}
?>

0 comments on commit 96157e7

Please sign in to comment.