|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* eGroupWare - Calendar - importexport |
|
4
|
|
|
* |
|
5
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License |
|
6
|
|
|
* @package calendar |
|
7
|
|
|
* @subpackage importexport |
|
8
|
|
|
* @link http://www.egroupware.org |
|
9
|
|
|
* @author Nathan Gray |
|
10
|
|
|
* @copyright Nathan Gray |
|
11
|
|
|
* @version $Id$ |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* class calendar_egw_record |
|
16
|
|
|
* compability layer for iface_egw_record needet for importexport |
|
17
|
|
|
*/ |
|
18
|
|
|
class calendar_egw_record implements importexport_iface_egw_record |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
private $identifier = ''; |
|
22
|
|
|
private $record = array(); |
|
23
|
|
|
private static $bo; |
|
24
|
|
|
|
|
25
|
|
|
public static $types = array( |
|
26
|
|
|
'select-cat' => array('category'), |
|
27
|
|
|
'select-account'=> array('owner','creator', 'modifier'), |
|
28
|
|
|
'date-time' => array('modified', 'created','start','end','recur_date'), |
|
29
|
|
|
'date' => array('recur_enddate'), |
|
30
|
|
|
'select-bool' => array('public', 'non_blocking'), |
|
31
|
|
|
'select' => array('priority'), |
|
32
|
|
|
); |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* constructor |
|
36
|
|
|
* reads record from backend if identifier is given. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $_identifier |
|
39
|
|
|
*/ |
|
40
|
|
|
public function __construct( $_identifier='' ){ |
|
41
|
|
|
$this->identifier = $_identifier; |
|
42
|
|
|
if(!is_object($this->bo)) { |
|
43
|
|
|
$this->bo = new calendar_bo(); |
|
44
|
|
|
} |
|
45
|
|
|
if($this->identifier) { |
|
46
|
|
|
$this->record = $this->bo->read($this->identifier); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* magic method to set attributes of record |
|
52
|
|
|
* |
|
53
|
|
|
* @param string $_attribute_name |
|
54
|
|
|
*/ |
|
55
|
|
|
public function __get($_attribute_name) { |
|
56
|
|
|
return $this->record[$_attribute_name]; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* magig method to set attributes of record |
|
61
|
|
|
* |
|
62
|
|
|
* @param string $_attribute_name |
|
63
|
|
|
* @param data $data |
|
64
|
|
|
*/ |
|
65
|
|
|
public function __set($_attribute_name, $data) { |
|
66
|
|
|
$this->record[$_attribute_name] = $data; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function __unset($_attribute_name) { |
|
70
|
|
|
unset($this->record[$_attribute_name]); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* converts this object to array. |
|
75
|
|
|
* @abstract We need such a function cause PHP5 |
|
76
|
|
|
* dosn't allow objects do define it's own casts :-( |
|
77
|
|
|
* once PHP can deal with object casts we will change to them! |
|
78
|
|
|
* |
|
79
|
|
|
* @return array complete record as associative array |
|
80
|
|
|
*/ |
|
81
|
|
|
public function get_record_array() { |
|
82
|
|
|
return $this->record; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* gets title of record |
|
87
|
|
|
* |
|
88
|
|
|
*@return string tiltle |
|
89
|
|
|
*/ |
|
90
|
|
|
public function get_title() { |
|
91
|
|
|
if (empty($this->record)) { |
|
92
|
|
|
$this->get_record(); |
|
|
|
|
|
|
93
|
|
|
} |
|
94
|
|
|
return $this->record['title']; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* sets complete record from associative array |
|
99
|
|
|
* |
|
100
|
|
|
* @todo add some checks |
|
101
|
|
|
* @return void |
|
102
|
|
|
*/ |
|
103
|
|
|
public function set_record(array $_record){ |
|
104
|
|
|
$this->record = $_record; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* gets identifier of this record |
|
109
|
|
|
* |
|
110
|
|
|
* @return string identifier of current record |
|
111
|
|
|
*/ |
|
112
|
|
|
public function get_identifier() { |
|
113
|
|
|
return $this->identifier; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Gets the URL icon representitive of the record |
|
118
|
|
|
* This could be as general as the application icon, or as specific as a contact photo |
|
119
|
|
|
* |
|
120
|
|
|
* @return string Full URL of an icon, or appname/icon_name |
|
121
|
|
|
*/ |
|
122
|
|
|
public function get_icon() { |
|
123
|
|
|
return 'calendar/navbar'; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* saves record into backend |
|
128
|
|
|
* |
|
129
|
|
|
* @return string identifier |
|
130
|
|
|
*/ |
|
131
|
|
|
public function save ( $_dst_identifier ) { |
|
132
|
|
|
// Not yet implemeted |
|
133
|
|
|
$this->identifier = $_dst_identifier; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* copys current record to record identified by $_dst_identifier |
|
138
|
|
|
* |
|
139
|
|
|
* @param string $_dst_identifier |
|
140
|
|
|
* @return string dst_identifier |
|
141
|
|
|
*/ |
|
142
|
|
|
public function copy ( $_dst_identifier ) { |
|
143
|
|
|
|
|
144
|
|
|
} |
|
145
|
|
|
|
|
146
|
|
|
/** |
|
147
|
|
|
* moves current record to record identified by $_dst_identifier |
|
148
|
|
|
* $this will become moved record |
|
149
|
|
|
* |
|
150
|
|
|
* @param string $_dst_identifier |
|
151
|
|
|
* @return string dst_identifier |
|
152
|
|
|
*/ |
|
153
|
|
|
public function move ( $_dst_identifier ) { |
|
154
|
|
|
|
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* delets current record from backend |
|
159
|
|
|
* |
|
160
|
|
|
*/ |
|
161
|
|
|
public function delete () { |
|
162
|
|
|
|
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* destructor |
|
167
|
|
|
* |
|
168
|
|
|
*/ |
|
169
|
|
|
public function __destruct() { |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
} // end of calendar_egw_record |
|
173
|
|
|
?> |
|
174
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.