Removed the following module configurations (converted to use roles):

participants, assesspublic and ratings. Changed assessed field to only use 1 (ratings on) or 0 (off).
This commit is contained in:
vyshane 2006-09-24 13:58:54 +00:00
parent 847a041fb7
commit 57244db359
4 changed files with 28 additions and 58 deletions

View File

@ -77,13 +77,11 @@ function data_backup_one_mod($bf,$preferences,$data) {
fwrite ($bf,full_tag("MODTYPE",4,false,"data"));
fwrite ($bf,full_tag("NAME",4,false,$data->name));
fwrite ($bf,full_tag("INTRO",4,false,$data->intro));
fwrite ($bf,full_tag("RATINGS",4,false,$data->ratings));
fwrite ($bf,full_tag("COMMENTS",4,false,$data->comments));
fwrite ($bf,full_tag("TIMEAVAILABLEFROM",4,false,$data->timeavailablefrom));
fwrite ($bf,full_tag("TIMEAVAILABLETO",4,false,$data->timeavailableto));
fwrite ($bf,full_tag("TIMEVIEWFROM",4,false,$data->timeviewfrom));
fwrite ($bf,full_tag("TIMEVIEWTO",4,false,$data->timeviewto));
fwrite ($bf,full_tag("PARTICIPANTS",4,false,$data->participants));
fwrite ($bf,full_tag("REQUIREDENTRIES",4,false,$data->requiredentries));
fwrite ($bf,full_tag("REQUIREDENTRIESTOVIEW",4,false,$data->requiredentriestoview));
fwrite ($bf,full_tag("MAXENTRIES",4,false,$data->maxentries));
@ -100,7 +98,6 @@ function data_backup_one_mod($bf,$preferences,$data) {
fwrite ($bf,full_tag("APPROVAL",4,false,$data->approval));
fwrite ($bf,full_tag("SCALE",4,false,$data->scale));
fwrite ($bf,full_tag("ASSESSED",4,false,$data->assessed));
fwrite ($bf,full_tag("ASSESSPUBLIC",4,false,$data->assesspublic));
// if we've selected to backup users info, then call any other functions we need
// including backing up individual files

View File

@ -23,9 +23,6 @@
///////////////////////////////////////////////////////////////////////////
/// Some constants
define ('DATA_TEACHERS_ONLY', 1);
define ('DATA_STUDENTS_ONLY', 2);
define ('DATA_TEACHERS_AND_STUDENTS', 3);
define ('DATA_MAX_ENTRIES', 50);
define ('DATA_PERPAGE_SINGLE', 1);
@ -595,8 +592,8 @@ function data_tags_check($dataid, $template){
function data_add_instance($data) {
global $CFG;
if (empty($data->ratings)) {
$data->ratings = 0;
if (empty($data->assessed)) {
$data->assessed = 0;
}
$data->timemodified = time();
@ -645,8 +642,8 @@ function data_update_instance($data) {
$data->id = $data->instance;
if (empty($data->ratings)) {
$data->ratings = 0;
if (empty($data->assessed)) {
$data->assessed = 0;
}
$data->timemodified = time();
@ -994,17 +991,16 @@ function data_print_ratings($data, $record) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$ratingsmenuused = false;
if ($data->ratings and !empty($USER->id)) {
if ($data->assessed and !empty($USER->id)) {
if ($ratings->scale = make_grades_menu($data->scale)) {
$ratings->assesspublic = $data->assesspublic;
$ratings->allow = ($data->assessed != 2 or has_capability('mod/data:rate', $context));
$ratings->allow = ($data->assessed and has_capability('mod/data:rate', $context));
if ($ratings->allow) {
echo '<div class="ratings" align="center">';
echo '<form name="form" method="post" action="rate.php">';
$useratings = true;
if ($useratings) {
if ((has_capability('mod/data:rate', $context) or $ratings->assesspublic) and !data_isowner($record->id)) {
if (has_capability('mod/data:rate', $context) and !data_isowner($record->id)) {
data_print_ratings_mean($record->id, $ratings->scale, has_capability('mod/data:rate', $context));
if (!empty($ratings->allow)) {
echo '&nbsp;';

View File

@ -29,9 +29,6 @@
if (!isset($form->schedule)) {
$form->schedule = 0;
}
if (!isset($form->participants)) {
$form->participants = DATA_TEACHERS_AND_STUDENTS;
}
if (!isset($form->requiredentries)) {
$form->requiredentries = 0;
}
@ -47,9 +44,6 @@
if (!isset($form->comments)) {
$form->comments = 0;
}
if (!isset($form->ratings)) {
$form->ratings = 0;
}
if (!isset($form->approval)) {
$form->approval = 0;
}
@ -57,10 +51,7 @@
$form->scale = 0;
}
if (!isset($form->assessed)) {
$form->assessed = 1;
}
if (!isset($form->assesspublic)) {
$form->assesspublic = 1;
$form->assessed = 0;
}
?>
@ -168,21 +159,6 @@
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('participants', 'data') ?>:</b></td>
<td>
<?php
$a->teachers = $course->teachers;
$a->students = $course->students;
$options = array(DATA_TEACHERS_ONLY => $a->teachers,
DATA_TEACHERS_AND_STUDENTS => get_string('teachersandstudents', 'data', $a));
choose_from_menu($options, 'participants', $form->participants, '');
helpbutton('participants', get_string('participants', 'data'), 'data');
?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string('requiredentries', 'data') ?>:</b></td>
<td>
@ -258,18 +234,20 @@
<td colspan="2">
<?php
echo '<script type="text/javascript">';
echo " var subitemsall = ['assessed', 'assesspublic', 'scale'];";
echo " var subitemsall = ['scale'];";
echo '</script>';
echo '<input name="ratings" type="checkbox" alt="'.get_string('ratingsuse', 'data').'" value="1" ';
echo " onclick=\"return lockoptions('form','ratings', subitemsall)\" ";
if ($form->ratings) {
//echo '<input name="ratings" type="checkbox" alt="'.get_string('ratingsuse', 'data').'" value="1" ';
echo '<input name="assessed" type="checkbox" alt="'.get_string('ratingsuse', 'data').'" value="1" ';
echo " onclick=\"return lockoptions('form', 'assessed', subitemsall)\" ";
if ($form->assessed) {
echo ' checked="checked" ';
}
echo ' />';
echo '&nbsp;'.get_string('ratingsuse', 'data').':';
echo '</td></tr>';
/*
echo '<tr><td>';
// The odd order below was to maintain backward compatibility
unset($options);
@ -279,16 +257,7 @@
echo '</td><td>';
choose_from_menu($options, 'assessed', $form->assessed, '');
echo '</td></tr>';
echo '<tr><td>';
unset($options);
$options[0] = get_string('ratingpublicnot', 'data', $course->students);
$options[1] = get_string('ratingpublic', 'data', $course->students);
echo get_string('view').': ';
echo '</td><td>';
choose_from_menu($options, 'assesspublic', $form->assesspublic, '');
echo '</td></tr>';
*/
echo '<tr><td>';
echo get_string('grade').': ';
echo '</td><td>';
@ -298,11 +267,10 @@
echo '</td></tr></table>';
echo '<input type="hidden" name="hassessed" value="0" />';
echo '<input type="hidden" name="hassesspublic" value="0" />';
echo '<input type="hidden" name="hscale" value="0" />';
echo '<script type="text/javascript">';
echo "lockoptions('form','ratings', subitemsall);";
echo "lockoptions('form','assessed', subitemsall);";
echo '</script>';
?>

View File

@ -60,7 +60,10 @@ function data_restore_mods($mod,$restore) {
$database->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$database->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
$database->ratings = backup_todb($info['MOD']['#']['RATINGS']['0']['#']);
// Only relevant for restoring backups from 1.6 in a 1.7 install.
if (isset($info['MOD']['#']['RATINGS']['0']['#'])) {
$database->ratings = backup_todb($info['MOD']['#']['RATINGS']['0']['#']);
}
$database->comments = backup_todb($info['MOD']['#']['COMMENTS']['0']['#']);
$database->timeavailablefrom = backup_todb($info['MOD']['#']['TIMEAVAILABLEFROM']['0']['#']);
$date = usergetdate($database->timeavailablefrom);
@ -87,7 +90,10 @@ function data_restore_mods($mod,$restore) {
$database->timeviewto += $restore->course_startdateoffset;
$date = usergetdate($database->timeviewto);
fwrite ($restorelog_file,"&nbsp;&nbsp;&nbsp;the TIMEVIEWTO is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."<br>");
$database->participants = backup_todb($info['MOD']['#']['PARTICIPANTS']['0']['#']);
// Only relevant for restoring backups from 1.6 in a 1.7 install.
if (isset($info['MOD']['#']['PARTICIPANTS']['0']['#'])) {
$database->participants = backup_todb($info['MOD']['#']['PARTICIPANTS']['0']['#']);
}
$database->requiredentries = backup_todb($info['MOD']['#']['REQUIREDENTRIES']['0']['#']);
$database->requiredentriestoview = backup_todb($info['MOD']['#']['REQUIREDENTRIESTOVIEW']['0']['#']);
$database->maxentries = backup_todb($info['MOD']['#']['MAXENTRIES']['0']['#']);
@ -104,7 +110,10 @@ function data_restore_mods($mod,$restore) {
$database->approval = backup_todb($info['MOD']['#']['APPROVAL']['0']['#']);
$database->scale = backup_todb($info['MOD']['#']['SCALE']['0']['#']);
$database->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
$database->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
// Only relevant for restoring backups from 1.6 in a 1.7 install.
if (isset($info['MOD']['#']['ASSESSPUBLIC']['0']['#'])) {
$database->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
}
$newid = insert_record ('data', $database);