Definition at line 35 of file class.ilPaymentBookings.php.
ilPaymentBookings::__getVendorIds | ( | ) |
Definition at line 576 of file class.ilPaymentBookings.php.
References ilPaymentTrustees::_getVendorsForObjects(), ilPaymentTrustees::_hasStatisticPermissionByVendor(), and ilPaymentVendors::_isVendor().
Referenced by __read().
{ if(ilPaymentVendors::_isVendor($this->user_id)) { $vendors[] = $this->user_id; } if($vend = ilPaymentTrustees::_getVendorsForObjects($this->user_id)) { foreach($vend as $v) { if(ilPaymentTrustees::_hasStatisticPermissionByVendor($this->user_id,$v)) { $vendors[] = $v; #vendors = array_merge($vendors,$v); } } } return $vendors ? $vendors : array(); }
ilPaymentBookings::__read | ( | ) |
Definition at line 470 of file class.ilPaymentBookings.php.
References $_SESSION, $query, $res, $row, and __getVendorIds().
Referenced by ilPaymentBookings().
{ $query = 'SELECT * FROM payment_statistic as ps, payment_objects as po'; if ($_SESSION["pay_statistics"]["customer"] or $_SESSION['pay_statistics']['vendor']) { $query .= ', usr_data as ud'; } $query .= " WHERE ps.pobject_id = po.pobject_id "; if ($_SESSION["pay_statistics"]["transaction_value"] != "") { if ($_SESSION["pay_statistics"]["transaction_type"] == 0) { $query .= "AND transaction_extern LIKE '" . $_SESSION["pay_statistics"]["transaction_value"] . "%' "; } else if ($_SESSION["pay_statistics"]["transaction_type"] == 1) { $query .= "AND transaction_extern LIKE '%" . $_SESSION["pay_statistics"]["transaction_value"] . "' "; } } if ($_SESSION["pay_statistics"]["customer"] != "") { $query .= "AND ud.login LIKE '%" . $_SESSION["pay_statistics"]["customer"] . "%' " . "AND ud.usr_id = ps.customer_id "; } if ($_SESSION["pay_statistics"]["from"]["day"] != "" && $_SESSION["pay_statistics"]["from"]["month"] != "" && $_SESSION["pay_statistics"]["from"]["year"] != "") { $from = mktime(0, 0, 0, $_SESSION["pay_statistics"]["from"]["month"], $_SESSION["pay_statistics"]["from"]["day"], $_SESSION["pay_statistics"]["from"]["year"]); $query .= "AND order_date >= '" . $from . "' "; } if ($_SESSION["pay_statistics"]["til"]["day"] != "" && $_SESSION["pay_statistics"]["til"]["month"] != "" && $_SESSION["pay_statistics"]["til"]["year"] != "") { $til = mktime(23, 59, 59, $_SESSION["pay_statistics"]["til"]["month"], $_SESSION["pay_statistics"]["til"]["day"], $_SESSION["pay_statistics"]["til"]["year"]); $query .= "AND order_date <= '" . $til . "' "; } if ($_SESSION["pay_statistics"]["payed"] == "0" || $_SESSION["pay_statistics"]["payed"] == "1") { $query .= "AND payed = '" . $_SESSION["pay_statistics"]["payed"] . "' "; } if ($_SESSION["pay_statistics"]["access"] == "0" || $_SESSION["pay_statistics"]["access"] == "1") { $query .= "AND access = '" . $_SESSION["pay_statistics"]["access"] . "' "; } if ($_SESSION["pay_statistics"]["pay_method"] == "1" || $_SESSION["pay_statistics"]["pay_method"] == "2" || $_SESSION["pay_statistics"]["pay_method"] == "3") { $query .= "AND b_pay_method = '" . $_SESSION["pay_statistics"]["pay_method"] . "' "; } if(!$this->admin_view) { $vendors = $this->__getVendorIds(); if (is_array($vendors) && count($vendors) > 0) { $in = 'ps.b_vendor_id IN ('; $in .= implode(',',$vendors); $in .= ')'; $query .= "AND ".$in." "; } } else { if($_SESSION['pay_statistics']['vendor']) { $query .= "AND ud.login LIKE '%" . $_SESSION["pay_statistics"]["vendor"] . "%' " . "AND ud.usr_id = ps.b_vendor_id "; } } $query .= "ORDER BY order_date DESC"; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $this->bookings[$row->booking_id]['booking_id'] = $row->booking_id; $this->bookings[$row->booking_id]['transaction'] = $row->transaction; $this->bookings[$row->booking_id]['pobject_id'] = $row->pobject_id; $this->bookings[$row->booking_id]['customer_id'] = $row->customer_id; $this->bookings[$row->booking_id]['order_date'] = $row->order_date; $this->bookings[$row->booking_id]['duration'] = $row->duration; $this->bookings[$row->booking_id]['price'] = $row->price; $this->bookings[$row->booking_id]['payed'] = $row->payed; $this->bookings[$row->booking_id]['access'] = $row->access; $this->bookings[$row->booking_id]['ref_id'] = $row->ref_id; $this->bookings[$row->booking_id]['status'] = $row->status; $this->bookings[$row->booking_id]['pay_method'] = $row->pay_method; $this->bookings[$row->booking_id]['vendor_id'] = $row->vendor_id; $this->bookings[$row->booking_id]['b_vendor_id'] = $row->b_vendor_id; $this->bookings[$row->booking_id]['b_pay_method'] = $row->b_pay_method; $this->bookings[$row->booking_id]['voucher'] = $row->voucher; $this->bookings[$row->booking_id]['transaction_extern'] = $row->transaction_extern; } }
ilPaymentBookings::_getActivation | ( | $ | a_pobject_id, | |
$ | a_user_id = 0 | |||
) |
Definition at line 379 of file class.ilPaymentBookings.php.
References $ilias, $query, $res, and $row.
{ global $ilDB,$ilias; $usr_id = $a_user_id ? $a_user_id : $ilias->account->getId(); $query = "SELECT * FROM payment_statistic ". "WHERE pobject_id = '".$a_pobject_id."' ". "AND customer_id = '".$usr_id."' ". "AND payed = '1' ". "AND access = '1'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $orderDateYear = date("Y", $row->order_date); $orderDateMonth = date("m", $row->order_date); $orderDateDay = date("d", $row->order_date); $orderDateHour = date("H", $row->order_date); $orderDateMinute = date("i", $row->order_date); $orderDateSecond = date("s", $row->order_date); if (($orderDateMonth + $row->duration) > 12) { $years = floor(($orderDateMonth + $row->duration) / 12); $months = ($orderDateMonth + $row->duration) - (12 * $years); $orderDateYear += $years; $orderDateMonth = $months; } else { $orderDateMonth += $row->duration; } $startDate = date("Y-m-d H:i:s", $row->order_date); $endDate = date("Y-m-d H:i:s", mktime($orderDateHour, $orderDateMinute, $orderDateSecond, $orderDateMonth, $orderDateDay, $orderDateYear)); if (date("Y-m-d H:i:s") >= $startDate && date("Y-m-d H:i:s") <= $endDate) { $activation = array( "activation_start" => $row->order_date, "activation_end" => mktime($orderDateHour, $orderDateMinute, $orderDateSecond, $orderDateMonth, $orderDateDay, $orderDateYear) ); return $activation; } } return false; }
ilPaymentBookings::_getCountBookingsByCustomer | ( | $ | a_vendor_id | ) |
Definition at line 307 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
Referenced by ilPersonalDesktopGUI::setTabs().
{ global $ilDB; $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE customer_id = '".$a_vendor_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; }
ilPaymentBookings::_getCountBookingsByObject | ( | $ | a_pobject_id | ) |
Definition at line 321 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
Referenced by ilPaymentObjectGUI::deleteObject(), ilPaymentObjectGUI::editDetails(), and ilPaymentObjectGUI::showObjects().
{ global $ilDB; $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE pobject_id = '".$a_pobject_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; }
ilPaymentBookings::_getCountBookingsByPayMethod | ( | $ | a_pm | ) |
Definition at line 426 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
{ switch($a_pm) { case 'pm_bill': $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE pay_method = '1'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; case 'pm_bmf': $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE pay_method = '2'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; case 'pm_paypal': $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE pay_method = '3'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; default: return 0; } }
ilPaymentBookings::_getCountBookingsByVendor | ( | $ | a_vendor_id | ) |
Definition at line 292 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
Referenced by ilObjPaymentSettingsGUI::deleteVendors(), and ilObjPaymentSettingsGUI::vendorsObject().
{ global $ilDB; $query = "SELECT COUNT(booking_id) AS bid FROM payment_statistic ". "WHERE b_vendor_id = '".$a_vendor_id."'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { return $row->bid; } return 0; }
ilPaymentBookings::_hasAccess | ( | $ | a_pobject_id, | |
$ | a_user_id = 0 | |||
) |
Definition at line 336 of file class.ilPaymentBookings.php.
References $ilias, $query, $res, and $row.
Referenced by ilPaymentObject::_hasAccess().
{ global $ilDB,$ilias; $usr_id = $a_user_id ? $a_user_id : $ilias->account->getId(); $query = "SELECT * FROM payment_statistic ". "WHERE pobject_id = '".$a_pobject_id."' ". "AND customer_id = '".$usr_id."' ". "AND payed = '1' ". "AND access = '1'"; $res = $ilDB->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $orderDateYear = date("Y", $row->order_date); $orderDateMonth = date("m", $row->order_date); $orderDateDay = date("d", $row->order_date); $orderDateHour = date("H", $row->order_date); $orderDateMinute = date("i", $row->order_date); $orderDateSecond = date("s", $row->order_date); if (($orderDateMonth + $row->duration) > 12) { $years = floor(($orderDateMonth + $row->duration) / 12); $months = ($orderDateMonth + $row->duration) - (12 * $years); $orderDateYear += $years; $orderDateMonth = $months; } else { $orderDateMonth += $row->duration; } $startDate = date("Y-m-d H:i:s", $row->order_date); $endDate = date("Y-m-d H:i:s", mktime($orderDateHour, $orderDateMinute, $orderDateSecond, $orderDateMonth, $orderDateDay, $orderDateYear)); if (date("Y-m-d H:i:s") >= $startDate && date("Y-m-d H:i:s") <= $endDate) { return true; } } return false; }
ilPaymentBookings::add | ( | ) |
Definition at line 173 of file class.ilPaymentBookings.php.
References $query, getAccessStatus(), getCustomerId(), getDuration(), getOrderDate(), getPayedStatus(), getPayMethod(), getPobjectId(), getPrice(), getTransaction(), getTransactionExtern(), getVendorId(), and getVoucher().
{ $query = sprintf("INSERT INTO payment_statistic VALUES('',". "'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')", $this->getTransaction(), $this->getPobjectId(), $this->getCustomerId(), $this->getVendorId(), $this->getPayMethod(), $this->getOrderDate(), $this->getDuration(), $this->getPrice(), $this->getPayedStatus(), $this->getAccessStatus(), $this->getVoucher(), $this->getTransactionExtern()); $this->db->query($query); return true; }
ilPaymentBookings::delete | ( | ) |
Definition at line 210 of file class.ilPaymentBookings.php.
References $query, and getBookingId().
{ if($this->getBookingId()) { $query = "DELETE FROM payment_statistic ". "WHERE booking_id = '".$this->getBookingId()."'"; $this->db->query($query); return true; } return false; }
ilPaymentBookings::getAccessStatus | ( | ) |
Definition at line 152 of file class.ilPaymentBookings.php.
Referenced by add(), and update().
{
return $this->access;
}
ilPaymentBookings::getBooking | ( | $ | a_booking_id | ) |
Definition at line 260 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
{ $query = 'SELECT * FROM payment_statistic as ps, payment_objects as po '. "WHERE ps.pobject_id = po.pobject_id ". "AND booking_id = '".$a_booking_id."'"; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $booking['booking_id'] = $row->booking_id; $booking['transaction'] = $row->transaction; $booking['pobject_id'] = $row->pobject_id; $booking['customer_id'] = $row->customer_id; $booking['order_date'] = $row->order_date; $booking['duration'] = $row->duration; $booking['price'] = $row->price; $booking['payed'] = $row->payed; $booking['access'] = $row->access; $booking['ref_id'] = $row->ref_id; $booking['status'] = $row->status; $booking['pay_method'] = $row->pay_method; $booking['vendor_id'] = $row->vendor_id; $booking['b_vendor_id'] = $row->b_vendor_id; $booking['b_pay_method'] = $row->b_pay_method; $booking['voucher'] = $row->voucher; $booking['transaction_extern'] = $row->transaction_extern; } return $booking ? $booking : array(); }
ilPaymentBookings::getBookingId | ( | ) |
Definition at line 72 of file class.ilPaymentBookings.php.
Referenced by delete(), and update().
{
return $this->booking_id;
}
ilPaymentBookings::getBookings | ( | ) |
Definition at line 255 of file class.ilPaymentBookings.php.
{
return $this->bookings ? $this->bookings : array();
}
ilPaymentBookings::getBookingsOfCustomer | ( | $ | a_usr_id | ) |
Definition at line 224 of file class.ilPaymentBookings.php.
References $query, $res, and $row.
{ $query = 'SELECT * FROM payment_statistic as ps, payment_objects as po '. "WHERE ps.pobject_id = po.pobject_id ". "AND customer_id = '".$a_usr_id."' ". "ORDER BY order_date DESC"; $res = $this->db->query($query); while($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { $booking[$row->booking_id]['booking_id'] = $row->booking_id; $booking[$row->booking_id]['transaction'] = $row->transaction; $booking[$row->booking_id]['pobject_id'] = $row->pobject_id; $booking[$row->booking_id]['customer_id'] = $row->customer_id; $booking[$row->booking_id]['order_date'] = $row->order_date; $booking[$row->booking_id]['duration'] = $row->duration; $booking[$row->booking_id]['price'] = $row->price; $booking[$row->booking_id]['payed'] = $row->payed; $booking[$row->booking_id]['access'] = $row->access; $booking[$row->booking_id]['ref_id'] = $row->ref_id; $booking[$row->booking_id]['status'] = $row->status; $booking[$row->booking_id]['pay_method'] = $row->pay_method; $booking[$row->booking_id]['vendor_id'] = $row->vendor_id; $booking[$row->booking_id]['b_vendor_id'] = $row->b_vendor_id; $booking[$row->booking_id]['b_pay_method'] = $row->b_pay_method; $booking[$row->booking_id]['voucher'] = $row->voucher; $booking[$row->booking_id]['transaction_extern'] = $row->transaction_extern; } return $booking ? $booking : array(); }
ilPaymentBookings::getCustomerId | ( | ) |
Definition at line 96 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->customer_id;
}
ilPaymentBookings::getDuration | ( | ) |
Definition at line 128 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->duration;
}
ilPaymentBookings::getOrderDate | ( | ) |
Definition at line 120 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->order_date;
}
ilPaymentBookings::getPayedStatus | ( | ) |
Definition at line 144 of file class.ilPaymentBookings.php.
Referenced by add(), and update().
{
return $this->payed;
}
ilPaymentBookings::getPayMethod | ( | ) |
Definition at line 112 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->pay_method;
}
ilPaymentBookings::getPobjectId | ( | ) |
Definition at line 88 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->pobject_id;
}
ilPaymentBookings::getPrice | ( | ) |
Definition at line 136 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->price;
}
ilPaymentBookings::getTransaction | ( | ) |
Definition at line 80 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->transaction;
}
ilPaymentBookings::getTransactionExtern | ( | ) |
Definition at line 168 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->transaction_extern;
}
ilPaymentBookings::getVendorId | ( | ) |
Definition at line 104 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->vendor_id;
}
ilPaymentBookings::getVoucher | ( | ) |
Definition at line 160 of file class.ilPaymentBookings.php.
Referenced by add().
{
return $this->voucher;
}
ilPaymentBookings::ilPaymentBookings | ( | $ | a_user_id = '' , |
|
$ | a_admin_view = false | |||
) |
Definition at line 53 of file class.ilPaymentBookings.php.
References __read().
{ global $ilDB; $this->admin_view = $a_admin_view; $this->user_id = $a_user_id; $this->db =& $ilDB; if($a_user_id) { $this->__read(); } }
ilPaymentBookings::setAccess | ( | $ | a_access | ) |
Definition at line 148 of file class.ilPaymentBookings.php.
{ $this->access = $a_access; }
ilPaymentBookings::setBookingId | ( | $ | a_booking_id | ) |
Definition at line 68 of file class.ilPaymentBookings.php.
{
return $this->booking_id = $a_booking_id;
}
ilPaymentBookings::setCustomerId | ( | $ | a_customer_id | ) |
Definition at line 92 of file class.ilPaymentBookings.php.
{ $this->customer_id = $a_customer_id; }
ilPaymentBookings::setDuration | ( | $ | a_duration | ) |
Definition at line 124 of file class.ilPaymentBookings.php.
{ $this->duration = $a_duration; }
ilPaymentBookings::setOrderDate | ( | $ | a_order_date | ) |
Definition at line 116 of file class.ilPaymentBookings.php.
{ $this->order_date = $a_order_date; }
ilPaymentBookings::setPayed | ( | $ | a_payed | ) |
Definition at line 140 of file class.ilPaymentBookings.php.
{ $this->payed = $a_payed; }
ilPaymentBookings::setPayMethod | ( | $ | a_pay_method | ) |
Definition at line 108 of file class.ilPaymentBookings.php.
{ $this->pay_method = $a_pay_method; }
ilPaymentBookings::setPobjectId | ( | $ | a_pobject_id | ) |
Definition at line 84 of file class.ilPaymentBookings.php.
{ $this->pobject_id = $a_pobject_id; }
ilPaymentBookings::setPrice | ( | $ | a_price | ) |
Definition at line 132 of file class.ilPaymentBookings.php.
{ $this->price = $a_price; }
ilPaymentBookings::setTransaction | ( | $ | a_transaction | ) |
Definition at line 76 of file class.ilPaymentBookings.php.
{ $this->transaction = $a_transaction; }
ilPaymentBookings::setTransactionExtern | ( | $ | a_transaction_extern | ) |
Definition at line 164 of file class.ilPaymentBookings.php.
{ $this->transaction_extern = $a_transaction_extern; }
ilPaymentBookings::setVendorId | ( | $ | a_vendor_id | ) |
Definition at line 100 of file class.ilPaymentBookings.php.
{ $this->vendor_id = $a_vendor_id; }
ilPaymentBookings::setVoucher | ( | $ | a_voucher | ) |
Definition at line 156 of file class.ilPaymentBookings.php.
{ $this->voucher = $a_voucher; }
ilPaymentBookings::update | ( | ) |
Definition at line 195 of file class.ilPaymentBookings.php.
References $query, getAccessStatus(), getBookingId(), and getPayedStatus().
{ if($this->getBookingId()) { $query = "UPDATE payment_statistic ". "SET payed = '".(int) $this->getPayedStatus()."', ". "access = '".(int) $this->getAccessStatus()."' ". "WHERE booking_id = '".$this->getBookingId()."'"; $this->db->query($query); return true; } return false; }
ilPaymentBookings::$access = null |
Definition at line 47 of file class.ilPaymentBookings.php.
ilPaymentBookings::$admin_view = false |
Definition at line 48 of file class.ilPaymentBookings.php.
ilPaymentBookings::$booking_id = null |
Definition at line 45 of file class.ilPaymentBookings.php.
ilPaymentBookings::$bookings = array() |
Definition at line 43 of file class.ilPaymentBookings.php.
ilPaymentBookings::$db = null |
Definition at line 41 of file class.ilPaymentBookings.php.
ilPaymentBookings::$payed = null |
Definition at line 46 of file class.ilPaymentBookings.php.
ilPaymentBookings::$user_id = null |
Definition at line 40 of file class.ilPaymentBookings.php.