3 require_once('../config.php');
4 require_once($CFG->libdir
.'/filelib.php');
6 $agree = optional_param('agree', 0, PARAM_BOOL
);
8 define('MESSAGE_WINDOW', true); // This prevents the message window coming up
14 if ($agree and confirm_sesskey()) { // User has agreed
15 if (!isguestuser()) { // Don't remember guests
16 if (!set_field('user', 'policyagreed', 1, 'id', $USER->id
)) {
17 error('Could not save your agreement');
20 $USER->policyagreed
= 1;
22 if (!empty($SESSION->wantsurl
)) {
23 $wantsurl = $SESSION->wantsurl
;
24 unset($SESSION->wantsurl
);
27 redirect($CFG->wwwroot
.'/');
32 $strpolicyagree = get_string('policyagree');
33 $strpolicyagreement = get_string('policyagreement');
34 $strpolicyagreementclick = get_string('policyagreementclick');
36 print_header($strpolicyagreement, $SITE->fullname
, $strpolicyagreement);
38 print_heading($strpolicyagreement);
40 $mimetype = mimeinfo('type', $CFG->sitepolicy
);
41 echo '<div class="noticebox">';
42 echo '<object id="policyframe" data="'.$CFG->sitepolicy
.'" type="'.$mimetype.'">';
43 echo link_to_popup_window ($CFG->sitepolicy
, 'agreement', $strpolicyagreementclick,
44 500, 500, 'Popup window', 'none', true);
45 echo '</object></div>';
47 $linkyes = 'policy.php';
48 $optionsyes = array('agree'=>1, 'sesskey'=>sesskey());
49 $linkno = $CFG->wwwroot
.'/login/logout.php';
50 $optionsno = array('sesskey'=>sesskey());
51 notice_yesno($strpolicyagree, $linkyes, $linkno, $optionsyes, $optionsno);