behavior.php
6.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<?php
/**
* @package FrameworkOnFramework
* @subpackage table
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* FrameworkOnFramework table behavior class. It defines the events which are
* called by a Table.
*
* @codeCoverageIgnore
* @package FrameworkOnFramework
* @since 2.1
*/
abstract class FOFTableBehavior extends FOFUtilsObservableEvent
{
/**
* This event runs before binding data to the table
*
* @param FOFTable &$table The table which calls this event
* @param array &$data The data to bind
*
* @return boolean True on success
*/
public function onBeforeBind(&$table, &$data)
{
return true;
}
/**
* The event which runs after binding data to the table
*
* @param FOFTable &$table The table which calls this event
* @param object|array &$src The data to bind
*
* @return boolean True on success
*/
public function onAfterBind(&$table, &$src)
{
return true;
}
/**
* The event which runs after loading a record from the database
*
* @param FOFTable &$table The table which calls this event
* @param boolean &$result Did the load succeeded?
*
* @return void
*/
public function onAfterLoad(&$table, &$result)
{
}
/**
* The event which runs before storing (saving) data to the database
*
* @param FOFTable &$table The table which calls this event
* @param boolean $updateNulls Should nulls be saved as nulls (true) or just skipped over (false)?
*
* @return boolean True to allow saving
*/
public function onBeforeStore(&$table, $updateNulls)
{
return true;
}
/**
* The event which runs after storing (saving) data to the database
*
* @param FOFTable &$table The table which calls this event
*
* @return boolean True to allow saving without an error
*/
public function onAfterStore(&$table)
{
return true;
}
/**
* The event which runs before moving a record
*
* @param FOFTable &$table The table which calls this event
* @param boolean $updateNulls Should nulls be saved as nulls (true) or just skipped over (false)?
*
* @return boolean True to allow moving
*/
public function onBeforeMove(&$table, $updateNulls)
{
return true;
}
/**
* The event which runs after moving a record
*
* @param FOFTable &$table The table which calls this event
*
* @return boolean True to allow moving without an error
*/
public function onAfterMove(&$table)
{
return true;
}
/**
* The event which runs before reordering a table
*
* @param FOFTable &$table The table which calls this event
* @param string $where The WHERE clause of the SQL query to run on reordering (record filter)
*
* @return boolean True to allow reordering
*/
public function onBeforeReorder(&$table, $where = '')
{
return true;
}
/**
* The event which runs after reordering a table
*
* @param FOFTable &$table The table which calls this event
*
* @return boolean True to allow the reordering to complete without an error
*/
public function onAfterReorder(&$table)
{
return true;
}
/**
* The event which runs before deleting a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record to delete
*
* @return boolean True to allow the deletion
*/
public function onBeforeDelete(&$table, $oid)
{
return true;
}
/**
* The event which runs after deleting a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record which was deleted
*
* @return boolean True to allow the deletion without errors
*/
public function onAfterDelete(&$table, $oid)
{
return true;
}
/**
* The event which runs before hitting a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record to hit
* @param boolean $log Should we log the hit?
*
* @return boolean True to allow the hit
*/
public function onBeforeHit(&$table, $oid, $log)
{
return true;
}
/**
* The event which runs after hitting a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record which was hit
*
* @return boolean True to allow the hitting without errors
*/
public function onAfterHit(&$table, $oid)
{
return true;
}
/**
* The even which runs before copying a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record being copied
*
* @return boolean True to allow the copy to take place
*/
public function onBeforeCopy(&$table, $oid)
{
return true;
}
/**
* The even which runs after copying a record
*
* @param FOFTable &$table The table which calls this event
* @param integer $oid The PK value of the record which was copied (not the new one)
*
* @return boolean True to allow the copy without errors
*/
public function onAfterCopy(&$table, $oid)
{
return true;
}
/**
* The event which runs before a record is (un)published
*
* @param FOFTable &$table The table which calls this event
* @param integer|array &$cid The PK IDs of the records being (un)published
* @param integer $publish 1 to publish, 0 to unpublish
*
* @return boolean True to allow the (un)publish to proceed
*/
public function onBeforePublish(&$table, &$cid, $publish)
{
return true;
}
/**
* The event which runs after the object is reset to its default values.
*
* @param FOFTable &$table The table which calls this event
*
* @return boolean True to allow the reset to complete without errors
*/
public function onAfterReset(&$table)
{
return true;
}
/**
* The even which runs before the object is reset to its default values.
*
* @param FOFTable &$table The table which calls this event
*
* @return boolean True to allow the reset to complete
*/
public function onBeforeReset(&$table)
{
return true;
}
}