Browse Source

Implemented take.php (previously attendance.php)

MOODLE_23_STABLE
Artem Andreev 14 years ago
parent
commit
1ee0f2cf30
  1. 80
      locallib.php
  2. 31
      renderables.php
  3. 308
      renderer.php
  4. 44
      styles.css
  5. 2
      take.php
  6. 2
      view.php

80
locallib.php

@ -234,6 +234,7 @@ class att_take_page_params {
public $gridcols; public $gridcols;
public function init() { public function init() {
if (!isset($this->group)) $this->group = 0;
if (!isset($this->sort)) $this->sort = self::SORT_LASTNAME; if (!isset($this->sort)) $this->sort = self::SORT_LASTNAME;
$this->init_view_mode(); $this->init_view_mode();
$this->init_gridcols(); $this->init_gridcols();
@ -262,8 +263,8 @@ class att_take_page_params {
$params['sessionid'] = $this->sessionid; $params['sessionid'] = $this->sessionid;
$params['grouptype'] = $this->grouptype; $params['grouptype'] = $this->grouptype;
if (isset($this->group)) $params['group'] = $this->group; if ($this->group) $params['group'] = $this->group;
$params['sort'] = $this->sort; if ($this->sort != self::SORT_LASTNAME) $params['sort'] = $this->sort;
if (isset($this->copyfrom)) $params['copyfrom'] = $this->copyfrom; if (isset($this->copyfrom)) $params['copyfrom'] = $this->copyfrom;
return $params; return $params;
@ -346,25 +347,75 @@ class attforblock {
} }
/** /**
* Returns today sessions for this attendance * Returns current sessions for this attendance
* *
* Fetches data from {attendance_sessions} * Fetches data from {attendance_sessions}
* *
* @return array of records or an empty array * @return array of records or an empty array
*/ */
public function get_today_sessions() { public function get_current_sessions() {
global $DB; global $DB;
$today = time(); // because we compare with database, we don't need to use usertime() $today = time(); // because we compare with database, we don't need to use usertime()
$sql = "SELECT id, groupid, lasttaken $sql = "SELECT *
FROM {attendance_sessions} FROM {attendance_sessions}
WHERE :time BETWEEN sessdate AND (sessdate + duration) WHERE :time BETWEEN sessdate AND (sessdate + duration)
AND courseid = :cid AND attendanceid = :aid"; AND attendanceid = :aid";
$params = array(
'time' => $today,
'aid' => $this->id);
return $DB->get_records_sql($sql, $params);
}
/**
* Returns today sessions for this attendance
*
* Fetches data from {attendance_sessions}
*
* @return array of records or an empty array
*/
public function get_today_sessions() {
global $DB;
$start = usergetmidnight(time());
$end = $start + DAYSECS;
$sql = "SELECT *
FROM {attendance_sessions}
WHERE sessdate >= :start AND sessdate < :end
AND attendanceid = :aid";
$params = array( $params = array(
'time' => $today, 'start' => $start,
'cid' => $this->course->id, 'end' => $end,
'aid' => $this->id); 'aid' => $this->id);
return $DB->get_records_sql($sql, $params);
}
/**
* Returns today sessions suitable for copying attendance log
*
* Fetches data from {attendance_sessions}
*
* @return array of records or an empty array
*/
public function get_today_sessions_for_copy($sess) {
global $DB;
$start = usergetmidnight($sess->sessdate);
$sql = "SELECT *
FROM {attendance_sessions}
WHERE sessdate >= :start AND sessdate <= :end AND
(groupid = 0 OR groupid = :groupid) AND
lasttaken > 0 AND attendanceid = :aid";
$params = array(
'start' => $start,
'end' => $sess->sessdate,
'groupid' => $sess->groupid,
'aid' => $this->id);
return $DB->get_records_sql($sql, $params); return $DB->get_records_sql($sql, $params);
} }
@ -400,7 +451,7 @@ class attforblock {
* @return moodle_url of sessions.php for attendance instance * @return moodle_url of sessions.php for attendance instance
*/ */
public function url_sessions($params=array()) { public function url_sessions($params=array()) {
$params = array('id' => $this->cm->id) + $params; $params = array_merge(array('id' => $this->cm->id), $params);
return new moodle_url('/mod/attforblock/sessions.php', $params); return new moodle_url('/mod/attforblock/sessions.php', $params);
} }
@ -436,11 +487,18 @@ class attforblock {
return new moodle_url('/mod/attforblock/take.php', $params); return new moodle_url('/mod/attforblock/take.php', $params);
} }
public function url_view($params=array()) {
$params = array_merge(array('id' => $this->cm->id), $params);
return new moodle_url('/mod/attforblock/view.php', $params);
}
private function calc_groupmode_sessgroupslist_currentgroup(){ private function calc_groupmode_sessgroupslist_currentgroup(){
global $USER, $SESSION; global $USER, $SESSION;
$cm = $this->cm; $cm = $this->cm;
$this->get_group_mode();
if ($this->groupmode == NOGROUPS) if ($this->groupmode == NOGROUPS)
return; return;
@ -691,6 +749,8 @@ class attforblock {
if (!isset($this->sessioninfo)) if (!isset($this->sessioninfo))
$this->sessioninfo = $DB->get_record('attendance_sessions', array('id' => $sessionid)); $this->sessioninfo = $DB->get_record('attendance_sessions', array('id' => $sessionid));
$this->sessioninfo->description = file_rewrite_pluginfile_urls($this->sessioninfo->description,
'pluginfile.php', $this->context->id, 'mod_attforblock', 'session', $this->sessioninfo->id);
return $this->sessioninfo; return $this->sessioninfo;
} }

31
renderables.php

@ -280,13 +280,19 @@ class attforblock_take_data implements renderable {
public $sessionlog; public $sessionlog;
public $sessions4copy;
public $updatemode; public $updatemode;
private $urlpath; private $urlpath;
private $urlparams; private $urlparams;
private $att;
public function __construct(attforblock $att) { public function __construct(attforblock $att) {
$this->users = $att->get_users(); if ($att->pageparams->grouptype)
$this->users = $att->get_users($att->pageparams->grouptype);
else
$this->users = $att->get_users($att->pageparams->group);
$this->pageparams = $att->pageparams; $this->pageparams = $att->pageparams;
$this->perm = $att->perm; $this->perm = $att->perm;
@ -297,23 +303,40 @@ class attforblock_take_data implements renderable {
$this->statuses = $att->get_statuses(); $this->statuses = $att->get_statuses();
$this->sessioninfo = $att->get_session_info($att->pageparams->sessionid); $this->sessioninfo = $att->get_session_info($att->pageparams->sessionid);
$this->updatemode = $this->sessioninfo->lasttaken > 0;
if (isset($att->pageparams->copyfrom))
$this->sessionlog = $att->get_session_log($att->pageparams->copyfrom);
elseif ($this->updatemode)
$this->sessionlog = $att->get_session_log($att->pageparams->sessionid);
else
$this->sessionlog = array();
$this->sessionlog = $att->get_session_log($att->pageparams->sessionid);
if (!$this->updatemode)
$this->sessions4copy = $att->get_today_sessions_for_copy($this->sessioninfo);
$this->urlpath = $att->url_take()->out_omit_querystring(); $this->urlpath = $att->url_take()->out_omit_querystring();
$params = $att->pageparams->get_significant_params(); $params = $att->pageparams->get_significant_params();
$params['id'] = $att->cm->id; $params['id'] = $att->cm->id;
$this->urlparams = $params; $this->urlparams = $params;
$this->updatemode =$this->sessioninfo->lasttaken > 0; $this->att = $att;
} }
public function url($params=array()) { public function url($params=array(), $excludeparams=array()) {
$params = array_merge($this->urlparams, $params); $params = array_merge($this->urlparams, $params);
foreach ($excludeparams as $paramkey)
unset($params[$paramkey]);
return new moodle_url($this->urlpath, $params); return new moodle_url($this->urlpath, $params);
} }
public function url_view($params=array()) {
return new moodle_url($this->att->url_view($params), $params);
}
public function url_path() { public function url_path() {
return $this->urlpath; return $this->urlpath;
} }

308
renderer.php

@ -170,54 +170,60 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$i = 0; $i = 0;
foreach ($sessdata->sessions as $key => $sess) { foreach ($sessdata->sessions as $key => $sess) {
$i++; $i++;
$actions = '';
$desc = empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description; $dta = $this->construct_date_time_actions($sessdata, $sess);
$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');
$date = html_writer::link($url, $date, array('title' => $title));
$time = html_writer::link($url, $time, array('title' => $title));
} else {
$date = '<i>' . $date . '</i>';
$time = '<i>' . $time . '</i>';
}
} else {
if ($sessdata->perm->can_take()) {
$url = $sessdata->url_take($sess->id, $sess->groupid);
$title = get_string('takeattendance','attforblock');
$actions = $this->output->action_icon($url, new pix_icon('t/go', $title));
}
}
if($sessdata->perm->can_manage()) {
$url = $sessdata->url_sessions($sess->id, att_sessions_page_params::ACTION_UPDATE);
$title = get_string('editsession','attforblock');
$actions .= $this->output->action_icon($url, new pix_icon('t/edit', $title));
$url = $sessdata->url_sessions($sess->id, att_sessions_page_params::ACTION_DELETE);
$title = get_string('deletesession','attforblock');
$actions .= $this->output->action_icon($url, new pix_icon('t/delete', $title));
}
$table->data[$sess->id][] = $i; $table->data[$sess->id][] = $i;
$table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attforblock'); $table->data[$sess->id][] = $sess->groupid ? $sessdata->groups[$sess->groupid]->name : get_string('commonsession', 'attforblock');
$table->data[$sess->id][] = $date; $table->data[$sess->id][] = $dta['date'];
$table->data[$sess->id][] = $time; $table->data[$sess->id][] = $dta['time'];
$table->data[$sess->id][] = $desc; $table->data[$sess->id][] = empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description;
$table->data[$sess->id][] = $actions; $table->data[$sess->id][] = $dta['actions'];
$table->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false); $table->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false);
} }
return html_writer::table($table); return html_writer::table($table);
} }
private function construct_date_time_actions(attforblock_sessions_manage_data $sessdata, $sess) {
$actions = '';
$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');
$date = html_writer::link($url, $date, array('title' => $title));
$time = html_writer::link($url, $time, array('title' => $title));
} else {
$date = '<i>' . $date . '</i>';
$time = '<i>' . $time . '</i>';
}
} else {
if ($sessdata->perm->can_take()) {
$url = $sessdata->url_take($sess->id, $sess->groupid);
$title = get_string('takeattendance','attforblock');
$actions = $this->output->action_icon($url, new pix_icon('t/go', $title));
}
}
if($sessdata->perm->can_manage()) {
$url = $sessdata->url_sessions($sess->id, att_sessions_page_params::ACTION_UPDATE);
$title = get_string('editsession','attforblock');
$actions .= $this->output->action_icon($url, new pix_icon('t/edit', $title));
$url = $sessdata->url_sessions($sess->id, att_sessions_page_params::ACTION_DELETE);
$title = get_string('deletesession','attforblock');
$actions .= $this->output->action_icon($url, new pix_icon('t/delete', $title));
}
return array('date' => $date, 'time' => $time, 'actions' => $actions);
}
protected function render_sess_control_table(attforblock_sessions_manage_data $sessdata) { protected function render_sess_control_table(attforblock_sessions_manage_data $sessdata) {
$table = new html_table(); $table = new html_table();
$table->attributes['class'] = ' '; $table->attributes['class'] = ' ';
@ -248,31 +254,99 @@ class mod_attforblock_renderer extends plugin_renderer_base {
} }
protected function render_attforblock_take_data(attforblock_take_data $takedata) { protected function render_attforblock_take_data(attforblock_take_data $takedata) {
$controls = ''; $controls = $this->render_attforblock_take_controls($takedata);
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); if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_LIST)
$table = $this->render_attforblock_take_list($takedata);
$table = $this->render_attforblock_take_list($takedata); else
$table = $this->render_attforblock_take_grid($takedata);
$table .= html_writer::input_hidden_params($takedata->url()); $table .= html_writer::input_hidden_params($takedata->url());
$params = array( $params = array(
'type' => 'submit', 'type' => 'submit',
'value' => get_string('save','attforblock')); 'value' => get_string('save','attforblock'));
$table .= html_writer::tag('center', html_writer::empty_tag('input', $params)); $table .= html_writer::tag('center', html_writer::empty_tag('input', $params));
$table = html_writer::tag('form', $table, array('method' => 'post', 'action' => $takedata->url_path())); $table = html_writer::tag('form', $table, array('method' => 'post', 'action' => $takedata->url_path()));
return $table;
return $controls.$table;
} }
protected function render_attforblock_take_controls(attforblock_take_data $takedata) {
$table = new html_table();
$table->attributes['class'] = ' ';
$table->data[0][] = $this->construct_take_session_info($takedata);
$table->data[0][] = $this->construct_take_controls($takedata);
return $this->output->container(html_writer::table($table), 'generalbox takecontrols');
}
private function construct_take_session_info(attforblock_take_data $takedata) {
$sess = $takedata->sessioninfo;
$date = userdate($sess->sessdate, get_string('strftimedate'));
$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 : ''));
$sessinfo = $date.' '.$time;
$sessinfo .= html_writer::empty_tag('br');
$sessinfo .= html_writer::empty_tag('br');
$sessinfo .= empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description;
return $sessinfo;
}
private function construct_take_controls(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::empty_tag('br');
$options = array(
att_take_page_params::SORTED_LIST => get_string('sortedlist','attforblock'),
att_take_page_params::SORTED_GRID => get_string('sortedgrid','attforblock'));
$select = new single_select($takedata->url(), 'viewmode', $options, $takedata->pageparams->viewmode, NULL);
$select->set_label(get_string('viewmode','attforblock'));
$select->class = 'singleselect inline';
$controls .= $this->output->render($select);
if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_GRID) {
$options = array (1 => '1 '.get_string('column','attforblock'),'2 '.get_string('columns','attforblock'),'3 '.get_string('columns','attforblock'),
'4 '.get_string('columns','attforblock'),'5 '.get_string('columns','attforblock'),'6 '.get_string('columns','attforblock'),
'7 '.get_string('columns','attforblock'),'8 '.get_string('columns','attforblock'),'9 '.get_string('columns','attforblock'),
'10 '.get_string('columns','attforblock'));
$select = new single_select($takedata->url(), 'gridcols', $options, $takedata->pageparams->gridcols, NULL);
$select->class = 'singleselect inline';
$controls .= $this->output->render($select);
}
if (count($takedata->sessions4copy) > 1) {
$controls .= html_writer::empty_tag('br');
$controls .= html_writer::empty_tag('br');
$options = array();
foreach ($takedata->sessions4copy as $sess) {
$start = userdate($sess->sessdate, get_string('strftimehm', 'attforblock'));
$end = $sess->duration ? ' - '.userdate($sess->sessdate + $sess->duration, get_string('strftimehm', 'attforblock')) : '';
$options[$sess->id] = $start . $end;
}
$select = new single_select($takedata->url(array(), array('copyfrom')), 'copyfrom', $options);
$select->set_label(get_string('copyfrom','attforblock'));
$select->class = 'singleselect inline';
$controls .= $this->output->render($select);
}
return $controls;
}
protected function render_attforblock_take_list(attforblock_take_data $takedata) { protected function render_attforblock_take_list(attforblock_take_data $takedata) {
$table = new html_table(); $table = new html_table();
$table->width = '0%'; $table->width = '0%';
$table->head = array( $table->head = array(
'#', '#',
$this->get_fullname_head($takedata) $this->construct_fullname_head($takedata)
); );
$table->align = array('left', 'left'); $table->align = array('left', 'left');
$table->size = array('20px', ''); $table->size = array('20px', '');
@ -285,56 +359,76 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$table->head[] = get_string('remarks', 'attforblock'); $table->head[] = get_string('remarks', 'attforblock');
$table->align[] = 'center'; $table->align[] = 'center';
$table->size[] = '20px'; $table->size[] = '20px';
$table->attributes['class'] = 'generaltable taketable'; $table->attributes['class'] = 'generaltable takelist';
$i = 0; $i = 0;
foreach ($takedata->users as $user) { foreach ($takedata->users as $user) {
$i++; $i++;
$row = new html_table_row(); $row = new html_table_row();
$row->cells[] = $i; $row->cells[] = $i;
$row->cells[] = $this->output->render(new user_picture($user)).fullname($user); $fullname = html_writer::link($takedata->url_view(array('student' => $user->id)), fullname($user));
if ($user->enrolmentstart > $takedata->sessioninfo->sessdate) { $row->cells[] = $this->output->render(new user_picture($user)).$fullname;
$cell = new html_table_cell(get_string('enrolmentstart', 'attforblock', userdate($user->enrolmentstart, '%d.%m.%Y')));
$cell->colspan = count($takedata->statuses) + 1; $celldata = $this->construct_take_user_controls($takedata, $user);
$row->cells[] = $cell; if (array_key_exists('colspan', $celldata)) {
$row->attributes['class'] = 'userwithoutenrol'; $cell = new html_table_cell($celldata['text']);
} $cell->colspan = $celldata['colspan'];
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->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'] = else
$row->cells = array_merge($row->cells, $celldata['text']);
if (array_key_exists('class', $celldata)) $row->attributes['class'] = $celldata['class'];
$table->data[] = $row; $table->data[] = $row;
} }
return html_writer::table($table); return html_writer::table($table);
}
protected function render_attforblock_take_grid(attforblock_take_data $takedata) {
$table = new html_table();
for ($i=0; $i < $takedata->pageparams->gridcols; $i++) {
$table->align[] = 'center';
$table->size[] = '110px';
}
$table->attributes['class'] = 'generaltable takegrid';
$table->headspan = $takedata->pageparams->gridcols;
$head = array();
foreach ($takedata->statuses as $st) {
$head[] = html_writer::link("javascript:select_all_in(null, 'st" . $st->id . "', null);", $st->acronym, array('title' => get_string('setallstatusesto', 'attforblock', $st->description)));
}
$table->head[] = implode('&nbsp;&nbsp;', $head);
$i = 0;
$row = new html_table_row();
foreach($takedata->users as $user) {
$userpict = new user_picture($user);
$userpict->size = 100;
$celltext = $this->output->render($userpict);
$celltext .= html_writer::empty_tag('br');
$fullname = html_writer::link($takedata->url_view(array('student' => $user->id)), fullname($user));
$celltext .= html_writer::tag('span', $fullname, array('class' => 'fullname'));
$celltext .= html_writer::empty_tag('br');
$celldata = $this->construct_take_user_controls($takedata, $user);
$celltext .= is_array($celldata['text']) ? implode('', $celldata['text']) : $celldata['text'];
$cell = new html_table_cell($celltext);
if (array_key_exists('class', $celldata)) $cell->attributes['class'] = $celldata['class'];
$row->cells[] = $cell;
$i++;
if ($i % $takedata->pageparams->gridcols == 0) {
$table->data[] = $row;
$row = new html_table_row();
}
}
if ($i % $takedata->pageparams->gridcols > 0) $table->data[] = $row;
return html_writer::table($table);
} }
private function get_fullname_head(attforblock_take_data $takedata) { private function construct_fullname_head(attforblock_take_data $takedata) {
global $CFG; global $CFG;
if ($takedata->pageparams->sort == att_take_page_params::SORT_LASTNAME) if ($takedata->pageparams->sort == att_take_page_params::SORT_LASTNAME)
@ -356,5 +450,49 @@ class mod_attforblock_renderer extends plugin_renderer_base {
return $fullnamehead; return $fullnamehead;
} }
private function construct_take_user_controls(attforblock_take_data $takedata, $user) {
$celldata = array();
if ($user->enrolmentstart > $takedata->sessioninfo->sessdate) {
$celldata['text'] = get_string('enrolmentstart', 'attforblock', userdate($user->enrolmentstart, '%d.%m.%Y'));
$celldata['colspan'] = count($takedata->statuses) + 1;
$celldata['class'] = 'userwithoutenrol';
}
elseif ($user->enrolmentstatus == ENROL_USER_SUSPENDED) {
$celldata['text'] = get_string('enrolmentsuspended', 'attforblock');
$celldata['colspan'] = count($takedata->statuses) + 1;
$celldata['class'] = 'userwithoutenrol';
}
else {
if ($takedata->updatemode and !array_key_exists($user->id, $takedata->sessionlog))
$celldata['class'] = 'userwithoutdata';
$celldata['text'] = array();
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'] = '';
$input = html_writer::empty_tag('input', $params);
if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_LIST)
$celldata['text'][] = $input;
else {
$celldata['text'][] = html_writer::tag('nobr', $input . $st->acronym);
}
}
$params = array(
'type' => 'text',
'name' => 'remarks'.$user->id);
if (array_key_exists($user->id, $takedata->sessionlog))
$params['value'] = $takedata->sessionlog[$user->id]->remarks;
$celldata['text'][] = html_writer::empty_tag('input', $params);
}
return $celldata;
}
} }
?> ?>

44
styles.css

@ -39,36 +39,66 @@
color: red; color: red;
} }
.path-mod-attforblock .taketable td { .path-mod-attforblock .takelist td {
vertical-align: middle; vertical-align: middle;
} }
.path-mod-attforblock .taketable .userpicture { .path-mod-attforblock .takelist .userpicture {
margin:0 3px; margin:0 3px;
vertical-align:middle; vertical-align:middle;
} }
.path-mod-attforblock #mod-attforblock-attendances table.controls { .path-mod-attforblock .takegrid input {
margin: 0px 3px 0px 6px;
}
.path-mod-attforblock .takegrid .fullname {
font-size: 0.8em;
}
.path-mod-attforblock table.controls {
width: 100%; width: 100%;
text-align: center; text-align: center;
} }
.path-mod-attforblock #mod-attforblock-attendances table.controls tr { .path-mod-attforblock table.controls tr {
vertical-align: top; vertical-align: top;
} }
.path-mod-attforblock #mod-attforblock-attendances table.controls td.right, .path-mod-attforblock table.controls td.right,
.path-mod-attforblock #mod-attforblock-attendances table.controls td.left { .path-mod-attforblock table.controls td.left {
padding-bottom: 4px; padding-bottom: 4px;
padding-left: 4px; padding-left: 4px;
padding-right: 4px; padding-right: 4px;
padding-top: 4px; padding-top: 4px;
} }
.path-mod-attforblock #mod-attforblock-attendances table.controls .right { .path-mod-attforblock table.controls .right {
text-align: right; text-align: right;
} }
/* for IE7*/ /* for IE7*/
.path-mod-attforblock .filtercontrols td { .path-mod-attforblock .filtercontrols td {
padding:6px; padding:6px;
} }
.path-mod-attforblock .takecontrols {
width: 800px;
margin: 0px auto 20px auto;
}
.path-mod-attforblock .takecontrols table{
margin: 0px auto;
}
.path-mod-attforblock .takecontrols .c0 {
width: 500px;
text-align: left;
}
.path-mod-attforblock .takecontrols .c1 {
text-align: right;
}
.path-mod-attforblock .inline,
.path-mod-attforblock .inline form,
.path-mod-attforblock .inline div {
display: inline;
}

2
take.php

@ -11,7 +11,7 @@ $pageparams->grouptype = required_param('grouptype', PARAM_INT);
$pageparams->group = optional_param('group', null, PARAM_INT); $pageparams->group = optional_param('group', null, PARAM_INT);
$pageparams->sort = optional_param('sort', null, PARAM_INT); $pageparams->sort = optional_param('sort', null, PARAM_INT);
$pageparams->copyfrom = optional_param('copyfrom', null, PARAM_INT); $pageparams->copyfrom = optional_param('copyfrom', null, PARAM_INT);
$pageparams->view_mode = optional_param('view', null, PARAM_INT); $pageparams->viewmode = optional_param('viewmode', null, PARAM_INT);
$pageparams->gridcols = optional_param('gridcols', null, PARAM_INT); $pageparams->gridcols = optional_param('gridcols', null, PARAM_INT);
$cm = get_coursemodule_from_id('attforblock', $id, 0, false, MUST_EXIST); $cm = get_coursemodule_from_id('attforblock', $id, 0, false, MUST_EXIST);

2
view.php

@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php'); require_once(dirname(__FILE__).'/locallib.php');
$id = required_param('id', PARAM_INT); // Course Module ID, or $id = required_param('id', PARAM_INT); // Course Module ID, or
$studentid = optional_param('student', 0, PARAM_INT); $student = optional_param('student', 0, PARAM_INT);
$printing = optional_param('printing', 0, PARAM_INT); $printing = optional_param('printing', 0, PARAM_INT);
$mode = optional_param('mode', 'thiscourse', PARAM_ALPHA); $mode = optional_param('mode', 'thiscourse', PARAM_ALPHA);
$view = optional_param('view', NULL, PARAM_INT); // which page to show $view = optional_param('view', NULL, PARAM_INT); // which page to show

Loading…
Cancel
Save