require_login(); $PAGE->set_url('/local/assignmentor/assign_mentor.php'); $PAGE->set_heading($SITE->fullname); //if (!has_capability('local/assignmentor:manage', $systemcontext)) { // print_error('You dont have permissions'); //} $PAGE->navbar->add(get_string('pluginname', 'local_assignmentor'), new moodle_url('/local/assignmentor/assign_mentor.php')); $PAGE->navbar->add(get_string('assign', 'local_assignmentor')); $currenturl = "{$CFG->wwwroot}/local/assignmentor/index.php"; echo $OUTPUT->header(); /* ----heading---- */ echo $OUTPUT->heading(get_string('pluginname', 'local_assignmentor')); $hier = new hierarchy(); /* ---adding tabs using prefix_tabs function--- */ $currenttab = 'assignmentor'; $assignee_ob = assign_mentortostudent::getInstance(); $assignee_ob->assignmentor_tabs($currenttab); if (isset($CFG->allowframembedding) and ! $CFG->allowframembedding) { echo $OUTPUT->box(get_string('desc_assign_mentor', 'local_assignmentor')); } /* ---description of the table --- */ echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide'); echo $OUTPUT->box_end(); /* ---after selecting students and mentor(assigning mentor to department)---- */ $data = data_submitted(); if (!empty($mentorid) && !empty($data)) { if (!empty($data->check)) { $count = sizeof($data->check); $res = $assignee_ob->assign_mentorparent_tostudent($data); $lang_name = $DB->get_record('user', array('id' => $sid)); $lang_mentorname = $DB->get_record('user', array('id' => $mentorid));
public static function getInstance() { if (!self::$_singleton) { self::$_singleton = new assign_mentortostudent(); } return self::$_singleton; }