示例#1
0
            // Approve requests.
            if (facetoface_approve_requests($form)) {
                // Logging and events trigger.
                $params = array('context' => $contextmodule, 'objectid' => $session->id);
                $event = \mod_facetoface\event\approve_requests::create($params);
                $event->add_record_snapshot('facetoface_sessions', $session);
                $event->add_record_snapshot('facetoface', $facetoface);
                $event->trigger();
            }
            redirect($return);
        }
    }
}
// Logging and events trigger.
$params = array('context' => $contextmodule, 'objectid' => $session->id);
$event = \mod_facetoface\event\attendees_viewed::create($params);
$event->add_record_snapshot('facetoface_sessions', $session);
$event->add_record_snapshot('facetoface', $facetoface);
$event->trigger();
$pagetitle = format_string($facetoface->name);
$PAGE->set_url('/mod/facetoface/approve.php', array('s' => $s));
$PAGE->set_context($context);
$PAGE->set_cm($cm);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->box_start();
echo $OUTPUT->heading(format_string($facetoface->name));
$OUTPUT->heading(get_string('unapprovedrequests', 'facetoface'));
$action = new moodle_url('approve.php', array('s' => $s));
echo html_writer::start_tag('form', array('action' => $action->out(), 'method' => 'post'));
$PAGE->requires->string_for_js('cancel', 'moodle');
$PAGE->requires->strings_for_js(array('uploadfile', 'addremoveattendees', 'approvalreqd', 'areyousureconfirmwaitlist', 'bulkaddattendeesfrominput', 'submitcsvtext', 'bulkaddattendeesresults', 'bulkaddattendeesfromfile', 'bulkaddattendeesresults', 'wait-list', 'cancellations', 'approvalreqd', 'takeattendance', 'updateattendeessuccessful', 'updateattendeesunsuccessful', 'waitlistselectoneormoreusers', 'confirmlotteryheader', 'confirmlotterybody', 'updatewaitlist', 'close'), 'facetoface');
$json_action = json_encode($action);
$args = array('args' => '{"sessionid":' . $session->id . ',' . '"action":' . $json_action . ',' . '"sesskey":"' . sesskey() . '",' . '"approvalreqd":"' . $facetoface->approvalreqd . '"}');
$jsmodule = array('name' => 'totara_f2f_attendees', 'fullpath' => '/local/preiscrizione/preiscrizione.js', 'requires' => array('json', 'totara_core'));
if ($action == 'messageusers') {
    $PAGE->requires->strings_for_js(array('editmessagerecipientsindividually', 'existingrecipients', 'potentialrecipients'), 'facetoface');
    $PAGE->requires->string_for_js('update', 'moodle');
    $jsmodule = array('name' => 'totara_f2f_attendees_message', 'fullpath' => '/mod/facetoface/attendees_messaging.js', 'requires' => array('json', 'totara_core'));
    $PAGE->requires->js_init_call('M.totara_f2f_attendees_messaging.init', $args, false, $jsmodule);
} else {
    $jsmodule = array('name' => 'totara_f2f_attendees', 'fullpath' => '/mod/facetoface/attendees.js', 'requires' => array('json', 'totara_core'));
    $args = array('args' => '{"sessionid":' . $session->id . ',' . '"action":' . $json_action . ',' . '"sesskey":"' . sesskey() . '",' . '"selectall":' . MDL_F2F_SELECT_ALL . ',' . '"selectnone":' . MDL_F2F_SELECT_NONE . ',' . '"selectset":"' . MDL_F2F_SELECT_SET . '",' . '"selectnotset":"' . MDL_F2F_SELECT_NOT_SET . '",' . '"courseid":"' . $course->id . '",' . '"facetofaceid":"' . $facetoface->id . '",' . '"notsetop":"' . MDL_F2F_STATUS_NOT_SET . '",' . '"approvalreqd":"' . $facetoface->approvalreqd . '"}');
    $PAGE->requires->js_init_call('M.totara_f2f_attendees.init', $args, false, $jsmodule);
}
\mod_facetoface\event\attendees_viewed::create_from_session($session, $context, $action)->trigger();
$cod_fiscali = $_COOKIE['utenti'];
$array_profili = explode(',', $cod_fiscali);
foreach ($array_profili as $piece) {
    $coppie[] = explode(":", $piece);
}
// ESPLODO PER OTTENERE UN ARRAY PER OGNI COPPIA DI VALORI
$organizzazione = 0;
foreach ($coppie as $coppia) {
    // PER OGNI COPPIA, ISCRIVO UTENTE E INSERISCO VALIDAZIONE.
    print_r($coppia);
    $utenti[] = $DB->get_record('user', array('username' => $coppia[0]));
    $utente = $DB->get_record('user', array('username' => $coppia[0]));
    $organizzazione_old = $organizzazione;
    $organizzazione = $DB->get_record('org', array('idnumber' => $coppia[1]));
    if ($organizzazione == NULL) {