Exemplo n.º 1
0
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->dirroot . '/local/scheduleexam/lib.php');
require_once($CFG->dirroot . '/local/scheduleexam/edit_form.php');
require_once('../../course/lib.php');
require_once($CFG->dirroot . '/local/lib.php');

$systemcontext =context_system::instance();
if (!has_capability('local/scheduleexam:manage', $systemcontext)) {
    print_error('You dont have permissions');
}

$hierarchy = new hierarchy();
global $exams;
$exams = new schedule_exam();

$id = optional_param('id', -1, PARAM_INT);    // user id; -1 if creating new tool
$delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$visible = optional_param('visible', -1, PARAM_INT);
$currenttab = optional_param('mode', 'create', PARAM_RAW);

if ($id > 0) {
    if (!($tool = $DB->get_record('local_scheduledexams', array('id' => $id)))) {
        print_error('invalidtoolid', 'local_scheduleexam');
    }
    $tool->opendate = date("m/d/Y", $tool->opendate);
} else {
    $tool = new stdClass();
    $tool->id = -1;
Exemplo n.º 2
0
    function definition_after_data() {
        global $CFG,$DB, $PAGE, $USER, $hierarchy, $exams, $selected_class;
        $hierarchy = new hierarchy();
        $exams = new schedule_exam();
        $linkmsg=get_string('navigation_info','local_collegestructure');
        $linkstyle='line-height: 0px;margin-bottom: -10px;';
        $mform = $this->_form;


        $id = $this->_customdata['id'];
        $selected_school = $mform->getElementValue('schoolid');
        //$selected_program = array();
        $disable = ($id > 0) ? 'disabled="disabled"' : '';

        // for programs and semesters in a school
        if ($selected_school[0] > 0) {

//            $programs_list = array();
//            $programs_list = $hierarchy->get_school_programs($selected_school[0]);
//            
//            $programs_listdrop = $mform->createElement('select', 'programid', get_string('programslist', 'local_scheduleexam'), $programs_list, $disable);
//            $mform->insertElementBefore($programs_listdrop, 'addprogramslisthere');
//            if($id < 0){
//                 $mform->addRule('programid', get_string('programreq', 'local_scheduleexam'), 'required', null, 'client');
//             }
//            $selected_program = $mform->getElementValue('programid');

            $semesters_list = array();
            $semesters_list = $exams->get_semesterslists_scheduleexam($selected_school[0]);

            $semesters_listdrop = $mform->createElement('select', 'semesterid', get_string('semester', 'local_semesters'), $semesters_list, $disable);
            $mform->insertElementBefore($semesters_listdrop, 'addsemesterslisthere');
            if ($id < 0) {
                $mform->addRule('semesterid', get_string('missingsemester', 'local_semesters'), 'required', null, 'client');
            }

            $selected_semester = array();
            $selected_semester = $mform->getElementValue('semesterid');
        }

        // for examtypes in a school
        if (($selected_school[0])) {

            $examtype = array();        
            $examtype = $hierarchy->get_records_cobaltselect_menu('local_examtypes', "schoolid = $selected_school[0] AND visible=1", null, '', 'id,examtype', 'Select Assessment Type');
            $examtypelist_listdrop = $mform->createElement('select', 'examtype', get_string('examtype', 'local_examtype'), $examtype, $disable);
            $mform->insertElementBefore($examtypelist_listdrop, 'addexamtypehere');
           if(count($examtype)<=1){ 
              $linkname=get_string('addeditexamtype','local_examtype');
              $examtypelist_empty=$mform->createElement('static', 'examtype_emptyinfo', '',$hierarchy->cobalt_navigation_msg($linkmsg,$linkname,$CFG->wwwroot.'/local/examtype/edit.php',$linkstyle));  
              $mform->insertElementBefore($examtypelist_empty, 'addexamtypeempty_msg');  
           }
            
            if ($id < 0) {
                $mform->addRule('examtype', get_string('examtypereq', 'local_scheduleexam'), 'required', null, 'client');
            }
        }

        // for clclasses assigned to a semester
        if (($selected_school[0]) AND ( $selected_semester[0] > 0)) {

            $clclasses_list = array();           
            $clclasses_list = $hierarchy->get_records_cobaltselect_menu('local_clclasses', "semesterid=$selected_semester[0] and schoolid=$selected_school[0] and visible=1", null, '', 'id,fullname', 'Select Class');
            $clclasses_listdrop = $mform->createElement('select', 'classid', get_string('class', 'local_clclasses'), $clclasses_list, $disable);
            $mform->insertElementBefore($clclasses_listdrop, 'addclclasseslisthere');
            if ($id < 0)
                $mform->addRule('classid', get_string('clclassesreq', 'local_clclasses'), 'required', null, 'client');

            $selected_class = array();
            $selected_class = $mform->getElementValue('classid');
        }

        // for lecturetypes in a school
        if ($selected_school[0]) {
            
            $lecturetype = array();
           // $lecturetype = $exams->get_lecturetype_scheduleexam($selected_school[0]);
            $lecturetype = $hierarchy->get_records_cobaltselect_menu('local_lecturetype', "schoolid=$selected_school[0] ", null, '', 'id,lecturetype', 'Select Mode of Assessment'); 
            $lecturetype_listdrop = $mform->createElement('select', 'lecturetype', get_string('lecturetype', 'local_scheduleexam'), $lecturetype, $disable);

            $mform->insertElementBefore($lecturetype_listdrop, 'addlecturetypehere');
            if(count($lecturetype)<=1){
             $linkname=get_string('create','local_lecturetype');     
             $lecturetypelist_empty=$mform->createElement('static', 'lecturetype_emptyinfo', '',$hierarchy->cobalt_navigation_msg( $linkmsg, $linkname,$CFG->wwwroot.'/local/lecturetype/edit.php',$linkstyle));  
             $mform->insertElementBefore($lecturetypelist_empty, 'addlecturetypeempty_msg');  
            }
            if ($id < 0) {
                $mform->addRule('lecturetype', get_string('lecturetypereq', 'local_scheduleexam'), 'required', null, 'client');
            }
        }

        if ($selected_class[0]) {
            //$cobaltcourse = array();
            $cobcourse = $exams->get_cobaltcourse_scheduleexam($selected_class[0]);

            $cobaltcourse = $mform->createElement('static', 'cobcourse', get_string('coursename', 'local_cobaltcourses'), $cobcourse);

            $mform->insertElementBefore($cobaltcourse, 'addcobaltcourseehere');
        }
    }
Exemplo n.º 3
0
/**
 * List the tool provided in a course
 *
 * @package    local
 * @subpackage courseregistration
 * @copyright  2014 Vinodkumar aleti <*****@*****.**>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->dirroot . '/local/lib.php');
require_once($CFG->dirroot . '/local/courseregistration/lib.php');
require_once($CFG->dirroot . '/local/scheduleexam/lib.php');
require_once($CFG->dirroot . '/local/users/lib.php');
global $CFG, $USER, $DB;
$exams = new schedule_exam();
$systemcontext = context_system::instance();
$cid = optional_param('id', 0, PARAM_INT);
$semid = optional_param('semid', 0, PARAM_INT);
$page = optional_param('page', 0, PARAM_INT);
/* ---get the admin layout--- */
$PAGE->set_pagelayout('admin');
$currentcss = '/local/collegestructure/css/styles.css';
$currentcss = '/local/courseregistration/css/styles.css';
$PAGE->requires->css($currentcss);
$PAGE->requires->js('/local/courseregistration/js/expand.js');
/* ---check the context level of the user and check weather the user is login to the system or not--- */
$PAGE->set_context($systemcontext);
if ($CFG->forcelogin) {
    require_login();
} else {
Exemplo n.º 4
0
            echo '<h4> No changes occured in Excel sheet.</h4>';
    }
    if ($examserrors) {
        echo '<h4> Please fill the sheet without any errors. Refer Help Manual for assistance.</h4>';
    }
    if ($examsskipped) {
        echo $OUTPUT->box_start('generalbox');
        if ($examsskipped == 1)
            echo '<h4> Exam skipped because record with that name is  already exists.</h4>';
        else
            echo '<h4>' . $examsskipped . ' Exams skipped because records with those names are already exist.</h4>';
        echo $OUTPUT->box_end();
    }
    echo '<div style="margin-left:35%;"><a href="index.php"><button>Continue</button></a></div>';
    echo $OUTPUT->footer();
    die;
}
// Print the header
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('uploadexamspreview', 'local_scheduleexam'));
$currenttab = 'upload';
$ob = new schedule_exam();
$ob->tabs($currenttab);
// Print the form if valid values are available
$noerror = true;
if ($noerror) {
    $mform2->display();
}
echo $OUTPUT->footer();
die;