示例#1
1
require_once($CFG->dirroot . '/local/admission/lib.php');
$PAGE->requires->js('/local/admission/js/validation.js');
$id = optional_param('id', 0, PARAM_INT);
$hierarchy = new hierarchy();
$conf = new object();
$systemcontext = context_system::instance();
$PAGE->set_pagelayout('admin');
$PAGE->set_context($systemcontext);
require_login();
$PAGE->set_url('/local/admission/accept.php');
$PAGE->set_heading(get_string('pluginname', 'local_admission'));
$PAGE->navbar->add(get_string('pluginname', 'local_admission'), new moodle_url('/local/admission/viewapplicant.php'));
$PAGE->navbar->add(get_string('acceptapplicant', 'local_admission'));
echo $OUTPUT->header();
$currenttab = 'accept';
$admission = cobalt_admission::get_instance();
$admission->applicant_tabs($currenttab);
echo $OUTPUT->heading(get_string('acceptapplicant', 'local_admission'));

$app = $DB->get_record('local_admission', array('id' => $id));
$curculum = $admission->cobalt_admission_curculum($app->schoolid, $app->programid);
echo '<form action="#" method="POST" onsubmit="return checkcurculum()">';
echo '<label>' . get_string('curriculum', 'local_curriculum') . ' : </label>';
echo '<select name="curs" id="cur">';
foreach ($curculum as $key => $cur) {
    echo '<option value="' . $key . '">' . $cur . '</option>';
}
echo '</select>';
$user = array();
$user[] = html_writer::tag('a', $app->firstname . " " . $app->lastname, array('href' => '' . $CFG->wwwroot . '/local/admission/view.php?id=' . $app->id . ''));
$user[] = $DB->get_field('local_school', 'fullname', array('id' => $app->schoolid));
示例#2
0
function user_download_xls($fields) {
    $admission = cobalt_admission::get_instance();
    global $CFG, $DB;
    require_once("$CFG->libdir/excellib.class.php");
    $filename = clean_filename(get_string('admission', 'local_admission') . '.xls');
    $workbook = new MoodleExcelWorkbook('-');
    $workbook->send($filename);
    $worksheet = array();
    $worksheet[0] = $workbook->add_worksheet('');
    $col = 0;
    foreach ($fields as $fieldname) {
        $worksheet[0]->write(0, $col, $fieldname);
        $col++;
    }
    $sheetrow = 1;
    $sql = $admission->cobalt_admission_applicant(0, 0, 0, 0);
    $applicants = $DB->get_records_sql($sql);

    foreach ($applicants as $app) {
        $user = new stdclass();

        $user->firstname = $app->firstname;
        $user->middlename = $app->middlename;
        $user->lastname = $app->lastname;
        $user->gender = $app->gender;
        $user->region = $app->region;
        $user->town = $app->town;
        $user->howlong = $app->howlong;
        $user->dob = $app->dob;
        $user->country = $app->country;
        $user->placecountry = $app->placecountry;
        $user->contactname = $app->contactname;
        $user->pob = $app->pob;
        $user->phone = $app->phone;
        $user->email = $app->email;
        $user->cummulativetotal = $app->cummulativetotal;
        $user->primaryschool = $app->primaryschool;
        $user->primaryyear = $app->primaryyear;
        $user->secondaryschool = $app->secondaryschool;
        $user->secondaryyear = $app->secondaryyear;
        $user->univercity = $app->univercity;
        $user->univercityyear = $app->univercityyear;
        $user->status = $app->status;
        $semid = $DB->get_field('local_semester', 'fullname', array('id' => $app->semid));
        $user->semname = $semid;
        $user->applicationid = $app->applicationid;
        $user->dateofapplication = date('d-m-y', $app->dateofapplication);
        $user->schoolname = $DB->get_field('local_school', 'fullname', array('id' => $app->schoolid));
        $user->programname = $DB->get_field('local_program', 'fullname', array('id' => $app->programid));
        if ($app->typeofapplication == 1) {
            $app->typeofapplication = 'New Applicant';
        } elseif ($app->typeofapplication == 2) {
            $app->typeofapplication = 'Transfer Applicant';
        } else {
            $app->typeofapplication = 'Readmitted Applicant';
        }
        $user->typeofapplication = $app->typeofapplication;


        if ($app->typeofprogram == 1) {
            $app->typeofprogram = 'Undergraduate';
        } elseif ($app->typeofprogram == 2) {
            $app->typeofprogram = 'Graduate';
        } else {
            $app->typeofprogram = 'Postgraduate';
        }
        $user->typeofprogram = $app->typeofprogram;
        $col = 0;
        foreach ($fields as $fieldname) {
            $worksheet[0]->write($sheetrow, $col, $user->$fieldname);
            $col++;
        }
        $sheetrow++;
    }

    $workbook->close();
    die;
}
示例#3
0
function local_batches_enroll_batches($applicantid,$curriculumid,$batchid,$csvfields){
    global $CFG,$DB,$USER;
      
    $admission = cobalt_admission::get_instance();    
    $applicant = $DB->get_record('local_admission', array('id' => $applicantid));
    $username = $applicant->email;
    //$password = generatePassword();
    
    $password = '******';
    $userinfo = $admission->cobalt_admission_info($applicantid, $curriculumid, $username, $password, true, $csvfields);

    $userid=$userinfo['userid'];
            //already enroled ?
        if ($DB->record_exists('cohort_members',array('userid'=>$userid, 'cohortid'=>$batchid))) {
            echo  '<div class="alert alert-error">'.get_string('im:already_in', 'local_mass_enroll', fullname($user)). '</div>';

        } else {
               cohort_add_member($batchid, $userid);
	}
        
    return true;
    
} //  end of function
示例#4
0
文件: lib.php 项目: anilch/Personel
    /**
     * We are using singleton for this class 
     * @method get_instance
     * @todo get object for cobalt_admission class
     * @return object of this class
     */

    public static function get_instance() {
        if (!self :: $admission) {
            self :: $admission = new cobalt_admission();
        }
        return self :: $admission;
    }
示例#5
0
    public function definition() {
        global $CFG, $DB, $PAGE, $OUTPUT;
        $mform = & $this->_form;
        $today = time();
        $date = date('d-M-Y');
        $value = 1;
        $PAGE->requires->yui_module('moodle-local_admission-school', 'M.local_admission.init_school', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_admission-student', 'M.local_admission.init_student', array(array('formid' => $mform->getAttribute('id'))));
        $PAGE->requires->yui_module('moodle-local_admission-address', 'M.local_admission.init_address', array(array('formid' => $mform->getAttribute('id'))));
        $admission = cobalt_admission::get_instance();
        $pgm = $admission->pgm;
        $typeofstudent = $admission->level;
        $admissiontype = $admission->type;

        $mform->addElement('header', 'moodle', get_string('details', 'local_admission'));
        $mform->addElement('select', 'typeofprogram', get_string('programlevel', 'local_programs'), $pgm);
        $mform->addRule('typeofprogram', get_string('typeofprogram_error', 'local_programs'), 'required', null, 'client');
        $mform->addElement('select', 'typeofapplication', get_string('typeofapplication', 'local_admission'), $admissiontype);
        $mform->addRule('typeofapplication', get_string('typeofapplication_error', 'local_admission'), 'required', null, 'client');
        $mform->addElement('select', 'typeofstudent', get_string('typeofstudent', 'local_admission'), $typeofstudent);
        $mform->addRule('typeofstudent', get_string('typeofstudent_error', 'local_admission'), 'required', null, 'client');
        $mform->addElement('hidden', 'beforeschool');
        $mform->setType('beforeschool', PARAM_RAW);
//Name details
        $mform->addElement('header', 'moodle', get_string('nameheading', 'local_admission'));
        $mform->addElement('text', 'firstname', get_string('firstname', 'local_admission'));
        $mform->addRule('firstname', get_string('firstname_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('firstname', PARAM_RAW);
        $mform->addElement('text', 'middlename', get_string('middlename', 'local_admission'));
        $mform->setType('middlename', PARAM_RAW);
        $mform->addElement('text', 'lastname', get_string('lastname', 'local_admission'));
        $mform->addRule('lastname', get_string('lastname_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('lastname', PARAM_RAW);
//Gender details
        $mform->addElement('header', 'moodle', get_string('genderheading', 'local_admission'));
        $radioarray = array();
        $radioarray[] = & $mform->createElement('radio', 'gender', '', get_string('female', 'local_admission'), 'Female');
        $radioarray[] = & $mform->createElement('radio', 'gender', '', get_string('male', 'local_admission'), 'Male');
        $mform->addGroup($radioarray, 'gender', 'Gender', array(' '), false);
        $mform->addRule('gender', get_string('gender_error', 'local_admission'), 'required', null, 'client');
//Dob details
        $mform->addElement('header', 'moodle', get_string('dobheading', 'local_admission'));
        $mform->addElement('date_selector', 'dob', get_string('dob', 'local_admission'));
        $mform->addHelpButton('dob', 'dob', 'local_admission');
        $mform->setType('dob', PARAM_RAW);
//Country of Birth
        $mform->addElement('header', 'moodle', get_string('countryheading', 'local_admission'));
        $country = get_string_manager()->get_list_of_countries();
        $default_country[''] = get_string('selectacountry');
        $country = array_merge($default_country, $country);
        $mform->addElement('select', 'birthcountry', get_string('country'), $country);
        $mform->addRule('birthcountry', get_string('missingcountry'), 'required', null, 'server');
//Place of birth
        $mform->addElement('header', 'moodle', get_string('placeheading', 'local_admission'));
        $mform->addElement('textarea', 'birthplace', get_string('placecountrys', 'local_admission'), 'rows="3" cols="23"');
        $mform->addRule('birthplace', get_string('birthplace_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('birthplace', PARAM_RAW);
//Current address
        $mform->addElement('header', 'moodle', get_string('addressheading', 'local_admission'));
        $mform->addElement('text', 'fathername', get_string('fathername', 'local_admission'));
        $mform->addRule('fathername', get_string('fathername_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('fathername', PARAM_RAW);
        $mform->addElement('text', 'pob', get_string('pob', 'local_admission'));
        $mform->addRule('pob', get_string('pob_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('pob', PARAM_RAW);
        $mform->addElement('text', 'region', get_string('region', 'local_admission'));
        $mform->addRule('region', get_string('region_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('region', PARAM_RAW);
        $mform->addElement('text', 'town', get_string('town', 'local_admission'));
        $mform->addRule('town', get_string('town_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('town', PARAM_RAW);
        $mform->addElement('text', 'currenthno', get_string('hno', 'local_admission'));
        $mform->addRule('currenthno', get_string('currenthno_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('currenthno', PARAM_RAW);
        $mform->addElement('select', 'currentcountry', get_string('country'), $country);
        $mform->addRule('currentcountry', get_string('country_error', 'local_admission'), 'required', null, 'server');
//personal details
        $mform->addElement('header', 'moodle', get_string('personalinfo', 'local_admission'));
        $mform->addElement('text', 'phone', get_string('phone', 'local_admission'));
        $mform->addRule('phone', get_string('phone_error', 'local_admission'), 'required', null, 'client');
        $mform->addRule('phone', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->addRule('phone', get_string('phoneminimum', 'local_admission'), 'minlength', 10, 'client');
        $mform->addRule('phone', get_string('phonemaximum', 'local_admission'), 'maxlength', 15, 'client');
        $mform->setType('phone', PARAM_RAW);
        $mform->addElement('text', 'email', get_string('email', 'local_admission'));
        $mform->addRule('email', get_string('email_error', 'local_admission'), 'required', null, 'client');
        $mform->addRule('email', get_string('emailerror', 'local_admission'), 'email', null, 'client');
        $mform->setType('email', PARAM_RAW);
        $mform->addElement('text', 'howlong', get_string('howlong', 'local_admission'));
        $mform->addRule('howlong', get_string('howlong_error', 'local_admission'), 'required', null, 'client');
        $mform->addRule('howlong', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->addRule('howlong', get_string('howlongmaximum', 'local_admission'), 'maxlength', 2, 'client');
        $mform->setType('howlong', PARAM_INT);
        $same = array('Select', 'Yes', 'No');
        $mform->addElement('select', 'same', get_string('same', 'local_admission'), $same);
        $mform->addRule('same', get_string('same_error', 'local_admission'), 'required', null, 'client');
//permanent details
        $mform->addElement('hidden', 'beforeaddress');
        $mform->setType('beforeaddress', PARAM_RAW);
        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        $mform->addElement('header', 'moodle', get_string('primaryschool', 'local_admission'));
        $mform->addElement('text', 'primaryschoolname', get_string('primaryschoolname', 'local_admission'));
        $mform->addRule('primaryschoolname', get_string('psname_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('primaryschoolname', PARAM_RAW);
        $mform->addElement('text', 'primaryyear', get_string('primaryyear', 'local_admission'));
        $mform->addRule('primaryyear', get_string('py_error', 'local_admission'), 'required', null, 'client');
        $mform->addRule('primaryyear', get_string('numeric', 'local_admission'), 'numeric', null, 'client');
        $mform->addRule('primaryyear', get_string('minimum', 'local_admission'), 'minlength', 4, 'client');
        $mform->addRule('primaryyear', get_string('maximum', 'local_admission'), 'maxlength', 4, 'client');
        $mform->setType('primaryyear', PARAM_INT);
        $mform->addElement('text', 'primaryscore', get_string('primaryscore', 'local_admission'));
        $mform->addHelpButton('primaryscore', 'primaryscore', 'local_admission');
        $mform->addRule('primaryscore', get_string('ps_error', 'local_admission'), 'required', null, 'client');
//$mform->addRule('primaryscore', get_string('numeric','local_admission'), 'numeric', null,'client');
        $mform->addRule('primaryscore', get_string('positivenumeric', 'local_admission'), 'regex', '/^[0-9]\d*$/', 'client');
        $mform->setType('primaryscore', PARAM_RAW);
        $mform->addElement('text', 'primaryplace', get_string('pnc', 'local_admission'));
        $mform->addRule('primaryplace', get_string('pp_error', 'local_admission'), 'required', null, 'client');
        $mform->setType('primaryplace', PARAM_RAW);
        $mform->addElement('hidden', 'beforestudent');
        $mform->setType('beforestudent', PARAM_RAW);
        $mform->addElement('hidden', 'uploadfiles');
        $mform->setType('uploadfiles', PARAM_RAW);
        $mform->registerNoSubmitButton('updatecourseformat');
        $mform->addElement('submit', 'updatecourseformat', get_string('courseformatudpate'));
        $mform->addElement('header', 'moodle', get_string('fileheading', 'local_admission'));
        
        $help = $OUTPUT->help_icon('uploadfile', 'local_admission', get_string('file', 'local_admission'));
        //@ $mform->addElement('file', 'uploadfile', get_string('uploadfile', 'local_admission') . $help);
        //$mform->setType('uploadfile', PARAM_RAW);
        //$mform->setType('MAX_FILE_SIZE', PARAM_RAW);
        //$mform->addRule('uploadfile', get_string('file_error', 'local_admission'), 'required', null, 'client');
        
         $filemanageroptions=   array(
             'maxfiles' =>2,        
            'subdirs' => 0,
            'accepted_types' => '*'
        );
        $mform->addElement('filemanager', 'uploadfile', get_string('uploadfile', 'local_admission'), null,   $filemanageroptions);
        
        $mform->addElement('hidden', 'dateofapplication', $today);
        $mform->setType('dateofapplication', PARAM_INT);
        $mform->addElement('hidden', 'previousstudent', $value);
        $mform->setType('previousstudent', PARAM_RAW);
        $this->add_action_buttons('false', 'Submit');
    }