mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
"MDL-14129, fix error() in moodle2"
This commit is contained in:
parent
60e40dda6c
commit
771dc7b298
@ -181,7 +181,7 @@
|
||||
|
||||
if ($mode == 'missing') {
|
||||
if (!file_exists($langdir)) {
|
||||
error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
|
||||
print_error('invalidlangpack');
|
||||
}
|
||||
|
||||
// Following variables store the HTML output to be echo-ed
|
||||
|
@ -164,7 +164,7 @@ if ($currenttab != 'update') {
|
||||
break;
|
||||
|
||||
default:
|
||||
error ('This is an unknown context (' . $context->contextlevel . ') in admin/roles/tabs.php!');
|
||||
print_error('unknowncontext');
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -111,10 +111,13 @@
|
||||
print_error('xmldberror');
|
||||
}
|
||||
} else {
|
||||
error ("Error: cannot instantiate class (actions/$action/$actionclass)");
|
||||
$a = new stdclass;
|
||||
$a->action = $action;
|
||||
$a->actionclass = $actionclass;
|
||||
print_error('cannotinstantiateclass', 'xmldb', '', $a);
|
||||
}
|
||||
} else {
|
||||
error ("Error: wrong action specified ($action)");
|
||||
print_error('invalidaction');
|
||||
}
|
||||
|
||||
if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
|
||||
|
@ -355,7 +355,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
// strings (UCS-2 Little Endian format) and surrounded with
|
||||
// double quotes. See http://support.microsoft.com/?kbid=269190
|
||||
if (!function_exists('mb_convert_encoding')) {
|
||||
print_error ('auth_ldap_no_mbstring', 'auth');
|
||||
print_error('auth_ldap_no_mbstring', 'auth');
|
||||
}
|
||||
|
||||
// First create the user account, and mark it as disabled.
|
||||
@ -366,7 +366,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$userdn = 'cn=' . $this->ldap_addslashes($extusername) .
|
||||
',' . $this->config->create_context;
|
||||
if (!ldap_add($ldapconnection, $userdn, $newuser)) {
|
||||
print_error ('auth_ldap_ad_create_req', 'auth');
|
||||
print_error('auth_ldap_ad_create_req', 'auth');
|
||||
}
|
||||
|
||||
// Now set the password
|
||||
@ -376,7 +376,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
if(!ldap_modify($ldapconnection, $userdn, $newuser)) {
|
||||
// Something went wrong: delete the user account and error out
|
||||
ldap_delete ($ldapconnection, $userdn);
|
||||
print_error ('auth_ldap_ad_create_req', 'auth');
|
||||
print_error('auth_ldap_ad_create_req', 'auth');
|
||||
}
|
||||
$uadd = true;
|
||||
break;
|
||||
@ -918,7 +918,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
& (~AUTH_AD_ACCOUNTDISABLE);
|
||||
break;
|
||||
default:
|
||||
error ('auth: ldap user_activate() does not support selected usertype:"'.$this->config->user_type.'" (..yet)');
|
||||
print_error('user_activatenotsupportusertype', 'auth', '', $this->config->user_type);
|
||||
}
|
||||
$result = ldap_modify($ldapconnection, $userdn, $newinfo);
|
||||
ldap_close($ldapconnection);
|
||||
@ -953,7 +953,7 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
| AUTH_AD_ACCOUNTDISABLE;
|
||||
break;
|
||||
default:
|
||||
error ('auth: ldap user_disable() does not support selected usertype (..yet)');
|
||||
print_error('user_disablenotsupportusertype', 'auth');
|
||||
}
|
||||
$result = ldap_modify($ldapconnection, $userdn, $newinfo);
|
||||
ldap_close($ldapconnection);
|
||||
|
@ -69,8 +69,7 @@
|
||||
echo "</table>";
|
||||
|
||||
if (!$status) {
|
||||
error ("The backup did not complete successfully",
|
||||
"$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
print_error('error', 'error', "$CFG->wwwroot/course/view.php?id=$course->id");
|
||||
}
|
||||
|
||||
if (empty($to)) {
|
||||
|
@ -313,7 +313,7 @@
|
||||
echo "</div>";
|
||||
} else {
|
||||
//Show error
|
||||
error ("Something was wrong checking restore preferences");
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
//If we are here. Something must be wrong. Debug !!!
|
||||
@ -321,7 +321,7 @@
|
||||
print_object($restore);
|
||||
print_object($info);
|
||||
print_object($course_header);
|
||||
error ("Something must be wrong");
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
//Checks we have the file variable
|
||||
if (!isset($file)) {
|
||||
error ("File not specified");
|
||||
print_error('nofile');
|
||||
}
|
||||
|
||||
//Check login
|
||||
|
@ -7284,7 +7284,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
//Check the file exists
|
||||
if (!is_file($file)) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
error ("File not exists ($file)");
|
||||
print_error('nofile');
|
||||
} else {
|
||||
$errorstr = "File not exists ($file)";
|
||||
return false;
|
||||
@ -7294,9 +7294,9 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
//Check the file name ends with .zip
|
||||
if (!substr($file,-4) == ".zip") {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
error ("File has an incorrect extension");
|
||||
print_error('incorrectext');
|
||||
} else {
|
||||
$errorstr = 'File has an incorrect extension';
|
||||
$errorstr = get_string('incorrectext', 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7463,7 +7463,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
|
||||
if (!$status) {
|
||||
if (!defined('RESTORE_SILENTLY')) {
|
||||
error ("An error has ocurred");
|
||||
print_error('error');
|
||||
} else {
|
||||
$errorstr = "An error has occured"; // helpful! :P
|
||||
return false;
|
||||
|
@ -231,7 +231,7 @@ $navlinks = array();
|
||||
break;
|
||||
|
||||
default:
|
||||
error ('Error unknown filtertype');
|
||||
print_error('unknownfiletype');
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@
|
||||
|
||||
/*
|
||||
if (!blog_user_can_view_user_post($template['userid'])) {
|
||||
error ('you can not view this post');
|
||||
print_error('cannotviewuserblog', 'blog');
|
||||
}*/
|
||||
|
||||
$stredit = get_string('edit');
|
||||
|
@ -177,7 +177,7 @@ if ($formdata = $mform->get_data()) {
|
||||
$h = trim($h); $header[$i] = $h; // remove whitespace
|
||||
}
|
||||
} else {
|
||||
error ('could not open file');
|
||||
print_error('cannotopenfile');
|
||||
}
|
||||
|
||||
$map = array();
|
||||
@ -481,7 +481,7 @@ if ($formdata = $mform->get_data()) {
|
||||
// temporary file can go now
|
||||
unlink($filename);
|
||||
} else {
|
||||
error ('import file '.$filename.' not readable');
|
||||
print_error('cannotreadfil');
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -144,7 +144,7 @@ abstract class grade_report {
|
||||
global $CFG, $COURSE, $DB;
|
||||
|
||||
if (empty($CFG->gradebookroles)) {
|
||||
error ('no roles defined in admin->appearance->graderoles');
|
||||
print_error('norolesdefined', 'grades');
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,6 +10,7 @@ $string['accessstatement'] = 'Accessibility statement';
|
||||
$string['activitynext'] = 'Next activity';
|
||||
$string['activityprev'] = 'Previous activity';
|
||||
$string['breadcrumb'] = 'Breadcrumb trail';
|
||||
$string['cannotdeleterolenoadmin'] = 'You can not delete this role because there is no other admin roles with users assigned';
|
||||
$string['currentweek'] = 'This week ';
|
||||
$string['currenttopic'] = 'This topic ';
|
||||
$string['monthnext'] = 'Next month';
|
||||
|
@ -450,6 +450,7 @@ $string['installedlangs'] = 'Installed language packs';
|
||||
$string['intcachemax'] = 'Int. cache max';
|
||||
$string['invalidsection'] = 'Invalid section.';
|
||||
$string['invaliduserchangeme'] = 'Username \"changeme\" is reserved -- you cannot create an account with it.';
|
||||
$string['invalidlangpack'] = 'to edit this language pack, you need to put it in language folder.';
|
||||
$string['ipblocker'] = 'IP Blocker';
|
||||
$string['ipblocked'] = 'This site is not available currently.';
|
||||
$string['iplookup'] = 'IP address lookup';
|
||||
|
@ -9,6 +9,8 @@ $string['forgottenpassword'] = 'If you enter a URL here, it will be used as the
|
||||
$string['forgottenpasswordurl'] = 'Forgotten password URL';
|
||||
$string['pluginnotenabled'] = 'Authentication plugin \'$a\' is not enabled.';
|
||||
$string['pluginnotinstalled'] = 'Authentication plugin \'$a\' is not installed.';
|
||||
$string['user_activatenotsupportusertype'] = 'auth: ldap user_activate() does not support selected usertype: $a';
|
||||
$string['user_disablenotsupportusertype'] = 'auth: ldap user_disable() does not support selected usertype (..yet)';
|
||||
// synchronization
|
||||
$string['auth_sync_script'] ='Cron synchronization script';
|
||||
$string['auth_dbinsertuser'] ='Inserted user $a[0] id $a[1]';
|
||||
|
@ -239,6 +239,7 @@ $string['guestnoeditprofileother'] = 'The guest user profile cannot be edited';
|
||||
$string['guestnorate'] = 'Guests are not allowed to rate entries';
|
||||
$string['guestsarenotallowed'] = 'The guest user is not allowed to do this';
|
||||
$string['hashpoolproblem'] = 'Incorrect pool file content $a.';
|
||||
$string['incorrectext'] = 'File has an incorrect extension';
|
||||
$string['invalidaction'] = 'Invalid action parameter';
|
||||
$string['invalidactivityid'] = 'Invalid Activity ID';
|
||||
$string['invalidarguments'] = 'No valid arguments supplied';
|
||||
@ -336,6 +337,7 @@ $string['needcoursecategroyid'] = 'Either course id or category must be specifie
|
||||
$string['noblocks'] = 'No blocks found!';
|
||||
$string['nodata'] = 'No data';
|
||||
$string['noformdesc'] = 'No formslib form description file found for this activity.';
|
||||
$string['nofile'] = 'File not specified';
|
||||
$string['nocategorydelete'] = 'Category \'$a\' cannot be deleted!';
|
||||
$string['nocontext'] = 'Sorry, but that course is not a valid context';
|
||||
$string['noinstances'] = 'There are no instances of $a in this course!';
|
||||
@ -423,6 +425,8 @@ $string['unknowformat'] = 'Format not known ($a)';
|
||||
$string['unknowncourse'] = 'Unknown course named \"$a\"';
|
||||
$string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
|
||||
$string['unknowncourserequest'] = 'Unknown course request';
|
||||
$string['unknowncontext'] = 'This is an unknown context.';
|
||||
$string['unknownfiletype'] = 'Error unknown filtertype';
|
||||
$string['unknownhelp'] = 'Unknown help topic $a';
|
||||
$string['unknowngroup'] = 'Unknown group \"$a\"';
|
||||
$string['unknownrole'] = 'Unknown role \"$a\"';
|
||||
|
@ -149,6 +149,7 @@ $string['importentries'] = 'Import entries';
|
||||
$string['importentriesfromxml'] = 'Import entries from XML file';
|
||||
$string['includegroupbreaks'] = 'Include group breaks';
|
||||
$string['invalidid'] = 'Incorrect glossary id';
|
||||
$string['invalidglossaryformat'] = 'Invalid Glossary Format';
|
||||
$string['isglobal'] = 'Is this glossary global?';
|
||||
$string['letter'] = 'letter';
|
||||
$string['linkcategory'] = 'Automatically link this category';
|
||||
|
@ -354,6 +354,7 @@ $string['noselectedcategories'] = 'no categories were selected.';
|
||||
$string['noselecteditems'] = 'no items were selected.';
|
||||
$string['notteachererror'] = 'You must be a teacher to use this feature.';
|
||||
$string['nousersloaded'] = 'No users loaded';
|
||||
$string['norolesdefined' ] = 'no roles defined in admin->appearance->graderoles';
|
||||
$string['numberofgrades'] = 'Number of grades';
|
||||
$string['onascaleof'] = ' on a scale of $a->grademin to $a->grademax';
|
||||
$string['operations'] = 'Operations';
|
||||
|
@ -7,6 +7,7 @@ $string['back'] = 'Back';
|
||||
$string['backtomainview'] = 'Back To Main';
|
||||
$string['binaryincorrectlength'] = 'Incorrect length for binary field';
|
||||
$string['cannotuseidfield'] = 'Cannot insert the \"id\" field. It is an autonumeric column';
|
||||
$string['cannotinstantiateclass'] = 'Error: cannot instantiate class (actions/$a->action/$a->actionclass)';
|
||||
$string['change'] = 'Change';
|
||||
$string['charincorrectlength'] = 'Incorrect length for char field';
|
||||
$string['checkbigints'] = 'Check bigints';
|
||||
|
@ -2627,7 +2627,7 @@ function delete_role($roleid) {
|
||||
}
|
||||
}
|
||||
if ($status !== true) {
|
||||
error ('You can not delete this role because there is no other admin roles with users assigned');
|
||||
print_error('cannotdeleterolenoadmin', 'access');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3455,7 +3455,7 @@ function print_context_name($context, $withprefix = true, $short = false) {
|
||||
break;
|
||||
|
||||
default:
|
||||
error ('This is an unknown context (' . $context->contextlevel . ') in print_context_name!');
|
||||
print_error('unknowncontext');
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4045,7 +4045,7 @@ function get_component_string($component, $contextlevel) {
|
||||
break;
|
||||
|
||||
default:
|
||||
error ('This is an unknown context $contextlevel (' . $contextlevel . ') in get_component_string!');
|
||||
print_error('unknowncontext');
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it
|
||||
|
||||
if ( !$displayformat = $DB->get_record("glossary_formats", array("id"=>$id))) {
|
||||
error ("Invalid Glossary Format");
|
||||
print_error('invalidglossaryformat', 'glossary');
|
||||
}
|
||||
|
||||
$form = data_submitted();
|
||||
|
@ -174,13 +174,13 @@
|
||||
$params["userid"] = $userid;
|
||||
}
|
||||
if (!$attempts = $DB->get_records_select('lesson_attempts', "pageid $usql".$queryadd, $params)) {
|
||||
error ('No one has answered essay questions yet...');
|
||||
print_error('nooneansweredthisquestion', 'lesson');
|
||||
}
|
||||
// Get the answers
|
||||
list($answerUsql, $parameters) = $DB->get_in_or_equal(array_keys($pages));
|
||||
$parameters["lessonid"] = $lesson->id;
|
||||
if (!$answers = $DB->get_records_select('lesson_answers', "lessonid = :lessonid AND pageid $answerUsql", $parameters, '', 'pageid, score')) {
|
||||
error ('Could not find answer records.');
|
||||
print_error('cannotfindanswer', 'lesson');
|
||||
}
|
||||
$options = new stdClass;
|
||||
$options->noclean = true;
|
||||
|
@ -88,7 +88,7 @@ class qformat_default {
|
||||
if ($pageid) {
|
||||
// the new page follows on from this page
|
||||
if (!$page = $DB->get_record("lesson_pages", array("id" => $pageid))) {
|
||||
error ("Format: Page $pageid not found");
|
||||
print_error('invalidpageid', 'lesson');
|
||||
}
|
||||
$newpage->prevpageid = $pageid;
|
||||
$newpage->nextpageid = $page->nextpageid;
|
||||
|
@ -86,43 +86,43 @@
|
||||
|
||||
/// Create directories
|
||||
if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
|
||||
error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
|
||||
print_error('errorcreatingdirectory', 'error', '', $CFG->moddata.'/resource/'.$resource->id);
|
||||
}
|
||||
|
||||
/// Ensure it's empty
|
||||
if (!delete_dir_contents($resourcedir)) {
|
||||
error (get_string('errorcleaningdirectory', 'error', $resourcedir));
|
||||
print_error('errorcleaningdirectory', 'error', '', $resourcedir);
|
||||
}
|
||||
|
||||
/// Copy files
|
||||
$origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
|
||||
|
||||
if (!is_file($origin)) {
|
||||
error (get_string('filenotfound' , 'error', $file));
|
||||
print_error('filenotfound' , 'error', '', $file);
|
||||
}
|
||||
$mimetype = mimeinfo("type", $file);
|
||||
if ($mimetype != "application/zip") {
|
||||
error (get_string('invalidfiletype', 'error', $file));
|
||||
print_error('invalidfiletype', 'error', '', $file);
|
||||
}
|
||||
$resourcefile = $resourcedir.'/'.basename($origin);
|
||||
if (!backup_copy_file($origin, $resourcefile)) {
|
||||
error (get_string('errorcopyingfiles', 'error'));
|
||||
print_error('errorcopyingfiles', 'error');
|
||||
}
|
||||
|
||||
/// Unzip files
|
||||
if (!unzip_file($resourcefile, '', false)) {
|
||||
error (get_string('errorunzippingfiles', 'error'));
|
||||
print_error('errorunzippingfiles', 'error');
|
||||
}
|
||||
|
||||
/// Check for imsmanifest
|
||||
if (!file_exists($resourcedir.'/imsmanifest.xml')) {
|
||||
error (get_string('filenotfound', 'error', 'imsmanifest.xml'));
|
||||
print_error('filenotfound', 'error', '', 'imsmanifest.xml');
|
||||
}
|
||||
|
||||
/// Load imsmanifest to memory (instead of using a full parser,
|
||||
/// we are going to use xmlize intensively (because files aren't too big)
|
||||
if (!$imsmanifest = ims_file2var ($resourcedir.'/imsmanifest.xml')) {
|
||||
error (get_string ('errorreadingfile', 'error', 'imsmanifest.xml'));
|
||||
print_error('errorreadingfile', 'error', '', 'imsmanifest.xml');
|
||||
}
|
||||
|
||||
/// Check if the first line is a proper one, because I've seen some
|
||||
@ -134,7 +134,7 @@
|
||||
$imsmanifest = substr($imsmanifest, $inixml);
|
||||
}
|
||||
} else {
|
||||
error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
|
||||
print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
|
||||
}
|
||||
|
||||
/// xmlize the variable
|
||||
@ -143,7 +143,7 @@
|
||||
/// Extract every manifest present in the imsmanifest file.
|
||||
/// Returns a tree structure.
|
||||
if (!$manifests = ims_extract_manifests($data)) {
|
||||
error (get_string('nonmeaningfulcontent', 'error'));
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
|
||||
/// Process every manifest found in inverse order so every one
|
||||
@ -160,7 +160,7 @@
|
||||
/// Parse XML-content package data
|
||||
/// First we select an organization an load all the items
|
||||
if (!$items = ims_process_organizations($data['manifest']['#']['organizations']['0'])) {
|
||||
error (get_string('nonmeaningfulcontent', 'error'));
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
|
||||
/// Detect if all the resources share a common xml:base tag
|
||||
@ -168,7 +168,7 @@
|
||||
|
||||
/// Now, we load all the resources available (keys are identifiers)
|
||||
if (!$resources = ims_load_resources($data['manifest']['#']['resources']['0']['#']['resource'], $manifest_base, $resources_base)) {
|
||||
error (get_string('nonmeaningfulcontent', 'error'));
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
///Now we assign to each item, its resource (by identifier)
|
||||
foreach ($items as $key=>$item) {
|
||||
@ -181,13 +181,13 @@
|
||||
|
||||
/// Create the INDEX (moodle_inx.ser - where the order of the pages are stored serialized) file
|
||||
if (!ims_save_serialized_file($resourcedir.'/moodle_inx.ser', $items)) {
|
||||
error (get_string('errorcreatingfile', 'error', 'moodle_inx.ser'));
|
||||
print_error('errorcreatingfile', 'error', '', 'moodle_inx.ser');
|
||||
}
|
||||
|
||||
/// Create the HASH file (moodle_hash.ser - where the hash of the ims is stored serialized) file
|
||||
$hash = $resource_obj->calculatefilehash($resourcefile);
|
||||
if (!ims_save_serialized_file($resourcedir.'/moodle_hash.ser', $hash)) {
|
||||
error (get_string('errorcreatingfile', 'error', 'moodle_hash.ser'));
|
||||
print_error('errorcreatingfile', 'error', '', 'moodle_hash.ser');
|
||||
}
|
||||
|
||||
/// End button (go to view mode)
|
||||
|
@ -30,7 +30,7 @@
|
||||
/// Load serialized IMS CP index to memory only once.
|
||||
if (empty($items)) {
|
||||
if (!$items = ims_load_serialized_file($deploydir.'/moodle_inx.ser')) {
|
||||
error (get_string('errorreadingfile', 'error', 'moodle_inx.ser'));
|
||||
print_error('errorreadingfile', 'error', '', 'moodle_inx.ser');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
/// Load imsmanifest to memory (instead of using a full parser,
|
||||
/// we are going to use xmlize intensively (because files aren't too big)
|
||||
if (!$imsmanifest = ims_file2var ($resourcedir.'/imsmanifest.xml')) {
|
||||
error (get_string ('errorreadingfile', 'error', 'imsmanifest.xml'));
|
||||
print_error('errorreadingfile', 'error', '', 'imsmanifest.xml');
|
||||
}
|
||||
|
||||
/// Check if the first line is a proper one, because I've seen some
|
||||
@ -124,7 +124,7 @@
|
||||
return;
|
||||
}
|
||||
else {
|
||||
error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
|
||||
print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@
|
||||
/// Extract every manifest present in the imsmanifest file.
|
||||
/// Returns a tree structure.
|
||||
if (!$manifests = ims_extract_manifests($data)) {
|
||||
error (get_string('nonmeaningfulcontent', 'error'));
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
|
||||
/// Process every manifest found in inverse order so every one
|
||||
@ -156,7 +156,11 @@
|
||||
/// First we select an organization an load all the items
|
||||
|
||||
if (!$items = ims_process_organizations($data['manifest']['#']['organizations']['0'])) {
|
||||
if ($all == 'force') return; else error (get_string('nonmeaningfulcontent', 'error'));
|
||||
if ($all == 'force') {
|
||||
return;
|
||||
} else {
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
/// Detect if all the resources share a common xml:base tag
|
||||
@ -164,7 +168,7 @@
|
||||
|
||||
/// Now, we load all the resources available (keys are identifiers)
|
||||
if (!$resources = ims_load_resources($data['manifest']['#']['resources']['0']['#']['resource'], $manifest_base, $resources_base)) {
|
||||
error (get_string('nonmeaningfulcontent', 'error'));
|
||||
print_error('nonmeaningfulcontent', 'error');
|
||||
}
|
||||
///Now we assign to each item, its resource (by identifier)
|
||||
foreach ($items as $key=>$item) {
|
||||
@ -178,7 +182,7 @@
|
||||
/// Create the INDEX (moodle_inx.ser - where the order of the pages are stored serialized) file
|
||||
$items['title'] = $title;
|
||||
if (!ims_save_serialized_file($resourcedir.'/moodle_inx.ser', $items)) {
|
||||
error (get_string('errorcreatingfile', 'error', 'moodle_inx.ser'));
|
||||
print_error('errorcreatingfile', 'error', '', 'moodle_inx.ser');
|
||||
}
|
||||
|
||||
/// No zip so no HASH
|
||||
|
@ -416,7 +416,7 @@ class resource_ims extends resource_base {
|
||||
$resourcedir = $CFG->repository . $resource->reference;
|
||||
}
|
||||
if (!$items = ims_load_serialized_file($resourcedir.'/moodle_inx.ser')) {
|
||||
error (get_string('errorreadingfile', 'error', 'moodle_inx.ser'));
|
||||
print_error('errorreadingfile', 'error', '', 'moodle_inx.ser');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1611,7 +1611,7 @@ class default_questiontype {
|
||||
/// If anything has changed, update it in the database.
|
||||
if ($updateqrec){
|
||||
if (!$DB->update_record('question', $question)){
|
||||
error ('Couldn\'t update question '.$question->name);
|
||||
print_error('cannotupdatequestion', 'question');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1630,7 +1630,7 @@ class default_questiontype {
|
||||
/// If anything has changed, update it in the database.
|
||||
if ($answerchanged){
|
||||
if (!$DB->update_record('question_answers', $answer)){
|
||||
error ('Couldn\'t update question ('.$question->name.') answer '.$answer->id);
|
||||
print_error('cannotupdatequestion', 'question');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user