3
* © Copyright 2006, 2007, 2008, 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 License as published by
9
* the Free Software Foundation; either version 3 of the License, 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 License for more details.
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/>.
21
* @author Ally Shaban <allyshaban5@yahoo.com>
26
* iHRIS_Person class for the person form.
29
* @subpackage ihris-train
31
class IHS_PageFormLecturer extends I2CE_PageForm {
33
protected function loadObjects() {
34
$factory = I2CE_FormFactory::instance();
38
if($this->post["submit_type"]=="confirm")
40
$lecturer=$factory->createContainer("lecturer");
41
$this->applyLimits($lecturer);
42
$lecturer->load($this->post);
43
$this->setObject($lecturer);
45
else if($this->post["submit_type"]=="save")
47
$this->setObject($lecturer,I2CE_PageForm::EDIT_PRIMARY);
49
$this->userMessage("Lecturer Added Successfully!!!");
50
$this->setRedirect("add_lecturer");
57
$lecturer=$factory->createContainer($id);
58
$this->applyLimits($lecturer);
59
$lecturer->populate();
60
$this->setObject( $lecturer);
65
protected function applyLimits($lecturer)
67
$username=$this->getUser()->username;
69
"operator"=>"FIELD_LIMIT",
70
"field"=>"identification_number",
72
"data"=>array("value"=>$username)
74
$insts=I2CE_FormStorage::listFields("lecturer",array("institution"),false,$where_users);
75
foreach ($insts as $inst)
76
$inst_id=$inst["institution"];
78
$where=array( "operator"=>"FIELD_LIMIT",
79
"fields"=>"institution",
81
"data"=>array("value"=>$inst_id)
83
$dep_field=$lecturer->getField("department");
84
$dep_field->setOption(array("meta","limits","default","department"),$where);
86
$where=array( "operator"=>"OR",
87
"operand"=>array(0=>array( "operator"=>"FIELD_LIMIT",
90
"data"=>array("value"=>"role|lecturer")
92
1=>array( "operator"=>"FIELD_LIMIT",
95
"data"=>array("value"=>"role|hod")
97
2=>array( "operator"=>"FIELD_LIMIT",
100
"data"=>array("value"=>"role|principal")
104
$role_field=$lecturer->getField("role");
105
$role_field->setOption(array("meta","limits","default","role"),$where);
b'\\ No newline at end of file'