From: David Mudrak Date: Mon, 4 Jan 2010 17:59:34 +0000 (+0000) Subject: MDL-20192 Allocators and grading strategies are proper subplugins now X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ed597c7756f804c8f43839fdb35d8869657fcc12;p=moodle.git MDL-20192 Allocators and grading strategies are proper subplugins now --- diff --git a/mod/workshop/allocation/manual/allocator.php b/mod/workshop/allocation/manual/allocator.php index c10dbbc939..40f04aa246 100644 --- a/mod/workshop/allocation/manual/allocator.php +++ b/mod/workshop/allocation/manual/allocator.php @@ -145,13 +145,13 @@ class workshop_manual_allocator implements workshop_allocator { case WORKSHOP_ALLOCATION_MANUAL_MSG_ADDED: $hlauthorid = $m[1]; $hlreviewerid = $m[2]; - $msg->text = get_string('allocationadded', 'workshop'); + $msg->text = get_string('allocationadded', 'workshopallocation_manual'); $msg->sty = 'ok'; break; case WORKSHOP_ALLOCATION_MANUAL_MSG_EXISTS: $hlauthorid = $m[1]; $hlreviewerid = $m[2]; - $msg->text = get_string('allocationexists', 'workshop'); + $msg->text = get_string('allocationexists', 'workshopallocation_manual'); $msg->sty = 'info'; break; case WORKSHOP_ALLOCATION_MANUAL_MSG_NOSUBMISSION: @@ -163,10 +163,10 @@ class workshop_manual_allocator implements workshop_allocator { $hlauthorid = $m[2]; $hlreviewerid = $m[3]; if ($m[4] == 0) { - $msg->text = get_string('areyousuretodeallocate', 'workshop'); + $msg->text = get_string('areyousuretodeallocate', 'workshopallocation_manual'); $msg->sty = 'info'; } else { - $msg->text = get_string('areyousuretodeallocategraded', 'workshop'); + $msg->text = get_string('areyousuretodeallocategraded', 'workshopallocation_manual'); $msg->sty = 'error'; } break; @@ -226,7 +226,7 @@ class workshop_manual_allocator implements workshop_allocator { // We have all data. Let it pass to the renderer and return the output // Here, we do not use neither the core renderer nor the workshop one but use an own one require_once(dirname(__FILE__) . '/renderer.php'); - $uioutput = $PAGE->theme->get_renderer('mod_workshop', $PAGE, 'allocation_manual'); + $uioutput = $PAGE->theme->get_renderer('workshopallocation_manual', $PAGE); echo $uioutput->display_allocations($this->workshop, $peer, $hlauthorid, $hlreviewerid, $msg); } diff --git a/mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php b/mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php new file mode 100644 index 0000000000..fd1ad48d22 --- /dev/null +++ b/mod/workshop/allocation/manual/lang/en_utf8/workshopallocation_manual.php @@ -0,0 +1,34 @@ +. + +/** + * English strings for Workshop - manual allocation subplugin + * + * @package mod-workshop + * @copyright 2009 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['addreviewee'] = 'Add reviewee'; +$string['addreviewer'] = 'Add reviewer'; +$string['allocationadded'] = 'The submission has been successfully allocated'; +$string['allocationexists'] = 'The allocation already exists'; +$string['areyousuretodeallocate'] = 'Are you sure you want deallocate the selected assessment?'; +$string['areyousuretodeallocategraded'] = 'You are going to remove the assessment that has already been graded. Are you really sure you want to do it?'; +$string['pluginname'] = 'Manual allocation'; diff --git a/mod/workshop/allocation/manual/renderer.php b/mod/workshop/allocation/manual/renderer.php index 20cb6cf3b2..4f9edb9879 100644 --- a/mod/workshop/allocation/manual/renderer.php +++ b/mod/workshop/allocation/manual/renderer.php @@ -28,7 +28,7 @@ defined('MOODLE_INTERNAL') || die(); /** * Manual allocation renderer class */ -class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_base { +class moodle_workshopallocation_manual_renderer extends moodle_renderer_base { /** the underlying renderer to use */ protected $output; @@ -139,9 +139,9 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas $handler = new moodle_url($this->page->url, array('mode' => 'new', 'of' => $user->id, 'sesskey' => sesskey())); $options = $this->users_to_menu_options($workshop->get_peer_reviewers(), $exclude); $select = html_select::make_popup_form($handler, 'by', $options, 'addreviewof' . $user->id, '', - get_string('addreviewer', 'workshop')); + get_string('addreviewer', 'workshopallocation_manual')); $select->nothinglabel = get_string('chooseuser', 'workshop'); - $select->set_label(get_string('addreviewer', 'workshop'), $select->id); + $select->set_label(get_string('addreviewer', 'workshopallocation_manual'), $select->id); $o .= $this->output->select($select); } $o .= $this->output->output_start_tag('ul', array()); @@ -186,9 +186,9 @@ class moodle_mod_workshop_allocation_manual_renderer extends moodle_renderer_bas $handler = new moodle_url($this->page->url, array('mode' => 'new', 'by' => $user->id, 'sesskey' => sesskey())); $options = $this->users_to_menu_options($workshop->get_peer_authors(), $exclude); $select = html_select::make_popup_form($handler, 'of', $options, 'addreviewby' . $user->id, '', - get_string('addreviewee', 'workshop')); + get_string('addreviewee', 'workshopallocation_manual')); $select->nothinglabel = get_string('chooseuser', 'workshop'); - $select->set_label(get_string('addreviewee', 'workshop'), $select->id); + $select->set_label(get_string('addreviewee', 'workshopallocation_manual'), $select->id); $o .= $this->output->select($select); $o .= $this->output->output_start_tag('ul', array()); foreach ($user->reviewerof as $authorid => $assessmentid) { diff --git a/mod/workshop/allocation/random/allocator.php b/mod/workshop/allocation/random/allocator.php index a710b3e000..fe11840259 100644 --- a/mod/workshop/allocation/random/allocator.php +++ b/mod/workshop/allocation/random/allocator.php @@ -105,17 +105,17 @@ class workshop_random_allocator implements workshop_allocator { $randomallocations = $this->random_allocation($authors, $reviewers, $curassessments, $numofreviews, $numper, $o); $this->filter_current_assessments($randomallocations, $assessments); $newallocations = array_merge($newallocations, $randomallocations); - $o[] = 'ok::' . get_string('numofrandomlyallocatedsubmissions', 'workshop', count($randomallocations)); + $o[] = 'ok::' . get_string('numofrandomlyallocatedsubmissions', 'workshopallocation_random', count($randomallocations)); unset($randomallocations); } if ($addselfassessment) { $selfallocations = $this->self_allocation($authors, $reviewers, $assessments); $newallocations = array_merge($newallocations, $selfallocations); - $o[] = 'ok::' . get_string('numofselfallocatedsubmissions', 'workshop', count($selfallocations)); + $o[] = 'ok::' . get_string('numofselfallocatedsubmissions', 'workshopallocation_random', count($selfallocations)); unset($selfallocations); } if (empty($newallocations)) { - $o[] = 'info::' . get_string('noallocationtoadd', 'workshop'); + $o[] = 'info::' . get_string('noallocationtoadd', 'workshopallocation_random'); } else { $this->add_new_allocations($newallocations, $authors, $reviewers); foreach ($newallocations as $newallocation) { @@ -123,14 +123,14 @@ class workshop_random_allocator implements workshop_allocator { $a = new stdClass(); $a->reviewername = fullname($reviewers[0][$reviewerid]); $a->authorname = fullname($authors[0][$authorid]); - $o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshop', $a); + $o[] = 'ok::indent::' . get_string('allocationaddeddetail', 'workshopallocation_random', $a); } } if ($removecurrent) { $delassessments = $this->get_unkept_assessments($assessments, $newallocations, $addselfassessment); // random allocator should not be able to delete assessments that have already been graded // by reviewer - $o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshop', count($delassessments)); + $o[] = 'info::' . get_string('numofdeallocatedassessment', 'workshopallocation_random', count($delassessments)); foreach ($delassessments as $delassessmentkey => $delassessmentid) { $a = new stdClass(); $a->authorname = fullname((object)array( @@ -140,10 +140,10 @@ class workshop_random_allocator implements workshop_allocator { 'lastname' => $assessments[$delassessmentid]->reviewerlastname, 'firstname' => $assessments[$delassessmentid]->reviewerfirstname)); if (!is_null($assessments[$delassessmentid]->grade)) { - $o[] = 'error::indent::' . get_string('allocationdeallocategraded', 'workshop', $a); + $o[] = 'error::indent::' . get_string('allocationdeallocategraded', 'workshopallocation_random', $a); unset($delassessments[$delassessmentkey]); } else { - $o[] = 'info::indent::' . get_string('assessmentdeleteddetail', 'workshop', $a); + $o[] = 'info::indent::' . get_string('assessmentdeleteddetail', 'workshopallocation_random', $a); } } $this->workshop->delete_assessment($delassessments); @@ -165,7 +165,7 @@ class workshop_random_allocator implements workshop_allocator { $m = optional_param('m', null, PARAM_INT); // status message code $msg = new stdClass(); if ($m == WORKSHOP_ALLOCATION_RANDOM_MSG_SUCCESS) { - $msg = (object)array('text' => get_string('randomallocationdone', 'workshop'), 'sty' => 'ok'); + $msg = (object)array('text' => get_string('randomallocationdone', 'workshopallocation_random'), 'sty' => 'ok'); } echo $OUTPUT->container_start('random-allocator'); diff --git a/mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php b/mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php new file mode 100644 index 0000000000..07420afcf7 --- /dev/null +++ b/mod/workshop/allocation/random/lang/en_utf8/workshopallocation_random.php @@ -0,0 +1,42 @@ +. + +/** + * English strings for Workshop allocation subplugin - Random allocation + * + * @package mod-workshop + * @copyright 2009 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['addselfassessment'] = 'Add self-assessments'; +$string['allocationaddeddetail'] = 'New assessment to be done: $a->reviewername is reviewer of $a->authorname'; +$string['allocationdeallocategraded'] = 'Unable to deallocate already graded assessment: reviewer $a->reviewername, submission author: $a->authorname'; +$string['allocationsettings'] = 'Allocation settings'; +$string['assessmentdeleteddetail'] = 'Assessment deallocated: $a->reviewername is no longer reviewer of $a->authorname'; +$string['assesswosubmission'] = 'Participants can assess without having submitted anything'; +$string['noallocationtoadd'] = 'No allocations to add'; +$string['numofdeallocatedassessment'] = 'Deallocating $a assessment(s)'; +$string['numofrandomlyallocatedsubmissions'] = 'Randomly allocating $a submissions'; +$string['numofselfallocatedsubmissions'] = 'Self-allocating $a submission(s)'; +$string['numperauthor'] = 'per submission'; +$string['numperreviewer'] = 'per reviewer'; +$string['pluginname'] = 'Random allocation'; +$string['randomallocationdone'] = 'Random allocation done'; +$string['removecurrentallocations'] = 'Remove current allocations'; diff --git a/mod/workshop/allocation/random/settings_form.php b/mod/workshop/allocation/random/settings_form.php index 4570c839b2..178a009314 100644 --- a/mod/workshop/allocation/random/settings_form.php +++ b/mod/workshop/allocation/random/settings_form.php @@ -44,7 +44,7 @@ class workshop_random_allocator_form extends moodleform { $mform = $this->_form; $workshop = $this->_customdata['workshop']; - $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshop')); + $mform->addElement('header', 'settings', get_string('allocationsettings', 'workshopallocation_random')); $gmode = groups_get_activity_groupmode($workshop->cm, $workshop->course); switch ($gmode) { @@ -61,8 +61,8 @@ class workshop_random_allocator_form extends moodleform { $mform->addElement('static', 'groupmode', get_string('groupmode', 'group'), $grouplabel); $options_numofreviewes = array(0=>0,1=>1, 2=>2, 3=>3, 4=>4); - $options_numper = array(WORKSHOP_USERTYPE_AUTHOR => get_string('numperauthor', 'workshop'), - WORKSHOP_USERTYPE_REVIEWER => get_string('numperreviewer', 'workshop')); + $options_numper = array(WORKSHOP_USERTYPE_AUTHOR => get_string('numperauthor', 'workshopallocation_random'), + WORKSHOP_USERTYPE_REVIEWER => get_string('numperreviewer', 'workshopallocation_random')); $grpnumofreviews = array(); $grpnumofreviews[] = $mform->createElement('select', 'numofreviews', '', $options_numofreviewes); $mform->setDefault('numofreviews', 4); @@ -70,13 +70,13 @@ class workshop_random_allocator_form extends moodleform { $mform->setDefault('numper', WORKSHOP_USERTYPE_AUTHOR); $mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshop'), array(' '), false); - $mform->addElement('advcheckbox', 'removecurrent', get_string('removecurrentallocations', 'workshop')); + $mform->addElement('advcheckbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random')); $mform->setDefault('removecurrent', 0); - $mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshop')); + $mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random')); $mform->setDefault('assesswosubmission', 0); - $mform->addElement('advcheckbox', 'addselfassessment', get_string('addselfassessment', 'workshop')); + $mform->addElement('advcheckbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random')); $mform->setDefault('addselfassessment', 0); $this->add_action_buttons(); diff --git a/mod/workshop/grading/accumulative/assessment_form.php b/mod/workshop/grading/accumulative/assessment_form.php index f2163d25a5..3d4c1ffa50 100644 --- a/mod/workshop/grading/accumulative/assessment_form.php +++ b/mod/workshop/grading/accumulative/assessment_form.php @@ -50,7 +50,7 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form { for ($i = 0; $i < $nodims; $i++) { // dimension header - $dimtitle = get_string('dimensionnumberaccumulative', 'workshop', $i+1); + $dimtitle = get_string('dimensionnumber', 'workshopgrading_accumulative', $i+1); $mform->addElement('header', "dimensionhdr__idx_$i", $dimtitle); // dimension id @@ -66,12 +66,12 @@ class workshop_accumulative_assessment_form extends workshop_assessment_form { $mform->addElement('html', $desc); // grade for this aspect - $label = get_string('dimensiongrade', 'workshop'); + $label = get_string('dimensiongrade', 'workshopgrading_accumulative'); $options = make_grades_menu($fields->{'grade__idx_' . $i}); $mform->addElement('select', 'grade__idx_' . $i, $label, $options); // comment - $label = get_string('dimensioncomment', 'workshop'); + $label = get_string('dimensioncomment', 'workshopgrading_accumulative'); //$mform->addElement('editor', 'peercomment__idx_' . $i, $label, null, array('maxfiles' => 0)); $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5)); } diff --git a/mod/workshop/grading/accumulative/edit_form.php b/mod/workshop/grading/accumulative/edit_form.php index 79bb7e9dcb..dcb2a79e72 100644 --- a/mod/workshop/grading/accumulative/edit_form.php +++ b/mod/workshop/grading/accumulative/edit_form.php @@ -55,18 +55,20 @@ class workshop_edit_accumulative_strategy_form extends workshop_edit_strategy_fo $weights = workshop_get_dimension_weights(); for ($i = 0; $i < $norepeats; $i++) { - $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumberaccumulative', 'workshop', $i+1)); + $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopgrading_accumulative', $i+1)); $mform->addElement('hidden', 'dimensionid__idx_'.$i); // the id in workshop_forms - $mform->addElement('editor', 'description__idx_'.$i.'_editor', get_string('dimensiondescription', 'workshop'), - '', $descriptionopts); - $mform->addElement('modgrade', 'grade__idx_'.$i, get_string('dimensionmaxgrade','workshop'), null, true); + $mform->addElement('editor', 'description__idx_'.$i.'_editor', + get_string('dimensiondescription', 'workshopgrading_accumulative'), '', $descriptionopts); + $mform->addElement('modgrade', 'grade__idx_'.$i, + get_string('dimensionmaxgrade','workshopgrading_accumulative'), null, true); $mform->setDefault('grade__idx_'.$i, 10); - $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshop'), $weights); + $mform->addElement('select', 'weight__idx_'.$i, + get_string('dimensionweight', 'workshopgrading_accumulative'), $weights); $mform->setDefault('weight__idx_'.$i, 1); } $mform->registerNoSubmitButton('noadddims'); - $mform->addElement('submit', 'noadddims', get_string('addmoredimensionsaccumulative', 'workshop', + $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopgrading_accumulative', WORKSHOP_STRATEGY_ADDDIMS)); $mform->closeHeaderBefore('noadddims'); $this->set_data($current); diff --git a/mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php b/mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php new file mode 100644 index 0000000000..7dbcd96f6e --- /dev/null +++ b/mod/workshop/grading/accumulative/lang/en_utf8/workshopgrading_accumulative.php @@ -0,0 +1,35 @@ +. + +/** + * English strings for Workshop subplugin - "Accumulative" grading strategy + * + * @package mod-workshop + * @copyright 2009 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['addmoredimensions'] = 'Blanks for $a more aspects'; +$string['dimensioncomment'] = 'Comment'; +$string['dimensiondescription'] = 'Description'; +$string['dimensiongrade'] = 'Grade'; +$string['dimensionmaxgrade'] = 'Best possible grade / Scale to use'; +$string['dimensionnumber'] = 'Aspect $a'; +$string['dimensionweight'] = 'Weight'; +$string['pluginname'] = 'Accumulative grading'; diff --git a/mod/workshop/grading/noerrors/assessment_form.php b/mod/workshop/grading/noerrors/assessment_form.php index 43f958acf8..56d6685b5b 100644 --- a/mod/workshop/grading/noerrors/assessment_form.php +++ b/mod/workshop/grading/noerrors/assessment_form.php @@ -50,7 +50,7 @@ class workshop_noerrors_assessment_form extends workshop_assessment_form { for ($i = 0; $i < $nodims; $i++) { // dimension header - $dimtitle = get_string('dimensionnumbernoerrors', 'workshop', $i+1); + $dimtitle = get_string('dimensionnumber', 'workshopgrading_noerrors', $i+1); $mform->addElement('header', "dimensionhdr__idx_$i", $dimtitle); // dimension id @@ -66,13 +66,13 @@ class workshop_noerrors_assessment_form extends workshop_assessment_form { $mform->addElement('html', $desc); // evaluation of the assertion - $label = get_string('dimensiongradenoerrors', 'workshop'); + $label = get_string('dimensiongrade', 'workshopgrading_noerrors'); $mform->addElement('radio', 'grade__idx_' . $i, 'Your assessment', $fields->{'grade0__idx_'.$i}, 0); // todo localize $mform->addElement('radio', 'grade__idx_' . $i, '', $fields->{'grade1__idx_'.$i}, 1); $mform->setDefault('grade__idx_' . $i, 0); // comment - $label = get_string('dimensioncomment', 'workshop'); + $label = get_string('dimensioncomment', 'workshopgrading_noerrors'); $mform->addElement('textarea', 'peercomment__idx_' . $i, $label, array('cols' => 60, 'rows' => 5)); } $this->set_data($current); diff --git a/mod/workshop/grading/noerrors/edit_form.php b/mod/workshop/grading/noerrors/edit_form.php index 8ab6d33b70..1e03e8a7f3 100644 --- a/mod/workshop/grading/noerrors/edit_form.php +++ b/mod/workshop/grading/noerrors/edit_form.php @@ -57,23 +57,23 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form { $weights = workshop_get_dimension_weights(); for ($i = 0; $i < $norepeats; $i++) { - $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumbernoerrors', 'workshop', $i+1)); + $mform->addElement('header', 'dimension'.$i, get_string('dimensionnumber', 'workshopgrading_noerrors', $i+1)); $mform->addElement('hidden', 'dimensionid__idx_'.$i); // the id in workshop_forms - $mform->addElement('editor', 'description__idx_'.$i.'_editor', get_string('dimensiondescription', 'workshop'), - '', $descriptionopts); - $mform->addElement('text', 'grade0__idx_'.$i, get_string('noerrorsgrade0', 'workshop'), array('size'=>'15')); + $mform->addElement('editor', 'description__idx_'.$i.'_editor', + get_string('dimensiondescription', 'workshopgrading_noerrors'), '', $descriptionopts); + $mform->addElement('text', 'grade0__idx_'.$i, get_string('grade0', 'workshopgrading_noerrors'), array('size'=>'15')); $mform->setDefault('grade0__idx_'.$i, $workshopconfig->noerrorsgrade0); $mform->setType('grade0__idx_'.$i, PARAM_TEXT); - $mform->addElement('text', 'grade1__idx_'.$i, get_string('noerrorsgrade1', 'workshop'), array('size'=>'15')); + $mform->addElement('text', 'grade1__idx_'.$i, get_string('grade1', 'workshopgrading_noerrors'), array('size'=>'15')); $mform->setDefault('grade1__idx_'.$i, $workshopconfig->noerrorsgrade1); $mform->setType('grade1__idx_'.$i, PARAM_TEXT); - $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshop'), $weights); + $mform->addElement('select', 'weight__idx_'.$i, get_string('dimensionweight', 'workshopgrading_noerrors'), $weights); $mform->setDefault('weight__idx_'.$i, 1); } - $mform->addElement('header', 'mappingheader', get_string('noerrorsgrademapping', 'workshop')); - $mform->addElement('static', 'mappinginfo', get_string('noerrorsmaperror', 'workshop'), - get_string('noerrorsmapgrade', 'workshop')); + $mform->addElement('header', 'mappingheader', get_string('grademapping', 'workshopgrading_noerrors')); + $mform->addElement('static', 'mappinginfo', get_string('maperror', 'workshopgrading_noerrors'), + get_string('mapgrade', 'workshopgrading_noerrors')); // get the total weight of all items == maximum weighted number of errors $totalweight = 0; @@ -87,20 +87,20 @@ class workshop_edit_noerrors_strategy_form extends workshop_edit_strategy_form { $percents = array(); $percents[''] = ''; for ($i = 100; $i >= 0; $i--) { - $percents[$i] = get_string('percents', 'workshop', $i); + $percents[$i] = get_string('percents', 'workshopgrading_noerrors', $i); } - $mform->addElement('static', 'mappingzero', 0, get_string('percents', 'workshop', 100)); + $mform->addElement('static', 'mappingzero', 0, get_string('percents', 'workshopgrading_noerrors', 100)); for ($i = 1; $i <= $totalweight; $i++) { $selects = array(); $selects[] = $mform->createElement('select', 'map__idx_'.$i, $i, $percents); $selects[] = $mform->createElement('static', 'mapdefault__idx_'.$i, '', - get_string('percents', 'workshop', floor(100 - $i * 100 / $totalweight))); + get_string('percents', 'workshopgrading_noerrors', floor(100 - $i * 100 / $totalweight))); $mform->addGroup($selects, 'grademapping'.$i, $i, array(' '), false); $mform->setDefault('map__idx_'.$i, ''); } $mform->registerNoSubmitButton('noadddims'); - $mform->addElement('submit', 'noadddims', get_string('addmoredimensionsaccumulative', 'workshop', + $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopgrading_noerrors', WORKSHOP_STRATEGY_ADDDIMS)); $mform->closeHeaderBefore('noadddims'); $this->set_data($current); diff --git a/mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php b/mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php new file mode 100644 index 0000000000..3572be750f --- /dev/null +++ b/mod/workshop/grading/noerrors/lang/en_utf8/workshopgrading_noerrors.php @@ -0,0 +1,44 @@ +. + +/** + * English strings for Workshop plugin - "Number of errors" grading strategy + * + * @package mod-workshop + * @copyright 2009 David Mudrak + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$string['addmoredimensions'] = 'Blanks for $a more assertions'; +$string['configgrade0'] = 'The default word describing the negative assessment of an assertion.'; +$string['configgrade1'] = 'The default word describing the positive assessment of an assertion.'; +$string['dimensioncomment'] = 'Comment'; +$string['dimensiondescription'] = 'Description'; +$string['dimensiongrade'] = 'Grade'; +$string['dimensionnumber'] = 'Assertion $a'; +$string['dimensionweight'] = 'Weight'; +$string['grademapping'] = 'Grade mapping table'; +$string['grade0default'] = 'No'; +$string['grade0'] = 'Word for the error'; +$string['grade1default'] = 'Yes'; +$string['grade1'] = 'Word for the success'; +$string['maperror'] = 'Weighted number of errors is less than or equals'; +$string['mapgrade'] = 'Grade for submission'; +$string['percents'] = '$a %'; +$string['pluginname'] = 'Number of errors'; diff --git a/mod/workshop/lang/en_utf8/workshop.php b/mod/workshop/lang/en_utf8/workshop.php index 6f81038ffe..8741436cad 100644 --- a/mod/workshop/lang/en_utf8/workshop.php +++ b/mod/workshop/lang/en_utf8/workshop.php @@ -25,56 +25,24 @@ defined('MOODLE_INTERNAL') || die(); -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; -$string[''] = ''; $string['accesscontrol'] = 'Access control'; -$string['addmoredimensionsaccumulative'] = 'Blanks for $a more aspects'; -$string['addmoredimensionsnoerrors'] = 'Blanks for $a more assertions'; -$string['addreviewee'] = 'Add reviewee'; -$string['addreviewer'] = 'Add reviewer'; -$string['addselfassessment'] = 'Add self-assessments'; -$string['addsubmissiontoreview'] = 'Assign submission'; $string['agreeassessments'] = 'Assessments must be agreed'; $string['agreeassessmentsdesc'] = 'Authors may comment assessments of their work and agree/disagree with it'; -$string['allocationaddeddetail'] = 'New assessment to be done: $a->reviewername is reviewer of $a->authorname'; -$string['allocationadded'] = 'The submission has been successfully allocated'; -$string['allocationdeallocategraded'] = 'Unable to deallocate already graded assessment: reviewer $a->reviewername, submission author: $a->authorname'; -$string['allocationexists'] = 'The allocation already exists'; -$string['allocationmanual'] = 'Manual allocation'; -$string['allocationrandom'] = 'Random allocation'; -$string['allocationsettings'] = 'Allocation settings'; $string['allocation'] = 'Submission allocation'; -$string['allocationview'] = 'View current allocations'; +$string['allocationdone'] = 'Allocation done'; +$string['allocationerror'] = 'Allocation error'; $string['areadimensiondescription'] = 'Assessment form fields'; $string['areasubmissionattachment'] = 'Submission attachments'; $string['areasubmissioncontent'] = 'Submission texts'; -$string['areyousuretodeallocate'] = 'Are you sure you want deallocate the selected assessment?'; -$string['areyousuretodeallocategraded'] = 'You are going to remove the assessment that has already been graded. Are you really sure you want to do it?'; $string['assessallexamples'] = 'Assess all examples'; $string['assessingsubmission'] = 'Assessing submission'; $string['assessmentcomps'] = 'Required level of assessments similarity'; $string['assessmentdeleted'] = 'Assessment deallocated'; -$string['assessmentdeleteddetail'] = 'Assessment deallocated: $a->reviewername is no longer reviewer of $a->authorname'; $string['assessmentend'] = 'End of assessment phase'; $string['assessmentform'] = 'Assessment form'; $string['assessmentresult'] = 'Assessment result'; $string['assessmentsettings'] = 'Assessment settings'; $string['assessmentstart'] = 'Start of assessment phase'; -$string['assesswosubmission'] = 'Participants can assess without having submitted anything'; $string['backtoeditform'] = 'Back to editing form'; $string['byfullname'] = 'by url}\">{$a->name}'; $string['comparisonhigh'] = 'High'; @@ -89,17 +57,8 @@ $string['configgrade'] = 'Default maximum grade for submission in workshops'; $string['configgradinggrade'] = 'Default maximum grade for assessment in workshops'; $string['configmaxbytes'] = 'Default maximum submission file size for all workshops on the site (subject to course limits and other local settings)'; $string['confignexassessments'] = 'Default number of examples to be reviewed by a user in the example assessment phase'; -$string['confignoerrorsgrade0'] = 'The default word describing the negative assessment of an assertion in "Number of errors" grading strategy.'; -$string['confignoerrorsgrade1'] = 'The default word describing the positive assessment of an assertion in "Number of errors" grading strategy.'; $string['confignsassessments'] = 'Default number of allocated submissions to be reviewed by a user in the assessment phase'; $string['configstrategy'] = 'Default grading strategy for workshops'; -$string['dimensioncomment'] = 'Comment'; -$string['dimensiondescription'] = 'Description'; -$string['dimensiongrade'] = 'Grade'; -$string['dimensionmaxgrade'] = 'Best possible grade / Scale to use'; -$string['dimensionnumberaccumulative'] = 'Aspect $a'; -$string['dimensionnumbernoerrors'] = 'Assertion $a'; -$string['dimensionweight'] = 'Weight'; $string['editingassessmentform'] = 'Editing assessment form'; $string['editingsubmission'] = 'Editing submission'; $string['editsubmission'] = 'Edit submission'; @@ -122,34 +81,18 @@ $string['modulenameplural'] = 'Workshops'; $string['modulename'] = 'Workshop'; $string['nattachments'] = 'Maximum number of submission attachments'; $string['nexassessments'] = 'Number of required assessments of examples'; -$string['noallocationtoadd'] = 'No allocations to add'; -$string['noerrorsgrademapping'] = 'Grade mapping table'; -$string['noerrorsgrade0default'] = 'No'; -$string['noerrorsgrade0'] = 'Word for the error'; -$string['noerrorsgrade1default'] = 'Yes'; -$string['noerrorsgrade1'] = 'Word for the success'; -$string['noerrorsmaperror'] = 'Weighted number of errors is less than or equals'; -$string['noerrorsmapgrade'] = 'Grade for submission'; $string['nogradeyet'] = 'No grade yet'; $string['nosubmissionfound'] = 'No submission found for this user'; $string['nosubmissions'] = 'No submissions yet in this workshop'; $string['nothingtoreview'] = 'Nothing to review'; $string['noworkshops'] = 'There are no workshops in this course'; $string['nsassessments'] = 'Number of required assessments of other users\' work'; -$string['numofdeallocatedassessment'] = 'Deallocating $a assessment(s)'; -$string['numofrandomlyallocatedsubmissions'] = 'Randomly allocating $a submissions'; $string['numofreviews'] = 'Number of reviews'; -$string['numofselfallocatedsubmissions'] = 'Self-allocating $a submission(s)'; -$string['numperauthor'] = 'per submission'; -$string['numperreviewer'] = 'per reviewer'; $string['participant'] = 'Participant'; $string['participantrevierof'] = 'Participant is reviewer of'; $string['participantreviewedby'] = 'Participant is reviewed by'; -$string['percents'] = '$a%'; $string['previewassessmentform'] = 'Preview'; -$string['randomallocationdone'] = 'Random allocation done'; $string['releasegrades'] = 'Push final grades into the gradebook'; -$string['removecurrentallocations'] = 'Remove current allocations'; $string['saveandclose'] = 'Save and close'; $string['saveandcontinue'] = 'Save and continue editing'; $string['saveandpreview'] = 'Save and preview'; @@ -157,7 +100,6 @@ $string['strategyaccumulative'] = 'Accumulative grading'; $string['strategydummy'] = 'Dummy strategy'; $string['strategy'] = 'Grading strategy'; $string['strategyhaschanged'] = 'The workshop grading strategy has changed since the form was opened for editing.'; -$string['strategynoerrors'] = 'Number of errors'; $string['strategynograding'] = 'No grading'; $string['strategyrubric'] = 'Rubric grading'; $string['submissionattachment'] = 'Attachment'; diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 4e73c7137a..d735d520c7 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -516,12 +516,13 @@ function workshop_get_dimension_weights() { * $return array Array ['string' => 'string'] */ function workshop_get_strategies() { - $installed = get_list_of_plugins('mod/workshop/grading'); + $installed = get_plugin_list('workshopgrading'); $forms = array(); - foreach ($installed as $strategy) { - $forms[$strategy] = get_string('strategy' . $strategy, 'workshop'); + foreach ($installed as $strategy => $strategypath) { + if (file_exists($strategypath . '/strategy.php')) { + $forms[$strategy] = get_string('pluginname', 'workshopgrading_' . $strategy); + } } - return $forms; } diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php index bc04bf74f7..1edb6cd6e7 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -32,7 +32,8 @@ defined('MOODLE_INTERNAL') || die(); require_once(dirname(__FILE__).'/lib.php'); // we extend this library here -define('WORKSHOP_ALLOCATION_EXISTS', -1); // return status of {@link add_allocation} +define('WORKSHOP_ALLOCATION_EXISTS', -1); // return status of {@link add_allocation} +define('WORKSHOP_ALLOCATION_ERROR', -2); // can be passed to a workshop renderer method /** * Full-featured workshop API @@ -513,10 +514,12 @@ class workshop { * @return array Array ['string' => 'string'] of localized allocation method names */ public function installed_allocators() { - $installed = get_list_of_plugins('mod/workshop/allocation'); + $installed = get_plugin_list('workshopallocation'); $forms = array(); - foreach ($installed as $allocation) { - $forms[$allocation] = get_string('allocation' . $allocation, 'workshop'); + foreach ($installed as $allocation => $allocationpath) { + if (file_exists($allocationpath . '/allocator.php')) { + $forms[$allocation] = get_string('pluginname', 'workshopallocation_' . $allocation); + } } // usability - make sure that manual allocation appears the first if (isset($forms['manual'])) { diff --git a/mod/workshop/renderer.php b/mod/workshop/renderer.php index 6ee7ac3ea6..33616593c8 100644 --- a/mod/workshop/renderer.php +++ b/mod/workshop/renderer.php @@ -87,10 +87,10 @@ class moodle_mod_workshop_renderer extends moodle_renderer_base { */ public function allocation_init_result($result='') { $msg = new stdClass(); - if ($result === 'WORKSHOP_ALLOCATION_RANDOM_ERROR') { - $msg = (object)array('text' => get_string('randomallocationerror', 'workshop'), 'sty' => 'error'); + if ($result === WORKSHOP_ALLOCATION_ERROR) { + $msg = (object)array('text' => get_string('allocationerror', 'workshop'), 'sty' => 'error'); } else { - $msg = (object)array('text' => get_string('randomallocationdone', 'workshop'), 'sty' => 'ok'); + $msg = (object)array('text' => get_string('allocationdone', 'workshop'), 'sty' => 'ok'); } $o = $this->status_message($msg); if (is_array($result)) { diff --git a/mod/workshop/view.php b/mod/workshop/view.php index bdedfa8ea9..d32aaec1ef 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -90,7 +90,7 @@ echo $OUTPUT->header($navigation); echo $OUTPUT->box_start(); echo $OUTPUT->heading('Workshop testing', 1); echo "
    \n"; -echo '
  1. Edit grading form (' . get_string('strategy' . $workshop->strategy, 'workshop') . ')
  2. ' . "\n"; +echo '
  3. Edit grading form (' . get_string('pluginname', 'workshopgrading_' . $workshop->strategy) . ')
  4. ' . "\n"; echo "
  5. id}\">View/edit your own submission
  6. \n"; echo "
  7. id}\">Fake others' submissions
  8. \n"; echo "
  9. id}\">Allocate submissions
  10. \n";