code/pagetypes/MetadataPostcardEntryPage.php
/**
     * Checks if hidden fields exist on the form which contain information to email a project co-ordinator.
     * If so then it gets the coordinator subject and body, parses special variables and then sends the email.
     *
     * @param Array $data the posted form data.
     */
Checks if hidden fields exist on the form which contain information to email a project co-ordinator.
If so then it gets the coordinator subject and body, parses special variables and then sends the email.

@param Array $data the posted form data.
Checks if hidden fields exist on the form which contain information to email a project co - ordinator . If so then it gets the coordinator subject and body parses special variables and then sends the email . @param Array $data the posted form data .
protected function EmailCoordinator($data)
    {
        $projectCode = !empty($data['_Project_Code']) ? $data['_Project_Code'] : '';
        $projectCoordinator = !empty($data['_Project_Coordinator']) ? $data['_Project_Coordinator'] : '';
        $projectCoordinatorEmail = !empty($data['_Project_Coordinator_email']) ? $data['_Project_Coordinator_email'] : '';
        $projectManager = !empty($data['_Project_Manager']) ? $data['_Project_Manager'] : '';
        if ($projectCode && $projectCoordinator && $projectCoordinatorEmail && $projectManager) {
            $subject = str_replace('{PROJECT_CODE}', $projectCode, $this->CoordinatorEmailSubject);
            $body = str_replace(
                    array('{PROJECT_CODE}', '{PROJECT_COORDINATOR}', '{PROJECT_MANAGER}'),
                    array($projectCode, $projectCoordinator, $projectManager),
                    $this->CoordinatorEmailBody
            );
            $email = new Email(
                $this->FromEmailAddress,
                $projectCoordinatorEmail,
                $subject,
                $body
            );
            $email->sendPlain();
        }
    }
protected function EmailCoordinator ( $ data ) { $ projectCode = ! empty ( $ data [ '_Project_Code' ] ) ? $ data [ '_Project_Code' ] : '' ; $ projectCoordinator = ! empty ( $ data [ '_Project_Coordinator' ] ) ? $ data [ '_Project_Coordinator' ] : '' ; $ projectCoordinatorEmail = ! empty ( $ data [ '_Project_Coordinator_email' ] ) ? $ data [ '_Project_Coordinator_email' ] : '' ; $ projectManager = ! empty ( $ data [ '_Project_Manager' ] ) ? $ data [ '_Project_Manager' ] : '' ; if ( $ projectCode && $ projectCoordinator && $ projectCoordinatorEmail && $ projectManager ) { $ subject = str_replace ( '{PROJECT_CODE}' , $ projectCode , $ this -> CoordinatorEmailSubject ) ; $ body = str_replace ( array ( '{PROJECT_CODE}' , '{PROJECT_COORDINATOR}' , '{PROJECT_MANAGER}' ) , array ( $ projectCode , $ projectCoordinator , $ projectManager ) , $ this -> CoordinatorEmailBody ) ; $ email = new Email ( $ this -> FromEmailAddress , $ projectCoordinatorEmail , $ subject , $ body ) ; $ email -> sendPlain ( ) ; } }
Checks if hidden fields exist on the form which contain information to email a project co-ordinator.
Checks if hidden fields exist on the form which contain information to email a project co - ordinator .
// Ensure have all these parameters, if not then we cannot send an email. This if fine as some organisations may not want to do this. // Parse special variables in the email subject and body. // Send the email. // Just send plain email, no need for a fancy template.