/** * Print the details of a session * * @param object $session Record from facetoface_sessions * @param boolean $showcapacity Show the capacity (true) or only the seats available (false) * @param boolean $calendaroutput Whether the output should be formatted for a calendar event * @param boolean $return Whether to return (true) the html or print it directly (true) * @param boolean $hidesignup Hide any messages relating to signing up */ function facetoface_print_session($session, $showcapacity, $calendaroutput=false, $return=false, $hidesignup=false) { global $CFG, $DB; $table = new html_table(); $table->summary = get_string('sessionsdetailstablesummary', 'facetoface'); $table->attributes['class'] = 'generaltable f2fsession'; $table->align = array('right', 'left'); if ($calendaroutput) { $table->tablealign = 'left'; } $customfields = facetoface_get_session_customfields(); $customdata = $DB->get_records('facetoface_session_data', array('sessionid' => $session->id), '', 'fieldid, data'); foreach ($customfields as $field) { $data = ''; if (!empty($customdata[$field->id])) { if (CUSTOMFIELD_TYPE_MULTISELECT == $field->type) { $values = explode(CUSTOMFIELD_DELIMITER, format_string($customdata[$field->id]->data)); $data = implode(html_writer::empty_tag('br'), $values); } else { $data = format_string($customdata[$field->id]->data); } } $table->data[] = array(str_replace(' ', ' ', format_string($field->name)), $data); } $strdatetime = str_replace(' ', ' ', get_string('sessiondatetime', 'facetoface')); if ($session->datetimeknown) { $html = ''; foreach ($session->sessiondates as $date) { if (!empty($html)) { $html .= html_writer::empty_tag('br'); } $sessionobj = facetoface_format_session_times($date->timestart, $date->timefinish, $date->sessiontimezone); if ($sessionobj->startdate == $sessionobj->enddate) { $html .= $sessionobj->startdate . ', '; } else { $html .= $sessionobj->startdate . ' - ' . $sessionobj->enddate . ', '; } $html .= $sessionobj->starttime . ' - ' . $sessionobj->endtime . ' ' . $sessionobj->timezone; } $table->data[] = array($strdatetime, $html); } else { $table->data[] = array($strdatetime, html_writer::tag('i', get_string('wait-listed', 'facetoface'))); } $signupcount = facetoface_get_num_attendees($session->id); $placesleft = $session->capacity - $signupcount; if ($showcapacity) { if ($session->allowoverbook) { $table->data[] = array(get_string('capacity', 'facetoface'), get_string('capacityallowoverbook', 'facetoface', $session->capacity)); } else { $table->data[] = array(get_string('capacity', 'facetoface'), $session->capacity); } } elseif (!$calendaroutput) { $table->data[] = array(get_string('seatsavailable', 'facetoface'), max(0, $placesleft)); } // Display requires approval notification $facetoface = $DB->get_record('facetoface', array('id' => $session->facetoface)); if ($facetoface->approvalreqd) { $table->data[] = array('', get_string('sessionrequiresmanagerapproval', 'facetoface')); } // Display waitlist notification if (!$hidesignup && $session->allowoverbook && $placesleft < 1) { $table->data[] = array('', get_string('userwillbewaitlisted', 'facetoface')); } if (!empty($session->duration)) { $table->data[] = array(get_string('duration', 'facetoface'), format_duration($session->duration)); } // Display room information $session->room = $DB->get_record('facetoface_room', array('id' => $session->roomid)); if (!empty($session->room)) { $roomstring = ''; $roomstring = isset($session->room->name) ? format_string($session->room->name) . ', '. html_writer::empty_tag('br') : ''; $roomstring .= isset($session->room->building) ? format_string($session->room->building) . ', ' . html_writer::empty_tag('br') : ''; $roomstring .= isset($session->room->address) ? format_string($session->room->address) . html_writer::empty_tag('br') : ''; $systemcontext = context_system::instance(); $editoroptions = array( 'noclean' => false, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'context' => $systemcontext, ); $session->room->descriptionformat = FORMAT_HTML; $session->room = file_prepare_standard_editor($session->room, 'description', $editoroptions, $systemcontext, 'facetoface', 'room', $session->room->id); $roomstring .= $session->room->description_editor['text']; $table->data[] = array(get_string('room', 'facetoface'), $roomstring); } if (!empty($session->normalcost)) { $table->data[] = array(get_string('normalcost', 'facetoface'), format_string($session->normalcost)); } if (!empty($session->discountcost)) { $table->data[] = array(get_string('discountcost', 'facetoface'), format_string($session->discountcost)); } // Display trainers. $courseid = $DB->get_field('facetoface', 'course', array('id' => $session->facetoface)); $coursecontext = context_course::instance($courseid); if (!empty($session->details)) { if ($cm = get_coursemodule_from_instance('facetoface', $facetoface->id, $courseid)) { $context = context_module::instance($cm->id); $session->details = file_rewrite_pluginfile_urls($session->details, 'pluginfile.php', $context->id, 'mod_facetoface', 'session', $session->id); } $details = format_text($session->details, FORMAT_HTML); $table->data[] = array(get_string('details', 'facetoface'), $details); } $trainerroles = facetoface_get_trainer_roles($coursecontext); if ($trainerroles) { // Get trainers. $trainers = facetoface_get_trainers($session->id); foreach ($trainerroles as $role => $rolename) { $rolename = $rolename->localname; if (empty($trainers[$role])) { continue; } $trainer_names = array(); foreach ($trainers[$role] as $trainer) { $trainer_url = new moodle_url('/user/view.php', array('id' => $trainer->id)); $trainer_names[] = html_writer::link($trainer_url, fullname($trainer)); } $table->data[] = array($rolename, implode(', ', $trainer_names)); } } return html_writer::table($table, $return); }
function simple_template_for_batches($facetofaceid,$session_cancel=0){ global $DB,$CFG,$USER,$SITE; $sentby_name=fullname($DB->get_record('user',array('id'=>$USER->id))); $sentby_id=$USER->id; $facetoface=$DB->get_record_sql("SELECT * FROM {facetoface} where id=$facetofaceid"); if($session_cancel==0 || $session_cancel==2){ $facetofacesessions=$DB->get_records_sql("SELECT * FROM {facetoface_sessions} fss JOIN {facetoface_sessions_dates} as fsd ON fsd.sessionid=fss.id where facetoface=$facetoface->id"); } //print_object($facetofacesessions); $facetoface_users=$DB->get_records_sql("SELECT * FROM {local_batch_users} where f2fid=$facetoface->id"); $facetoface_course=$DB->get_record_sql("SELECT * FROM {local_batch_courses} where batchid=$facetoface->id"); if((!empty($facetoface)) && (!empty($facetoface_users))){ $mail=new stdClass(); switch($facetoface->active){ case 1: if($session_cancel==0){ $mailsubject=get_string('subject_active', 'facetoface'); }elseif($session_cancel==2){ $mailsubject=get_string('subject_active_session_cancel', 'facetoface'); } $mail->batch_status=get_string('batch_active', 'facetoface'); break; case 8: $mailsubject=get_string('subject_complete', 'facetoface'); $mail->batch_status=get_string('batch_complete', 'facetoface'); break; case 2: $mailsubject=get_string('subject_cancel', 'facetoface'); $mail->batch_status=get_string('batch_cancel', 'facetoface'); break; case 0: $batch_cousre=$DB->get_record('course',array('id'=>$facetoface_course->courseid)); $tataaia = new stdclass(); $tataaia->picture3 = $CFG->wwwroot.'/mod/facetoface/pix/Picture3.png'; $tataaia->picture2 = $CFG->wwwroot.'/mod/facetoface/pix/Picture2.png'; $tataaia->programname = $batch_cousre->fullname; $tataaia->date = date("d M, Y ",$facetoface->startdate); $tataaia->time = date("g:i a",$facetoface->startdate);; $tataaia->venue = 'Thane Training Room'; $tataaia->summary =strip_tags($batch_cousre->summary); $tataaia->summary2 = 'Request you to please discuss with your supervisor, plan your work and make sure that you attend this program'; $tataaia->senderfullname = 'Jagadeep M.P'; $tataaia->designation = 'Manager-Training & Development'; $tataaia->mobileno = '9000 469 5151'; $mailsubject="Batch Start Invitation"; $mail->batch_status=get_string('batch_active', 'facetoface'); } $mail->batch_name=$facetoface->name; $mail->batch_startdate=date("d M, Y ",$facetoface->startdate); $mail->batch_enddate=date("d M, Y ",$facetoface->enddate); $tariner_name=$DB->get_record('user',array('id'=>$facetoface->trainerid)); $mail->tariner_name=fullname($tariner_name); if($facetoface_course){ if($facetoface_course->courseid!=0){ $batch_cousre=$DB->get_field('course','fullname',array('id'=>$facetoface_course->courseid)); $mail->batch_course=$batch_cousre; }else{ $mail->batch_course="-----"; } if($facetoface_course->testid!=0){ $quiz=$DB->get_record('quiz',array('id'=>$facetoface_course->testid)); $mail->test_name=$quiz->name; $course_completion_check=$DB->record_exists_sql("SELECT * FROM {course_completion_criteria} cc, {course} c Where c.id=$facetoface_course->courseid and c.id=cc.course and c.enablecompletion=1 AND cc.module IS NOT NULL AND cc.moduleinstance in (SELECT id FROM {course_modules} where course=$facetoface_course->courseid and instance=$facetoface_course->testid)"); if($course_completion_check==1){ $mail->test_status=get_string('test_completed', 'facetoface'); }else{ $mail->test_status=get_string('test_not_completed', 'facetoface'); } }else{ $mail->test_name="-----"; $mail->test_status="-----"; } } if($facetofacesessions && ($session_cancel==0 || $session_cancel==2)){ $session_mail='<h2 style="text-align:center;font-weight:bold;">SESSION DETAILS</h2>'; $session_mail.='<table style="border:1px solid #333;">'; $i=1; foreach($facetofacesessions as $sessiondate){ //print_object($sessiondate); $sessiondates=new stdClass(); $timenow = time(); if (!empty($html)) { $html= html_writer::empty_tag('br'); } $sessionobj = facetoface_format_session_times($sessiondate->timestart, $sessiondate->timefinish, $sessiondate->sessiontimezone); if ($sessionobj->startdate == $sessionobj->enddate) { $html .= $sessionobj->startdate . ', '; } else { $html .= $sessionobj->startdate . ' - ' . $sessionobj->enddate . ', '; } $html .= $sessionobj->starttime . ' - ' . $sessionobj->endtime . ' ' . $sessionobj->timezone; $duration=round(($sessiondate->duration/60),2); $session_mail.='<tr>'; $session_mail.='<td style="border:1px solid #333;">Session '.$i.' '.'Timings : </td>'; $session_mail.='<td style="border:1px solid #333;"><b>'.$html.'</b></td>'; $session_mail.='<td style="border:1px solid #333;">Duration : </td>'; $session_mail.='<td style="border:1px solid #333;"><b>'.$duration.' Hours </b></td>'; if ($sessiondate->roomid) { $room = $DB->get_record('facetoface_room', array('id' => $sessiondate->roomid)); $sessionroom = $room->name." ". $room->building." ".$room->address; }else{ $sessionroom = "----"; } $sessiondates->datetimeknown=$sessiondate->datetimeknown; $sessiondates->sessiondates=facetoface_get_session_dates($sessiondate->id); //print_object($sessiondates); $session_cancel=$DB->get_record_sql("SELECT * FROM {facetoface_signups} as fsg JOIN {facetoface_signups_status} as fsst on fsst.signupid=fsg.id where fsg.sessionid=$sessiondate->id group by fsg.sessionid"); if($session_cancel->statuscode==10){ $status = get_string('sessionincancel', 'facetoface'); }else{ if ($sessiondate->datetimeknown && facetoface_has_session_started($sessiondates, $timenow) && !facetoface_is_session_in_progress($sessiondates, $timenow)) { $status = get_string('sessioninprogress', 'facetoface'); } else if ($sessiondate->datetimeknown && facetoface_has_session_started($sessiondates, $timenow)&&facetoface_is_session_in_progress($sessiondates, $timenow)) { $status = get_string('sessionover', 'facetoface'); } } $session_mail.='<td style="border:1px solid #333;">Room : </td>'; $session_mail.='<td style="border:1px solid #333;"><b>'.$sessionroom.'</b></td>'; $session_mail.='<td style="border:1px solid #333;">Status : </td>'; $session_mail.='<td style="border:1px solid #333;"><b>'.$status.'</b></td>'; $session_mail.='</tr>'; $i++; } $session_mail.='</table>'; $mail->sessions_details=$session_mail; }else{ $mail->sessions_details=""; } $userenrolments=array(); foreach($facetoface_users as $facetoface_user){ $user=$DB->get_record('user',array('id'=>$facetoface_user->userid)); if($facetoface_course){ $userenrolments[]=$DB->get_record_sql("SELECT * FROM {user_enrolments} where userid=$facetoface_user->userid and enrolid in (SELECT id FROM {enrol} where courseid=$facetoface_course->courseid and enrol='manual')"); } } $emai_users=email_send_users_list($userenrolments,$facetoface_course->courseid,$facetoface->trainerid); $to_emailid=$emai_users[0]; $to_userid=$emai_users[1]; //print_object($emai_users); $from = $DB->get_record('user',array('id'=>2)); $messagetext='Batch'; if($facetoface->active==0){ $messagetext_fr=get_string('first_time_notify', 'facetoface',$tataaia); $messagehtml=text_to_html($messagetext_fr); }else{ $messagetext_fr=get_string('batch_mail', 'facetoface',$mail); $messagehtml=text_to_html($messagetext_fr); } if((!empty($to_emailid))&&(!empty($to_userid))){ $sucess=email_logs_insert_table($to_emailid,$to_userid,$from->email,$from->id,$mailsubject,$messagehtml,$sentby_id,$sentby_name,$facetoface_course->courseid,$facetofaceid); return $sucess; } } }
$PAGE->set_title($pagetitle); $PAGE->set_heading('Attendence'); require_login(); $PAGE->set_pagelayout('admin'); echo $OUTPUT->header(); $has_attendees = facetoface_get_num_attendees($sessionid); $customdata = $DB->get_record('facetoface_sessions', array('id' => $sessionid)); $sessiondate = $DB->get_record('facetoface_sessions_dates', array('sessionid' => $sessionid)); $strdatetime = str_replace(' ', ' ', get_string('sessiondatetime', 'facetoface')); $html = ''; if (!empty($html)) { $html .= html_writer::empty_tag('br'); } $sessionobj = facetoface_format_session_times($sessiondate->timestart, $sessiondate->timefinish, $sessiondate->sessiontimezone); if ($sessionobj->startdate == $sessionobj->enddate) { $html .= $sessionobj->startdate . ', '; } else { $html .= $sessionobj->startdate . ' - ' . $sessionobj->enddate . ', '; } $html .= $sessionobj->starttime . ' - ' . $sessionobj->endtime . ' ' . $sessionobj->timezone; $duration=$customdata->duration/60; $table = new html_table(); //$table->head = array('Employee', 'Date','Status','Action'); /*code has written by rajesh*/
/** * Builds session list table given an array of sessions */ public function print_session_list_table($customfields, $sessions, $viewattendees, $editsessions) { $output = ''; $tableheader = array(); foreach ($customfields as $field) { if (!empty($field->showinsummary)) { $tableheader[] = format_string($field->name); } } $tableheader[] = get_string('date', 'facetoface'); $tableheader[] = get_string('time', 'facetoface'); $tableheader[] = get_string('room', 'facetoface'); if ($viewattendees) { $tableheader[] = get_string('capacity', 'facetoface'); } else { $tableheader[] = get_string('seatsavailable', 'facetoface'); } $tableheader[] = get_string('status', 'facetoface'); $tableheader[] = get_string('options', 'facetoface'); $timenow = time(); $table = new html_table(); $table->summary = get_string('previoussessionslist', 'facetoface'); $table->attributes['class'] = 'generaltable fullwidth'; $table->head = $tableheader; $table->data = array(); foreach ($sessions as $session) { $isbookedsession = false; $bookedsession = $session->bookedsession; $sessionstarted = false; $sessionfull = false; $sessionrow = array(); // Custom fields $customdata = $session->customfielddata; foreach ($customfields as $field) { if (empty($field->showinsummary)) { continue; } if (empty($customdata[$field->id])) { $sessionrow[] = ' '; } else { if (CUSTOMFIELD_TYPE_MULTISELECT == $field->type) { $sessionrow[] = str_replace(CUSTOMFIELD_DELIMITER, html_writer::empty_tag('br'), format_string($customdata[$field->id]->data)); } else { $sessionrow[] = format_string($customdata[$field->id]->data); } } } // Dates/times $allsessiondates = ''; $allsessiontimes = ''; if ($session->datetimeknown) { foreach ($session->sessiondates as $date) { if (!empty($allsessiondates)) { $allsessiondates .= html_writer::empty_tag('br'); $allsessiontimes .= html_writer::empty_tag('br'); } $sessionobj = facetoface_format_session_times($date->timestart, $date->timefinish, $date->sessiontimezone); if ($sessionobj->startdate == $sessionobj->enddate) { $allsessiondates .= $sessionobj->startdate; } else { $allsessiondates .= $sessionobj->startdate . ' - ' . $sessionobj->enddate; } $allsessiontimes .= $sessionobj->starttime . ' - ' . $sessionobj->endtime . ' ' . $sessionobj->timezone; } } else { $allsessiondates = get_string('wait-listed', 'facetoface'); $allsessiontimes = get_string('wait-listed', 'facetoface'); $sessionwaitlisted = true; } $sessionrow[] = $allsessiondates; $sessionrow[] = $allsessiontimes; // Room. if (isset($session->room)) { $roomhtml = ''; $roomhtml .= isset($session->room->name) ? format_string($session->room->name) . html_writer::empty_tag('br') : ''; $roomhtml .= isset($session->room->building) ? format_string($session->room->building) . html_writer::empty_tag('br') : ''; $roomhtml .= isset($session->room->address) ? format_string($session->room->address) . html_writer::empty_tag('br') : ''; $sessionrow[] = $roomhtml; } else { $sessionrow[] = ''; } // Capacity. if ($session->datetimeknown) { $signupcount = facetoface_get_num_attendees($session->id, MDL_F2F_STATUS_BOOKED); } else { $signupcount = facetoface_get_num_attendees($session->id, MDL_F2F_STATUS_APPROVED); } if ($viewattendees) { if ($session->datetimeknown) { $a = array('current' => $signupcount, 'maximum' => $session->capacity); $stats = get_string('capacitycurrentofmaximum', 'facetoface', $a); if ($signupcount > $session->capacity) { $stats .= get_string('capacityoverbooked', 'facetoface'); } $waitlisted = facetoface_get_num_attendees($session->id, MDL_F2F_STATUS_APPROVED) - $signupcount; if ($waitlisted > 0) { $stats .= " (" . $waitlisted . " " . get_string('status_waitlisted', 'facetoface') . ")"; } } else { $stats = $session->capacity . " (" . $signupcount . " " . get_string('status_waitlisted', 'facetoface') . ")"; } } else { $stats = max(0, $session->capacity - $signupcount); } $sessionrow[] = $stats; // Status. $allowcancellation = false; $status = get_string('bookingopen', 'facetoface'); if ($session->datetimeknown && facetoface_has_session_started($session, $timenow) && facetoface_is_session_in_progress($session, $timenow)) { $status = get_string('sessioninprogress', 'facetoface'); $sessionstarted = true; // If user status is wait-listed. if ($bookedsession && $bookedsession->statuscode == MDL_F2F_STATUS_WAITLISTED) { $allowcancellation = true; } } else if ($session->datetimeknown && facetoface_has_session_started($session, $timenow)) { $status = get_string('sessionover', 'facetoface'); $sessionstarted = true; // If user status is wait-listed. if ($bookedsession && $bookedsession->statuscode == MDL_F2F_STATUS_WAITLISTED) { $allowcancellation = true; } } else if ($bookedsession && $session->id == $bookedsession->sessionid) { $signupstatus = facetoface_get_status($bookedsession->statuscode); $status = get_string('status_'.$signupstatus, 'facetoface'); $isbookedsession = true; } else if ($signupcount >= $session->capacity) { $status = get_string('bookingfull', 'facetoface'); $sessionfull = true; } $sessionrow[] = $status; // Options. $options = ''; if ($editsessions) { $options .= $this->output->action_icon(new moodle_url('sessions.php', array('s' => $session->id)), new pix_icon('t/edit', get_string('edit', 'facetoface')), null, array('title' => get_string('editsession', 'facetoface'))) . ' '; $options .= $this->output->action_icon(new moodle_url('sessions.php', array('s' => $session->id, 'c' => 1)), new pix_icon('t/copy', get_string('copy', 'facetoface')), null, array('title' => get_string('copysession', 'facetoface'))) . ' '; $options .= $this->output->action_icon(new moodle_url('sessions.php', array('s' => $session->id, 'd' => 1)), new pix_icon('t/delete', get_string('delete', 'facetoface')), null, array('title' => get_string('deletesession', 'facetoface'))) . ' '; $options .= html_writer::empty_tag('br'); } if ($viewattendees) { $options .= html_writer::link('attendees.php?s='.$session->id.'&backtoallsessions='.$session->facetoface, get_string('attendees', 'facetoface'), array('title' => get_string('seeattendees', 'facetoface'))); $options .= html_writer::empty_tag('br'); } if ($isbookedsession) { $options .= html_writer::link('signup.php?s='.$session->id.'&backtoallsessions='.$session->facetoface, get_string('moreinfo', 'facetoface'), array('title' => get_string('moreinfo', 'facetoface'))); $options .= html_writer::empty_tag('br'); $options .= html_writer::link('cancelsignup.php?s='.$session->id.'&backtoallsessions='.$session->facetoface, get_string('cancelbooking', 'facetoface'), array('title' => get_string('cancelbooking', 'facetoface'))); } else if (!$sessionstarted and !$bookedsession) { if (!facetoface_session_has_capacity($session, $this->context, MDL_F2F_STATUS_WAITLISTED) && !$session->allowoverbook) { $options .= get_string('none', 'facetoface'); } else { $options .= html_writer::link('signup.php?s='.$session->id.'&backtoallsessions='.$session->facetoface, get_string('signup', 'facetoface')); } } if (empty($options)) { if ($sessionstarted && $allowcancellation) { $options = html_writer::link('cancelsignup.php?s='.$session->id.'&backtoallsessions='.$session->facetoface, get_string('cancelbooking', 'facetoface'), array('title' => get_string('cancelbooking', 'facetoface'))); } else { $options = get_string('none', 'facetoface'); } } $sessionrow[] = $options; $row = new html_table_row($sessionrow); // Set the CSS class for the row. if ($sessionstarted) { $row->attributes = array('class' => 'dimmed_text'); } else if ($isbookedsession) { $row->attributes = array('class' => 'highlight'); } else if ($sessionfull) { $row->attributes = array('class' => 'dimmed_text'); } // Add row to table. $table->data[] = $row; } $output .= html_writer::table($table); return $output; }
public function print_dates($dates, $includebookings, $includegrades=false, $includestatus=false, $includecourseid=false, $includetrainers=false, $showlocation=true) { global $CFG, $USER; $output = ''; $courselink = $CFG->wwwroot.'/course/view.php?id='; $facetofacelink = $CFG->wwwroot.'/mod/facetoface/view.php?f='; $attendeelink = $CFG->wwwroot.'/mod/facetoface/attendees.php?s='; $bookinghistoryurl = new moodle_url('/blocks/facetoface/bookinghistory.php'); $output .= html_writer::start_tag('table', array('border' => "1", 'cellpadding' => "5", 'summary' => get_string('sessiondatestable', 'block_facetoface'))) . html_writer::start_tag('tr'); // include the course id in the display if ($includecourseid) { $output .= html_writer::tag('th', get_string('idnumbercourse')); } $output .= html_writer::tag('th', get_string('course')); $output .= html_writer::tag('th', get_string('name')); if ($showlocation) { $output .= html_writer::tag('th', get_string('location')); } $output .= html_writer::tag('th', get_string('date','block_facetoface')); $output .= html_writer::tag('th', get_string('time', 'block_facetoface')); if ($includebookings) { $output .= html_writer::tag('th', get_string('nbbookings', 'block_facetoface')); } // include the grades/status in the display if ($includegrades || $includestatus) { $output .= html_writer::tag('th', get_string('status')); } $output .= html_writer::end_tag('tr'); $even = false; // used to colour rows foreach ($dates as $date) { // include the grades in the display if ($includegrades) { $grade = facetoface_get_grade($date->userid, $date->courseid, $date->facetofaceid); } if ($even) { $output .= html_writer::start_tag('tr', array('style' => 'background-color: #CCCCCC', 'valign' => 'top')); } else { $output .= html_writer::start_tag('tr', array('valign' => 'top')); } $even = !$even; if ($includecourseid) { $output .= html_writer::tag('td', $date->cidnumber); } $output .= html_writer::tag('td', html_writer::link($courselink.$date->courseid, format_string($date->coursename))); $output .= html_writer::tag('td', html_writer::link($facetofacelink.$date->facetofaceid, format_string($date->name))); if ($showlocation) { $location = isset($date->location) ? $date->location : ''; $output .= html_writer::tag('td', format_string($location)); } $output .= html_writer::start_tag('td'); if ($date->datetimeknown) { $sessiondates = $date->alldates; foreach ($sessiondates as $sessiondate) { $sessionobj = facetoface_format_session_times($sessiondate->timestart, $sessiondate->timefinish, $sessiondate->sessiontimezone); if ($sessionobj->startdate == $sessionobj->enddate) { $output .= $sessionobj->startdate . html_writer::empty_tag('br'); } else { $output .= $sessionobj->startdate . ' - ' . $sessionobj->enddate . html_writer::empty_tag('br'); } } $output .= html_writer::end_tag('td'); $output .= html_writer::start_tag('td'); foreach ($sessiondates as $sessiondate) { $sessionobj = facetoface_format_session_times($sessiondate->timestart, $sessiondate->timefinish, $sessiondate->sessiontimezone); $output .= $sessionobj->starttime . ' - ' . $sessionobj->endtime . ' ' . $sessionobj->timezone . html_writer::empty_tag('br'); } } else { $output .= get_string('datenotset', 'block_facetoface'); $output .= html_writer::end_tag('td'); $output .= html_writer::start_tag('td'); } $output .= html_writer::end_tag('td'); if ($includebookings) { $output .= html_writer::tag('td', html_writer::link($attendeelink.$date->sessionid, (isset($date->nbbookings)? format_string($date->nbbookings) : 0))); } // include the grades/status in the display foreach (array($includegrades, $includestatus) as $col) { if ($col) { $bookinghistoryurl->params(array('session' => $date->sessionid, 'userid' => $date->userid)); $output .= html_writer::tag('td', html_writer::link($bookinghistoryurl, get_string('status:' . facetoface_get_status($date->status), 'block_facetoface'))); } } $output .= html_writer::end_tag('tr'); } $output .= html_writer::end_tag('table'); return $output; }