Example #1
0
 /**
  * This function defines the formslib elements
  * @return void
  */
 public function definition()
 {
     global $CFG, $PAGE, $DB;
     $locationlabel = '';
     $mform =& $this->_form;
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     $mform->addElement('hidden', 'rec_id');
     $mform->setType('rec_id', PARAM_INT);
     $mform->addElement('hidden', 'entity_id');
     $mform->setType('entity_id', PARAM_INT);
     $mform->addElement('hidden', 'entity_type');
     $mform->setType('entity_type', PARAM_TEXT);
     if (!empty($this->_customdata['nosettingfound'])) {
         $mform->addElement('header', 'nosettingfound', get_string('nosettingfound', 'local_elisprogram'));
     }
     // border drop down selection
     $name = get_string('cert_border_setting', 'local_elisprogram');
     $borders = function_exists('cm_certificate_get_borders') ? cm_certificate_get_borders() : array('Fancy1-blue.jpg' => 'Fancy1-blue', 'Fancy1-green.jpg' => 'Fancy1-green', 'Fancy2-black.jpg' => 'Fancy2-black', 'Fancy2-brown.jpg' => 'Fancy2-brown', '' => 'None');
     // for testing
     $mform->addElement('select', 'cert_border', $name, $borders);
     $mform->addHelpButton('cert_border', 'cert_border_setting', 'local_elisprogram');
     // Seal drop down selection
     $name = get_string('cert_seal_setting', 'local_elisprogram');
     $seals = function_exists('cm_certificate_get_seals') ? cm_certificate_get_seals() : array('Fancy.png' => 'Fancy', 'Logo.png' => 'Logo', 'Plain.png' => 'Plain', 'Quality.png' => 'Quality', 'Teamwork.png' => 'Teamwork', '' => 'None');
     // for testing
     $mform->addElement('select', 'cert_seal', $name, $seals);
     $mform->addHelpButton('cert_seal', 'cert_seal_setting', 'local_elisprogram');
     // Template drop down selection
     $name = get_string('certificate_template_file', 'local_elisprogram');
     $templates = cm_certificate_get_templates();
     $mform->addElement('select', 'cert_template', $name, $templates);
     $mform->setDefault('cert_template', 'crsentitydefault.php');
     $mform->addHelpButton('cert_template', 'certificate_template_file', 'local_elisprogram');
     $name = get_string('cert_enable', 'local_elisprogram');
     $desc = ' ' . get_string('cert_enable_desc', 'local_elisprogram');
     $mform->addElement('advcheckbox', 'disable', $name, $desc, array('group' => 1), array(1, 0));
     $mform->setDefault('disable', 1);
     $submitlabel = get_string('savechanges');
     $buttonarray[] =& $mform->createElement('submit', 'submitbutton', $submitlabel);
     $buttonarray[] =& $mform->createElement('cancel');
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
 }
 function definition()
 {
     global $USER, $CFG, $COURSE;
     $mform =& $this->_form;
     $strgeneral = get_string('general');
     $strrequired = get_string('required');
     /// Add some extra hidden fields
     $mform->addElement('hidden', 's', 'cfg');
     // Track settings
     $mform->addElement('header', 'tracksettings', get_string('tracksettings', 'block_curr_admin'));
     $mform->addElement('checkbox', 'userdefinedtrack', get_string('userdefinedtrackyesno', 'block_curr_admin'));
     // Course catalog / Learning plan settings
     $mform->addElement('header', 'coursecatalog', get_string('coursecatalog', 'block_curr_admin'));
     $mform->addElement('checkbox', 'disablecoursecatalog', get_string('disablecoursecatalog', 'block_curr_admin'));
     $mform->addElement('text', 'catalog_collapse_count', get_string('catalog_collapse_count', 'block_curr_admin'));
     $mform->setType('catalog_collapse_count', PARAM_INT);
     // Curriculum expiration settings (ELIS-1172)
     $mform->addElement('checkbox', 'enable_curriculum_expiration', get_string('enable_curriculum_expiration', 'block_curr_admin'));
     $opts = array(CURR_EXPIRE_ENROL_START => get_string('curriculum_expire_enrol_start', 'block_curr_admin'), CURR_EXPIRE_ENROL_COMPLETE => get_string('curriculum_expire_enrol_complete', 'block_curr_admin'));
     $mform->addElement('select', 'curriculum_expiration_start', get_string('curriculum_expiration_start', 'block_curr_admin'), $opts);
     // Generate certificate border & seal image options
     $border_images = cm_certificate_get_borders();
     $seal_images = cm_certificate_get_seals();
     $template_files = cm_certificate_get_templates();
     // Certificate settings
     $mform->addElement('header', 'certificates', get_string('certificates', 'block_curr_admin'));
     $mform->addElement('checkbox', 'disablecertificates', get_string('disablecertificates', 'block_curr_admin'));
     $mform->addElement('select', 'certificate_border_image', get_string('certificate_border_image', 'block_curr_admin'), $border_images);
     $mform->setHelpButton('certificate_border_image', array('config/certificate_border_image', get_string('certificate_border_image', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('select', 'certificate_seal_image', get_string('certificate_seal_image', 'block_curr_admin'), $seal_images);
     $mform->setHelpButton('certificate_seal_image', array('config/certificate_seal_image', get_string('certificate_seal_image', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('select', 'certificate_template_file', get_string('certificate_template_file', 'block_curr_admin'), $template_files);
     $mform->setHelpButton('certificate_template_file', array('config/certificate_template_file', get_string('certificate_template_file', 'block_curr_admin'), 'block_curr_admin'));
     // Interface settings
     $mform->addElement('header', 'interfacesettings', get_string('interfacesettings', 'block_curr_admin'));
     $mform->addElement('checkbox', 'time_format_12h', get_string('time_format_12h', 'block_curr_admin'));
     $mform->addElement('checkbox', 'mymoodle_redirect', get_string('mymoodle_redirect', 'block_curr_admin'));
     // User settings
     $mform->addElement('header', 'usersettings', get_string('usersettings', 'block_curr_admin'));
     $mform->addElement('checkbox', 'auto_assign_user_idnumber', get_string('auto_assign_user_idnumber', 'block_curr_admin'));
     $mform->setHelpButton('auto_assign_user_idnumber', array('config/auto_assign_user_idnumber', get_string('auto_assign_user_idnumber', 'block_curr_admin'), 'block_curr_admin'));
     //default instructor role
     $roles = array();
     $roles[NO_ROLE_ID] = get_string('noroleselected', 'block_curr_admin');
     if ($role_records = get_records('role', '', '', 'id')) {
         foreach ($role_records as $id => $role_record) {
             $roles[$id] = $role_record->name;
         }
     }
     $mform->addElement('select', 'default_instructor_role', get_string('instructorrole', 'block_curr_admin'), $roles);
     $mform->setHelpButton('default_instructor_role', array('config/default_instructor_role', get_string('instructorrole', 'block_curr_admin'), 'block_curr_admin'));
     $mform->addElement('checkbox', 'restrict_to_elis_enrolment_plugin', get_string('restrict_to_elis_enrolment_plugin', 'block_curr_admin'));
     $mform->setHelpButton('restrict_to_elis_enrolment_plugin', array('config/restrict_to_elis_enrolment_plugin', get_string('restrict_to_elis_enrolment_plugin', 'block_curr_admin'), 'block_curr_admin'));
     // Cluster settings
     $mform->addElement('header', 'clustersettings', get_string('clustersettings', 'crlm_cluster_groups'));
     $mform->addElement('checkbox', 'cluster_groups', get_string('cluster_groups', 'crlm_cluster_groups'));
     $mform->setHelpButton('cluster_groups', array('global/cluster_groups', get_string('cluster_groups', 'crlm_cluster_groups'), 'crlm_cluster_groups'));
     $mform->addElement('checkbox', 'site_course_cluster_groups', get_string('site_course_cluster_groups', 'crlm_cluster_groups'));
     $mform->setHelpButton('site_course_cluster_groups', array('global/site_course_cluster_groups', get_string('site_course_cluster_groups', 'crlm_cluster_groups'), 'crlm_cluster_groups'));
     $mform->addElement('checkbox', 'cluster_groupings', get_string('cluster_groupings', 'crlm_cluster_groups'));
     $mform->setHelpButton('cluster_groupings', array('global/cluster_groupings', get_string('cluster_groupings', 'crlm_cluster_groups'), 'crlm_cluster_groups'));
     //settings specifically for the curriculum administration block
     $mform->addElement('header', 'block_curr_admin_settings', get_string('block_curr_admin_settings', 'block_curr_admin'));
     //number of icons of each type to display in each section of the tree
     $mform->addElement('text', 'num_block_icons', get_string('num_block_icons', 'block_curr_admin'));
     $mform->setType('num_block_icons', PARAM_INT);
     $mform->setHelpButton('num_block_icons', array('config/num_block_icons', get_string('num_block_icons', 'block_curr_admin'), 'block_curr_admin'));
     //whether to display clusters at the top level
     $mform->addElement('advcheckbox', 'display_clusters_at_top_level', get_string('display_clusters_at_top_level', 'block_curr_admin'), null, null, array(0, 1));
     $mform->setHelpButton('display_clusters_at_top_level', array('config/display_clusters_at_top_level', get_string('display_clusters_at_top_level', 'block_curr_admin'), 'block_curr_admin'));
     //whether to display curricula at the top level
     $mform->addElement('checkbox', 'display_curricula_at_top_level', get_string('display_curricula_at_top_level', 'block_curr_admin'), null, null, array(0, 1));
     $mform->setHelpButton('display_curricula_at_top_level', array('config/display_curricula_at_top_level', get_string('display_curricula_at_top_level', 'block_curr_admin'), 'block_curr_admin'));
     //default role assignments on cm entities
     $mform->addElement('header', 'default_role_assignment_settings', get_string('default_role_assignment_settings', 'block_curr_admin'));
     // we must not use assignable roles here:
     //   1/ unsetting roles as assignable for admin might bork the settings!
     //   2/ default user role should not be assignable anyway
     $allroles = array(0 => get_string('no_default_role', 'block_curr_admin'));
     $nonguestroles = array();
     if ($roles = get_all_roles()) {
         foreach ($roles as $role) {
             $rolename = strip_tags(format_string($role->name, true));
             $allroles[$role->id] = $rolename;
             if (!isset($guestroles[$role->id])) {
                 $nonguestroles[$role->id] = $rolename;
             }
         }
     }
     //default cluster role
     $mform->addElement('select', 'default_cluster_role_id', get_string('default_cluster_role_id', 'block_curr_admin'), $allroles);
     $mform->setHelpButton('default_cluster_role_id', array('config/default_cluster_role_id', get_string('default_cluster_role_id', 'block_curr_admin'), 'block_curr_admin'));
     //default curriculum role
     $mform->addElement('select', 'default_curriculum_role_id', get_string('default_curriculum_role_id', 'block_curr_admin'), $allroles);
     $mform->setHelpButton('default_curriculum_role_id', array('config/default_curriculum_role_id', get_string('default_curriculum_role_id', 'block_curr_admin'), 'block_curr_admin'));
     //default course role
     $mform->addElement('select', 'default_course_role_id', get_string('default_course_role_id', 'block_curr_admin'), $allroles);
     $mform->setHelpButton('default_course_role_id', array('config/default_course_role_id', get_string('default_course_role_id', 'block_curr_admin'), 'block_curr_admin'));
     //default class role
     $mform->addElement('select', 'default_class_role_id', get_string('default_class_role_id', 'block_curr_admin'), $allroles);
     $mform->setHelpButton('default_class_role_id', array('config/default_class_role_id', get_string('default_class_role_id', 'block_curr_admin'), 'block_curr_admin'));
     //default track role
     $mform->addElement('select', 'default_track_role_id', get_string('default_track_role_id', 'block_curr_admin'), $allroles);
     $mform->setHelpButton('default_track_role_id', array('config/default_track_role_id', get_string('default_track_role_id', 'block_curr_admin'), 'block_curr_admin'));
     // enrolment role synchronization settings
     $mform->addElement('header', 'enrolment_role_sync', get_string('enrolment_role_sync_settings', 'crlm_enrolment_role_sync'));
     $mform->addElement('select', 'enrolment_role_sync_student_role', get_string('student_role', 'crlm_enrolment_role_sync'), $allroles);
     $mform->setHelpButton('enrolment_role_sync_student_role', array('student_role', get_string('student_role', 'crlm_enrolment_role_sync'), 'crlm_enrolment_role_sync'));
     $mform->addElement('select', 'enrolment_role_sync_instructor_role', get_string('instructor_role', 'crlm_enrolment_role_sync'), $allroles);
     $mform->setHelpButton('enrolment_role_sync_instructor_role', array('instructor_role', get_string('instructor_role', 'crlm_enrolment_role_sync'), 'crlm_enrolment_role_sync'));
     // autocreate settings
     $mform->addElement('header', 'autocreate', get_string('autocreate_settings', 'block_curr_admin'));
     $mform->addElement('advcheckbox', 'autocreated_unknown_is_yes', get_string('autocreated_unknown_is_yes', 'block_curr_admin'), null, null, array(0, 1));
     $mform->setHelpButton('autocreated_unknown_is_yes', array('config/autocreated_unknown_is_yes', get_string('autocreated_unknown_is_yes', 'block_curr_admin'), 'block_curr_admin'));
     // legacy settings
     $mform->addElement('header', 'legacy', get_string('legacy_settings', 'block_curr_admin'));
     $mform->addElement('advcheckbox', 'legacy_show_inactive_users', get_string('legacy_show_inactive_users', 'block_curr_admin'), null, null, array(0, 1));
     $mform->setHelpButton('legacy_show_inactive_users', array('config/legacy_show_inactive_users', get_string('legacy_show_inactive_users', 'block_curr_admin'), 'block_curr_admin'));
     $this->add_action_buttons();
 }
Example #3
0
 $settings->add(new admin_setting_heading('certificates', get_string('certificates', 'local_elisprogram'), ''));
 // Disable Certificates
 $settings->add(new admin_setting_configcheckbox('local_elisprogram/disablecoursecertificates', get_string('disable_crs_cert', 'local_elisprogram'), get_string('disable_crs_cert_desc', 'local_elisprogram'), 0));
 $settings->add(new admin_setting_configcheckbox('local_elisprogram/disablecertificates', get_string('disable_cert_setting', 'local_elisprogram'), '', 1));
 // Certificate border image
 $borders = function_exists('cm_certificate_get_borders') ? cm_certificate_get_borders() : array('Fancy1-blue.jpg' => 'Fancy1-blue', 'Fancy1-green.jpg' => 'Fancy1-green', 'Fancy2-black.jpg' => 'Fancy2-black', 'Fancy2-brown.jpg' => 'Fancy2-brown', '' => 'None');
 // for testing
 $settings->add(new admin_setting_configselect('local_elisprogram/certificate_border_image', get_string('cert_border_setting', 'local_elisprogram'), get_string('cert_border_help', 'local_elisprogram'), 0, $borders));
 // TBD
 // Certificate seal image
 $seals = function_exists('cm_certificate_get_seals') ? cm_certificate_get_seals() : array('Fancy.png' => 'Fancy', 'Logo.png' => 'Logo', 'Plain.png' => 'Plain', 'Quality.png' => 'Quality', 'Teamwork.png' => 'Teamwork', '' => 'None');
 // for testing
 $settings->add(new admin_setting_configselect('local_elisprogram/certificate_seal_image', get_string('cert_seal_setting', 'local_elisprogram'), get_string('cert_seal_help', 'local_elisprogram'), 0, $seals));
 // TBD
 // Certificate templates
 if ($templates = cm_certificate_get_templates()) {
     $settings->add(new admin_setting_configselect('local_elisprogram/certificate_template_file', get_string('certificate_template_file', 'local_elisprogram'), get_string('certificate_template_file_help', 'local_elisprogram'), 0, $templates));
 }
 // ***Interface Settings
 $settings->add(new admin_setting_heading('interface_settings', get_string('interface_settings', 'local_elisprogram'), ''));
 // Display time selection in a 12 hour format
 $settings->add(new admin_setting_configcheckbox('local_elisprogram/time_format_12h', get_string('time_12h_setting', 'local_elisprogram'), '', 0));
 // Redirect users accessing My Moodle to the dashboard
 $settings->add(new admin_setting_configcheckbox('local_elisprogram/mymoodle_redirect', get_string('redirect_dashbrd_setting', 'local_elisprogram'), '', 0));
 // ***User Settings
 $settings->add(new admin_setting_heading('user_settings', get_string('user_settings', 'local_elisprogram'), ''));
 // Automatically assign an ID number to Moodle users without one
 $settings->add(new admin_setting_configcheckbox('local_elisprogram/auto_assign_user_idnumber', get_string('auto_idnumber_setting', 'local_elisprogram'), get_string('auto_idnumber_help', 'local_elisprogram'), 1));
 // Default Instructor Role
 $crsroles = array();
 if (!defined('NO_ROLE_ID')) {