0

Hello,

I have a file (01.php)

<?php
abstract class Sender
{
    const E_NEW_APPOINTMENT       = 1;  

    /**
     * Send instant confirmation/notification emails.
     *
     * @param int $type  (E_NEW_APPOINTMENT)
     * @param CustomerAppointment $ca
     */
    public static function sendEmails( $type, CustomerAppointment $ca )
    {
        list ( $codes, $staff, $appointment, $customer ) = self::_prepareData( $ca );

        switch ( $type ) {
            case self::E_NEW_APPOINTMENT:
                $to_client = new Notification();
                $to_client->loadBy( array( 'slug' => 'client_info' ) );

                $to_staff = new Notification();
                $to_staff->loadBy( array( 'slug' => 'provider_info' ) );

                $confirmed_appointment= $codes->set( 'confirmed', $ca->get( 'confirmed' ) );

                if ( $to_staff->get( 'active' ) AND $ca->get( 'confirmed' )==1 ) {
                    // Send email notification to staff member (and admins if necessary).
                    self::_send( $to_staff, $codes, $staff->get( 'email' ) );
                }
                break;

        }
    }
}
?>

And another file (02.php)

<?php
require "http://abc.com/01.php";
sendEmails(E_NEW_APPOINTMENT, $ca);
?>

In this case, how can I call the "public static function sendEmails" in file 01.php ?

Thank you.

2
Contributors
9
Replies
32
Views
2 Years
Discussion Span
Last Post by pritaeas
0
require '01.php'; // domain includes might not always work
Sender::sendEmails(E_NEW_APPOINTMENT, $ca);

Edited by pritaeas

0

Thank you, but my owne files don't stay in the same folder, so it perhaps works without included domain http?

0

Thank you, but I have just tried the above code but it cannot perform and call the function in file 01.php.

0

The

Sender::sendEmails(E_NEW_APPOINTMENT, $ca);

is not correct. The code is dead here and the function sendEmails doesn't work.

0
Sender::sendEmails(Sender::E_NEW_APPOINTMENT, $ca);

Perhaps because $ca is null, don't you need to initialize it?

Edited by pritaeas

0

Perhaps because $ca is null, don't you need to initialize it?
It is necessary because without it, the function sendEmails couldn't understand with which objet it will work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.