* 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)
You can get latest daily build here:
http://download.moodle.org/plugins/mod/attforblock.zip (module)
http://download.moodle.org/plugins/blocks/attendance.zip (block)
Remember, you MUST install module and block together! Only in this case
Attendance will work! (code rewriting not finished yet. In future it will be
corrected)
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I am missing some strings when looking at the role definition for teacher.
I am not sure how to track down these strings. I don't remember checking this before, so perhaps I did not do a good job of bug reporting! Or maybe I just did not install the language files correctly. But I don't have missing strings anywhere else that I can see.
Here is a screen shot. Thank you for any advice!
atw

Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
// print_group_menu($groups, $groupmode, $currentgroup, "attendances.php?id=$id&attsid=$attsid&sort=$sort"); setup_and_print_groups($course, $groupmode, "attendances.php?id=$id&attsid=$attsid&sort=$sort");
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
When I install these modules, all of of my topics disappear when I turn editing on! I installed this about a month ago with the same result and then this morning using the latest zips. The only error I get when I nav to the Admin page is that version.php can not be read. I copied it from another mod and the install appeared to go smoothly. Without adding the mod or the block to any courses though, all topics disappear when I turn editing on.
Help! The first time I had to completly rebuild the site - this site is small and only used by a handful of people so it is my "test" site but I really dont want to have to rebuild again. ALso, I need to install this on our production site but cant proceed until I see it work.
Thanks!
Jeff
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I think that this problem is caused by something failing in your setup. Many people have posted on the issue, and usually manage to solve it by turning debugging on and noting where the page load fails. It might be attendance, and it might be something else! It is almost always a third-party block though.
In my experience, the problem is caused by some code calling a block or module that no longer exists or is corrupted in the instance. Easiest fix is to re-install the missing block, but sometimes you can't (because it hasn't been updated for the current version of Moodle). Other things you can try are digging through all the relevant directories, removing the files completely, and then re-installing. Some things require files in multiple places, so you tend to forget where all of them are! If you remove only half the files, you will get the "turn editing on vanishes everything" problem.
I do hope you get it figured out. I can tell you that the attendance block is working properly in our instance, 1.8.2+ updated September 7.
atw
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
One could hope for clearer naming so that iddyits like me would have an easier life but to be a devil's advocate, Dmitry does state clearly which is which in the message at the top of this discussion.
Oh well! LOL
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
When you turn editing on, you can look in the "activity" dropdown box and add attendance the same way you add any assignment, forum, or other interactive object.
If you don't want attendance to show in your gradebook, you can then hide it. You use the block to take attendance (which still works even though the activity is hidden), and the students can see their report. (My recollection is that this happens automatically, but you can check the student roles if there is a problem).
Of course if you DO want it in the gradebook, don't hide the activity or set the gradebook to show ALL activities even those that are hidden. Personally, I always put the attendance activity in the summary topic at the very top of my course.
Hope you get it to work! We love this block.
atw
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks for the work on the attendance code!
I have used it and like it.
I notice that Moodle 1.8 is what the attendance code works with, but I thought I would try it out with Moodle 1.9, and report any problems I found. So I did.
I just installed the latest (as of Nov 14, 2007) attendance block and module in Moodle 1.9.2.
I noticed these things:
- under the Report tab, display of Months and Weeks worked, but "All Taken" reported "Nothing to display"
- the activity was missing some language information, since it appeared as modulename on the main course page (the block did not have this problem)
This was a quick test with 1 student - but I thought the info may be useful. Other than the above, it seems to work. I have not done extensive testing, however.
Thanks.
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
have the same Problem with Moodle 1.8.4+, previous updated from 1.8.2+.
Additionally i have copied the language Files into the lang/de_utf8 and en_utf8 Folder, like in http://moodle.org/mod/forum/discuss.php?d=90061, but it don't solve the problem.
Any ideas?
Florian
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
1. Go to \moodle\blocks\attendance\lang\en_utf8\help COPY "block_attendance" folder into \moodle\lang\en_utf8\help
2. COPY \moodle\blocks\attendance\lang\en_utf8\attforblock.php and block_attendance.php into \moodle\lang\en_utf8
you usually need to put a copy of the language file in en_utf8 or whichever language pack you are using .
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Minor bugfix in report.php Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
perhaps by messing about in ways that one wouldn't ordinarily, I found what I think is a small bug in the reports. The totals (P,A,L,E,Grade) are counted based on the sessions since the course.startdate. However, the report shows gradings for all sessions, even before course.startdate (suppose you changed the startdate). This can lead to confusing reports like the one below.
Attached is a patch, causing the report to only show those sessions which occur after startdate and therefore report the totals and individual sessions consistently.
Thanks very much for the great add-on.
Gavin
PS why can it not be found under moodle.org's "modules and plugins" section. The only reason I found out about this module was a colleague sent me a URL.

Re: Minor bugfix in report.php Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: Minor bugfix in report.php Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
http://moodle.org/mod/data/view.php?d=13&rid=1062
Re: Minor bugfix in report.php Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I have just installed the module and block as per read me files and the notifications tell me it has installed OK.
However when I add an attendance block to a course it tells me to add an activity - fair enough. However when I add an activity I get the error:
Could not add a new instance of attforblock
What am i doing wrong?
Cheers
I have given my teachers permission to export their attendance report and am receiving this message "Sorry, but you do not currently have permissions to do that (attendance:export)".
As an administrator, I can export, but my teachers can not.
Try this:
http://moodle.org/mod/forum/discuss.php?d=78474
It is a work around, but pretty effective!
atw
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Sorry! It's my fault...
Fixed.
Will be available tomorrow after daily build...
PS: You can only replace file export.php from module!
I continue to really appreciate this module and we are preparing to use it very wide scale at my university from this April.
I am going to need to create a large number of courses and pre-set them with attendance dates for teachers. If I could create a 'template' attendance pattern in a course and then import it into other courses it would make my job MUCH easier. Currently this is not possible....I guess due to the lack of backup support.
Is there any forecast date for when the 'backup support' is going to be implemented for the attendance module/block?
Or is backup support even related to the issue I'm having??? If I click on "import" from a course that doesn't not have the attendance mod/block installed, and then navigate to a course that has the attendance mod/block to try to import it, all the other activities from that course appear but the attendance activity does not.
Maybe this isn't related to backup.....?
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I thought the information might be useful, so here it is!
I noticed the admin/index.php was blank.
I turned maximum debugging on via the admin settings.
In attforblock, settings.php, config.php was not included or found.
I changed this line
require_once('../../config.php');
to
require_once($CFG->dirroot.'/config.php');
and that error disappeared.
However, I had other errors...
A required parameter (id) was missing
Stack trace:
* line 5741 of lib/weblib.php: call to debugging()
* line 296 of lib/moodlelib.php: call to error()
* line 14 of mod/attforblock/settings.php: call to required_param()
* line 27 of admin/settings/plugins.php: call to include()
* line 4037 of lib/adminlib.php: call to include()
* line 545 of admin/index.php: call to admin_get_root()
the above was on the page moodle-site/admin/
(Please note: the line numbers might be off by 1 or 2, since I tried making a few changes to fix this - but they should be close!)
I looked and the line in attforblock/settings.php was
$id = required_param('id', PARAM_INT);
// Course id
I wondered if this was not set because I was in the admin page, not in a course.
So, on a course page (the default course, CF101) I see this:
print_header() was sent a string as 3rd (CF101 -> Attendance) parameter. This is deprecated in favour of an array built by build_navigation(). Please upgrade your code.
* line 2338 of lib/weblib.php: call to debugging()
* line 48 of mod/attforblock/manage.php: call to print_header()
Course Fullname 101
*
Navigation needs to be updated to use build_navigation()
* line 3542 of lib/weblib.php: call to debugging()
* line 37 of theme/standardwhite/header.html: call to print_navigation()
* line 2553 of lib/weblib.php: call to include()
* line 48 of mod/attforblock/manage.php: call to print_header()
You are here
* Moo
* / ► CF101
* / ► Attendance
But, the block seems to be working, in spite of the errors. With debugging off, the only noticeable thing I recall was that some admin pages were not visible.
I used this block in Moodle 1.8 without this problem - but that was an older version of Attendance, and older version of Moodle.
I hope the above information is helpful.
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Dmitry,
Is there a way to make the radio buttons so that more than one option can be applied. In particular, I am looking at the Excused button. We have to track absences and tardies and whether they are excused or not. We also have to track dismissals, but you do not have a column for that.
Mark
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
1) blocks - such as calendar or online users
2) a resource - such as a web page
3) an activity - such as a quiz
The blocks are usually available on the right column, and the resources and activities in the center column.
I believe that the attendance module requires both
- an attendance block
- an attendance activity
You would add the attendance activity as you would normally add another activity, such as a quiz, forum or assignment.
More detail:
Click the button to Turn Editing On. Then in the center column, look for a drop-down list with the words
Add an activity...
For each topic, or week (depending on whether your course uses topics or weeks), you will see this drop-down list. The top one is a good choice.
If you are using the social format for your course, instead of weeks or topics, then I think you will see a block named Social Activities. There you can select an activity to add.
If you don't see it, you might be able to add Social Activities as a new block (under Blocks, select the block from the "Add..." drop-down list).
Then select the attendance activity from the list.
...
Add an activity...
For each topic, or week (depending on whether your course uses topics or weeks), you will see this drop-down list. The top topic or week is a good choice as the place to put the attendance activity.
If you are using the social format for your course, instead of weeks or topics, then I think you will see a block named Social Activities. There you can select an activity to add.
If you don't see it, you might be able to add Social Activities as a new block (under Blocks, select the block from the "Add..." drop-down list).
Anyway, after finding the "Add an activity..." drop-down list,
select the attendance activity from the list.
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
When tabulating the student's attendance score, the score is taken from all sessions but the possible score omits the four that are shown as not taken. Thus all of my students have >100% attendance at this point. I haven't updated my attendance module since the start of 2008, so if this has been addressed since December my apologies. If it hasn't been addressed, it would be cool if someone could figure out what is going on.
Thanks,
Richard
Edit: Added screen capture of report
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I am begging to know how I can import attendance from one course to another. I REALLY need to be able to do this and if it is something simple that I'm just overlooking I'm going to feel like an idiot but that's ok
If it is a feature that needs to be added (programmed) into the attendance module I'm willing to throw out some funds to help with the development if necessary.
Does anyone else want to do what I'm trying to do? It can't be just me...
Setting up attendance templates (3 in our case) and then importing them into other courses will make things not just easier but possible for us so this is a make or break issue for me right now.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
If you do, it should not be a big deal to write a few SQL queries to create the block and the activity to your specification in a course. Below, I've written queries to show the three types of rows which you'd need to insert. You might need to create mdl_attendance_settings per course (below are just defaults), you need to create a row per attendance session in mdl_attendance_sessions and you need to create a block instance for the course in mdl_block_instance.
You can write SQL queries like
INSERT INTO mdl_attendance_settings (courseid,status,acronym,description,grade) VALUES (1,'P','P','Present',3), (2,'P','P','Present',6);
which would insert two new settings over-riding the present grade on courses with id 1 and 2 into mdl_attendance_settings etc.
Alternatively you could put together a few spreadsheets with the values you need to insert and use LOAD DATA INFILE to load them into each table.
If you need more help with this post. I'm a little busy at the moment but this may help get you started.
Gavin
mysql> select * from mdl_attendance_settings;
+----+----------+--------+---------+-------------+-------+
| id | courseid | status | acronym | description | grade |
+----+----------+--------+---------+-------------+-------+
| 1 | 0 | P | P | Present | 2 |
| 2 | 0 | A | A | Absent | 0 |
| 3 | 0 | L | L | Late | 1 |
| 4 | 0 | E | E | Excused | 1 |
+----+----------+--------+---------+-------------+-------+
4 rows in set (0.00 sec)
mysql> select * from mdl_attendance_sessions LIMIT 4;
+----+----------+---------+------------+---------+------------+--------------+-------------+
| id | courseid | creator | sessdate | takenby | timetaken | timemodified | description |
+----+----------+---------+------------+---------+------------+--------------+-------------+
| 11 | 2 | 5 | 1196208000 | 804 | 1196254913 | 1196255199 | |
| 12 | 2 | 5 | 1196294400 | 5 | 1196327117 | 1196352874 | |
| 13 | 2 | 5 | 1196380800 | 5 | 1196414255 | 1196442129 | |
| 14 | 2 | 5 | 1196640000 | 5 | 1196681825 | NULL | |
+----+----------+---------+------------+---------+------------+--------------+-------------+
4 rows in set (0.00 sec)
mysql> select mdl_block_instance.* from mdl_block_instance INNER JOIN mdl_block ON mdl_block_instance.blockid=mdl_block.id WHERE mdl_block.name='attendance';
+----+---------+--------+-------------+----------+--------+---------+------------+
| id | blockid | pageid | pagetype | position | weight | visible | configdata |
+----+---------+--------+-------------+----------+--------+---------+------------+
| 15 | 29 | 2 | course-view | r | 0 | 1 | |
| 86 | 29 | 0 | admin | l | 2 | 1 | |
| 49 | 29 | 3 | course-view | r | 0 | 1 | |
| 52 | 29 | 4 | course-view | r | 0 | 1 | |
| 53 | 29 | 5 | course-view | r | 0 | 1 | |
| 54 | 29 | 6 | course-view | r | 0 | 1 | |
| 65 | 29 | 7 | course-view | r | 0 | 1 | |
+----+---------+--------+-------------+----------+--------+---------+------------+
7 rows in set (0.00 sec)
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks. I think your message is in response to mine...right?
I don't know much SQL. Really almost none but I have tinkered a little.
I think I understand what you have explained here. Are you saying that I could generate the attendance settings for all of my courses using an SQL command or set of commands?
The spreadsheet option sounds even better to me but I'm not sure if I can get it all set up or not..
I need to generate attendance settings (specific dates over the course of a semester - three different patterns) for quite a few courses and I was thinking that importing them from a template course would be the best way but I guess, if my skills were up to par, I could do it other ways too.
Maybe I'll tinker with my development site and see if I can figure it out using the example you've provided here.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
that's pretty much the idea.
In order to create an attendance block and sessions on a given course, you need to add one row to the mdl_block_instance table which is the same as adding the attendance block through the webpage.
You then need to add a row to the mdl_attendance_sessions table for each date a given course needs to call attendance, which is equivalent to creating the date sessions in the web interface.
You can do this by running SQL insert commands like the example I've given.
http://www.geocities.com/SiliconValley/Vista/2207/sql1.html
Alternatively, it might be easier to create a spreadsheet with all of the records you need to add for a given table. You can then export them to CSV format and use the LOAD DATA INFILE SQL command to import the rows into each table. That might be easier initially.
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
http://www.modwest.com/help/kb6-253.html
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks. I understand the logic here, it's just that my tech skills (MySQL & PHP) are way behind. I got to thinking how nice it would be to be able to integrate what I'm trying to do into the batch course upload addon. I see how this could be done (from a logic perspective) but I'm afraid I don't have the skills to do it.
I guess what I'm going to do is make a copy of my development instance of Moodle (I'm sure I'll screw it up) and then play around with the MySQL commands that you have provided and see if I can get it down before going to my production instance.
Thanks again
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks so much for your help here. I've been trying to get my head around all of this and have finally managed to figure it out (I think).
I just have one question about the mdl_block_instance table in the database. I know that I need to create new rows in this table for each instance of the Attendance block but I can't figure out what the connection (relation) is between each block instance created in mdl_block_instance and the course that it is to appear in?
I see the courseid in the mdl_attendance_sessions and mdl_attendance_settings but can't seem to figure out the logical connection for the instance? Is the pageid field in mdl_block_instance what connects each instance to a course?
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I have 6 courses here which are using the attendance block/module (Ignore the one with id=86, I'm not sure what that is myself!). The mdl_block table has an entry for attendance with id=29. My mdl_block_instance table contains:
mysql> select * from mdl_block_instance WHERE blockid=29;
+----+---------+--------+-------------+----------+--------+---------+------------+
| id | blockid | pageid | pagetype | position | weight | visible | configdata |
+----+---------+--------+-------------+----------+--------+---------+------------+
| 15 | 29 | 2 | course-view | r | 0 | 1 | |
| 86 | 29 | 0 | admin | l | 2 | 1 | |
| 49 | 29 | 3 | course-view | r | 0 | 1 | |
| 52 | 29 | 4 | course-view | r | 0 | 1 | |
| 53 | 29 | 5 | course-view | r | 0 | 1 | |
| 54 | 29 | 6 | course-view | r | 0 | 1 | |
| 65 | 29 | 7 | course-view | r | 0 | 1 | |
+----+---------+--------+-------------+----------+--------+---------+------------+
7 rows in set (0.00 sec)
So, obviously the blockid of 29 means attendance (but it might not be 29 for you), the id is auto-generated, the pageid is the id value from the mdl_course table entry for the course you want attendance on (so I have attendance on courses with IDs 2,3,4,5,6,7). The position tells you which side of the page (l,r) the block should appear and the larger the weight, the further down the side of the page it'll appear (we have zero so they're all near the top).
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks. If you look at mdl_course table the course id column is just "id" so I wasn't sure if "pageid" in mdl_block_instance referred to the course or not.
I think I'm going to make one template course with the attendance sessions that I need and then export the attendance sessions from that course using PHPMyAdmin and then use that file as a template for creating the attendance sessions in other courses. All I will need to do is change the course ID and then use the LOAD DATA INFILE command that you mentioned previously. I'm learning a little SQL as I go but at this point feel more comfortable with PHPMyAdmin as opposed to using direct SQL from the command line of my server.
This should allow me to create the sessions fairly rapidly. I am still going to have to go an look up the ID for all my courses which will be a little time consuming but nothing near what it would be to try to generate all these sessions by hand through the web interface. I guess I could export a csv file of mdl_course to speed that up too.
Thanks again for your help. Once I accomplish what I'm trying to do I'll post a quick 'how to' for anyone that may be in the same boat as me.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I haven't been working on this long enough to want to pull out my hair yet but I'm heading in that direction.
I managed to add the necessary row and fields to mdl_block_instance but the block did not 'appear' in the course that I added it to. The course ID is correct as I can also see it in the address bar of my browser when I access that particular course.
I thought maybe the block had not appeared yet because I still needed to add rows and fields to mdl_attforblock and mdl_attendance_settings and eventually mdl_attendance_sessions.
I tried to add the rows and fields to mdl_attendance_settings as follows:
"","82","P","S","Super","3"
"","82","A","P","Present","2"
"","82","L","L","Late","1"
"","82","E","A","Absent","0"
using Import from PHPMyAdmin which uses the LOAD DATA INFILE command. I have a very strange problem though. Every time I try to add the 4 rows listed above, I only get 2 rows successfully added and every time they are the one containing 'Super' and the one containing 'Late'. It skips 'Present' and 'Absent' every time.... I've tried all kinds of things (using different field separators, different enclosures, using just 'Import csv file' instead of 'csv using LOAD DATA' but nothing seems to work. Every time I just get those two rows.
I also went back to the course (number 82) to see if the attendance block was showing up but no luck, it's not there.
I am probably missing something really simple...... can't, for the life of me, figure out what it is though.
Advice and help will, as always, be greatly appreciated.
Jason
Edit - I manged to add the 2 rows through phyMyAdmin by clicking on Insert and adding one row at a time (not how I want to do it for 200+ courses) but the block still doesn't show up in the course I've added everything to...
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I know you're trying to avoid the command line by using php_myadmin, but I really would suggest learning the command line. Life is so much clearer there and you can show us the commands you're running so it's clear to us what you're doing. MySQL has excellent manuals filled with examples for all statements, including LOAD DATA INFILE and SELECT, which are pretty much the only ones you need here.
http://dev.mysql.com/doc/refman/5.0/en/sql-syntax.html
> I tried to add the rows and fields to mdl_attendance_settings as follows:
>
> "","82","P","S","Super","3"
> "","82","A","P","Present","2"
> "","82","L","L","Late","1"
> "","82","E","A","Absent","0"
I presume from this that you're setting the course id to 82 and the blank entries are the IDs. Setting courseid=0 will set the default for all courses.
+----+----------+--------+---------+-------------+-------+
| id | courseid | status | acronym | description | grade |
+----+----------+--------+---------+-------------+-------+
| 1 | 0 | P | P | Present | 2 |
| 2 | 0 | A | A | Absent | 0 |
| 3 | 0 | L | L | Late | 1 |
| 4 | 0 | E | E | Excused | 1 |
+----+----------+--------+---------+-------------+-------+
I haven't used PHPMyAdmin, but I would have thought you should just leave out the id field entirely. Trying to set the id to the empty string should fail -- though perhaps PHPMyAdmin interprets this some other way. You also cannot create multiple entries with the same id or the same (courseid, status), but you don't appear to have tried that.
Have you considered just updating the 0 rows to change the defaults for all courses, rather than creating entries for every course?
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Remove all the other entries you've created for this course:
DELETE FROM mdl_attendance_settings WHERE courseid=82;
This is the insert statement you want:
INSERT INTO mdl_attendance_settings
(courseid,status,acronym,description,grade)
VALUES (82,'P','S','Super',3),
(82,'A','P','Present',2),
(82,'L','L','Late',1),
(82,'E','A','Absent',0);
or just update the defaults with four statements of this form:
UPDATE mdl_attendance_settings SET
courseid=0,
status='P',
acronym='S',
description='Super',
grade=3
WHERE id=1;
changing the id and values each time.
The LOAD DATA INFILE way is as follows:
LOAD DATA INFILE '/home/admins/gavinmc/tmp.csv' REPLACE
INTO TABLE mdl_attendance_settings
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
(courseid,status,acronym,description,grade);
but you must REMOVE the opening empty string of each row so the first column in your CSV file is courseid.
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks again for your help and patience
I think I'm dealing with several issues at the same time here and haven't probably made them clear enough.
My understanding is that if I create rows and fields in the following tables:
mdl_block_instance
mdl_attendance_settings
mdl_attforblock (this one too?)
and eventually
mdl_attendance_sessions
that the block will appear in the course specified.
So, in mdl_block_instance I created a new row that looks like this:
812 | 33 | 82 | course-view | r | 1 | 1 |
The column headings are (id, blockid, pageid, pagetype, position, weight, visible
At this point, should I be able to navigate to the course (82) and see the attendance block? It seems that this should make the block appear but it does not.
My next problem is related to the settings in mdl_attendance_settings and not being able to import the csv file correctly. (only 2 of the 4 rows get imported). I did go ahead and put them in one line at a time but still don't see the attendance block/mod when I go to the course (id is 82).
I also created a row in mdl_attforblock that is the same as other lines in that table but with the appropriate course id (82) but still no attendance block/mod on the course page.
My development instance of Moodle is a MAMP package running on my laptop. I guess I can access SQL directly by using the terminal. I'll give that a try using the commands you've provided and see how it works.
It seems that I've been able to create the rows and fields correctly but the block isn't showing up so I'm confused. I even went to the course via my browser and created the block via the web interface and then went back to the database to see the new row in the database with all the same values (except for the incremental id of course). Creating the attendance block via the web site adds the row to mdl_block_instance right after the one that I added manually. It seems like I'm missing something when I add the block manually into the database...
Also, in regards to the mdl_attendance_settings, it seems that you are saying that if I just change the defaults I won't have to make any other changes to mdl_attendance_settings...? But when I look at the mdl_attendance_settings, there are rows (4 of them) for every instance of the attendance block I have created on my site.....so don't I need to create those rows for the attendance block of each course that I want it in?
This is a study in database organization for me in addition to manipulation. I don't think I completely understand the relations between the tables (block_instance, attendance_settings, attforblock) yet and apologize for my bone headedness. If you can grant me a little more patient assistance I will probably eventually figure it out
Thanks
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I tried
INSERT INTO mdl_attendance_settings
(courseid,status,acronym,description,grade)
VALUES (82,'P','S','Super',3),
(82,'A','P','Present',2),
(82,'L','L','Late',1),
(82,'E','A','Absent',0);
from PhpMyAdmin and it worked perfectly. I mean, the 4 rows were created without problem. I'm not sure why the LOAD DATA INFILE command wasn't working though PHPMyAdmin but...
Anyway, I'm still stuck on how to get the block to 'appear' on my course page.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
your LOAD DATA command may have failed due to the leading empty string? Did you try my suggested LOAD DATA command from the command line interface? I've tested it and it works if you remove the initial empty string.
I added a block to a new course just now with:
INSERT INTO mdl_block_instance (blockid,pageid,pagetype,position,weight,visible) VALUES (29,12,'course-view','r',0,1);
where 29 came from this:
mysql> select * from mdl_block WHERE name='attendance';
+----+------------+------------+------+----------+---------+----------+
| id | name | version | cron | lastcron | visible | multiple |
+----+------------+------------+------+----------+---------+----------+
| 29 | attendance | 2007070201 | 0 | 0 | 1 | 0 |
+----+------------+------------+------+----------+---------+----------+
and 12 is the courseid which comes from:
mysql> select id,shortname,fullname from mdl_course WHERE shortname='German';
+----+-----------+----------+
| id | shortname | fullname |
+----+-----------+----------+
| 12 | German | German |
+----+-----------+----------+
1 row in set (0.00 sec)
The block immediately appeared at the top-right of that course page.
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks again. Actually I think I had the empty string in my command. I'll try it again today just as you have outlined here.
I guess my next step (after I get this to work) will be to test the LOAD DATA INFILE as that's really what I'm going to need to be able to do.
Thanks again. Hopefully I'll be posting here again later with success and a 'how to' process.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I'm going to be SO happy when I finally get this to work but unfortunately I'm not there yet.
Can I verify a couple of things? I am using Moodle 1.8.4+ Are you using this same version of Moodle?
It seems, from your posts, that I should be able to make the Attendance block appear on my course page with the settings that I want by modifying the following 2 tables in the database:
mdl_attendance_settings
mdl_block_instance
I've added the necessary rows (now from SQL command line) and still am not getting the block on the page so I'm wondering if modifications need to be made to additional tables in the database such as:
mdl_attforblock
mdl_course_modules
Later, if I can ever get this to work, I know I will have to add the sessions that I want to pre-load each course with, by adding rows to:
mdl_attendance_sessions
Anyway, do I need to add information to attforblock and/or course_modules?
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I started wondering what would happen if the 'visible' setting conflicted with a different block on the same page as there are 3 blocks already on the right side of the page that I was trying to add the Attendance block to so I changed the visibility from 0 to 4 and the block showed up!
The problem is the block says
"This block can work only with an attendance activity. Please add the activity to this course."
So, I went to mdl_attforblock and added the activity (I thought) to my course but nothing showed up.
So, then I went to mdl_course_modules and added the activity to the course. After adding it there (mdl_course_modules) it showed up on the left side of the course screen in the "Activities" block but when I click on it I get an error.
Maybe there are tables in my database from older versions of the Attendance mod/block? I'm getting closer but not quite there yet.
Jason
P.S. Just discovered something strange - I can't add the Attendance activity to my course through the web interface. I get an error saying that another attendance activity cannot be added....? But the one that appear in the Activities block doesn't work either....?
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2

Another table that seems to be related here is
mdl_course
The field "modinfo" contains information about the modules displayed within that course (their position, visibility etc.).
After experimenting a little with the Attendance module it seems that I don't even need to install the block....? If I install the module (activity) and use it to set up sessions and the settings then can't I just take attendance through the module each time. What do I need the block for?
My need to be able to create over 200 attendance instances (complete with settings and sessions) is turning into a complete study of how the attendance package is designed. It's fun but I'm running out of time

Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Looking at the database table that I referred to in my last post (mdl_course) I checked the contents of the 'modinfo' field when the attendance module (attforblock) was not activated on my course and when it was activated and got the following
Without the attforblock activity
a:1:{i:595;O:8:"stdClass":6:{s:2:"cm";i:595;s:3:"mod";s:5:"forum";s:7:"section";s:1:"0";s:4:"name";s:10:"News+forum";s:7:"visible";N;s:5:"extra";s:0:"";}}
With the attforblock activity
a:2:{i:595;O:8:"stdClass":6:{s:2:"cm";i:595;s:3:"mod";s:5:"forum";s:7:"section";s:1:"0";s:4:"name";s:10:"News+forum";s:7:"visible";N;s:5:"extra";s:0:"";}i:597;O:8:"stdClass":6:{s:2:"cm";i:597;s:3:"mod";s:11:"attforblock";s:7:"section";s:1:"0";s:4:"name";s:10:"Attendance";s:7:"visible";s:1:"1";s:5:"extra";s:0:"";}}
Without the attforblock activity 'activated', the Attendance block is not usable so I need to find a way to add the attforblock module via the database if I have any hope of being able to add attendance in a bulk fashion (at least that's what it seems like to me).
Does anyone have any experience doing this?
Gavin (if you are still there
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
What you need to think about is this. You're trying to run the exact same SQL commands which the moodle attendance block itself does in creating each attendance module.
So, one approach to understand what's going on is:
1. Set up a test server and install moodle attendance.
2. On your database, turn up the debug output so that each query gets output into a text file.
3. Login and create a new course. Record the time on the server.
4. Now set up attendance in that course via the webpages.
5. Record the time on the server.
6. Now look at the log file and see what SQL commands got run.
On a debian linux system with mysql, it appears you turn on the query logging by uncommenting this line in /etc/mysql/my.cnf
#log = /var/log/mysql/mysql.log
and restarting mysql.
Gavin
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Thanks and I'm sorry to be a pest. I'm rather obsessed with this at the moment as my deadline is slowly creeping up on me
I was going at the problem from a less effective direction (i.e. looking at the database before and after setting up the attendance module in a course). I think your suggestion presents a much more efficient and thorough solution. I'll give it a try this weekend when I can sit down at the server uninterrupted for an extended period of time.
Thanks again. I'll post back (hopefully with a success story) toward the end of the weekend.
Jason
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
I've finally managed to figure out how to:
1. Get the attendance module to 'appear' in a course through manipulation of the database.
and
2. Insert attendance sessions into each instance created.
The process (for #1) involves modification of the following tables in the database:
mdl_attforblock
mdl_course_modules
mdl_course_sections
mdl_course
The module simply needs to be added for each course in mdl_attforblock. That part is rather simple. Adding it to mdl_course_modules isn't too complicated either. For mdl_course_sections, if adding the module to the top center block ('0') the sequence needs to be modified so that Moodle knows in which order to display the default News Forum and the Attendance activity.
The hardest part is that in mdl_course, the modinfo field must be modified to include information about the module you have added (in this case Attendance). If you don't make this modification, nothing is displayed in the top center block. Under activities "Attendances" will be displayed but clicking on it produces an error.
I'm working on first getting the task I need completed and will then try to write this up in a more user friendly post. At that point I'll start a new thread (and link to it in a response here) rather than continue to add on to this forum.
Many thanks to Gavin for pointing me in the right direction and helping with great suggestions that allowed me to figure this out!
Jason
P.S. As for #2 (adding attendance sessions) that will just involve adding the appropriate rows to mdl_attendance_sessions. I'm going to be doing that as well and will include more detailed instructions for that process as well.
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Hello Gavin,
Would you mind sharing your code to automate the attendance?
I am new to Moodle and I have a project to create attendance automatically for specific courses so instructors do not need to add the sessions. I believe it is close to what you've accomplished here.
Thanks,
Juliana
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Yeah, I'm not a big fan of this naming scheme. I'd be inclined to have every table id more clearly named, eg mdl_course.courseid so cross-references would be more obvious.
> Thanks again for your help. Once I accomplish what I'm trying to do I'll post a quick 'how to' for anyone that may be in the same boat as me."
Please do!
Gavin
這一討論區的貼文已經被移除
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
To make sure what I did is clear, I created a zip file with the mod/attforblock, blocks/attendance, and lang/(all of them) and sent it to the computer administrator (I am the Moodle administrator, but I don't have access to the computer or installing files--doesn't make sense but that's the way our computer services department trusts faculty with computers) who copied the structure into the Moodle directory. He said that when he went to "an admin page" which I assume is the blocks or modules page, it showed lines indicating that the database had been updated. However, he said after it showed the database update info, it said he had to log in as administrator (he couldn't have arrived at that page without being logged in as administrator). Thus I'm guessing something funky happened in the database repair.
Anyhow, is there a sql command I can manually enter to repair the database?
Thanks for all of your efforts!
Richard
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Richard
這一討論區的貼文已經被移除
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
hi all,,
I am new to Moodle, i am trying to add attendance module to my moodle,
i followed the instructions as specified , but soon i login as admin in hitting with an error called
Plugins check
|
on the other side i am getting with
blocks/attendance attendance Non-standard (about to be installed)
. if i click upgrade again i am hitting with a error called
- line 462 of \lib\upgradelib.php: plugin_defective_exception thrown
- line 265 of \lib\upgradelib.php: call to upgrade_plugins_modules()
- line 1425 of \lib\upgradelib.php: call to upgrade_plugins()
- line 311 of \admin\index.php: call to upgrade_noncore()
pls can any one help me .
thanks in advance.
Re: New STABLE version of attendance (v2.0.2) for Moodle 1.8.2
Are you using Moodle 2.0.x? In that case, you should install an upgraded module that works with it. Look at #CONTRIB-2196.