From 873bf8758f5f53bbccea38e3d18ec35c2cc72886 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Thu, 27 Jan 2005 02:35:10 +0000 Subject: [PATCH] Initial checkin for import course content functionality (uses backup/restore). Probably needs wording changes and new icon! Please test me *thoroughly*! --- backup/backup.php | 18 +++- backup/backup_check.html | 93 ++++++++++------- backup/backup_execute.html | 67 ++++++++----- backup/backup_form.html | 110 ++++++++++++-------- backup/restore.php | 31 +++++- backup/restore_execute.html | 18 +++- backup/restore_precheck.html | 131 ++---------------------- backup/restorelib.php | 188 +++++++++++++++++++++++++++++++++++ blocks/admin/block_admin.php | 4 + lang/en/moodle.php | 8 ++ 10 files changed, 434 insertions(+), 234 deletions(-) diff --git a/backup/backup.php b/backup/backup.php index fb3efb9118..49f46bcc14 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -9,6 +9,7 @@ require_once ("$CFG->libdir/blocklib.php"); optional_variable($id); // course id + optional_variable($to); // id of course to import into afterwards. optional_variable($cancel); optional_variable($launch); @@ -16,7 +17,13 @@ if (!empty($id)) { if (!isteacheredit($id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -34,14 +41,19 @@ //Check backup_version if ($id) { - $linkto = "backup.php?id=".$id; + $linkto = "backup.php?id=".$id.((!empty($to)) ? '&to='.$to : ''); } else { $linkto = "backup.php"; } upgrade_backup_db($linkto); //Get strings - $strcoursebackup = get_string("coursebackup"); + if (empty($to)) { + $strcoursebackup = get_string("coursebackup"); + } + else { + $strcoursebackup = get_string('importdata'); + } $stradministration = get_string("administration"); //If no course has been selected or cancel button pressed diff --git a/backup/backup_check.html b/backup/backup_check.html index d4a5cea243..acf1d437a6 100644 --- a/backup/backup_check.html +++ b/backup/backup_check.html @@ -6,7 +6,13 @@ if (!empty($course->id)) { if (!isteacheredit($course->id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -77,11 +83,6 @@ "; - echo ""; - //Calculate the backup unique code to allow simultaneus backups (to define //the temp-directory name and records in backup temp tables $backup_unique_code = time(); //Add as hidden name echo ""; + + if (empty($to)) { + //Now print the Backup Name tr + echo ""; + echo ""; - //Line - echo ""; + //Line + echo ""; + + //Now print the To Do list + echo ""; + echo ""; - echo ""; + if (empty($to)) { + echo get_string("backupdetails").":"; + echo ""; + } //This is tha align to every ingo table $table->align = array ("left","right"); @@ -200,25 +214,29 @@ } } } - //Line - echo ""; - - //Now print the Users tr - echo ""; - echo ""; + + //Now print the Users tr + echo ""; + echo ""; + + } //Add as hidden name echo ""; - //Print info - $table->data = user_check_backup($id,$backup_unique_code,$backup_users); - print_table($table); - echo ""; - + //Now print the Logs tr conditionally - if ($backup_logs) { + if ($backup_logs && empty($to)) { echo ""; echo "

"; - echo get_string("name").":"; - echo "

"; //Calculate the backup string //Calculate the backup word @@ -118,22 +119,33 @@ //And finally, clean everything $backup_name = clean_filename($backup_name); - //Add as text field - echo ""; - echo "

"; + echo get_string("name").":"; + echo "

"; + //Add as text field + echo ""; + echo "


"; + + } else { + echo ''; + } - //Now print the To Do list - echo "

"; //Here we check if backup_users = None. Then, we switch off every module //user info, user_files, logs and exercises and workshop backups. A Warning is showed to @@ -160,8 +172,10 @@ echo "


"; } - echo get_string("backupdetails").":"; - echo "

"; - $user_options[0] = get_string("includeallusers"); - $user_options[1] = get_string("includecourseusers"); - $user_options[2] = get_string("includenoneusers"); - echo "

  • ".$user_options[$backup_users]."

    "; + + if (empty($to)) { + //Line + echo "


  • "; + $user_options[0] = get_string("includeallusers"); + $user_options[1] = get_string("includecourseusers"); + $user_options[2] = get_string("includenoneusers"); + echo "

  • ".$user_options[$backup_users]."

    "; + //Print info + $table->data = user_check_backup($id,$backup_unique_code,$backup_users); + print_table($table); + echo "

  • "; echo "

  • ".get_string("includelogentries")."

    "; @@ -260,9 +278,10 @@


  • - - -"> -"> + + + +" /> +" />
    diff --git a/backup/backup_execute.html b/backup/backup_execute.html index 0fe00113d2..fad9a5c018 100644 --- a/backup/backup_execute.html +++ b/backup/backup_execute.html @@ -6,7 +6,13 @@ if (!empty($course->id)) { if (!isteacheredit($course->id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -106,24 +112,26 @@ notice("No backupable modules are installed!"); } - //Start the main table - echo ""; - - //Now print the Backup Name tr - echo ""; - echo ""; - - //Start the main tr, where all the backup progress is done - echo ""; - echo "

    "; - echo get_string("name").":"; - echo "

    "; - echo $preferences->backup_name; - echo "
    "; - - //Start the main ul - echo "
      "; + if (empty($to)) { + //Start the main table + echo ""; + + //Now print the Backup Name tr + echo ""; + echo ""; + + //Start the main tr, where all the backup progress is done + echo ""; + echo ""; + if (empty($to)) { + $backup_user_options[0] = get_string("withoutuserdata"); + $backup_user_options[1] = get_string("withuserdata"); + choose_from_menu($backup_user_options, $var, $$var, ""); + } + else { + echo ''; + } + echo ""; } } //Line echo ""; - - //Now print the Users tr - echo ""; - echo ""; - - //Now print the Logs tr - echo ""; - echo ""; - - //Now print the User Files tr - echo ""; - echo ""; - + + if (empty($to)) { + //Now print the Users tr + echo ""; + echo ""; + } + else { + echo ''; + } + + if (empty($to)) { + //Now print the Logs tr + echo ""; + echo ""; + } + else { + echo ''; + } + + if (empty($to)) { + //Now print the User Files tr + echo ""; + echo ""; + } + else { + echo ''; + } //Now print the Course Files tr echo ""; - echo "

      "; + echo get_string("name").":"; + echo "

      "; + echo $preferences->backup_name; + echo "
      "; + + //Start the main ul + echo "
        "; + } //Check for temp and backup and backup_unique_code directory //Create them as needed echo "
      • ".get_string("creatingtemporarystructures"); @@ -185,9 +193,9 @@ //End course contents (close ul) echo "
      "; - echo "
    • ".get_string("writinguserinfo"); //User info - if ($status) { + if ($status && $preferences->backup_users) { + echo "
    • ".get_string("writinguserinfo"); if (!$status = backup_user_info($backup_file,$preferences)) { notify("An error occurred while backing up user info"); } @@ -346,8 +354,19 @@ "$CFG->wwwroot/course/view.php?id=$course->id"); } - //Print final message - print_simple_box(get_string("backupfinished"),"center"); - print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&wdir=/backupdata"); - + if (empty($to)) { + //Print final message + print_simple_box(get_string("backupfinished"),"center"); + print_continue("$CFG->wwwroot/files/index.php?id=".$preferences->backup_course."&wdir=/backupdata"); + } else { + print_simple_box(get_string('importdataexported'),"CENTER"); + if (!empty($preferences->backup_destination)) { + $filename = $preferences->backup_destination."/".$preferences->backup_name; + } else { + $filename = $preferences->backup_course."/backupdata/".$preferences->backup_name; + } + error_log($filename); + $SESSION->import_preferences = $preferences; + print_continue($CFG->wwwroot.'/course/import.php?id='.$to.'&fromcourse='.$id.'&filename='.$filename); + } ?> diff --git a/backup/backup_form.html b/backup/backup_form.html index 8e48b24bb7..7c542858b8 100644 --- a/backup/backup_form.html +++ b/backup/backup_form.html @@ -6,7 +6,13 @@ if (!empty($course->id)) { if (!isteacheredit($course->id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -92,50 +98,69 @@ $backup_options[1] = get_string("yes"); $var = "backup_".$modname; choose_from_menu($backup_options, $var, $$var, ""); - $backup_user_options[0] = get_string("withoutuserdata"); - $backup_user_options[1] = get_string("withuserdata"); $var = "backup_user_info_".$modname; - choose_from_menu($backup_user_options, $var, $$var, ""); - echo "

    • "; - echo get_string("users").":"; - echo "

      "; - $user_options[0] = get_string("all"); - $user_options[1] = get_string("course"); - $user_options[2] = get_string("none"); - choose_from_menu($user_options, "backup_users", $backup_users, ""); - echo "

      "; - echo get_string("logs").":"; - echo "

      "; - $log_options[0] = get_string("no"); - $log_options[1] = get_string("yes"); - choose_from_menu($log_options, "backup_logs", $backup_logs, ""); - echo "

      "; - echo get_string ("userfiles").":"; - echo "

      "; - $user_file_options[0] = get_string("no"); - $user_file_options[1] = get_string("yes"); - choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, ""); - echo "

      "; + echo get_string("users").":"; + echo "

      "; + $user_options[0] = get_string("all"); + $user_options[1] = get_string("course"); + $user_options[2] = get_string("none"); + choose_from_menu($user_options, "backup_users", $backup_users, ""); + echo "

      "; + echo get_string("logs").":"; + echo "

      "; + $log_options[0] = get_string("no"); + $log_options[1] = get_string("yes"); + choose_from_menu($log_options, "backup_logs", $backup_logs, ""); + echo "

      "; + echo get_string ("userfiles").":"; + echo "

      "; + $user_file_options[0] = get_string("no"); + $user_file_options[1] = get_string("yes"); + choose_from_menu($user_file_options, "backup_user_files", $backup_user_files, ""); + echo "

      "; + echo "

      "; echo get_string ("coursefiles").":"; echo "

      "; $course_file_options[0] = get_string("no"); @@ -147,9 +172,10 @@

      - - -"> -"> + + + +" /> +" />
      diff --git a/backup/restore.php b/backup/restore.php index 0a2c011100..dda9e1cf95 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -16,13 +16,24 @@ optional_variable($file); optional_variable($cancel); optional_variable($launch); + optional_variable($to); //Check login require_login(); + if (!$to && isset($SESSION->restore->restoreto) && isset($SESSION->restore->importing) && isset($SESSION->restore->course_id)) { + $to = $SESSION->restore->course_id; + } + if (!empty($id)) { if (!isteacheredit($id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -47,7 +58,11 @@ upgrade_backup_db($linkto); //Get strings - $strcourserestore = get_string("courserestore"); + if (empty($to)) { + $strcourserestore = get_string("courserestore"); + } else { + $strcourserestore = get_string("importdata"); + } $stradministration = get_string("administration"); //If no file has been selected from the FileManager, inform and end @@ -90,7 +105,7 @@ $strcourserestore"); } //Print form - print_heading("$strcourserestore: ".basename($file)); + print_heading("$strcourserestore".((empty($to) ? ': '.basename($file) : ''))); print_simple_box_start("center", "", "$THEME->cellheading"); //Adjust some php variables to the execution of this script @@ -98,10 +113,18 @@ raise_memory_limit("memory_limit","128M"); //Call the form, depending the step we are + + if (!$launch) { include_once("restore_precheck.html"); } else if ($launch == "form") { - include_once("restore_form.html"); + if ($SESSION->restore->importing) { + // set up all the config stuff and skip asking the user about it. + restore_setup_for_check($SESSION->restore,$backup_unique_code); + include_once("restore_execute.html"); + } else { + include_once("restore_form.html"); + } } else if ($launch == "check") { include_once("restore_check.html"); } else if ($launch == "execute") { diff --git a/backup/restore_execute.html b/backup/restore_execute.html index 35242c776c..e3c7b057cb 100644 --- a/backup/restore_execute.html +++ b/backup/restore_execute.html @@ -20,7 +20,13 @@ //Check admin if (!empty($id)) { if (!isteacheredit($id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -382,8 +388,14 @@ error ("An error has occurred and the restore could not be completed!"); } - //Print final message - print_simple_box(get_string("restorefinished"),"center"); + if (!$restore->importing) { + echo $output; + //Print final message + print_simple_box(get_string("restorefinished"),"CENTER"); + } else { + print_simple_box(get_string("importdatafinished"),"CENTER"); + unset($SESSION->restore); + } print_continue("$CFG->wwwroot/course/view.php?id=".$restore->course_id); ?> diff --git a/backup/restore_precheck.html b/backup/restore_precheck.html index f046a025f8..02e8200446 100644 --- a/backup/restore_precheck.html +++ b/backup/restore_precheck.html @@ -15,7 +15,13 @@ //Check admin if (!empty($id)) { if (!isteacheredit($id)) { - error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + if (empty($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } else { + if (!isteacheredit($to)) { + error("You need to be a teacher or admin user to use this page.", "$CFG->wwwroot/login/index.php"); + } + } } } else { if (!isadmin()) { @@ -28,127 +34,10 @@ error("Site not found!"); } - //Prepend dataroot to variable to have the absolute path - $file = $CFG->dataroot."/".$file; - - //Start the main table - echo ""; - echo ""; - echo "
      "; - - //Start the mail ul - echo "
        "; - - //Check the file exists - if (!is_file($file)) { - error ("File not exists ($file)"); - } - - //Check the file name ends with .zip - if (!substr($file,-4) == ".zip") { - error ("File has an incorrect extension"); - } - - //Now calculate the unique_code for this restore - $backup_unique_code = time(); - - //Now check and create the backup dir (if it doesn't exist) - echo "
      • ".get_string("creatingtemporarystructures"); - $status = check_and_create_backup_dir($backup_unique_code); - //Empty dir - if ($status) { - $status = clear_backup_dir($backup_unique_code); - } - - //Now delete old data and directories under dataroot/temp/backup - if ($status) { - echo "
      • ".get_string("deletingolddata"); - $status = backup_delete_old_data(); - } - - //Now copy he zip file to dataroot/temp/backup/backup_unique_code - if ($status) { - echo "
      • ".get_string("copyingzipfile"); - if (! $status = backup_copy_file($file,$CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) { - notify("Error copying backup file. Invalid name or bad perms."); - } - } - - //Now unzip the file - if ($status) { - echo "
      • ".get_string("unzippingbackup"); - if (! $status = restore_unzip ($CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) { - notify("Error unzipping backup file. Invalid zip file."); - } - } - - //Now check for the moodle.xml file - if ($status) { - $xml_file = $CFG->dataroot."/temp/backup/".$backup_unique_code."/moodle.xml"; - echo "
      • ".get_string("checkingbackup"); - if (! $status = restore_check_moodle_file ($xml_file)) { - notify("Error checking backup file. Invalid or corrupted."); - } - } - - $info = ""; - $course_header = ""; - - //Now read the info tag (all) - if ($status) { - echo "
      • ".get_string("readinginfofrombackup"); - //Reading info from file - $info = restore_read_xml_info ($xml_file); - //Reading course_header from file - $course_header = restore_read_xml_course_header ($xml_file); - } - - //End the main ul - echo "
      "; - - //End the main table - echo "
      "; - - //We compare Moodle's versions - if ($CFG->version < $info->backup_moodle_version && $status) { - $message->serverversion = $CFG->version; - $message->serverrelease = $CFG->release; - $message->backupversion = $info->backup_moodle_version; - $message->backuprelease = $info->backup_moodle_release; - print_simple_box(get_string('noticenewerbackup','',$message), "center", "70%", "$THEME->cellheading2", "20", "noticebox"); - - } - - //Now we print in other table, the backup and the course it contains info - if ($info and $course_header and $status) { - //First, the course info - $status = restore_print_course_header($course_header); - //Now, the backup info - if ($status) { - $status = restore_print_info($info); - } - } - - //Save course header and info into php session - if ($status) { - $SESSION->info = $info; - $SESSION->course_header = $course_header; - } - - //Finally, a little form to continue - //with some hidden fields - if ($status) { - echo "
      "; - $hidden["backup_unique_code"] = $backup_unique_code; - $hidden["launch"] = "form"; - $hidden["file"] = $file; - $hidden["id"] = $id; - print_single_button("restore.php", $hidden, get_string("continue"),"post"); - echo "
      "; - } - + $status = restore_precheck($id,$file,!empty($SESSION->restore->importing)); + if (!$status) { - error ("An error has ocurred"); + error("An error occured"); } ?> diff --git a/backup/restorelib.php b/backup/restorelib.php index 0c367c14a6..c4845451f9 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -3165,4 +3165,192 @@ return $status; } } + + function restore_precheck($id,$file,$silent=false) { + + global $CFG; + + //Prepend dataroot to variable to have the absolute path + $file = $CFG->dataroot."/".$file; + + if (empty($silent)) { + //Start the main table + echo ""; + echo ""; + echo "
      "; + + //Start the mail ul + echo "
        "; + } + + //Check the file exists + if (!is_file($file)) { + error ("File not exists ($file)"); + } + + //Check the file name ends with .zip + if (!substr($file,-4) == ".zip") { + error ("File has an incorrect extension"); + } + + //Now calculate the unique_code for this restore + $backup_unique_code = time(); + + //Now check and create the backup dir (if it doesn't exist) + if (empty($silent)) { + echo "
      • ".get_string("creatingtemporarystructures"); + } + $status = check_and_create_backup_dir($backup_unique_code); + //Empty dir + if ($status) { + $status = clear_backup_dir($backup_unique_code); + } + + //Now delete old data and directories under dataroot/temp/backup + if ($status) { + if (empty($silent)) { + echo "
      • ".get_string("deletingolddata"); + } + $status = backup_delete_old_data(); + } + + //Now copy he zip file to dataroot/temp/backup/backup_unique_code + if ($status) { + if (empty($silent)) { + echo "
      • ".get_string("copyingzipfile"); + } + if (! $status = backup_copy_file($file,$CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) { + notify("Error copying backup file. Invalid name or bad perms."); + } + } + + //Now unzip the file + if ($status) { + if (empty($silent)) { + echo "
      • ".get_string("unzippingbackup"); + } + if (! $status = restore_unzip ($CFG->dataroot."/temp/backup/".$backup_unique_code."/".basename($file))) { + notify("Error unzipping backup file. Invalid zip file."); + } + } + + //Now check for the moodle.xml file + if ($status) { + $xml_file = $CFG->dataroot."/temp/backup/".$backup_unique_code."/moodle.xml"; + if (empty($silent)) { + echo "
      • ".get_string("checkingbackup"); + } + if (! $status = restore_check_moodle_file ($xml_file)) { + notify("Error checking backup file. Invalid or corrupted."); + } + } + + $info = ""; + $course_header = ""; + + //Now read the info tag (all) + if ($status) { + if (empty($silent)) { + echo "
      • ".get_string("readinginfofrombackup"); + } + //Reading info from file + $info = restore_read_xml_info ($xml_file); + //Reading course_header from file + $course_header = restore_read_xml_course_header ($xml_file); + } + + if (empty($silent)) { + //End the main ul + echo "
      "; + + //End the main table + echo "
      "; + } + + //We compare Moodle's versions + if ($CFG->version < $info->backup_moodle_version && $status) { + $message->serverversion = $CFG->version; + $message->serverrelease = $CFG->release; + $message->backupversion = $info->backup_moodle_version; + $message->backuprelease = $info->backup_moodle_release; + print_simple_box(get_string('noticenewerbackup','',$message), "center", "70%", "$THEME->cellheading2", "20", "noticebox"); + + } + + //Now we print in other table, the backup and the course it contains info + if ($info and $course_header and $status) { + //First, the course info + $status = restore_print_course_header($course_header); + //Now, the backup info + if ($status) { + $status = restore_print_info($info); + } + } + + //Save course header and info into php session + if ($status) { + $SESSION->info = $info; + $SESSION->course_header = $course_header; + } + + //Finally, a little form to continue + //with some hidden fields + if ($status) { + if (empty($silent)) { + echo "
      "; + $hidden["backup_unique_code"] = $backup_unique_code; + $hidden["launch"] = "form"; + $hidden["file"] = $file; + $hidden["id"] = $id; + print_single_button("restore.php", $hidden, get_string("continue"),"post"); + echo "
      "; + } + else { + redirect($CFG->wwwroot.'/backup/restore.php?backup_unique_code='.$backup_unique_code.'&launch=form&file='.$file.'&id='.$id); + } + } + + if (!$status) { + error ("An error has ocurred"); + } + return true; + } + + function restore_setup_for_check(&$restore,$backup_unique_code) { + global $SESSION; + $restore->backup_unique_code=$backup_unique_code; + $restore->users = 2; // yuk + if ($allmods = get_records("modules")) { + foreach ($allmods as $mod) { + $modname = $mod->name; + $var = "restore_".$modname; + //Now check that we have that module info in the backup file + if (isset($SESSION->info->mods[$modname]) && $SESSION->info->mods[$modname]->backup == "true") { + $restore->$var = 1; + } + } + } + } + + function backup_to_restore_array($backup,$k=0) { + if (is_array($backup) ) { + foreach ($backup as $key => $value) { + $newkey = str_replace('backup','restore',$key); + $restore[$newkey] = backup_to_restore_array($value,$key); + } + } + else if (is_object($backup)) { + $tmp = get_object_vars($backup); + foreach ($tmp as $key => $value) { + $newkey = str_replace('backup','restore',$key); + $restore->$newkey = backup_to_restore_array($value,$key); + } + } + else { + $newkey = str_replace('backup','restore',$k); + $restore = $backup; + } + return $restore; + } + ?> diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index 986f338b81..eb0a96c9fa 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -117,6 +117,10 @@ class block_admin extends block_base { $this->content->items[]=''.get_string('restore').'...'; $this->content->icons[]=''; + + $this->content->items[]=''.get_string('importdata').''; + $this->content->icons[]=''; + $this->content->items[]=''.get_string('scales').'...'; $this->content->icons[]=''; } diff --git a/lang/en/moodle.php b/lang/en/moodle.php index fc20a90a6f..da4ab08f47 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -254,6 +254,8 @@ $string['coursegrades'] = 'Course grades'; $string['courseinfo'] = 'Course info'; $string['courserestore'] = 'Course restore'; $string['courses'] = 'Courses'; +$string['coursestaught'] = 'Courses I have taught'; +$string['coursescategory'] = 'Courses in the same category'; $string['courseupdates'] = 'Course updates'; $string['courseuploadlimit'] = 'Course upload limit'; $string['create'] = 'Create'; @@ -590,6 +592,10 @@ $string['htmleditordisabledbrowser'] = 'The HTML editor is unavailable because y $string['htmlformat'] = 'Pretty HTML format'; $string['icqnumber'] = 'ICQ number'; $string['idnumber'] = 'ID number'; +$string['importdata'] = 'Import course data'; +$string['importdatafrom'] = 'Find a course to import data from:'; +$string['importdataexported'] = 'Exported data from \'from\' course successfully.
      Continue to import into your \'to\' course.'; +$string['importdatafinished'] = 'Import complete! Continue to your course'; $string['importmetacoursenote'] = 'Use this form to add courses to your meta course (this will import the enrolments)'; $string['inactive'] = 'Inactive'; $string['include'] = 'Include'; @@ -797,6 +803,7 @@ $string['nopotentialadmins'] = 'No potential admins'; $string['nopotentialcreators'] = 'No potential course creators'; $string['nopotentialstudents'] = 'No potential students'; $string['nopotentialteachers'] = 'No potential teachers'; +$string['noresults'] = 'No results'; $string['normal'] = 'Normal'; $string['normalfilter'] = 'Normal search'; $string['nostudentsfound'] = 'No $a found'; @@ -1093,6 +1100,7 @@ $string['userprofilefor'] = 'User profile for $a'; $string['users'] = 'Users'; $string['usersnew'] = 'New users'; $string['userzones'] = 'User zones'; +$string['usethiscourse'] = 'Use this course'; $string['usingexistingcourse'] = 'Using existing course'; $string['version'] = 'Version'; $string['view'] = 'View'; -- 2.39.5