Ejemplo n.º 1
0
/**
 * Runs when registration form is submitted
 */
function register_submit(Pieform $form, $values)
{
    global $SESSION;
    $result = registration_send_data();
    $data = json_decode($result->data);
    if ($data->status != 1) {
        log_info($result);
        $SESSION->add_error_msg(get_string('registrationfailedtrylater', 'admin', $result->info['http_code']));
    } else {
        set_config('registration_lastsent', time());
        set_config('registration_sendweeklyupdates', $values['sendweeklyupdates']);
        if (get_config('new_registration_policy')) {
            set_config('new_registration_policy', false);
        }
        $SESSION->add_ok_msg(get_string('registrationsuccessfulthanksforregistering', 'admin'));
        $info = '
<h4>' . get_string('datathathavebeensent', 'admin') . '</h4>
<table class="table table-striped table-bordered" id="register-table">
    <thead>
        <tr>
            <th> ' . get_string('Field', 'admin') . '</th>
            <th> ' . get_string('Value', 'admin') . '</th>
        </tr>
    </thead>
    <tbody>
';
        $datasent = registration_data();
        foreach ($datasent as $key => $val) {
            $info .= '<tr><th>' . hsc($key) . '</th><td>' . hsc($val) . "</td></tr>\n";
        }
        $info .= '</tbody></table>';
        $SESSION->add_ok_msg($info, false);
    }
    redirect('/admin/');
}
Ejemplo n.º 2
0
/**
 * Runs when registration form is submitted
 */
function register_submit(Pieform $form, $values)
{
    global $SESSION;
    $result = registration_send_data();
    if ($result->data != '1') {
        log_info($result);
        $SESSION->add_error_msg(get_string('registrationfailedtrylater', 'admin', $result->info['http_code']));
    } else {
        set_config('registration_lastsent', time());
        set_config('registration_sendweeklyupdates', $values['sendweeklyupdates']);
        $SESSION->add_ok_msg(get_string('registrationsuccessfulthanksforregistering', 'admin'));
    }
    redirect('/admin/');
}
Ejemplo n.º 3
0
/**
 * Cronjob to send an update of site statistics to mahara.org
 */
function cron_send_registration_data()
{
    require_once get_config('libroot') . 'registration.php';
    registration_store_data();
    if (!get_config('registration_sendweeklyupdates')) {
        return;
    }
    $result = registration_send_data();
    $data = json_decode($result->data);
    if ($data->status != 1) {
        log_info($result);
    } else {
        set_config('registration_lastsent', time());
    }
}
Ejemplo n.º 4
0
/**
 * Cronjob to send an update of site statistics to mahara.org
 */
function cron_send_registration_data()
{
    if (!get_config('registration_sendweeklyupdates')) {
        return;
    }
    require_once get_config('libroot') . 'registration.php';
    $result = registration_send_data();
    if ($result->data != '1') {
        log_info($result);
    } else {
        set_config('registration_lastsent', time());
    }
}