Locking the Markbook

I’d like to have the ability to lock out edits to a particular term in the Markbook once a condition is met; that condition doesn’t matter so much because I would want it to be multiple things. Manually, when a report is run, and so on.

How could we go about locking down edits to a particular term in the markbook? I think it would be a good thing for a school administrator to have the ability to lock and unlock the ability for edits to be made to the markbook. A simple check box that says “Enable Term’s Markbook” or something to that effect would be stellar.

I’d like to be able to add settings to the school admin section that would prevent the creation of new markbook columns and editing of current markbook columns, specific to whatever terms I’ve created in the system.

Hi Nate, the general aim is that the Markbook enables teachers to use it much in the way that they could a paper markbook: it’s a living set of records in which they have access to change and update information as needed, without restrictions. For this reason, the Reports system has a separate method for recording grades and “solidifying” them into a more formal record. The reports have access controls and locking mechanisms, so that data cannot be changed after a certain time, and that certain users can retain access as needed. The idea being that the Markbook is a flexible active system that teachers enter their grades into, and the Reports are a formalized and restricted system for academic reporting.

For this reason, the core will likely never support locking markbook columns or restricting access. For your approach, if you are trying to create an automated system, it may be helpful to work on recording your values as Report grades rather than in the markbook. This will then give you many more options for creating report cards and PDFs from that data.

I like this idea. I currently have my module calculate our school specific grades by pulling from the markbook and filtering, weighting, etc… I then store them in a custom database table for storage. But this doesn’t lock those values and prevent them from being changed. The reports system uses the access criteria, which is exactly the kind of thing I want.

So, is it a simple database entry in to a reports table then? The reports module is huge, and wrapping my head around all the moving parts has been difficult given my time constraints. Is there a direction you could point me in to get started?
I really like this idea, because I feel like it really is the best of both worlds, combining the current system’s functionality with just a redirect from markbook to report.

Hi Nate, the reports can certainly be a bit daunting at first. The essential component is the Criteria setup, which is a flexible way to define pretty much any shape of data you’re looking to record (the criteria type) and for who (the scopes). For example, you could decide you want percentage marks recorded for all students in each course three times per year, so you setup three Reporting Cycles, then a Course scope, and add Percentage criteria for each of the classes. It’s highly flexible, so you can assign criteria separately for different courses, classes, year groups, etc.

Once you have the criteria, you’re writing to the gibbonReportingValue table. Have a look at the schema of the table. It looks like a lot of fields at first, but a lot of them are relational, which your script should be able to pick up on based on the student you’re working with (what class/year/etc they’re in). Then, you’re recording either a value or a comment, plus some timestamps. Once you’re able to start writing consistently to the gibbonReportingValue table from your script, the values would then be available in the interface to preview, proof, generate reports, etc.

Hope this helps!

So your description matches exactly what I found when testing. Thank you for taking the time to describe in such detail; it has been a massive help to me. I’ll report back when I have a working solution.

I do have one last quick question. Right now my module works as a template that gets triggered when a report with that particular template item is added to the report. How can I trigger my module by a button click? Something that just allows me to run the script and store the data with a click of a button?

Have you created a standalone module using something like the Gibbon Starter Module? If so, you shouldn’t necessarily need to hook into the report templates themselves, you could create a page with a button, and a process page on submit, that runs whatever piece of code you’re looking for.

The documentation isn’t perfect, but this page might help you get started creating and submitting a form: https://docs.gibbonedu.org/code/gibbon/forms/form/ and use the process page example in the starter module.

My module is customized from a template sent to me from Ross. It’s a Reports Template.

Hi Nate, sounds like you have a module setup, which is good. It’s possible your module, since it’s used for report templates, just doesn’t have any actions associated with it. You can add actions to it. Check out the Starter Module to see what the action pages look like. Generally, for form to work, you would pair a page with a process page, using a form in your page much like the example here: https://docs.gibbonedu.org/code/gibbon/forms/form/ This gives you the basics of creating a submit button that then runs a piece of code.

So I’ve another question. Even if I was inputting into the reports side of things after calculation from the gradebook, I think I’d still run into the problem of teachers being able to change markbook grades after reports are run. Really and truly I think I need a way to lock out markbook changes; both by date and by manual override from a sys admin. Surely there must be a way?

My thinking is that, once grades are input into the reports, theoretically you wouldn’t run the same script to extract them from the markbook again, so even if the markbook changed, the reports would remain as a fixed record of a students marks at that time. While teachers may change the grades in the markbook, it wouldn’t change the report marks, so there would always be a record of the original mark, and professionally it doesn’t send the message “we don’t trust you, you’re locked out”. The markbook is then a teachers area to work on and record marks, and the reports are a fixed academic record. As always, you would be welcome to change your system to work in a different way, but locking the markbook is something the core of Gibbon is unlikely to support.

So, after speaking with our headmaster, locking the markbook is something that she’s much more comfortable with, and is the way our current system works. Is there somewhere I should be looking in order to implement this? I’ve tried looking up how to lock the mysql table, but that doesn’t appear to be an option.

Here’s an idea. Could I create a new table or table entry for classes, that marks whether or not a class has been locked? Then, when loading markbook, have the system check for that value and make fields uneditable if true?

Hi Qualitymix, it’s been a busy time of year and sadly I don’t have any quick answers. This would definitely require modifications to the core, so be sure you’re using a forked repository on GitHub so you can track the changes and merge new versions into your custom code.

It is, technically, safe to add new columns to an existing table and base your code off of that, as long as those columns never conflict with future column names (perhaps prefix them). So you could add a column to the gibbonMarkbookColumn table to indicate if it is locked, and then check that status at the beginning of the markbook edit/enter data pages. There are already different levels of permissions for the markbook, so you could check for the “Edit Markbook_everything” permission, which could allow users to lock and unlock columns, and then show a message to users if they do not have permission.

To make bulk changes to locked columns, I recommend the new Commands feature in the Query Builder module, which would let you write an SQL UPDATE command to change the locked status of columns based on something such as the date or column type.

Hope this helps get you up and running with your changes.