3
* © Copyright 2009 IntraHealth International, Inc.
5
* This File is part of I2CE
7
* I2CE is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public Registration as published by
9
* the Free Software Foundation; either version 3 of the Registration, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public Registration for more details.
17
* You should have received a copy of the GNU General Public Registration
18
* along with this program. If not, see <http://www.gnu.org/registrations/>.
21
* @author Luke Duncan <lduncan@intrahealth.org>
27
* Class iHRIS_Module_FacilityRegistration
33
class iHRIS_Module_FacilityRegistration extends I2CE_Module {
35
public static function getMethods() {
37
'iHRIS_PageViewPrivateFacility->action_facility_registration' => 'action_facility_registration'
42
* Return the array of hooks available in this module.
45
public static function getHooks() {
47
'validate_form_facility_registration' => 'validate_form_facility_registration'
52
public function action_facility_registration( $page ) {
53
if ( !$page instanceof iHRIS_PageViewPrivateFacility ) {
56
$facility = $page->getFacility();
58
$success = $page->addChildForms( 'facility_registration' );
59
$template = $page->getTemplate();
60
if( !$page->hasChildForm( "facility_registration" ) ) {
61
$template->appendFileById( "view_privatefacility_registration_link.html", "span", "registration_links" );
67
* Validate any extra information other than required fields
69
* @param I2CE_Form $form
71
public function validate_form_facility_registration( $form ) {
72
if ( $form->registration_date->before( $form->application_date ) ) {
73
$form->getField( "registration_date" )->setInvalid( "The registration date must be after the application date." );
83
# c-default-style: "bsd"
84
# indent-tabs-mode: nil