if ($signedup) { if (!($session->datetimeknown && facetoface_has_session_started($session, $timenow))) { // Cancellation link. echo html_writer::link(new moodle_url('cancelsignup.php', array('s' => $session->id, 'backtoallsessions' => $backtoallsessions)), get_string('cancelbooking', 'facetoface'), array('title' => get_string('cancelbooking', 'facetoface'))); echo ' – '; } // See attendees link. if ($viewattendees) { echo html_writer::link(new moodle_url('attendees.php', array('s' => $session->id, 'backtoallsessions' => $backtoallsessions)), get_string('seeattendees', 'facetoface'), array('title' => get_string('seeattendees', 'facetoface'))); } echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } // Don't allow signup to proceed if a manager is required. else if (facetoface_manager_needed($facetoface) && empty($manager->email)) { // Check to see if the user has a managers email set. echo html_writer::tag('p', html_writer::tag('strong', get_string('error:manageremailaddressmissing', 'facetoface'))); echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } else if (!has_capability('mod/facetoface:signup', $context)) { echo html_writer::tag('p', html_writer::tag('strong', get_string('error:nopermissiontosignup', 'facetoface'))); echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } else { // Signup form. $mform->display(); } echo $OUTPUT->box_end(); echo $OUTPUT->footer($course);
echo facetoface_print_session($session, $viewattendees); if ($signedup) { if (!($session->datetimeknown && facetoface_has_session_started($session, $timenow))) { // Cancellation link. $cancellationurl = new moodle_url('cancelsignup.php', array('s' => $session->id, 'backtoallsessions' => $backtoallsessions)); echo html_writer::link($cancellationurl, get_string('cancelbooking', 'facetoface'), array('title' => get_string('cancelbooking', 'facetoface'))); echo ' – '; } // See attendees link. if ($viewattendees) { $attendeesurl = new moodle_url('attendees.php', array('s' => $session->id, 'backtoallsessions' => $backtoallsessions)); echo html_writer::link($attendeesurl, get_string('seeattendees', 'facetoface'), array('title' => get_string('seeattendees', 'facetoface'))); } echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } else { if (facetoface_manager_needed($facetoface) && !facetoface_get_manageremail($USER->id)) { // Don't allow signup to proceed if a manager is required. // Check to see if the user has a managers email set. echo html_writer::tag('p', html_writer::tag('strong', get_string('error:manageremailaddressmissing', 'facetoface'))); echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } else { if (!has_capability('mod/facetoface:signup', $context)) { echo html_writer::tag('p', html_writer::tag('strong', get_string('error:nopermissiontosignup', 'facetoface'))); echo html_writer::empty_tag('br') . html_writer::link($returnurl, get_string('goback', 'facetoface'), array('title' => get_string('goback', 'facetoface'))); } else { // Signup form. $mform->display(); } } } echo $OUTPUT->box_end();
function test_facetoface_manager_needed() { // Test variables. $facetoface1 = $this->facetoface['f2f1']; $f2f1 = $this->array_to_object($facetoface1); $facetoface2 = $this->facetoface['f2f0']; $f2f2 = $this->array_to_object($facetoface2); // Test for valid case. $this->assertTrue((bool)facetoface_manager_needed($f2f1), $this->msgtrue); // Test for invalid case. $this->assertFalse((bool)facetoface_manager_needed($f2f2), $this->msgfalse); $this->resetAfterTest(true); }