Open Journal Systems  2.4.3
 All Classes Namespaces Functions Variables Groups Pages
QueuedPaymentDAO.inc.php
1 <?php
2 
19 class QueuedPaymentDAO extends DAO {
23  function QueuedPaymentDAO() {
24  parent::DAO();
25  }
26 
32  function &getQueuedPayment($queuedPaymentId) {
33  $result =& $this->retrieve(
34  'SELECT * FROM queued_payments WHERE queued_payment_id = ?',
35  (int) $queuedPaymentId
36  );
37 
38  $queuedPayment = null;
39  if ($result->RecordCount() != 0) {
40  $queuedPayment = unserialize($result->fields['payment_data']);
41  if (!is_object($queuedPayment)) $queuedPayment = null;
42  }
43  $result->Close();
44  unset($result);
45  return $queuedPayment;
46  }
47 
53  function insertQueuedPayment(&$queuedPayment, $expiryDate = null) {
54  $this->update(
55  sprintf('INSERT INTO queued_payments
56  (date_created, date_modified, expiry_date, payment_data)
57  VALUES
58  (%s, %s, %s, ?)',
61  $this->datetimeToDB($expiryDate)),
62  array(
63  serialize($queuedPayment)
64  )
65  );
66 
67  return $queuedPayment->setId($this->getInsertQueuedPaymentId());
68  }
69 
75  function updateQueuedPayment($queuedPaymentId, &$queuedPayment) {
76  return $this->update(
77  sprintf('UPDATE queued_payments
78  SET
79  date_modified = %s,
80  payment_data = ?
81  WHERE queued_payment_id = ?',
83  array(
84  serialize($queuedPayment),
85  (int) $queuedPaymentId
86  )
87  );
88  }
89 
95  return $this->getInsertId('queued_payments', 'queued_payment_id');
96  }
97 
102  function deleteQueuedPayment($queuedPaymentId) {
103  return $this->update(
104  'DELETE FROM queued_payments WHERE queued_payment_id = ?',
105  array((int) $queuedPaymentId)
106  );
107  }
108 
113  return $this->update(
114  'DELETE FROM queued_payments WHERE expiry_date < now()'
115  );
116  }
117 }
118 
119 ?>
Operations for retrieving and modifying objects from a database.
Definition: DAO.inc.php:29
& retrieve($sql, $params=false, $callHooks=true)
Definition: DAO.inc.php:83
& getQueuedPayment($queuedPaymentId)
getInsertId($table= '', $id= '', $callHooks=true)
Definition: DAO.inc.php:252
getCurrentDate($ts=null)
Definition: Core.inc.php:94
deleteQueuedPayment($queuedPaymentId)
insertQueuedPayment(&$queuedPayment, $expiryDate=null)
updateQueuedPayment($queuedPaymentId, &$queuedPayment)
Operations for retrieving and modifying queued payment objects.
datetimeToDB($dt)
Definition: DAO.inc.php:296
update($sql, $params=false, $callHooks=true, $dieOnError=true)
Definition: DAO.inc.php:211