registersite.php 2.1 KB
Newer Older
1
2
3
4
5
6
<?php
/**
 *
 * @package    mahara
 * @subpackage admin
 * @author     Catalyst IT Ltd
7
8
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
 * @copyright  For copyright information on Mahara, please see the README file distributed with this software.
9
10
11
12
13
 *
 */

define('INTERNAL', 1);
define('ADMIN', 1);
14
define('MENUITEM', 'adminhome/registersite');
15
16
17
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');

18

19
20
require(dirname(dirname(__FILE__)).'/init.php');
require(get_config('libroot') . 'registration.php');
21
define('TITLE', get_string('Registration', 'admin'));
22

23
// This runs register_site in registration.php, which is what displays the form and the button for emails.
24
25
if (!get_config('registration_lastsent')
    || get_config('new_registration_policy')) {
26
    $register = register_site();
27
28
29
    if (get_config('new_registration_policy')) {
        $registration_update = get_string('newregistrationpolicyinfo', 'admin');
    }
30
31
}
else {
32
33
34
35
36
37
38
    $registered = register_site(true);
    $firstregistered = (get_config('registration_firstsent'));
    // The $firstregistered might be false if site registered before we kept this info. Otherwise format as date.
    if ($firstregistered) {
        $firstregistered = format_date($firstregistered);
    }
}
39
40
41

$smarty = smarty();

42
setpageicon($smarty, 'icon-star');
43

44
45
46
if (isset($register)) {
    $smarty->assign('register', $register);
}
47
48
49
50
else if (isset($registered)) {
    $smarty->assign('registered', $registered);
    $smarty->assign('firstregistered', $firstregistered);
}
51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$js = <<<EOF
jQuery(function($) {
    function update_weeklyupdates_options() {
        var showweeklyupdates = $('#register_registeryesno').prop('checked');
        if (showweeklyupdates) {
            $('#register_sendweeklyupdates_container').removeClass('hidden');
        }
        else {
            $('#register_sendweeklyupdates_container').addClass('hidden');
        }
    }
    $('#register_registeryesno').on('click', update_weeklyupdates_options);
    update_weeklyupdates_options();
});
EOF;

$smarty->assign('INLINEJAVASCRIPT', $js);
69
$smarty->display('admin/registersite.tpl');