Example #1
0
 /**
  * Defines the teamwork instance configuration form
  *
  * @return void
  */
 public function definition()
 {
     global $CFG;
     $teamworkconfig = get_config('teamwork');
     $mform = $this->_form;
     // General --------------------------------------------------------------------
     $mform->addElement('header', 'general', get_string('general', 'form'));
     // Teamwork name
     $label = get_string('teamworkname', 'teamwork');
     $mform->addElement('text', 'name', $label, array('size' => '64'));
     if (!empty($CFG->formatstringstriptags)) {
         $mform->setType('name', PARAM_TEXT);
     } else {
         $mform->setType('name', PARAM_CLEANHTML);
     }
     $mform->addRule('name', null, 'required', null, 'client');
     $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
     // Introduction
     $this->add_intro_editor(false, get_string('introduction', 'teamwork'));
     // Grading settings -----------------------------------------------------------
     $mform->addElement('header', 'gradingsettings', get_string('gradingsettings', 'teamwork'));
     $label = get_string('strategy', 'teamwork');
     $mform->addElement('select', 'strategy', $label, teamwork::available_strategies_list());
     $mform->setDefault('strategy', $teamworkconfig->strategy);
     $mform->addHelpButton('strategy', 'strategy', 'teamwork');
     $options = array();
     for ($i = 5; $i >= 0; $i--) {
         $options[$i] = $i;
     }
     $label = get_string('gradedecimals', 'teamwork');
     $mform->addElement('select', 'gradedecimals', $label, $options);
     $mform->setDefault('gradedecimals', $teamworkconfig->gradedecimals);
     // Submission settings --------------------------------------------------------
     $mform->addElement('header', 'submissionsettings', get_string('submissionsettings', 'teamwork'));
     $options = get_max_upload_sizes($CFG->maxbytes, $this->course->maxbytes, 0, $teamworkconfig->maxbytes);
     $mform->addElement('select', 'maxbytes', get_string('maxbytes', 'teamwork'), $options);
     $mform->setDefault('maxbytes', $teamworkconfig->maxbytes);
     // Participation settings --------------------------------------------------------
     $mform->addElement('header', 'participationsettings', get_string('participationsettings', 'teamwork'));
     $options = array();
     for ($i = 1; $i <= 10; $i++) {
         $options[$i] = $i;
     }
     $mform->addElement('select', 'participationnumlimit', get_string('participationnumlimit', 'teamwork'), $options);
     $mform->addHelpButton('participationnumlimit', 'participationnumlimit', 'teamwork');
     // Date settings---------------------------------------------------------------
     $mform->addElement('header', 'datecontrol', get_string('datesettings', 'teamwork'));
     $label = get_string('applystart', 'teamwork');
     $mform->addElement('date_time_selector', 'applystart', $label, array('optional' => false));
     $label = get_string('applyend', 'teamwork');
     $mform->addElement('date_time_selector', 'applyend', $label, array('optional' => false));
     // Common module settings, Restrict availability, Activity completion etc. ----
     $this->_features = array('groups' => false, 'groupings' => false, 'outcomes' => true, 'gradecat' => false, 'idnumber' => true);
     $this->standard_coursemodule_elements();
     // Standard buttons, common to all modules ------------------------------------
     $this->add_action_buttons();
 }
Example #2
0
if ($ADMIN->fulltree) {
    require_once $CFG->dirroot . '/mod/teamwork/locallib.php';
    $grades = teamwork::available_maxgrades_list();
    $settings->add(new admin_setting_configselect('teamwork/grade', get_string('submissiongrade', 'teamwork'), get_string('configgrade', 'teamwork'), 80, $grades));
    $settings->add(new admin_setting_configselect('teamwork/gradinggrade', get_string('gradinggrade', 'teamwork'), get_string('configgradinggrade', 'teamwork'), 20, $grades));
    $options = array();
    for ($i = 5; $i >= 0; $i--) {
        $options[$i] = $i;
    }
    $settings->add(new admin_setting_configselect('teamwork/gradedecimals', get_string('gradedecimals', 'teamwork'), get_string('configgradedecimals', 'teamwork'), 0, $options));
    if (isset($CFG->maxbytes)) {
        $maxbytes = get_config('teamwork', 'maxbytes');
        $options = get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes);
        $settings->add(new admin_setting_configselect('teamwork/maxbytes', get_string('maxbytes', 'teamwork'), get_string('configmaxbytes', 'teamwork'), 0, $options));
    }
    $settings->add(new admin_setting_configselect('teamwork/strategy', get_string('strategy', 'teamwork'), get_string('configstrategy', 'teamwork'), 'accumulative', teamwork::available_strategies_list()));
    $options = teamwork::available_example_modes_list();
    $settings->add(new admin_setting_configselect('teamwork/examplesmode', get_string('examplesmode', 'teamwork'), get_string('configexamplesmode', 'teamwork'), teamwork::EXAMPLES_VOLUNTARY, $options));
    // include the settings of allocation subplugins
    $allocators = core_component::get_plugin_list('teamworkallocation');
    foreach ($allocators as $allocator => $path) {
        if (file_exists($settingsfile = $path . '/settings.php')) {
            $settings->add(new admin_setting_heading('teamworkallocationsetting' . $allocator, get_string('allocation', 'teamwork') . ' - ' . get_string('pluginname', 'teamworkallocation_' . $allocator), ''));
            include $settingsfile;
        }
    }
    // include the settings of grading strategy subplugins
    $strategies = core_component::get_plugin_list('teamworkform');
    foreach ($strategies as $strategy => $path) {
        if (file_exists($settingsfile = $path . '/settings.php')) {
            $settings->add(new admin_setting_heading('teamworkformsetting' . $strategy, get_string('strategy', 'teamwork') . ' - ' . get_string('pluginname', 'teamworkform_' . $strategy), ''));