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
break;
default:
- error ('This is an unknown context (' . $context->contextlevel . ') in admin/roles/tabs.php!');
+ print_error('unknowncontext');
return false;
}
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) {
// 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.
$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
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;
& (~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);
| 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);
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)) {
echo "</div>";
} else {
//Show error
- error ("Something was wrong checking restore preferences");
+ print_error('error');
}
//If we are here. Something must be wrong. Debug !!!
print_object($restore);
print_object($info);
print_object($course_header);
- error ("Something must be wrong");
+ print_error('error');
}
?>
//Checks we have the file variable
if (!isset($file)) {
- error ("File not specified");
+ print_error('nofile');
}
//Check login
//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;
//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;
}
}
if (!$status) {
if (!defined('RESTORE_SILENTLY')) {
- error ("An error has ocurred");
+ print_error('error');
} else {
$errorstr = "An error has occured"; // helpful! :P
return false;
break;
default:
- error ('Error unknown filtertype');
+ print_error('unknownfiletype');
break;
}
/*
if (!blog_user_can_view_user_post($template['userid'])) {
- error ('you can not view this post');
+ print_error('cannotviewuserblog', 'blog');
}*/
$stredit = get_string('edit');
$h = trim($h); $header[$i] = $h; // remove whitespace
}
} else {
- error ('could not open file');
+ print_error('cannotopenfile');
}
$map = array();
// temporary file can go now
unlink($filename);
} else {
- error ('import file '.$filename.' not readable');
+ print_error('cannotreadfil');
}
} else {
global $CFG, $COURSE, $DB;
if (empty($CFG->gradebookroles)) {
- error ('no roles defined in admin->appearance->graderoles');
+ print_error('norolesdefined', 'grades');
}
$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';
$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';
$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]';
$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';
$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!';
$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\"';
$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';
$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';
$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';
}
}
if ($status !== true) {
- error ('You can not delete this role because there is no other admin roles with users assigned');
+ print_error('cannotdeleterolenoadmin', 'access');
}
}
}
break;
default:
- error ('This is an unknown context (' . $context->contextlevel . ') in print_context_name!');
+ print_error('unknowncontext');
return false;
}
break;
default:
- error ('This is an unknown context $contextlevel (' . $contextlevel . ') in get_component_string!');
+ print_error('unknowncontext');
return false;
}
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();
$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;
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;
/// 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
$imsmanifest = substr($imsmanifest, $inixml);
}
} else {
- error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
+ print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
}
/// xmlize the variable
/// 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
/// 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
/// 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) {
/// 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)
/// 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');
}
}
/// 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
return;
}
else {
- error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
+ print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
}
}
/// 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
/// 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
/// 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) {
/// 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
$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');
}
}
/// 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');
}
}
/// 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');
}
}
}