From faacb6c7fb18f15932fa1e53fc77ca9679a82eca Mon Sep 17 00:00:00 2001 From: Luis Ramon Lopez Date: Sun, 16 Jan 2011 20:18:08 +0100 Subject: [PATCH] Added "Start of period" into export tab --- CHANGES | 7 +++++++ export.php | 12 +++++++----- export_form.php | 7 ++++++- lang/en_utf8/attforblock.php | 2 ++ lang/es_utf8/attforblock.php | 4 +++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 18b2e0f..022cc9d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +2011-01-16 lrlopez + + * export.php: export_form.php: + * lang/: en_utf8/attforblock.php: es_utf8/attforblock.php: + Added "Start of period" into export tab and two new strings for + the new fields on the form. + 2011-01-15 lrlopez * db/install.xml: diff --git a/export.php b/export.php index f152d7f..7e7a7a5 100644 --- a/export.php +++ b/export.php @@ -56,11 +56,13 @@ $data->tabhead[] = get_string('lastname'); $data->tabhead[] = get_string('firstname'); - $select = "courseid = {$course->id} AND attendanceid = {$attforblock->id} AND sessdate >= {$course->startdate}"; - if (isset($fromform->includenottaken)) { - $select .= " AND sessdate <= {$fromform->sessionenddate}"; - } else { - $select .= " AND lasttaken != 0"; + $select = "courseid = {$course->id} AND attendanceid = {$attforblock->id} "; + if (!isset($fromform->includeallsessions)) { + $finalenddate = $fromform->sessionenddate + 86400; // take into account the whole day + $select .= "AND sessdate >= {$fromform->sessionstartdate} AND sessdate < {$finalenddate} "; + } + if (!isset($fromform->includenottaken)) { + $select .= " AND lasttaken != 0"; } if ($sessions = get_records_select('attendance_sessions', $select, 'sessdate ASC')) { diff --git a/export_form.php b/export_form.php index 610a7cc..c9f5869 100644 --- a/export_form.php +++ b/export_form.php @@ -59,9 +59,14 @@ class mod_attforblock_export_form extends moodleform { // $durtime[] =& MoodleQuickForm::createElement('select', 'minutes', get_string('minute', 'form'), $minutes, false, true); // $mform->addGroup($durtime, 'durtime', get_string('duration','attforblock'), array(' '), true); + $mform->addElement('checkbox', 'includeallsessions', get_string('includeall','attforblock'), get_string('yes')); + $mform->setDefault('includeallsessions', true); $mform->addElement('checkbox', 'includenottaken', get_string('includenottaken','attforblock'), get_string('yes')); + $mform->addElement('date_selector', 'sessionstartdate', get_string('startofperiod','attforblock')); + $mform->setDefault('sessionstartdate', $course->startdate); + $mform->disabledIf('sessionstartdate', 'includeallsessions', 'checked'); $mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod','attforblock')); - $mform->disabledIf('sessionenddate', 'includenottaken', 'notchecked'); + $mform->disabledIf('sessionenddate', 'includeallsessions', 'checked'); $mform->addElement('select', 'format', get_string('format'), array('excel' => get_string('downloadexcel','attforblock'), diff --git a/lang/en_utf8/attforblock.php b/lang/en_utf8/attforblock.php index ffcca82..2b88002 100644 --- a/lang/en_utf8/attforblock.php +++ b/lang/en_utf8/attforblock.php @@ -73,6 +73,7 @@ $string['gridcolumns'] = 'Grid columns'; $string['groupsession'] = 'Group'; $string['hiddensessions'] = 'Hidden sessions'; $string['identifyby'] = 'Identify student by'; +$string['includeall'] = 'Select all sessions'; $string['includenottaken'] = 'Include not taken sessions'; $string['indetail'] = 'In detail...'; $string['moduledescription'] = 'You can add only one module Attendance per course.
Removal of this module will not entail removal of the data!'; @@ -121,6 +122,7 @@ $string['showdefaults'] = 'Show defaults'; $string['showduration'] = 'Show duration'; $string['sortedgrid'] = 'Sorted grid'; $string['sortedlist'] = 'Sorted list'; +$string['startofperiod'] = 'Start of period'; $string['status'] = 'Status'; $string['statusdeleted'] = 'Status deleted'; $string['strftimedm'] = '%%d.%%m'; diff --git a/lang/es_utf8/attforblock.php b/lang/es_utf8/attforblock.php index 8b27014..fa5d891 100644 --- a/lang/es_utf8/attforblock.php +++ b/lang/es_utf8/attforblock.php @@ -64,7 +64,7 @@ $string['downloadooo'] = 'Descargar en Formato OpenOffice'; $string['downloadtext'] = 'Descargar en Formato de Texto'; $string['duration'] = 'Duración'; $string['editsession'] = 'Editar Sesión'; -$string['endofperiod'] = 'Fin del periodo'; +$string['endofperiod'] = 'Fecha final'; $string['endtime'] = 'Hora de finalización'; $string['errorgroupsnotselected'] = 'Elija uno o más grupos'; $string['errorinaddingsession'] = 'Error añadiendo Sesión'; @@ -73,6 +73,7 @@ $string['gridcolumns'] = 'Columnas de la rejilla'; $string['groupsession'] = 'Grupal'; $string['hiddensessions'] = 'Sesiones ocultas'; $string['identifyby'] = 'Identificar estudiantes por'; +$string['includeall'] = 'Seleccionar todas las sesiones'; $string['includenottaken'] = 'Incluir sesiones no registradas'; $string['indetail'] = 'En detalle...'; $string['moduledescription'] = 'Sólo se puede agregar una actividad \"Asistencia\" por curso.
Si se elimina esta actividad, los datos de la base de datos no se verán afectados, así que reaparecerán en caso de volver a agregar nuevamente la actividad.'; @@ -121,6 +122,7 @@ $string['showduration'] = 'Mostrar duración'; $string['showdefaults'] = 'Mostrar opciones por defecto'; $string['sortedgrid'] = 'Rejilla alfabética'; $string['sortedlist'] = 'Lista alfabética'; +$string['startofperiod'] = 'Fecha de comienzo'; $string['status'] = 'Estado'; $string['statusdeleted'] = 'Estado eliminado'; $string['strftimedm'] = '%%d.%%m';