Add new Options in classes

Hi, i’d like to know how to add class hours duration within the clases section. Thanks

Well i managed to do something, i created manually a table in the database and then i created a new column within the table ClassData. The next thing i did is try to show that new data in a table so i basically did this

$courseGateway = $container->get(CourseGateway::class);

$criteria = $courseGateway->newQueryCriteria(true)
    ->searchBy($courseGateway->getSearchableColumns(), $search)
    ->sortBy(['gibbonCourse.nameShort', 'gibbonCourse.name',])
    ->fromPOST();

$classes = $courseGateway->selectClassesDataByCourseID($course[‘gibbonCourseID’], $filter);
$fill_classes_array = $classes->fetchAll();

and this $fill_classes_array shows this in the module:

The real challenge is how on earth can i add my new ClassData column into the $fill_classes_array array?

Don’t know if my approach is correct and how can i solve this.

Hi Ivan, you’ve been really inventive here…but hacking the core like this means that your changes will get overwritten next time you upgrade Gibbon. You could contribute your changes back to the project, but in this case there is a non-programming solution. If you head to Admin > System Admin > Custom Fields, you’ll see that you can add such fields to different parts of the system, including Course and Class. Let us know how you get on with this! Ross

hahaha, yes! I did it the hard way i guess. I see no documentation so i did try it myself. Is there any documentation i can follow from now on?

Sadly does are not our strong point! Still waiting for that saintly volunteer who takes that bull by the horns. What we do have is available at https://docs.gibbonedu.org/. Cheers!

Finally i had no other choice than keeping un with all those customization, we inherited the code with all this creativity among the code, it tales longer to correct them all.

I managed to add that value to the array i mentioned above as shown in the image attached.

However im having problems converting that id to the value. so instead of that 000000003 i want to show the value linked (1.5 Hours)

I daresay i need something like this

$dataAlert = array(‘gibbonAlertLevelID’ => $gibbonAlertLevelID);
$sqlAlert = ‘SELECT * FROM gibbonAlertLevel WHERE gibbonAlertLevelID=:gibbonAlertLevelID’;
$resultAlert = $connection2->prepare($sqlAlert);
$resultAlert->execute($dataAlert);

right? Anytime i try to compose a query like this the site breaks

Hmm, your SQL looks good at first glance. You could wrap that in a try {} catch(Exception $e) { echo $e->getMessage(); } to catch any exceptions and output them, to see where the error might be. Otherwise, if the site breaks, be sure to check the PHP error logs to narrow down the cause.