From 1ee0f2cf30c3500b73658113daa83079dd83d299 Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Sat, 4 Jun 2011 16:57:17 +0400 Subject: [PATCH] Implemented take.php (previously attendance.php) --- locallib.php | 80 +++++++++++-- renderables.php | 31 ++++- renderer.php | 308 +++++++++++++++++++++++++++++++++++------------- styles.css | 44 +++++-- take.php | 2 +- view.php | 2 +- 6 files changed, 359 insertions(+), 108 deletions(-) diff --git a/locallib.php b/locallib.php index 37ab9f0..b2969ab 100644 --- a/locallib.php +++ b/locallib.php @@ -234,6 +234,7 @@ class att_take_page_params { public $gridcols; public function init() { + if (!isset($this->group)) $this->group = 0; if (!isset($this->sort)) $this->sort = self::SORT_LASTNAME; $this->init_view_mode(); $this->init_gridcols(); @@ -262,8 +263,8 @@ class att_take_page_params { $params['sessionid'] = $this->sessionid; $params['grouptype'] = $this->grouptype; - if (isset($this->group)) $params['group'] = $this->group; - $params['sort'] = $this->sort; + if ($this->group) $params['group'] = $this->group; + if ($this->sort != self::SORT_LASTNAME) $params['sort'] = $this->sort; if (isset($this->copyfrom)) $params['copyfrom'] = $this->copyfrom; 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} * * @return array of records or an empty array */ - public function get_today_sessions() { + public function get_current_sessions() { global $DB; $today = time(); // because we compare with database, we don't need to use usertime() - $sql = "SELECT id, groupid, lasttaken + $sql = "SELECT * FROM {attendance_sessions} 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( - 'time' => $today, - 'cid' => $this->course->id, - 'aid' => $this->id); + 'start' => $start, + 'end' => $end, + '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); } @@ -400,7 +451,7 @@ class attforblock { * @return moodle_url of sessions.php for attendance instance */ 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); } @@ -436,11 +487,18 @@ class attforblock { 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(){ global $USER, $SESSION; $cm = $this->cm; + $this->get_group_mode(); + if ($this->groupmode == NOGROUPS) return; @@ -691,6 +749,8 @@ class attforblock { if (!isset($this->sessioninfo)) $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; } diff --git a/renderables.php b/renderables.php index d991781..ab2e178 100644 --- a/renderables.php +++ b/renderables.php @@ -280,13 +280,19 @@ class attforblock_take_data implements renderable { public $sessionlog; + public $sessions4copy; + public $updatemode; private $urlpath; private $urlparams; + private $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->perm = $att->perm; @@ -297,23 +303,40 @@ class attforblock_take_data implements renderable { $this->statuses = $att->get_statuses(); $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(); $params = $att->pageparams->get_significant_params(); $params['id'] = $att->cm->id; $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); + foreach ($excludeparams as $paramkey) + unset($params[$paramkey]); + 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() { return $this->urlpath; } diff --git a/renderer.php b/renderer.php index 960a7dc..d0bda45 100644 --- a/renderer.php +++ b/renderer.php @@ -170,54 +170,60 @@ class mod_attforblock_renderer extends plugin_renderer_base { $i = 0; foreach ($sessdata->sessions as $key => $sess) { $i++; - $actions = ''; - $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'); - - $date = html_writer::link($url, $date, array('title' => $title)); - $time = html_writer::link($url, $time, array('title' => $title)); - } else { - $date = '' . $date . ''; - $time = '' . $time . ''; - } - } 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)); - } + + $dta = $this->construct_date_time_actions($sessdata, $sess); $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][] = $dta['date']; + $table->data[$sess->id][] = $dta['time']; + $table->data[$sess->id][] = empty($sess->description) ? get_string('nodescription', 'attforblock') : $sess->description; + $table->data[$sess->id][] = $dta['actions']; $table->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false); } 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 = '' . $date . ''; + $time = '' . $time . ''; + } + } 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) { $table = new html_table(); $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) { - $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 = $this->render_attforblock_take_controls($takedata); - $controls = html_writer::tag('div', $controls); - - $table = $this->render_attforblock_take_list($takedata); + if ($takedata->pageparams->viewmode == att_take_page_params::SORTED_LIST) + $table = $this->render_attforblock_take_list($takedata); + else + $table = $this->render_attforblock_take_grid($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; + + 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) { $table = new html_table(); $table->width = '0%'; $table->head = array( '#', - $this->get_fullname_head($takedata) + $this->construct_fullname_head($takedata) ); $table->align = array('left', 'left'); $table->size = array('20px', ''); @@ -285,56 +359,76 @@ class mod_attforblock_renderer extends plugin_renderer_base { $table->head[] = get_string('remarks', 'attforblock'); $table->align[] = 'center'; $table->size[] = '20px'; - $table->attributes['class'] = 'generaltable taketable'; + $table->attributes['class'] = 'generaltable takelist'; $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; + $fullname = html_writer::link($takedata->url_view(array('student' => $user->id)), fullname($user)); + $row->cells[] = $this->output->render(new user_picture($user)).$fullname; + + $celldata = $this->construct_take_user_controls($takedata, $user); + if (array_key_exists('colspan', $celldata)) { + $cell = new html_table_cell($celldata['text']); + $cell->colspan = $celldata['colspan']; $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; } + 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('  ', $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; if ($takedata->pageparams->sort == att_take_page_params::SORT_LASTNAME) @@ -356,5 +450,49 @@ class mod_attforblock_renderer extends plugin_renderer_base { 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; + } + } ?> diff --git a/styles.css b/styles.css index e1f410e..53c684d 100644 --- a/styles.css +++ b/styles.css @@ -39,36 +39,66 @@ color: red; } -.path-mod-attforblock .taketable td { +.path-mod-attforblock .takelist td { vertical-align: middle; } -.path-mod-attforblock .taketable .userpicture { +.path-mod-attforblock .takelist .userpicture { margin:0 3px; 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%; text-align: center; } -.path-mod-attforblock #mod-attforblock-attendances table.controls tr { +.path-mod-attforblock table.controls tr { vertical-align: top; } -.path-mod-attforblock #mod-attforblock-attendances table.controls td.right, -.path-mod-attforblock #mod-attforblock-attendances table.controls td.left { +.path-mod-attforblock table.controls td.right, +.path-mod-attforblock table.controls td.left { padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; } -.path-mod-attforblock #mod-attforblock-attendances table.controls .right { +.path-mod-attforblock table.controls .right { text-align: right; } /* for IE7*/ .path-mod-attforblock .filtercontrols td { 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; +} + diff --git a/take.php b/take.php index d7a1469..154c5fe 100644 --- a/take.php +++ b/take.php @@ -11,7 +11,7 @@ $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->viewmode = optional_param('viewmode', null, PARAM_INT); $pageparams->gridcols = optional_param('gridcols', null, PARAM_INT); $cm = get_coursemodule_from_id('attforblock', $id, 0, false, MUST_EXIST); diff --git a/view.php b/view.php index f88fa30..c916119 100644 --- a/view.php +++ b/view.php @@ -13,7 +13,7 @@ require_once(dirname(__FILE__).'/../../config.php'); require_once(dirname(__FILE__).'/locallib.php'); $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); $mode = optional_param('mode', 'thiscourse', PARAM_ALPHA); $view = optional_param('view', NULL, PARAM_INT); // which page to show