Skip to content

Commit

Permalink
merging MOODLE_19_QUESTIONS with HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesensei committed Aug 9, 2007
1 parent e8a46dc commit 3bee1ea
Show file tree
Hide file tree
Showing 19 changed files with 1,068 additions and 592 deletions.
5 changes: 5 additions & 0 deletions admin/environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@
<ON_OK message="qtyperqpwillberemoved" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/upgrade.php" function="question_random_check" level="optional">
<FEEDBACK>
<ON_OK message="questioncwqpfsok" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.0">
Expand Down
1 change: 1 addition & 0 deletions admin/settings/courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
$temp->add(new admin_setting_backupcheckbox('backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0));
$temp->add(new admin_setting_backupcheckbox('backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0));
$temp->add(new admin_setting_backupcheckbox('backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0));
$temp->add(new admin_setting_backupcheckbox('backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0));
$temp->add(new admin_setting_backupcheckbox('backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0));
$temp->add(new admin_setting_backupselect('backup_sche_keep', get_string('keep'), get_string('backupkeephelp'), 1, array(0 => get_string('all'),
1 => '1',
Expand Down
7 changes: 3 additions & 4 deletions backup/backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

//Check necessary functions exists. Thanks to gregb@crowncollege.edu
backup_required_functions();

//Check backup_version
if ($id) {
$linkto = "backup.php?id=".$id.((!empty($to)) ? '&to='.$to : '');
Expand Down Expand Up @@ -101,11 +101,11 @@
<a href=\"backup.php\">$strcoursebackup</a> -> $course->fullname ($course->shortname)");
} else {
print_header("$course->shortname: $strcoursebackup", $course->fullname,
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
$strcoursebackup");
}

//Print form
//Print form
print_heading(format_string("$strcoursebackup: $course->fullname ($course->shortname)"));
print_simple_box_start("center");

Expand All @@ -129,5 +129,4 @@

//Print footer
print_footer();

?>
51 changes: 33 additions & 18 deletions backup/backup_check.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php //$Id$
require_once("$CFG->dirroot/question/backuplib.php");
//This page prints the backup todo list to see everything

//Check login
//Check login
require_login();

if (!empty($course->id)) {
Expand All @@ -20,19 +21,26 @@
}
}



$backupprefs = new StdClass;
$count = 0;
backup_fetch_prefs_from_request($backupprefs,$count,$course);



//Check site
if (!$site = get_site()) {
error("Site not found!");
}
if ($count == 0) {
notice("No backupable modules are installed!");
}

if (!execute_sql("DELETE FROM {$CFG->prefix}backup_ids WHERE backup_code = '{$backupprefs->backup_unique_code}'",false)){
error('Couldn\'t delete previous backup ids.');
}

?>

<form id="form" method="post" action="backup.php">
Expand All @@ -48,12 +56,12 @@
//Add as text field
echo "<input type=\"text\" name=\"backup_name\" size=\"40\" value=\"".$backupprefs->backup_name."\" />";
echo "</td></tr>";

//Line
echo "<tr><td colspan=\"2\"><hr /></td></tr>";

//Now print the To Do list
echo "<tr>";
echo "<tr>";
echo "<td colspan=\"2\" align=\"center\"><b>";

}
Expand Down Expand Up @@ -90,7 +98,7 @@
echo "</b></td></tr>";
}

//This is tha align to every ingo table
//This is the alignment of every row in the table
$table->align = array ("left","right");

if ($allmods = get_records("modules") ) {
Expand All @@ -111,13 +119,10 @@
//Print the full tr
echo "<tr>";
echo "<td colspan=\"2\">";
//Add hidden fields
$var = "backup_".$modname;
$var = "backup_user_info_".$modname;
//Print the mod name
echo "<b>".get_string("include")." ".get_string("modulenameplural",$modname)." ";
//Now look for user-data status
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
$var = "backup_user_info_".$modname;
//Print the user info
Expand All @@ -139,17 +144,17 @@
$obj->id = $instance->id;
$instancestopass[$instance->id]= $obj;
$countinstances++;

}
}
}
}
$table->data = $modcheckbackup($id,$backupprefs->$var,$backupprefs->backup_unique_code,$instancestopass);
print_table($table);
print_table($table);
echo "</td></tr>";
}
}
}


if (empty($to)) {
//Line
Expand All @@ -163,12 +168,12 @@
$user_options[2] = get_string("includenoneusers");
echo $user_options[$backupprefs->backup_users].'</b>';
//Print info
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages);
print_table($table);
$table->data = user_check_backup($id,$backupprefs->backup_unique_code,$backupprefs->backup_users,$backupprefs->backup_messages);
print_table($table);
echo "</td></tr>";

}

//Now print the Logs tr conditionally
if ($backupprefs->backup_logs && empty($to)) {
echo "<tr>";
Expand Down Expand Up @@ -201,6 +206,16 @@
print_table($table);
echo "</td></tr>";
}
//Now print the site Files tr conditionally
if ($backupprefs->backup_site_files) {
echo "<tr>";
echo "<td colspan=\"2\"><b>";
echo get_string("includesitefiles").'</b>';
//Print info
$table->data = site_files_check_backup($id,$backupprefs->backup_unique_code);
print_table($table);
echo "</td></tr>";
}
}

// now keep it for next time.
Expand Down
54 changes: 34 additions & 20 deletions backup/backup_form.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php //$Id$
//This page prints the backup form to select everything

//Check login
//Check login
require_login();

if (!empty($course->id)) {
Expand All @@ -26,7 +26,7 @@
}

//Checks for the required files/functions to backup every mod
//And check if there is data about it
//And check if there is data about it
$count = 0;
if ($allmods = get_records("modules") ) {
foreach ($allmods as $mod) {
Expand Down Expand Up @@ -64,6 +64,7 @@
$backup_logs = optional_param('backup_logs',0);
$backup_user_files = optional_param('backup_user_files',1);
$backup_course_files = optional_param('backup_course_files',1);
$backup_site_files = optional_param('backup_site_files',1);
$backup_gradebook_history = optional_param('backup_gradebook_history', 1, PARAM_INT);
$backup_messages = optional_param('backup_messages',1);

Expand Down Expand Up @@ -145,7 +146,7 @@
echo "<tr class=\"r".$currentrow."\">";
echo " <td align=\"right\">&nbsp;";
echo "</td><td>\n";
$backup_options[0] = get_string("no");
$backup_options[0] = get_string("no");
$backup_options[1] = get_string("yes");
$var = "backup_".$modname;
//choose_from_menu($backup_options, $var, $$var, "");
Expand All @@ -155,14 +156,14 @@
echo "</td><td>";
$var = "backup_user_info_".$modname;
if (empty($to)) {
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[0] = get_string("withoutuserdata");
$backup_user_options[1] = get_string("withuserdata");
//choose_from_menu($backup_user_options, $var, $$var, "");
print_checkbox($var, $$var, $$var, get_string("userdata"),'','selectItemInCheckboxByName(\'form1\',\'backup_user_info_'.$modname.'\',this.checked)');
} else {
echo '<input type="hidden" name="'.$var.'" value="0" />';
}
echo "</td></tr>\n";
echo "</td></tr>\n";
// if we have the backup_one_mod function, loop here.
$var = 'exists_one_'.$modname;
if (!empty($$var)) {
Expand All @@ -185,20 +186,20 @@
}
echo '</table></td></tr>';
}

}
}
//Line
echo "<tr><td colspan=\"4\"><hr /></td></tr>\n";

if (empty($to)) {
//Now print the Metacourse tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo get_string ("metacourse").":";
echo "</b></td><td colspan=\"2\">";
$meta_options[0] = get_string("no");
$meta_options[1] = get_string("yes");
$meta_options[0] = get_string("no");
$meta_options[1] = get_string("yes");
choose_from_menu($meta_options, "backup_metacourse", $backup_metacourse, "");
echo "</td></tr>";
}
Expand All @@ -221,30 +222,30 @@
else {
echo '<input type="hidden" name="backup_users" value="0" />';
}

if (empty($to)) {
//Now print the Logs tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo get_string("logs").":";
echo get_string("logs").":";
echo "</b></td><td colspan=\"2\">";
$log_options[0] = get_string("no");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
$log_options[1] = get_string("yes");
choose_from_menu($log_options, "backup_logs", $backup_logs, "");
echo "</td></tr>";
}
else {
echo '<input type="hidden" name="backup_logs" value="0" />';
}

if (empty($to)) {
//Now print the User Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo get_string ("userfiles").":";
echo "</b></td><td colspan=\"2\">";
$user_file_options[0] = get_string("no");
$user_file_options[1] = get_string("yes");
$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 "</td></tr>";
}
Expand All @@ -261,6 +262,19 @@
choose_from_menu($course_file_options, "backup_course_files", $backup_course_files, "");
echo "</td></tr>";


if ($course->id != SITEID){
//Now print the site Files tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo get_string ("sitefilesused").":";
echo "</b></td><td colspan=\"2\">";
$course_file_options[0] = get_string("no");
$course_file_options[1] = get_string("yes");
choose_from_menu($course_file_options, "backup_site_files", $backup_site_files, "");
echo "</td></tr>";
}

// do you want grade histories to be backed up?
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
Expand All @@ -277,8 +291,8 @@
echo "<td align=\"right\" colspan=\"2\"><b>";
echo get_string ('messages','message').":";
echo "</b></td><td colspan=\"2\">";
$mess_options[0] = get_string("no");
$mess_options[1] = get_string("yes");
$mess_options[0] = get_string("no");
$mess_options[1] = get_string("yes");
choose_from_menu($mess_options, "backup_messages", $backup_messages, "");
echo "</td></tr>";
}
Expand All @@ -293,8 +307,8 @@
//Calculate the backup unique code to allow simultaneus backups (to define
//the temp-directory name and records in backup temp tables
$backup_name = backup_get_zipfile_name($course, $backup_unique_code);


?>
</table>

Expand Down
Loading

0 comments on commit 3bee1ea

Please sign in to comment.