MDL-20236 overall codebase architecture cleanup and fixing regression

See the issue description for more details
This commit is contained in:
David Mudrak
2010-01-04 18:05:48 +00:00
parent 6516b9e9e4
commit f05c168d2e
35 changed files with 530 additions and 577 deletions
@@ -75,14 +75,14 @@ class workshop_random_allocator implements workshop_allocator {
$o = array(); // list of output messages
$numofreviews = required_param('numofreviews', PARAM_INT);
$numper = required_param('numper', PARAM_INT);
$removecurrent = required_param('removecurrent', PARAM_INT);
$assesswosubmission = required_param('assesswosubmission', PARAM_INT);
$removecurrent = optional_param('removecurrent', false, PARAM_BOOL);
$assesswosubmission = optional_param('assesswosubmission', false, PARAM_BOOL);
$addselfassessment = optional_param('addselfassessment', false, PARAM_BOOL);
$musthavesubmission = empty($assesswosubmission);
$addselfassessment = optional_param('addselfassessment', false, PARAM_INT); // may be frozen in the form
$authors = $this->workshop->get_potential_authors();
$authors = $this->workshop->get_potential_authors($PAGE->context);
$authors = $this->workshop->get_grouped($authors);
$reviewers = $this->workshop->get_potential_reviewers($musthavesubmission);
$reviewers = $this->workshop->get_potential_reviewers($PAGE->context, $musthavesubmission);
$reviewers = $this->workshop->get_grouped($reviewers);
$assessments = $this->workshop->get_all_assessments();
@@ -72,22 +72,17 @@ class workshop_random_allocator_form extends moodleform {
$mform->setDefault('numper', workshop_random_allocator::USERTYPE_AUTHOR);
$mform->addGroup($grpnumofreviews, 'grpnumofreviews', get_string('numofreviews', 'workshop'), array(' '), false);
$mform->addElement('advcheckbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random'));
$mform->addElement('checkbox', 'removecurrent', get_string('removecurrentallocations', 'workshopallocation_random'));
$mform->setDefault('removecurrent', 0);
$mform->addElement('advcheckbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random'));
$mform->addElement('checkbox', 'assesswosubmission', get_string('assesswosubmission', 'workshopallocation_random'));
$mform->setDefault('assesswosubmission', 0);
$grpselfassessment = array();
$grpselfassessment[] = $mform->createElement('advcheckbox', 'addselfassessment');
$mform->setDefault('addselfassessment', 0);
if (!$workshop->useselfassessment) {
$grpselfassessment[] = $mform->createElement('static', 'selfassessmentcheck', '',
get_string('selfassessmentdisabled', 'workshop'));
}
$mform->addGroup($grpselfassessment, 'grpselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
if (!$workshop->useselfassessment) {
$mform->freeze(array('grpselfassessment'));
if (empty($workshop->useselfassessment)) {
$mform->addElement('static', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'),
get_string('selfassessmentdisabled', 'workshop'));
} else {
$mform->addElement('checkbox', 'addselfassessment', get_string('addselfassessment', 'workshopallocation_random'));
}
$this->add_action_buttons();
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for mod/workshop/allocation/random/allocator.php
* Unit tests for Random allocation
*
* @package mod-workshop
* @copyright 2009 David Mudrak <[email protected]>
@@ -26,7 +26,8 @@
defined('MOODLE_INTERNAL') || die();
// Include the code to test
require_once($CFG->dirroot . '/mod/workshop/allocation/random/allocator.php');
require_once($CFG->dirroot . '/mod/workshop/locallib.php');
require_once($CFG->dirroot . '/mod/workshop/allocation/random/lib.php');
/**
* Make protected methods we want to test public