33 $this->PERM_STATISTIC = 1;
34 $this->PERM_OBJECT = 2;
41 return $this->trustees ? $this->trustees : array();
45 return isset($this->trustees[$a_usr_id]) ? $this->trustees[$a_usr_id] : array();
49 return isset($this->trustees[$a_usr_id]);
54 $this->perm_stat = (bool) $a_on;
58 $this->perm_obj = (bool) $a_on;
62 $this->perm_coupons = (bool) $a_on;
66 $this->trustee_id = $a_id;
71 $statement = $this->db->manipulateF(
'
72 INSERT INTO payment_trustees
79 VALUES (%s,%s,%s,%s,%s)',
80 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
81 array( $this->user_obj->getId(),
97 die(
"ilPaymentTrustees::modify() no id given");
100 $statement = $this->db->manipulateF(
'
101 UPDATE payment_trustees
107 AND trustee_id = %s',
108 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
113 $this->user_obj->getId(),
122 public function delete()
126 die(
"ilPaymentTrustees::delete() no id given");
129 $statement = $this->db->manipulateF(
'
130 DELETE FROM payment_trustees
132 AND trustee_id = %s ',
133 array(
'integer',
'integer'),
143 $statement = $this->db->manipulateF(
'
144 DELETE FROM payment_trustees
145 WHERE vendor_id = %s',
147 array($this->user_obj->getId()));
158 return $this->trustee_id;
162 return (
int) $this->perm_stat;
166 return (
int) $this->perm_obj;
170 return (
int) $this->perm_coupons;
175 $this->trustees = array();
177 $res = $this->db->queryf(
'
178 SELECT * FROM payment_trustees
179 WHERE vendor_id = %s',
181 array($this->user_obj->getId()));
183 while(
$row = $this->db->fetchObject(
$res))
185 $this->trustees[
$row->trustee_id][
'trustee_id'] =
$row->trustee_id;
186 $this->trustees[
$row->trustee_id][
'perm_stat'] =
$row->perm_stat;
187 $this->trustees[
$row->trustee_id][
'perm_obj'] =
$row->perm_obj;
188 $this->trustees[
$row->trustee_id][
'perm_coupons'] =
$row->perm_coupons;
197 $statement = $ilDB->manipulateF(
'
198 DELETE FROM payment_trustees
199 WHERE vendor_id = %s',
200 array(
'integer'), array($a_vendor_id));
209 $res = $ilDB->queryf(
'
210 SELECT * FROM payment_trustees
211 WHERE trustee_id = %s',
212 array(
'integer'), array($a_trustee));
214 while(
$row = $ilDB->fetchObject(
$res))
216 if((
bool)
$row->perm_stat)
228 $res = $ilDB->queryf(
'
229 SELECT * FROM payment_trustees
230 WHERE trustee_id = %s',
234 while(
$row = $ilDB->fetchObject(
$res))
236 if((
bool)
$row->perm_obj)
248 $res = $ilDB->queryf(
'
249 SELECT * FROM payment_trustees
250 WHERE trustee_id = %s',
254 while(
$row = $ilDB->fetchObject(
$res))
256 if((
bool)
$row->perm_coupons)
268 $res = $ilDB->queryf(
'
269 SELECT * FROM payment_trustees
270 WHERE trustee_id = %s
273 array(
'integer',
'integer',
'integer' ),
274 array($a_trustee, $a_vendor,
'1'));
276 return $res->numRows() ?
true :
false;
283 $res = $ilDB->queryf(
'
284 SELECT * FROM payment_trustees
285 WHERE trustee_id = %s
288 array(
'integer',
'integer',
'integer' ),
289 array($a_trustee, $a_vendor,
'1'));
291 return $ilDB->numRows(
$res) ?
true :
false;
298 $res = $ilDB->queryf(
'
299 SELECT * FROM payment_trustees
300 WHERE trustee_id = %s
302 AND perm_coupons = %s',
303 array(
'integer',
'integer',
'integer' ),
304 array($a_trustee, $a_vendor,
'1'));
306 return $res->numRows() ?
true :
false;
320 $res = $ilDB->queryf(
'
321 SELECT vendor_id FROM payment_trustees
322 WHERE trustee_id = %s
324 array(
'integer',
'integer'),
325 array($a_usr_id,
'1'));
327 while(
$row = $ilDB->fetchObject(
$res))
329 $vendors[] =
$row->vendor_id;
332 return $vendors ? $vendors : array();
339 $res = $ilDB->queryf(
'
340 SELECT vendor_id FROM payment_trustees
341 WHERE trustee_id = %s
342 AND perm_stat = %s ',
343 array(
'integer',
'integer'),
344 array($a_trustee_id,
'1'));
346 while(
$row = $ilDB->fetchObject(
$res))
348 $vendors[] =
$row->vendor_id;
351 return $vendors ? $vendors : array();
358 $res = $ilDB->queryf(
'
359 SELECT vendor_id FROM payment_trustees
360 WHERE trustee_id = %s
361 AND perm_coupons = %s ',
362 array(
'integer',
'integer'),
363 array($a_usr_id,
'1'));
365 while(
$row = $ilDB->fetchObject(
$res))
367 $vendors[] =
$row->vendor_id;
370 return $vendors ? $vendors : array();
377 $res = $ilDB->queryf(
'
378 SELECT trustee_id FROM payment_trustees
380 AND perm_coupons = %s ',
381 array(
'integer',
'integer'), array($a_usr_id,
'1'));
383 while(
$row = $ilDB->fetchObject(
$res))
394 $res = $ilDB->queryf(
'
395 SELECT vendor_id FROM payment_trustees WHERE trustee_id = %s',
396 array(
'integer'), array($a_usr_id));
397 while(
$row = $ilDB->fetchObject(
$res))
399 $vendors[] =
$row->vendor_id;
401 return $vendors ? $vendors : array();