Reporting Term total from Markbook

Hello good people,
I was trying to create a "mark book by course" report replicating the idea from V22 which used to report internal assessment by course.

I have managed to fetch the value from the markbook as shown in the attached file. My target is to calculate the value of each markbook columns course wise and display the total mark as per the associated Term.
Where Term 1 will have course 1 and total mark ...and Term 2 will have the same

Please Help.
Thanks

Comments

  • Hi anteneh, looks like you're off to a great start. If you check out the MarkbookView class in the moudles/Markbook/src directory, this may help you with the term calculations you're looking for. You can see the MarkbookView in action on the Markbook page, however the code for that page is massive, so here's a snippet of how it's being used. In your script, you'd likely want to fetch your data, then loop over and process it using this class, and return the resulting array of data:
    
    // Build the markbook object for this class
    $markbook = new MarkbookView($gibbon, $pdo, $gibbonCourseClassID);
    
    // You don't necessarily need to use the below query, which is for a whole class. Just ensure your data has the same columns and names, and create a new DataSet() before passing it into the loadColumnsFromDataSet() method.
    $columns = $markbookGateway->queryMarkbookColumnsByClass($criteria, $gibbonCourseClassID);
    // Load the columns for the current page
    $markbook->loadColumnsFromDataSet($columns);
    
    // Cache all weighting data for efficient use below
    if ($markbook->getSetting('enableColumnWeighting') == 'Y') {
        $markbook->cacheWeightings( );
    }
    
    // Once the data is loaded into the $markbook object, you can get the calculated term and overall averages with methods like:
    
    $markbook->getTermAverage($rowStudents['gibbonPersonID'], $term['gibbonSchoolYearTermID']);
    
    $markbook->getCumulativeAverage($rowStudents['gibbonPersonID']);
    
    $markbook->getFormattedAverage($markbook->getFinalGradeAverage($rowStudents['gibbonPersonID']));
    anteneh
  • Hi Sadra,
    Thanks for the detailed explanation. But one quick question. Can I use the code logic you mentioned above as part of the data source for the report

    Regards,
  • Hi anteneh,

    Yes, you could use this in a new class that extends DataSource, and in the getData() method you could instantiate the MarkbookView object. Since this is a special use-case, you may need to use global $gibbon, $pdo; above that line to bring these into the class (a bit of a hack, but they're guaranteed to be instantiated at that point in the runtime). The gibbonCourseClassID is available in the incoming $ids array as $ids['gibbonCourseClassID'].

    Hope this helps!
    anteneh
Sign In or Register to comment.