Cron Jobs

Dear Admins,

             I want to send weekly summary of 1-Attendance 2-Behavior 3-Mark book through Email to the Parents. How I can achieve this through cron jobs or any other mean.

Best Regards,

Dear Ghulam,

Please take a look at the CLI script /cli/planner_parentWeeklyEmailSummary.php. This covers Planner, Behaviour and Markbook, but not not attendance.

I run crontab -e on my Ubuntu Linux servers, and this lets me schedule when to run these scripts. For more details on the other scripts included in Gibbon, and cron, check out:

https://docs.gibbonedu.org/administrators/misc/command-line-tools/

See how you get on with this, and then perhaps we can look at adding attendance into it in v19.

Thanks,

Ross

Hi @ross and @sandra

Was attendance incorporated into planner_parentWeeklyEmailSummary.php? I checked the Command Line Tools page but didn’t see it.

Would it be possible to have a separate script specifically for attendance notifications—particularly for daily student absence notices sent to parents?

For example, a notification might look like this:

Unexcused Absences – [Today’s Date]

This email is regarding [Student’s Name].

Our records indicate that your student was absent for one or more class periods today…

Looking forward to your thoughts.

Thanks!

1 Like

I have found the attendance scripts in /cli:
attendance_dailyIncompleteEmail.php
attendance_dailyIncompleteEmail_byClass.php
attendance_weeklySummaryEmail.php

I am getting errors with attendance_weeklySummaryEmail.php.

[master_~]:cli$ php attendance_weeklySummaryEmail.php
PHP Fatal error:  Uncaught TypeError: array_column(): Argument #1 ($array) must be of type array, null given in /~/modules/Attendance/src/AttendanceView.php:83
Stack trace:
#0 /~/modules/Attendance/src/AttendanceView.php(83): array_column()
#1 /~/cli/attendance_weeklySummaryEmail.php(41): Gibbon\Module\Attendance\AttendanceView->__construct()
#2 {main}
  thrown in /~/modules/Attendance/src/AttendanceView.php on line 83

<!DOCTYPE html>
<html lang="">
    <head>
        <title></title>

        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <meta http-equiv="content-language" content="{{ locale }}"/>
        <meta name="author" content="Ross Parker, International College Hong Kong"/>
        <meta name="robots" content="noindex"/>
        <meta name="Referrer‐Policy" value="no‐referrer | same‐origin"/>
        <link rel="shortcut icon" type="image/x-icon" href="./favicon.ico"/>

        <link rel="stylesheet" href="./themes/Default/css/main.css" type="text/css" media="all">
        <link rel="stylesheet" href="./resources/assets/css/core.min.css" type="text/css" media="all">
        <link rel="stylesheet" href="./resources/assets/css/theme.min.css" type="text/css" media="all">
    </head>

    <body class="h-screen flex flex-col font-sans body-gradient-purple m-0 p-0" style="background: linear-gradient(to left top, #402568 2%, #935ee1 65%, #a871ec) no-repeat fixed;">

        <div class="px-4 sm:px-6 lg:px-12 pb-24">
            <div id="header" class="relative flex justify-between items-center">

                <a id="header-logo" class="block my-4 max-w-xs sm:max-w-full leading-none" href="http://.">
                    <img class="block max-w-full h-20 mt-4 mb-4" alt="DEMO Logo" src="./themes/Default/img/logo.png" style="max-height:100px;">
                </a>

                <div class="flex-grow flex items-center justify-end text-right text-sm text-purple-200">
                </div>
            </div>
        </div>

        <div id="wrapOuter" class="flex-1 pt-24 bg-transparent-100">
            <div id="wrap" class="px-0 sm:px-6 lg:px-12 -mt-48">
                <div id="content-wrap" class="relative w-full min-h-1/2 flex content-start flex-coll lg:flex-row clearfix">

                    <div id="content" class="max-w-full w-full shadow bg-white sm:rounded px-8 pt-2 pb-6">
                        <h1>
                            Oh no!<br/>
                        </h1>
                        <p>
                            Something has gone wrong: the Gibbons have escaped!<br/>
                            <br/>
                            An error has occurred. This could mean a number of different things, but generally indicates that you have a misspelt address, or are trying to access a page that you are not permitted to access. If you cannot solve this problem by retyping the address, or through other means, please contact your system administrator.<br/>
                        </p>
                        </body>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
[master_gfqkxmaadf]:cli$

Gibbon Version
v28.0.01

PHP Version
8.1.31

MySQL Version
10.6.20

Thanks

Also error with schoolAdmin_tutorDailyEmailSummary.php

[master_]:cli$ php schoolAdmin_tutorDailyEmailSummary.php
PHP Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, Gibbon\Database\Result given in /…/cli/schoolAdmin_tutorDailyEmailSummary.php:135
Stack trace:
#0 /…/cli/schoolAdmin_tutorDailyEmailSummary.php(135): array_filter()
#1 {main}
thrown in /…/cli/schoolAdmin_tutorDailyEmailSummary.php on line 135

++++++
And behaviour_dailySummaryEmail.php not sending emails after behavior record(s) added:
[master_]:cli$ php behaviour_dailySummaryEmail.php
Sent 0 notifications: 0 inserts, 0 updates, 0 emails sent, 0 emails failed.