commit b86085074fe8fb547c881ff371efecb37c292b57 Author: Artem Andreev Date: Fri Jul 9 14:46:53 2010 +0400 Initial commit. Version 2.1.1 diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..d9d7e71 --- /dev/null +++ b/CHANGES @@ -0,0 +1,1237 @@ +2009-04-13 Monday 01:50 dlnsk + + * lang/: en_utf8/attforblock.php, ru_utf8/attforblock.php: + + two forgotten strings + +2009-04-13 Monday 01:48 dlnsk + + * locallib.php: + + array_intersect_key which require PHP 5.1.0 replaced to local + implementation + +2009-04-11 Saturday 12:21 dlnsk + + * README.txt: + + installation description fixed + +2009-04-08 Wednesday 01:23 dlnsk + + * lang/ja_utf8/help/attforblock/hiddensessions.html: + + file hiddensessions.html was initially added on branch + MOODLE_19_STABLE. + +2009-04-08 Wednesday 01:23 dlnsk + + * lang/ja_utf8/: attforblock.php, + help/attforblock/createmultiplesessions.html, + help/attforblock/createonesession.html, + help/attforblock/defaultstatuses.html, + help/attforblock/display.html, help/attforblock/export.html, + help/attforblock/myvariables.html, help/attforblock/report.html, + help/attforblock/sessions.html, help/attforblock/studentview.html, + help/attforblock/hiddensessions.html: + + Japanese language updated Thanks to Mitsuhiro Yoshida + +2009-03-12 Thursday 03:21 dlnsk + + * lib.php: + + bug fixed: notofication rise when module adding into course. + Updating gradebook is a reason. Now Attendance show up in gradebook + only after taking attendance. + +2009-03-12 Thursday 03:17 dlnsk + + * export_form.php: + + bug fixed: 'no groups' cause notification + +2009-03-10 Tuesday 20:19 dlnsk + + * lang/cs_utf8/attforblock.php: + + Czech Language. Thanks to Lukas Mizoch + +2009-03-10 Tuesday 20:19 dlnsk + + * lang/cs_utf8/attforblock.php: + + file attforblock.php was initially added on branch + MOODLE_19_STABLE. + +2009-03-01 Sunday 04:20 dlnsk + + * lang/en_utf8/help/attforblock/hiddensessions.html: + + file hiddensessions.html was initially added on branch + MOODLE_19_STABLE. + +2009-03-01 Sunday 04:20 dlnsk + + * RELEASES.txt, backuplib.php, manage.php, restorelib.php, + version.php, lang/en_utf8/attforblock.php, + lang/en_utf8/help/attforblock/hiddensessions.html, + lang/ru_utf8/attforblock.php: + + Format of backup changed Hidden sessions displayed Small fixes + +2009-03-01 Sunday 01:49 dlnsk + + * report.php: + + bug fix: statuses on Report page + +2009-02-27 Friday 21:08 dlnsk + + * locallib.php: + + bug fixed: devision by zero + +2009-02-25 Wednesday 20:07 dlnsk + + * lang/es_utf8/: attforblock.php, + help/attforblock/createmultiplesessions.html, + help/attforblock/createonesession.html, + help/attforblock/display.html, help/attforblock/export.html, + help/attforblock/myvariables.html, help/attforblock/mods.html, + help/attforblock/report.html, help/attforblock/sessions.html, + help/attforblock/studentview.html, + help/attforblock/updateattendance.html: + + Updated Thanks to Enrique Robredo. + +2009-02-25 Wednesday 19:30 dlnsk + + * lang/es_utf8/help/attforblock/updateattendance.html: + + file updateattendance.html was initially added on branch + MOODLE_19_STABLE. + +2009-02-25 Wednesday 19:30 dlnsk + + * lang/es_utf8/help/attforblock/mods.html: + + file mods.html was initially added on branch MOODLE_19_STABLE. + +2009-02-25 Wednesday 19:30 dlnsk + + * lang/es_utf8/: attforblock.php, + help/attforblock/createmultiplesessions.html, + help/attforblock/createonesession.html, + help/attforblock/display.html, help/attforblock/export.html, + help/attforblock/myvariables.html, help/attforblock/mods.html, + help/attforblock/report.html, help/attforblock/sessions.html, + help/attforblock/studentview.html, + help/attforblock/updateattendance.html: + + Updated Thanks to Enrique Robredo. + +2009-02-24 Tuesday 05:20 dlnsk + + * RELEASES.txt: + + date fixed + +2009-02-24 Tuesday 05:16 dlnsk + + * RELEASES.txt: + + date fixed + +2009-02-24 Tuesday 04:22 dlnsk + + * README.txt, attendances.php, attsettings.php, backuplib.php, + export.php, index.php, RELEASES.txt, lib.php, locallib.php, + manage.php, mod_form.php, report.php, restorelib.php, sessions.php, + version.php, view.php, add_form.php, duration_form.php, + export_form.php, mod.html, update_form.php, db/access.php, + db/install.xml, db/upgrade.php, db/migrate2utf8.php, + db/migrate2utf8.xml, db/mysql.php, db/mysql.sql, db/postgres7.php, + db/postgres7.sql, lang/de/attforblock.php, + lang/en_utf8/attforblock.php, + lang/en_utf8/help/attforblock/createmultiplesessions.html, + lang/en_utf8/help/attforblock/sessions.html, + lang/es_utf8/attforblock.php, + lang/es_utf8/help/attforblock/createmultiplesessions.html, + lang/es_utf8/help/attforblock/changesession.html, + lang/es_utf8/help/attforblock/createonesession.html, + lang/es_utf8/help/attforblock/display.html, + lang/es_utf8/help/attforblock/export.html, + lang/es_utf8/help/attforblock/myvariables.html, + lang/es_utf8/help/attforblock/report.html, + lang/es_utf8/help/attforblock/sessions.html, + lang/es_utf8/help/attforblock/studentview.html, + lang/eu_utf8/attforblock.php, + lang/eu_utf8/help/attforblock/sessions.html, + lang/fr_utf8/attforblock.php, lang/it/attforblock.php, + lang/it/help/attforblock/sessions.html, + lang/ja_utf8/attforblock.php, + lang/ja_utf8/help/attforblock/sessions.html, + lang/ru_utf8/attforblock.php, + lang/ru_utf8/help/attforblock/sessions.html, + lang/sk_utf8/attforblock.php, lang/sv/attforblock.php, + lang/en_us_utf8/attforblock.php: + + Release 2.1.0 Merged from HEAD + +2009-02-24 Tuesday 04:07 dlnsk + + * README.txt, RELEASES.txt, version.php: + + Release 2.1.0 + +2009-02-24 Tuesday 04:07 dlnsk + + * RELEASES.txt: + + file RELEASES.txt was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:41 +0000 + +2009-02-18 Wednesday 04:55 dlnsk + + * attendances.php, report.php: + + deprecated function changed to actual + +2009-02-18 Wednesday 03:32 dlnsk + + * locallib.php: + + get_percent fixed old version renamed to get_percent_adaptive (not + used yet) + +2009-02-09 Monday 04:42 dlnsk + + * version.php: + + [no log message] + +2009-02-09 Monday 04:36 dlnsk + + * manage.php: + + better interaction with block + +2009-02-09 Monday 04:35 dlnsk + + * mod_form.php: + + groupmode added + +2009-02-09 Monday 04:35 dlnsk + + * sessions.php: + + small fix + +2009-02-09 Monday 04:34 dlnsk + + * export_form.php: + + cancel button removed + +2009-02-09 Monday 04:34 dlnsk + + * export_form.php: + + file export_form.php was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:42 +0000 + +2009-02-09 Monday 01:15 dlnsk + + * lang/es_utf8/help/attforblock/changesession.html: + + file changesession.html was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:44 +0000 + +2009-02-09 Monday 01:15 dlnsk + + * lang/es_utf8/: attforblock.php, + help/attforblock/createmultiplesessions.html, + help/attforblock/createonesession.html, + help/attforblock/display.html, help/attforblock/export.html, + help/attforblock/myvariables.html, help/attforblock/report.html, + help/attforblock/sessions.html, help/attforblock/studentview.html, + help/attforblock/changesession.html: + + Improved by Enrique Robredo + +2009-01-25 Sunday 02:43 dlnsk + + * lang/en_utf8/help/attforblock/createmultiplesessions.html: + + [no log message] + +2009-01-21 Wednesday 03:11 dlnsk + + * attsettings.php: + + perfomance improved + +2009-01-21 Wednesday 03:08 dlnsk + + * attendances.php, manage.php, view.php, locallib.php, report.php, + version.php, db/access.php, lang/en_utf8/attforblock.php, + lang/ru_utf8/attforblock.php: + + changeattendance capability added takeattendance and + changeattendance is fully separated improved interaction of + capabilities + +2009-01-14 Wednesday 17:13 dlnsk + + * lang/en_utf8/attforblock.php: + + Strings for reset + +2009-01-14 Wednesday 17:12 dlnsk + + * update_form.php: + + file update_form.php was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:42 +0000 + +2009-01-14 Wednesday 17:12 dlnsk + + * attsettings.php, duration_form.php, lib.php, locallib.php, + manage.php, restorelib.php, update_form.php, view.php: + + Bug fixes: duration, wrong link, adding status + +2009-01-14 Wednesday 17:12 dlnsk + + * duration_form.php: + + file duration_form.php was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:42 +0000 + +2009-01-13 Tuesday 02:43 dlnsk + + * lang/: en_utf8/attforblock.php, ru_utf8/attforblock.php: + + Added few strings + +2009-01-12 Monday 17:16 dlnsk + + * attendances.php, attsettings.php, manage.php, version.php: + + Small language fixes + +2009-01-12 Monday 06:47 dlnsk + + * attendances.php, lib.php, sessions.php, db/install.xml, + db/upgrade.php, lang/en_utf8/attforblock.php: + + Improved a little + +2009-01-12 Monday 06:45 dlnsk + + * backuplib.php, restorelib.php: + + Backup and restore much improved + +2008-12-03 Wednesday 03:42 dlnsk + + * attendances.php, duration_form.php, sessions.php, + update_form.php: + + Several undefined variables usage fixed + +2008-11-26 Wednesday 01:51 dlnsk + + * db/migrate2utf8.php, db/migrate2utf8.xml, mod.html, db/mysql.php, + db/mysql.sql, db/postgres7.php, db/postgres7.sql: + + Not need for Moodle 1.9 + +2008-11-26 Wednesday 01:46 dlnsk + + * lang/en_us_utf8/attforblock.php: + + file attforblock.php was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:46 +0000 + +2008-11-26 Wednesday 01:46 dlnsk + + * add_form.php: + + file add_form.php was added on branch MOODLE_19_STABLE on + 2009-02-23 19:22:41 +0000 + +2008-11-26 Wednesday 01:44 dlnsk + + * attendances.php, attsettings.php, backuplib.php, export.php, + index.php, lib.php, locallib.php, manage.php, mod_form.php, + report.php, restorelib.php, sessions.php, version.php, view.php, + db/access.php, db/install.xml, db/upgrade.php, + lang/de/attforblock.php, lang/en_utf8/attforblock.php, + lang/en_utf8/help/attforblock/sessions.html, + lang/es_utf8/attforblock.php, + lang/es_utf8/help/attforblock/sessions.html, + lang/eu_utf8/attforblock.php, + lang/eu_utf8/help/attforblock/sessions.html, + lang/fr_utf8/attforblock.php, lang/it/attforblock.php, + lang/it/help/attforblock/sessions.html, + lang/ja_utf8/attforblock.php, + lang/ja_utf8/help/attforblock/sessions.html, + lang/ru_utf8/attforblock.php, + lang/ru_utf8/help/attforblock/sessions.html, + lang/sk_utf8/attforblock.php, lang/sv/attforblock.php, + add_form.php, duration_form.php, export_form.php, update_form.php, + lang/en_us_utf8/attforblock.php: + + Very much changes! New version with many session in one day, user + defined statuses etc. Fully separated from block. + +2008-11-11 Tuesday 18:10 dlnsk + + * README.txt, attendances.php, lib.php, manage.php, report.php, + sessions.php, version.php: + + Merged from 1.9 branch + +2008-06-30 Monday 02:26 dlnsk + + * lib.php: + + workaround lost instance in course + +2008-06-27 Friday 09:37 dlnsk + + * version.php: + + [no log message] + +2008-06-26 Thursday 14:05 dlnsk + + * lib.php: + + Critical bug - error when adding new instance + +2008-06-21 Saturday 02:18 dlnsk + + * README.txt: + + [no log message] + +2008-06-21 Saturday 02:07 dlnsk + + * README.txt, attendances.php, locallib.php, manage.php, + report.php, sessions.php, lang/de/attforblock.php, + lang/en_us_utf8/README, lang/en_utf8/attforblock.php, + lang/en_utf8/help/attforblock/createmultiplesessions.html, + lang/en_utf8/help/attforblock/createonesession.html, + lang/en_utf8/help/attforblock/defaultstatuses.html, + lang/en_utf8/help/attforblock/display.html, + lang/en_utf8/help/attforblock/export.html, + lang/en_utf8/help/attforblock/myvariables.html, + lang/en_utf8/help/attforblock/report.html, + lang/en_utf8/help/attforblock/sessions.html, + lang/en_utf8/help/attforblock/studentview.html, + lang/es_utf8/attforblock.php, + lang/es_utf8/help/attforblock/createmultiplesessions.html, + lang/es_utf8/help/attforblock/createonesession.html, + lang/es_utf8/help/attforblock/defaultstatuses.html, + lang/es_utf8/help/attforblock/display.html, + lang/es_utf8/help/attforblock/export.html, + lang/es_utf8/help/attforblock/myvariables.html, + lang/es_utf8/help/attforblock/report.html, + lang/es_utf8/help/attforblock/sessions.html, + lang/es_utf8/help/attforblock/studentview.html, + lang/eu_utf8/attforblock.php, + lang/eu_utf8/help/attforblock/defaultstatuses.html, + lang/eu_utf8/help/attforblock/sessions.html, + lang/fr_utf8/attforblock.php, lang/it/attforblock.php, + lang/it/help/attforblock/sessions.html, + lang/ja_utf8/attforblock.php, + lang/ja_utf8/help/attforblock/createmultiplesessions.html, + lang/ja_utf8/help/attforblock/createonesession.html, + lang/ja_utf8/help/attforblock/defaultstatuses.html, + lang/ja_utf8/help/attforblock/display.html, + lang/ja_utf8/help/attforblock/export.html, + lang/ja_utf8/help/attforblock/myvariables.html, + lang/ja_utf8/help/attforblock/report.html, + lang/ja_utf8/help/attforblock/sessions.html, + lang/ja_utf8/help/attforblock/studentview.html, + lang/ru_utf8/attforblock.php, + lang/ru_utf8/help/attforblock/sessions.html, + lang/sk_utf8/attforblock.php, lang/sv/attforblock.php: + + giving help from module directory + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ru_utf8/help/attforblock/sessions.html: + + file sessions.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:05 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/studentview.html: + + file studentview.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:04 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ru_utf8/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:05 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/: sk_utf8/attforblock.php, sv/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:06 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:03 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/export.html: + + file export.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:08:04 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/myvariables.html: + + file myvariables.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:04 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/defaultstatuses.html: + + file defaultstatuses.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:03 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/display.html: + + file display.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:03 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/sessions.html: + + file sessions.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:04 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/createmultiplesessions.html: + + file createmultiplesessions.html was added on branch + MOODLE_18_STABLE on 2008-06-20 18:08:03 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/createonesession.html: + + file createonesession.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:03 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/ja_utf8/help/attforblock/report.html: + + file report.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:08:04 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/createonesession.html: + + file createonesession.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:00 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/sessions.html: + + file sessions.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:01 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/: eu_utf8/help/attforblock/sessions.html, + it/help/attforblock/sessions.html: + + file sessions.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:02 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/export.html: + + file export.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:08:01 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/myvariables.html: + + file myvariables.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:01 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/report.html: + + file report.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:08:01 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/createmultiplesessions.html: + + file createmultiplesessions.html was added on branch + MOODLE_18_STABLE on 2008-06-20 18:08:00 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/defaultstatuses.html: + + file defaultstatuses.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:00 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/: eu_utf8/attforblock.php, fr_utf8/attforblock.php, + it/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:02 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/eu_utf8/help/attforblock/defaultstatuses.html: + + file defaultstatuses.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:02 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/studentview.html: + + file studentview.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:01 +0000 + +2008-06-21 Saturday 02:03 dlnsk + + * lang/es_utf8/help/attforblock/display.html: + + file display.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:01 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/export.html: + + file export.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:07:59 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/es_utf8/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:08:00 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/display.html: + + file display.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/defaultstatuses.html: + + file defaultstatuses.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/createonesession.html: + + file createonesession.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/studentview.html: + + file studentview.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:59 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/report.html: + + file report.html was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:07:59 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/myvariables.html: + + file myvariables.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:59 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/sessions.html: + + file sessions.html was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:59 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/help/attforblock/createmultiplesessions.html: + + file createmultiplesessions.html was added on branch + MOODLE_18_STABLE on 2008-06-20 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_us_utf8/README: + + file README was added on branch MOODLE_18_STABLE on 2008-06-20 + 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/en_utf8/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:58 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * lang/de/attforblock.php: + + file attforblock.php was added on branch MOODLE_18_STABLE on + 2008-06-20 18:07:57 +0000 + +2008-06-21 Saturday 02:02 dlnsk + + * attendances.php, attsettings.php, locallib.php, manage.php, + report.php, sessions.php, lang/de/attforblock.php, + lang/en_us_utf8/README, lang/en_utf8/attforblock.php, + lang/en_utf8/help/attforblock/createmultiplesessions.html, + lang/en_utf8/help/attforblock/createonesession.html, + lang/en_utf8/help/attforblock/defaultstatuses.html, + lang/en_utf8/help/attforblock/display.html, + lang/en_utf8/help/attforblock/export.html, + lang/en_utf8/help/attforblock/myvariables.html, + lang/en_utf8/help/attforblock/report.html, + lang/en_utf8/help/attforblock/sessions.html, + lang/en_utf8/help/attforblock/studentview.html, + lang/es_utf8/attforblock.php, + lang/es_utf8/help/attforblock/createmultiplesessions.html, + lang/es_utf8/help/attforblock/createonesession.html, + lang/es_utf8/help/attforblock/defaultstatuses.html, + lang/es_utf8/help/attforblock/display.html, + lang/es_utf8/help/attforblock/export.html, + lang/es_utf8/help/attforblock/myvariables.html, + lang/es_utf8/help/attforblock/report.html, + lang/es_utf8/help/attforblock/sessions.html, + lang/es_utf8/help/attforblock/studentview.html, + lang/eu_utf8/attforblock.php, + lang/eu_utf8/help/attforblock/defaultstatuses.html, + lang/eu_utf8/help/attforblock/sessions.html, + lang/fr_utf8/attforblock.php, lang/it/attforblock.php, + lang/it/help/attforblock/sessions.html, + lang/ja_utf8/attforblock.php, + lang/ja_utf8/help/attforblock/createmultiplesessions.html, + lang/ja_utf8/help/attforblock/createonesession.html, + lang/ja_utf8/help/attforblock/defaultstatuses.html, + lang/ja_utf8/help/attforblock/display.html, + lang/ja_utf8/help/attforblock/export.html, + lang/ja_utf8/help/attforblock/myvariables.html, + lang/ja_utf8/help/attforblock/report.html, + lang/ja_utf8/help/attforblock/sessions.html, + lang/ja_utf8/help/attforblock/studentview.html, + lang/ru_utf8/attforblock.php, + lang/ru_utf8/help/attforblock/sessions.html, + lang/sk_utf8/attforblock.php, lang/sv/attforblock.php: + + Merged from 1.9 branch + +2008-06-21 Saturday 01:56 dlnsk + + * attendances.php, attsettings.php, locallib.php, manage.php, + report.php, sessions.php: + + giving help from module directory + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/myvariables.html, + es_utf8/help/attforblock/myvariables.html, + ja_utf8/help/attforblock/myvariables.html: + + file myvariables.html was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/report.html, + es_utf8/help/attforblock/report.html, + ja_utf8/help/attforblock/report.html: + + file report.html was initially added on branch MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/sessions.html, + es_utf8/help/attforblock/sessions.html, + eu_utf8/help/attforblock/sessions.html, + it/help/attforblock/sessions.html, + ja_utf8/help/attforblock/sessions.html, + ru_utf8/help/attforblock/sessions.html: + + file sessions.html was initially added on branch MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/studentview.html, + es_utf8/help/attforblock/studentview.html, + ja_utf8/help/attforblock/studentview.html: + + file studentview.html was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/createonesession.html, + es_utf8/help/attforblock/createonesession.html, + ja_utf8/help/attforblock/createonesession.html: + + file createonesession.html was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/createmultiplesessions.html, + es_utf8/help/attforblock/createmultiplesessions.html, + ja_utf8/help/attforblock/createmultiplesessions.html: + + file createmultiplesessions.html was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/defaultstatuses.html, + es_utf8/help/attforblock/defaultstatuses.html, + eu_utf8/help/attforblock/defaultstatuses.html, + ja_utf8/help/attforblock/defaultstatuses.html: + + file defaultstatuses.html was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/display.html, + es_utf8/help/attforblock/display.html, + ja_utf8/help/attforblock/display.html: + + file display.html was initially added on branch MOODLE_19_STABLE. + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/createmultiplesessions.html, + en_utf8/help/attforblock/createonesession.html, + en_utf8/help/attforblock/defaultstatuses.html, + en_utf8/help/attforblock/display.html, + en_utf8/help/attforblock/export.html, + en_utf8/help/attforblock/myvariables.html, + en_utf8/help/attforblock/report.html, + en_utf8/help/attforblock/sessions.html, + en_utf8/help/attforblock/studentview.html, + es_utf8/help/attforblock/createmultiplesessions.html, + es_utf8/help/attforblock/createonesession.html, + es_utf8/help/attforblock/defaultstatuses.html, + es_utf8/help/attforblock/display.html, + es_utf8/help/attforblock/export.html, + es_utf8/help/attforblock/myvariables.html, + es_utf8/help/attforblock/report.html, + es_utf8/help/attforblock/sessions.html, + es_utf8/help/attforblock/studentview.html, + eu_utf8/help/attforblock/defaultstatuses.html, + eu_utf8/help/attforblock/sessions.html, + it/help/attforblock/sessions.html, + ja_utf8/help/attforblock/createmultiplesessions.html, + ja_utf8/help/attforblock/createonesession.html, + ja_utf8/help/attforblock/defaultstatuses.html, + ja_utf8/help/attforblock/display.html, + ja_utf8/help/attforblock/export.html, + ja_utf8/help/attforblock/myvariables.html, + ja_utf8/help/attforblock/report.html, + ja_utf8/help/attforblock/sessions.html, + ja_utf8/help/attforblock/studentview.html, + ru_utf8/help/attforblock/sessions.html: + + help and lang moved here from block + +2008-06-21 Saturday 01:53 dlnsk + + * lang/: en_utf8/help/attforblock/export.html, + es_utf8/help/attforblock/export.html, + ja_utf8/help/attforblock/export.html: + + file export.html was initially added on branch MOODLE_19_STABLE. + +2008-06-21 Saturday 01:37 dlnsk + + * lang/: de/attforblock.php, en_utf8/attforblock.php, + es_utf8/attforblock.php, eu_utf8/attforblock.php, + fr_utf8/attforblock.php, it/attforblock.php, + ja_utf8/attforblock.php, ru_utf8/attforblock.php, + sk_utf8/attforblock.php, sv/attforblock.php: + + file attforblock.php was initially added on branch + MOODLE_19_STABLE. + +2008-06-21 Saturday 01:37 dlnsk + + * lang/en_us_utf8/README: + + file README was initially added on branch MOODLE_19_STABLE. + +2008-06-21 Saturday 01:37 dlnsk + + * lang/: de/attforblock.php, en_us_utf8/README, + en_utf8/attforblock.php, es_utf8/attforblock.php, + eu_utf8/attforblock.php, fr_utf8/attforblock.php, + it/attforblock.php, ja_utf8/attforblock.php, + ru_utf8/attforblock.php, sk_utf8/attforblock.php, + sv/attforblock.php: + + help and lang moved here from block + +2008-06-21 Saturday 01:02 dlnsk + + * README.txt, attendances.php, attsettings.php, backuplib.php, + lib.php, locallib.php, manage.php, restorelib.php, sessions.php, + version.php, view.php: + + Merged from 1.9 branch + +2008-06-21 Saturday 00:50 dlnsk + + * README.txt, attendances.php, attsettings.php, lib.php, + manage.php, sessions.php, version.php, view.php: + + Now compatible with Gradebook of Moodle 1.9 + +2008-05-14 Wednesday 03:10 dlnsk + + * locallib.php, locallib.php: + + Bug fixed in student's view + +2008-05-13 Tuesday 02:44 dlnsk + + * backuplib.php, restorelib.php: + + Backup/Restore support + +2008-05-13 Tuesday 02:36 dlnsk + + * restorelib.php: + + file restorelib.php was initially added on branch MOODLE_18_STABLE. + +2008-05-13 Tuesday 02:36 dlnsk + + * backuplib.php, restorelib.php: + + Backup/Restore support + +2008-05-13 Tuesday 02:36 dlnsk + + * restorelib.php: + + file restorelib.php was added on branch MOODLE_19_STABLE on + 2008-05-12 18:44:48 +0000 + +2008-05-13 Tuesday 02:36 dlnsk + + * backuplib.php: + + file backuplib.php was initially added on branch MOODLE_18_STABLE. + +2008-05-13 Tuesday 02:36 dlnsk + + * backuplib.php: + + file backuplib.php was added on branch MOODLE_19_STABLE on + 2008-05-12 18:44:48 +0000 + +2008-02-27 Wednesday 20:29 dlnsk + + * attendances.php: + + groups_get_all_groups should used in Moodle 1.9 + +2008-02-27 Wednesday 20:24 dlnsk + + * README.txt, attendances.php, export.php, locallib.php, + attsettings.php, report.php, settings.php, version.php, + db/upgrade.php: + + Merged from HEAD + +2008-02-20 Wednesday 03:37 dlnsk + + * README.txt: + + v2.0.3 + +2008-02-20 Wednesday 03:36 dlnsk + + * README.txt: + + [no log message] + +2008-02-20 Wednesday 03:22 dlnsk + + * attendances.php, version.php, db/upgrade.php: + + Merged from MOODLE_18_STABLE + +2008-02-20 Wednesday 03:10 dlnsk + + * version.php, db/upgrade.php: + + bug fixed If session have apostrophes in the description it can't + will be changed to "taken" + +2008-02-19 Tuesday 19:38 dlnsk + + * attendances.php: + + bug fixed If session have apostrophes in the description it can't + will be changed to "taken" + +2008-02-18 Monday 17:39 dlnsk + + * attsettings.php: + + links to attsettings.php fixed + +2008-02-18 Monday 17:39 dlnsk + + * attsettings.php: + + file attsettings.php was added on branch MOODLE_19_STABLE on + 2008-02-27 11:24:24 +0000 + +2008-02-18 Monday 17:37 dlnsk + + * attsettings.php, locallib.php, settings.php: + + settings.php now reserved for Moodle core file renamed to + attsettings.php + +2008-02-18 Monday 15:26 dlnsk + + * README.txt, attendances.php, export.php, index.php, lib.php, + locallib.php, manage.php, mod.html, version.php, view.php, + mod_form.php, report.php, sessions.php, settings.php, + db/access.php, db/install.xml, db/upgrade.php: + + merged from HEAD + +2008-02-18 Monday 14:48 dlnsk + + * export.php: + + file export.php was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:08 +0000 + +2008-02-18 Monday 14:48 dlnsk + + * export.php: + + percents added + +2008-02-03 Sunday 04:39 mudrd8mz + + * export.php: + + Fixed variable name. + +2007-12-04 Tuesday 20:23 dlnsk + + * export.php: + + Export bug fixed: invalid capability + +2007-11-28 Wednesday 16:47 dlnsk + + * report.php: + + Report didn't use course's start date + +2007-11-28 Wednesday 16:47 dlnsk + + * report.php: + + file report.php was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:09 +0000 + +2007-10-08 Monday 19:14 dlnsk + + * attendances.php: + + show group names in attendances instead of numerical codes + +2007-10-08 Monday 19:14 dlnsk + + * attendances.php: + + file attendances.php was added on branch MOODLE_18_STABLE on + 2008-02-18 06:26:08 +0000 + +2007-07-08 Sunday 02:50 dlnsk + + * locallib.php, manage.php: + + display default description + +2007-07-08 Sunday 02:50 dlnsk + + * manage.php: + + file manage.php was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:08 +0000 + +2007-07-08 Sunday 02:50 dlnsk + + * locallib.php: + + file locallib.php was added on branch MOODLE_18_STABLE on + 2008-02-18 06:26:08 +0000 + +2007-07-06 Friday 16:43 dlnsk + + * sessions.php: + + file sessions.php was added on branch MOODLE_18_STABLE on + 2008-02-18 06:26:09 +0000 + +2007-07-06 Friday 16:43 dlnsk + + * settings.php: + + file settings.php was added on branch MOODLE_18_STABLE on + 2008-02-18 06:26:09 +0000 + +2007-07-06 Friday 16:43 dlnsk + + * README.txt, sessions.php, settings.php, version.php: + + 2.0.2 beta + +2007-07-05 Thursday 11:43 dlnsk + + * index.php: + + don't display table of instances, just redirect to manage.php + +2007-07-05 Thursday 11:41 dlnsk + + * mod_form.php: + + [no log message] + +2007-07-05 Thursday 11:41 dlnsk + + * mod_form.php: + + file mod_form.php was added on branch MOODLE_18_STABLE on + 2008-02-18 06:26:09 +0000 + +2007-07-05 Thursday 04:08 dlnsk + + * lib.php, locallib.php, mod.html: + + few bugs fixed + +2007-07-05 Thursday 01:33 dlnsk + + * db/install.xml: + + file install.xml was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:09 +0000 + +2007-07-05 Thursday 01:33 dlnsk + + * db/upgrade.php: + + file upgrade.php was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:10 +0000 + +2007-07-05 Thursday 01:32 dlnsk + + * db/access.php: + + file access.php was added on branch MOODLE_18_STABLE on 2008-02-18 + 06:26:09 +0000 + +2007-07-05 Thursday 01:32 dlnsk + + * index.php, lib.php, version.php, view.php, attendances.php, + export.php, locallib.php, manage.php, report.php, sessions.php, + settings.php, db/access.php, db/install.xml, db/upgrade.php: + + version 2.0.1 + +2006-06-13 Tuesday 09:27 dlnsk + + * db/migrate2utf8.php: + + function name changed + +2006-04-17 Monday 04:50 dlnsk + + * db/migrate2utf8.php, db/migrate2utf8.xml, db/postgres7.php, + db/postgres7.sql, version.php: + + index added to database migrating support added + +2006-02-01 Wednesday 20:00 dlnsk + + * index.php, lib.php, version.php, view.php: + + [no log message] + +2006-02-01 Wednesday 16:25 dlnsk + + * README.txt, icon.gif, index.php, lib.php, mod.html, version.php, + view.php, db/mysql.php, db/mysql.sql, db/postgres7.php, + db/postgres7.sql: + + Dmitry's version of attendance block. Started from version 1.0.5 + diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..029dc31 --- /dev/null +++ b/README.txt @@ -0,0 +1,26 @@ +********************************************************************************************* +****** WARNING: THIS MODULE IS IN DEVELOPMENT. USE WITH CAUTION ****** +********************************************************************************************* + +-------- +ABOUT +-------- +This is version 2.1.x of the "Attendance" module (attforblock). It is still IN DEVELOPMENT +and should not be considered a stable release unless otherwise noted. +It has been tested on Moodle 1.9+, MySQL and PHP 5.2+. + +The "Attendance" module is developed by Dmitry Pupinin, Novosibirsk, Russia. + +This block may be distributed under the terms of the General Public License +(see http://www.gnu.org/licenses/gpl.txt for details) + +----------- +PURPOSE +----------- +The attendance module and block are designed to allow instructors of a course keep an attendance log of the students in their courses. The instructor will setup the frequency of his classes (# of days per week & length of course) and the attendance is ready for use. To take attendance, the instructor clicks on the "Update Attendance" button and is presented with a list of all the students in that course, along with 4 options: Present, Absent, Late & Excused, with a Remarks textbox. Instructors can download the attendance for their course in Excel format or text format. +Only the instructor can update the attendance data. However, a student gets to see his attendance record. + +---------------- +INSTALLATION +---------------- +The attendance follows standard installation procedures. Place the "attendance" directory in your blocks directory, "attforblock" directory in your mod directory. Please delete old language files from your moodledata/lang/en directory if you are upgrading the module. Then visit the Admin page in Moodle to activate it. diff --git a/RELEASES.txt b/RELEASES.txt new file mode 100644 index 0000000..c9192c8 --- /dev/null +++ b/RELEASES.txt @@ -0,0 +1,49 @@ +**************************************************************************** +****** WARNING: ATTENDANCE MODULE IS IN DEVELOPMENT. USE WITH CAUTION ****** +**************************************************************************** + +-------------- +RELEASE NOTES +-------------- +1.0 - 09 jan 2006 Dmitry Pupinin [moodle.org member] ++ basic functions + +1.0.1 - 23 jan 2006 Dmitry Pupinin [moodle.org member] ++ attendance displayed on user's quick and full report pages + +2.0 - 10 may 2007 - Dmitry Pupinin [moodle.org member] +* code rewrited. General code moved from block to attforblock module. +* this version only compatible with latest Moodle 1.8 (without grouping!) + +2.0.2 - 06 jul 2007 - Dmitry Pupinin [moodle.org member] +* bug fixed: empty Gradebook +* bug fixed: error if block instance added before module instance +* bug fixed: wrong link on report tab when no session added +* bug fixed: Activity report looks good ++ link from Activities block point directly to Attendances (because it can't be more than one) +* bug fixed: Wrong link when adding a session for a date that had already been added +* bug fixed: Error when settings updated +* en_utf8 lang updated (thanks to A. T. Wyatt) ++ en_us_utf8 lang added (contain only differences from en_utf8) + +2.0.3 - 27 jan 2008 - Dmitry Pupinin [moodle.org member] +* bug fixed: If session have apostrophes in the description it can't will be changed to "taken" + (you can't lost any data but upgrading strongly recommended) ++ french language added +* bug fixed: functions for work with groups changed in Moodle 1.9 + +2.0.4 - 19 jun 2008 - Dmitry Pupinin [moodle.org member] ++ compatibility with Gradebook of Moodle 1.9 + +2.1.0 - 24 jan 2009 - Dmitry Pupinin [moodle.org member] ++ unlimited number of statuses ++ unlimited sessions in day ++ reset feature +* permissions improved +* backup/restore improved +* export improved + +2.1.0 - 28 feb 2009 - Dmitry Pupinin [moodle.org member] ++ hidden sessions displayed +* format of backup changed +* bug fixes \ No newline at end of file diff --git a/add_form.php b/add_form.php new file mode 100644 index 0000000..ffe2b51 --- /dev/null +++ b/add_form.php @@ -0,0 +1,89 @@ +libdir.'/formslib.php'); + +class mod_attforblock_add_form extends moodleform { + + function definition() { + + global $CFG; + $mform =& $this->_form; + + $course = $this->_customdata['course']; + $cm = $this->_customdata['cm']; +// $coursecontext = $this->_customdata['coursecontext']; + $modcontext = $this->_customdata['modcontext']; +// $forum = $this->_customdata['forum']; +// $post = $this->_customdata['post']; // hack alert + + + $mform->addElement('header', 'general', get_string('addsession','attforblock'));//fill in the data depending on page params + //later using set_data + $mform->addElement('checkbox', 'addmultiply', '', get_string('createmultiplesessions','attforblock')); + $mform->setHelpButton('addmultiply', array('createmultiplesessions', get_string('createmultiplesessions','attforblock'), 'attforblock')); + +// $mform->addElement('date_selector', 'sessiondate', get_string('sessiondate','attforblock')); + $mform->addElement('date_time_selector', 'sessiondate', get_string('sessiondate','attforblock')); + + for ($i=0; $i<=23; $i++) { + $hours[$i] = sprintf("%02d",$i); + } + for ($i=0; $i<60; $i+=5) { + $minutes[$i] = sprintf("%02d",$i); + } + $durtime = array(); + $durtime[] =& MoodleQuickForm::createElement('select', 'hours', get_string('hour', 'form'), $hours, false, true); + $durtime[] =& MoodleQuickForm::createElement('select', 'minutes', get_string('minute', 'form'), $minutes, false, true); + $mform->addGroup($durtime, 'durtime', get_string('duration','attforblock'), array(' '), true); + + $mform->addElement('date_selector', 'sessionenddate', get_string('sessionenddate','attforblock')); + $mform->disabledIf('sessionenddate', 'addmultiply', 'notchecked'); + + $sdays = array(); + if ($CFG->calendar_startwday === '0') { //week start from sunday + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Sun', '', get_string('sunday','calendar')); + } + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Mon', '', get_string('monday','calendar')); + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Tue', '', get_string('tuesday','calendar')); + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Wed', '', get_string('wednesday','calendar')); + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Thu', '', get_string('thursday','calendar')); + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Fri', '', get_string('friday','calendar')); + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Sat', '', get_string('saturday','calendar')); + if ($CFG->calendar_startwday !== '0') { //week start from sunday + $sdays[] =& MoodleQuickForm::createElement('checkbox', 'Sun', '', get_string('sunday','calendar')); + } + $mform->addGroup($sdays, 'sdays', get_string('sessiondays','attforblock'), array(' '), true); + $mform->disabledIf('sdays', 'addmultiply', 'notchecked'); + + $period = array(1=>1,2,3,4,5,6,7,8); + $periodgroup = array(); + $periodgroup[] =& MoodleQuickForm::createElement('select', 'period', '', $period, false, true); + $periodgroup[] =& MoodleQuickForm::createElement('static', 'perioddesc', '', get_string('week','attforblock')); + $mform->addGroup($periodgroup, 'periodgroup', get_string('period','attforblock'), array(' '), false); + $mform->disabledIf('periodgroup', 'addmultiply', 'notchecked'); + + $mform->addElement('text', 'sdescription', get_string('description', 'attforblock'), 'size="48"'); + $mform->setType('sdescription', PARAM_TEXT); + $mform->addRule('sdescription', get_string('maximumchars', '', 100), 'maxlength', 100, 'client'); + +//------------------------------------------------------------------------------- + // buttons + $submit_string = get_string('addsession', 'attforblock'); + $this->add_action_buttons(false, $submit_string); + + $mform->addElement('hidden', 'id', $cm->id); + $mform->addElement('hidden', 'action', 'add'); + + } + +// function validation($data, $files) { +// $errors = parent::validation($data, $files); +// if (($data['timeend']!=0) && ($data['timestart']!=0) +// && $data['timeend'] <= $data['timestart']) { +// $errors['timeend'] = get_string('timestartenderror', 'forum'); +// } +// return $errors; +// } + +} +?> diff --git a/attendances.php b/attendances.php new file mode 100644 index 0000000..b88fceb --- /dev/null +++ b/attendances.php @@ -0,0 +1,190 @@ +libdir.'/blocklib.php'); + require_once('locallib.php'); + require_once('lib.php'); + + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + require_once($CFG->libdir.'/gradelib.php'); + } + + $id = required_param('id', PARAM_INT); + $sessionid = required_param('sessionid', PARAM_INT); + $group = optional_param('group', -1, PARAM_INT); // Group to show + $sort = optional_param('sort','lastname', PARAM_ALPHA); + + if (! $cm = get_record('course_modules', 'id', $id)) { + error('Course Module ID was incorrect'); + } + + if (! $course = get_record('course', 'id', $cm->course)) { + error('Course is misconfigured'); + } + + require_login($course->id); + + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + $statlist = implode(',', array_keys( (array)get_statuses($course->id) )); + if ($form = data_submitted()) { + $students = array(); // stores students ids + $formarr = (array)$form; + $i = 0; + $now = time(); + foreach($formarr as $key => $value) { + if(substr($key,0,7) == 'student' && $value !== '') { + $students[$i] = new Object(); + $sid = substr($key,7); // gets studeent id from radiobutton name + $students[$i]->studentid = $sid; + $students[$i]->statusid = $value; + $students[$i]->statusset = $statlist; + $students[$i]->remarks = array_key_exists('remarks'.$sid, $formarr) ? $formarr['remarks'.$sid] : ''; + $students[$i]->sessionid = $sessionid; + $students[$i]->timetaken = $now; + $students[$i]->takenby = $USER->id; + $i++; + } + } + $attforblockrecord = get_record('attforblock', 'course', $course->id); + + foreach($students as $student) { + if ($log = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->studentid)) { + $student->id = $log->id; // this is id of log + update_record('attendance_log', $student); + } else { + insert_record('attendance_log', $student); + } + } + set_field('attendance_sessions', 'lasttaken', $now, 'id', $sessionid); + set_field('attendance_sessions', 'lasttakenby', $USER->id, 'id', $sessionid); + + attforblock_update_grades($attforblockrecord); + add_to_log($course->id, 'attendance', 'updated', 'mod/attforblock/report.php?id='.$id, $user->lastname.' '.$user->firstname); + redirect('manage.php?id='.$id, get_string('attendancesuccess','attforblock'), 3); + exit(); + } + +/// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity'); + $navlinks[] = array('name' => get_string('update', 'attforblock'), 'link' => null, 'type' => 'activityinstance'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - ' .get_string('update','attforblock'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + +//check for hack + if (!$sessdata = get_record('attendance_sessions', 'id', $sessionid)) { + error("Required Information is missing", "manage.php?id=".$id); + } + $help = helpbutton ('updateattendance', get_string('help'), 'attforblock', true, false, '', true); + $update = count_records('attendance_log', 'sessionid', $sessionid); + + if ($update) { + require_capability('mod/attforblock:changeattendances', $context); + print_heading(get_string('update','attforblock').' ' .get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname.$help); + } else { + require_capability('mod/attforblock:takeattendances', $context); + print_heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname.$help); + } + + /// find out current groups mode + $groupmode = groups_get_activity_groupmode($cm); + $currentgroup = groups_get_activity_group($cm, true); + + if ($currentgroup) { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false); + } else { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', '', '', false); + } + + $sort = $sort == 'firstname' ? 'firstname' : 'lastname'; + /// Now we need a menu for separategroups as well! + if ($groupmode == VISIBLEGROUPS || + ($groupmode && has_capability('moodle/site:accessallgroups', $context))) { + groups_print_activity_menu($cm, "attendances.php?id=$id&sessionid=$sessionid&sort=$sort"); + } + + $table->data[][] = ''.get_string('sessiondate','attforblock').': '.userdate($sessdata->sessdate, get_string('strftimedate').', '.get_string('strftimehm', 'attforblock')). + ', "'.($sessdata->description ? $sessdata->description : get_string('nodescription', 'attforblock')).'"'; + print_table($table); + + $statuses = get_statuses($course->id); + $i = 3; + foreach($statuses as $st) { + $tabhead[] = "$st->acronym"; + $i++; + } + $tabhead[] = get_string('remarks','attforblock'); + + $firstname = "".get_string('firstname').''; + $lastname = "".get_string('lastname').''; + if ($CFG->fullnamedisplay == 'lastname firstname') { // for better view (dlnsk) + $fullnamehead = "$lastname / $firstname"; + } else { + $fullnamehead = "$firstname / $lastname"; + } + + if ($students) { + unset($table); + $table->width = '0%'; + $table->head[] = '#'; + $table->align[] = 'center'; + $table->size[] = '20px'; + + $table->head[] = ''; + $table->align[] = ''; + $table->size[] = '1px'; + + $table->head[] = $fullnamehead; + $table->align[] = 'left'; + $table->size[] = ''; + $table->wrap[2] = 'nowrap'; + foreach ($tabhead as $hd) { + $table->head[] = $hd; + $table->align[] = 'center'; + $table->size[] = '20px'; + } + $i = 0; + foreach($students as $student) { + $i++; + $att = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->id); + $table->data[$student->id][] = (!$att && $update) ? "$i" : $i; + $table->data[$student->id][] = print_user_picture($student->id, $course->id, $student->picture, 20, true, true);//, $returnstring=false, $link=true, $target=''); + $table->data[$student->id][] = "id}\">".((!$att && $update) ? '' : '').fullname($student).((!$att && $update) ? '' : '').''; + + foreach($statuses as $st) { + @$table->data[$student->id][] = 'id == $att->statusid ? 'checked' : '').'>'; + } + $table->data[$student->id][] = ''; + } + + echo '
'; + print_table($table); + echo ''; + echo ''; + echo ''; + echo '
'; + echo '
'; + } else { + print_heading(get_string('nothingtodisplay'), 'center'); + } + + echo get_string('status','attforblock').':
'; + foreach($statuses as $st) { + echo $st->acronym.' - '.$st->description.'
'; + } + + print_footer($course); + +?> diff --git a/attsettings.php b/attsettings.php new file mode 100644 index 0000000..c10a9c2 --- /dev/null +++ b/attsettings.php @@ -0,0 +1,176 @@ +course)) { + error('Course is misconfigured'); + } + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + } + $attforblockrecord = get_record('attforblock','course',$course->id); + + + require_login($course->id); + + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + require_capability('mod/attforblock:manageattendances', $context); + + /// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity'); + $navlinks[] = array('name' => get_string('settings', 'attforblock'), 'link' => null, 'type' => 'activityinstance'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - '.get_string('settings','attforblock'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + + if (!empty($action)) { + switch ($action) { + case 'delete': + if (!$rec = get_record('attendance_statuses', 'courseid', $course->id, 'id', $stid)) { + print_error('notfoundstatus', 'attforblock', "attsettings.php?id=$id"); + } + if (count_records('attendance_log', 'statusid', $stid)) { + print_error('cantdeletestatus', 'attforblock', "attsettings.php?id=$id"); + } + + $confirm = optional_param('confirm'); + if (isset($confirm)) { + set_field('attendance_statuses', 'deleted', 1, 'id', $rec->id); +// delete_records('attendance_statuses', 'id', $rec->id); + redirect('attsettings.php?id='.$id, get_string('statusdeleted','attforblock'), 3); + } + print_heading(get_string('deletingstatus','attforblock').' :: ' .$course->fullname); + + notice_yesno(get_string('deletecheckfull', '', get_string('variable', 'attforblock')). + '

'.$rec->acronym.': '. + ($rec->description ? $rec->description : get_string('nodescription', 'attforblock')), + "attsettings.php?id=$id&st=$stid&action=delete&confirm=1", $_SERVER['HTTP_REFERER']); + exit; + case 'show': + set_field('attendance_statuses', 'visible', 1, 'id', $stid); + break; + case 'hide': + $students = get_users_by_capability($context, 'moodle/legacy:student', '', '', '', '', '', '', false); + $studlist = implode(',', array_keys($students)); + if (!count_records_select('attendance_log', "studentid IN ($studlist) AND statusid = $stid")) { + set_field('attendance_statuses', 'visible', 0, 'id', $stid); + } else { + print_error('canthidestatus', 'attforblock', "attsettings.php?id=$id"); + } + break; + default: //Adding new status + $newacronym = optional_param('newacronym', '', PARAM_MULTILANG); + $newdescription = optional_param('newdescription', '', PARAM_MULTILANG); + $newgrade = optional_param('newgrade', 0, PARAM_INT); + if (!empty($newacronym) && !empty($newdescription)) { + unset($rec); + $rec->courseid = $course->id; + $rec->acronym = $newacronym; + $rec->description = $newdescription; + $rec->grade = $newgrade; + insert_record('attendance_statuses', $rec); + add_to_log($course->id, 'attendance', 'setting added', 'mod/attforblock/attsettings.php?course='.$course->id, $user->lastname.' '.$user->firstname); + } else { + print_error('cantaddstatus', 'attforblock', "attsettings.php?id=$id"); + } + break; + } + } + + show_tabs($cm, $context, 'settings'); + + if ($submitsettings) { + config_save(); ////////////////////////////// + notice(get_string('variablesupdated','attforblock'), 'attsettings.php?id='.$id); + } + + $i = 1; + $table->width = '100%'; + //$table->tablealign = 'center'; + $table->head = array('#', + get_string('acronym','attforblock'), + get_string('description'), + get_string('grade'), + get_string('action')); + $table->align = array('center', 'center', 'center', 'center', 'center', 'center'); + //$table->size = array('1px', '1px', '*', '1px', '1px', '1px'); + $statuses = get_statuses($course->id, false); + $deltitle = get_string('delete'); + foreach($statuses as $st) + { + $table->data[$i][] = $i; +// $table->data[$i][] = $st->status; + $table->data[$i][] = ''; + $table->data[$i][] = ''; + $table->data[$i][] = ''; + + $action = $st->visible ? 'hide' : 'show'; + $titlevis = get_string($action); + $deleteact = ''; + if (!count_records('attendance_log', 'statusid', $st->id)) { + $deleteact = "id&st={$st->id}&action=delete\">". + "pixpath}/t/delete.gif\" alt=\"$deltitle\" /> "; + } + $table->data[$i][] = "id&st={$st->id}&action=$action\">". + "pixpath}/t/{$action}.gif\" alt=\"$titlevis\" /> ". + $deleteact; + $i++; + } + $new_row = array('*', + '', + '', + '', + '' + ); + $table->data[$i] = $new_row; + + echo '
'; + echo '
'; + echo '

'.get_string('myvariables','attforblock').helpbutton ('myvariables', get_string('myvariables','attforblock'), 'attforblock', true, false, '', true).'

'; + print_table($table); + echo '
'; + echo ''; + echo '
'; + + print_footer($course); + + +function config_save() +{ + global $course, $user, $attforblockrecord; + + $acronym = required_param('acronym'); + $description = required_param('description'); + $grade = required_param('grade',PARAM_INT); + + foreach ($acronym as $id => $v) { + $rec = get_record('attendance_statuses', 'id', $id); + $rec->acronym = $acronym[$id]; + $rec->description = $description[$id]; + $rec->grade = $grade[$id]; + update_record('attendance_statuses', $rec); + add_to_log($course->id, 'attendance', 'settings updated', 'mod/attforblock/attsettings.php?course='.$course->id, $user->lastname.' '.$user->firstname); + } + attforblock_update_grades($attforblockrecord); +} + +?> diff --git a/backuplib.php b/backuplib.php new file mode 100644 index 0000000..a5c1545 --- /dev/null +++ b/backuplib.php @@ -0,0 +1,202 @@ + $instance) { + $info += attforblock_check_backup_mods_instances($course, $instance, $backup_unique_code); + } + return $info; + } + return $info; + } + + + + function attforblock_check_backup_mods_instances($course, $instance, $backup_unique_code) { + //First the course data + $info[$instance->id.'0'][0] = ''.$instance->name.''; + $info[$instance->id.'0'][1] = ''; + + $sessions = get_records_menu('attendance_sessions', 'courseid', $course); + $info[$instance->id.'1'][0] = get_string('sessions', 'attforblock'); + $info[$instance->id.'1'][1] = count($sessions); + + //Now, if requested, the user_data + if (!empty($instance->userdata)) { + $info[$instance->id.'2'][0] = get_string('attrecords', 'attforblock'); + $sesslist = implode(',', array_keys($sessions)); + if ($datas = get_records_list('attendance_log', 'sessionid', $sesslist)) { + $info[$instance->id.'2'][1] = count($datas); + } else { + $info[$instance->id.'2'][1] = 0; + } + } + return $info; + } + + + function attforblock_backup_mods($bf, $preferences) { + + global $CFG; + + $status = true; + + //Iterate over attforblock table + $attforblocks = get_records ('attforblock', 'course', $preferences->backup_course, 'id'); + if ($attforblocks) { + foreach ($attforblocks as $attforblock) { + if (backup_mod_selected($preferences, 'attforblock', $attforblock->id)) { + $status = attforblock_backup_one_mod($bf, $preferences, $attforblock); + } + } + } + + return $status; + } + + + + function attforblock_backup_one_mod($bf, $preferences, $attforblock) { + + global $CFG; + + if (is_numeric($attforblock)) { + $attforblock = get_record('attforblock', 'id', $attforblock); + } + + $status = true; + + //Start mod + fwrite ($bf,start_tag('MOD',3,true)); + //Print attforblock data + fwrite ($bf,full_tag('ID',4,false,$attforblock->id)); + fwrite ($bf,full_tag('MODTYPE',4,false,'attforblock')); + fwrite ($bf,full_tag('COURSE',4,false,$attforblock->course)); + fwrite ($bf,full_tag('NAME',4,false,$attforblock->name)); + fwrite ($bf,full_tag('GRADE',4,false,$attforblock->grade)); + + attforblock_backup_attendance_statuses ($bf,$preferences,$attforblock); + attforblock_backup_attendance_sessions ($bf,$preferences,$attforblock); + if (backup_userdata_selected($preferences, 'attforblock', $attforblock->id)) { + attforblock_backup_attendance_log ($bf,$preferences,$attforblock); + } + + //End mod + $status =fwrite ($bf,end_tag('MOD',3,true)); + + return $status; + } + + + function attforblock_backup_attendance_sessions ($bf,$preferences,$attforblock) { + + global $CFG; + + $status = true; + + $datas = get_records('attendance_sessions', 'courseid', $attforblock->course); + if ($datas) { + //Write start tag + $status =fwrite ($bf,start_tag('SESSIONS',4,true)); + //Iterate over each session + foreach ($datas as $item) { + //Start session + $status =fwrite ($bf,start_tag('SESSION',5,true)); + //Print contents + fwrite ($bf,full_tag('ID',6,false,$item->id)); + fwrite ($bf,full_tag('COURSEID',6,false,$item->courseid)); + fwrite ($bf,full_tag('SESSDATE',6,false,$item->sessdate)); + fwrite ($bf,full_tag('DURATION',6,false,$item->duration)); + fwrite ($bf,full_tag('TIMEMODIFIED',6,false,$item->timemodified)); + fwrite ($bf,full_tag('DESCRIPTION',6,false,$item->description)); + if (backup_userdata_selected($preferences, 'attforblock', $attforblock->id)) { + fwrite ($bf,full_tag('LASTTAKEN',6,false,$item->lasttaken)); + fwrite ($bf,full_tag('LASTTAKENBY',6,false,$item->lasttakenby)); + } else { + fwrite ($bf,full_tag('LASTTAKEN',6,false,0)); + fwrite ($bf,full_tag('LASTTAKENBY',6,false,0)); + } + //End submission + $status =fwrite ($bf,end_tag('SESSION',5,true)); + } + //Write end tag + $status =fwrite ($bf,end_tag('SESSIONS',4,true)); + } + return $status; + } + + + function attforblock_backup_attendance_statuses ($bf,$preferences,$attforblock) { + + global $CFG; + + $status = true; + + $datas = get_records('attendance_statuses', 'courseid', $attforblock->course); + //If there is levels + if ($datas) { + //Write start tag + $status =fwrite ($bf,start_tag('STATUSES',4,true)); + //Iterate over each status + foreach ($datas as $item) { + //Start status + $status =fwrite ($bf,start_tag('STATUS',5,true)); + //Print status contents + fwrite ($bf,full_tag('ID',6,false,$item->id)); + fwrite ($bf,full_tag('COURSEID',6,false,$item->courseid)); + fwrite ($bf,full_tag('ACRONYM',6,false,$item->acronym)); + fwrite ($bf,full_tag('DESCRIPTION',6,false,$item->description)); + fwrite ($bf,full_tag('GRADE',6,false,$item->grade)); + fwrite ($bf,full_tag('VISIBLE',6,false,$item->visible)); + fwrite ($bf,full_tag('DELETED',6,false,$item->deleted)); + //End submission + $status =fwrite ($bf,end_tag('STATUS',5,true)); + } + //Write end tag + $status =fwrite ($bf,end_tag('STATUSES',4,true)); + } + return $status; + } + + + + function attforblock_backup_attendance_log ($bf,$preferences,$attforblock) { + + global $CFG; + + $status = true; + + $sessions = get_records_menu('attendance_sessions', 'courseid', $attforblock->course); + $sesslist = implode(',', array_keys($sessions)); + $datas = get_records_list('attendance_log', 'sessionid', $sesslist); + //If there is levels + if ($datas) { + //Write start tag + $status = fwrite ($bf,start_tag('LOGS',4,true)); + //Iterate over each log + foreach ($datas as $item) { + //Start log + $status = fwrite ($bf,start_tag('LOG',5,true)); + //Print log contents + fwrite ($bf,full_tag('ID',6,false,$item->id)); + fwrite ($bf,full_tag('SESSIONID',6,false,$item->sessionid)); + fwrite ($bf,full_tag('STUDENTID',6,false,$item->studentid)); + fwrite ($bf,full_tag('STATUSID',6,false,$item->statusid)); + fwrite ($bf,full_tag('TIMETAKEN',6,false,$item->timetaken)); + fwrite ($bf,full_tag('TAKENBY',6,false,$item->takenby)); + fwrite ($bf,full_tag('STATUSSET',6,false,$item->statusset)); + fwrite ($bf,full_tag('REMARKS',6,false,$item->remarks)); + //End submission + $status = fwrite ($bf,end_tag('LOG',5,true)); + } + //Write end tag + $status = fwrite ($bf,end_tag('LOGS',4,true)); + } + return $status; + } + + +?> \ No newline at end of file diff --git a/db/access.php b/db/access.php new file mode 100644 index 0000000..2e4b6c4 --- /dev/null +++ b/db/access.php @@ -0,0 +1,124 @@ +: +// +// component_name should be the same as the directory name of the mod or block. +// +// Core moodle capabilities are defined thus: +// moodle/: +// +// Examples: mod/forum:viewpost +// block/recent_activity:view +// moodle/site:deleteuser +// +// The variable name for the capability definitions array follows the format +// $__capabilities +// +// For the core capabilities, the variable is $moodle_capabilities. + + +$mod_attforblock_capabilities = array( + + 'mod/attforblock:view' => array( + + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'student' => CAP_ALLOW, + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:viewreports' => array( + + 'riskbitmask' => RISK_PERSONAL, + + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:takeattendances' => array( + + 'riskbitmask' => RISK_DATALOSS, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:changeattendances' => array( + + 'riskbitmask' => RISK_DATALOSS, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:manageattendances' => array( + + 'riskbitmask' => RISK_CONFIG, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:changepreferences' => array( + + 'riskbitmask' => RISK_CONFIG, + + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ), + + 'mod/attforblock:export' => array( + + 'riskbitmask' => RISK_PERSONAL, + + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'legacy' => array( + 'editingteacher' => CAP_ALLOW, + 'admin' => CAP_ALLOW + ) + ) +); + +?> diff --git a/db/install.xml b/db/install.xml new file mode 100644 index 0000000..0974663 --- /dev/null +++ b/db/install.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/db/upgrade.php b/db/upgrade.php new file mode 100644 index 0000000..cc16f38 --- /dev/null +++ b/db/upgrade.php @@ -0,0 +1,221 @@ +id) > 0) { + $sess->takenby = $USER->id; + $sess->timetaken = $sess->timemodified ? $sess->timemodified : time(); + $sess->description = addslashes($sess->description); + $result = update_record('attendance_sessions', $sess) and $result; + } + } + } + } + + if ($oldversion < 2008102401 and $result) { + + $table = new XMLDBTable('attforblock'); + + $field = new XMLDBField('grade'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, null, '100', 'name'); + $result = $result && add_field($table, $field); + + + $table = new XMLDBTable('attendance_sessions'); + + $field = new XMLDBField('courseid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id'); + $result = $result && change_field_unsigned($table, $field); + +// $field = new XMLDBField('creator'); +// $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courseid'); +// $result = $result && change_field_unsigned($table, $field); + + $field = new XMLDBField('sessdate'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'creator'); + $result = $result && change_field_unsigned($table, $field); + + $field = new XMLDBField('duration'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'sessdate'); + $result = $result && add_field($table, $field); + + $field = new XMLDBField('timetaken'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'takenby'); + $result = $result && change_field_unsigned($table, $field); + $result = $result && rename_field($table, $field, 'lasttaken'); + + $field = new XMLDBField('takenby'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'lasttaken'); + $result = $result && change_field_unsigned($table, $field); + $result = $result && rename_field($table, $field, 'lasttakenby'); + + $field = new XMLDBField('timemodified'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'lasttaken'); + $result = $result && change_field_unsigned($table, $field); + + + $table = new XMLDBTable('attendance_log'); + + $field = new XMLDBField('attsid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id'); + $result = $result && change_field_unsigned($table, $field); + + $field = new XMLDBField('studentid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'attsid'); + $result = $result && change_field_unsigned($table, $field); + + $field = new XMLDBField('statusid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'status'); + $result = $result && add_field($table, $field); + + $field = new XMLDBField('statusset'); + $field->setAttributes(XMLDB_TYPE_CHAR, '100', null, null, null, null, null, null, 'statusid'); + $result = $result && add_field($table, $field); + + $field = new XMLDBField('timetaken'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'statusid'); + $result = $result && add_field($table, $field); + + $field = new XMLDBField('takenby'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timetaken'); + $result = $result && add_field($table, $field); + + //Indexes + $index = new XMLDBIndex('statusid'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('statusid')); + $result = $result && add_index($table, $index); + + $index = new XMLDBIndex('attsid'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('attsid')); + $result = $result && drop_index($table, $index); + + $field = new XMLDBField('attsid'); //Rename field + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id'); + $result = $result && rename_field($table, $field, 'sessionid'); + + $index = new XMLDBIndex('sessionid'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('sessionid')); + $result = $result && add_index($table, $index); + + + $table = new XMLDBTable('attendance_settings'); + + $field = new XMLDBField('courseid'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'id'); + $result = $result && change_field_unsigned($table, $field); + + $field = new XMLDBField('visible'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'grade'); + $result = $result && add_field($table, $field); + + $field = new XMLDBField('deleted'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'visible'); + $result = $result && add_field($table, $field); + + //Indexes + $index = new XMLDBIndex('visible'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('visible')); + $result = $result && add_index($table, $index); + + $index = new XMLDBIndex('deleted'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('deleted')); + $result = $result && add_index($table, $index); + + $result = $result && rename_table($table, 'attendance_statuses'); + } + + if ($oldversion < 2008102406 and $result) { + + if ($courses = get_records_sql("SELECT courseid FROM {$CFG->prefix}attendance_sessions GROUP BY courseid")) { + foreach ($courses as $c) { + //Adding own status for course (now it must have own) + if (!count_records('attendance_statuses', 'courseid', $c->courseid)) { + $statuses = get_records('attendance_statuses', 'courseid', 0); + foreach($statuses as $stat) { + $rec = $stat; + $rec->courseid = $c->courseid; + insert_record('attendance_statuses', $rec); + } + } + $statuses = get_records('attendance_statuses', 'courseid', $c->courseid); + $statlist = implode(',', array_keys($statuses)); + $sess = get_records_select_menu('attendance_sessions', "courseid = $c->courseid AND lasttakenby > 0"); + $sesslist = implode(',', array_keys($sess)); + foreach($statuses as $stat) { + execute_sql("UPDATE {$CFG->prefix}attendance_log + SET statusid = {$stat->id}, statusset = '$statlist' + WHERE sessionid IN ($sesslist) AND status = '$stat->status'"); + } + $sessions = get_records_list('attendance_sessions', 'id', $sesslist); + foreach($sessions as $sess) { + execute_sql("UPDATE {$CFG->prefix}attendance_log + SET timetaken = {$sess->lasttaken}, + takenby = {$sess->lasttakenby} + WHERE sessionid = {$sess->id}"); + } + + } + } + + } + + if ($oldversion < 2008102409 and $result) { + $table = new XMLDBTable('attendance_statuses'); + + $field = new XMLDBField('status'); + $result = $result && drop_field($table, $field); + + $index = new XMLDBIndex('status'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status')); + $result = $result && drop_index($table, $index); + + + $table = new XMLDBTable('attendance_log'); + + $field = new XMLDBField('status'); + $result = $result && drop_field($table, $field); + + $index = new XMLDBIndex('status'); + $index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('status')); + $result = $result && drop_index($table, $index); + + $table = new XMLDBTable('attendance_sessions'); + + $field = new XMLDBField('creator'); + $result = $result && drop_field($table, $field); + + } + return $result; +} + +?> diff --git a/duration_form.php b/duration_form.php new file mode 100644 index 0000000..b09ac83 --- /dev/null +++ b/duration_form.php @@ -0,0 +1,48 @@ +libdir.'/formslib.php'); + +class mod_attforblock_duration_form extends moodleform { + + function definition() { + + global $CFG; + $mform =& $this->_form; + + $course = $this->_customdata['course']; + $cm = $this->_customdata['cm']; + $modcontext = $this->_customdata['modcontext']; + $ids = $this->_customdata['ids']; + + $mform->addElement('header', 'general', get_string('changeduration','attforblock')); + $mform->addElement('static', 'count', get_string('countofselected','attforblock'), count(explode('_', $ids))); + + for ($i=0; $i<=23; $i++) { + $hours[$i] = sprintf("%02d",$i); + } + for ($i=0; $i<60; $i+=5) { + $minutes[$i] = sprintf("%02d",$i); + } + $durselect[] =& MoodleQuickForm::createElement('select', 'hours', '', $hours); + $durselect[] =& MoodleQuickForm::createElement('select', 'minutes', '', $minutes, false, true); + $mform->addGroup($durselect, 'durtime', get_string('newduration','attforblock'), array(' '), true); + + $mform->addElement('hidden', 'ids', $ids); + $mform->addElement('hidden', 'id', $cm->id); + $mform->addElement('hidden', 'action', 'changeduration'); + + $mform->setDefaults(array('durtime' => array('hours'=>0, 'minutes'=>0))); + +//------------------------------------------------------------------------------- + // buttons + $submit_string = get_string('update', 'attforblock'); + $this->add_action_buttons(true, $submit_string); + +// $mform->addElement('hidden', 'id', $cm->id); +// $mform->addElement('hidden', 'sessionid', $sessionid); +// $mform->addElement('hidden', 'action', 'changeduration'); + + } + +} +?> diff --git a/export.php b/export.php new file mode 100644 index 0000000..d2ec5ce --- /dev/null +++ b/export.php @@ -0,0 +1,187 @@ +course)) { + error("Course is misconfigured"); + } + + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + + require_login($course->id); + + $context = get_context_instance(CONTEXT_MODULE, $cm->id); + require_capability('mod/attforblock:export', $context); + + $mform_export = new mod_attforblock_export_form('export.php', array('course'=>$course, 'cm'=>$cm, 'modcontext'=>$context)); + + if ($fromform = $mform_export->get_data()) { + $group = groups_get_group($fromform->group); + if ($group) { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', 'u.lastname ASC', '', '', $group->id, '', false); + } else { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', 'u.lastname ASC', '', '', '', '', false); + } + + if ($students) { + $filename = clean_filename($course->shortname.'_Attendances_'.userdate(time(), '%Y%m%d-%H%M')); + + $data->tabhead = array(); +// $data->sheettitle = $course->fullname.' - '; +// $data->sheettitle .= $group ? $group->name : get_string('allparticipants'); + $data->course = $course->fullname; + $data->group = $group ? $group->name : get_string('allparticipants'); + + if (isset($fromform->ident['id'])) { + $data->tabhead[] = get_string('studentid','attforblock'); + } + if (isset($fromform->ident['uname'])) { + $data->tabhead[] = get_string('username'); + } + $data->tabhead[] = get_string('lastname'); + $data->tabhead[] = get_string('firstname'); + + $select = "courseid = {$course->id} AND sessdate >= {$course->startdate}"; + if (isset($fromform->includenottaken)) { + $select .= " AND sessdate <= {$fromform->sessionenddate}"; + } else { + $select .= " AND lasttaken != 0"; + } + + if ($sessions = get_records_select('attendance_sessions', $select, 'sessdate ASC')) { + foreach($sessions as $sess) { + $data->tabhead[] = userdate($sess->sessdate, get_string('strftimedmyhm', 'attforblock')); + } + } else { + error('Sessions not found!', 'report.php?id='.$id); + } + $data->tabhead[] = '%'; + + $i = 0; + $data->table = array(); + $statuses = get_statuses($course->id); + foreach($students as $student) { + if (isset($fromform->ident['id'])) { + $data->table[$i][] = $student->id; + } + if (isset($fromform->ident['uname'])) { + $data->table[$i][] = $student->username; + } + $data->table[$i][] = $student->lastname; + $data->table[$i][] = $student->firstname; + foreach ($sessions as $sess) { + if ($rec = get_record('attendance_log', 'sessionid', $sess->id, 'studentid', $student->id)) { + $data->table[$i][] = $statuses[$rec->statusid]->acronym; + } else { + $data->table[$i][] = '-'; + } + } + $data->table[$i][] = get_percent($student->id, $course).'%'; + $i++; + } + + if ($fromform->format === 'text') { + ExportToCSV($data, $filename); + } else { + ExportToTableEd($data, $filename, $fromform->format); + } + exit; + } else { + error('Students not found!', 'report.php?id='.$id); + } + } else { + /// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity'); + $navlinks[] = array('name' => get_string('export', 'quiz'), 'link' => null, 'type' => 'activityinstance'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - ' .get_string('export', 'quiz'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + + show_tabs($cm, $context, 'export'); + $mform_export->display(); + } + print_footer($course); + +///////////////////////////////////////////////////////////////////////////////// + +function ExportToTableEd($data, $filename, $format) { + global $CFG; + + if ($format === 'excel') { + require_once("$CFG->libdir/excellib.class.php"); + $filename .= ".xls"; + $workbook = new MoodleExcelWorkbook("-"); + } else { + require_once("$CFG->libdir/odslib.class.php"); + $filename .= ".ods"; + $workbook = new MoodleODSWorkbook("-"); + } +/// Sending HTTP headers + $workbook->send($filename); +/// Creating the first worksheet + $myxls =& $workbook->add_worksheet('Attendances'); +/// format types + $formatbc =& $workbook->add_format(); + $formatbc->set_bold(1); + + $myxls->write(0, 0, get_string('course'), $formatbc); + $myxls->write(0, 1, $data->course); + $myxls->write(1, 0, get_string('group'), $formatbc); + $myxls->write(1, 1, $data->group); + + $i = 3; + $j = 0; + foreach ($data->tabhead as $cell) { + $myxls->write($i, $j++, $cell, $formatbc); + } + $i++; + $j = 0; + foreach ($data->table as $row) { + foreach ($row as $cell) { + $myxls->write($i, $j++, $cell); +// if (is_numeric($cell)) { +// $myxls->write_number($i, $j++, $cell); +// } else { +// $myxls->write_string($i, $j++, $cell); +// } + } + $i++; + $j = 0; + } + $workbook->close(); +} + +function ExportToCSV($data, $filename) { + $filename .= ".txt"; + + header("Content-Type: application/download\n"); + header("Content-Disposition: attachment; filename=\"$filename\""); + header("Expires: 0"); + header("Cache-Control: must-revalidate,post-check=0,pre-check=0"); + header("Pragma: public"); + + echo get_string('course')."\t".$data->course."\n"; + echo get_string('group')."\t".$data->group."\n\n"; + + echo implode("\t", $data->tabhead)."\n"; + foreach ($data->table as $row) { + echo implode("\t", $row)."\n"; + } +} + +?> diff --git a/export_form.php b/export_form.php new file mode 100644 index 0000000..610a7cc --- /dev/null +++ b/export_form.php @@ -0,0 +1,113 @@ +libdir.'/formslib.php'); + +class mod_attforblock_export_form extends moodleform { + + function definition() { + + global $CFG, $USER; + $mform =& $this->_form; + + $course = $this->_customdata['course']; + $cm = $this->_customdata['cm']; +// $coursecontext = $this->_customdata['coursecontext']; + $modcontext = $this->_customdata['modcontext']; +// $forum = $this->_customdata['forum']; +// $post = $this->_customdata['post']; // hack alert + + + $mform->addElement('header', 'general', get_string('export','quiz')); + $mform->setHelpButton('general', array('export', get_string('export','quiz'), 'attforblock')); + +// $mform->addElement('date_selector', 'sessiondate', get_string('sessiondate','attforblock')); + $groupmode=groups_get_activity_groupmode($cm); + $groups = groups_get_activity_allowed_groups($cm, $USER->id); + if ($groupmode == VISIBLEGROUPS or has_capability('moodle/site:accessallgroups', $modcontext)) { + $grouplist[0] = get_string('allparticipants'); + } + if ($groups) { + foreach ($groups as $group) { + $grouplist[$group->id] = $group->name; + } + } + $mform->addElement('select', 'group', get_string('group'), $grouplist); + + $ident = array(); + $ident[] =& MoodleQuickForm::createElement('checkbox', 'id', '', get_string('studentid', 'attforblock')); + $ident[] =& MoodleQuickForm::createElement('checkbox', 'uname', '', get_string('username')); + $mform->addGroup($ident, 'ident', get_string('identifyby','attforblock'), array('
'), true); + $mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true)); + + + + + +// for ($i=0; $i<=23; $i++) { +// $hours[$i] = sprintf("%02d",$i); +// } +// for ($i=0; $i<60; $i+=5) { +// $minutes[$i] = sprintf("%02d",$i); +// } +// $stime = array(); +// $stime[] =& MoodleQuickForm::createElement('select', 'hours', get_string('hour', 'form'), $hours, false, true); +// $stime[] =& MoodleQuickForm::createElement('select', 'minutes', get_string('minute', 'form'), $minutes, false, true); +// $mform->addGroup($stime, 'stime', get_string('sessionstarttime','attforblock'), array(' '), true); + +// $durtime = array(); +// $durtime[] =& MoodleQuickForm::createElement('select', 'hours', get_string('hour', 'form'), $hours, false, true); +// $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', 'includenottaken', get_string('includenottaken','attforblock'), get_string('yes')); + $mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod','attforblock')); + $mform->disabledIf('sessionenddate', 'includenottaken', 'notchecked'); + + $mform->addElement('select', 'format', get_string('format'), + array('excel' => get_string('downloadexcel','attforblock'), + 'ooo' => get_string('downloadooo','attforblock'), + 'text' => get_string('downloadtext','attforblock') + )); + +// $opts = array(); +// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Mon', '', get_string('monday','calendar')); +//// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Tue', '', get_string('tuesday','calendar')); +//// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Wed', '', get_string('wednesday','calendar')); +//// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Thu', '', get_string('thursday','calendar')); +//// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Fri', '', get_string('friday','calendar')); +//// $opts[] =& MoodleQuickForm::createElement('checkbox', 'Sat', '', get_string('saturday','calendar')); +// $mform->addGroup($opts, 'opts', get_string('sessiondays','attforblock'), array(' '), true); +// $mform->disabledIf('opts', 'addmultiply', 'notchecked'); +// +// $period = array(1=>1,2,3,4,5,6,7,8); +// $periodgroup = array(); +// $periodgroup[] =& MoodleQuickForm::createElement('select', 'period', '', $period, false, true); +// $periodgroup[] =& MoodleQuickForm::createElement('static', 'perioddesc', '', get_string('week','attforblock')); +// $mform->addGroup($periodgroup, 'periodgroup', get_string('period','attforblock'), array(' '), false); +// $mform->disabledIf('periodgroup', 'addmultiply', 'notchecked'); +// +// $mform->addElement('text', 'sdescription', get_string('description', 'attforblock'), 'size="48"'); +// $mform->setType('sdescription', PARAM_TEXT); +// $mform->addRule('sdescription', get_string('maximumchars', '', 100), 'maxlength', 100, 'client'); + +//------------------------------------------------------------------------------- + // buttons + $submit_string = get_string('ok'); + $this->add_action_buttons(false, $submit_string); + + $mform->addElement('hidden', 'id', $cm->id); +// $mform->addElement('hidden', 'action', 'add'); + + } + +// function validation($data, $files) { +// $errors = parent::validation($data, $files); +// if (($data['timeend']!=0) && ($data['timestart']!=0) +// && $data['timeend'] <= $data['timestart']) { +// $errors['timeend'] = get_string('timestartenderror', 'forum'); +// } +// return $errors; +// } + +} +?> diff --git a/icon.gif b/icon.gif new file mode 100644 index 0000000..5157566 Binary files /dev/null and b/icon.gif differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..e9ad94b --- /dev/null +++ b/index.php @@ -0,0 +1,20 @@ +coursemodule"); + } else { + print_error('notfound', 'attforblock'); + } + +?> diff --git a/lang/cs_utf8/attforblock.php b/lang/cs_utf8/attforblock.php new file mode 100644 index 0000000..465345a --- /dev/null +++ b/lang/cs_utf8/attforblock.php @@ -0,0 +1,116 @@ +Odstranění tohoto modulu neodstraní data!'; +$string['modulename'] = 'Docházka'; +$string['modulenameplural'] = 'Docházky'; +$string['months'] = 'Měsíce'; +$string['myvariables'] = 'Volby'; +$string['newdate'] = 'Nové datum'; +$string['newduration'] = 'Nové trvání'; +$string['noattforuser'] = 'Pro uživatele neexistují žádné záznamy docházky'; +$string['nodescription'] = 'Řádný záznam třídy'; +$string['noguest'] = 'Hosté nemohou vidět docházku'; +$string['noofdaysabsent'] = 'Žádné dny absence'; +$string['noofdaysexcused'] = 'Žádné dny omluvené'; +$string['noofdayslate'] = 'Žádné dny pozdě'; +$string['noofdayspresent'] = 'Žádné dny přítomen'; +$string['nosessiondayselected'] = 'Nebyl vybrán žádný den se záznamem'; +$string['nosessionexists'] = 'Pro tento kurz neexistují žádné záznamy'; +$string['notfound'] = 'Docházková činnost nebyla v tomto kurzu nalezena!'; +$string['olddate'] = 'Staré datum'; +$string['period'] = 'Frekvence'; +$string['remarks'] = 'Poznámky'; +$string['report'] = 'Přehled'; +$string['resetdescription'] = 'Nezapomeňte, že smazání docházkových dat smaže informace z databáze. Můžete skrýt starší záznamy změnou data zahájení kurzu.'; +$string['resetstatuses'] = 'Obnovit stavy do výchozích hodnot'; +$string['restoredefaults'] = 'Obnovit výchozí'; +$string['session'] = 'Záznam'; +$string['sessionadded'] = 'Záznam úspěšně přidán'; +$string['sessionalreadyexists'] = 'Záznam pro toto datum již existuje'; +$string['sessiondate'] = 'Datum záznamu'; +$string['sessiondays'] = 'Dny'; +$string['sessiondeleted'] = 'Záznam úspěšně smazán'; +$string['sessionenddate'] = 'Koncové datum záznamů'; +$string['sessionexist'] = 'Záznam nebyl přidán (již existuje)!'; +$string['sessions'] = 'Záznamy'; +$string['sessionscompleted'] = 'Všechny záznamy'; +$string['sessionsgenerated'] = 'Záznamy úspěšně vygenerovány'; +$string['sessionstartdate'] = 'Počáteční datum záznamů'; +$string['sessionupdated'] = 'Záznam úspěšně aktualizován'; +$string['settings'] = 'Nastavení'; +$string['showdefaults'] = 'Ukázat výchozí'; +$string['status'] = 'Stav'; +$string['strftimedm'] = '%%d.%%m.'; +$string['strftimedmy'] = '%%d.%%m.%%Y'; +$string['strftimedmyhm'] = '%%d.%%m.%%Y %%H:%%M'; // line added to allow multiple sessions in the same day +$string['strftimedmyw'] = '%%A %%d.%%m.%%Y'; +$string['strftimehm'] = '%%H:%%M'; //line added to allow display of time +$string['strftimeshortdate'] = '%%d.%%m.%%Y'; +$string['studentid'] = 'ID studenta'; +$string['takeattendance'] = 'Vyplnit docházku'; +$string['thiscourse'] = 'Tento kurz'; +$string['update'] = 'Aktualizovat'; +$string['variablesupdated'] = 'Volby úspěšně aktualizovány'; +$string['versionforprinting'] = 'verze pro tisk'; +$string['week'] = 'týdnů'; +$string['weeks'] = 'Týdny'; +$string['youcantdo'] = 'Nemůžete nic udělat'; + +?> diff --git a/lang/de/attforblock.php b/lang/de/attforblock.php new file mode 100644 index 0000000..7261cfa --- /dev/null +++ b/lang/de/attforblock.php @@ -0,0 +1,84 @@ + \ No newline at end of file diff --git a/lang/en_us_utf8/README b/lang/en_us_utf8/README new file mode 100644 index 0000000..829e352 --- /dev/null +++ b/lang/en_us_utf8/README @@ -0,0 +1,11 @@ +US English is only slightly different from standard English. + +Only a few words are changed, like : + + enrolment -> enrollment + colour -> color + +Note that many help files and strings may be missing but this +doesn't matter much. Because the "parent language" of this +pack is "en", missing strings will be taken from there. +So you should also copy en_utf8 language files. \ No newline at end of file diff --git a/lang/en_us_utf8/attforblock.php b/lang/en_us_utf8/attforblock.php new file mode 100644 index 0000000..976675e --- /dev/null +++ b/lang/en_us_utf8/attforblock.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/lang/en_utf8/attforblock.php b/lang/en_utf8/attforblock.php new file mode 100644 index 0000000..cee5f09 --- /dev/null +++ b/lang/en_utf8/attforblock.php @@ -0,0 +1,119 @@ +Removal of this module will not entail removal of the data!'; +$string['modulename'] = 'Attendance'; +$string['modulenameplural'] = 'Attendances'; +$string['months'] = 'Months'; +$string['myvariables'] = 'My Variables'; +$string['newdate'] = 'New date'; +$string['newduration'] = 'New duration'; +$string['noattforuser'] = 'No attendance records exist for the user'; +$string['nodescription'] = 'Regular class session'; +$string['noguest'] = 'Guest can\'t see attendance'; +$string['noofdaysabsent'] = 'No of days absent'; +$string['noofdaysexcused'] = 'No of days excused'; +$string['noofdayslate'] = 'No of days late'; +$string['noofdayspresent'] = 'No of days present'; +$string['nosessiondayselected'] = 'No Session day selected'; +$string['nosessionexists'] = 'No Session exists for this course'; +$string['notfound'] = 'Attendance activity not found in this course!'; +$string['olddate'] = 'Old date'; +$string['period'] = 'Frequency'; +$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'; +$string['restoredefaults'] = 'Restore defaults'; +$string['session'] = 'Session'; +$string['sessionadded'] = 'Session successfully added'; +$string['sessionalreadyexists'] = 'Session already exists for this date'; +$string['sessiondate'] = 'Session Date'; +$string['sessiondays'] = 'Session Days'; +$string['sessiondeleted'] = 'Session successfully deleted'; +$string['sessionenddate'] = 'Session end date'; +$string['sessionexist'] = 'Session not added (already exists)!'; +$string['sessions'] = 'Sessions'; +$string['sessionscompleted'] = 'Sessions completed'; +$string['sessionsgenerated'] = 'Sessions successfully generated'; +$string['sessionstartdate'] = 'Session start date'; +$string['sessionupdated'] = 'Session successfully updated'; +$string['settings'] = 'Settings'; +$string['showdefaults'] = 'Show defaults'; +$string['status'] = 'Status'; +$string['statusdeleted'] = 'Status deleted'; +$string['strftimedm'] = '%%d.%%m'; +$string['strftimedmy'] = '%%d.%%m.%%Y'; +$string['strftimedmyhm'] = '%%d.%%m.%%Y %%H.%%M'; // line added to allow multiple sessions in the same day +$string['strftimedmyw'] = '%%d.%%m.%%y (%%a)'; +$string['strftimehm'] = '%%H:%%M'; //line added to allow display of time +$string['strftimeshortdate'] = '%%d.%%m.%%Y'; +$string['studentid'] = 'Student ID'; +$string['takeattendance'] = 'Take attendance'; +$string['thiscourse'] = 'This course'; +$string['update'] = 'Update'; +$string['variable'] = 'variable'; +$string['variablesupdated'] = 'Variables successfully updated'; +$string['versionforprinting'] = 'version for printing'; +$string['week'] = 'week(s)'; +$string['weeks'] = 'Weeks'; +$string['youcantdo'] = 'You can\'t do anything'; + +?> diff --git a/lang/en_utf8/help/attforblock/createmultiplesessions.html b/lang/en_utf8/help/attforblock/createmultiplesessions.html new file mode 100644 index 0000000..4751943 --- /dev/null +++ b/lang/en_utf8/help/attforblock/createmultiplesessions.html @@ -0,0 +1,12 @@ +

Attendance

+ +

Create Multiple Sessions

+

This function allows you to create multiple sessions in one simple + step.

+ Session Start Date: Select the start date of your course + (the first day of class)
+ Session End Date: Select the last + day of class (the last day you want to take attendance).
+ Session Days: Select the days of the week when your class will meet (for example, Monday/Wednesday/Friday).
+ Frequency: This allows for a frequency setting. If your class will meet every week, select + 1; if it will meet every other week, select 2; every 3rd week, select 3, etc.

diff --git a/lang/en_utf8/help/attforblock/createonesession.html b/lang/en_utf8/help/attforblock/createonesession.html new file mode 100644 index 0000000..4c156ca --- /dev/null +++ b/lang/en_utf8/help/attforblock/createonesession.html @@ -0,0 +1,4 @@ +

Attendance

+

Create One Session

+

To create one session that you want to take attendance for, select + the date, enter a description (optional) and click on "Add Session".

diff --git a/lang/en_utf8/help/attforblock/defaultstatuses.html b/lang/en_utf8/help/attforblock/defaultstatuses.html new file mode 100644 index 0000000..f3e006f --- /dev/null +++ b/lang/en_utf8/help/attforblock/defaultstatuses.html @@ -0,0 +1,26 @@ +

+ + + + + + + + + + + + + + + + + +
#
.status;?>acronym;?>description;?>grade;?>
\ No newline at end of file diff --git a/lang/en_utf8/help/attforblock/display.html b/lang/en_utf8/help/attforblock/display.html new file mode 100644 index 0000000..cae87ce --- /dev/null +++ b/lang/en_utf8/help/attforblock/display.html @@ -0,0 +1,6 @@ +

Attendance

+

Display

+

Use this option to modify the way the attendance record is displayed. + You can chose between "all taken" which will show all sessions, "weeks" + which will show weekly averages, and "months" to display monthly averages + for each student.

diff --git a/lang/en_utf8/help/attforblock/export.html b/lang/en_utf8/help/attforblock/export.html new file mode 100644 index 0000000..2ee8c6f --- /dev/null +++ b/lang/en_utf8/help/attforblock/export.html @@ -0,0 +1,3 @@ +

Attendance

+

Export

+

Use this option to select the format for the export data.

diff --git a/lang/en_utf8/help/attforblock/hiddensessions.html b/lang/en_utf8/help/attforblock/hiddensessions.html new file mode 100644 index 0000000..b4d7924 --- /dev/null +++ b/lang/en_utf8/help/attforblock/hiddensessions.html @@ -0,0 +1,6 @@ +

Attendance

+

Hidden sessions

+

Session hides if course's start date older than its date. +Change start date of course and hidden sessions will be shown.

+

You can use this feature to hide older sessions instead delete. +Remember than only visible sessions using in Gradebook.

\ No newline at end of file diff --git a/lang/en_utf8/help/attforblock/myvariables.html b/lang/en_utf8/help/attforblock/myvariables.html new file mode 100644 index 0000000..424e398 --- /dev/null +++ b/lang/en_utf8/help/attforblock/myvariables.html @@ -0,0 +1,4 @@ +

Attendance

+

My Variables

+

Change settings here to modify the default attendance categories + and points assigned to each category.

diff --git a/lang/en_utf8/help/attforblock/report.html b/lang/en_utf8/help/attforblock/report.html new file mode 100644 index 0000000..934bd42 --- /dev/null +++ b/lang/en_utf8/help/attforblock/report.html @@ -0,0 +1,5 @@ +

Attendance

+

Report

+

Modify attendance data by adjusting the display settings. Data + may also be downloaded for offline viewing and analysis via the "Report" + pulldown menu found at the bottom of the report screen.

diff --git a/lang/en_utf8/help/attforblock/sessions.html b/lang/en_utf8/help/attforblock/sessions.html new file mode 100644 index 0000000..470c4f7 --- /dev/null +++ b/lang/en_utf8/help/attforblock/sessions.html @@ -0,0 +1,20 @@ +

Attendance module

+

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

+

Attendance sessions are shown here. If no sessions appear, click + on the "Add" tab to create new sessions.

+

Take attendance by clicking on the green icon under the "actions" + menu (left side).

+

Edit each session by clicking on the middle "edit session" + icon. After taking attendance you can edit the session by clicking on the description. +

+

Delete the session entirely by clicking on the delete icon on + the right side.

diff --git a/lang/en_utf8/help/attforblock/studentview.html b/lang/en_utf8/help/attforblock/studentview.html new file mode 100644 index 0000000..8e3a4ca --- /dev/null +++ b/lang/en_utf8/help/attforblock/studentview.html @@ -0,0 +1,3 @@ +

Attendance

+

Student View

+

This screen allows you to view the attendance records for a single student. Use the "version for printing" link to print a copy without the tabs and headers displayed on the webpage.

diff --git a/lang/es_utf8/attforblock.php b/lang/es_utf8/attforblock.php new file mode 100644 index 0000000..6c44f82 --- /dev/null +++ b/lang/es_utf8/attforblock.php @@ -0,0 +1,113 @@ +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.'; +$string['modulename'] = 'Asistencia'; +$string['modulenameplural'] = 'Asistencias'; +$string['months'] = 'Meses'; +$string['myvariables'] = 'Mis Variables'; +$string['newdate'] = 'Nueva Fecha'; +$string['newduration'] = 'Nueva duración'; +$string['noattforuser'] = 'No existen registros de asistencia para el usuario'; +$string['nodescription'] = 'Sesión de Clase Normal'; +$string['noguest'] = 'Los invitados no pueden ver la asistencia'; +$string['noofdaysabsent'] = 'Nº de días de ausencia'; +$string['noofdaysexcused'] = 'Nº de días con faltas justificadas'; +$string['noofdayslate'] = 'Nº de días de retrasos'; +$string['noofdayspresent'] = 'Nº de días de asistencia'; +$string['nosessiondayselected'] = 'No se ha seleccionado día de Sesión'; +$string['nosessionexists'] = 'No existen Sesiones para este curso'; +$string['notfound'] = 'No se ha encontrado ninguna actividad Asistencia en este curso'; +$string['olddate'] = 'Fecha Anterior'; +$string['Pacronym'] = 'P'; +$string['period'] = 'Frecuencia'; +$string['Pfull'] = 'Presente'; +$string['remarks'] = 'Observaciones'; +$string['report'] = 'Informe'; +$string['resetdescription'] = 'Recuerde que eliminando los datos de la asistencia provocará el borrado de información en la base de datos. Usted puede ocultar sesiones anteriores cambiando la fecha de inicio del curso en la zona de administración.'; +$string['resetstatuses'] = 'Reinicar la configuración por defecto'; +$string['restoredefaults'] = 'Restarurar valores por defecto'; +$string['session'] = 'Sesión'; +$string['sessionadded'] = 'Sesión añadida con éxito'; +$string['sessionalreadyexists'] = 'Ya existe una sesión para la fecha indicada'; +$string['sessiondate'] = 'Fecha de la Sesión'; +$string['sessiondays'] = 'Días de Sesión'; +$string['sessiondeleted'] = 'Sesión eliminada con éxito'; +$string['sessionenddate'] = 'Fecha de Fin de Sesión'; +$string['sessionexist'] = 'Sesión no añadida (ya existe)'; +$string['sessions'] = 'Sesiones'; +$string['sessionscompleted'] = 'Sesiones completadas'; +$string['sessionsgenerated'] = 'Sesiones generadas con éxito'; +$string['sessionstartdate'] = 'Fecha de Inicio de la Sesión'; +$string['sessionupdated'] = 'Sesión actualizada con éxito'; +$string['settings'] = 'Configuración'; +$string['showdefaults'] = 'Mostrar opciones por defecto'; +$string['status'] = 'Estado'; +$string['strftimedm'] = '%%d.%%m'; +$string['strftimedmy'] = '%%d.%%m.%%Y'; +$string['strftimedmyhm'] = '%%d.%%m.%%Y %%H.%%M'; +$string['strftimedmyw'] = '%%d.%%m.%%y (%%a)'; +$string['strftimehm'] = '%%H:%%M'; +$string['strftimeshortdate'] = '%%d.%%m.%%Y'; +$string['studentid'] = 'ID de Estudiante'; +$string['takeattendance'] = 'Iniciar Asistencia'; +$string['thiscourse'] = 'Este curso'; +$string['update'] = 'Actualizar'; +$string['variablesupdated'] = 'Variables actualizadas con éxito'; +$string['versionforprinting'] = 'versión para Imprimir'; +$string['week'] = 'semana(s)'; +$string['weeks'] = 'Semanas'; +$string['youcantdo'] = 'Usted no puede hacer nada'; +?> diff --git a/lang/es_utf8/help/attforblock/changesession.html b/lang/es_utf8/help/attforblock/changesession.html new file mode 100644 index 0000000..0b6de7d --- /dev/null +++ b/lang/es_utf8/help/attforblock/changesession.html @@ -0,0 +1,4 @@ +

Asistencia

+ +

Cambiar sesión

+

Esta función le permite cambiar la fecha, la hora de inicio, la duración y la descripción de una sesión en particular.
diff --git a/lang/es_utf8/help/attforblock/createmultiplesessions.html b/lang/es_utf8/help/attforblock/createmultiplesessions.html new file mode 100644 index 0000000..19e9c11 --- /dev/null +++ b/lang/es_utf8/help/attforblock/createmultiplesessions.html @@ -0,0 +1,10 @@ +

Asistencia

+ +

Crear Múltiples Sesiones

+

Esta función le permite crear múltiples sesiones en un único paso.
+ Fecha de Inicio de Sesión: seleccione la fecha de inicio de su curso asignatura + (el primer día de clase).
Fecha de Fin de Sesión: indique aquí el último día de clase + (el último día en que usted quiera tomar asistencia).
+ Días de Sesión: Seleccione los días de la semana en los que tenga clase.
+ Frecuencia: Esto permite configurar las repeticiones. Si su clase se repite semanalmente, seleccione 1, + si su clase se repite cada dos semanas, seleccione 2, si sucede cada 3 semanas, seleccione 3, etc.

Finalmente, usted puede escribir el nombre que desea otorgarle a cada asistencia por defecto. En cualquier caso, siempre podrá editar individualmente este valor.

diff --git a/lang/es_utf8/help/attforblock/createonesession.html b/lang/es_utf8/help/attforblock/createonesession.html new file mode 100644 index 0000000..9c71fe1 --- /dev/null +++ b/lang/es_utf8/help/attforblock/createonesession.html @@ -0,0 +1,4 @@ +

Asistencia

+

Crear Una Sesión

+

Para crear una sesión en la que desee tomar la asistencia seleccione + la fecha, introduzca una descripción (opcional) y haga click sobre "Añadir Sesión".

diff --git a/lang/es_utf8/help/attforblock/defaultstatuses.html b/lang/es_utf8/help/attforblock/defaultstatuses.html new file mode 100644 index 0000000..f3e006f --- /dev/null +++ b/lang/es_utf8/help/attforblock/defaultstatuses.html @@ -0,0 +1,26 @@ +

+ + + + + + + + + + + + + + + + + +
#
.status;?>acronym;?>description;?>grade;?>
\ No newline at end of file diff --git a/lang/es_utf8/help/attforblock/display.html b/lang/es_utf8/help/attforblock/display.html new file mode 100644 index 0000000..ec5116f --- /dev/null +++ b/lang/es_utf8/help/attforblock/display.html @@ -0,0 +1,4 @@ +

Asitencia

+

Mostrar

+

Utilice esta opción para modificar la forma en que se visualizan los registros de asistencia. + Puede elegir entre:

"Hasta hoy", que mostrará las asistencias tomadas hasta el día en curso.
"Semanas", que mostrará las asistencias agrupadas por semanas y
"Meses" para mostrar las asistencias mensuales de cada grupo de estudiantes. diff --git a/lang/es_utf8/help/attforblock/export.html b/lang/es_utf8/help/attforblock/export.html new file mode 100644 index 0000000..6a8e63b --- /dev/null +++ b/lang/es_utf8/help/attforblock/export.html @@ -0,0 +1,3 @@ +

Asistencia

+

Exportar

+

Utilice esta opción para seleccionar el formato en que se exportarán los datos. Puede decidir si incluye o no las sesiones no registradas. También puede exportar hasta una fecha determinada, dejando las demás fuera del archivo de exportación.

Se exporta en formato xls (MsExcell), ods (OoCalc) o Texto txt.

diff --git a/lang/es_utf8/help/attforblock/mods.html b/lang/es_utf8/help/attforblock/mods.html new file mode 100644 index 0000000..a68f8f2 --- /dev/null +++ b/lang/es_utf8/help/attforblock/mods.html @@ -0,0 +1,4 @@ +

Asistencia

+ +

Crear - Editar asistencia

+

El módulo asistencia permite llevar un seguimiento de los estudiantes en cuanto a su asistencia/retrasos/ausencias a las clases. Los parámetros elegidos pueden ser calificados, asignando valores. Ejemplo: Asiste = 2; Retraso = 1; Justificado = 1; Ausente = 0. Esta actividad debe ir acompañada, obligatoriamente, del bloque Asistencia correspondiente y sólo se permite una actividad por curso. En caso de eliminar la actividad, los datos permanecen registrados en la base de datos, de modo que reaparecerán en caso de volver a agregarla.

Es importante tener en cuenta que el módulo funciona atendiendo a la fecha de inicio curso. Usted debe mantener la configuración de fecha de inicio del curso debidamente actualizada accediendo a "Configuración" en el Panel de Adminsitración del curso. La actividad Asistencia no mostrará las sesiones anteriores a la fecha de inicio del curso. diff --git a/lang/es_utf8/help/attforblock/myvariables.html b/lang/es_utf8/help/attforblock/myvariables.html new file mode 100644 index 0000000..fbe3bba --- /dev/null +++ b/lang/es_utf8/help/attforblock/myvariables.html @@ -0,0 +1,3 @@ +

Asistencia

+

Mis Variables

+

Cambie esta configuración para modificar las categorías de asistencia que vienen definidas por defecto y la puntuación asignada a cada categoría.

Si usted lo desea, puede agregar nuevas categorías completando el recuadro vacío y utilizando el botón "añadir"-

Puede utilizar valores negativos. No se admiten campos vacíos, siendo el valor predeterminado el cero (0).

Puede modificar los valores cuantas veces lo desee, el módulo recalculará los valores que han sido previamente asignados a los alumnos, mostrando su nueva calificación sin ningún problema.

diff --git a/lang/es_utf8/help/attforblock/report.html b/lang/es_utf8/help/attforblock/report.html new file mode 100644 index 0000000..82cb49b --- /dev/null +++ b/lang/es_utf8/help/attforblock/report.html @@ -0,0 +1,5 @@ +

Asistencia

+

Informe

+

Modifique la forma en que se visualizan los datos de asistencia ajustando los parámetros. Los datos también pueden ser +descargados para una visualización sin conexión y analizarlos mediante el menú desplegable de "Informe" +que puede encontrar en la pestaña "exportar".



Informe individual: Si lo desea, también puede hacer click sobre el nombre del estudiante para poder ver un informe individualizado de su asistencia. En este sitio dispondrá de una opción para imprimir su informe personal o también podrá visualizar la asistencia del estudiante en todos los cursos en los que se encuentra matriculado (rol).

diff --git a/lang/es_utf8/help/attforblock/sessions.html b/lang/es_utf8/help/attforblock/sessions.html new file mode 100644 index 0000000..831c981 --- /dev/null +++ b/lang/es_utf8/help/attforblock/sessions.html @@ -0,0 +1,16 @@ +

Asistencia

+

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

+

Las sesiones de Asistencia se muestran aquí. Si no aparecen sesiones, utilice la pestaña "Añadir" para crear una nuevas sesiones.

Es importante tener en cuenta que el módulo funciona atendiendo a la fecha de inicio curso. Usted debe mantener la configuración de fecha de inicio del curso debidamente actualizada accediendo a "Configuración" en el Panel de Adminsitración del curso. La actividad Asistencia no mostrará las sesiones anteriores a la fecha de inicio del curso. +

Iniciar registro de asistencia: Inicie el registro de asistencias por medio del icono de color verde que hay bajo el menú "acciones" (parte izquierda).

+

Editar sesión: Edite cada sesión haciendo uso del icono central "editar sesión". Una vez haya finalizado la toma de Asistencias, puede editar la sesión haciendo click en la descripción. +

+

Eliminar sesión: elimine por completo la sesión en el icono de la derecha.


Eliminar/modificar varias sesiones simultáneamente: para poder eliminar o modificar la duración de varias sesiones simultáneamente debe seleccionarlas en la casilla que se encuentra al final de cada una de ellas, al final de la página encontrará las opciones "Con las seleccionadas", una vez aquí, debe elegir la opción que desee. diff --git a/lang/es_utf8/help/attforblock/studentview.html b/lang/es_utf8/help/attforblock/studentview.html new file mode 100644 index 0000000..5d9ff48 --- /dev/null +++ b/lang/es_utf8/help/attforblock/studentview.html @@ -0,0 +1,3 @@ +

Asistencia

+

Vista de Estudiante

+

Esta pantalla permite ver los registros de asistencia de un estudiante en concreto. Use el enlace "versión para imprimir" si desea imprimir una copia sin las pestañas ni encabezados mostrados en la página web.

La opción "todos los cursos" le permitirá consultar en una página la asistencia registrada en los demás cursos en los que el estudiante está matriculado (rol). diff --git a/lang/es_utf8/help/attforblock/updateattendance.html b/lang/es_utf8/help/attforblock/updateattendance.html new file mode 100644 index 0000000..fb2f8ee --- /dev/null +++ b/lang/es_utf8/help/attforblock/updateattendance.html @@ -0,0 +1,3 @@ +

Asistencia

+

Actualizar asistencia

+

Desde aquí podrá marcar los datos de asistencia de su grupo de estudiantes. Puede hacerlo individualmente o en bloque. Para asignar a todos sus alumnos el mismo valor, puede seleccionar la letra que figura en el encabezado de cada columna (P, J, T...) y luego modificar individualmente algún dato concreto. Al final del listado encontrará el botón "ok" (puede acceder rápidamente pulsando la tecla Fin de su teclado) que grabará los resultados. Puede modificar los valores en cualquier momento accediendo nuevamente la asistencia de este día/hora. Junto a cada registro encontrará una caja de texto que le permitirá anotar observaciones personalizadas para cada estudiante.



Informe individual: Si lo desea, también puede hacer click sobre el nombre del estudiante para poder ver un informe individualizado de su asistencia. En este sitio dispondrá de una opción para imprimir su informe personal o también podrá visualizar la asistencia del estudiante en todos los cursos en los que se encuentra matriculado (rol).

diff --git a/lang/eu_utf8/attforblock.php b/lang/eu_utf8/attforblock.php new file mode 100644 index 0000000..d6f5826 --- /dev/null +++ b/lang/eu_utf8/attforblock.php @@ -0,0 +1,87 @@ + diff --git a/lang/eu_utf8/help/attforblock/defaultstatuses.html b/lang/eu_utf8/help/attforblock/defaultstatuses.html new file mode 100644 index 0000000..f3e006f --- /dev/null +++ b/lang/eu_utf8/help/attforblock/defaultstatuses.html @@ -0,0 +1,26 @@ +

+ + + + + + + + + + + + + + + + + +
#
.status;?>acronym;?>description;?>grade;?>
\ No newline at end of file diff --git a/lang/eu_utf8/help/attforblock/sessions.html b/lang/eu_utf8/help/attforblock/sessions.html new file mode 100644 index 0000000..5049b9a --- /dev/null +++ b/lang/eu_utf8/help/attforblock/sessions.html @@ -0,0 +1,12 @@ +

Asistentziarako blokea

+ +

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

\ No newline at end of file diff --git a/lang/fr_utf8/attforblock.php b/lang/fr_utf8/attforblock.php new file mode 100644 index 0000000..1316646 --- /dev/null +++ b/lang/fr_utf8/attforblock.php @@ -0,0 +1,94 @@ + diff --git a/lang/it/attforblock.php b/lang/it/attforblock.php new file mode 100644 index 0000000..c4ed6d2 --- /dev/null +++ b/lang/it/attforblock.php @@ -0,0 +1,84 @@ + diff --git a/lang/it/help/attforblock/sessions.html b/lang/it/help/attforblock/sessions.html new file mode 100644 index 0000000..8b9b85b --- /dev/null +++ b/lang/it/help/attforblock/sessions.html @@ -0,0 +1,12 @@ +

Blocco Presenze

+ +

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

\ No newline at end of file diff --git a/lang/ja_utf8/attforblock.php b/lang/ja_utf8/attforblock.php new file mode 100644 index 0000000..fd6fe56 --- /dev/null +++ b/lang/ja_utf8/attforblock.php @@ -0,0 +1,116 @@ +このモジュールを削除したとしても、データが削除されるわけではありません!'; +$string['modulename'] = '出欠'; +$string['modulenameplural'] = '出欠'; +$string['months'] = '月'; +$string['myvariables'] = 'マイ変数'; +$string['newdate'] = '新しい出欠日'; +$string['newduration'] = '新しい持続時間'; +$string['noattforuser'] = 'このユーザの出欠レコードはありません。'; +$string['nodescription'] = '標準クラスセッション'; +$string['noguest'] = 'ゲストは出欠を閲覧できません。'; +$string['noofdaysabsent'] = '欠席数'; +$string['noofdaysexcused'] = '早退数'; +$string['noofdayslate'] = '遅刻数'; +$string['noofdayspresent'] = '出席数'; +$string['nosessiondayselected'] = 'セッション日が選択されませんでした。'; +$string['nosessionexists'] = 'このコースには、セッションがありません。'; +$string['notfound'] = 'このコースには、出欠活動はありません!'; +$string['olddate'] = '古い出欠日'; +$string['period'] = '頻度'; +$string['remarks'] = '備考'; +$string['report'] = 'レポート'; +$string['resetdescription'] = '出欠を削除することで、データベースから情報が削除されることに留意してください。あなたは、コースの開始日を変更することで、古いセッションを隠すことができます!'; +$string['resetstatuses'] = 'ステータスをデフォルトにリセットする'; +$string['restoredefaults'] = 'デフォルトをリストアする'; +$string['session'] = 'セッション'; +$string['sessionadded'] = 'セッションが正常に追加されました。'; +$string['sessionalreadyexists'] = 'この日には、すでにセッションが追加されています。'; +$string['sessiondate'] = 'セッション日'; +$string['sessiondays'] = 'セッション曜日'; +$string['sessiondeleted'] = 'セッションが正常に削除されました。'; +$string['sessionenddate'] = 'セッション終了日'; +$string['sessionexist'] = 'セッションは追加されませんでした (すでに追加されています)!'; +$string['sessions'] = 'セッション'; +$string['sessionscompleted'] = 'セッション完了'; +$string['sessionsgenerated'] = 'セッションが正常に生成されました。'; +$string['sessionstartdate'] = 'セッション開始日'; +$string['sessionupdated'] = 'セッションが正常に更新されました。'; +$string['settings'] = '設定'; +$string['showdefaults'] = 'デフォルトを表示する'; +$string['status'] = 'ステータス'; +$string['strftimedm'] = '%%m/%%d'; +$string['strftimedmy'] = '%%Y/%%m/%%d'; +$string['strftimedmyhm'] = '%%Y/%%m/%%d %%H.%%M'; +$string['strftimedmyw'] = '%%Y/%%m/%%d (%%a)'; +$string['strftimehm'] = '%%H:%%M'; +$string['strftimeshortdate'] = '%%Y/%%m/%%d'; +$string['studentid'] = '学籍番号'; +$string['takeattendance'] = '出欠を取る'; +$string['thiscourse'] = 'このコース'; +$string['update'] = '更新'; +$string['variablesupdated'] = '変数が正常に更新されました。'; +$string['versionforprinting'] = '印刷画面'; +$string['week'] = '週'; +$string['weeks'] = '週'; +$string['youcantdo'] = 'あなたは、何もできません。'; + +?> diff --git a/lang/ja_utf8/help/attforblock/createmultiplesessions.html b/lang/ja_utf8/help/attforblock/createmultiplesessions.html new file mode 100644 index 0000000..3518fd7 --- /dev/null +++ b/lang/ja_utf8/help/attforblock/createmultiplesessions.html @@ -0,0 +1,6 @@ +

倍数セッションを作成する

+

あなたは、この機能を使って、1つのシンプルなステップで倍数セッションを作成することができます。

+

セッション開始日: あなたのコース開始日 (授業の初日) を選択してください。
+セッション終了日: 授業の最終日 (あなたが出欠を取りたい最終日) を選択してください。
+ セッション曜日: あなたの授業が開講される週の曜日を選択してください (例 月曜日/水曜日/金曜日)。
+ 頻度: ここでは、頻度を設定することができます。あなたの授業が毎週開講される場合、1を設定してください。隔週に開講される場合は、2を設定してください。また、第3週に開講される場合は、3を選択してください。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/createonesession.html b/lang/ja_utf8/help/attforblock/createonesession.html new file mode 100644 index 0000000..3c086e3 --- /dev/null +++ b/lang/ja_utf8/help/attforblock/createonesession.html @@ -0,0 +1,2 @@ +

1つのセッションを作成する

+

あなたが出欠を取りたい、1つのセッションを作成するには、日付を選択して説明 (任意) を入力した後、「セッションを追加する」をクリックしてください。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/defaultstatuses.html b/lang/ja_utf8/help/attforblock/defaultstatuses.html new file mode 100644 index 0000000..8f66cad --- /dev/null +++ b/lang/ja_utf8/help/attforblock/defaultstatuses.html @@ -0,0 +1,26 @@ +

+ + + + + + + + + + + + + + + + + +
#
.status;?>acronym;?>description;?>grade;?>
\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/display.html b/lang/ja_utf8/help/attforblock/display.html new file mode 100644 index 0000000..f257106 --- /dev/null +++ b/lang/ja_utf8/help/attforblock/display.html @@ -0,0 +1,2 @@ +

表示

+

このオプションは、出欠レコードの表示方法の変更に使用してください。あなたは、それぞれの学生に関して、すべてを表示する「すべて」、週ごとの平均を表示する「週」、月ごとの平均を表示する「月」を選択することができます。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/export.html b/lang/ja_utf8/help/attforblock/export.html new file mode 100644 index 0000000..7c00a28 --- /dev/null +++ b/lang/ja_utf8/help/attforblock/export.html @@ -0,0 +1,2 @@ +

エクスポート

+

このオプションは、エクスポートデータのフォーマット選択に使用してください。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/hiddensessions.html b/lang/ja_utf8/help/attforblock/hiddensessions.html new file mode 100644 index 0000000..bd4e4ed --- /dev/null +++ b/lang/ja_utf8/help/attforblock/hiddensessions.html @@ -0,0 +1,3 @@ +

非表示セッション

+

コース開始日が実際の日時より古い場合、セッションが隠されます。コース開始日を変更することで、非表示セッションが表示されます。

+

あなたは、古いセッションを削除する代わりに、この機能を使用することができます。評定表には、表示セッションのみ使用されますので留意してください。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/myvariables.html b/lang/ja_utf8/help/attforblock/myvariables.html new file mode 100644 index 0000000..56fad2a --- /dev/null +++ b/lang/ja_utf8/help/attforblock/myvariables.html @@ -0,0 +1,2 @@ +

マイ変数

+

デフォルトの出欠カテゴリおよび各カテゴリに割り当てられている評点を修正するには、ここで設定を変更してください。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/report.html b/lang/ja_utf8/help/attforblock/report.html new file mode 100644 index 0000000..68b6acd --- /dev/null +++ b/lang/ja_utf8/help/attforblock/report.html @@ -0,0 +1,2 @@ +

レポート

+

表示設定を調整することで、出欠データを修正してください。オフライン閲覧および分析のため、レポート画面下部にある「レポート」プルダウンメニューより、データをダウンロードすることもできます。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/sessions.html b/lang/ja_utf8/help/attforblock/sessions.html new file mode 100644 index 0000000..7a3d6c1 --- /dev/null +++ b/lang/ja_utf8/help/attforblock/sessions.html @@ -0,0 +1,14 @@ +

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

+

ここに出欠セッションが表示されます。セッションが表示されない場合、新しいセッションを追加するため、「追加」タブをクリックしてください。

+

「操作」メニューの下 (左側) にあるグリーンのアイコンをクリックすることで、出欠を取ることができます。

+

中央にある「セッションを編集する」アイコンをクリックすることで、それぞれのセッションを編集してください。出欠を取った後、説明をクリックすることで、あなたはセッションを編集することができます。

+

右側にあるアイコンをクリックすることで、セッションを削除することができます。

\ No newline at end of file diff --git a/lang/ja_utf8/help/attforblock/studentview.html b/lang/ja_utf8/help/attforblock/studentview.html new file mode 100644 index 0000000..b57ac2a --- /dev/null +++ b/lang/ja_utf8/help/attforblock/studentview.html @@ -0,0 +1,2 @@ +

学生ビュー

+

この画面では、学生の出欠レコードを個別に閲覧することができます。「印刷画面」リンクを使用することで、タブおよびヘッダを含まないページをウェブページに表示することができます。

\ No newline at end of file diff --git a/lang/ru_utf8/attforblock.php b/lang/ru_utf8/attforblock.php new file mode 100644 index 0000000..ad2f73a --- /dev/null +++ b/lang/ru_utf8/attforblock.php @@ -0,0 +1,113 @@ +Удаление этого модуля не повлечет удаление данных о посещаемости!'; +$string['modulename'] = 'Посещаемость'; +$string['modulenameplural'] = 'Посещаемость'; +$string['months'] = 'По месяцам'; +$string['myvariables'] = 'Мои переменные'; +$string['newdate'] = 'Новая дата'; +$string['newduration'] = 'New duration'; +$string['noattforuser'] = 'Нет отметок посещаемости для этого пользователя'; +$string['nodescription'] = 'Для этого занятия нет описания'; +$string['noguest'] = 'Гость не может видеть информацию о посещаемости'; +$string['noofdaysabsent'] = 'Пропущено'; +$string['noofdaysexcused'] = 'Пропущено по ув. причине'; +$string['noofdayslate'] = 'Опозданий'; +$string['noofdayspresent'] = 'Вы присутствовали'; +$string['nosessiondayselected'] = 'Не выбран день занятия'; +$string['nosessionexists'] = 'В данном курсе отсутствуют занятия. Сначала добавьте их'; +$string['notfound'] = 'Элемент курса - \"Посещаемость\" не найден в данном курсе!'; +$string['olddate'] = 'Старая дата'; +$string['period'] = 'Периодичность'; +$string['remarks'] = 'Заметка'; +$string['report'] = 'Отчет'; +$string['restoredefaults'] = 'Востановить значения по-умолчанию'; +$string['session'] = 'Занятие'; +$string['sessionadded'] = 'Занятие успешно добавлено'; +$string['sessionalreadyexists'] = 'В этот день занятие уже существует'; +$string['sessiondate'] = 'Дата занятия'; +$string['sessiondays'] = 'Дни занятий'; +$string['sessiondeleted'] = 'Занятие успешно удалено'; +$string['sessionenddate'] = 'Дата завершения занятий'; +$string['sessionexist'] = 'Занятие не добавлено (уже существует)!'; +$string['sessions'] = 'Занятия'; +$string['sessionscompleted'] = 'Прошло занятий'; +$string['sessionsgenerated'] = 'Занятия успешно созданы'; +$string['sessionstartdate'] = 'Дата начала занятий'; +$string['sessionupdated'] = 'Занятие успешно изменено'; +$string['settings'] = 'Настройки'; +$string['showdefaults'] = 'Показать значения по-умолчанию'; +$string['status'] = 'Статус'; +$string['statusdeleted'] = 'Статус удален'; +$string['strftimedm'] = '%%d.%%m'; +$string['strftimedmy'] = '%%d.%%m.%%Y'; +$string['strftimedmyhm'] = '%%d.%%m.%%Y %%H.%%M'; +$string['strftimedmyw'] = '%%d.%%m.%%y (%%a)'; +$string['strftimehm'] = '%%H:%%M'; +$string['strftimeshortdate'] = '%%d.%%m.%%Y'; +$string['studentid'] = 'ID студента'; +$string['takeattendance'] = 'Отметить посещаемость'; +$string['update'] = 'Обновить'; +$string['variable'] = 'переменную'; +$string['variablesupdated'] = 'Переменные успешно обновлены'; +$string['versionforprinting'] = 'версия для печати'; +$string['week'] = 'неделя(и)'; +$string['weeks'] = 'По неделям'; +$string['youcantdo'] = 'Вы ничего не можете сделать'; + +?> diff --git a/lang/ru_utf8/help/attforblock/sessions.html b/lang/ru_utf8/help/attforblock/sessions.html new file mode 100644 index 0000000..b19e27a --- /dev/null +++ b/lang/ru_utf8/help/attforblock/sessions.html @@ -0,0 +1,12 @@ +

Модуль Посещаемость

+ +

+ dirroot.'/mod/attforblock/version.php'); + echo get_string('version').": $module->release ($module->version)"; + unset($module); + $module = $temp; + ?> +

\ No newline at end of file diff --git a/lang/sk_utf8/attforblock.php b/lang/sk_utf8/attforblock.php new file mode 100644 index 0000000..743f9e8 --- /dev/null +++ b/lang/sk_utf8/attforblock.php @@ -0,0 +1,87 @@ + diff --git a/lang/sv/attforblock.php b/lang/sv/attforblock.php new file mode 100644 index 0000000..b4399c0 --- /dev/null +++ b/lang/sv/attforblock.php @@ -0,0 +1,77 @@ + diff --git a/lib.php b/lib.php new file mode 100644 index 0000000..eabf781 --- /dev/null +++ b/lib.php @@ -0,0 +1,389 @@ + 2, 'A' => 0, 'L' => 1, 'E' => 1); + foreach ($arr as $k => $v) { + unset($rec); + $rec->courseid = 0; + $rec->acronym = get_string($k.'acronym', 'attforblock'); + $rec->description = get_string($k.'full', 'attforblock'); + $rec->grade = $v; + $rec->visible = 1; + $rec->deleted = 0; + $result = $result && insert_record('attendance_statuses', $rec); + } + return $result; +} + +function attforblock_add_instance($attforblock) { +/// Given an object containing all the necessary data, +/// (defined by the form in mod.html) this function +/// will create a new instance and return the id number +/// of the new instance. + + $attforblock->timemodified = time(); + + if ($att = get_record('attforblock', 'course', $attforblock->course)) { + $modnum = get_field('modules', 'id', 'name', 'attforblock'); + if (!get_record('course_modules', 'course', $attforblock->course, 'module', $modnum)) { + delete_records('attforblock', 'course', $attforblock->course); + $attforblock->id = insert_record('attforblock', $attforblock); + } else { + return false; + } + } else { + $attforblock->id = insert_record('attforblock', $attforblock); + } + + //Copy statuses for new instance from defaults + if (!get_records('attendance_statuses', 'courseid', $attforblock->course)) { + $statuses = get_records('attendance_statuses', 'courseid', 0, 'id'); + foreach($statuses as $stat) { + $rec = $stat; + $rec->courseid = $attforblock->course; + insert_record('attendance_statuses', $rec); + } + } + +// attforblock_grade_item_update($attforblock); +// attforblock_update_grades($attforblock); + return $attforblock->id; +} + + +function attforblock_update_instance($attforblock) { +/// Given an object containing all the necessary data, +/// (defined by the form in mod.html) this function +/// will update an existing instance with new data. + + $attforblock->timemodified = time(); + $attforblock->id = $attforblock->instance; + + if (! update_record('attforblock', $attforblock)) { + return false; + } + + attforblock_grade_item_update($attforblock); + + return true; +} + + +function attforblock_delete_instance($id) { +/// Given an ID of an instance of this module, +/// this function will permanently delete the instance +/// and any data that depends on it. + + if (! $attforblock = get_record('attforblock', 'id', $id)) { + return false; + } + + $result = delete_records('attforblock', 'id', $id); + + attforblock_grade_item_delete($attforblock); + + return $result; +} + +function attforblock_delete_course($course, $feedback=true){ + + if ($sess = get_records('attendance_sessions', 'courseid', $course->id, '', 'id')) { + $slist = implode(',', array_keys($sess)); + delete_records_select('attendance_log', "sessionid IN ($slist)"); + delete_records('attendance_sessions', 'courseid', $course->id); + } + delete_records('attendance_statuses', 'courseid', $course->id); + + //Inform about changes performed if feedback is enabled +// if ($feedback) { +// notify(get_string('deletedefaults', 'lesson', $count)); +// } + + return true; +} + +/** + * Called by course/reset.php + * @param $mform form passed by reference + */ +function attforblock_reset_course_form_definition(&$mform) { + $mform->addElement('header', 'attendanceheader', get_string('modulename', 'attforblock')); + + $mform->addElement('static', 'description', get_string('description', 'attforblock'), + get_string('resetdescription', 'attforblock')); + $mform->addElement('checkbox', 'reset_attendance_log', get_string('deletelogs','attforblock')); + + $mform->addElement('checkbox', 'reset_attendance_sessions', get_string('deletesessions','attforblock')); + $mform->disabledIf('reset_attendance_sessions', 'reset_attendance_log', 'notchecked'); + + $mform->addElement('checkbox', 'reset_attendance_statuses', get_string('resetstatuses','attforblock')); + $mform->setAdvanced('reset_attendance_statuses'); + $mform->disabledIf('reset_attendance_statuses', 'reset_attendance_log', 'notchecked'); +} + +/** + * Course reset form defaults. + */ +function attforblock_reset_course_form_defaults($course) { + return array('reset_attendance_log'=>0, 'reset_attendance_statuses'=>0, 'reset_attendance_sessions'=>0); +} + +function attforblock_reset_userdata($data) { + if (!empty($data->reset_attendance_log)) { + $sess = get_records('attendance_sessions', 'courseid', $data->courseid, '', 'id'); + $slist = implode(',', array_keys($sess)); + delete_records_select('attendance_log', "sessionid IN ($slist)"); + set_field('attendance_sessions', 'lasttaken', 0, 'courseid', $data->courseid); + } + if (!empty($data->reset_attendance_statuses)) { + delete_records('attendance_statuses', 'courseid', $data->courseid); + $statuses = get_records('attendance_statuses', 'courseid', 0, 'id'); + foreach($statuses as $stat) { + $rec = $stat; + $rec->courseid = $data->courseid; + insert_record('attendance_statuses', $rec); + } + } + if (!empty($data->reset_attendance_sessions)) { + delete_records('attendance_sessions', 'courseid', $data->courseid); + } +} + +function attforblock_user_outline($course, $user, $mod, $attforblock) { +/// Return a small object with summary information about what a +/// user has done with a given particular instance of this module +/// Used for user activity reports. +/// $return->time = the time they did it +/// $return->info = a short text description + + require_once('locallib.php'); + + if (isstudent($course->id, $user->id)) { + if ($sescount = get_attendance($user->id,$course)) { + $strgrade = get_string('grade'); + $maxgrade = get_maxgrade($user->id, $course); + $usergrade = get_grade($user->id, $course); + $percent = get_percent($user->id,$course); + $result->info = "$strgrade: $usergrade / $maxgrade ($percent%)"; + } + } + + return $result; +} + +function attforblock_user_complete($course, $user, $mod, $attforblock) { +/// Print a detailed representation of what a user has done with +/// a given particular instance of this module, for user activity reports. + + require_once('locallib.php'); + + if (isstudent($course->id, $user->id)) { +// if (! $cm = get_coursemodule_from_instance("attforblock", $attforblock->id, $course->id)) { +// error("Course Module ID was incorrect"); +// } + print_user_attendaces($user, $mod, $course); + } + + //return true; +} + +function attforblock_print_recent_activity($course, $isteacher, $timestart) { +/// Given a course and a time, this module should find recent activity +/// that has occurred in attforblock activities and print it out. +/// Return true if there was output, or false is there was none. + + return false; // True if anything was printed, otherwise false +} + +function attforblock_cron () { +/// Function to be run periodically according to the moodle cron +/// This function searches for things that need to be done, such +/// as sending out mail, toggling flags etc ... + + return true; +} + +/** + * Return grade for given user or all users. + * + * @param int $attforblockid id of attforblock + * @param int $userid optional user id, 0 means all users + * @return array array of grades, false if none + */ +function attforblock_get_user_grades($attforblock, $userid=0) { + global $CFG; + + require_once('locallib.php'); + + if (! $course = get_record('course', 'id', $attforblock->course)) { + error("Course is misconfigured"); + } + + $result = false; + if ($userid) { + $result = array(); + $result[$userid]->userid = $userid; + $result[$userid]->rawgrade = $attforblock->grade * get_percent($userid, $course) / 100; + } else { + if ($students = get_course_students($course->id)) { + $result = array(); + foreach ($students as $student) { + $result[$student->id]->userid = $student->id; + $result[$student->id]->rawgrade = $attforblock->grade * get_percent($student->id, $course) / 100; + } + } + } + + return $result; +} + +/** + * Update grades by firing grade_updated event + * + * @param object $attforblock null means all attforblocks + * @param int $userid specific user only, 0 mean all + */ +function attforblock_update_grades($attforblock=null, $userid=0, $nullifnone=true) { + global $CFG; + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + require_once($CFG->libdir.'/gradelib.php'); + } + + if ($attforblock != null) { + if ($grades = attforblock_get_user_grades($attforblock, $userid)) { + foreach($grades as $k=>$v) { + if ($v->rawgrade == -1) { + $grades[$k]->rawgrade = null; + } + } + attforblock_grade_item_update($attforblock, $grades); + } else { + attforblock_grade_item_update($attforblock); + } + + } else { + $sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid + FROM {$CFG->prefix}attforblock a, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m + WHERE m.name='attforblock' AND m.id=cm.module AND cm.instance=a.id"; + if ($rs = get_recordset_sql($sql)) { + while ($attforblock = rs_fetch_next_record($rs)) { +// if ($attforblock->grade != 0) { + attforblock_update_grades($attforblock); +// } else { +// attforblock_grade_item_update($attforblock); +// } + } + rs_close($rs); + } + } +} + +/** + * Create grade item for given attforblock + * + * @param object $attforblock object with extra cmidnumber + * @param mixed optional array/object of grade(s); 'reset' means reset grades in gradebook + * @return int 0 if ok, error code otherwise + */ +function attforblock_grade_item_update($attforblock, $grades=NULL) { + global $CFG; + + require_once('locallib.php'); + + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + require_once($CFG->libdir.'/gradelib.php'); + } + + if (!isset($attforblock->courseid)) { + $attforblock->courseid = $attforblock->course; + } + if (! $course = get_record('course', 'id', $attforblock->course)) { + error("Course is misconfigured"); + } + //$attforblock->grade = get_maxgrade($course); + + if(!empty($attforblock->cmidnumber)){ + $params = array('itemname'=>$attforblock->name, 'idnumber'=>$attforblock->cmidnumber); + }else{ + // MDL-14303 + $cm = get_coursemodule_from_instance('attforblock', $attforblock->id); + $params = array('itemname'=>$attforblock->name, 'idnumber'=>$cm->id); + } + + if ($attforblock->grade > 0) { + $params['gradetype'] = GRADE_TYPE_VALUE; + $params['grademax'] = $attforblock->grade; + $params['grademin'] = 0; + + } + else if ($attforblock->grade < 0) { + $params['gradetype'] = GRADE_TYPE_SCALE; + $params['scaleid'] = -$attforblock->grade; + + } else { + $params['gradetype'] = GRADE_TYPE_NONE; + } + + if ($grades === 'reset') { + $params['reset'] = true; + $grades = NULL; + } + + return grade_update('mod/attforblock', $attforblock->courseid, 'mod', 'attforblock', $attforblock->id, 0, $grades, $params); +} + +/** + * Delete grade item for given attforblock + * + * @param object $attforblock object + * @return object attforblock + */ +function attforblock_grade_item_delete($attforblock) { + global $CFG; + require_once($CFG->libdir.'/gradelib.php'); + + if (!isset($attforblock->courseid)) { + $attforblock->courseid = $attforblock->course; + } + + return grade_update('mod/attforblock', $attforblock->courseid, 'mod', 'attforblock', $attforblock->id, 0, NULL, array('deleted'=>1)); +} + +function attforblock_get_participants($attforblockid) { +//Must return an array of user records (all data) who are participants +//for a given instance of attforblock. Must include every user involved +//in the instance, independient of his role (student, teacher, admin...) +//See other modules as example. + + return false; +} + +function attforblock_scale_used ($attforblockid, $scaleid) { +//This function returns if a scale is being used by one attforblock +//it it has support for grading and scales. Commented code should be +//modified if necessary. See forum, glossary or journal modules +//as reference. + + $return = false; + + //$rec = get_record("attforblock","id","$attforblockid","scale","-$scaleid"); + // + //if (!empty($rec) && !empty($scaleid)) { + // $return = true; + //} + + return $return; +} + +////////////////////////////////////////////////////////////////////////////////////// +/// Any other attforblock functions go here. Each of them must have a name that +/// starts with attforblock_ + + +?> diff --git a/locallib.php b/locallib.php new file mode 100644 index 0000000..8022259 --- /dev/null +++ b/locallib.php @@ -0,0 +1,314 @@ +libdir.'/gradelib.php'); + +define('ONE_DAY', 86400); // Seconds in one day +define('ONE_WEEK', 604800); // Seconds in one week + +function show_tabs($cm, $context, $currenttab='sessions') +{ + $toprow = array(); + if (has_capability('mod/attforblock:manageattendances', $context) or + has_capability('mod/attforblock:takeattendances', $context) or + has_capability('mod/attforblock:changeattendances', $context)) { + $toprow[] = new tabobject('sessions', 'manage.php?id='.$cm->id, + get_string('sessions','attforblock')); + } + + if (has_capability('mod/attforblock:manageattendances', $context)) { + $toprow[] = new tabobject('add', "sessions.php?id=$cm->id&action=add", + get_string('add','attforblock')); + } + if (has_capability('mod/attforblock:viewreports', $context)) { + $toprow[] = new tabobject('report', 'report.php?id='.$cm->id, + get_string('report','attforblock')); + } + if (has_capability('mod/attforblock:export', $context)) { + $toprow[] = new tabobject('export', 'export.php?id='.$cm->id, + get_string('export','quiz')); + } + if (has_capability('mod/attforblock:changepreferences', $context)) { + $toprow[] = new tabobject('settings', 'attsettings.php?id='.$cm->id, + get_string('settings','attforblock')); + } + + $tabs = array($toprow); + print_tabs($tabs, $currenttab); +} + + +//getting settings for course + +function get_statuses($courseid, $onlyvisible = true) +{ + if ($onlyvisible) { + $result = get_records_select('attendance_statuses', "courseid = $courseid AND visible = 1 AND deleted = 0", 'grade DESC'); + } else { + $result = get_records_select('attendance_statuses', "courseid = $courseid AND deleted = 0", 'grade DESC'); +// $result = get_records('attendance_statuses', 'courseid', $courseid, 'grade DESC'); + } + return $result; +} + +//gets attendance status for a student, returns count + +function get_attendance($userid, $course, $statusid=0) +{ + global $CFG; + $qry = "SELECT count(*) as cnt + FROM {$CFG->prefix}attendance_log al + JOIN {$CFG->prefix}attendance_sessions ats + ON al.sessionid = ats.id + WHERE ats.courseid = $course->id + AND ats.sessdate >= $course->startdate + AND al.studentid = $userid"; + if ($statusid) { + $qry .= " AND al.statusid = $statusid"; + } + + return count_records_sql($qry); +} + +function get_grade($userid, $course) +{ + global $CFG; + $logs = get_records_sql("SELECT l.id, l.statusid, l.statusset + FROM {$CFG->prefix}attendance_log l + JOIN {$CFG->prefix}attendance_sessions s + ON l.sessionid = s.id + WHERE l.studentid = $userid + AND s.courseid = $course->id + AND s.sessdate >= $course->startdate"); + $result = 0; + if ($logs) { + $stat_grades = records_to_menu(get_records('attendance_statuses', 'courseid', $course->id), 'id', 'grade'); + foreach ($logs as $log) { + $result += $stat_grades[$log->statusid]; + } + } + + return $result; +} + +//temporary solution, for support PHP 4.3.0 which minimal requirement for Moodle 1.9.x +function local_array_intersect_key($array1, $array2) { + $result = array(); + foreach ($array1 as $key => $value) { + if (isset($array2[$key])) { + $result[$key] = $value; + } + } + return $result; +} + +function get_maxgrade($userid, $course) +{ + global $CFG; + $logs = get_records_sql("SELECT l.id, l.statusid, l.statusset + FROM {$CFG->prefix}attendance_log l + JOIN {$CFG->prefix}attendance_sessions s + ON l.sessionid = s.id + WHERE l.studentid = $userid + AND s.courseid = $course->id + AND s.sessdate >= $course->startdate"); + $maxgrade = 0; + if ($logs) { + $stat_grades = records_to_menu(get_records('attendance_statuses', 'courseid', $course->id), 'id', 'grade'); + foreach ($logs as $log) { + $ids = array_flip(explode(',', $log->statusset)); +// $grades = array_intersect_key($stat_grades, $ids); // require PHP 5.1.0 and higher + $grades = local_array_intersect_key($stat_grades, $ids); //temporary solution, for support PHP 4.3.0 which minimal requirement for Moodle 1.9.x + $maxgrade += max($grades); + } + } + + return $maxgrade; +} + +function get_percent_adaptive($userid, $course) // NOT USED +{ + global $CFG; + $logs = get_records_sql("SELECT l.id, l.statusid, l.statusset + FROM {$CFG->prefix}attendance_log l + JOIN {$CFG->prefix}attendance_sessions s + ON l.sessionid = s.id + WHERE l.studentid = $userid + AND s.courseid = $course->id + AND s.sessdate >= $course->startdate"); + $result = 0; + if ($logs) { + $stat_grades = records_to_menu(get_records('attendance_statuses', 'courseid', $course->id), 'id', 'grade'); + + $percent = 0; + foreach ($logs as $log) { + $ids = array_flip(explode(',', $log->statusset)); + $grades = array_intersect_key($stat_grades, $ids); + $delta = max($grades) - min($grades); + $percent += $stat_grades[$log->statusid] / $delta; + } + $result = $percent / count($logs) * 100; + } + if (!$dp = grade_get_setting($course->id, 'decimalpoints')) { + $dp = $CFG->grade_decimalpoints; + } + + return sprintf("%0.{$dp}f", $result); +} + +function get_percent($userid, $course) +{ + global $CFG; + + $maxgrd = get_maxgrade($userid, $course); + if ($maxgrd == 0) { + $result = 0; + } else { + $result = get_grade($userid, $course) / $maxgrd * 100; + } + if ($result < 0) { + $result = 0; + } + if (!$dp = grade_get_setting($course->id, 'decimalpoints')) { + $dp = $CFG->grade_decimalpoints; + } + + return sprintf("%0.{$dp}f", $result); +} + +function set_current_view($courseid, $view) { + global $SESSION; + + return $SESSION->currentattview[$courseid] = $view; +} + +function get_current_view($courseid) { + global $SESSION; + + if (isset($SESSION->currentattview[$courseid])) + return $SESSION->currentattview[$courseid]; + else + return 'all'; +} + +function print_row($left, $right) { + echo "\n$left$right\n"; +} + +function print_attendance_table($user, $course) { + + $complete = get_attendance($user->id, $course); + $percent = get_percent($user->id, $course).' %'; + $grade = get_grade($user->id, $course); + + echo ''; + print_row(get_string('sessionscompleted','attforblock').':', "$complete"); + $statuses = get_statuses($course->id); + foreach($statuses as $st) { + print_row($st->description.': ', ''.get_attendance($user->id, $course, $st->id).''); + } + print_row(get_string('attendancepercent','attforblock').':', "$percent"); + print_row(get_string('attendancegrade','attforblock').':', "$grade / ".get_maxgrade($user->id, $course)); + print_row(' ', ' '); + echo '
'; + +} + +function print_user_attendaces($user, $cm, $course = 0, $printing = null) { + global $CFG, $COURSE, $mode; + + echo ''; + if (!$printing) { + echo ''; + echo ''; + echo ''; + } +// echo ''; +// echo ''; +// echo ''; + echo ''; + echo ''; + echo '
'. + helpbutton('studentview', get_string('attendancereport','attforblock'), 'attforblock', true, false, '', true). + "id}&student={$user->id}&mode=$mode&printing=yes\" target=\"_blank\">[".get_string('versionforprinting','attforblock').']

'.get_string('attendancereport','attforblock').helpbutton('studentview', get_string('attendancereport','attforblock'), 'attforblock', true, false, '', true).'

'; + print_user_picture($user->id, $COURSE->id, $user->picture, true); + echo ''; + echo ''.fullname($user).''; + if ($course) { + echo '
'; + $complete = get_attendance($user->id, $course); + if($complete) { + print_attendance_table($user, $course); + } else { + echo get_string('attendancenotstarted','attforblock'); + } + } else { + $stqry = "SELECT ats.id,ats.courseid + FROM {$CFG->prefix}attendance_log al + JOIN {$CFG->prefix}attendance_sessions ats + ON al.sessionid = ats.id + WHERE al.studentid = {$user->id} + GROUP BY ats.courseid + ORDER BY ats.courseid asc"; + $recs = get_records_sql_menu($stqry); + foreach ($recs as $id => $courseid) { + echo '
'; + echo ''; + $nextcourse = get_record('course', 'id', $courseid); + echo ''; + echo ''; + echo '
'.$nextcourse->fullname.''; + $complete = get_attendance($user->id, $nextcourse); + if($complete) { + print_attendance_table($user, $nextcourse); + } else { + echo get_string('attendancenotstarted','attforblock'); + } + echo '
'; + } + } + + + if ($course) { + $stqry = "SELECT ats.sessdate,ats.description,al.statusid,al.remarks + FROM {$CFG->prefix}attendance_log al + JOIN {$CFG->prefix}attendance_sessions ats + ON al.sessionid = ats.id + WHERE ats.courseid = {$course->id} AND al.studentid = {$user->id} + ORDER BY ats.sessdate asc"; + if ($sessions = get_records_sql($stqry)) { + $statuses = get_statuses($course->id); + ?> +
+ + + + + + + + + + $session) + { + ?> + + + + + + + + + '; + } else { + print_heading(get_string('noattforuser','attforblock')); + } + } + echo '
#
sessdate, get_string('strftimedmyw', 'attforblock')); //userdate($students->sessdate,'%d.%m.%y (%a)', 99, false);?>sessdate, get_string('strftimehm', 'attforblock')); ?>description) ? get_string('nodescription', 'attforblock') : $session->description; ?>statusid]->description ?>remarks;?>
 
'; +} + +?> diff --git a/manage.php b/manage.php new file mode 100644 index 0000000..5e20c21 --- /dev/null +++ b/manage.php @@ -0,0 +1,164 @@ +course)) { + error("Course is misconfigured"); + } + + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + + require_login($course->id); + + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + if (!has_capability('mod/attforblock:manageattendances', $context) AND + !has_capability('mod/attforblock:takeattendances', $context) AND + !has_capability('mod/attforblock:changeattendances', $context)) { + redirect("view.php?id=$cm->id"); + } + + //if teacher is coming from block, then check for a session exists for today + if($from === 'block') { + $today = time(); // because we compare with database, we don't need to use usertime() + $sql = "SELECT id, lasttaken + FROM {$CFG->prefix}attendance_sessions + WHERE $today BETWEEN sessdate AND (sessdate + duration) + AND courseid = $course->id"; + if($att = get_record_sql($sql)) { + if ((!$att->lasttaken and has_capability('mod/attforblock:takeattendances', $context)) or + ($att->lasttaken and has_capability('mod/attforblock:changeattendances', $context))) { + redirect('attendances.php?id='.$id.'&sessionid='.$att->id); + } + } + } + +/// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => null, 'type' => 'activity'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name, $course->fullname, + $navigation, "", "", true, update_module_button($cm->id, $course->id, get_string('modulename', 'attforblock')), + navmenu($course)); + + print_heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname); + + if(!count_records_select('attendance_sessions', "courseid = $course->id AND sessdate >= $course->startdate")) { // no session exists for this course + show_tabs($cm, $context); + print_heading(get_string('nosessionexists','attforblock')); + $hiddensess = count_records_select('attendance_sessions', "courseid = $course->id AND sessdate < $course->startdate"); + echo '
'.helpbutton('hiddensessions', '', 'attforblock', true, true, '', true); + echo get_string('hiddensessions', 'attforblock').': '.$hiddensess.'
'; + } else { //sessions generated , display them + add_to_log($course->id, 'attendance', 'manage attendances', 'mod/attforblock/manage.php?course='.$course->id, $user->lastname.' '.$user->firstname); + show_tabs($cm, $context); + print_sessions_list($course); + } +// require_once('lib.php'); +// $t = attforblock_get_user_grades($attforblock); //////////////////////////////////////////// + print_footer($course); + + +function print_sessions_list($course) { + global $CFG, $context, $cm; + + $strhours = get_string('hours'); + $strmins = get_string('min'); + + $qry = get_records_select('attendance_sessions', "courseid = $course->id AND sessdate >= $course->startdate", 'sessdate asc'); + $i = 0; + $table->width = '100%'; + //$table->tablealign = 'center'; + $table->head = array('#', get_string('date'), get_string('time'), get_string('duration', 'attforblock'), get_string('description','attforblock'), get_string('actions'), get_string('select')); + $table->align = array('', '', '', 'right', 'left', 'center', 'center'); + $table->size = array('1px', '1px', '1px', '1px', '*', '1px', '1px'); + + $allowtake = has_capability('mod/attforblock:takeattendances', $context); + $allowchange = has_capability('mod/attforblock:changeattendances', $context); + $allowmanage = has_capability('mod/attforblock:manageattendances', $context); + foreach($qry as $key=>$sessdata) + { + $i++; + $actions = ''; +// if ($allowtake) { + if($sessdata->lasttaken > 0) //attendance has taken + { + if ($allowchange) { + $desc = "id&sessionid={$sessdata->id}\">". + ($sessdata->description ? $sessdata->description : get_string('nodescription', 'attforblock')). + ''; + } else { + $desc = ''.(empty($sessdata->description) ? get_string('nodescription', 'attforblock') : $sessdata->description).''; + } + } else { + $desc = empty($sessdata->description) ? get_string('nodescription', 'attforblock') : $sessdata->description; + if ($allowtake) { + $title = get_string('takeattendance','attforblock'); + $actions = "id&sessionid={$sessdata->id}\">". + "pixpath}/t/go.gif\" alt=\"$title\" /> "; + } + } +// } + if($allowmanage) { + $title = get_string('editsession','attforblock'); + $actions .= "id&sessionid={$sessdata->id}&action=update\">". + "pixpath}/t/edit.gif\" alt=\"$title\" /> "; + $title = get_string('deletesession','attforblock'); + $actions .= "id&sessionid={$sessdata->id}&action=delete\">". + "pixpath}/t/delete.gif\" alt=\"$title\" /> "; + } + + $table->data[$sessdata->id][] = $i; + $table->data[$sessdata->id][] = userdate($sessdata->sessdate, get_string('strftimedmyw', 'attforblock')); + $table->data[$sessdata->id][] = userdate($sessdata->sessdate, get_string('strftimehm', 'attforblock')); + $hours = floor($sessdata->duration / HOURSECS); + $mins = floor(($sessdata->duration - $hours * HOURSECS) / MINSECS); + $mins = $mins < 10 ? "0$mins" : "$mins"; + $table->data[$sessdata->id][] = $hours ? "{$hours} {$strhours} {$mins} {$strmins}" : "{$mins} {$strmins}"; + $table->data[$sessdata->id][] = $desc; + $table->data[$sessdata->id][] = $actions; + $table->data[$sessdata->id][] = ''; + unset($desc, $actions); + } + echo '
'; + echo "
id}\">"; //&sessionid={$sessdata->id} + echo '
'.helpbutton ('sessions', get_string('help'), 'attforblock', true, true, '', true).'
'; + print_table($table); + $hiddensess = count_records_select('attendance_sessions', "courseid = $course->id AND sessdate < $course->startdate"); + echo ''; + echo '
'; + echo '
'.helpbutton('hiddensessions', '', 'attforblock', true, true, '', true); + echo get_string('hiddensessions', 'attforblock').': '.$hiddensess.'
'.get_string('selectall').' /'. + ' '.get_string('deselectall').'

'; + echo ''.get_string('withselected', 'quiz').': '; + if ($allowmanage) { + $actionlist = array('deleteselected' => get_string('delete'), + 'changeduration' => get_string('changeduration', 'attforblock')); + choose_from_menu($actionlist, 'action'); + echo '\n"; + } else { + echo get_string('youcantdo', 'attforblock'); //You can't do anything + } + echo '
'; + echo '
'; + +} +?> diff --git a/mod_form.php b/mod_form.php new file mode 100644 index 0000000..47549eb --- /dev/null +++ b/mod_form.php @@ -0,0 +1,32 @@ +dirroot.'/course/moodleform_mod.php'); + +class mod_attforblock_mod_form extends moodleform_mod { + + function definition() { + + global $CFG; + $mform =& $this->_form; + +//------------------------------------------------------------------------------- + $mform->addElement('header', 'general', get_string('general', 'form')); + + $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); + $mform->setType('name', PARAM_TEXT); + $mform->addRule('name', null, 'required', null, 'client'); + $mform->setDefault('name', get_string('modulename', 'attforblock')); + + $mform->addElement('static', 'attdescription', '', get_string('moduledescription', 'attforblock')); + + $mform->addElement('modgrade', 'grade', get_string('grade')); + $mform->setDefault('grade', 100); + + $this->standard_coursemodule_elements(true); + +//------------------------------------------------------------------------------- + // buttons + $this->add_action_buttons(); + } + +} +?> \ No newline at end of file diff --git a/report.php b/report.php new file mode 100644 index 0000000..9d2a0fd --- /dev/null +++ b/report.php @@ -0,0 +1,226 @@ +libdir.'/blocklib.php'); + require_once('locallib.php'); + + define('USER_SMALL_CLASS', 20); // Below this is considered small + define('USER_LARGE_CLASS', 200); // Above this is considered large + define('DEFAULT_PAGE_SIZE', 20); + + $id = required_param('id', PARAM_INT); + $group = optional_param('group', -1, PARAM_INT); // Group to show + $view = optional_param('view', 'weeks', PARAM_ALPHA); // which page to show + $current = optional_param('current', 0, PARAM_INT); + $sort = optional_param('sort', 'lastname', PARAM_ALPHA); + + if ($id) { + if (! $cm = get_record('course_modules', 'id', $id)) { + error('Course Module ID was incorrect'); + } + if (! $course = get_record('course', 'id', $cm->course)) { + error('Course is misconfigured'); + } + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + } + + require_login($course->id); + + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + require_capability('mod/attforblock:viewreports', $context); + + //add info to log + add_to_log($course->id, 'attendance', 'report displayed', 'mod/attforblock/report.php?id='.$id, $user->lastname.' '.$user->firstname); + + /// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity'); + $navlinks[] = array('name' => get_string('report', 'attforblock'), 'link' => null, 'type' => 'activityinstance'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - ' .get_string('report','attforblock'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + + show_tabs($cm, $context, 'report'); + + $sort = $sort == 'firstname' ? 'firstname' : 'lastname'; + + if(!count_records('attendance_sessions', 'courseid', $course->id)) { // no session exists for this course + redirect("sessions.php?id=$cm->id&action=add"); + } else { // display attendance report + /// find out current groups mode + $groupmode = groups_get_activity_groupmode($cm); + $currentgroup = groups_get_activity_group($cm, true); + if ($groupmode == VISIBLEGROUPS || + ($groupmode && has_capability('moodle/site:accessallgroups', $context))) { + groups_print_activity_menu($cm, "report.php?id=$id&sort=$sort"); + } + + echo '
'.helpbutton ('report', get_string('help'), 'attforblock', true, true, '', true).'
'; + + if ($currentgroup) { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false); + } else { + $students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', '', '', false); + } + + // display date interval selector + $rec = get_record_sql("SELECT MIN(sessdate) AS min, MAX(sessdate) AS max + FROM {$CFG->prefix}attendance_sessions + WHERE courseid=$course->id AND sessdate >= $course->startdate"); + $firstdate = $rec->min; + $lastdate = $rec->max; + $now = time(); + $current = $current == 0 ? $now : $current; + list(,,,$wday, $syear, $smonth, $sday) = array_values(usergetdate($firstdate)); + $wday = $wday == 0 ? 7 : $wday; //////////////////////////////////////////////////// Нужна проверка настройки календаря + $startdate = make_timestamp($syear, $smonth, $sday-$wday+1); //GMT timestamp but for local midnight of monday + + $options['all'] = get_string('alltaken','attforblock'); + $options['weeks'] = get_string('weeks','attforblock'); + $options['months'] = get_string('months','attforblock'); + echo '
'.helpbutton ('display', get_string('display','attforblock'), 'attforblock', true, false, '', true).get_string('display','attforblock').': '; + if (isset($_GET['view'])) //{ + set_current_view($course->id, $_GET['view']); + $view = get_current_view($course->id); + popup_form("report.php?id=$id&sort=$sort&view=", $options, 'viewmenu', $view, ''); + + $out = ''; + $list = array(); + if ($view === 'weeks') { + $format = get_string('strftimedm', 'attforblock'); + for ($i = 0, $monday = $startdate; $monday <= $lastdate; $i++, $monday += ONE_WEEK) { + if (count_records_select('attendance_sessions', "courseid={$course->id} AND sessdate >= ".$monday." AND sessdate < ".($monday + ONE_WEEK))) { + $list[] = $monday; + } + } + } elseif ($view === 'months') { + $startdate = make_timestamp($syear, $smonth, 1); + $format = '%B'; + for ($i = 0, $month = $startdate; $month <= $lastdate; $i++, $month = make_timestamp($syear, $smonth+$i, 1)) { + if (count_records_select('attendance_sessions', "courseid={$course->id} AND sessdate >= ".$month." AND sessdate < ".make_timestamp($syear, $smonth+$i+1, 1))) { + $list[] = $month; + } + } + } + $found = false; + for ($i = count($list)-1; $i >= 0; $i--) { + if ($list[$i] <= $current && !$found) { + $found = true; + $current = $list[$i]; + $out = ''.userdate($list[$i], $format).' / '.$out; + } else { + $out = "\n".userdate($list[$i], $format)." / ".$out; + } + } + echo substr($out, 0, -2)."
\n"; + + $statuses = get_statuses($course->id); + $allstatuses = get_statuses($course->id, false); + + if ($view === 'weeks') { + $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $current AND sessdate < ".($current + ONE_WEEK); + } elseif ($view === 'months') { + list(,,,, $syear, $smonth, $sday) = array_values(usergetdate($current)); + $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $current AND sessdate < ".make_timestamp($syear, $smonth+1, 1); + } else { + $where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate <= ".time(); + } + if ($students and + ($course_sess = get_records_select('attendance_sessions', $where, 'sessdate ASC'))) { + + $firstname = "".get_string('firstname').''; + $lastname = "".get_string('lastname').''; + if ($CFG->fullnamedisplay == 'lastname firstname') { // for better view (dlnsk) + $fullnamehead = "$lastname / $firstname"; + } else { + $fullnamehead = "$firstname / $lastname"; + } + + $table->head[] = ''; + $table->align[] = ''; + $table->size[] = '1px'; + $table->head[] = $fullnamehead; + $table->align[] = 'left'; + $table->size[] = ''; + $allowtake = has_capability('mod/attforblock:takeattendances', $context); + $allowchange = has_capability('mod/attforblock:changeattendances', $context); + foreach($course_sess as $sessdata) { + if (count_records('attendance_log', 'sessionid', $sessdata->id)) { + if ($allowchange) { + $table->head[] = "id}\">". + userdate($sessdata->sessdate, get_string('strftimedm', 'attforblock').'
('.get_string('strftimehm', 'attforblock').')'). + '
'; + } else { + $table->head[] = userdate($sessdata->sessdate, get_string('strftimedm', 'attforblock').'
('.get_string('strftimehm', 'attforblock').')'); + } + + } else { + if ($allowtake) { + $table->head[] = "id}\">". + userdate($sessdata->sessdate, get_string('strftimedm', 'attforblock').'
('.get_string('strftimehm', 'attforblock').')'). + '
'; + } else { + $table->head[] = userdate($sessdata->sessdate, get_string('strftimedm', 'attforblock').'
('.get_string('strftimehm', 'attforblock').')'); + } + } + $table->align[] = 'center'; + $table->size[] = '1px'; + } + for ($i=0; $i<5; $i++) { + $table->align[] = 'center'; + $table->size[] = '1px'; + } + + foreach($statuses as $st) { + $table->head[] = $st->acronym; + } + $table->head[] = get_string('grade');//.' / '.$maxgrade; + + $table->align[] = 'right'; + $table->size[] = '1px'; + $table->head[] = '%'; + + foreach($students as $student) { + $table->data[$student->id][] = print_user_picture($student->id, $course->id, $student->picture, 20, true, true); + $table->data[$student->id][] = "id}\">".fullname($student).''; + foreach($course_sess as $sessdata) { + if ($att = get_record('attendance_log', 'sessionid', $sessdata->id, 'studentid', $student->id)) { + if (isset($statuses[$att->statusid])) { + $table->data[$student->id][] = $statuses[$att->statusid]->acronym; + } else { + $table->data[$student->id][] = ''.$allstatuses[$att->statusid]->acronym.''; + } + } else { + $table->data[$student->id][] = '-'; + } + } + foreach($statuses as $st) { + $table->data[$student->id][] = get_attendance($student->id, $course, $st->id); + } + $table->data[$student->id][] = get_grade($student->id, $course).' / '.get_maxgrade($student->id, $course); + $table->data[$student->id][] = get_percent($student->id, $course).'%'; + } + echo '
'; + print_table($table); + } else { + print_heading(get_string('nothingtodisplay'), 'center'); + } + + echo get_string('status','attforblock').':
'; + foreach($statuses as $st) { + echo $st->acronym.' - '.$st->description.'
'; + } + } + print_footer($course); + exit; +?> \ No newline at end of file diff --git a/restorelib.php b/restorelib.php new file mode 100644 index 0000000..79a22c1 --- /dev/null +++ b/restorelib.php @@ -0,0 +1,255 @@ +backup_unique_code, $mod->modtype, $mod->id); + + if ($data) { + //Now get completed xmlized object + $info = $data->info; + + if (count_records('attforblock', 'course', $restore->course_id)) { + return false; + } + + //Now, build the attforblock record structure + $attforblock->course = $restore->course_id; +// $attforblock->teacher = backup_todb($info['MOD']['#']['TEACHER']['0']['#']); + $attforblock->name = backup_todb($info['MOD']['#']['NAME']['0']['#']); + if (isset($info['MOD']['#']['GRADE'])) { + $attforblock->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']); + } else { + $attforblock->grade = 100; + } + + //The structure is equal to the db, so insert the attforblock + $newid = insert_record ('attforblock', $attforblock); + if ($newid) { + //We have the newid, update backup_ids + backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid); + + attforblock_restore_attendance_statuses ($mod->id, $newid, $info, $restore); + attforblock_restore_attendance_sessions ($mod->id, $newid, $info, $restore); + //Now check if want to restore user data and do it. + if (restore_userdata_selected($restore, 'attforblock', $mod->id)) { + attforblock_restore_attendance_log ($mod->id, $newid, $info, $restore); + } + } else { + $status = false; + } + } else { + $status = false; + } + + return $status; + } + + + + function attforblock_restore_attendance_sessions ($old_attforblock_id, $new_attforblock_id, $info, $restore) { + + global $CFG, $oldidarray; + + $status = true; + + if (isset($info['MOD']['#']['SESSIONS'])) { + @$stats = $info['MOD']['#']['SESSIONS']['0']['#']['SESSION']; + }else { + @$stats = $info['MOD']['#']['ATTFORBLOCK_SESSIONS']['0']['#']['ROWS']; + } + for($i = 0; $i < sizeof($stats); $i++) { + $stat_info = $stats[$i]; + //Now, build the attforblock_SESSIONS record structure + + $stat->courseid = $restore->course_id; +// $stat->creator = backup_todb($stat_info['#']['CREATOR']['0']['#']); + $stat->sessdate = backup_todb($stat_info['#']['SESSDATE']['0']['#']); + $stat->timemodified = backup_todb($stat_info['#']['TIMEMODIFIED']['0']['#']); + $stat->description = backup_todb($stat_info['#']['DESCRIPTION']['0']['#']); + if (isset($info['MOD']['#']['SESSIONS'])) { + $stat->duration = backup_todb($stat_info['#']['DURATION']['0']['#']);; + $stat->lasttaken = backup_todb($stat_info['#']['LASTTAKEN']['0']['#']); + $stat->lasttakenby = backup_todb($stat_info['#']['LASTTAKENBY']['0']['#']); + } else { //Old backup + $stat->duration = 0; + $stat->lasttaken = backup_todb($stat_info['#']['TIMETAKEN']['0']['#']); + $stat->lasttakenby = backup_todb($stat_info['#']['TAKENBY']['0']['#']); + } + if (restore_userdata_selected($restore, 'attforblock', $old_attforblock_id)) { + if ($user = backup_getid($restore->backup_unique_code, 'user', $stat->lasttakenby)) { + $stat->lasttakenby = $user->new_id; + } + } else { + $stat->lasttaken = 0; + $stat->lasttakenby = 0; + } + + $newid = insert_record ('attendance_sessions', $stat); + $oldidarray[$old_attforblock_id]['attendance_sessions'][backup_todb($stat_info['#']['ID']['0']['#'])] = $newid; + } + + return $status; + } + + + + function attforblock_restore_attendance_statuses ($old_attforblock_id, $new_attforblock_id,$info,$restore) { + + global $CFG, $oldidarray; + + $status = true; + + //Get the statuses array + if (isset($info['MOD']['#']['STATUSES'])) { + $stats = $info['MOD']['#']['STATUSES']['0']['#']['STATUS']; + for($i = 0; $i < sizeof($stats); $i++) { + $stat_info = $stats[$i]; + //Now, build the attforblock_STATUS record structure + + $stat->courseid = $restore->course_id; + $stat->acronym = backup_todb($stat_info['#']['ACRONYM']['0']['#']); + $stat->description = backup_todb($stat_info['#']['DESCRIPTION']['0']['#']); + $stat->grade = backup_todb($stat_info['#']['GRADE']['0']['#']); + $stat->visible = backup_todb($stat_info['#']['VISIBLE']['0']['#']); + $stat->deleted = backup_todb($stat_info['#']['DELETED']['0']['#']); + //if user's data not required, we don't restore invisible and deleted statuses + if (!restore_userdata_selected($restore, 'attforblock', $old_attforblock_id) + and (!$stat->visible or $stat->deleted)) { + continue; + } + + $newid = insert_record ('attendance_statuses', $stat); + $oldidarray[$old_attforblock_id]['attendance_statuses'][backup_todb($stat_info['#']['ID']['0']['#'])] = $newid; + } + + } elseif (isset($info['MOD']['#']['ATTFORBLOCK_SETTINGS'])) { + $stats = $info['MOD']['#']['ATTFORBLOCK_SETTINGS']['0']['#']['ROWS']; + for($i = 0; $i < sizeof($stats); $i++) { + $stat_info = $stats[$i]; + //Now, build the attforblock_STATUS record structure + + $stat->courseid = $restore->course_id; + $stat->acronym = backup_todb($stat_info['#']['ACRONYM']['0']['#']); + $stat->description = backup_todb($stat_info['#']['DESCRIPTION']['0']['#']); + $stat->grade = backup_todb($stat_info['#']['GRADE']['0']['#']); + $stat->visible = 1; + $stat->deleted = 0; + + $newid = insert_record ('attendance_statuses', $stat); + $oldidarray[$old_attforblock_id]['attendance_statuses'][backup_todb($stat_info['#']['STATUS']['0']['#'])] = $newid; + + } + + } else { + // ATTFORBLOCK_SETTINGS tag don't exists + // so course used default statuses (can be only in old version) + $stats = get_records('attendance_statuses', 'courseid', 0, 'id ASC'); + $oldstats = array('P', 'A', 'L', 'E'); + $i = 0; + foreach($stats as $stat) { +// $stat = $stats[$i]; + $stat->courseid = $restore->course_id; + $newid = insert_record('attendance_statuses', $stat); + $oldidarray[$old_attforblock_id]['attendance_statuses'][$oldstats[$i++]] = $newid; +// $i++; + } + } + + return $status; + } + + + function attforblock_restore_attendance_log ($old_attforblock_id, $new_attforblock_id,$info,$restore) { + + global $CFG, $oldidarray; + + $status = true; + + //Get the logs array + if (isset($info['MOD']['#']['LOGS'])) { + @$logs = $info['MOD']['#']['LOGS']['0']['#']['LOG']; + } else { + @$logs = $info['MOD']['#']['ATTFORBLOCK_LOG']['0']['#']['ROWS']; + } + + $stats = get_records_menu('attendance_statuses', 'courseid', $restore->course_id); + $statslist = implode(',', array_keys($stats)); + $sessions = get_records('attendance_sessions', 'courseid', $restore->course_id); + + //Iterate over logs + for($i = 0; $i < sizeof($logs); $i++) { + $log_info = $logs[$i]; + //Now, build the attforblock_LOG record structure + + $log->studentid = backup_todb($log_info['#']['STUDENTID']['0']['#']); + $log->remarks = backup_todb($log_info['#']['REMARKS']['0']['#']); + $user = backup_getid($restore->backup_unique_code, 'user', $log->studentid); + if ($user) { + $log->studentid = $user->new_id; + } + if (isset($info['MOD']['#']['LOGS'])) { + $log->sessionid = $oldidarray[$old_attforblock_id]['attendance_sessions'][backup_todb($log_info['#']['SESSIONID']['0']['#'])]; + $log->statusid = $oldidarray[$old_attforblock_id]['attendance_statuses'][backup_todb($log_info['#']['STATUSID']['0']['#'])]; + $log->timetaken = backup_todb($log_info['#']['TIMETAKEN']['0']['#']); + + $log->statusset = backup_todb($log_info['#']['STATUSSET']['0']['#']); + $ids = explode(',', $log->statusset); + foreach ($ids as $id) { + $new_ids[] = $oldidarray[$old_attforblock_id]['attendance_statuses'][$id]; + } + $log->statusset = implode(',', $new_ids); + + $log->takenby = backup_todb($log_info['#']['TAKENBY']['0']['#']); + $user = backup_getid($restore->backup_unique_code, 'user', $log->takenby); + if ($user) { + $log->takenby = $user->new_id; + } + + } else { //Old version + // Catching bug of first version of backup + if (isset($oldidarray[$old_attforblock_id]['attendance_sessions'][backup_todb($log_info['#']['ATTSID']['0']['#'])])) { + $log->sessionid = $oldidarray[$old_attforblock_id]['attendance_sessions'][backup_todb($log_info['#']['ATTSID']['0']['#'])]; + } else { + continue; + } + $log->statusid = $oldidarray[$old_attforblock_id]['attendance_statuses'][backup_todb($log_info['#']['STATUS']['0']['#'])]; + $log->statusset = $statslist; +// $log->timetaken = get_field('attendance_sessions', 'lasttaken', 'id', $log->sessionid); + $log->timetaken = $sessions[$log->sessionid]->lasttaken; + $log->takenby = $sessions[$log->sessionid]->lasttakenby; +// $log->takenby = backup_todb($log_info['#']['TAKENBY']['0']['#']); + } + + $newid = insert_record ('attendance_log', $log); + $oldidarray[$old_attforblock_id]['attendance_log'][backup_todb($log_info['#']['ID']['0']['#'])] = $newid; + + + //Do some output + if (($i+1) % 50 == 0) { + if (!defined('RESTORE_SILENTLY')) { + echo '.'; + if (($i+1) % 1000 == 0) { + echo '
'; + } + } + backup_flush(300); + } + } + + return $status; + } + + +// function attforblock_restore_logs($restore,$log) { +// +// $status = true; +// +// return $status; +// } + +?> \ No newline at end of file diff --git a/sessions.php b/sessions.php new file mode 100644 index 0000000..adc98d1 --- /dev/null +++ b/sessions.php @@ -0,0 +1,265 @@ +libdir.'/blocklib.php'); + require_once('locallib.php'); + require_once('lib.php'); + require_once('add_form.php'); + require_once('update_form.php'); + require_once('duration_form.php'); + + if (!function_exists('grade_update')) { //workaround for buggy PHP versions + require_once($CFG->libdir.'/gradelib.php'); + } + + $id = required_param('id', PARAM_INT); + $action = required_param('action', PARAM_ACTION); + + if ($id) { + if (! $cm = get_record('course_modules', 'id', $id)) { + error('Course Module ID was incorrect'); + } + if (! $course = get_record('course', 'id', $cm->course)) { + error('Course is misconfigured'); + } + if (! $attforblock = get_record('attforblock', 'id', $cm->instance)) { + error("Course module is incorrect"); + } + } + + require_login($course->id); + + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + require_capability('mod/attforblock:manageattendances', $context); + + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activity'); + $navlinks[] = array('name' => get_string($action, 'attforblock'), 'link' => null, 'type' => 'activityinstance'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - '.get_string($action,'attforblock'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + + ////////////////////////////////////////////////////////// + // Adding sessions + ////////////////////////////////////////////////////////// + + if ($action === 'add') { + + show_tabs($cm, $context, 'add'); + $mform_add = new mod_attforblock_add_form('sessions.php', array('course'=>$course, 'cm'=>$cm, 'modcontext'=>$context)); + + if ($fromform = $mform_add->get_data()) { + $duration = $fromform->durtime['hours']*HOURSECS + $fromform->durtime['minutes']*MINSECS; + $now = time(); + + if (isset($fromform->addmultiply)) { + $startdate = $fromform->sessiondate;// + $fromform->stime['hour']*3600 + $fromform->stime['minute']*60; + $enddate = $fromform->sessionenddate + ONE_DAY; // because enddate in 0:0am + + //get number of days + $days = (int)ceil(($enddate - $startdate) / ONE_DAY); + if($days <= 0) + error(get_string('wrongdatesselected','attforblock'), "sessions.php?id=$id&action=add"); + else { + add_to_log($course->id, 'attendance', 'multiply sessions added', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + + // Getting first day of week + $sdate = $startdate; + $dinfo = usergetdate($sdate); + if ($CFG->calendar_startwday === '0') { //week start from sunday + $startweek = $startdate - $dinfo['wday'] * ONE_DAY; //call new variable + } else { + $wday = $dinfo['wday'] === 0 ? 7 : $dinfo['wday']; + $startweek = $startdate - ($wday-1) * ONE_DAY; + } + // Adding sessions + $wdaydesc = array(0=>'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); + while ($sdate < $enddate) { + if($sdate < $startweek + ONE_WEEK) { + $dinfo = usergetdate($sdate); + if(key_exists($wdaydesc[$dinfo['wday']] ,$fromform->sdays)) { + //check whether this date there is in our session days +// if(count_records('attendance_sessions', 'courseid', $course->id, 'sessdate', $sdate) > 0) { +// notify(strftime(get_string('strftimedmy', 'attforblock'), $sdate).': '.get_string('sessionexist','attforblock')); +// $sdate += ONE_DAY; +// continue; +// } + $rec->courseid = $course->id; + $rec->sessdate = $sdate; + $rec->duration = $duration; + $rec->description = $fromform->sdescription; + $rec->timemodified = $now; + if(!insert_record('attendance_sessions', $rec)) + error(get_string('erroringeneratingsessions','attforblock'), "sessions.php?id=$id&action=add"); + } + $sdate += ONE_DAY; + } else { + $startweek += ONE_WEEK * $fromform->period; + $sdate = $startweek; + } + } + notice(get_string('sessionsgenerated','attforblock')); + } + } else { + // insert one session + $rec->courseid = $course->id; + $rec->sessdate = $fromform->sessiondate; + $rec->duration = $duration; + $rec->description = $fromform->sdescription; + $rec->timemodified = $now; + if(insert_record('attendance_sessions', $rec)) { + add_to_log($course->id, 'attendance', 'one session added', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + notice(get_string('sessionadded','attforblock')); + } else + error(get_string('errorinaddingsession','attforblock'), "sessions.php?id=$id&action=add"); + } + } + $mform_add->display(); + } + + ////////////////////////////////////////////////////////// + // Updating sessions + ////////////////////////////////////////////////////////// + + if ($action === 'update') { + + $sessionid = required_param('sessionid'); + $mform_update = new mod_attforblock_update_form('sessions.php', array('course'=>$course, + 'cm'=>$cm, + 'modcontext'=>$context, + 'sessionid'=>$sessionid)); + if ($mform_update->is_cancelled()) { + redirect('manage.php?id='.$id); + } + if ($fromform = $mform_update->get_data()) { + if (!$att = get_record('attendance_sessions', 'id', $sessionid) ) { + error('No such session in this course'); + } + +// $newdate = mktime($newhour, $newminute, 0, $newmonth, $newday, $newyear); //new variables called here + + //check for duplicate +// $count = count_records('attendance_sessions','courseid', $course->id, 'sessdate', $newdate); +// if($count != 0 && $newdate != $att->sessdate) //duplicate session exists +// error(get_string('sessionalreadyexists','attforblock'),"sessions.php?id=".$id."&sessionid=". +// $sessionid."&sessdate=".$att->sessdate."&action=update"); +// else +// { + //update session + $att->sessdate = $fromform->sessiondate; + $att->duration = $fromform->durtime['hours']*HOURSECS + $fromform->durtime['minutes']*MINSECS; + $att->description = $fromform->sdescription; + $att->timemodified = time(); + update_record('attendance_sessions', $att); + add_to_log($course->id, 'attendance', 'Session updated', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + //notice(get_string('sessionupdated','attforblock'), 'manage.php?id='.$id); + redirect('manage.php?id='.$id, get_string('sessionupdated','attforblock'), 3); +// } + } + + print_heading(get_string('update','attforblock').' ' .get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname); + $mform_update->display(); + } + + ////////////////////////////////////////////////////////// + // Deleting sessions + ////////////////////////////////////////////////////////// + + if ($action === 'delete') { + $sessionid = required_param('sessionid'); + $confirm = optional_param('confirm'); + + if (!$att = get_record('attendance_sessions', 'id', $sessionid) ) { + error('No such session in this course'); + } + + if (isset($confirm)) { + delete_records('attendance_log', 'sessionid', $sessionid); + delete_records('attendance_sessions', 'id', $sessionid); + add_to_log($course->id, 'attendance', 'Session deleted', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + $attforblockrecord = get_record('attforblock', 'course', $course->id); + attforblock_update_grades($attforblockrecord); + redirect('manage.php?id='.$id, get_string('sessiondeleted','attforblock'), 3); + } + + print_heading(get_string('deletingsession','attforblock').' :: ' .$course->fullname); + + notice_yesno(get_string('deletecheckfull', '', get_string('session', 'attforblock')). + '

'.userdate($att->sessdate, get_string('strftimedmyhm', 'attforblock')).': '. + ($att->description ? $att->description : get_string('nodescription', 'attforblock')), + "sessions.php?id=$id&sessionid=$sessionid&action=delete&confirm=1", $_SERVER['HTTP_REFERER']); + } + + if ($action === 'deleteselected') { + $confirm = optional_param('confirm'); + if (isset($confirm)) { + $sessionid = required_param('sessionid'); + $ids = implode(',', explode('_', $sessionid)); + delete_records_select('attendance_log', "sessionid IN ($ids)"); + delete_records_select('attendance_sessions', "id IN ($ids)"); + add_to_log($course->id, 'attendance', 'Several sessions deleted', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + + $attforblockrecord = get_record('attforblock','course',$course->id); + attforblock_update_grades($attforblockrecord); + redirect('manage.php?id='.$id, get_string('sessiondeleted','attforblock'), 3); + } + + $fromform = data_submitted(); + $slist = implode(',', array_keys($fromform->sessid)); + $sessions = get_records_list('attendance_sessions', 'id', $slist, 'sessdate'); + + print_heading(get_string('deletingsession','attforblock').' :: ' .$course->fullname); + $message = '
'; + foreach ($sessions as $att) { + $message .= '
'.userdate($att->sessdate, get_string('strftimedmyhm', 'attforblock')).': '. + ($att->description ? $att->description : get_string('nodescription', 'attforblock')); + } + + $slist = implode('_', array_keys($fromform->sessid)); + notice_yesno(get_string('deletecheckfull', '', get_string('sessions', 'attforblock')).$message, + "sessions.php?id=$id&sessionid=$slist&action=deleteselected&confirm=1", $_SERVER['HTTP_REFERER']); + } + + ////////////////////////////////////////////////////////// + // Change duration + ////////////////////////////////////////////////////////// + + if ($action === 'changeduration') { + $fromform = data_submitted(); + $slist = isset($fromform->sessid) ? implode('_', array_keys($fromform->sessid)) : ''; + + $mform_duration = new mod_attforblock_duration_form('sessions.php', array('course'=>$course, + 'cm'=>$cm, + 'modcontext'=>$context, + 'ids'=>$slist)); + if ($mform_duration->is_cancelled()) { + redirect('manage.php?id='.$id); + } + if ($fromform = $mform_duration->get_data()) { + $now = time(); + $slist = implode(',', explode('_', $fromform->ids)); + if (!$sessions = get_records_list('attendance_sessions', 'id', $slist) ) { + error('No such session in this course'); + } + foreach ($sessions as $sess) { + $sess->duration = $fromform->durtime['hours']*HOURSECS + $fromform->durtime['minutes']*MINSECS; + $sess->timemodified = $now; + update_record('attendance_sessions', $sess); + } + add_to_log($course->id, 'attendance', 'Session updated', 'mod/attforblock/manage.php?id='.$id, $user->lastname.' '.$user->firstname); + redirect('manage.php?id='.$id, get_string('sessionupdated','attforblock'), 3); + } + print_heading(get_string('update','attforblock').' ' .get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname); + $mform_duration->display(); + + } + + print_footer($course); + + ?> diff --git a/update_form.php b/update_form.php new file mode 100644 index 0000000..7bc8d6b --- /dev/null +++ b/update_form.php @@ -0,0 +1,69 @@ +libdir.'/formslib.php'); + +class mod_attforblock_update_form extends moodleform { + + function definition() { + + global $CFG; + $mform =& $this->_form; + + $course = $this->_customdata['course']; + $cm = $this->_customdata['cm']; +// $coursecontext = $this->_customdata['coursecontext']; + $modcontext = $this->_customdata['modcontext']; + $sessionid = $this->_customdata['sessionid']; + + + if (!$att = get_record('attendance_sessions', 'id', $sessionid) ) { + error('No such session in this course'); + } + $mform->addElement('header', 'general', get_string('changesession','attforblock')); + $mform->setHelpButton('general', array('changesession', get_string('changesession','attforblock'), 'attforblock')); + + $mform->addElement('static', 'olddate', get_string('olddate','attforblock'), userdate($att->sessdate, get_string('strftimedmyhm', 'attforblock'))); + $mform->addElement('date_time_selector', 'sessiondate', get_string('newdate','attforblock')); + + for ($i=0; $i<=23; $i++) { + $hours[$i] = sprintf("%02d",$i); + } + for ($i=0; $i<60; $i+=5) { + $minutes[$i] = sprintf("%02d",$i); + } + $durselect[] =& MoodleQuickForm::createElement('select', 'hours', '', $hours); + $durselect[] =& MoodleQuickForm::createElement('select', 'minutes', '', $minutes, false, true); + $mform->addGroup($durselect, 'durtime', get_string('duration','attforblock'), array(' '), true); + + $mform->addElement('text', 'sdescription', get_string('description', 'attforblock'), 'size="48"'); + $mform->setType('sdescription', PARAM_TEXT); + $mform->addRule('sdescription', get_string('maximumchars', '', 100), 'maxlength', 100, 'client'); + + $dhours = floor($att->duration / HOURSECS); + $dmins = floor(($att->duration - $dhours * HOURSECS) / MINSECS); + $mform->setDefaults(array('sessiondate' => $att->sessdate, + 'durtime' => array('hours'=>$dhours, 'minutes'=>$dmins), + 'sdescription' => $att->description)); + +//------------------------------------------------------------------------------- + // buttons + $submit_string = get_string('update', 'attforblock'); + $this->add_action_buttons(true, $submit_string); + + $mform->addElement('hidden', 'id', $cm->id); + $mform->addElement('hidden', 'sessionid', $sessionid); + $mform->addElement('hidden', 'action', 'update'); + + } + +// function validation($data, $files) { +// $errors = parent::validation($data, $files); +// if (($data['timeend']!=0) && ($data['timestart']!=0) +// && $data['timeend'] <= $data['timestart']) { +// $errors['timeend'] = get_string('timestartenderror', 'forum'); +// } +// return $errors; +// } + +} +?> diff --git a/version.php b/version.php new file mode 100644 index 0000000..b213430 --- /dev/null +++ b/version.php @@ -0,0 +1,11 @@ +version = 2009022800; // The current module version (Date: YYYYMMDDXX) +$module->release = '2.1.1'; +$module->cron = 0; // Period for cron to check this module (secs) +?> diff --git a/view.php b/view.php new file mode 100644 index 0000000..3393fbe --- /dev/null +++ b/view.php @@ -0,0 +1,118 @@ +course)) { + error("Course is misconfigured"); + } + + if (! $attforblock = get_record("attforblock", "id", $cm->instance)) { + error("Course module is incorrect"); + } + + } else { + error("Module id is incorrect."); +// if (! $attforblock = get_record("attforblock", "id", $a)) { +// error("Course module is incorrect"); +// } +// if (! $course = get_record("course", "id", $attforblock->course)) { +// error("Course is misconfigured"); +// } +// if (! $cm = get_coursemodule_from_instance("attforblock", $attforblock->id, $course->id)) { +// error("Course Module ID was incorrect"); +// } + } + + require_login($course->id); + + if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { + print_error('badcontext'); + } + + if (!$studentid && (has_capability('mod/attforblock:manageattendances', $context) || + has_capability('mod/attforblock:takeattendances', $context) || + has_capability('mod/attforblock:changeattendances', $context))) { + redirect("manage.php?id=$cm->id"); + } + if (!$studentid && has_capability('mod/attforblock:viewreports', $context)) { + redirect("report.php?id=$cm->id"); + } + + if (! $user = get_record('user', 'id', $USER->id) ) { + error("No such user in this course"); + } + + require_capability('mod/attforblock:view', $context); + + $student = false; + if ($studentid) { + if ($studentid == $USER->id or has_capability('mod/attforblock:viewreports', $context)) { + if (!$student = get_record('user', 'id', $studentid) ) { + error("No such user in this course"); + } + } + } + +// if (empty($student) && has_capability('mod/attforblock:manageattendances', $context)) { +// redirect("manage.php?id=$cm->id"); +// } + + if ($student) { + $user = $student; + } + if ($printing) { + if ($mode === 'thiscourse') { + print_header('', $course->fullname.' - '.get_string('attendancereport','attforblock')); + print_user_attendaces($user, $cm, $course, 'printing'); + } else { + print_header('', get_string('attendancereport','attforblock')); + print_user_attendaces($user, $cm, 0, 'printing'); + } + exit(); + } + +/// Print headers + $navlinks[] = array('name' => $attforblock->name, 'link' => "view.php?id=$id", 'type' => 'activityinstance'); + $navlinks[] = array('name' => get_string('attendancereport', 'attforblock'), 'link' => null, 'type' => 'title'); + $navigation = build_navigation($navlinks); + print_header("$course->shortname: ".$attforblock->name.' - ' .get_string('export', 'quiz'), $course->fullname, + $navigation, "", "", true, " ", navmenu($course)); + + //add info to log + add_to_log($course->id, 'attendance', 'student view', "mod/attforblock/view.php?course=$course->id&student=$USER->id", $USER->lastname.' '.$USER->firstname); +// print_heading(get_string('attendanceforthecourse','attforblock').' :: ' .$course->fullname); + + /// Prints out tabs + $currenttab = $mode; + $studstr = $student ? '&student='.$student->id : ''; + $toprow = array(); + $toprow[] = new tabobject('thiscourse', "view.php?id=$id&mode=thiscourse{$studstr}", + get_string('thiscourse','attforblock')); + $toprow[] = new tabobject('allcourses', "view.php?id=$id&mode=allcourses{$studstr}", + get_string('allcourses','attforblock')); + print_tabs(array($toprow), $currenttab); + + if ($mode === 'thiscourse') { + print_user_attendaces($user, $cm, $course); + } else { + print_user_attendaces($user, $cm); + } + + print_footer($course); + +?> \ No newline at end of file