~oh-dev/openhealth/phit-tools

« back to all changes in this revision

Viewing changes to ihris-suite/lib/common/modules/Person/lib/iHRIS_PageFormPerson.php

  • Committer: litlfred at ibiblio
  • Date: 2009-10-26 13:55:16 UTC
  • Revision ID: litlfred@ibiblio.org-20091026135516-7er0260tad01febt
ihris suite updated to 4.0.1 pre-release...
follows that did not get added on the last attempt did this time... the problem is that bzr does not like to include branches in a sub-directory even if you add them in which 
  is how ihris-suite/lib/* was structed.  so i had to move ihris-suite/lib/*/.bzr to ihris-suite/lib/*/.bzr_dir to trick it
the site will now succesfully install.  have not attempted change the root drive letter yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
* © Copyright 2007 IntraHealth International, Inc.
 
4
 
5
* This File is part of I2CE 
 
6
 
7
* I2CE is free software; you can redistribute it and/or modify 
 
8
* it under the terms of the GNU General Public License as published by 
 
9
* the Free Software Foundation; either version 3 of the License, or
 
10
* (at your option) any later version.
 
11
 
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 License for more details.
 
16
 
17
* You should have received a copy of the GNU General Public License 
 
18
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
*/
 
20
/**
 
21
*  iHRIS_PageFormPerson
 
22
* @package I2CE
 
23
* @subpackage Core
 
24
* @author Carl Leitner <litlfred@ibiblio.org>
 
25
* @copyright Copyright &copy; 2007 IntraHealth International, Inc. 
 
26
* This file is part of I2CE. I2CE is free software; you can redistribute it and/or modify it under 
 
27
* the terms of the GNU General Public License as published by the Free Software Foundation; either 
 
28
* version 3 of the License, or (at your option) any later version. I2CE is distributed in the hope 
 
29
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 
30
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 
 
31
* received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
 
32
* @version 2.1
 
33
* @access public
 
34
*/
 
35
 
 
36
 
 
37
class iHRIS_PageFormPerson extends I2CE_PageForm{
 
38
 
 
39
 
 
40
 
 
41
    /**
 
42
     * Create and load data for the objects used for this form.
 
43
     * 
 
44
     * Create the list object and if this is a form submission load
 
45
     * the data from the form data.
 
46
     */
 
47
    protected function loadObjects() {
 
48
        $factory = I2CE_FormFactory::instance();
 
49
        if ($this->isPost()) {
 
50
            $person = $factory->createForm('person');
 
51
            if (!$person instanceof iHRIS_Person) {
 
52
                I2CE::raiseError("Could not create person form");
 
53
                return;
 
54
            }
 
55
            $person->load($this->post);
 
56
            $surname_ignore = $person->getField('surname_ignore');
 
57
            $ignore_path = array('forms','person',$person->getID(),'ignore','surname');
 
58
            if ($surname_ignore instanceof I2CE_FormField && $this->post_exists($ignore_path)) {
 
59
                $surname_ignore->setFromPost($this->post($ignore_path));
 
60
            }
 
61
        } else {
 
62
            if ($this->get_exists('id')) {
 
63
                $id = $this->get('id');
 
64
                if (strpos($id,'|')=== false) {
 
65
                    I2CE::raiseError("Depcreated use of id variable");
 
66
                    $id = 'person|' . $id;
 
67
                }
 
68
            } else {
 
69
                $id = 'person|0';
 
70
            }
 
71
            $person = $factory->createForm($id);
 
72
            if (!$person instanceof iHRIS_Person) {
 
73
                I2CE::raiseError("Could not create valid person form from id:$id");
 
74
                return;
 
75
            }
 
76
            $person->populate();
 
77
        }
 
78
        $this->setObject( $person);
 
79
    }
 
80
 
 
81
    /**
 
82
     * Save the objects to the database.
 
83
     * 
 
84
     * Save the default object being edited and return to the view page.
 
85
     * @global array
 
86
     */
 
87
    protected function save() {
 
88
        parent::save();
 
89
        $this->setRedirect(  "view?id=" . $this->getPrimary()->getFormId() );
 
90
    }
 
91
 
 
92
}
 
93
# Local Variables:
 
94
# mode: php
 
95
# c-default-style: "bsd"
 
96
# indent-tabs-mode: nil
 
97
# c-basic-offset: 4
 
98
# End: