function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        $mform->addElement('header', 'settingsheader', get_string('system_settings', 'local_cobaltsettings'));
        $hier1 = new hierarchy();
        $schoolids = $hier1->get_assignedschools();
        if (!empty($schoolids)) {
            $count = sizeof($schoolids);
            if ($count > 1) {
                $parents = $hier1->get_school_parent($schoolids, '', true);
                $attributes1 = 'style="height:25px; width:29%; "';
                $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents, $attributes1);
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            } else {
                $schoolname = $DB->get_record('local_school', array('id' => $schoolids[0]->id));
                $mform->addElement('static', 'sid', get_string('select', 'local_collegestructure'), $schoolname->fullname);
                $mform->addElement('hidden', 'schoolid', $schoolids[0]->id);
            }
        }
        $mform->addElement('advcheckbox', 'batch', null, 'Batch', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px;" class="form-description"><p>' . get_string('enable_batch', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'prefix_suffix', null, 'Prefix-Suffix', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px;" class="form-description"><p>' . get_string('create_batch', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'online_app', null, 'Online Applications', array('group' => 1), array(0, 1));
        $mform->addElement('html', '<div style=" margin-left:265px; color:light-grey" class="form-description"><p>' . get_string('enable_online', 'local_cobaltsettings') . '
			   </p></div>');
        $mform->addElement('advcheckbox', 'certificate', null, 'Issue certificates', array('group' => 1), array(0, 1));
        /* start of vijaya jan-29 */
        $mform->addElement('advcheckbox', 'onlinepayment', null, 'Online Payment', array('group' => 1), array(0, 1));
        /* end of vijaya jan-29 */
        $this->add_action_buttons(true, 'Submit');
    }
Beispiel #2
0
    public function definition() {
        global $USER, $CFG, $PAGE;
        $school = new school();
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $schools = $this->_customdata['tool'];
        $editoroptions = $this->_customdata['editoroptions'];
        if ($id < 0)
            $mform->addElement('header', 'settingsheader', get_string('createschool', 'local_collegestructure'));
        else
            $mform->addElement('header', 'settingsheader', get_string('editschool', 'local_collegestructure'));
        $tools = array();
        $hierarchy = new hierarchy();
        $items = $hierarchy->get_school_items(true);
        $parents = $hierarchy->get_school_parent($items, $schools->id);
        if (count($parents) <= 1) {
            $mform->addElement('hidden', 'parentid', 0);
            $mform->setType('parentid', PARAM_RAW);
        } else {
            $mform->addElement('select', 'parentid', get_string('parent', 'local_collegestructure'), $parents);
            $mform->setType('parentid', PARAM_RAW);
        }
        $mform->addHelpButton('parentid', 'parent', 'local_collegestructure');
        $mform->addElement('text', 'fullname', get_string('schoolname', 'local_collegestructure'), $tools);
        $mform->setType('fullname', PARAM_TEXT);
        $mform->addRule('fullname', get_string('missingschoolname', 'local_collegestructure'), 'required', null, 'client');

        $mform->addElement('editor', 'description', get_string('description', 'local_collegestructure'), null, $editoroptions);
        $mform->setType('description', PARAM_RAW);

        $selecttype = array();
        $selecttype['1'] = get_string('campus', 'local_collegestructure');
        $selecttype['2'] = get_string('university', 'local_collegestructure');
        $selecttype['3'] = get_string('location', 'local_collegestructure');
        $mform->addElement('select', 'type', get_string('type', 'local_collegestructure'), $selecttype);
        $mform->addHelpButton('type', 'type', 'local_collegestructure');
        $mform->setType('type', PARAM_RAW);
        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $now = date("d-m-Y");
        $now = strtotime($now);
        $mform->addElement('hidden', 'timecreated', $now);
        $mform->setType('timecreated', PARAM_RAW);
        $mform->addElement('hidden', 'usermodified', $USER->id);
        $mform->setType('usermodified', PARAM_RAW);
        $themelist = $school->cobalt_get_theme_list();
        $mform->addElement('select', 'theme', get_string('theme', 'local_collegestructure'), $themelist);
        $mform->setType('theme', PARAM_RAW);
        $mform->addRule('theme', get_string('missingtheme', 'local_collegestructure'), 'required', null, 'client');
        $submit = ($id > 0) ? get_string('update_school', 'local_collegestructure') : get_string('create', 'local_collegestructure');
        $this->add_action_buttons('false', $submit);
    }
Beispiel #3
0
    public function definition() {
        global $USER, $CFG, $PAGE;
        $id = optional_param('id', -1, PARAM_INT);
        $hierarchy = new hierarchy();
        $mform = $this->_form;
        if ($id < 0)
            $PAGE->requires->yui_module('moodle-local_modules-schoolchooser', 'M.local_modules.init_schoolchooser', array(array('formid' => $mform->getAttribute('id'))));
        $editoroptions = $this->_customdata['editoroptions'];
        $items = $hierarchy->get_school_items();
        $school = $hierarchy->get_school_parent($items);
        $editoroptions = $this->_customdata['editoroptions'];
        if ($id > 0)
            $mform->addElement('header', 'settingsheader', get_string('editmodule', 'local_modules'));
        else
            $mform->addElement('header', 'settingsheader', get_string('createmodule', 'local_modules'));
        if ($id < 0) {

            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            $mform->setType('schoolid', PARAM_RAW);

            $mform->registerNoSubmitButton('updateschoolformat');
            $mform->addElement('submit', 'updateschoolformat', get_string('courseformatudpate'));
            $mform->addElement('hidden', 'addprogramslisthere');
            $mform->setType('addprogramslisthere', PARAM_RAW);
        }

        if ($id > 0) {
            $mform->addElement('static', 'school_name', get_string('schoolid', 'local_collegestructure'));
            $mform->addElement('hidden', 'schoolid');
            $mform->setType('schoolid', PARAM_RAW);
            $mform->addElement('static', 'program_name', get_string('programname', 'local_programs'));
            $mform->addElement('hidden', 'programid');
            $mform->setType('programid', PARAM_RAW);
        }
        $tools = array();
        $mform->addElement('text', 'fullname', get_string('modulename', 'local_modules'), $tools);
        $mform->addRule('fullname', get_string('missingmodulename', 'local_modules'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);
        $mform->addElement('editor', 'description', get_string('description', 'local_modules'), null, $editoroptions);
        $mform->setType('description', PARAM_RAW);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submitlable = ($id > 0) ? get_string('savemodule', 'local_modules') : get_string('createmodule', 'local_modules');
        $this->add_action_buttons($cancel = true, $submitlable);
        // $this->add_action_buttons();
    }
Beispiel #4
0
    public function definition() {
        global $CFG, $DB;
        $mform = & $this->_form;
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        if ($count > 1) {
            $school = $hierarchy->get_school_parent($scho);
            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
            $mform->addRule('schoolid', get_string('required'), 'required', null, 'client');
        } else {
            $school = $DB->get_record('local_school', array('visible' => 1));
            $mform->addElement('static', 'school', get_string('schoolid', 'local_collegestructure'), $school->fullname);
            $mform->setType('school', PARAM_RAW);

            $mform->addElement('hidden', 'schoolid', $school->id);
            $mform->setType('schoolidid', PARAM_INT);
        }

        for ($i = 0; $i <= 23; $i++) {
            $hours[$i] = sprintf("%02d", $i);
        }
        for ($i = 0; $i < 60; $i+=5) {
            $minutes[$i] = sprintf("%02d", $i);
        }

        $durtime = array();
        $durtime[] = & $mform->createElement('select', 'starthours', get_string('hour', 'form'), $hours, false, true);
        $durtime[] = & $mform->createElement('select', 'startminutes', get_string('minute', 'form'), $minutes, false, true);
        $mform->addGroup($durtime, 'starttime', get_string('starttime', 'local_attendance'), array(' '), true);


        $durtimes = array();
        $durtimes[] = & $mform->createElement('select', 'endhours', get_string('hour', 'form'), $hours, false, true);
        $durtimes[] = & $mform->createElement('select', 'endminutes', get_string('minute', 'form'), $minutes, false, true);
        $mform->addGroup($durtimes, 'endtime', get_string('orgendtime', 'local_attendance'), array(' '), true);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submit = ($this->_customdata['id'] > 0) ? 'Update' : 'Create';
        $this->add_action_buttons('false', $submit);
    }
Beispiel #5
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;

        $mform = $this->_form;
        $mform->addElement('header', 'settingsheader', get_string('addeditgradeletter', 'local_gradesubmission'));

        $PAGE->requires->yui_module('moodle-local_gradesubmission-heirarchyselector', 'M.local_gradesubmission.init_heirarchyselector', array(array('formid' => $mform->getAttribute('id'))));
        $id = $this->_customdata['id'];

        $disable = ($id > 0) ? 'disabled="disabled"' : '';

        $hierarchy = new hierarchy();
        $schools = $hierarchy->get_assignedschools();
        $count = count($schools);

        if ($count > 1) {
            $parents = $hierarchy->get_school_parent($schools);
            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents, $disable);
            if ($id < 0) {
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            }
            $mform->setType('schoolid', PARAM_INT);
        } else {
            $school_name = $DB->get_record('local_school', array('id' => $schools[0]->id));
            $mform->addElement('static', 'schid', get_string('schoolid', 'local_collegestructure'), $school_name->fullname);
            $mform->addElement('hidden', 'schoolid', $schools[0]->id);
            $mform->setType('schoolid', PARAM_INT);
        }

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        $mform->addElement('hidden', 'addprogramslisthere');
        $mform->setType('addprogramslisthere', PARAM_INT);
        $mform->addElement('hidden', 'addsemesterslisthere');
        $mform->setType('addsemesterslisthere', PARAM_INT);
        $mform->addElement('hidden', 'addclclasseslisthere');
        $mform->setType('addclclasseslisthere', PARAM_INT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $this->add_action_buttons();
    }
Beispiel #6
0
 function definition() {
     global $USER, $CFG, $DB, $PAGE;
     $id = optional_param('id', -1, PARAM_INT);
     $hierarchy = new hierarchy();
     $instance = new cobalt_examtype();
     $mform = $this->_form;
     $editoroptions = $this->_customdata['editoroptions'];
     if ($id > 0)
         $mform->addElement('header', 'settingsheader', get_string('editexamtype', 'local_examtype'));
     else
         $mform->addElement('header', 'settingsheader', get_string('addeditexamtype', 'local_examtype'));
     $items = $hierarchy->get_school_items();
     $school = $hierarchy->get_school_parent($items);
     if ($id < 0) {
         $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
         $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
         $mform->setType('schoolid', PARAM_RAW);
     }
     if ($id > 0) {
         $mform->addElement('static', 'school_name', get_string('schoolid', 'local_collegestructure'));
         $mform->addElement('hidden', 'schoolid');
         $mform->setType('schoolid', PARAM_RAW);
     }
     $mform->addElement('text', 'examtype', get_string('examtype', 'local_examtype'));
     $mform->addRule('examtype', get_string('examtypereq', 'local_examtype'), 'required', null, 'client');
     $mform->setType('examtype', PARAM_RAW);
     $mform->addElement('editor', 'description', get_string('description', 'local_examtype'), null, $editoroptions);
     $mform->setType('description', PARAM_RAW);
     $mform->addElement('hidden', 'id');
     $mform->setType('id', PARAM_INT);
     if ($id < 0)
         $save = get_string('addeditexamtype', 'local_examtype');
     else
         $save = get_string('updateexamtype', 'local_examtype');
     $this->add_action_buttons(true, $save);
 }
Beispiel #7
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        //------used for editing purpose(used to put static schoolname and shortname)
        $eid = $this->_customdata['temp'];
        //-------used for adding department from college structure plugin or other plugin
        $schoolid_collegestruct = $this->_customdata['scid'];
        /* Bug-id #262 
         * @author hemalatha c arun <*****@*****.**>  
         * resolved -string issue
         */

        if ($eid->id > 0) {
            $mform->addElement('header', 'editheader', get_string('edit_department', 'local_departments'));
            $mform->addHelpButton('editheader', 'deptnote', 'local_departments');
        } else {
            // get_string('create_note','local_departments');
            $mform->addElement('header', 'createheader', get_string('create_department', 'local_departments'));
            $mform->addHelpButton('createheader', 'deptnote', 'local_departments');
        }
        $attributes = 'style="height:30px; "';
        //------used for editing purpose(used to put static schoolname )
        if ($eid->id > 0) {
            $school = $DB->get_record('local_school', array('id' => $eid->schoolid));
            $mform->addElement('static', 'esid', get_string('schoolid', 'local_collegestructure'), $school->fullname);
        } else {
            $hier = new hierarchy();
            if (is_siteadmin($USER->id)) {
                $schoolids = $DB->get_records('local_school', array('visible' => 1));
            } else
                $schoolids = $hier->get_assignedschools();

            $count = sizeof($schoolids);
            if ($count > 1) {
                //  $items = $hier->get_school_items();
                $parents = $hier->get_school_parent($schoolids, '', true);
                //$attributes1='style="height:30px; width:29%; "';
                $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents);
                $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
                if ($schoolid_collegestruct > 0)
                    $mform->setDefault('schoolid', $schoolid_collegestruct);
            }
            else {          
                foreach($schoolids as $sid){
                  $schoolid=$sid->id;
                  $schoolname=$sid->fullname;
                }          
                $mform->addElement('static', 'sid', get_string('schoolid', 'local_collegestructure'), $schoolname);
                $mform->addElement('hidden', 'schoolid', $schoolid);
            }
        }
        $mform->setType('schoolid', PARAM_INT);

        $mform->addElement('text', 'fullname', get_string('deptfullname', 'local_departments'), $attributes);
        $mform->addRule('fullname', get_string('missing_deptfullname', 'local_departments'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);
        $mform->addHelpButton('fullname', 'fullname_note', 'local_departments');

        //-----used to put static shortname while editing---------
        if ($eid->id > 0) {
            $mform->addElement('static', 'eshortname', get_string('deptid', 'local_departments'), $eid->shortname);
        } else {
            $mform->addElement('text', 'shortname', get_string('deptid', 'local_departments'), $attributes);
            $mform->addRule('shortname', get_string('missing_deptid', 'local_departments'), 'required', null, 'client');
            $mform->setType('shortname', PARAM_TEXT);
            $mform->addHelpButton('shortname', 'shortname_note', 'local_departments');
        }

        //$mform->addElement('textarea', 'description', get_string("description", "local_departments"), 'wrap="virtual" rows="6" cols="150"',$attributes);
        //$mform->setType('description', PARAM_TEXT);

        $mform->addElement('editor', 'description', get_string("description", "local_departments"));
        $mform->setType('description', PARAM_RAW);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submitbuttonname = ($eid->id > 0) ? 'update_department' : 'create_department';
        $this->add_action_buttons(true, get_string($submitbuttonname, 'local_departments'));
    }
Beispiel #8
0
 /**
  * @method  school_formelement_condition
  * @todo to display school field form element based on condition (if multiple school providing drop down box else static field)
  * @param object $mform    
  * @return array of objects(form elements)
  */
 public function school_formelement_condition($mform) {
     global $DB, $CFG, $USER;
     $hier = new hierarchy();
     if (is_siteadmin($USER->id)) {
         $schoolids = $DB->get_records('local_school', array('visible' => 1));
     } else
         $schoolids = $hier->get_assignedschools();
     if (!empty($schoolids)) {
         $count = sizeof($schoolids);
         if ($count > 1) {
             $parents = $hier->get_school_parent($schoolids, '', true);
             $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
             $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
         } else {
             $schoolname = $DB->get_record('local_school', array('id' => $schoolids[0]->id));
             $mform->addElement('static', 'sid', get_string('schoolid', 'local_collegestructure'), $schoolname->fullname);
             $mform->addElement('hidden', 'schoolid', $schoolids[0]->id);
         }
         $mform->setType('schoolid', PARAM_INT);
     }
 }
Beispiel #9
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $mform = $this->_form;
        //------used for editing purpose(used to put static schoolname and shortname)
        $eid = $this->_customdata['temp'];
        $hierarchy= new hierarchy();
        $PAGE->requires->yui_module('moodle-local_prefix-hideshow', 'M.local_prefix.init_hideshow', array(array('formid' => $mform->getAttribute('id'))));
        if ($eid->id > 0)
            $mform->addElement('header', 'settingsheader', get_string('editprefix_settings', 'local_prefix'));
        else
            $mform->addElement('header', 'settingsheader', get_string('prefixs', 'local_prefix'));

        $prefix = prefix_suffix::getInstance();
        $entitylist = $hierarchy->get_records_cobaltselect_menu('local_create_entity', '', null, '', 'id,entity_name', '--Select--');
        $mform->addElement('select', 'entityid', get_string('entityid', 'local_prefix'), $entitylist);
        $mform->addRule('entityid', get_string('entityid', 'local_prefix'), 'required', null, 'client');
        //------used for editing purpose(used to put static schoolname )
        if ($eid->id > 0) {
            $school = $DB->get_record('local_school', array('id' => $eid->schoolid));
            $mform->addElement('static', 'esid', get_string('select', 'local_collegestructure'), $school->fullname);

            $program = $DB->get_record('local_program', array('id' => $eid->programid));
            $mform->addElement('static', 'epid', get_string('selectprogram', 'local_programs'), $program->fullname);
        } else {
            $hier = new hierarchy();
            if (is_siteadmin($USER->id)) {
                $schoolids = $DB->get_records('local_school', array('visible' => 1));
            } else {
                $schoolids = $hier->get_assignedschools();
            }
            $count = sizeof($schoolids);
            if ($count > 1) {
                $items = $hier->get_school_items();
                $parents = $hier->get_school_parent($schoolids, '', true);
                $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
                $mform->addRule('schoolid', get_string('select', 'local_collegestructure'), 'required', null, 'client');
                $mform->registerNoSubmitButton('updatecourseformat');
                $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
            } else {
                  
                 foreach($schoolids as $sid){
                  $schoolid=$sid->id;
                  $schoolname=$sid->fullname;
                }          
                $mform->addElement('static', 'sid', get_string('schoolid', 'local_collegestructure'), $schoolname);
                $mform->addElement('hidden', 'schoolid', $schoolid);
            }
        }

        $mform->setType('schoolid', PARAM_INT);
        $mform->addElement('hidden', 'addprogramlisthere');
        $mform->setType('addprogramlisthere', PARAM_INT);

        $mform->addElement('text', 'sequence_no', get_string('sequence', 'local_prefix'));
        $mform->addRule('sequence_no', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
        $mform->addRule('sequence_no', get_string('num', 'local_prefix'), 'numeric', null, 'client');
        $mform->addRule('sequence_no', get_string('seq1', 'local_prefix'), 'required', null, 'client');
        $mform->setType('sequence_no', PARAM_RAW);

        $mform->addElement('text', 'prefix', get_string('prefix', 'local_prefix'));
        $mform->addRule('prefix', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
        $mform->addRule('prefix', get_string('pre1', 'local_prefix'), 'required', null, 'client');
        $mform->setType('prefix', PARAM_RAW);

        $mform->addElement('text', 'suffix', get_string('suffix', 'local_prefix'));
        $mform->addRule('suffix', get_string('spaces', 'local_prefix'), 'regex', '/[^ ]+/', 'client');
        $mform->addRule('suffix', get_string('suf1', 'local_prefix'), 'required', null, 'client');
        $mform->setType('suffix', PARAM_RAW);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $mform->addElement('hidden', 'page');
        $mform->setType('page', PARAM_INT);
        $i = get_string('submit', 'local_prefix');

        $this->add_action_buttons(true, 'Submit');
    }
Beispiel #10
0
//Header and the navigation bar
$PAGE->set_heading(get_string('semesters', 'local_semesters'));
$PAGE->navbar->add(get_string('pluginname', 'local_semesters'), new moodle_url('/local/semesters/index.php'));
$PAGE->navbar->add(get_string('report', 'local_semesters'));
echo $OUTPUT->header();
//Heading of the page
echo $OUTPUT->heading(get_string('pluginname', 'local_semesters'));
$currenttab = 'report';
$mysemester->createtabview($currenttab);
$hierarchy = new hierarchy();
$schoollist = $hierarchy->get_assignedschools();

if (is_siteadmin()) {
    $schoollist = $hierarchy->get_school_items();
}
$parent = $hierarchy->get_school_parent($schoollist, '', false, false);
$schoolid = implode(',', array_keys($parent));
//get the reports for the Current & Completed Semesters.

$semesters = $mysemester->get_listofsemesters($currenttab, $schoolid);
$data = array();
foreach ($semesters as $semester) {
    $line = array();
    $line[] = $semester->fullname;
    $line[] = $DB->count_records('local_user_semester', array('semesterid' => $semester->id));
    $line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 0));
    $line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 1));
    $line[] = $DB->count_records('local_user_sem_details', array('semesterid' => $semester->id, 'studentstatus' => 2));
    $data[] = $line;
}
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
Beispiel #11
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE, $hierarchy;

        $mform = $this->_form;

        $PAGE->requires->yui_module('moodle-local_scheduleexam-scheduleexamchooser', 'M.local_scheduleexam.init_scheduleexamchooser', array(array('formid' => $mform->getAttribute('id'))));
        $id = $this->_customdata['id'];

        $disable = ($id > 0) ? 'disabled="disabled"' : '';

        $hierarchy = new hierarchy();
        if (is_siteadmin($USER->id)) {
            $schools = $DB->get_records('local_school', array('visible' => 1));
        } else {
            $schools = $hierarchy->get_assignedschools();
        }

        if ($id > 0) {
            $mform->addElement('header', 'editexamheader', get_string('editexamheader', 'local_scheduleexam'));
            $mform->addHelpButton('editexamheader', 'editexamheader', 'local_scheduleexam');
        } else {
            $mform->addElement('header', 'createexamheader', get_string('createexamheader', 'local_scheduleexam'));
            $mform->addHelpButton('createexamheader', 'createexamheader', 'local_scheduleexam');
        }

        $parents = $hierarchy->get_school_parent($schools);
        $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents, $disable);
        if ($id < 0) {
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        }
        $mform->setType('schoolid', PARAM_INT);


        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        $mform->addElement('hidden', 'addsemesterslisthere');
        $mform->setType('addsemesterslisthere', PARAM_INT);
        $mform->addElement('hidden', 'addclclasseslisthere');
        $mform->setType('addclclasseslisthere', PARAM_INT);
        
        $mform->addElement('hidden', 'addcobaltcourseehere');
        $mform->setType('addcobaltcourseehere', PARAM_INT);
        
        $mform->addElement('hidden', 'addexamtypehere');
        $mform->setType('addexamtypehere', PARAM_INT);
        
        $mform->addElement('hidden', 'addexamtypeempty_msg');
        $mform->setType('addexamtypeempty_msg', PARAM_RAW);
        
        $mform->addElement('hidden', 'addlecturetypehere');
        $mform->setType('addlecturetypehere', PARAM_INT);
        
        $mform->addElement('hidden', 'addlecturetypeempty_msg');
        $mform->setType('addlecturetypeempty_msg', PARAM_RAW);
        
        $mform->addElement('date_selector', 'opendate', get_string('opendate', 'local_scheduleexam'));
        $mform->addRule('opendate', get_string('opendatereq', 'local_scheduleexam'), 'required', null, 'client');

        //*************************************************************************************************************
        $shour['null'] = 'Hour';
        for ($sthour = 0; $sthour <= 23; $sthour++) {
            if ($sthour < 10)
                $shour['0' . $sthour] = '0' . $sthour;
            else
                $shour[$sthour] = $sthour;
        }
        $smin['null'] = 'Mins';
        for ($stmin = 0; $stmin <= 59; $stmin++) {
            if ($stmin < 10)
                $smin['0' . $stmin] = '0' . $stmin;
            else
                $smin[$stmin] = $stmin;
        }

        $starttime = array();
        $starttime[] = & $mform->createElement('select', 'starttimehour', '', $shour);
        $starttime[] = & $mform->createElement('select', 'starttimemin', '', $smin);
        $mform->addGroup($starttime, 'starttimearr', get_string('starttimehour', 'local_scheduleexam'), array(' '), false);
        $mform->addRule('starttimearr', get_string('missingstarttimehour', 'local_scheduleexam'), 'required', null, 'client');

        $endtime = array();
        $endtime[] = & $mform->createElement('select', 'endtimehour', '', $shour);
        $endtime[] = & $mform->createElement('select', 'endtimemin', '', $smin);
        $mform->addGroup($endtime, 'endtimearr', get_string('endtimehour', 'local_scheduleexam'), array(' '), false);
        $mform->addRule('endtimearr', get_string('missingendtimehour', 'local_scheduleexam'), 'required', null, 'client');


        $mform->addElement('text', 'grademin', get_string('grademin', 'local_scheduleexam'), $disable);
        $mform->setType('grademin', PARAM_INT);
        if ($id < 0) {
            $mform->addRule('grademin', get_string('grademinreq', 'local_scheduleexam'), 'required', null, 'client');
            $mform->addRule('grademin', get_string('grademinnum', 'local_scheduleexam'), 'numeric', null, 'client');
        }

        $mform->addElement('text', 'grademax', get_string('grademax', 'local_scheduleexam'), $disable);
        $mform->setType('grademax', PARAM_INT);
        if ($id < 0) {
            $mform->addRule('grademax', get_string('grademaxreq', 'local_scheduleexam'), 'required', null, 'client');
            $mform->addRule('grademax', get_string('grademaxnum', 'local_scheduleexam'), 'numeric', null, 'client');
        }
//            $mform->addElement('text', 'examweightage', get_string('examweightage', 'local_scheduleexam'), $disable);
//            $mform->setType('examweightage', PARAM_INT);
//        if($id < 0){
//            $mform->addRule('examweightage', get_string('examweightagereq', 'local_scheduleexam'), 'required', null, 'client');
//            $mform->addRule('examweightage', get_string('examweightagenum', 'local_scheduleexam'), 'numeric', null, 'client');
//        }
        //*****************************************************************************************

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        if ($id < 0) {
            $this->add_action_buttons('false', 'Schedule Assessment');
        } else {
            $this->add_action_buttons('false', 'Update Assessment');
        }
    }
Beispiel #12
0
//echo $OUTPUT->header();
echo $OUTPUT->header();
//Heading of the page
echo $OUTPUT->heading(get_string('managemodule', 'local_modules'));
$hier = new hierarchy();
$schools = $hier->get_assignedschools();
$currenttab = "lists";
$instance->print_tabs($currenttab, -1);

// 
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_modules'));
}

$schools = $hier->get_school_parent($schools, $selected = array(), $inctop = false, $all = false);
if (is_siteadmin()) {
    $schools = $hier->get_school_items();
}

$schoollist_string = implode(',', array_keys($schools));
if (empty($schoollist_string)) {
    echo get_string('no_records', 'local_request');

    echo $OUTPUT->footer();
    die;
}
$tools = $DB->get_records_sql('select * from {local_module} where schoolid in (' . $schoollist_string . ')');
$data = array();
$capabilities_array = array('local/modules:manage', 'local/modules:delete', 'local/modules:update', 'local/modules:visible');
$assigncourse_cap = array('local/modules:manage', 'local/modules:assigncourse');
Beispiel #13
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;

        $mform = $this->_form;
        $id = $this->_customdata['id'];

        $mform->addElement('header', 'settingsheader', get_string('addeditgradeletter', 'local_gradeletter'));

        $hierarchy = new hierarchy();
        if (is_siteadmin($USER->id)) {
            $schools = $DB->get_records('local_school', array('visible' => 1));
        } else {
            $schools = $hierarchy->get_assignedschools();
        }
        $noofschools = count($schools);

        if ($noofschools > 1) {
            $parents = $hierarchy->get_school_parent($schools);
            $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $parents);
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
            $mform->setType('schoolid', PARAM_INT);
        } else {
            foreach($schools as $sl){
                $schoolid  = $sl->id;
                $schoolname= $sl->fullname;
            }            
            $mform->addElement('static', 'schid', get_string('select', 'local_collegestructure'), $schoolname);
            $mform->addElement('hidden', 'schoolid', $schoolid);
            $mform->setType('schoolid', PARAM_INT);
        }

        $mform->addElement('text', 'letter', get_string('lettergrades', 'local_gradeletter'));
        $mform->addRule('letter', get_string('letterreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('letter', get_string('lettersonly', 'local_gradeletter'), 'lettersonly', null, 'client');
        $mform->setType('letter', PARAM_TEXT);

        $mform->addElement('text', 'markfrom', get_string('markfrom', 'local_gradeletter'));
        $mform->addRule('markfrom', get_string('marksfromreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('markfrom', null, 'numeric', null, 'client');
        // $mform->addRule('markfrom', get_string('markslengthmin','local_gradeletter'), 'minlength',2, 'client');
        $mform->setType('markfrom', PARAM_INT);

        $mform->addElement('text', 'markto', get_string('markto', 'local_gradeletter'));
        $mform->addRule('markto', get_string('reqmarktoval', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('markto', null, 'numeric', null, 'client');
        $mform->addRule('markto', get_string('markslengthmin', 'local_gradeletter'), 'minlength', 2, 'client');
        $mform->setType('markto', PARAM_INT);

        $mform->addRule(array('markfrom', 'markto'), '"Mark from" value should be lesser than "Mark to" value.', 'compare', '<');

        $mform->addElement('text', 'gradepoint', get_string('gradepoint', 'local_gradeletter'));
        $mform->addRule('gradepoint', get_string('gradepointreq', 'local_gradeletter'), 'required', null, 'client');
        $mform->addRule('gradepoint', null, 'numeric', null, 'client');
        $mform->setType('gradepoint', PARAM_TEXT);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $submitlable = ($id > 0) ? get_string('updategradeletter', 'local_gradeletter') : get_string('creategradeletter', 'local_gradeletter');
        $this->add_action_buttons($cancel = true, $submitlable);
    }
Beispiel #14
0
$data = array();
foreach ($semesters as $semester) {
    $line = array();
    $line[] = $semester->fullname;
    $schoollist = $DB->get_records('local_school_semester', array('semesterid' => $semester->id));
    $schoolname = '';
    $unassign = '';
    foreach ($schoollist as $school) {
        $schoolname .= '<div>' . $DB->get_field('local_school', 'fullname', array('id' => $school->schoolid)) . '</div>';
        $unassign .= '<div>' . html_writer::link(new moodle_url('/local/semesters/assign.php', array('schoolid' => $school->schoolid, 'semesterid' => $school->semesterid, 'unassign' => 1, 'sesskey' => sesskey())), html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'title' => get_string('unassign', 'local_semesters'), 'alt' => get_string('unassign', 'local_semesters'), 'class' => 'iconsmall'))) . '</div>';
    }
    $line[] = $schoolname;
    $line[] = $unassign;
    $items = $hierarchy->get_school_items();
    $items = $mysemester->remove_assignedschool($items, $semester->id);
    $parents = $hierarchy->get_school_parent($items);
    $scl = new single_select(new moodle_url('/local/semesters/assign.php?semesterid=' . $semester->id . ''), 'schoolid', $parents, '', null);
    $line[] = $OUTPUT->render($scl);
    $data[] = $line;
}
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('viewsemesterreportspage', 'local_semesters'));
}
if (!empty($data)) {  //if data is present in the table then only display the filters
    $PAGE->requires->js('/local/semesters/semesterjs.js');
}
//View Part starts
//start the table
$table = new html_table();
$table->id = "semestertable";
$head = array();
Beispiel #15
0
//tabs
createtabview_gsub($currenttab);

// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_gradesubmission'));
}

$hierarchy = new hierarchy();
if (is_siteadmin($USER->id)) {
    $schools = $DB->get_records('local_school', array('visible' => 1));
} else {
    $schools = $hierarchy->get_assignedschools();
}
$schoolist = $hierarchy->get_school_parent($schools);
echo '<br/><br/>';
echo '<div class="selfilterpos" id="school">';
$sch = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php'), 'school', $schoolist, $school, null);
$sch->set_label(get_string('schoolid', 'local_collegestructure'));
echo $OUTPUT->render($sch);
echo '</div>';

if (isset($schoolist)) {

    $semesterslist = $hierarchy->get_school_semesters($school);
    echo '<div class="selfilterpos" id="semester">';
    $sem = new single_select(new moodle_url('/local/gradesubmission/submitgrades.php?school=' . $school), 'semester', $semesterslist, $semester, null);
    $sem->set_label(get_string('semester', 'local_semesters'));
    echo $OUTPUT->render($sem);
    echo '</div>';
Beispiel #16
0
    public function definition() {
        global $CFG, $DB, $PAGE, $USER;
        $mform = & $this->_form;
        $hierarchy = new hierarchy();
        $id = $this->_customdata['id'];
        $deptid = $this->_customdata['deptid'];
        $schoid = $this->_customdata['schoid'];
        $semid = $this->_customdata['semid'];
        $courseid = $this->_customdata['courseid'];
        $classid = $this->_customdata['classid'];
        $classtype = $this->_customdata['classtype'];

        // remove empty value in classtype
        if ($classtype) {
            foreach ($classtype as $key => $value) {
                if ($value == 0)
                    unset($classtype[$key]);
            }
        }

        if (isset($classid))
            $classinfo = $DB->get_record('local_clclasses', array('id' => $classid, 'visible' => 1));


        $deptid = (isset($classinfo->departmentid) ? $classinfo->departmentid : 0);
        $schoolid = (isset($classinfo->schoolid) ? $classinfo->schoolid : 0);
        $semid = (isset($classinfo->semesterid) ? $classinfo->semesterid : 0);

        $id = $this->_customdata['id'];
        //$PAGE->requires->yui_module('moodle-local_clclasses-chooser', 'M.local_clclasses.init_chooser', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_timetable-timetable', 'M.local_timetable.init_timetable', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->js('/local/timetable/unassign_type.js');
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        $school = $hierarchy->get_school_parent($scho);

        $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
        $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        $mform->setType('schoolid', PARAM_RAW);
        $mform->setDefault('schoolid', $classinfo->schoolid);

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addsemesterlisthere');
        $mform->setType('addsemesterlisthere', PARAM_RAW);

        $mform->addElement('hidden', 'addclasslisthere');
        $mform->setType('addclasslisthere', PARAM_RAW);

        // adding classtype       
        $mform->addElement('header', 'settingsheader', get_string('classtype', 'local_timetable'));
        $classtypes = $DB->get_records_menu('local_class_scheduletype', array('schoolid' => $schoolid,'visible'=>1), '', 'id, classtype');
	if(sizeof($classtypes) > 0 ){
           $string_cltype = array('Select classtype', '-1' => 'All');
           $final_classtype = $string_cltype + $classtypes;
	  } 
	else  {
	  $string_cltype = array('Select classtype');   
          $final_classtype=$string_cltype + $classtypes;
	}

        if ($classid) {
            $select = $mform->addElement('select', 'classtype', get_string('classtype', 'local_timetable'), $final_classtype);
            $select->setMultiple(true);

            $mform->setType('classtype', PARAM_INT);
            $mform->addRule('classtype', get_string('required'), 'required', null, 'client');
        }


        $mform->addElement('html', '<a id="newclasstype" style="float:right;margin-right: 240px;cursor:pointer;"
			onclick="newclasstype(' . $schoolid . ')">' . get_string('classtype', 'local_timetable') . '</a>');

        $mform->addElement('html', '<div id="createclasstype"></div>');
        $mform->addElement('html', '<div id="myratings1"></div>');

        $mform->registerNoSubmitButton('scheduleclasstype');
        $mform->addElement('submit', 'scheduleclasstype', get_string('scheduleclasstype', 'local_timetable'));


        $scheduleclass = cobalt_scheduleclass::get_instance();
        $hour = $scheduleclass->hour();
        $min = $scheduleclass->min();
        $starttime = array();
        $endtime = array();
        /* Start of scheduleclass startdate */
        //providing semester startdate and enddate helpful to select date
        if ($semid) {
            $seminfo = $DB->get_record('local_semester', array('id' => $semid));
            $seminfo->startdate = date('d M Y', $seminfo->startdate);
            $seminfo->enddate = date('d M Y', $seminfo->enddate);
            $mform->addElement('static', 'datedescription', '', get_string('classschedule_datedescription', 'local_clclasses', $seminfo));
        }

        if ($classtype && $classinfo)
            $this->reapeat_schedulecontent_basedon_type($classtype, $classinfo);

        /* Bug Report #276
         * @author hemalatha c arun<*****@*****.**> 
         * Resolved- if classrom created under the online course, no need to display classroom dropdown box 
         */
//        if ($DB->record_exists('local_clclasses', array('id' => $classid, 'online' => 1))) {
//            
//        } else {
//            $classroom = $hierarchy->get_records_cobaltselect_menu('local_classroom', "schoolid=$schoid AND visible=1", null, '', 'id,fullname', '--Select--');
//            //$classroom=1;
//            $mform->addElement('select', 'classroomid', get_string('classroomids', 'local_classroomresources'), $classroom);
//            if (count($classroom) <= 1) {
//                $navigationlink = $CFG->wwwroot . '/local/classroomresources/classroom.php?linkschool=' . $schoid . '';
//                $navigationmsg = get_string('navigation_info', 'local_collegestructure');
//                $linkname = get_string('createclassroom', 'local_classroomresources');
//                $mform->addElement('static', 'classroomids_empty', '', $hierarchy->cobalt_navigation_msg($navigationmsg, $linkname, $navigationlink, 'margin-bottom: -15px;
//line-height: 0px;'));
//            }
//            $mform->addRule('classroomid', get_string('required'), 'required', null, 'client');
//        }
        /* Start of hidden fields */
        $time = time();
        $user = $USER->id;
        $mform->addElement('hidden', 'timecreated', $time);
        $mform->setType('timecreated', PARAM_INT);
        $mform->addElement('hidden', 'timemodified', $time);
        $mform->setType('timemodified', PARAM_INT);
        $mform->addElement('hidden', 'usermodified', $user);
        $mform->setType('usermodified', PARAM_INT);

        $mform->addElement('hidden', 'departmentid', $deptid);
        $mform->setType('departmentid', PARAM_INT);
        //
        $mform->addElement('hidden', 'schoid', $schoid);
        $mform->setType('schoid', PARAM_INT);
        $mform->addElement('hidden', 'deptid', $deptid);
        $mform->setType('deptid', PARAM_INT);
        //
        //   $mform->addElement('hidden', 'schoolid', $schoid);
        //  $mform->setType('schoolid', PARAM_INT);
        // $mform->addElement('hidden', 'semesterid', $semid);
        // $mform->setType('semesterid', PARAM_INT);
        //$mform->addElement('hidden', 'semid', $semid);
        //$mform->setType('semid', PARAM_INT);
        $mform->addElement('hidden', 'courseid', $courseid);
        $mform->setType('courseid', PARAM_INT);
        //$mform->addElement('hidden', 'classid', $classid);
        //$mform->setType('classid', PARAM_INT);
        /* Start of hidden id field */
        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        /* Start of action buttons */
        $actionbutton = ($id > 0) ? get_string('scheduleclassroom', 'local_clclasses') : get_string('scheduleclassroom', 'local_clclasses');
        $this->add_action_buttons($cancel = true, $actionbutton);
    }
Beispiel #17
0
function get_events() {
    global $DB, $CFG, $USER;
    $systemcontext = get_context_instance(CONTEXT_SYSTEM);
    ?>
    <?php

    if (is_siteadmin()) {
$time = time();

        $sql = 'select * from {local_event_activities} where FROM_UNIXTIME("%d-%m-%y",startdate) >= FROM_UNIXTIME("%d-%m-%y",'.$time.') OR 
              FROM_UNIXTIME("%d-%m-%y",'.$time.') <= FROM_UNIXTIME("%d-%m-%y",enddate) LIMIT 0,3';
        
        $eactivities = $DB->get_records_sql($sql);
        if (!empty($eactivities)) {
            $data = array();
			$i = 1;
            foreach ($eactivities as $eactivity) {
				if($i > 3){
					break;
				}
                $line = array();
                $eactivity->startdate = date('d-m-Y', $eactivity->startdate);
                $startdate = $eactivity->startdate;
                $eactivity->enddate > 0 ? $eactivity->enddate = date('d-m-Y', $eactivity->enddate) : $eactivity->enddate = '';
                $enddate = $eactivity->enddate;
                $view = new moodle_url('' . $CFG->wwwroot . '/local/academiccalendar/viewevent.php', array('id' => $eactivity->id));
                $line[] = html_writer::link($view, $eactivity->eventtitle);
                if ($enddate) {
                    $line[] = $startdate . '&nbsp;&nbsp;-&nbsp;&nbsp;' . $enddate;
                } else {
                    $line[] = $startdate;
                }
				$i++;
                $data[] = $line;
            }
            $table = new html_table();
            $table->head = array(
                get_string('eventtitle', 'local_academiccalendar'),
                'Date'
            );
            $table->width = '100%';
            $table->align = array('left','left');
            $table->size = array('50%','50%');
            $table->data = $data;
            $string = html_writer::table($table);
			if(sizeof($data) > 3)
				$string.='<a href="../local/academiccalendar/index.php">View more...</a>';
            return $string;
        } else {
            $string = '<p>No events created till now.</p>';
            return $string;
        } 
    } elseif (has_capability('local/collegestructure:manage', $systemcontext) && !is_siteadmin()) {
        $hier = new hierarchy();
        $time = time();
        $schoolslist = $hier->get_assignedschools();
        $array = array();
        $schools = $hier->get_school_parent($schoolslist, $array, false, false);
        foreach ($schools as $key => $value) {
		if($key!=null) {
            $schoollist[] = $key;
			}
        }
        $schoollist_string = implode(',', $schoollist);
        $sql = "select * from {local_event_activities} where eventlevel=2 and schoolid in ( $schoollist_string ) and (FROM_UNIXTIME('%d-%m-%y',startdate) >= FROM_UNIXTIME('%d-%m-%y',$time) OR 
              FROM_UNIXTIME('%d-%m-%y',$time) <= FROM_UNIXTIME('%d-%m-%y',enddate)) LIMIT 0,3";
        $eactivities = $DB->get_records_sql($sql);
        if (!empty($eactivities)) {
            $data = array();
            foreach ($eactivities as $eactivity) {
                $line = array();
                $eactivity->startdate = date('d-m-Y', $eactivity->startdate);
                $startdate = $eactivity->startdate;
                $eactivity->enddate > 0 ? $eactivity->enddate = date('d M Y', $eactivity->enddate) : $eactivity->enddate = '';
                $enddate = $eactivity->enddate;
                $view = new moodle_url('' . $CFG->wwwroot . '/local/academiccalendar/viewevent.php', array('id' => $eactivity->id));
                $line[] = html_writer::link($view, $eactivity->eventtitle);
                if ($enddate) {
                    $line[] = $startdate . '&nbsp;&nbsp;-&nbsp;&nbsp;' . $enddate;
                } else {
                    $line[] = $startdate;
                }
                $data[] = $line;
            } 
            $table = new html_table();
            $table->head = array(
                get_string('eventtitle', 'local_academiccalendar'),
                'Date'
                
            );
            $table->width = '100%';
            $table->align = array('left', 'left');
            $table->size = array('50%', '50%');
            $table->data = $data;
            $string = html_writer::table($table);
            return $string;
        } else {
            $string = '<p>No events created till now.</p>';
            return $string;
        }
    } else {
        $time = time();
        $userdetails = $DB->get_records('local_userdata', array('userid' => $USER->id));
        if ($userdetails) {
            foreach ($userdetails as $userdetail) {
                $schoollist[] = $userdetail->schoolid;
                $programlist[] = $userdetail->programid;
            }
            $schoollist_string = implode(',', $schoollist);
            $programlist_string = implode(',', $programlist);
//            $string = '<div id="event_tabs">
//		<ul>
//		<li><a href="#fragment-3"><span>Academic Events</span></a></li>
//		<li><a href="#fragment-2"><span>Global Events</span></a></li>
//		</ul>';
//
//            $string.='<div id="fragment-3">';
//            $sql = 'select * from {local_event_activities} where (FROM_UNIXTIME("%d-%m-%y",startdate) >= FROM_UNIXTIME("%d-%m-%y",'.$time.') OR 
//              FROM_UNIXTIME("%d-%m-%y",'.$time.') <= FROM_UNIXTIME("%d-%m-%y",enddate)) and 
//                                     (eventlevel=2 and schoolid in (' . $schoollist_string . ')) OR
//                                     (
//                                     eventlevel=3 and schoolid in (' . $schoollist_string . ') AND
//                                     programid in (' . $programlist_string . ')
//                                     ) LIMIT 0,3';
//
//            $eactivities1 = $DB->get_records_sql($sql);
//
//            $data = array();
//            foreach ($eactivities1 as $eactivity) {
//                $line = array();
//                $eactivity->startdate = strtoupper(date('d-M-Y', $eactivity->startdate));
//                $startdate = $eactivity->startdate;
//                $eactivity->enddate > 0 ? $eactivity->enddate = strtoupper(date('d-M-Y', $eactivity->enddate)) : $eactivity->enddate = '';
//                $enddate = $eactivity->enddate;
//                $view = new moodle_url('' . $CFG->wwwroot . '/local/academiccalendar/viewevent.php', array('id' => $eactivity->id));
//                $line[] = html_writer::link($view, $eactivity->eventtitle);
//                if ($enddate) {
//                    $line[] = $startdate . '&nbsp;&nbsp;-&nbsp;&nbsp;' . $enddate;
//                } else {
//                    $line[] = $startdate;
//                }
//                $data[] = $line;
//            }
//            $table = new html_table();
//            $table->head = array(
//                get_string('eventtitle', 'local_academiccalendar'),
//                get_string('date', 'block_classrooms')
////                                   get_string('enddate','local_academiccalendar')
//            );
//            $table->width = '100%';
//            $table->align = array('left', 'center');
//            $table->size = array('50%', '50%');
//            $table->data = $data;
//            $string.= html_writer::table($table);
//            if($data)
//                $string .= '<a href="' . $CFG->wwwroot . '/local/academiccalendar/index.php" > View All </a> ';
//            else
//                $string .= '<p>No events created.</p>';
//            $string.='</div>';
//            
//            $string.='<div id="fragment-2">';
            $sql = 'select * from {local_event_activities} where eventlevel=1 and (FROM_UNIXTIME("%d-%m-%y",startdate) >= FROM_UNIXTIME("%d-%m-%y",'.$time.') OR 
              FROM_UNIXTIME("%d-%m-%y",'.$time.') <= FROM_UNIXTIME("%d-%m-%y",enddate)) LIMIT 0,3';
            $eactivities = $DB->get_records_sql($sql);
            $data1 = array();
            foreach ($eactivities as $eactivity) {
                $line1 = array();
                $eactivity->startdate = strtoupper(date('d-M-Y', $eactivity->startdate));
                $startdate = $eactivity->startdate;
                $eactivity->enddate > 0 ? $eactivity->enddate = strtoupper(date('d-M-Y', $eactivity->enddate)) : $eactivity->enddate = '';
                $enddate = $eactivity->enddate;
                $view = new moodle_url('' . $CFG->wwwroot . '/local/academiccalendar/viewevent.php', array('id' => $eactivity->id));
                $line1[] = html_writer::link($view, $eactivity->eventtitle);
                if ($enddate) {
                    $line1[] = $startdate . '&nbsp;&nbsp;-&nbsp;&nbsp;' . $enddate;
                } else {
                    $line1[] = $startdate;
                }
//				$line1[] =  $enddate;
                $data1[] = $line1;
            }
            $table1 = new html_table();
            $table1->head = array(
                get_string('eventtitle', 'local_academiccalendar'),
                'Date'
//                                   get_string('enddate','local_academiccalendar')
            );
            $table1->width = '100%';
            $table1->align = array('left', 'center');
            $table1->size = array('50%', '50%');
            $table1->data = $data1;
            $string.= html_writer::table($table1);
            if($data1)
                $string .= '<a href="' . $CFG->wwwroot . '/local/academiccalendar/index.php" > View All </a> ';
            else
                $string .= '<p>No events created.</p>';
            //$string.='</div>';
            //$string .= '</div>';
            return $string;
        }
        else
            $string = '<p>You are not registered to any type of courses.</p>';
        return $string;
    }
    ?>
<?php } ?>
Beispiel #18
0
    public function definition() {
        global $CFG, $DB, $PAGE;

        $mform = & $this->_form;

        $schoolid = $this->_customdata['sid'];
        $PAGE->requires->yui_module('moodle-local_classroomresources-building', 'M.local_classroomresources.init_building', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_classroomresources-floor', 'M.local_classroomresources.init_floor', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_classroomresources-classroom', 'M.local_classroomresources.init_classroom', array(array('formid' => $mform->getAttribute('id'))));

        $c = 'class="one";style="border:none";readonly="readonly";';
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        $school = $hierarchy->get_school_parent($scho);
        $this->_customdata['id'];
        if ($this->_customdata['id'] > 0) {

            $mform->addElement('static', 'schoolid', get_string('schoolname', 'local_collegestructure'));
            $mform->setType('schoolid', PARAM_RAW);
            $mform->addElement('text', 'buildingid', get_string('buildingname', 'local_classroomresources'), $c);
            $mform->setType('buildingid', PARAM_RAW);
            $mform->addElement('text', 'floorid', get_string('floorname', 'local_classroomresources'), $c);
            $mform->setType('floorid', PARAM_RAW);
            $mform->addElement('text', 'classroomid', get_string('classroomid', 'local_classroomresources'), $c);
            $mform->setType('classroomid', PARAM_RAW);
            $resource = cobalt_resources::get_instance();
            $resourcelist = $hierarchy->get_records_cobaltselect_menu('local_resource', "schoolid=$schoolid AND visible=1", null, '', 'id,fullname', get_string('select', 'local_classroomresources'));
            $select = $mform->addElement('select', 'resourceid', get_string('resourceid', 'local_classroomresources'), $resourcelist);
            $select->setMultiple(true);
        } else {

            $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
            $mform->addRule('schoolid', get_string('required'), 'required', null, 'client');


            $mform->addElement('hidden', 'beforefloor');
            $mform->setType('beforefloor', PARAM_RAW);
            $mform->addElement('hidden', 'beforeclass');
            $mform->setType('beforeclass', PARAM_RAW);
            $mform->addElement('hidden', 'beforeresource');
            $mform->setType('beforeresource', PARAM_RAW);
            $mform->addElement('hidden', 'beforer');
            $mform->setType('beforer', PARAM_RAW);
            $mform->registerNoSubmitButton('updatecourseformat');
            $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        }

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $submit = ($this->_customdata['id'] > 0) ? 'Update' : 'Assign Resources';
        $this->add_action_buttons('false', $submit);
    }
Beispiel #19
0
echo $OUTPUT->box(get_string('assigndesc', 'local_modules'));
echo '<hr>';
$displaylist = array();
$notused = array();
$hier = new hierarchy();
$displaylist = $hier->get_records_cobaltselect_menu('local_program', 'visible=1', null, '', 'id,fullname', '--Select--');
$displaylist = array();
$notused = array();
$hier = new hierarchy();

$schools = $hier->get_assignedschools();
if (is_siteadmin()) {
    $schools = $hier->get_school_items();
}

$school = $hier->get_school_parent($schools);
// print_object($school);
?>
<style>
    .categorypicker1{padding-bottom:11px;margin-left:35px;}
    .dataTables_length{float:none;padding-top:20px;}
    .pagination { margin: 10px 50px;}
</style>
<?php

if (count($schools) != 1) {
    echo '<div class="selfilterpos" >';
    /* Bug report #275  
     * @author hemalatha a arun<*****@*****.**>
     * resolved - restrict to display only shared school
     */
Beispiel #20
0
//Header and the navigation bar
$PAGE->set_heading($SITE->fullname);
$PAGE->navbar->add(get_string('pluginheading', 'local_gradeletter'));
$PAGE->navbar->add(get_string('view', 'local_gradeletter'));
$PAGE->set_title(get_string('pluginheading', 'local_gradeletter') . ': ' . get_string('view', 'local_gradeletter'));

echo $OUTPUT->header();

//Heading of the page
echo $OUTPUT->heading(get_string('pluginheading', 'local_gradeletter'));


$hierarchy = new hierarchy();
$schoollist = $hierarchy->get_assignedschools();
$schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = false, $all = false);
if (is_siteadmin()) {
    $schoollist = $hierarchy->get_school_items();
}

$gletters->createtabview_gl($currenttab);
// Moodle 2.2 and onwards
if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('allowframembedding', 'local_gradeletter'));
}

$schoolidin = implode(',', array_keys($schoollist));
$sql = "SELECT * FROM {$CFG->prefix}local_gradeletters WHERE schoolid IN ($schoolidin)";
$grade_letters = $DB->get_records_sql($sql);

$data = array();
Beispiel #21
0
    public function definition() {
        global $CFG, $DB, $PAGE, $USER;
        $mform = & $this->_form;
        /*  Bug report #304 -Edit Class>Short Name- Error
         * @author hemalatha c arun <*****@*****.**>
         * Resolved- added valid condition avoiding duplication of shortname and also updated strings
         */
        $id = $this->_customdata['id'];
        $PAGE->requires->yui_module('moodle-local_clclasses-chooser', 'M.local_clclasses.init_chooser', array(array('formid' => $mform->getAttribute('id'))));
        $hierarchy = new hierarchy();
        if (is_siteadmin()) {
            $scho = $hierarchy->get_school_items();
        } else {
            $scho = $hierarchy->get_assignedschools();
        }
        $count = count($scho);
        $school = $hierarchy->get_school_parent($scho);

        $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
        $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        $mform->setType('schoolid', PARAM_RAW);

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addsemesterlisthere');
        $mform->setType('addsemesterlisthere', PARAM_RAW);

        $mform->addElement('hidden', 'adddepartmentlisthere');
        $mform->setType('adddepartmentlisthere', PARAM_RAW);
        $style = "style='height:25px !important;'";
        $mform->addElement('hidden', 'adddepartmentemptymsg');
        $mform->setType('adddepartmentemptymsg', PARAM_RAW);

        $mform->addElement('hidden', 'addcobaltcoursehere');
        $mform->setType('addcobaltcoursehere', PARAM_RAW);


        $mform->addElement('text', 'fullname', get_string('classesname', 'local_clclasses'), $style);
        $mform->addHelpButton('fullname', 'classesname', 'local_clclasses');
        $mform->addRule('fullname', get_string('missingclassesname', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);

        $mform->addElement('text', 'shortname', get_string('classesshortname', 'local_clclasses'), $style);
        $mform->addHelpButton('shortname', 'classesshortname', 'local_clclasses');
        $mform->addRule('shortname', get_string('missingclassesshort', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('shortname', PARAM_RAW);



        $mform->addElement('text', 'classlimit', get_string('classlimit', 'local_clclasses'), $style);
        $mform->addHelpButton('classlimit', 'classlimit', 'local_clclasses');
        $mform->addRule('classlimit', get_string('missinglimit', 'local_clclasses'), 'required', null, 'client');
        $mform->addRule('classlimit', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->setType('classlimit', PARAM_RAW);

        $selecttype = array();
        $selecttype['1'] = get_string('clsmode_1', 'local_clclasses');
        $selecttype['2'] = get_string('clsmode_2', 'local_clclasses');
        $mform->addElement('select', 'type', get_string('classmode', 'local_clclasses'), $selecttype);
        $mform->addHelpButton('type', 'classmode', 'local_clclasses');
        $mform->addRule('type', get_string('missingtype', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('type', PARAM_INT);



        $mform->addElement('hidden', 'addonlinelisthere');
        $mform->setType('addonlinelisthere', PARAM_RAW);

        $mform->addElement('hidden', 'addonlinecoursehere');
        $mform->setType('addonlinecoursehere', PARAM_RAW);


        $mform->addElement('hidden', 'addinstructorhere');
        $mform->setType('addinstructorhere', PARAM_RAW);


        $mform->addElement('editor', 'description', get_string('description', 'local_clclasses'), null);
        $mform->setType('description', PARAM_RAW);

        /* $style="style='height:25px !important;'";
          $mform->addElement('text', 'fullname', get_string('classesname', 'local_clclasses'),$style);
          $mform->addHelpButton('fullname', 'classesname', 'local_clclasses');
          $mform->addRule('fullname', get_string('missingclassesname','local_clclasses'), 'required', null, 'client');
          $mform->setType('fullname', PARAM_RAW);

          $mform->addElement('text', 'shortname', get_string('classesshortname', 'local_clclasses'),$style);
          $mform->addHelpButton('shortname', 'classesshortname', 'local_clclasses');
          $mform->addRule('shortname', get_string('missingclassesshort','local_clclasses'), 'required', null, 'client');
          $mform->setType('shortname', PARAM_RAW);

          $mform->addElement('editor', 'description', get_string('description', 'local_clclasses'), null, $editoroptions);
          $mform->setType('description', PARAM_RAW);

          $mform->addElement('text', 'classlimit',get_string('classlimit','local_clclasses'),$style);
          $mform->addHelpButton('classlimit', 'classlimit', 'local_clclasses');
          $mform->addRule('classlimit', get_string('missinglimit','local_clclasses'), 'required', null, 'client');
          $mform->addRule('classlimit', get_string('numeric','local_admission'), 'numeric', null,'client');
          $mform->setType('classlimit', PARAM_RAW);

          $selecttype=array();
          $selecttype['1']=get_string('clsmode_1','local_clclasses');
          $selecttype['2']=get_string('clsmode_2','local_clclasses');
          $mform->addElement('select', 'type',get_string('classmode','local_clclasses'),$selecttype);
          $mform->addHelpButton('type', 'classmode', 'local_clclasses');
          $mform->addRule('type', get_string('missingtype','local_clclasses'), 'required', null, 'client');
          $mform->setType('type', PARAM_INT); */

        $mform->addElement('html', '<div id="myratings1"></div>');
        $mform->addElement('html', '<div id="myratings2"></div>');
        $submit = get_string('createclasses', 'local_clclasses');

        $time = time();
        $userid = $USER->id;
        $mform->addElement('hidden', 'timecreated', $time);
        $mform->setType('timecreated', PARAM_INT);

        $mform->addElement('hidden', 'timemodified', $time);
        $mform->setType('timemodified', PARAM_INT);

        $mform->addElement('hidden', 'usermodified', $userid);
        $mform->setType('usermodified', PARAM_INT);


        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $actionbutton = ($id > 0) ? get_string('updateclass', 'local_clclasses') : get_string('createclasses', 'local_clclasses');


        $this->add_action_buttons($cancel = true, $actionbutton);
    }
Beispiel #22
0
            else
                $conform_msg = get_string('sassign_mentor_singular', 'local_assignmentor', $temp_lang);
            $options = array('style' => 'notifysuccess');
        }
        else {
            $conform_msg = get_string('eassign_mentor', 'local_assignmentor', $temp_lang);
            $options = array('style' => 'notifyproblem');
        }
        $hier->set_confirmation($conform_msg, $currenturl, $options);
    }
}

try {
    /* ----school filter----- */
    $schoolids = $assignee_ob->check_loginuser_registrar_admin();
    $schoollist = $hier->get_school_parent($schoolids, '', true);
    $school_select = new single_select(new moodle_url('/local/assignmentor/assign_mentor.php'), 'sid', $schoollist, $sid, null, null);
    $school_select->set_label(get_string('select', 'local_collegestructure'));
    echo '<div>' . $OUTPUT->render($school_select) . '</div>';
    $programlist = $hier->get_records_cobaltselect_menu('local_program', "schoolid=$sid AND visible=1", null, '', 'id,fullname', '--Select--');
    $prg_select = new single_select(new moodle_url('/local/assignmentor/assign_mentor.php', array('sid' => $sid)), 'pid', $programlist, $programid, null);
    $prg_select->set_label(get_string('selectprogram', 'local_programs'));

    echo '<div style="margin-top:10px;">' . $OUTPUT->render($prg_select) . '</div>';
    echo '<br/><br/>';
    $currentyear = date("Y", time());
    /* ----fetching students of perticular program and students---- */
    $sql1 = "SELECT u.id,u.firstname,u.lastname,u.email ,from_unixtime(ud.timecreated,'%Y') as year From {$CFG->prefix}local_userdata AS ud
                   INNER JOIN {$CFG->prefix}user AS u
		   ON u.id=ud.userid
		   where ud.schoolid=$sid and  ud.programid=$programid and from_unixtime(ud.timecreated,'%Y')=$currentyear";
Beispiel #23
0
 function get_usercount($extraselect = '', array $extraparams = null)
 {
     global $DB, $CFG, $SESSION;
     $select = " u.id <> :guestid AND u.deleted = 0";
     $params = array('guestid' => $CFG->siteguest);
     if ($extraselect) {
         $select .= " AND {$extraselect}";
         $params = $params + (array) $extraparams;
     }
     if (isset($SESSION->user_filtering['courseid'])) {
         $sql = "SELECT u.* FROM {user_enrolments} ue\n\t\t\t\t\t\t\t\t\t\tJOIN {enrol} e ON e.id = ue.enrolid\n\t\t\t\t\t\t\t\t\t\tJOIN {user} u ON u.id = ue.userid\n\t\t\t\t\t\t\t\t\t\tJOIN {course} c ON c.id = e.courseid\n\t\t\t\t\t\t\t\t\t\tWHERE c.visible = 1 AND ue.status = 0 AND {$select}";
         $users = $DB->get_records_sql($sql, $params);
     } else {
         $users = $DB->get_records_sql("SELECT u.*, lu.rosterid\n\t\t\t\t\t\t\t   FROM {user} u\n\t\t\t\t\t\t\t   JOIN {local_users} lu ON lu.userid = u.id\n\t\t\t\t\t\t\t   WHERE {$select}", $params);
     }
     $records = array();
     if (!empty($users)) {
         $useridin = implode(',', array_keys($users));
         $hierarchy = new hierarchy();
         $schoollist = $hierarchy->get_assignedschools();
         $schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = false, $all = false);
         if (is_siteadmin()) {
             $schoollist = $hierarchy->get_school_items();
         }
         if (!empty($schoollist)) {
             $schoolidin = implode(',', array_keys($schoollist));
             $records = $DB->get_records_sql("(SELECT u.* FROM {user} u\n                                         JOIN {local_users} lu ON lu.userid = u.id\n                                         JOIN {local_school_permissions} sp ON sp.userid = u.id\n\n                                         WHERE u.id in ({$useridin}) AND sp.schoolid IN ({$schoolidin}))\n                                         UNION\n                                         (SELECT u.* FROM {user} u\n                                         JOIN {local_users} lu ON lu.userid = u.id\n                                         JOIN {local_userdata} ud ON ud.userid = u.id\n                                        WHERE u.id in ({$useridin}) AND ud.schoolid IN ({$schoolidin}))");
         }
     }
     return sizeof($records);
 }
Beispiel #24
0
    public function definition() {
        global $USER, $CFG, $DB, $PAGE;

        $mform = $this->_form;
        $PAGE->requires->yui_module('moodle-local_clclasses-schoolchooser', 'M.local_clclasses.init_schoolchooser', array(array('formid' => $mform->getAttribute('id'))));
        $editoroptions = $this->_customdata['editoroptions'];
        $id = $this->_customdata['id'];
        if ($id > 0)
            $mform->addElement('header', 'settingsheader', get_string('editclasses', 'local_clclasses'));
        else
            $mform->addElement('header', 'settingsheader', get_string('createclasses', 'local_clclasses'));

        $tools = array();
        $enddate = date("d/m/Y");
        $startdate = date("d/m/Y");

        $hierarchy = new hierarchy();
        $items = $hierarchy->get_school_items();
        $parents = $hierarchy->get_school_parent($items);
        $mform->addElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $parents);
        $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        $mform->setType('schoolid', PARAM_RAW);

        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addsemesterlisthere');
        $mform->setType('addsemesterlisthere', PARAM_RAW);

        $mform->addElement('hidden', 'adddepartmentlisthere');
        $mform->setType('adddepartmentlisthere', PARAM_RAW);
        $mform->registerNoSubmitButton('updatedepartment');
        $mform->addElement('submit', 'updatedepartment', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addcobaltcoursehere');
        $mform->setType('addcobaltcoursehere', PARAM_RAW);

        $mform->addElement('text', 'fullname', get_string('classesname', 'local_clclasses'), $tools);
        $mform->addHelpButton('fullname', 'classesname', 'local_clclasses');
        $mform->addRule('fullname', get_string('missingclassesname', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('fullname', PARAM_RAW);

        $mform->addElement('text', 'shortname', get_string('classesshortname', 'local_clclasses'), $tools);
        $mform->addHelpButton('shortname', 'classesshortname', 'local_clclasses');
        $mform->addRule('shortname', get_string('missingclassesshort', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('shortname', PARAM_RAW);
        $mform->addElement('editor', 'description', get_string('description', 'local_clclasses'), null, $editoroptions);
        $mform->setType('description', PARAM_RAW);

        $now = date("d-m-Y");
        $now = strtotime($now);
        $mform->addElement('text', 'classlimit', get_string('classlimit', 'local_clclasses'));
        $mform->addHelpButton('classlimit', 'classlimit', 'local_clclasses');
        $mform->addRule('classlimit', get_string('missinglimit', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('classlimit', PARAM_RAW);
        $selecttype = array();
        $selecttype['1'] = get_string('clsmode_1', 'local_clclasses');
        $selecttype['2'] = get_string('clsmode_2', 'local_clclasses');

        $mform->addElement('select', 'type', get_string('classmode', 'local_clclasses'), $selecttype);
        $mform->addHelpButton('type', 'classmode', 'local_clclasses');
        $mform->addRule('type', get_string('missingtype', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('type', PARAM_INT);

        $selectonline = array();
        $selectonline[''] = get_string('select', 'local_clclasses');
        $selectonline['1'] = get_string('online', 'local_clclasses');
        $selectonline['2'] = get_string('offline', 'local_clclasses');
        $mform->addElement('select', 'online', get_string('classtype', 'local_clclasses'), $selectonline);
        $mform->addHelpButton('online', 'classtype', 'local_clclasses');
        $mform->addRule('online', get_string('missingonline', 'local_clclasses'), 'required', null, 'client');
        $mform->setType('online', PARAM_INT);

        $mform->registerNoSubmitButton('updatecourseid');
        $mform->addElement('submit', 'updatecourseid', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addonlinecoursehere');
        $mform->setType('addonlinecoursehere', PARAM_RAW);
        $mform->addElement('html', '<a name="Iheader"> </a>');
        /* ---assing instructor heading task--- */
        $mform->addElement('header', 'settingsheader', get_string('assigninstructor', 'local_clclasses'));

        $mform->addElement('hidden', 'adddepartmentinhere');
        $mform->setType('adddepartmentinhere', PARAM_RAW);
        $mform->registerNoSubmitButton('updateinstructor');
        $mform->addElement('submit', 'updateinstructor', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'addinstructorhere');
        $mform->setType('addinstructorhere', PARAM_RAW);
        /* ---Area for Scheduling the classes--- */

        $mform->addElement('header', 'settingsheader', get_string('scheduleclassroom', 'local_clclasses'));

        $scheduleclass = cobalt_scheduleclass::get_instance();
        $hour = $scheduleclass->hour();
        $min = $scheduleclass->min();
        $starttime = array();
        $endtime = array();
        $mform->addElement('html', '<a name="zheader"> </a>');
        $mform->addElement('date_selector', 'startdate', get_string('from', 'local_clclasses'), array('optional' => true));
        $mform->addHelpButton('startdate', 'from', 'local_clclasses');
        $mform->setDefault('startdate', time() + 3600 * 24);
        $mform->addElement('date_selector', 'enddate', get_string('to', 'local_clclasses'), array('optional' => true));
        $mform->addHelpButton('enddate', 'to', 'local_clclasses');
        $mform->setDefault('enddate', time() + 3600 * 24);
        $starttime[] = &$mform->createElement('select', 'starthour', get_string('starthour', 'local_classroomresources'), $hour);
        $starttime[] = &$mform->createElement('select', 'startmin', get_string('startmin', 'local_classroomresources'), $min);
        $mform->addGroup($starttime, 'starttime', 'Start Time', array(' '), false);
        $endtime[] = &$mform->createElement('select', 'endhour', get_string('endhour', 'local_classroomresources'), $hour);
        $endtime[] = &$mform->createElement('select', 'endmin', get_string('endmin', 'local_classroomresources'), $min);
        $mform->addGroup($endtime, 'endtime', 'End Time', array(' '), false);



        /* ---End of schedule classes--- */

        $mform->addElement('advcheckbox', 'choose', get_string('getfreeclass', 'local_clclasses'));
        $mform->addHelpButton('choose', 'getfreeclass', 'local_clclasses');
        $mform->setDefault('choose', 0);
        $mform->addHelpButton('startdate', 'from', 'local_clclasses');
        $mform->addElement('hidden', 'beforeclassroom');
        $mform->setType('beforeclassroom', PARAM_RAW);
        $mform->registerNoSubmitButton('updateclassrooms');
        $mform->addElement('submit', 'updateclassrooms', get_string('courseformatudpate'));

        $mform->addElement('hidden', 'timecreated', $now);
        $mform->setType('timecreated', PARAM_RAW);
        $mform->addElement('hidden', 'usermodified', $USER->id);
        $mform->setType('usermodified', PARAM_RAW);

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $actionbutton = ($id > 0) ? get_string('updateclass', 'local_clclasses') : get_string('createclasses', 'local_clclasses');


        $this->add_action_buttons($cancel = true, $actionbutton);
    }
Beispiel #25
0
    /**
     * @method settingelements
     * @todo to set form elements
     * @param object $mform object
     * @param string $place1
     * @param string $place2 
     * @return array of objects ($mfrom objects)
     * */
    public function settingelements($mform, $place1, $place2) {
        global $hierarchy;
        $hierarchy = new hierarchy();
        $faculties = $hierarchy->get_assignedschools();
        $school = $hierarchy->get_school_parent($faculties);
        $newel = $mform->createElement('select', 'schoolid', get_string('schoolid', 'local_collegestructure'), $school);
        $mform->insertElementBefore($newel, $place1);
        $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        $school_value = $mform->getElementValue('schoolid');

        //Creating program element after getting the school value
        if (isset($school_value) && !empty($school_value)) {
            $school_id = $school_value[0];
            $programs = $hierarchy->get_records_cobaltselect_menu('local_program', "schoolid=$school_id AND visible=1", null, '', 'id,fullname', '--Select--');
            $newel2 = $mform->createElement('select', 'programid', get_string('selectprogram', 'local_programs'), $programs);
            $mform->insertElementBefore($newel2, $place2);
            $mform->addRule('programid', get_string('missingfullname', 'local_programs'), 'required', null, 'client');
            $program_value = $mform->getElementValue('programid');
            return $program_value;
        }
    }
Beispiel #26
0
$admission = cobalt_admission::get_instance();
$hierarchy = new hierarchy();
$currenttab = 'viewapplicant';

$level = $admission->pgm;

if (is_siteadmin()) {
    $scho = $hierarchy->get_school_items();
} else {
    $scho = $hierarchy->get_assignedschools();
}
$admission->report_tabs($currenttab);
if (isset($CFG->allowframembedding) and !$CFG->allowframembedding) {
    echo $OUTPUT->box(get_string('viewapplicantsdes', 'local_collegestructure'));
}
$school = $hierarchy->get_school_parent($scho);

echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php'), 'ptype', $level, $ptype, null);
$select->set_label(get_string('programlevel', 'local_programs'));
echo $OUTPUT->render($select);
echo '</div>';

echo '<div class="selfilterposition">';
$select = new single_select(new moodle_url('/local/admission/viewapplicant.php?ptype=' . $ptype . ''), 'school', $school, $schoolid, null);
$select->set_label(get_string('schoolid', 'local_collegestructure'));
echo $OUTPUT->render($select);
echo '</div>';
if ($schoolid == 0) {
    if (is_siteadmin()) {
        $program = $hierarchy->get_records_cobaltselect_menu('local_program', 'visible=1', null, '', 'id,fullname', '--Select--');
Beispiel #27
0
    /**
     * @method get_users_listing
     * @todo to get user list of school based on condition  
     * @param string $sort fieldname
     * @param string $dir specify the order to sort
     * @param int $page page number
     * @param int $recordsperpage records perpage
     * @param string $extraselect extra condition to select user
     * @param array $extraparams
     * @return array of objects , list of users
     */
    function get_users_listing($sort = 'lastaccess', $dir = 'ASC', $page = 0, $recordsperpage = 0, $extraselect = '', array $extraparams = null, $extracontext = null) {
        global $DB, $CFG;
        $extraselect;

        $select = "deleted <> 1 AND id <> :guestid";  //$select = "deleted=0";
        $params = array('guestid' => $CFG->siteguest);

        if ($extraselect) {
            $select .= " AND $extraselect";
            $params = $params + (array) $extraparams;
        }

        // If a context is specified, get extra user fields that the current user
        // is supposed to see.
        $extrafields = '';
        if ($extracontext) {
            $extrafields = get_extra_user_fields_sql($extracontext, '', '', array('id', 'username', 'email', 'firstname', 'lastname', 'city', 'country',
                'lastaccess', 'confirmed', 'mnethostid'));
        }
        /*
         * ###Bugreport#183-Filters
         * @author Naveen Kumar<*****@*****.**>
         * (Resolved) Added $select parameters for conditions 
         */
        // warning: will return UNCONFIRMED USERS
        //  print_object($params);
        $users = $DB->get_records_sql("SELECT *
                                       FROM {user}
                                       WHERE $select", $params);

        $hierarchy = new hierarchy();
        $schoollist = $hierarchy->get_assignedschools();
        $schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = false, $all = false);
        if (is_siteadmin()) {
            $schoollist = $hierarchy->get_school_items();
        }
        $schoolidin = implode(',', array_keys($schoollist));
        if ($users && $schoollist) {
            $useridin = implode(',', array_keys($users));
            return $DB->get_records_sql("select user.* from (SELECT u.id, u.username, u.email, u.firstname, u.lastname, u.city, u.country,
                                            u.lastaccess, u.confirmed, u.mnethostid, u.suspended FROM {user} u
                                        JOIN {local_users} lu ON lu.userid = u.id
                                        JOIN {local_school_permissions} sp ON sp.userid = u.id
                                        WHERE u.id in ($useridin) AND sp.schoolid IN ($schoolidin)
                                        UNION
                                        SELECT u.id, u.username, u.email, u.firstname, u.lastname, u.city, u.country,
                                            u.lastaccess, u.confirmed, u.mnethostid, u.suspended FROM {user} u
                                        JOIN {local_users} lu ON lu.userid = u.id
                                        JOIN {local_userdata} ud ON ud.userid = u.id
                                        WHERE u.id in ($useridin) AND ud.schoolid IN ($schoolidin)) user GROUP BY user.id ORDER BY user.$sort $dir LIMIT $page, $recordsperpage ");
        }
    }
Beispiel #28
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        $hierarchy = new hierarchy();
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $mform->addElement('header', 'settingsheader', get_string('accountingperiod', 'local_onlinepayment'));
        $schoollist = $hierarchy->get_assignedschools();
        if (is_siteadmin()) {
            $schoollist = $hierarchy->get_school_items();
        }
        $schoollist = $hierarchy->get_school_parent($schoollist, $selected = array(), $inctop = true, $all = false);
        if ($id < 0) {
            $mform->addElement('select', 'schoolid', get_string('select', 'local_collegestructure'), $schoollist);
            $mform->setType('schoolid', PARAM_INT);
            $mform->addRule('schoolid', get_string('missingschool', 'local_collegestructure'), 'required', null, 'client');
        } else {
            $mform->addElement('static', 'school_name', get_string('schoolname', 'local_collegestructure'));
            $mform->addElement('hidden', 'schoolid');
            $mform->setType('schoolid', PARAM_INT);
        }
        $mform->addElement('date_selector', 'datefrom', get_string('startdate', 'local_academiccalendar'), array('optional' => true));
        $mform->addElement('date_selector', 'dateto', get_string('enddate', 'local_academiccalendar'), array('optional' => true));
        $mform->addRule('datefrom', get_string('missingstartdate', 'local_academiccalendar'), 'required', null, 'client');
        $mform->addRule('dateto', get_string('missingenddate', 'local_academiccalendar'), 'required', null, 'client');

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);

        $buttonarray = array();
        $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('submit'));
        $buttonarray[] = &$mform->createElement('cancel');
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
    }
Beispiel #29
0
    echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $baseurl);
    echo html_writer::table($table);
    echo $OUTPUT->paging_bar($totalcount, $page, $perpage, $baseurl);
    echo '<br/>';
//Description to assign courses.
    $descripion = $id ? get_string('descforassign', 'local_curriculum', $plan) : get_string('descforassign', 'local_curriculum', $cur);
    echo $OUTPUT->box($descripion);

    $tool = new stdClass();
    $tool->type = $_GET['type'];
    $tool->pid = $programid;
    $tool->did = $departmentid;
    $tool->moduleid = $moduleid;
    $PAGE->requires->js('/local/curriculum/js/filter.js');
//List of Modules.
    $school = $hierarchy->get_school_parent($schoollist, array(), false, false);
    $school = array_keys($school);
    $checked1 = '';
    $display1 = 'display:none;';
    $checked2 = '';
    $display2 = 'display:none;';
    if ($departmentid) {
        $checked2 = 'checked="checked"';
        $display2 = 'display:block;';
    } else if ($programid || $moduleid) {
        $checked1 = 'checked="checked"';
        $display1 = 'display:block;';
    }

    echo '<br/>';
    echo '<form id="frm1" action="assigncourses.php" method="get">';
Beispiel #30
0
            $sid = $fa->assigned_schoolid;
        $schoolname = $DB->get_record('local_school', array('id' => $sid));
        $cells[1]->text = $schoolname->fullname;
        //----used fetech id of (assigned_school_dept)
        $assigned_id = isset($fa->deptid) ? $fa->id : 0;
        if (empty($assigned_id))
            $cells[2]->text = html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'alt' => get_string('dept_unassign', 'local_departments'), 'title' => get_string('unassign_msg', 'local_departments'), 'class' => 'iconsmall'));
        else
            $cells[2]->text = html_writer::link(new moodle_url('/local/departments/assign_school.php', array('id' => $assigned_id, 'sid' => $schoolname->id, 'deptid' => $departmentid, 'unassign' => 1, 'sesskey' => sesskey(), 'page' => $page, 'perpage' => $perpage)), html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'alt' => get_string('unassign', 'local_departments'), 'title' => get_string('dept_unassign', 'local_departments'), 'class' => 'iconsmall')));

        if (isset($fa->fullname)) {
            $departmentid = $fa->id;
            //-- used to remove default school from single select drop down  list--    
            $tempsidlist = $dept_ob->remove_defaultschool($schoolid, $departmentid);

            $schoollist = $hier1->get_school_parent($tempsidlist);
            $select = new single_select(new moodle_url('/local/departments/assign_school.php', array('deptid' => $departmentid, 'assign' => 1, 'sesskey' => sesskey(), 'page' => $page, 'perpage' => $perpage)), 'sid', $schoollist, 'assign', null, null);
            // $OUTPUT->render($select);
            $cells[3] = new html_table_cell();
            $cells[3]->text = $OUTPUT->render($select);
            $cells[3]->rowspan = $count;
            $cells[3]->style = 'vertical-align:middle;';
        }
        $row = new html_table_row($cells);
        $table->data[] = $row;
    }
    $table->size = array('15%', '15%', '15%', '15%');
    $table->align = array('left', 'left', 'left', 'center');
    $table->width = '99%';
    echo html_writer::table($table);