House Points (by roll group/class)

Hi Ross & Sandra,

There are situations where a group can be rewarded by house points but to do so, points have to be entered on a student by student basis. Inconvenient for the member of staff, but a potential time-waster over a lengthy period of application.

Is there a possibility of adding a function for awarding house points by roll group/class, or changing the student selection combo box to a list box for multiple selections?

Regards,

Andy Richards.

Hi Andy,

This module is maintained by @andystat, who may be interested in adding this feature, or who may be able to work with you to allow you to add the feature.

Good luck!

Ross

Hey @sandra @andystat,

Would this be possible?

Thanks,

Okay, so I’ve managed to add this. @sandra @ross @andystat @stdavsurfer18

Gibbbon House Point Module Modification to allow MultiStudentSelection

  • Modified composer.json in root to include :
    "autoload": {
    "psr-4": { 
        "Gibbon\\": ["src/", "src/Gibbon"],
        "Gibbon\\Module\\HousePoints\\": ["modules/HousePoints/src/"]
    }
}
  • Modified studentPointsProcess.php to include:
use Gibbon\Module\HousePoints\Domain\HousePointStudentGateway;

require_once '../../gibbon.php';

if (!$session->has('gibbonPersonID') || !$session->has('gibbonRoleIDPrimary') || !isActionAccessible($guid, $connection2, '/modules/House Points/award.php')) {
    die(__('Your request failed because you do not have access to this action.'));
} else {
    $URL = $session->get('absoluteURL') . '/index.php?q=/modules/' . $session->get('module') . '/award.php';

    //'gibbonPersonIDMulti' is the name attribute for the student select input
    $studentIDs = $_POST['gibbonPersonIDMulti'] ?? null;
    $categoryID = $_POST['categoryID'] ?? null;
    $points = $_POST['points'] ?? null;
    $reason = $_POST['reason'] ?? null;
    $yearID = $_POST['yearID'] ?? null;
    $teacherID = $_POST['teacherID'] ?? null;

    if ($studentIDs != null && is_array($studentIDs)) {
        foreach ($studentIDs as $studentID) {
            $data = [
                'studentID' => $studentID,
                'categoryID' => $categoryID,
                'points' => $points,
                'reason' => $reason,
                'yearID' => $yearID,
                'awardedDate' => date('Y-m-d'),
                'awardedBy' => $teacherID
            ];

            $housePointStudentGateway = $container->get(HousePointStudentGateway::class);
            $housePointStudentID = $housePointStudentGateway->insert($data);

            if ($housePointStudentID === false) {
                $URL .= '&return=error2';
                header("Location: {$URL}");
                exit;
            }
        }

        // Success for all students
        $URL .= '&return=success0';
        header("Location: {$URL}");
        exit;

    } else {
        $URL .= '&return=error1';
        header("Location: {$URL}");
        exit;
    }
}
  • Modified award.php to include:
$row->addLabel('gibbonPersonIDMulti', __('Students'));
        $row->addSelectStudent('gibbonPersonIDMulti', $session->get('gibbonSchoolYearID'), array('byName' => true, 'byForm' => true))->selectMultiple()->required();

Hi everyone,

There was a bit of a delay in responding to this post; it was half-term and we are in a mock exam session.

Andy was busy when we spoke but created a function to add points for students selected from multiple classes. Two issues were never resolved, but they didn’t interfere with the operation of the module.

The first issue is the pre-fill option that doesn’t link to my existing list of point values. The points have to be entered manually into the pre-fill selector box.

The second issue, probably the most important, is updating the module, which doesn’t work. You have to remove the old one and install the new version. You should save your SQL tables before installing the module, but I did find that the new module read the points already in the system.

If you contact Andy, he should be able to share the new version with you, and you can maybe look at solving the two issues I have mentioned.


I wasn’t able to find @andystat email, are you able to send it me?

Andy Statham andy@rapid36.com

Regards,
Andy Richards, BWIC.

1 Like

Hi sorry to jump on an old post, I have tried emailing Andy but no responce.

It would be good if the house points system had a drop-down to select form group and then multiple students from that class, and for the student dropdown to be a search box instead.

Did you manage to get yours working like the screenshots above? would you be able to share your code please

Thanks

Hi @tmike, it sounds like, based on this other post, that there may have already been some changes made to this effect. If I were to receive a copy of those changes, I’m happy to merge them into the public version and release that so everyone can use the same features.