Modifications - extra fields

Modifications - extra fields

by Barry Oosthuizen -
Number of replies: 27
Hi Dmitry,

Here is the code for the modifications I've made so far.

Anyone else who wants to check it out (without installing the modifications) can see the pics on www.whbtconline.com/pics
Average of ratings: -
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by Barry Oosthuizen -
I've updated the code a bit. It can now be installed in the normal way (new database tables/fields created automatically). Not recommended for production sites!

If anyone finds the extra functionality useful, please give your feedback. If 'Title/Session title', 'Subject' or 'Teacher' fields are not useful in your setup you could change the language file to say something else like 'venue', 'location', 'class' etc.

Background:

Our attendance register and our academic records) are maintained by our office staff (not teachers/instructors). All our students take the same subjects by the same teachers in the same venues and we only have two groups of students (Year 1 & Year 2). So my modifications might only be useful for organisations with a similar setup.
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

Yes, the most important field is missed out. Its the week field. Generally, it would be better if you allow the instructor to choose the date from which the labs start from and when it ends, and have a week field automatically be generated for the number of weeks. For instance start 1.1.09 to 31.06.09 and then for the number of weeks involved would be about for eg. 24 weeks, so in display it would appear as: wk 1 date Monday teacherdescription etc. I am not able to add the fields for the teachers and so forth. I get this error 

cantaddteacher

More information about this error 

 

error/attforblock/cantaddteacher

From MoodleDocs

Jump to: navigation, search

This page does not exist yet. You are welcome to

In reply to N Prasad

Re: Modifications - extra fields

by N Prasad -
In reply to N Prasad

Re: Modifications - extra fields

by N Prasad -

This tool still needs improvement. I teach computing courses, and lab attendances are crucial in this system. So it would be better to incorporate a table of weeks for each session and update it through that session. I have put in a simple interface: I have attached my ideas in for what would be a better interface.

In reply to N Prasad

Re: Modifications - extra fields

by Dmitry Pupinin -
Picture of Core developers Picture of Plugin developers
Sorry, maybe I don't undestood something but in current version:
1. You can add sessions using date range and duration (fig 1.1)
2. You can see list of sessions and edit it (fig 1.2)
3. You can see report and take attendances (fig 1.3)
So all this features already implemented.
In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
I agree with Dmitry, I can't see any benefit in the screenshots of your document, only the 'Lab Instructor' input field seems to add anything to the current stable version of the Moodle Attendance module.

I decided not to use the Moodle user tables for my 'teacher' fields as our intructors don't use Moodle and don't have profiles etc. I also didn't use Moodle's tables for existing courses to create my 'subjects' fields as all our 'subjects' reside inside one big 'course' for each term. It would be better (for us) if I used the Topic names inside the course or Grade categories because for us they are one and the same... but I'm just getting started now.
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

Perhaps, not so, as those are the functionalities of our organization. The documenatation is just a sample of how our organization would prefer to work in those steps. The attendance modules already covers many aspect of creating sessions, so the first figure is probably covered. However, it is important that instructors only see what labs they are teaching rather than the whole list. And in addition, since we have many weeks per a semester running, it is better if we get those weekly columns directly for that session. Every session would have the same number of weeks,  and we would grade each lab week with its respective score for the student. The only important bit is to have a validation rule for the inputs for input field that we intent to use as grade.

In reply to N Prasad

Re: Modifications - extra fields

by N Prasad -

Also, there needs to be a better way for assigning a group of students to each of these labs. Maybe you have already covered this but I am not so sure.

Generally, we students/participants can state which lab session they wish to attend via the choices tool in moodle and it would be great to link the participants ids/names from the choice list directly into the lab sessions created.

Second:nstructors associated, should directly be able to only view their respective labs and not every one's else. Is it possible to associate the user instructor accounts to each lab session

Finally: It should be possible to add/remove or relocate participants/students from one session to another from the full list of students/participant in the course

In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
Hi,

As I explained elsewhere, our admin staff do all the attendance etc. The instructors don't get involved so it's natural for all our admin staff to see all the instructors/subjects.

Dmitry has some other ideas for subjects/teachers using groups so maybe his solution will cover what you're asking for.

I'm trying to keep it simple at the moment and it meets our needs fine. If I have some free time I'll see if I can add what you want.






In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

Thank you for your feedback. 

1. If you can give me some ideas of how I can add input boxes to represent any additional fields according to my own institution's needs and have the grading use those input fields rather than the generic grading for presence, it would be great. I would like to incorporate that into the attendance tables.

2. How can I link the student groups or tables already defined to select students for a group. For instance, if students have selected choices made by moodle itself, I would like to link those choices for lab sessions directly into the sessions for attendance, and grade the labs using input boxes to represent the fields to calculate our attendance, directly by accumulation of marks.

3. If you can provide me a common code which I can directly incorporate for the selection of instructors (Teachers for eg.) directly for the course, I could incorporate these features myself.

4. How do I generate the calculated weeks within the same session. So that there is a combo box for eg to select which week to be graded and add marks.

I believe these are simple features. If you could please guide me to some code or ideas, I could do this myself.

In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -

  1. I'm not sure what you mean. In the settings tab Dmitry has added a nice feature where you can now have unlimited number of options. You don't have to use the defaults. I added two extra input fields to the attendances.php form ('make up notes' and 'sick note'). These work exactly like the 'Remarks' field at the moment, but I intend to change them into drop down lists where a status can be selected e.g. 'Due, Submitted, Approved' etc. It's quite easy to do. Just add your extra field to the attendance_logs table using PHPmyAdmin and Moodle's XMLDB editor. Then find the code for the 'Remark' field, copy it and change 'remark' to your new field. In a table there is always two parts: a header and data. You have to add your new field to both.
  2. - 4. I'm new to coding in Moodle myself. Using something like the Moodle IDE/Eclipse/xref.moodle.org helps to see where/how things are defined. Looking at code others have done can give you a clue of how to do what you want to do. Just find a page in Moodle where you see something similar to what you want, find the PHP file that displays that page (it's in the address bar) and try and find the elements you want to use. Then try and figure out how it works. The moodle/lib folder is full of functions that can do all sorts of complicated things very easily and there are some notes there on how to use it. Do you have an understanding of SQL/relational databases? If not, you might need to read up before you embark on tweaking a database...

In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

I am web developer and programmer myself. Writing SQL is very simple. But I do not have time to review too much material on all the moodle details and functions/tables, as I am a new instructor to moodle. Eg. which table has all info on the session attributes (teacher, title, duration, date etc).

I only want to do some simple things. My idea is simple.

1. Create sessions for each lab class for a semester with specified date range. Associate an instructor from the users created for the course with a teaching role. I would like the drop-down list to reference the users with the teacher role only, so I dont need manual inputs. Which function from which library would be able to select all such users without me needing to spend too much time on writing SQL. Can I utilize get_record, how does that work. If you can guide me to that, then great.  

2. When a session is created, it happens for a duration of about 12-15 weeks with a limited capacity for students, eg 30 students per class. I just want a simple script that would create all the weeks based on frequency (1 in my case) generated automatically on the date range, directly on the page for the respective session. So that would mean, for each particular session created, there is a standard number of weeks associate and a description by date for each week of 5 working days (Monday to friday). Eg Wk 3 (June 1-5, 2009). On the session page, I should be able to select the respective week (eg Week 1, Week 2 .... Week 12..etc), and then just update marks for the student for that week. 

3. After the sessions are created, I would like the students to sign-up themselves for the sessions created. To do this, I need them to select exactly one of the sessions created, representing the whole 14 weeks. So that would mean integrating the choice function with the session ids from its respective table in the database, which I have no idea of. So I do not need to manually create choices for each of the session, but rather pick from the sessions created.

4. Students sign-up using these choices, and when I click on a session eg. Monday 9-11 in venue Lab-1, it should link to the sign-up completed by students using the choices in a grouping, so I do not get the whole list of all students

5. In my gradebook, the mark associated from labs is simply an accumulation of each week lab marks in the specified period. So I just need to add a column in the gradebook to have the sum of the weeks involved. That should be simple.

6. When the instructor for the lab logs in (depending on role), should only be able to view labs that is assigned to the instructor. So that would mean an a simple link for the instructor (e. My Labs to grade) and then he views all sessions relevant to the instructor and just updates those.

7. Perhaps it is better, if I get some idea of how can I have a page like create_semester_lab_weeks_for_grading.php, where I specify the common date range for each session, to automatically create the number of weeks associated in the range as fields in the respective attendance table. This would mean, just having a tab in the attendance setting tabs to create weekly range. and then just select that for the session being created. It is very important to have a system that associates each week with a date range eg. Week 1 (June 1-5) for the 5 working days only for eg.

If you can assist me with some sample code to refernces the instructors for the course with a particular role, I can do this myself.

My second aim is to be able to get a script to generate the number of weeks by frequency for the specified date, and have this consistent for each session.

If I am able to get some idea on the first 2, the rest is simple. My core problem is I am not aware of which function to use to fetch records of a particular attribute from a table and just integrate that into the drop-down lists, like Javascript. If I am able to do this, the rest is simple.

Anyway, I would be grateful if you are able to give me some feedback with code, to keep your module stable, as I will be using it for a very large number of students in a major institution.

The features I intend to include, are really easy to implement and should not take me more than a day, if I can get some core code for the basics.

Thanks a lot.

In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
Hi,

"Eg. which table has all info on the session attributes (teacher, title, duration, date etc)."

That would be mdl_attendance_sessions. All the attendance tables start with mdl_attendance (if mdl is your prefix)

For help on Moodle functions I would ask in the Developer forum.

In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

With your code, it cant seem to add extra fields. What is important is that I want to change the type of button for my fields. I dont want a radio, but a text box. Does Dmitry's code already have that. Is something wrong with your attsettings.php file in the mod folder you provided?

I want to be able to add the field as a radio, check box or input box directly by a setting in a script, so that I can have a new improved module, and be able to allow the user to add extra fields.

Also with your reports, it doesnt seem to work, it just gives "Nothing to display message".

Attendance

Settings
In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
I don't believe this is my code. This looks like the 'Settings' page. Dmitry made it. You probably forgot to fill in the required fields...

You need to fill in at least two things:
  1. Acronym (one or two letters)
  2. Description
  3. Grade (optional - zero if you leave it empty)

It seems like you've not used the attendance module before and you don't know exactly how it works. Maybe you should have a play with the current stable version before you try mine.
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

I put in all fields. It did not work. All other features seem to be in place except the Report and Adding additional variables. I have only recently installed it and used it, and seen the good features. I only had issues with those 2.

I will try again.

In reply to N Prasad

Re: Modifications - extra fields

by N Prasad -
Hi, I have fixed all my errors in installation. So its fully functional,
In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
If you already have a version of the attendance module installed you have to delete it first:

  1. Go to Site Admin > Modules > Activities > Attforblock and delete it.
  2. Delete the attforblock folder from the moodle/mod directory.
  3. Extract my modifications in the moodle/mod directory
  4. Go to Admin > Notifications
I haven't changed anything in the block folder so that can be left as is.
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -
Would you happen to know how to create groups from choices, and which module is already available to do that.
In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
I wonder what your objective is:

Do you want to restrict access to certain activities in a course by means of a student selecting which group they want to belong to? The only way I know of how to restrict access to activities is by either not allowing a student to enroll in the course containing the activities or by assigning a 'Grouping' to each activity in a course. You can then assign Groups of students to the Grouping. Groups can have enrollment keys which you could probably hide in a quiz or something. Maybe a multiple choice quiz with only one attempt allowed. Then you hide the enrollment key for each Group in the feedback of each answer. For instance we 'schedule' our exams using Groups and Groupings without using the attendance module at all.
In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

I have been able to settle this issue, by using the Group Selection module which allows students to sign up directly for the lab of their choice which we grade. So this is covered.

The way we would prefer to work is this:

1. Create groups and let students sign up themseleves (done)

2. When we (our institution) use the attendance module, we would prefer to be able to select these groups as values for my Session, rather than manually create, since the sessions are already identified in those groups.

3. We need to have the teacher role/non-editing teachers be the ones that could be represented in the teacher field for the session, as our institution is specific to only have them edit.

4. Then, just have the weeks involved directly created as columns for each of the session pages based on the date range we specify for each of the groups session student sign up for. For eg. when create sesssion is clicked, we have an option to choose from existing groups to describe the session, next, we specify the Date Rnge and automatically columns of weeks appear in the session page, with the fields that we grade in as input boxes validated to a range. It is less effective for us to have so many sessions representing so many groups. Eg if there are 12-14 weeks per session, we end up create for 10 sessions that run over 12-14 weeks, about 120-140 sessions to represent all sessions for the whole semester. The grade we provide is just the sum of the values for each week for the total lab grading.  

Even if you could add the ability to reference the instructors from the teachers/non-editing teachers in your code as an option to select from, that would be great. The last bit is that when the instructor logs in to moodle, to find a link (such as My Labs To Grade) that would get ONLY the labs the logged in instructor teaches.

Many thanks in advance if you have any valuable input to achieve these.  

In reply to N Prasad

Re: Modifications - extra fields

by Barry Oosthuizen -
  1. I think it would be much easier to just add an attendance activity to each course which your teachers/non-editing teachers are assigned to. Then only their own sessions will be visible to them.
  2. I think Dmitry might be working on something with Groups/Groupings. Maybe that will be a good solution for you.
  3. The extra fields I added don't control anything, they are purely there just as meta data. It's like the description field broken into smaller sections. To make my 'teachers' menu select teachers/non-editing teachers shouldn't be too difficult though. There is a function in locallib.php called get_teachers. You'd need to edit that function.
  4. The attendance module can display a 'grade' in the gradebook, I prefer the present way of recording and calculating attendance. I think it's much better!

In reply to Barry Oosthuizen

Re: Modifications - extra fields

by N Prasad -

I have managed to do everything. The only bit that remains is to have input box rather than radio buttons for recording values, as we have a range of marks to issue in class. How do  I convert the types for the status such as late/present to input text boxes rather than radio and have the user place actual values like 1,3, 5 etc.

Please assist.

In reply to Barry Oosthuizen

Re: Modifications - extra fields

by umesh chavan -
hello Barry,

i am using attendance module for our institute. but we came across some extra fields n so i found few in your updated afterblock.zip.
i have installed your afterblock and i was so happy to see subject,teacher,title fileds...
but sad i couldnt add any subject,teacher,title..evertime it dosnt show anything ..if i say update then it gives error.
can you guide on this?
and can we have report with subject wise %?
and can we have email facility to send the report to respective parents email id, which will be added and linked at the time of creating sessions.

i asked such questions to Dirpmty, but he has not answered...ihope you will help me...smile

umesh
In reply to umesh chavan

Re: Modifications - extra fields

by Barry Oosthuizen -
Hi Umesh,

Maybe you used the first attachment I posted? It didn't create the database tables etc. Or maybe you didn't install it properly? I have not changed the version number so you have to uninstall (delete from database) the old one if you have it before reinstalling with my version.

The latest development snapshot is here: CONTRIB-1400. (second file)

These steps should get you started with trying it:

1. Go to Site Admin > Modules > Attforblock
2. Delete it
3. Replace mod/attforblock with my files.
4. Go to Site Admin > Notifications

The work is not finished, but you could probably use it as is if it's all you need.

Also, to add teachers, subjects etc. you have to click 'Add' not 'Update'.

"and can we have report with subject wise %? "
Good idea, I'll put that on my TODO list. (but will probably come last)

"and can we have email facility to send the report to respective parents email id, which will be added and linked at the time of creating sessions."
What do you mean with "added and linked at the time of creating sessions"?

In reply to Barry Oosthuizen

Re: Modifications - extra fields

by Marty Watson -
Barry,
This is exactly what we've been needing. Is it ready for a production server yet?
In reply to Marty Watson

Re: Modifications - extra fields

by Barry Oosthuizen -
Hi Marty,

My version is now geared towards barcode scanning (but can be used manually as well) , so some of the features might be slightly annoying for those who don't need/want them.

I have used it on a production server since early September '09 with no major problems. We've only tested it with site admin access though.

I'm happy to say that backup, restore, and upgrade have been implemented successfully as well. There are still a few loose ends to tie up, when it's ready for beta testing I'll post here again. In the mean time you can follow the development progress here.

Cheers,

Barry