From: vyshane Date: Sun, 24 Sep 2006 13:58:54 +0000 (+0000) Subject: Removed the following module configurations (converted to use roles): X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=57244db3594036bf31f5ad142656bfefb316cc1a;p=moodle.git 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). --- diff --git a/mod/data/backuplib.php b/mod/data/backuplib.php index 952e90fdb4..8666439dc3 100644 --- a/mod/data/backuplib.php +++ b/mod/data/backuplib.php @@ -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 diff --git a/mod/data/lib.php b/mod/data/lib.php index 1e3ef59791..373771abf1 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -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 '
'; echo '
'; $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 ' '; diff --git a/mod/data/mod.html b/mod/data/mod.html index c8a3a26d15..8f430a2dc1 100644 --- a/mod/data/mod.html +++ b/mod/data/mod.html @@ -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 @@ - - : - - 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'); - ?> - - - - : @@ -258,18 +234,20 @@ '; - echo " var subitemsall = ['assessed', 'assesspublic', 'scale'];"; + echo " var subitemsall = ['scale'];"; echo ''; - echo 'ratings) { + //echo 'assessed) { echo ' checked="checked" '; } echo ' />'; echo ' '.get_string('ratingsuse', 'data').':'; echo ''; +/* echo ''; // The odd order below was to maintain backward compatibility unset($options); @@ -279,16 +257,7 @@ echo ''; choose_from_menu($options, 'assessed', $form->assessed, ''); echo ''; - - echo ''; - unset($options); - $options[0] = get_string('ratingpublicnot', 'data', $course->students); - $options[1] = get_string('ratingpublic', 'data', $course->students); - echo get_string('view').': '; - echo ''; - choose_from_menu($options, 'assesspublic', $form->assesspublic, ''); - echo ''; - +*/ echo ''; echo get_string('grade').': '; echo ''; @@ -298,11 +267,10 @@ echo ''; echo ''; - echo ''; echo ''; echo ''; ?> diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index e3933dc755..ddefa21520 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -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,"   the TIMEVIEWTO is now " .$date['weekday'].", ".$date['mday']." ".$date['month']." ".$date['year']."
"); - $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);