예제 #1
0
$PAGE->navbar->add(fullname($plpuser), $userprofileurl, 'title');
//section name
$PAGE->navbar->add(get_string('dashboard', 'block_ilp'), null, 'title');
// setup the page title and heading
$SITE = $dbc->get_course_by_id(SITEID);
$PAGE->set_title($SITE->fullname . " : " . get_string('blockname', 'block_ilp') . " : " . fullname($plpuser));
$PAGE->set_heading($SITE->fullname);
$PAGE->set_pagetype('ilp-dashboard');
$PAGE->set_pagelayout('ilp');
$PAGE->set_url($CFG->wwwroot . "/blocks/ilp/actions/view_main.php", $PARSER->get_params());
//get the enabled template
$temp = $dbc->get_enabled_template();
$classname = $temp->name;
//include the class file for the enabled template
require_once $CFG->dirroot . "/blocks/ilp/classes/dashboard/templates/{$classname}.php";
$template = new $classname();
//check if the student has a user status record if not create one
if (!$dbc->get_user_status($user_id)) {
    //the user can not change there own status so we must set the modifying user to
    //the default user
    $user_modified_id = $user_id != $USER->id ? $USER->id : ILP_DEFAULT_USER_ID;
    $studentstatus = new stdClass();
    $studentstatus->user_id = $user_id;
    $studentstatus->user_modified_id = $user_modified_id;
    $defaultconfiguserstatus = get_config('block_ilp', 'defaultstatusitem');
    $studentstatus->parent_id = !empty($defaultconfiguserstatus) ? $defaultconfiguserstatus : ILP_DEFAULT_USERSTATUS_RECORD;
    //ILP_DEFAULT_USERSTATUS_RECORD;
    $dbc->create_userstatus($studentstatus);
}
//require the view_main.html file
require_once $CFG->dirroot . "/blocks/ilp/views/view_main.html";