Skip to content

Commit

Permalink
Tidy up of import/export function layout to match coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
thepurpleblob committed Jul 21, 2005
1 parent b586f7c commit 96157e7
Showing 1 changed file with 32 additions and 30 deletions.
62 changes: 32 additions & 30 deletions mod/quiz/locallib.php
Expand Up @@ -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.