$_REQUEST['parent'],
'address' => issetVal( $_REQUEST['address'], array() ),
'contact' => issetVal( $_REQUEST['contact'], array() ),
'student' => issetVal( $_REQUEST['student'], array() ),
);
if ( RegistrationFormConfigSave( $values ) )
{
$note[] = button( 'check' ) . ' ' . _( 'The Registration form was saved.' );
}
// Delete modfunc, values & redirect URL.
RedirectURL( array( 'modfunc', 'parent', 'address', 'contact', 'student' ) );
}
if ( $_REQUEST['modfunc'] === 'preview' )
{
// Back header.
DrawHeader( RegistrationAdminPreviewHeader() );
DrawHeader( RegistrationIntroHeader() );
echo '
';
echo PopTable( 'header', _( 'Registration' ) );
$config = RegistrationFormConfig();
RegistrationFormOutput( $config );
echo PopTable( 'footer' );
}
if ( ! $_REQUEST['modfunc'] )
{
echo ErrorMessage( $note, 'note' );
echo ErrorMessage( $error );
echo '
';
}
}
else
{
if ( $_REQUEST['modfunc'] === 'save' )
{
require_once 'modules/Custom/includes/RegistrationSave.fnc.php';
// Add eventual Dates to $_REQUEST['parent'].
AddRequestedDates( 'parent' );
// Add eventual Dates to $_REQUEST['address'].
AddRequestedDates( 'address' );
// Add eventual Dates to $_REQUEST['contact'].
AddRequestedDates( 'contact' );
// Add eventual Dates to $_REQUEST['students'].
AddRequestedDates( 'students' );
$values = array(
'parent' => issetVal( $_REQUEST['parent'], array() ),
'address' => issetVal( $_REQUEST['address'], array() ),
'contact' => issetVal( $_REQUEST['contact'], array() ),
'student' => issetVal( $_REQUEST['students'], array() ),
);
$config = RegistrationFormConfig();
if ( ! empty( $_REQUEST['sibling_use_contacts_address'] )
&& ! empty( $_REQUEST['sibling_id'] ) )
{
$save_ok = RegistrationSaveSibling( $config, $values, $_REQUEST['sibling_id'] );
}
else
{
$save_ok = RegistrationSave( $config, $values );
}
if ( $save_ok )
{
// @todo Move to ProgramFunctions/SendNotification.fnc.php.
// Send New Registration email to Notify.
if ( filter_var( $RosarioNotifyAddress, FILTER_VALIDATE_EMAIL ) )
{
require_once 'ProgramFunctions/SendEmail.fnc.php';
$student_name = DBGetOne( "SELECT " . DisplayNameSQL() . " AS FULL_NAME
FROM STUDENTS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
$message = sprintf(
_( 'New Registration %s (%d) has been registered by %s.' ),
$student_name,
UserStudentID(),
User( 'NAME' )
);
SendEmail( $RosarioNotifyAddress, _( 'New Registration' ), $message );
}
}
// Delete modfunc, values & redirect URL.
RedirectURL( array( 'modfunc', 'parent', 'address', 'contact', 'student' ) );
}
$registration_done = DBGetOne( "SELECT 1
FROM STUDENTS_JOIN_ADDRESS
WHERE STUDENT_ID='" . UserStudentID() . "'" );
// Registration check.
if ( $registration_done )
{
$note[] = button( 'check' ) . ' ' .
( User( 'STAFF_ID' ) ?
_( 'Your child has been registered.' ) :
_( 'Your parents have been registered.' ) );
echo ErrorMessage( $note, 'note' );
}
if ( ! $_REQUEST['modfunc']
&& ! $registration_done )
{
$_ROSARIO['allow_edit'] = true;
echo ErrorMessage( $error );
echo '';
}
}