/** * Get session declined requests * * @access public * @param integer $sessionid * @return array|false */ function facetoface_get_declines($sessionid) { $select = "u.id, su.id AS signupid, u.firstname, u.lastname, u.email, ss.statuscode, ss.timecreated AS timerequested"; return facetoface_get_users_by_status($sessionid, MDL_F2F_STATUS_DECLINED, $select); }
function definition() { global $CFG; $mform =& $this->_form; $mform->addElement('hidden', 's', $this->_customdata['s']); $mform->setType('s', PARAM_INT); $mform->addElement('header', 'recipientgroupsheader', get_string('messagerecipientgroups', 'facetoface')); // Display select recipient by status $statuses = array( MDL_F2F_STATUS_USER_CANCELLED, MDL_F2F_STATUS_WAITLISTED, MDL_F2F_STATUS_BOOKED, MDL_F2F_STATUS_NO_SHOW, MDL_F2F_STATUS_PARTIALLY_ATTENDED, MDL_F2F_STATUS_FULLY_ATTENDED ); $json_users = array(); $attendees = array(); foreach ($statuses as $status) { // Get count of users with this status $count = facetoface_get_num_attendees($this->_customdata['s'], $status, '='); if (!$count) { continue; } $users = facetoface_get_users_by_status($this->_customdata['s'], $status); $json_users[$status] = $users; $attendees = array_merge($attendees, $users); $title = facetoface_get_status($status); $mform->addElement('checkbox', 'recipient_group['.$status.']', get_string('status_'.$title, 'facetoface') . ' - ' . get_string('xusers', 'facetoface', $count)); } // Display individual recipient selectors $mform->addElement('header', 'recipientsheader', get_string('messagerecipients', 'facetoface')); $options = array(); foreach ($attendees as $a) { $options[$a->id] = fullname($a); } $mform->addElement('select', 'recipients', get_string('individuals', 'facetoface'), $options, array('size' => 5)); $mform->addElement('hidden', 'recipients_selected'); $mform->setType('recipients_selected', PARAM_SEQUENCE); $mform->addElement('button', 'recipient_custom', get_string('editmessagerecipientsindividually', 'facetoface')); $mform->addElement('checkbox', 'cc_managers', get_string('messagecc', 'facetoface')); $mform->addElement('header', 'messageheader', get_string('messageheader', 'facetoface')); $mform->addElement('text', 'subject', get_string('messagesubject', 'facetoface')); $mform->setType('subject', PARAM_TEXT); $mform->addRule('subject', get_string('required'), 'required', null, 'client'); $mform->addElement('editor', 'body', get_string('messagebody', 'facetoface')); $mform->setType('body', PARAM_CLEANHTML); $mform->addRule('body', get_string('required'), 'required', null, 'client'); $json_users = json_encode($json_users); $mform->addElement('html', '<script type="text/javascript">var recipient_groups = '.$json_users.'</script>'); // Add action buttons $buttonarray[] = $mform->createElement('submit', 'submitbutton', get_string('sendmessage', 'facetoface')); $buttonarray[] = $mform->createElement('cancel', 'cancel', get_string('discardmessage', 'facetoface')); $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false); $mform->closeHeaderBefore('buttonar'); }
$mform = new mod_facetoface_attendees_message_form($formurl, array('s' => $s)); // Check form validates if ($mform->is_cancelled()) { redirect($baseurl); } else if ($data = $mform->get_data()) { // Get recipients list $recipients = array(); if (!empty($data->recipient_group)) { foreach ($data->recipient_group as $key => $value) { if (!$value) { continue; } $recipients = $recipients + facetoface_get_users_by_status($s, $key, 'u.id, u.*'); } } //print_object($data); // Get indivdual recipients if (empty($recipients) && !empty($data->recipients_selected)) { // Strip , prefix $data->recipients_selected = substr($data->recipients_selected, 1); $recipients = explode(',', $data->recipients_selected); list($insql, $params) = $DB->get_in_or_equal($recipients); $ssl="'SELECT * FROM {user} WHERE id ' . $insql, $params"; $recipients = $DB->get_records_sql('SELECT * FROM {user} WHERE id ' . $insql, $params); if (!$recipients) { $recipients = array();
} $context = context_module::instance($cm->id); //print_r($cm->id); = 35 require_login(); // Setup urls $baseurl = new moodle_url('/local/preiscrizione/view.php?c_id=' . $c_id); $allowed_actions = array(); $available_actions = array(); $PAGE->set_context($context); // Actions the user can perform $has_attendees = facetoface_get_num_attendees($s); $allowed_actions[] = 'attendees'; $allowed_actions[] = 'waitlist'; $allowed_actions[] = 'addattendees'; $available_actions[] = 'attendees'; if (facetoface_get_users_by_status($s, MDL_F2F_STATUS_WAITLISTED)) { $available_actions[] = 'waitlist'; } /*************************************************************************** * Handle actions */ $heading_message = ''; $params = array('sessionid' => $s); $actions = array(); // Check if any dates are set // Get list of actions $actions['addremove'] = get_string('addremoveattendees', 'facetoface'); $actions['bulkaddfile'] = get_string('bulkaddattendeesfromfile', 'facetoface'); $actions['bulkaddinput'] = get_string('bulkaddattendeesfrominput', 'facetoface'); /** * Print page header