Permalink
Browse files

Merge branch 'workshop-submissions-anonymity-and-availability' of git…

…://github.com/mudrd8mz/moodle
  • Loading branch information...
2 parents 5ff33ba + d67c20b commit 500422e6d0c5a9cca11588db655e2ba44514df21 @stronk7 stronk7 committed Mar 7, 2011
View
@@ -42,7 +42,7 @@
)
),
- // Ability to change the current phase (stage) of the workshop, it est for example
+ // Ability to change the current phase (stage) of the workshop, for example
// allow submitting, start assessment period, close workshop etc.
'mod/workshop:switchphase' => array(
'captype' => 'write',
@@ -110,7 +110,7 @@
)
),
- // Ability to publish submissions, it est make them available when workshop is closed
+ // Ability to publish submissions, i.e. make them available when workshop is closed
'mod/workshop:publishsubmissions' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
@@ -134,7 +134,7 @@
)
),
- // Ability to identify the reviewer of the given submission (ie the owner of the assessment)
+ // Ability to identify the reviewer of the given submission (i.e. the owner of the assessment)
'mod/workshop:viewreviewernames' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
@@ -170,6 +170,18 @@
)
),
+ // Ability to view the authors of published submissions.
+ 'mod/workshop:viewauthorpublished' => array(
+ 'captype' => 'read',
+ 'contextlevel' => CONTEXT_MODULE,
+ 'archetypes' => array(
+ 'student' => CAP_ALLOW,
+ 'teacher' => CAP_ALLOW,
+ 'editingteacher' => CAP_ALLOW,
+ 'manager' => CAP_ALLOW
+ )
+ ),
+
// Ability to always view the assessments of other users' work and the calculated grades, regardless the phase.
// Applies to the user's group only or - if the user is allowed to access all groups - applies to any assessment
'mod/workshop:viewallassessments' => array(
@@ -178,7 +178,7 @@ protected function process_assessments(array $assessments, array $diminfo, stdcl
$distances[$asid] = $this->assessments_distance($assessment, $average, $diminfo, $settings);
}
- // identify the best assessments - it est those with the shortest distance from the best assessment
+ // identify the best assessments - that is those with the shortest distance from the best assessment
$bestids = array_keys($distances, min($distances));
// for every assessment, calculate its distance from the nearest best assessment
@@ -63,7 +63,7 @@ function workshopform_accumulative_upgrade_legacy() {
// refetch them from DB so that this function can be called during recovery
$newelementids = workshop_upgrade_element_id_mappings('accumulative');
- // migrate all grades for these elements (it est the values that reviewers put into forms)
+ // migrate all grades for these elements (i.e. the values that reviewers put into forms)
echo $OUTPUT->notification('Copying assessment form grades', 'notifysuccess');
$sql = "SELECT *
FROM {workshop_grades_old}
@@ -60,7 +60,7 @@ function workshopform_comments_upgrade_legacy() {
// now we need to reload the legacy element ids
$newelementids = workshop_upgrade_element_id_mappings('comments');
- // migrate all comments for these elements (it est the values that reviewers put into forms)
+ // migrate all comments for these elements (i.e. the values that reviewers put into forms)
echo $OUTPUT->notification('Copying assessment form comments', 'notifysuccess');
$sql = "SELECT *
FROM {workshop_grades_old}
@@ -83,7 +83,7 @@ function workshopform_numerrors_upgrade_legacy() {
// refetch them from DB so that this function can be called during recovery
$newelementids = workshop_upgrade_element_id_mappings('numerrors');
- // migrate all grades for these elements (it est the values that reviewers put into forms)
+ // migrate all grades for these elements (i.e. the values that reviewers put into forms)
echo $OUTPUT->notification('Copying assessment form grades', 'notifysuccess');
$sql = "SELECT *
FROM {workshop_grades_old}
@@ -556,7 +556,7 @@ protected function calculate_peer_grade(array $grades) {
if (empty($grades)) {
return null;
}
- $sumerrors = 0; // sum of the weighted errors (ie the negative responses)
+ $sumerrors = 0; // sum of the weighted errors (i.e. the negative responses)
foreach ($grades as $grade) {
if (grade_floats_different($grade->grade, 1.00000)) {
// negative reviewer's response
@@ -92,7 +92,7 @@ function workshopform_rubric_upgrade_legacy_criterion() {
// reload the mappings - this must be reloaded to that we can run this during recovery
$newelementids = workshop_upgrade_element_id_mappings('rubric_levels');
- // migrate all grades for these elements (it est the values that reviewers put into forms)
+ // migrate all grades for these elements (i.e. the values that reviewers put into forms)
echo $OUTPUT->notification('Copying criterion assessment form grades', 'notifysuccess');
$sql = "SELECT *
FROM {workshop_grades_old}
@@ -199,7 +199,7 @@ function workshopform_rubric_upgrade_legacy_rubric() {
unset($oldweights);
unset($element);
- // migrate all grades for these elements (it est the values that reviewers put into forms)
+ // migrate all grades for these elements (i.e. the values that reviewers put into forms)
echo $OUTPUT->notification('Copying rubric assessment form grades', 'notifysuccess');
$sql = "SELECT *
FROM {workshop_grades_old}
@@ -254,6 +254,7 @@
$string['workshop:viewallassessments'] = 'View all assessments';
$string['workshop:viewallsubmissions'] = 'View all submissions';
$string['workshop:viewauthornames'] = 'View author names';
+$string['workshop:viewauthorpublished'] = 'View authors of published submissions';
$string['workshop:viewpublishedsubmissions'] = 'View published submissions';
$string['workshop:viewreviewernames'] = 'View reviewer names';
$string['yoursubmission'] = 'Your submission';
@@ -458,7 +458,7 @@ public function get_grouped($users) {
}
/**
- * Returns the list of all allocations (it est assigned assessments) in the workshop
+ * Returns the list of all allocations (i.e. assigned assessments) in the workshop
*
* Assessments of example submissions are ignored
*
@@ -721,7 +721,7 @@ public function delete_submission(stdclass $submission) {
* Returns the list of all assessments in the workshop with some data added
*
* Fetches data from {workshop_assessments} and adds some useful information from other
- * tables. The returned object does not contain textual fields (ie comments) to prevent memory
+ * tables. The returned object does not contain textual fields (i.e. comments) to prevent memory
* lack issues.
*
* @return array [assessmentid] => assessment stdclass
@@ -2397,7 +2397,7 @@ public function get_examples() {
*/
abstract class workshop_submission_base {
- /** @var bool is the submission anonymous (ie contains author information) */
+ /** @var bool is the submission anonymous (i.e. contains author information) */
protected $anonymous;
/* @var array of columns from workshop_submissions that are assigned as properties */
View
@@ -12,6 +12,12 @@
margin: 0.75em auto;
}
+.path-mod-workshop #workshop-viewlet-assignedassessments div.singlebutton,
+.path-mod-workshop #workshop-viewlet-allexamples div.singlebutton,
+.path-mod-workshop #workshop-viewlet-examples div.singlebutton {
+ text-align: left;
+}
+
/**
* Submission - one line summary display
*/
@@ -72,6 +72,9 @@
$userassessment = $workshop->get_assessment_of_submission_by_user($submission->id, $USER->id);
$isreviewer = !empty($userassessment);
$editable = ($cansubmit and $ownsubmission);
+$ispublished = ($workshop->phase == workshop::PHASE_CLOSED
+ and $submission->published == 1
+ and has_capability('mod/workshop:viewpublishedsubmissions', $workshop->context));
if (empty($submission->id) and !$workshop->creating_submission_allowed()) {
$editable = false;
@@ -93,8 +96,13 @@
}
$edit = ($editable and $edit);
+$seenaspublished = false; // is the submission seen as a published submission?
+
if ($submission->id and ($ownsubmission or $canviewall or $isreviewer)) {
// ok you can go
+} elseif ($submission->id and $ispublished) {
+ // ok you can go
+ $seenaspublished = true;
} elseif (is_null($submission->id) and $cansubmit) {
// ok you can go
} else {
@@ -238,7 +246,12 @@
// else display the submission
if ($submission->id) {
- echo $output->render($workshop->prepare_submission($submission, has_capability('mod/workshop:viewauthornames', $workshop->context)));
+ if ($seenaspublished) {
+ $showauthor = has_capability('mod/workshop:viewauthorpublished', $workshop->context);
+ } else {
+ $showauthor = has_capability('mod/workshop:viewauthornames', $workshop->context);
+ }
+ echo $output->render($workshop->prepare_submission($submission, $showauthor));
} else {
echo $output->box(get_string('noyoursubmission', 'workshop'));
}
View
@@ -29,6 +29,6 @@
defined('MOODLE_INTERNAL') || die();
-$module->version = 2011021100;
+$module->version = 2011030400;
$module->requires = 2011020900; // Requires this Moodle version
//$module->cron = 60;
View
@@ -409,7 +409,7 @@
print_collapsible_region_start('', 'workshop-viewlet-ownsubmission', get_string('yoursubmission', 'workshop'));
echo $output->box_start('generalbox ownsubmission');
if ($submission = $workshop->get_submission_by_author($USER->id)) {
- echo $output->render(new workshop_submission_summary($submission, true));
+ echo $output->render($workshop->prepare_submission_summary($submission, true));
} else {
echo $output->container(get_string('noyoursubmission', 'workshop'));
}
@@ -492,16 +492,48 @@
print_collapsible_region_end();
}
if (has_capability('mod/workshop:viewpublishedsubmissions', $workshop->context)) {
+ $shownames = has_capability('mod/workshop:viewauthorpublished', $workshop->context);
if ($submissions = $workshop->get_published_submissions()) {
print_collapsible_region_start('', 'workshop-viewlet-publicsubmissions', get_string('publishedsubmissions', 'workshop'));
foreach ($submissions as $submission) {
echo $output->box_start('generalbox submission-summary');
- echo $output->render($workshop->prepare_submission_summary($submission, true));
+ echo $output->render($workshop->prepare_submission_summary($submission, $shownames));
echo $output->box_end();
}
print_collapsible_region_end();
}
}
+ if ($assessments = $workshop->get_assessments_by_reviewer($USER->id)) {
+ print_collapsible_region_start('', 'workshop-viewlet-assignedassessments', get_string('assignedassessments', 'workshop'));
+ $shownames = has_capability('mod/workshop:viewauthornames', $PAGE->context);
+ foreach ($assessments as $assessment) {
+ $submission = new stdclass();
+ $submission->id = $assessment->submissionid;
+ $submission->title = $assessment->submissiontitle;
+ $submission->timecreated = $assessment->submissioncreated;
+ $submission->timemodified = $assessment->submissionmodified;
+ $submission->authorid = $assessment->authorid;
+ $submission->authorfirstname = $assessment->authorfirstname;
+ $submission->authorlastname = $assessment->authorlastname;
+ $submission->authorpicture = $assessment->authorpicture;
+ $submission->authorimagealt = $assessment->authorimagealt;
+ $submission->authoremail = $assessment->authoremail;
+
+ if (is_null($assessment->grade)) {
+ $class = ' notgraded';
+ $submission->status = 'notgraded';
+ $buttontext = get_string('assess', 'workshop');
+ } else {
+ $class = ' graded';
+ $submission->status = 'graded';
+ $buttontext = get_string('reassess', 'workshop');
+ }
+ echo $output->box_start('generalbox assessment-summary' . $class);
+ echo $output->render($workshop->prepare_submission_summary($submission, $shownames));
+ echo $output->box_end();
+ }
+ print_collapsible_region_end();
+ }
break;
default:
}

0 comments on commit 500422e

Please sign in to comment.