Browse Source

Unfinished implementation take.php (previously attendance.php) with enhancement: take into account information about students enrolment(status, start date).

MOODLE_23_STABLE
Artem Andreev 14 years ago
parent
commit
2b3b13f425
  1. 4
      lang/en/attforblock.php
  2. 3
      lang/ru/attforblock.php
  3. 183
      locallib.php
  4. 2
      manage.php
  5. 61
      renderables.php
  6. 177
      renderer.php
  7. 4
      sessions.php
  8. 33
      styles.css
  9. 52
      take.php

4
lang/en/attforblock.php

@ -76,6 +76,8 @@ $string['duration'] = 'Duration';
$string['editsession'] = 'Edit Session';
$string['endtime'] = 'Session end time';
$string['endofperiod'] = 'End of period';
$string['enrolmentstart'] = 'User enrolment starts {$a}';
$string['enrolmentsuspended'] = 'Enrolment suspended';
$string['errorgroupsnotselected'] = 'Select one or more groups';
$string['errorinaddingsession'] = 'Error in adding session';
$string['erroringeneratingsessions'] = 'Error in generating sessions ';
@ -113,6 +115,7 @@ $string['olddate'] = 'Old date';
$string['period'] = 'Frequency';
$string['pluginname'] = 'Attendance';
$string['pluginadministration'] = 'Attendance administration';
$string['remarks'] = 'Remarks';
$string['report'] = 'Report';
$string['resetdescription'] = 'Remember that deleting attendance data will erase information from database. You can just hide older sessions having changed start date of course!';
$string['resetstatuses'] = 'Reset statuses to default';
@ -139,6 +142,7 @@ $string['sessiontype_help'] = 'There are two types of sessions: common and group
';
$string['sessiontypeshort'] = 'Type';
$string['sessionupdated'] = 'Session successfully updated';
$string['setallstatusesto'] = 'Set status for all users to «{$a}»';
$string['settings'] = 'Settings';
$string['showdefaults'] = 'Show defaults';
$string['showduration'] = 'Show duration';

3
lang/ru/attforblock.php

@ -62,6 +62,8 @@ $string['downloadtext'] = 'Скачать в текстовом формате';
$string['duration'] = 'Продолжительность';
$string['editsession'] = 'Редактировать занятие';
$string['endofperiod'] = 'Конец периода';
$string['enrolmentstart'] = 'Подписка на курс начинается с {$a}';
$string['enrolmentsuspended'] = 'Подписка на курс приостановлена';
$string['errorgroupsnotselected'] = 'Выберите одну или более групп';
$string['errorinaddingsession'] = 'Ошибка при добавлении занятия';
$string['erroringeneratingsessions'] = 'Ошибка при создании занятий';
@ -123,6 +125,7 @@ $string['sessiontype_help'] = 'Существует 2 типа занятий:
';
$string['sessiontypeshort'] = 'Тип';
$string['sessionupdated'] = 'Занятие успешно изменено';
$string['setallstatusesto'] = 'Установить статус для всех учащихся в «{$a}»';
$string['settings'] = 'Настройки';
$string['showdefaults'] = 'Показать значения по-умолчанию';
$string['sortedgrid'] = 'Таблица';

183
locallib.php

@ -1,5 +1,7 @@
<?php
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . '/gradelib.php');
@ -194,6 +196,10 @@ class att_manage_page_params {
break;
}
}
public function get_significant_params() {
return array();
}
}
class att_sessions_page_params {
@ -213,31 +219,54 @@ class att_take_page_params {
const DEFAULT_VIEW_MODE = self::SORTED_LIST;
/** @var int view mode of taking attendance page*/
public $view_mode;
const SORT_LASTNAME = 1;
const SORT_FIRSTNAME = 2;
public static function create_default() {
$instance = new att_take_page_params();
public $sessionid;
public $grouptype;
public $group;
public $sort;
public $copyfrom;
$instance->view_mode = self::DEFAULT_VIEW_MODE;
/** @var int view mode of taking attendance page*/
public $viewmode;
return $instance;
}
public $gridcols;
public function init(att_manage_page_params $view_params, $courseid) {
$this->init_view_mode($view_params->view_mode);
public function init() {
if (!isset($this->sort)) $this->sort = self::SORT_LASTNAME;
$this->init_view_mode();
$this->init_gridcols();
}
private function init_view_mode($view_mode) {
global $SESSION;
private function init_view_mode() {
if (isset($this->viewmode)) {
set_user_preference("attforblock_take_view_mode", $this->viewmode);
}
else {
$this->viewmode = get_user_preferences("attforblock_take_view_mode", self::DEFAULT_VIEW_MODE);
}
}
if (isset($view_mode)) {
set_user_preference("attforblock_take_view_mode", $view_mode);
$this->view_mode = $view_mode;
private function init_gridcols() {
if (isset($this->gridcols)) {
set_user_preference("attforblock_gridcolumns", $this->gridcols);
}
else {
$this->view_mode = get_user_preferences("attforblock_take_view_mode", $this->view_mode);
$this->gridcols = get_user_preferences("attforblock_gridcolumns", 5);
}
}
public function get_significant_params() {
$params = array();
$params['sessionid'] = $this->sessionid;
$params['grouptype'] = $this->grouptype;
if (isset($this->group)) $params['group'] = $this->group;
$params['sort'] = $this->sort;
if (isset($this->copyfrom)) $params['copyfrom'] = $this->copyfrom;
return $params;
}
}
@ -279,6 +308,10 @@ class attforblock {
private $currentgroup;
private $sessioninfo;
private $statuses;
/**
* Initializes the attendance API instance using the data from DB
*
@ -367,7 +400,7 @@ class attforblock {
* @return moodle_url of sessions.php for attendance instance
*/
public function url_sessions($params=array()) {
$params = array_merge(array('id' => $this->cm->id), $params);
$params = array('id' => $this->cm->id) + $params;
return new moodle_url('/mod/attforblock/sessions.php', $params);
}
@ -400,14 +433,13 @@ class attforblock {
*/
public function url_take() {
$params = array('id' => $this->cm->id);
return new moodle_url('/mod/attforblock/attendances.php', $params);
return new moodle_url('/mod/attforblock/take.php', $params);
}
private function calc_groupmode_sessgroupslist_currentgroup(){
global $USER, $SESSION;
$cm = $this->cm;
$this->groupmode = groups_get_activity_groupmode($cm);
if ($this->groupmode == NOGROUPS)
return;
@ -484,7 +516,7 @@ class attforblock {
public function get_group_mode() {
if (is_null($this->groupmode))
$this->calc_groupmode_sessgroupslist_currentgroup();
$this->groupmode = groups_get_activity_groupmode($this->cm);
return $this->groupmode;
}
@ -555,6 +587,119 @@ class attforblock {
// TODO: log
// add_to_log($course->id, 'attendance', 'Session updated', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname);
}
public function take_from_form_data($formdata) {
global $DB, $USER;
$statuses = implode(',', array_keys( (array)$this->get_statuses() ));
$now = time();
$sesslog = array();
$formdata = (array)$formdata;
foreach($formdata as $key => $value) {
if(substr($key, 0, 4) == 'user' && $value !== '') {
$sid = substr($key, 4);
$sesslog[$sid] = new Object();
$sesslog[$sid]->studentid = $sid;
$sesslog[$sid]->statusid = $value;
$sesslog[$sid]->statusset = $statuses;
$sesslog[$sid]->remarks = array_key_exists('remarks'.$sid, $formdata) ? $formdata['remarks'.$sid] : '';
$sesslog[$sid]->sessionid = $this->pageparams->sessionid;
$sesslog[$sid]->timetaken = $now;
$sesslog[$sid]->takenby = $USER->id;
}
}
$dbsesslog = $this->get_session_log($this->pageparams->sessionid);
foreach ($sesslog as $log) {
if (array_key_exists($log->studentid, $dbsesslog)) {
$log->id = $dbsesslog[$log->studentid]->id;
$DB->update_record('attendance_log', $log);
}
else
$DB->insert_record('attendance_log', $log, false);
}
$rec = new object();
$rec->id = $this->pageparams->sessionid;
$rec->lasttaken = $now;
$rec->lasttakenby = $USER->id;
$DB->update_record('attendance_sessions', $rec);
// TODO: update_grades
// TODO: log
redirect($this->url_manage(), get_string('attendancesuccess','attforblock'));
}
/**
* MDL-27591 made this method obsolete.
*/
public function get_users($groupid = 0) {
global $DB;
//fields we need from the user table
$userfields = user_picture::fields('u');
if (isset($this->pageparams->sort) and ($this->pageparams->sort == att_take_page_params::SORT_FIRSTNAME)) {
$orderby = "u.firstname ASC, u.lastname ASC";
}
else {
$orderby = "u.lastname ASC, u.firstname ASC";
}
$users = get_enrolled_users($this->context, 'mod/attforblock:canbelisted', $groupid, $userfields, $orderby);
//add a flag to each user indicating whether their enrolment is active
if (!empty($users)) {
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED, 'usid0');
$sql = "SELECT ue.userid, ue.status, ue.timestart, ue.timeend
FROM {user_enrolments} ue
JOIN {enrol} e ON e.id = ue.enrolid
WHERE ue.userid $usql
AND e.status = :estatus
AND e.courseid = :courseid
GROUP BY ue.userid";
$params = array_merge($uparams, array('estatus'=>ENROL_INSTANCE_ENABLED, 'courseid'=>$this->course->id));
$enrolmentsparams = $DB->get_records_sql($sql, $params);
foreach ($users as $user) {
$users[$user->id]->enrolmentstatus = $enrolmentsparams[$user->id]->status;
$users[$user->id]->enrolmentstart = $enrolmentsparams[$user->id]->timestart;
$users[$user->id]->enrolmentend = $enrolmentsparams[$user->id]->timeend;
}
}
return $users;
}
public function get_statuses($onlyvisible = true) {
global $DB;
if (!isset($this->statuses)) {
if ($onlyvisible) {
$this->statuses = $DB->get_records_select('attendance_statuses', "attendanceid = :aid AND visible = 1 AND deleted = 0", array('aid' => $this->id), 'grade DESC');
} else {
$this->statuses = $DB->get_records_select('attendance_statuses', "attendanceid = :aid AND deleted = 0", array('aid' => $this->id), 'grade DESC');
}
}
return $this->statuses;
}
public function get_session_info($sessionid) {
global $DB;
if (!isset($this->sessioninfo))
$this->sessioninfo = $DB->get_record('attendance_sessions', array('id' => $sessionid));
return $this->sessioninfo;
}
public function get_session_log($sessionid) {
global $DB;
return $DB->get_records('attendance_log', array('sessionid' => $sessionid), '', 'studentid,statusid,remarks,id');
}
}

2
manage.php

@ -56,7 +56,7 @@ $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'attforblock'));
$PAGE->navbar->add($att->name);
$output = $PAGE->get_renderer('mod_attforblock');
$tabs = new attforblock_tabs($att);
$tabs = new attforblock_tabs($att, attforblock_tabs::TAB_SESSIONS);
$filtercontrols = new attforblock_filter_controls($att);
$sesstable = new attforblock_sessions_manage_data($att);

61
renderables.php

@ -37,7 +37,7 @@ class attforblock_tabs implements renderable {
* @param attforblock $att instance
* @param $currenttab - one of attforblock_tabs constants
*/
public function __construct(attforblock $att, $currenttab=self::TAB_SESSIONS) {
public function __construct(attforblock $att, $currenttab=NULL) {
$this->att = $att;
$this->currenttab = $currenttab;
}
@ -130,9 +130,8 @@ class attforblock_filter_controls implements renderable {
}
$this->urlpath = $PAGE->url->out_omit_querystring();
$params = array('id' => $att->cm->id);
if (isset($att->pageparams->studentssort)) $params['sort'] = $att->pageparams->studentssort;
if (isset($att->pageparams->studentid)) $params['studentid'] = $att->pageparams->studentid;
$params = $att->pageparams->get_significant_params();
$params['id'] = $att->cm->id;
$this->urlparams = $params;
$this->att = $att;
@ -266,4 +265,58 @@ class attforblock_sessions_manage_data implements renderable {
}
}
class attforblock_take_data implements renderable {
public $users;
public $pageparams;
public $perm;
public $groupmode;
public $cm;
public $statuses;
public $sessioninfo;
public $sessionlog;
public $updatemode;
private $urlpath;
private $urlparams;
public function __construct(attforblock $att) {
$this->users = $att->get_users();
$this->pageparams = $att->pageparams;
$this->perm = $att->perm;
$this->groupmode = $att->get_group_mode();
$this->cm = $att->cm;
$this->statuses = $att->get_statuses();
$this->sessioninfo = $att->get_session_info($att->pageparams->sessionid);
$this->sessionlog = $att->get_session_log($att->pageparams->sessionid);
$this->urlpath = $att->url_take()->out_omit_querystring();
$params = $att->pageparams->get_significant_params();
$params['id'] = $att->cm->id;
$this->urlparams = $params;
$this->updatemode =$this->sessioninfo->lasttaken > 0;
}
public function url($params=array()) {
$params = array_merge($this->urlparams, $params);
return new moodle_url($this->urlpath, $params);
}
public function url_path() {
return $this->urlpath;
}
}
?>

177
renderer.php

@ -153,37 +153,43 @@ class mod_attforblock_renderer extends plugin_renderer_base {
}
protected function render_sess_manage_table(attforblock_sessions_manage_data $sessdata) {
$sesstable = new html_table();
$sesstable->width = '100%';
$sesstable->head = array(
$table = new html_table();
$table->width = '100%';
$table->head = array(
'#',
get_string('sessiontypeshort', 'attforblock'),
get_string('date'), get_string('from'),
($sessdata->showendtime == '0') ? get_string('duration', 'attforblock') : get_string('to'),
get_string('date'),
get_string('time'),
get_string('description','attforblock'),
get_string('actions'),
get_string('select')
);
$sesstable->align = array('', '', '', 'right', 'left', 'center', 'center');
$sesstable->size = array('1px', '', '1px', '1px', '1px', '*', '1px', '1px');
$table->align = array('', '', '', '', 'center', 'center', 'center');
$table->size = array('1px', '', '1px', '1px', '*', '1px', '1px');
$i = 0;
foreach ($sessdata->sessions as $key => $sess) {
$i++;
$actions = '';
$desctext = empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description;
if($sess->lasttaken > 0) //attendance has taken
$desc = empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description;
$date = userdate($sess->sessdate, get_string('strftimedmyw', 'attforblock'));
$starttime = userdate($sess->sessdate, get_string('strftimehm', 'attforblock'));
$endtime = userdate($sess->sessdate + $sess->duration, get_string('strftimehm', 'attforblock'));
$time = html_writer::tag('nobr', $starttime . ($sess->duration > 0 ? ' - ' . $endtime : ''));
if($sess->lasttaken > 0)
{
if ($sessdata->perm->can_change()) {
$url = $sessdata->url_take($sess->id, $sess->groupid);
$title = get_string('changeattendance','attforblock');
$desc = html_writer::link($url, $desctext, array('title' => $title));
$date = html_writer::link($url, $date, array('title' => $title));
$time = html_writer::link($url, $time, array('title' => $title));
} else {
$desc = '<i>' . $desctext . '</i>';
$date = '<i>' . $date . '</i>';
$time = '<i>' . $time . '</i>';
}
} else {
$desc = $desctext;
if ($sessdata->perm->can_take()) {
$url = $sessdata->url_take($sess->id, $sess->groupid);
$title = get_string('takeattendance','attforblock');
@ -200,33 +206,25 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$actions .= $this->output->action_icon($url, new pix_icon('t/delete', $title));
}
$sesstable->data[$sess->id][] = $i;
$sesstable->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attforblock');
$sesstable->data[$sess->id][] = userdate($sess->sessdate, get_string('strftimedmyw', 'attforblock'));
$sesstable->data[$sess->id][] = userdate($sess->sessdate, get_string('strftimehm', 'attforblock'));
$hours = floor($sess->duration / HOURSECS);
$mins = floor(($sess->duration - $hours * HOURSECS) / MINSECS);
$mins = $mins < 10 ? "0$mins" : "$mins";
$duration = "{$mins}&nbsp;" . get_string('min');
if ($hours)
$duration = "{$hours}&nbsp;" . get_string('hours') . "&nbsp;" . $duration;
$endtime = userdate($sess->sessdate+$sess->duration, get_string('strftimehm', 'attforblock'));
$sesstable->data[$sess->id][] = ($sessdata->showendtime == 0) ? $duration : $endtime;
$sesstable->data[$sess->id][] = $desc;
$sesstable->data[$sess->id][] = $actions;
$sesstable->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false);
$table->data[$sess->id][] = $i;
$table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attforblock');
$table->data[$sess->id][] = $date;
$table->data[$sess->id][] = $time;
$table->data[$sess->id][] = $desc;
$table->data[$sess->id][] = $actions;
$table->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false);
}
return html_writer::table($sesstable);
return html_writer::table($table);
}
protected function render_sess_control_table(attforblock_sessions_manage_data $sessdata) {
$controltable = new html_table();
$controltable->attributes['class'] = ' ';
$controltable->width = '100%';
$controltable->align = array('left', 'right');
$table = new html_table();
$table->attributes['class'] = ' ';
$table->width = '100%';
$table->align = array('left', 'right');
$controltable->data[0][] = $this->output->help_icon('hiddensessions', 'attforblock',
$table->data[0][] = $this->output->help_icon('hiddensessions', 'attforblock',
get_string('hiddensessions', 'attforblock').': '.$sessdata->hiddensessionscount);
$controls = html_writer::link('javascript:checkall();', get_string('selectall')).' / '.
@ -244,9 +242,118 @@ class mod_attforblock_renderer extends plugin_renderer_base {
} else {
$controls .= get_string('youcantdo', 'attforblock'); //You can't do anything
}
$controltable->data[0][] = $controls;
$table->data[0][] = $controls;
return html_writer::table($table);
}
protected function render_attforblock_take_data(attforblock_take_data $takedata) {
$controls = '';
if ($takedata->pageparams->grouptype == attforblock::SESSION_COMMON and
($takedata->groupmode == VISIBLEGROUPS or
($takedata->groupmode and $takedata->perm->can_access_all_groups()))) {
$controls .= groups_print_activity_menu($takedata->cm, $takedata->url(), true);
}
$controls = html_writer::tag('div', $controls);
$table = $this->render_attforblock_take_list($takedata);
$table .= html_writer::input_hidden_params($takedata->url());
$params = array(
'type' => 'submit',
'value' => get_string('save','attforblock'));
$table .= html_writer::tag('center', html_writer::empty_tag('input', $params));
$table = html_writer::tag('form', $table, array('method' => 'post', 'action' => $takedata->url_path()));
return $table;
}
protected function render_attforblock_take_list(attforblock_take_data $takedata) {
$table = new html_table();
$table->width = '0%';
$table->head = array(
'#',
$this->get_fullname_head($takedata)
);
$table->align = array('left', 'left');
$table->size = array('20px', '');
$table->wrap[1] = 'nowrap';
foreach ($takedata->statuses as $st) {
$table->head[] = html_writer::link("javascript:select_all_in(null, 'st" . $st->id . "', null);", $st->acronym, array('title' => get_string('setallstatusesto', 'attforblock', $st->description)));
$table->align[] = 'center';
$table->size[] = '20px';
}
$table->head[] = get_string('remarks', 'attforblock');
$table->align[] = 'center';
$table->size[] = '20px';
$table->attributes['class'] = 'generaltable taketable';
$i = 0;
foreach ($takedata->users as $user) {
$i++;
$row = new html_table_row();
$row->cells[] = $i;
$row->cells[] = $this->output->render(new user_picture($user)).fullname($user);
if ($user->enrolmentstart > $takedata->sessioninfo->sessdate) {
$cell = new html_table_cell(get_string('enrolmentstart', 'attforblock', userdate($user->enrolmentstart, '%d.%m.%Y')));
$cell->colspan = count($takedata->statuses) + 1;
$row->cells[] = $cell;
$row->attributes['class'] = 'userwithoutenrol';
}
elseif ($user->enrolmentstatus == ENROL_USER_SUSPENDED) {
$cell = new html_table_cell(get_string('enrolmentsuspended', 'attforblock'));
$cell->colspan = count($takedata->statuses) + 1;
$row->cells[] = $cell;
$row->attributes['class'] = 'userwithoutenrol';
}
else {
if ($takedata->updatemode and !array_key_exists($user->id, $takedata->sessionlog))
$row->attributes['class'] = 'userwithoutdata';
foreach ($takedata->statuses as $st) {
$params = array(
'type' => 'radio',
'name' => 'user'.$user->id,
'class' => 'st'.$st->id,
'value' => $st->id);
if (array_key_exists($user->id, $takedata->sessionlog) and $st->id == $takedata->sessionlog[$user->id]->statusid)
$params['checked'] = '';
$row->cells[] = html_writer::empty_tag('input', $params);
}
$params = array(
'type' => 'text',
'name' => 'remarks'.$user->id);
if (array_key_exists($user->id, $takedata->sessionlog))
$params['value'] = $takedata->sessionlog[$user->id]->remarks;
$row->cells[] = html_writer::empty_tag('input', $params);
}
//$row->attributes['class'] =
$table->data[] = $row;
}
return html_writer::table($table);
}
private function get_fullname_head(attforblock_take_data $takedata) {
global $CFG;
if ($takedata->pageparams->sort == att_take_page_params::SORT_LASTNAME)
$firstname = html_writer::link($takedata->url(array('sort' => att_take_page_params::SORT_FIRSTNAME)), get_string('firstname'));
else
$firstname = get_string('firstname');
if ($takedata->pageparams->sort == att_take_page_params::SORT_FIRSTNAME)
$lastname = html_writer::link($takedata->url(array('sort' => att_take_page_params::SORT_LASTNAME)), get_string('lastname'));
else
$lastname = get_string('lastname');
if ($CFG->fullnamedisplay == 'lastname firstname') {
$fullnamehead = "$lastname / $firstname";
} else {
$fullnamehead = "$firstname / $lastname";
}
return html_writer::table($controltable);
return $fullnamehead;
}
}

4
sessions.php

@ -41,7 +41,7 @@ switch ($att->pageparams->action) {
}
else {
$att->add_session_from_form_data($formdata);
redirect($url, get_string('sessionadded','attforblock'), 3);
redirect($url, get_string('sessionadded','attforblock'));
}
}
@ -60,7 +60,7 @@ switch ($att->pageparams->action) {
if ($mform->is_submitted()) {
$att->update_session_from_form_data($mform->get_data(), $sessionid);
redirect($att->url_manage(), get_string('sessionupdated','attforblock'), 3);
redirect($att->url_manage(), get_string('sessionupdated','attforblock'));
}
break;
}

33
styles.css

File diff suppressed because one or more lines are too long

52
take.php

@ -0,0 +1,52 @@
<?php
require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php');
$pageparams = new att_take_page_params();
$id = required_param('id', PARAM_INT);
$pageparams->sessionid = required_param('sessionid', PARAM_INT);
$pageparams->grouptype = required_param('grouptype', PARAM_INT);
$pageparams->group = optional_param('group', null, PARAM_INT);
$pageparams->sort = optional_param('sort', null, PARAM_INT);
$pageparams->copyfrom = optional_param('copyfrom', null, PARAM_INT);
$pageparams->view_mode = optional_param('view', null, PARAM_INT);
$pageparams->gridcols = optional_param('gridcols', null, PARAM_INT);
$cm = get_coursemodule_from_id('attforblock', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$att = $DB->get_record('attforblock', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, true, $cm);
$pageparams->init($course->id);
$att = new attforblock($att, $cm, $course, $PAGE->context, $pageparams);
if ($formdata = data_submitted()) {
$att->take_from_form_data($formdata);
}
$PAGE->set_url($att->url_take());
$PAGE->set_title($course->shortname. ": ".$att->name);
$PAGE->set_heading($course->fullname);
$PAGE->set_cacheable(true);
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'attforblock'));
$PAGE->navbar->add($att->name);
$output = $PAGE->get_renderer('mod_attforblock');
$tabs = new attforblock_tabs($att);
$sesstable = new attforblock_take_data($att);
/// Output starts here
echo $output->header();
echo $output->heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname);
echo $output->render($tabs);
echo $output->render($sesstable);
echo $output->footer();
?>
Loading…
Cancel
Save