Example #1
0
        $usernew = get_record('user', 'id', $USER->id);
        foreach ((array) $usernew as $variable => $value) {
            $USER->{$variable} = $value;
        }
        if (!is_survey_taken($USER->id, $instanceid) && empty($incomplete)) {
            $dataobject = new object();
            $dataobject->blockinstanceid = $instanceid;
            $dataobject->userid = $USER->id;
            insert_record('block_enrol_survey_taken', $dataobject);
        }
        if (!empty($formdata->save_exit)) {
            redirect($CFG->wwwroot . '/course/view.php?id=' . $COURSE->id);
        }
    }
}
$toform = array();
$u = new user(cm_get_crlmuserid($USER->id));
$toform = get_object_vars($u);
$customdata = get_records('user_info_data', 'userid', $USER->id);
if (!empty($customdata)) {
    foreach ($customdata as $cd) {
        $customfields = get_record('user_info_field', 'id', $cd->fieldid);
        $toform[$customfields->shortname] = $cd->data;
    }
}
$survey_form->set_data($toform);
$blockname = get_string('blockname', 'block_enrol_survey');
print_header($blockname, $blockname, build_navigation($blockname));
print_heading($block->config->title);
$survey_form->display();
print_footer();
Example #2
0
$PAGE->set_pagelayout('standard');
// TBV
$PAGE->set_pagetype('elis');
// TBV
$PAGE->set_context($context);
$PAGE->set_url($ME);
$PAGE->set_title($blockname);
$PAGE->set_heading($blockname);
$PAGE->set_cacheable(true);
$PAGE->set_button(' ');
// Make sure that the either the My Moodle or course shortname link is in the navbar if within that context
if ($mymoodle) {
    $PAGE->navbar->add(get_string('myhome'), new moodle_url('/my'));
} else {
    if ($course->id != SITEID) {
        $PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php?id=' . $course->id));
    }
}
if (isset($block->config->title)) {
    $pagetitle = $block->config->title;
} else {
    $pagetitle = get_string('takepage', 'block_enrolsurvey');
}
$PAGE->navbar->add($pagetitle);
$PAGE->blocks->add_regions(array('side-pre', 'side-post'));
// TBV ?
echo $OUTPUT->header();
echo $OUTPUT->heading($pagetitle);
$surveyform->set_data($toform);
$surveyform->display();
echo $OUTPUT->footer();