I am currently attempting to customize the Emergency Data summary found under People → Students. I want to add the Year Group and Form Group of each student to the table. To do this i am directly editing the php file report_student_emergencySummary.php found in /modules/Students.
I have figured out how to edit existing columns and add new ones. However, I have been unable to find out how to access the students Form Group and Year Group, because as far as I can tell that information is not present in the $student table created in the file.
I have attempted to join this table with the gibbonStudentEnrolment table where this info is present but have been unsuccessful as I am not well versed in php and unfamiliar with the joining process and the Gateways that are used to access the data.
I will attach my current modifications and hope that someone can explain to me how I can integrate data from other tables for future report modifications as well
Hi @JadenD
Thank you for sharing the question. In order to access and add the Year Group and Form Group to each student, you need to update the queryStudentDetails function in src → Domain→ Students → StudentReportGateway.
Here is how you can update the code to retrieve the Form Group and Year Group:
public function queryStudentDetails(QueryCriteria $criteria, $gibbonPersonID)
{ ->cols(['gibbonPerson.*', 'gibbonPersonMedical.', …, 'gibbonPerson.gibbonPersonID', 'gibbonYearGroup.nameShort AS yearGroup', 'gibbonFormGroup.nameShort AS formGroup']) ->leftJoin('gibbonPersonMedical', 'gibbonPersonMedical.gibbonPersonID=gibbonPerson.gibbonPersonID')->leftJoin('gibbonStudentEnrolment', 'gibbonPerson.gibbonPersonID=gibbonStudentEnrolment.gibbonPersonID')->leftJoin('gibbonYearGroup', 'gibbonStudentEnrolment.gibbonYearGroupID=gibbonYearGroup.gibbonYearGroupID')->leftJoin('gibbonFormGroup', 'gibbonStudentEnrolment.gibbonFormGroupID=gibbonFormGroup.gibbonFormGroupID') … }
The result will contain the Form Group and Year Group of each student. You can access it in the report_student_emergencySummary.php such and display them such as
*$output .= ' ('.$student['formGroup'].')'; $output .= ' ('.$student['yearGroup'].')';
*
I hope that helps. Thanks!
Hi @JadenD glad to hear that worked. I started writing a reply with some notes to keep in mind, and ended up turning it into a new page on the docs, so be sure to check this out so you don’t lose any of your changes next time you update Gibbon: Core Development | Gibbon Documentation