moodle/user/policy.php
moodler 027a160469 New feature: Site Policy Agreements.
If the admin specifies a Policy Agreement (via URL in the config variables)
then each user is required to see and agree to that document once before
continuing.

To get everyone to see it again (on an update, say) one just needs to issue:

   UPDATE user SET policyagreed = 0
2004-11-29 05:30:36 +00:00

41 lines
1.2 KiB
PHP

<?php // $Id$
require_once("../config.php");
optional_param('agree', 0, PARAM_INT);
if (!isset($USER->id)) {
require_login();
}
if ($agree == 1 and confirm_sesskey()) { // User has agreed
if (!set_field('user', 'policyagreed', 1, 'id', $USER->id)) {
error('Could not save your agreement');
}
$USER->policyagreed = 1;
redirect($CFG->wwwroot);
exit;
}
$strpolicyagree = get_string('policyagree');
$strpolicyagreement = get_string('policyagreement');
$strpolicyagreementclick = get_string('policyagreementclick');
print_header($strpolicyagreement, $SITE->fullname, $strpolicyagreement);
print_heading($strpolicyagreement);
echo '<center>';
echo '<iframe align="center" width="80%" height="70%" src="'.$CFG->sitepolicy.'" />';
echo link_to_popup_window ($CFG->sitepolicy, 'agreement', $strpolicyagreementclick,
500, 500, 'Popup window', 'none', true);
echo '</iframe>';
echo '</center>';
notice_yesno($strpolicyagree, "policy.php?agree=1&amp;sesskey=$USER->sesskey", $CFG->wwwroot);
print_footer();
?>