Browse Source

Implemented button date picker through YUI calendar + some refactoring of renderer.php and locallib.php

MOODLE_23_STABLE
Artem Andreev 14 years ago
parent
commit
61349c25a0
  1. 12
      calendar.js
  2. 4
      lang/en/attforblock.php
  3. 4
      lang/ru/attforblock.php
  4. 252
      locallib.php
  5. 14
      manage.php
  6. 98
      renderer.php
  7. 4
      styles.css

12
calendar.js

@ -34,7 +34,7 @@ YAHOO.util.Event.onDOMReady(function(){
dialog = new YAHOO.widget.Dialog("container", { dialog = new YAHOO.widget.Dialog("container", {
visible:false, visible:false,
context:["show", "tl", "bl"], context:["show", "tl", "bl"],
buttons:[{text: cal_today, handler: resetHandler, isDefault:true}, {text: cal_close, handler: closeHandler}], buttons:[{text: M.str.attforblock.caltoday, handler: resetHandler, isDefault:true}, {text: M.str.attforblock.calclose, handler: closeHandler}],
draggable:false, draggable:false,
close:false close:false
}); });
@ -60,16 +60,16 @@ YAHOO.util.Event.onDOMReady(function(){
hide_blank_weeks:true // Enable, to demonstrate how we handle changing height, using changeContent hide_blank_weeks:true // Enable, to demonstrate how we handle changing height, using changeContent
}); });
calendar.cfg.setProperty("start_weekday", cal_start_weekday); calendar.cfg.setProperty("start_weekday", M.attforblock.cal_start_weekday);
calendar.cfg.setProperty("MONTHS_LONG", cal_months); calendar.cfg.setProperty("MONTHS_LONG", M.attforblock.cal_months);
calendar.cfg.setProperty("WEEKDAYS_SHORT", cal_week_days); calendar.cfg.setProperty("WEEKDAYS_SHORT", M.attforblock.cal_week_days);
calendar.select(new Date(cal_cur_date*1000)); calendar.select(new Date(M.attforblock.cal_cur_date*1000));
calendar.render(); calendar.render();
calendar.selectEvent.subscribe(function() { calendar.selectEvent.subscribe(function() {
if (calendar.getSelectedDates().length > 0) { if (calendar.getSelectedDates().length > 0) {
Dom.get("current").value = calendar.getSelectedDates()[0] / 1000; Dom.get("curdate").value = calendar.getSelectedDates()[0] / 1000;
Dom.get("currentdate").submit(); Dom.get("currentdate").submit();
} }

4
lang/en/attforblock.php

@ -34,10 +34,10 @@ $string['attforblock:view'] = 'Viewing Attendances';
$string['attforblock:viewreports'] = 'Viewing Reports'; $string['attforblock:viewreports'] = 'Viewing Reports';
$string['attrecords'] = 'Attendances records'; $string['attrecords'] = 'Attendances records';
$string['calclose'] = 'Close'; $string['calclose'] = 'Close';
$string['calmonths'] = '\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"'; $string['calmonths'] = 'January,February,March,April,May,June,July,August,September,October,November,December';
$string['calshow'] = 'Choose date'; $string['calshow'] = 'Choose date';
$string['caltoday'] = 'Today'; $string['caltoday'] = 'Today';
$string['calweekdays'] = ' \"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"'; $string['calweekdays'] = 'Su,Mo,Tu,We,Th,Fr,Sa';
$string['changeattendance'] = 'Change attendance'; $string['changeattendance'] = 'Change attendance';
$string['changeduration'] = 'Change duration'; $string['changeduration'] = 'Change duration';
$string['changesession'] = 'Change session'; $string['changesession'] = 'Change session';

4
lang/ru/attforblock.php

@ -32,10 +32,10 @@ $string['attforblock:view'] = 'Просмотр посещаемости';
$string['attforblock:viewreports'] = 'Просмотр отчетов'; $string['attforblock:viewreports'] = 'Просмотр отчетов';
$string['attrecords'] = 'Отметок о посещаемости'; $string['attrecords'] = 'Отметок о посещаемости';
$string['calclose'] = 'Закрыть'; $string['calclose'] = 'Закрыть';
$string['calmonths'] = '\"Январь\", \"Февраль\", \"Март\", \"Апрель\", \"Май\", \"Июнь\", \"Июль\", \"Август\", \"Сентябрь\", \"Октябрь\", \"Ноябрь\", \"Декабрь\"'; $string['calmonths'] = 'Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь,Октябрь,Ноябрь,Декабрь';
$string['calshow'] = 'Выбрать дату'; $string['calshow'] = 'Выбрать дату';
$string['caltoday'] = 'Сегодня'; $string['caltoday'] = 'Сегодня';
$string['calweekdays'] = ' \"Вс\", \"Пн\", \"Вт\", \"Ср\", \"Чт\", \"Пт\", \"Сб\"'; $string['calweekdays'] = 'Вс,Пн,Вт,Ср,Чт,Пт,Сб';
$string['changeattendance'] = 'Изменить посещаемость'; $string['changeattendance'] = 'Изменить посещаемость';
$string['changeduration'] = 'Изменить продолжительность'; $string['changeduration'] = 'Изменить продолжительность';
$string['changesession'] = 'Изменить занятие'; $string['changesession'] = 'Изменить занятие';

252
locallib.php

@ -76,10 +76,7 @@ class attforblock_permissions {
} }
} }
class attforblock { class attforblock_view_params {
const SESSION_COMMON = 1;
const SESSION_GROUP = 2;
const VIEW_DAYS = 1; const VIEW_DAYS = 1;
const VIEW_WEEKS = 2; const VIEW_WEEKS = 2;
const VIEW_MONTHS = 3; const VIEW_MONTHS = 3;
@ -93,34 +90,15 @@ class attforblock {
const SORTED_LIST = 1; const SORTED_LIST = 1;
const SORTED_GRID = 2; const SORTED_GRID = 2;
const DEFAULT_VIEW = attforblock::VIEW_WEEKS; const DEFAULT_VIEW = self::VIEW_WEEKS;
const DEFAULT_CURDATE = 0; const DEFAULT_VIEW_TAKE = self::SORTED_LIST;
const DEFAULT_VIEW_TAKE = attforblock::SORTED_LIST;
const DEFAULT_SHOWENDTIME = 0; const DEFAULT_SHOWENDTIME = 0;
/** @var stdclass course module record */
public $cm;
/** @var stdclass course record */
public $course;
/** @var stdclass context object */
public $context;
/** @var int attendance instance identifier */
public $id;
/** @var string attendance activity name */
public $name;
/** @var float number (10, 5) unsigned, the maximum grade for attendance */
public $grade;
/** @var int current view mode */ /** @var int current view mode */
public $view = self::DEFAULT_VIEW; public $view;
/** @var int $view and $curdate specify displaed date range */ /** @var int $view and $curdate specify displaed date range */
public $curdate = self::DEFAULT_CURDATE; public $curdate;
/** @var int start date of displayed date range */ /** @var int start date of displayed date range */
public $startdate; public $startdate;
@ -129,65 +107,68 @@ class attforblock {
public $enddate; public $enddate;
/** @var int view mode of taking attendance page*/ /** @var int view mode of taking attendance page*/
public $view_take = self::DEFAULT_VIEW_TAKE; public $view_take;
/** @var int whether sessions end time will be displayed on manage.php */ /** @var int whether sessions end time will be displayed on manage.php */
public $showendtime = self::DEFAULT_SHOWENDTIME; public $show_endtime;
/** @var attforblock_permissions permission of current user for attendance instance*/ public $students_sort;
public $perm;
/**
* Initializes the attendance API instance using the data from DB
*
* Makes deep copy of all passed records properties. Replaces integer $course attribute
* with a full database record (course should not be stored in instances table anyway).
*
* @param stdClass $dbrecord Attandance instance data from {attforblock} table
* @param stdClass $cm Course module record as returned by {@link get_coursemodule_from_id()}
* @param stdClass $course Course record from {course} table
* @param stdClass $context The context of the workshop instance
*/
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) {
foreach ($dbrecord as $field => $value) {
if (property_exists('attforblock', $field)) {
$this->{$field} = $value;
}
else {
throw new coding_exception('The attendance table has field for which there is no property in the attforblock class');
}
}
$this->cm = $cm;
$this->course = $course;
if (is_null($context)) {
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
} else {
$this->context = $context;
}
$this->perm = new attforblock_permissions($this->context); public $student_id;
private $courseid;
public function init_defaults($courseid) {
$this->view = self::DEFAULT_VIEW;
$this->curdate = time();
$this->view_take = self::DEFAULT_VIEW_TAKE;
$this->show_endtime = self::DEFAULT_SHOWENDTIME;
$this->courseid = $courseid;
} }
public function init_view_params($view=NULL, $curdate=NULL, $view_take=NULL, $showendtime=NULL) { public function init(attforblock_view_params $view_params) {
$this->init_view($view_params->view);
$this->init_curdate($view_params->curdate);
$this->init_view_take($view_params->view_take);
$this->init_show_endtime($view_params->show_endtime);
$this->students_sort = $view_params->students_sort;
$this->student_id = $view_params->student_id;
$this->init_start_end_date();
}
private function init_view($view) {
global $SESSION; global $SESSION;
if (isset($view)) { if (isset($view)) {
$SESSION->attcurrentattview[$this->course->id] = $view; $SESSION->attcurrentattview[$this->courseid] = $view;
$this->view = $view; $this->view = $view;
} }
elseif (isset($SESSION->attcurrentattview[$this->course->id])) { elseif (isset($SESSION->attcurrentattview[$this->courseid])) {
$this->view = $SESSION->attcurrentattview[$this->course->id]; $this->view = $SESSION->attcurrentattview[$this->courseid];
} }
}
private function init_curdate($curdate) {
global $SESSION;
if ($curdate) { if ($curdate) {
$SESSION->attcurrentattdate[$this->course->id] = $curdate; $SESSION->attcurrentattdate[$this->courseid] = $curdate;
$this->curdate = $curdate; $this->curdate = $curdate;
} }
elseif (isset($SESSION->attcurrentattdate[$this->course->id])) { elseif (isset($SESSION->attcurrentattdate[$this->courseid])) {
$this->curdate = $SESSION->attcurrentattdate[$this->course->id]; $this->curdate = $SESSION->attcurrentattdate[$this->courseid];
}
else {
$this->curdate = time();
} }
}
private function init_view_take($view_take) {
global $SESSION;
if (isset($view_take)) { if (isset($view_take)) {
set_user_preference("attforblock_view_take", $view_take); set_user_preference("attforblock_view_take", $view_take);
@ -196,16 +177,18 @@ class attforblock {
else { else {
$this->view_take = get_user_preferences("attforblock_view_take", $this->view_take); $this->view_take = get_user_preferences("attforblock_view_take", $this->view_take);
} }
}
if (isset($showendtime)) { private function init_show_endtime($show_endtime) {
set_user_preference("attforblock_showendtime", $showendtime); global $SESSION;
$this->showendtime = $showendtime;
if (isset($show_endtime)) {
set_user_preference("attforblock_showendtime", $show_endtime);
$this->show_endtime = $show_endtime;
} }
else { else {
$this->showendtime = get_user_preferences("attforblock_showendtime", $this->showendtime); $this->show_endtime = get_user_preferences("attforblock_showendtime", $this->show_endtime);
} }
$this->init_start_end_date();
} }
private function init_start_end_date() { private function init_start_end_date() {
@ -238,6 +221,68 @@ class attforblock {
break; break;
} }
} }
}
class attforblock {
const SESSION_COMMON = 1;
const SESSION_GROUP = 2;
/** @var stdclass course module record */
public $cm;
/** @var stdclass course record */
public $course;
/** @var stdclass context object */
public $context;
/** @var int attendance instance identifier */
public $id;
/** @var string attendance activity name */
public $name;
/** @var float number (10, 5) unsigned, the maximum grade for attendance */
public $grade;
/** @var attforblock_view_params view parameters current attendance instance*/
public $view_params;
/** @var attforblock_permissions permission of current user for attendance instance*/
public $perm;
/**
* Initializes the attendance API instance using the data from DB
*
* Makes deep copy of all passed records properties. Replaces integer $course attribute
* with a full database record (course should not be stored in instances table anyway).
*
* @param stdClass $dbrecord Attandance instance data from {attforblock} table
* @param stdClass $cm Course module record as returned by {@link get_coursemodule_from_id()}
* @param stdClass $course Course record from {course} table
* @param stdClass $context The context of the workshop instance
*/
public function __construct(stdclass $dbrecord, stdclass $cm, stdclass $course, stdclass $context=null) {
foreach ($dbrecord as $field => $value) {
if (property_exists('attforblock', $field)) {
$this->{$field} = $value;
}
else {
throw new coding_exception('The attendance table has field for which there is no property in the attforblock class');
}
}
$this->cm = $cm;
$this->course = $course;
if (is_null($context)) {
$this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
} else {
$this->context = $context;
}
$this->view_params = new attforblock_view_params();
$this->view_params->init_defaults($this->course->id);
$this->perm = new attforblock_permissions($this->context);
}
/** /**
* Returns today sessions for this attendance * Returns today sessions for this attendance
@ -403,49 +448,74 @@ class attforblock_filter_controls implements renderable {
/** @var int current view mode */ /** @var int current view mode */
public $view; public $view;
public $curdate;
public $prevcur; public $prevcur;
public $nextcur; public $nextcur;
public $curdatetxt; public $curdatetxt;
private $url_path;
private $url_params;
private $att; private $att;
public function __construct(attforblock $att) { public function __construct(attforblock $att) {
$this->view = $att->view; global $PAGE;
$date = usergetdate($att->curdate); $this->view = $att->view_params->view;
$this->curdate = $att->view_params->curdate;
$date = usergetdate($att->view_params->curdate);
$mday = $date['mday']; $mday = $date['mday'];
$wday = $date['wday']; $wday = $date['wday'];
$mon = $date['mon']; $mon = $date['mon'];
$year = $date['year']; $year = $date['year'];
switch ($this->view) { switch ($this->view) {
case attforblock::VIEW_DAYS: case attforblock_view_params::VIEW_DAYS:
$format = get_string('strftimedm', 'attforblock'); $format = get_string('strftimedm', 'attforblock');
$this->prevcur = make_timestamp($year, $mon, $mday - 1); $this->prevcur = make_timestamp($year, $mon, $mday - 1);
$this->nextcur = make_timestamp($year, $mon, $mday + 1); $this->nextcur = make_timestamp($year, $mon, $mday + 1);
$this->curdatetxt = userdate($att->startdate, $format); $this->curdatetxt = userdate($att->view_params->startdate, $format);
break; break;
case attforblock::VIEW_WEEKS: case attforblock_view_params::VIEW_WEEKS:
$format = get_string('strftimedm', 'attforblock'); $format = get_string('strftimedm', 'attforblock');
$this->prevcur = $att->startdate - WEEKSECS; $this->prevcur = $att->view_params->startdate - WEEKSECS;
$this->nextcur = $att->startdate + WEEKSECS; $this->nextcur = $att->view_params->startdate + WEEKSECS;
$this->curdatetxt = userdate($att->startdate, $format)." - ".userdate($att->enddate, $format); $this->curdatetxt = userdate($att->view_params->startdate, $format)." - ".userdate($att->view_params->enddate, $format);
break; break;
case attforblock::VIEW_MONTHS: case attforblock_view_params::VIEW_MONTHS:
$format = '%B'; $format = '%B';
$this->prevcur = make_timestamp($year, $mon - 1); $this->prevcur = make_timestamp($year, $mon - 1);
$this->nextcur = make_timestamp($year, $mon + 1); $this->nextcur = make_timestamp($year, $mon + 1);
$this->curdatetxt = userdate($att->startdate, $format); $this->curdatetxt = userdate($att->view_params->startdate, $format);
break; break;
} }
$this->url_path = $PAGE->url->out_omit_querystring();
$params = array('id' => $att->cm->id);
if (isset($att->view_params->students_sort)) $params['sort'] = $att->view_params->students_sort;
if (isset($att->view_params->student_id)) $params['studentid'] = $att->view_params->student_id;
$this->url_params = $params;
$this->att = $att; $this->att = $att;
} }
public function url($params=NULL) { public function url($params=array()) {
global $PAGE; $params = array_merge($this->url_params, $params);
return new moodle_url($this->url_path, $params);
}
public function url_path() {
return $this->url_path;
}
public function url_params($params=array()) {
$params = array_merge($this->url_params, $params);
return new moodle_url($PAGE->url, $params); return $params;
} }
} }
@ -488,10 +558,10 @@ class attforblock_sessions_manage_data implements renderable {
$this->perm = $att->perm; $this->perm = $att->perm;
$this->showendtime = $att->showendtime; $this->showendtime = $att->view_params->show_endtime;
$this->startdate = $att->startdate; $this->startdate = $att->view_params->startdate;
$this->enddate = $att->enddate; $this->enddate = $att->view_params->enddate;
if ($this->startdate && $this->enddate) { if ($this->startdate && $this->enddate) {
$where = "courseid=:cid AND attendanceid = :aid AND sessdate >= :csdate AND sessdate >= :sdate AND sessdate < :edate"; $where = "courseid=:cid AND attendanceid = :aid AND sessdate >= :csdate AND sessdate >= :sdate AND sessdate < :edate";

14
manage.php

@ -12,11 +12,13 @@
require_once(dirname(__FILE__).'/../../config.php'); require_once(dirname(__FILE__).'/../../config.php');
require_once(dirname(__FILE__).'/locallib.php'); require_once(dirname(__FILE__).'/locallib.php');
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or $view_params = new attforblock_view_params();
$from = optional_param('from', NULL, PARAM_ACTION);
$view = optional_param('view', NULL, PARAM_INT); // which page to show $id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
$curdate = optional_param('curdate', 0, PARAM_INT); $from = optional_param('from', NULL, PARAM_ACTION);
$showendtime = optional_param('showendtime', NULL, PARAM_INT); $view_params ->view = optional_param('view', NULL, PARAM_INT); // which page to show
$view_params ->curdate = optional_param('curdate', NULL, PARAM_INT);
$view_params ->showendtime = optional_param('showendtime', 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);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
@ -31,7 +33,7 @@ if ($canmanage && $cantake && $canchange)
redirect("view.php?id=$cm->id"); redirect("view.php?id=$cm->id");
$att = new attforblock($att, $cm, $course, $PAGE->context); $att = new attforblock($att, $cm, $course, $PAGE->context);
$att->init_view_params($view, $curdate, NULL, $showendtime); $att->view_params->init($view_params);
// if teacher is coming from block, then check for a session exists for today // if teacher is coming from block, then check for a session exists for today
if ($from === 'block') { if ($from === 'block') {

98
renderer.php

@ -47,20 +47,68 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$filtertable->data[0][] = ''; $filtertable->data[0][] = '';
$curdatecontrols = ''; $filtertable->data[0][] = $this->render_curdate_controls($fcontrols);
$filtertable->data[0][] = $this->render_view_controls($fcontrols);
$o = html_writer::table($filtertable);
$o = $this->output->container($o, 'attfiltercontrols attwidth');
return $o;
}
private function render_curdate_controls(attforblock_filter_controls $fcontrols) {
global $CFG;
$curdate_controls = '';
if ($fcontrols->curdatetxt) { if ($fcontrols->curdatetxt) {
$curdatecontrols = html_writer::link($fcontrols->url(array('curdate' => $fcontrols->prevcur)), $this->output->larrow()); $this->page->requires->strings_for_js(array('calclose', 'caltoday'), 'attforblock');
$curdatecontrols .= $fcontrols->curdatetxt; $jsvals = array(
$curdatecontrols .= html_writer::link($fcontrols->url(array('curdate' => $fcontrols->nextcur)), $this->output->rarrow()); 'cal_months' => explode(',', get_string('calmonths','attforblock')),
//plug_yui_calendar($current); 'cal_week_days' => explode(',', get_string('calweekdays','attforblock')),
'cal_start_weekday' => $CFG->calendar_startwday,
'cal_cur_date' => $fcontrols->curdate);
$curdate_controls = html_writer::script(js_writer::set_variable('M.attforblock', $jsvals));
$this->page->requires->yui2_lib('container');
$this->page->requires->yui2_lib('calendar');
$this->page->requires->js('/mod/attforblock/calendar.js');
$curdate_controls .= html_writer::link($fcontrols->url(array('curdate' => $fcontrols->prevcur)), $this->output->larrow());
$params = array(
'title' => get_string('calshow', 'attforblock'),
'id' => 'show',
'type' => 'button');
$button_form = html_writer::tag('button', $fcontrols->curdatetxt, $params);
foreach ($fcontrols->url_params(array('curdate' => '')) as $name => $value) {
$params = array(
'type' => 'hidden',
'id' => $name,
'name' => $name,
'value' => $value);
$button_form .= html_writer::empty_tag('input', $params);
}
$params = array(
'id' => 'currentdate',
'action' => $fcontrols->url_path(),
'method' => 'post'
);
$button_form = html_writer::tag('form', $button_form, $params);
$curdate_controls .= $button_form;
$curdate_controls .= html_writer::link($fcontrols->url(array('curdate' => $fcontrols->nextcur)), $this->output->rarrow());
} }
$filtertable->data[0][] = $curdatecontrols;
$views[attforblock::VIEW_ALL] = get_string('all', 'attforblock'); return $curdate_controls;
$views[attforblock::VIEW_ALLTAKEN] = get_string('alltaken', 'attforblock'); }
$views[attforblock::VIEW_MONTHS] = get_string('months', 'attforblock');
$views[attforblock::VIEW_WEEKS] = get_string('weeks', 'attforblock'); private function render_view_controls(attforblock_filter_controls $fcontrols) {
$views[attforblock::VIEW_DAYS] = get_string('days', 'attforblock'); $views[attforblock_view_params::VIEW_ALL] = get_string('all', 'attforblock');
$views[attforblock_view_params::VIEW_ALLTAKEN] = get_string('alltaken', 'attforblock');
$views[attforblock_view_params::VIEW_MONTHS] = get_string('months', 'attforblock');
$views[attforblock_view_params::VIEW_WEEKS] = get_string('weeks', 'attforblock');
$views[attforblock_view_params::VIEW_DAYS] = get_string('days', 'attforblock');
$viewcontrols = ''; $viewcontrols = '';
foreach ($views as $key => $sview) { foreach ($views as $key => $sview) {
if ($key != $fcontrols->view) { if ($key != $fcontrols->view) {
@ -70,12 +118,8 @@ class mod_attforblock_renderer extends plugin_renderer_base {
else else
$viewcontrols .= html_writer::tag('span', $sview, array('class' => 'attcurbtn')); $viewcontrols .= html_writer::tag('span', $sview, array('class' => 'attcurbtn'));
} }
$filtertable->data[0][] = html_writer::tag('nobr', $viewcontrols);
$o = html_writer::table($filtertable);
$o = $this->output->container($o, 'attfiltercontrols attwidth');
return $o; return html_writer::tag('nobr', $viewcontrols);
} }
/** /**
@ -85,6 +129,16 @@ class mod_attforblock_renderer extends plugin_renderer_base {
* @return string html code * @return string html code
*/ */
protected function render_attforblock_sessions_manage_data(attforblock_sessions_manage_data $sessdata) { protected function render_attforblock_sessions_manage_data(attforblock_sessions_manage_data $sessdata) {
$o = $this->render_sess_manage_table($sessdata) . $this->render_sess_control_table($sessdata);
$o = html_writer::tag('form', $o, array('method' => 'post', 'action' => $sessdata->url_sessions()->out()));
$o = $this->output->container($o, 'generalbox attwidth');
$o = $this->output->container($o, 'attsessions_manage_table');
return $o;
}
private function render_sess_manage_table(attforblock_sessions_manage_data $sessdata) {
$sesstable = new html_table(); $sesstable = new html_table();
$sesstable->width = '100%'; $sesstable->width = '100%';
$sesstable->head = array( $sesstable->head = array(
@ -149,6 +203,10 @@ class mod_attforblock_renderer extends plugin_renderer_base {
$sesstable->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false); $sesstable->data[$sess->id][] = html_writer::checkbox('sessid', $sess->id, false);
} }
return html_writer::table($sesstable);
}
private function render_sess_control_table(attforblock_sessions_manage_data $sessdata) {
$controltable = new html_table(); $controltable = new html_table();
$controltable->attributes['class'] = ' '; $controltable->attributes['class'] = ' ';
$controltable->width = '100%'; $controltable->width = '100%';
@ -174,12 +232,8 @@ class mod_attforblock_renderer extends plugin_renderer_base {
} }
$controltable->data[0][] = $controls; $controltable->data[0][] = $controls;
$o = html_writer::table($sesstable) . html_writer::table($controltable); return html_writer::table($controltable);
$o = html_writer::tag('form', $o, array('method' => 'post', 'action' => $sessdata->url_sessions()->out()));
$o = $this->output->container($o, 'generalbox attwidth');
$o = $this->output->container($o, 'attsessions_manage_table');
return $o;
} }
} }
?> ?>

4
styles.css

@ -22,6 +22,10 @@
margin-left:auto; margin-left:auto;
} }
.path-mod-attforblock .attfiltercontrols #currentdate{
display: inline;
}
.path-mod-attforblock .attwidth { .path-mod-attforblock .attwidth {
width:90%; width:90%;
margin: auto; margin: auto;

Loading…
Cancel
Save