Skip to content
Newer
Older
100755 158 lines (120 sloc) 4.56 KB
74db667 @denis-larka init
denis-larka authored
1 <?php
2 /**
3 * DataObject For Involvement Entity of OpenEvSys.
4 *
5 * This file is part of OpenEvsys.
6 *
7 * Copyright (C) 2009 Human Rights Information and Documentation Systems,
8 * HURIDOCS), http://www.huridocs.org/, info@huridocs.org
9 *
10 * OpenEvsys is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * OpenEvsys is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
19 *
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 *
23
24 * @author Nilushan Silva <nilushan@respere.com>
25 *
26 * @package OpenEvsys
27 * @subpackage DataModel
28 *
29 */
30
31 //require_once ( APPROOT . 'data/DataObject.php' );
32
33 class Involvement extends DomainEntity{
34
35
36 public $involvement_record_number;
37 public $act;
38 public $perpetrator;
39 public $event;
40 public $confidentiality;
41 public $degree_of_involvement;
42 public $latest_status_as_perpetrator_in_the_act;
43 public $remarks;
44
45 public $Management;
46
47 //Management
48
49 public $date_received;
50 public $date_of_entry;
51 public $entered_by ;
52 public $project_title;
53 public $comments ;
54 public $record_grouping;
55 public $date_updated ;
56 public $updated_by ;
57 public $monitoring_status;
58
59 protected $mt = array('type_of_perpetrator' );
60
61
62 protected $managementFields = array( 'date_received', 'date_of_entry',
63 'entered_by' , 'project_title', 'comments', 'record_grouping',
64 'date_updated' , 'updated_by' , 'monitoring_status');
65
66 protected $supporting_doc = true;
67
68
69 private $pkey = array('involvement_record_number');
70
71 public function __construct($table = false, $pkeyarr=false, $db=false, $options=array()){
72 parent::__construct('involvement', $pkey ,$db , $options);
73
74
75 }
76 /*
77 public function SaveAll(){
78 $saveType = $this->getSaveType() ;
79
80 $this->Save();
81 $this->SaveManagementData();
82 foreach($this->mt as $mtField){
83 if(sizeof( $this->$mtField) > 0 ){
84 MtFieldWrapper::setMTTermsforEntity( $mtField , 'involvement' , $this->involvement_record_number, $this->$mtField);
85
86
87 }
88 }
89
90 $this->saveClarifyingNotes();
91 Log::saveLogDetails($this->_table , $this->involvement_record_number , $saveType );
92
93
94 }
95
96 public function LoadfromRecordNumber($involvement_record_number){
97 $this->Load("involvement_record_number='$involvement_record_number'");
98 $this->LoadManagementData();
99 }
100
101 public function LoadRelationships(){
102 foreach($this->mt as $mtField){
103 MtFieldWrapper::getMTTermsforEntity($mtField,'involvement',$this,$this->involvement_record_number);
104 }
105 }
106
107 public function getAll(){
108 $entities = $this->Find('');
109 return $entities;
110 }
111
112 public function LoadManagementData(){
113 $this->Management = new Management();
114 $ok = $this->Management->LoadfromEntityId($this->_table, $this->involvement_record_number);
115
116 foreach($this->managementFields as $mngField){
117 $this->$mngField = $this->Management->$mngField;
118 }
119
120
121
122 }
123 private function SetManagementData(){
124 if($this->Management == null){
125 $this->Management = new Management();
126 }
127 $this->Management->entity_type=$this->_table;
128 $this->Management->entity_id=$this->involvement_record_number;
129 foreach($this->managementFields as $mngField){
130 $this->Management->$mngField = $this->$mngField ;
131 }
132 }
133
134 public function SaveManagementData(){
135
136 $this->SetManagementData();
137 $this->Management->Save();
138 }
139
140 private function saveClarifyingNotes(){
141 ClariNotes::deleteExistingNotes($this->_table , $this->involvement_record_number);
142
143 foreach($this->clari_notes as $clari_note){
144 $clari_note->Save();
145 }
146
147 }
148
149 protected function getSaveType(){
150 if($this->_saved)
151 return 'update';
152 else
153 return 'save';
154 }
155 */
156 }
157 ?>
Something went wrong with that request. Please try again.