Ejemplo n.º 1
0
    function definition_after_data() {
        global $DB;
        $mform = $this->_form;
        $category = $mform->getElementValue('entityid');
        $schoolid = $mform->getElementValue('schoolid');
        $tools = array();
        if ($category[0] > 0) {
            $entityid = $category[0];
            $global_ob = global_settings::getInstance();
            $cate_types = $global_ob->get_category_types($entityid);

            foreach ($cate_types as $types) {

                $types->name = $mform->createElement('static', $types->name, null, $types->name);
                $mform->insertElementBefore($types->name, 'categorytypehere');
            }
        }
        if ($schoolid[0] > 0) {
            $exists = $DB->get_records('local_cobalt_entitylevels', array('schoolid' => $schoolid[0]));
            if ($exists) {
                $new1 = $mform->createElement('hidden', 'radiobuttondisable', '1');
                $mform->insertElementBefore($new1, 'radiobuttonhere');
            }
        }
    }
Ejemplo n.º 2
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $mform->addElement('header', 'settingsheader', get_string('gpa_settings', 'local_cobaltsettings'));
        $global_ob = global_settings::getInstance();

        $global_ob->school_formelement_condition($mform);

        $category_types = $global_ob->get_category_types(1, true);
        $mform->addElement('select', 'sub_entityid', get_string('category', 'local_cobaltsettings'), $category_types);
        $mform->addRule('sub_entityid', get_string('category', 'local_cobaltsettings'), 'required', null, 'client');
        $mform->setType('sub_entityid', PARAM_INT);

        $mform->addElement('text', 'gpa', get_string('semgpa', 'local_semesters'));
        $mform->addRule('gpa', get_string('misgpa', 'local_semesters'), 'required', null, 'client');
        $mform->addRule('gpa', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->setType('gpa', PARAM_FLOAT);

        $mform->addElement('text', 'cgpa', get_string('semcgpa', 'local_semesters'));
        $mform->addRule('cgpa', get_string('miscgpa', 'local_semesters'), 'required', null, 'client');
        $mform->addRule('cgpa', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->setType('cgpa', PARAM_FLOAT);

        $mform->addElement('text', 'probationgpa', get_string('probationgpa', 'local_cobaltsettings'));
        $mform->addRule('probationgpa', get_string('misprobationgpa', 'local_cobaltsettings'), 'required', null, 'client');
        $mform->addRule('probationgpa', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->setType('probationgpa', PARAM_FLOAT);

        $mform->addElement('text', 'dismissalgpa', get_string('dismissalgpa', 'local_cobaltsettings'));
        $mform->addRule('dismissalgpa', get_string('misdismissalgpa', 'local_cobaltsettings'), 'required', null, 'client');
        $mform->addRule('dismissalgpa', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->setType('dismissalgpa', PARAM_FLOAT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        if ($id < 0)
            $save = get_string('addsettings', 'local_cobaltsettings');
        else
            $save = get_string('updatesettings', 'local_cobaltsettings');
        $this->add_action_buttons(true, $save);
    }
Ejemplo n.º 3
0
require_login();
$PAGE->set_url('/local/cobaltsettings/school_settings.php');
if (!has_capability('local/cobaltsettings:view', $systemcontext)) {
    print_cobalterror('permissions_error','local_collegestructure');
}
$PAGE->navbar->add(get_string('global_settings', 'local_cobaltsettings'), new moodle_url('/local/cobaltsettings/school_settings.php'));
echo $OUTPUT->header();
/* ---global settings--- */
echo $OUTPUT->heading(get_string('school_settings', 'local_cobaltsettings'));

$currenturl = "{$CFG->wwwroot}/local/cobaltsettings/school_settings.php";
$hier1 = new hierarchy();
/* ---instance of school settings form--- */
$system = new schoolsettings_form();
/* ---adding tabs using cobalt_settings_tabs function--- */
$global_ob = global_settings::getInstance();
/* ---checking if login user is registrar or admin--- */
$schoolid = $global_ob->check_loginuser_registrar_admin();

try {

    /* ---description of the cobalt level settings table--- */
    echo $des = get_string('des_slsettings', 'local_cobaltsettings');

    /* ---used to fectching exists schoolids in cobalt settings table--- */
    $tool = $DB->get_records('local_school_settings');
    $temp1_cond = array_chunk($tool, 4);
    $exists_schoolids[] = 0;
    if (!empty($temp1_cond)) {
        foreach ($temp1_cond as $tc)
            $exists_schoolids[] = $tc[0]->schoolid;
Ejemplo n.º 4
0
 public static function getInstance() {
     if (!self::$_singleton) {
         self::$_singleton = new global_settings ();
     }
     return self::$_singleton;
 }