ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPurchaseBaseGUI Class Reference

Class class.ilPurchaseBaseGUI.php. More...

+ Inheritance diagram for ilPurchaseBaseGUI:
+ Collaboration diagram for ilPurchaseBaseGUI:

Public Member Functions

 __construct ($user_obj, $pay_method)
 
 cancel ()
 
 showPersonalData ()
 
 getPersonalData ()
 
 showBillConfirm ()
 
 executeCommand ()
 execute command More...
 
 __addBookings ($external_data=null)
 
 __sendBill ($bookings)
 
 __emptyShoppingCart ()
 
 __clearSession ()
 
 __loadTemplate ()
 
 __buildStatusline ()
 
 __buildLocator ()
 
 __buildStylesheet ()
 
 __getCountries ()
 shows select box f�r countries More...
 
 __getCountryCode ($value='')
 
 __getCountryName ($value='')
 
 __getTotalAmount ()
 depricated!? More...
 
 getBill ()
 
 __showShoppingCart ()
 
 getAccess ()
 
 setAccess ($access)
 
 getPayed ()
 
 setPayed ($payed)
 
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()
 

Data Fields

 $ctrl
 
 $tpl
 
 $psc_obj = null
 
 $user_obj = null
 
 $coupon_obj = null
 
 $error
 
 $pmethod_obj = null
 

Private Member Functions

 __getShoppingCart ()
 
 __showItemsTable ($a_result_set)
 

Private Attributes

 $pm_id = 0
 
 $totalVat = 0
 
 $session_var = null
 
 $payed = 1
 
 $access = 1
 

Additional Inherited Members

- Protected Member Functions inherited from ilShopBaseGUI
 prepareOutput ()
 
 addPager ($result)
 
- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 
 $lng = null
 
 $tpl = null
 
 $settings = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPurchaseBaseGUI::__construct (   $user_obj,
  $pay_method 
)

Definition at line 41 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, $ilCtrl, ilShopBaseGUI\$lng, $session_var, $tpl, $user_obj, __getCountryCode(), and __loadTemplate().

42  {
43  global $lng, $tpl, $ilCtrl, $ilTabs;
44 
45  parent::__construct();
46 
47  $this->lng = $lng;
48  $this->ctrl = $ilCtrl;
49  $this->tpl = $tpl;
50  $this->user_obj = $user_obj;
51 
52  $this->pmethod_obj = new ilPayMethods($pay_method);
53  $this->session_var = $this->pmethod_obj->getPmTitle();
54 
55  $this->pm_id = $pay_method;
56 
57  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
58 
59  $this->coupon_obj = new ilPaymentCoupons($this->user_obj);
60 
61  if (!is_array($_SESSION[$this->session_var]['personal_data']))
62  {
63  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
64  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
65  if (strpos('_' . $this->user_obj->getStreet(), ' ') > 0)
66  {
67  $houseNo = substr($this->user_obj->getStreet(), strrpos($this->user_obj->getStreet(), ' ')+1);
68  $street = substr($this->user_obj->getStreet(), 0, strlen($this->user_obj->getStreet())-(strlen($houseNo)+1));
69  $_SESSION[$this->session_var]['personal_data']['street'] = $street;
70  $_SESSION[$this->session_var]['personal_data']['house_number'] = $houseNo;
71  }
72  else
73  {
74  $_SESSION[$this->session_var]['personal_data']['street'] = $this->user_obj->getStreet();
75  $_SESSION[$this->session_var]['personal_data']['house_number'] = '';
76  }
77  $_SESSION[$this->session_var]['personal_data']['po_box'] = '';
78  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $this->user_obj->getZipcode();
79  $_SESSION[$this->session_var]['personal_data']['city'] = $this->user_obj->getCity();
80  $_SESSION[$this->session_var]['personal_data']['country'] = $this->__getCountryCode($this->user_obj->getCountry());
81  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
82  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
83  }
84 
85  if (!is_array($_SESSION['coupons'][$this->session_var]))
86  {
87  $_SESSION['coupons'][$this->session_var] = array();
88  }
89 
90  $this->__loadTemplate();
91  $this->error = '';
92  $this->lng->loadLanguageModule('payment');
93 
94  $ilTabs->clearTargets();
95  $ilTabs->clearSubTabs();
96  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
global $ilCtrl
Definition: ilias.php:18
Class ilObjPaymentSettingsGUI.
+ Here is the call graph for this function:

Member Function Documentation

◆ __addBookings()

ilPurchaseBaseGUI::__addBookings (   $external_data = null)

Definition at line 285 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, $ilUser, $session_var, $total, __getCountryName(), __sendBill(), ilShopUtils\_addPurchasedObjToDesktop(), ilShopUtils\_assignPurchasedCourseMemberRole(), ilInvoiceNumberPlaceholdersPropertyGUI\_generateInvoiceNumber(), ilPaymentObject\_getObjectData(), ilObject\_lookupType(), getAccess(), getPayed(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

Referenced by getBill().

286  {
287  global $ilUser, $ilObjDataCache;
288 
289  $sc = $this->psc_obj->getShoppingCart($this->pm_id);
290  $total = 0;
291  $total_vat = 0;
292  $total_discount = 0;
293 
294 # $this->psc_obj->clearCouponItemsSession();
295 
296  if (is_array($sc) && count($sc) > 0)
297  {
298  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
299  //@todo check $this->usr_obj
300  $book_obj = new ilPaymentBookings($this->usr_obj);
301 
302  for ($i = 0; $i < count($sc); $i++)
303  {
304  if (!empty($_SESSION['coupons'][$this->session_var]))
305  {
306  $sc[$i]['math_price'] = (float) $sc[$i]['price'];
307 
308  $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']);
309 
310  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
311  {
312  $this->coupon_obj->setId($coupon['pc_pk']);
313  $this->coupon_obj->setCurrentCoupon($coupon);
314 
315  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
316  {
317  $_SESSION['coupons'][$this->session_var][$key]['total_objects_coupon_price'] += (float) $sc[$i]['price'];
318  $_SESSION['coupons'][$this->session_var][$key]['items'][] = $sc[$i];
319  }
320  }
321 
322  unset($tmp_pobject);
323  }
324  }
325 
326  $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION['coupons'][$this->session_var]);
328 
329  for ($i = 0; $i < count($sc); $i++)
330  {
331  $pobjectData = ilPaymentObject::_getObjectData($sc[$i]['pobject_id']);
332  $pobject = new ilPaymentObject($this->user_obj,$sc[$i]['pobject_id']);
333 
334  $price = $sc[$i]['price'];
335  $bonus = 0.0;
336 
337  if (array_key_exists($sc[$i]['pobject_id'], $coupon_discount_items))
338  {
339  $bonus = $coupon_discount_items[$sc[$i]['pobject_id']]['math_price'] - $coupon_discount_items[$sc[$i]['pobject_id']]['discount_price'];
340  if($bonus > 0)
341  $discount = round($bonus, 2)* (-1);
342  else $discount = round($bonus, 2);
343 
344  }
345 
346  $book_obj->setTransaction($transaction);
347  $book_obj->setPobjectId($sc[$i]['pobject_id']);
348  $book_obj->setCustomerId($this->user_obj->getId());
349  $book_obj->setVendorId($pobjectData['vendor_id']);
350  $book_obj->setPayMethod($pobjectData['pay_method']);
351  $book_obj->setOrderDate(time());
352 
353  $book_obj->setPrice($sc[$i]['price_string']);
354  //$book_obj->setDiscount($bonus > 0 ? ilPaymentPrices::_getPriceStringFromAmount($bonus * (-1)) : '');
355  $book_obj->setDiscount($discount);
356  $book_obj->setPayed($this->getPayed());
357  $book_obj->setAccess($this->getAccess());
358 
359  $book_obj->setVoucher(''); // bmf
360  $book_obj->setTransactionExtern(''); // bmf , paypal
361 
362  $book_obj->setVatRate($sc[$i]['vat_rate']);
363  $book_obj->setVatUnit($sc[$i]['vat_unit']);
364  $book_obj->setObjectTitle(strip_tags($sc[$i]['object_title']));
365  $book_obj->setAccessExtension($sc[$i]['extension']);
366 
367  switch($sc[$i]["price_type"])
368  {
370  $book_obj->setDuration($sc[$i]['duration']);
371  break;
372 
374  $book_obj->setDuration(0);
375  $book_obj->setAccessStartdate($sc[$i]['duration_from']);
376  $book_obj->setAccessEnddate($sc[$i]['duration_until']);
377  break;
379  $book_obj->setDuration(0);
380  $book_obj->setAccessEnddate(NULL);
381  $book_obj->setUnlimitedDuration($sc[$i]['unlimited_duration']);
382  break;
383  }
384 
385 
386  $book_obj->setPriceType($sc[$i]["price_type"]);
387 //
388  if($external_data)
389  {
390  $book_obj->setVoucher($external_data['voucher']); // bmf
391  $book_obj->setTransactionExtern($external_data['transaction_extern']); // bmf, paypal
392  $book_obj->setStreet($external_data['street'],'');
393  $book_obj->setZipcode($external_data['zipcode']);
394  $book_obj->setCity($external_data['city']);
395  $book_obj->setCountry($external_data['country']);
396  }
397  else
398  if(isset($_SESSION[$this->session_var]['personal_data']))
399  {
400  $book_obj->setStreet($_SESSION[$this->session_var]['personal_data']['street'], $_SESSION[$this->session_var]['personal_data']['house_number']);
401  $book_obj->setPoBox($_SESSION[$this->session_var]['personal_data']['po_box']);
402  $book_obj->setZipcode($_SESSION[$this->session_var]['personal_data']['zipcode']);
403  $book_obj->setCity($_SESSION[$this->session_var]['personal_data']['city']);
404  $book_obj->setCountry($_SESSION[$this->session_var]['personal_data']['country']);
405  }
406  else
407  {
408  $book_obj->setStreet($this->user_obj->getStreet(), '');
409  $book_obj->setPoBox($this->user_obj->getPoBox());
410  $book_obj->setZipcode($this->user_obj->getZipCode());
411  $book_obj->setCity($this->user_obj->getCity());
412  $book_obj->setCountry($this->user_obj->getCountry());
413  }
414 
415  $booking_id = $book_obj->add();
416 
417  // add purchased item to desktop
419 
420  // autosubscribe user if purchased object is a course
421  $obj_type = ilObject::_lookupType((int)$pobject->getRefId(),true);
422 
423  if($obj_type == 'crs')
424  {
426  }
427 
428  if (!empty($_SESSION['coupons'][$this->session_var]) && $booking_id)
429  {
430  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
431  {
432  $this->coupon_obj->setId($coupon['pc_pk']);
433  $this->coupon_obj->setCurrentCoupon($coupon);
434 
435  if ($this->coupon_obj->isObjectAssignedToCoupon($pobject->getRefId()))
436  {
437  $this->coupon_obj->addCouponForBookingId($booking_id);
438  }
439  }
440  }
441 
442  $obj_id = $ilObjDataCache->lookupObjId($pobjectData['ref_id']);
443  $obj_type = $ilObjDataCache->lookupType($obj_id);
444  $obj_title = $ilObjDataCache->lookupTitle($obj_id);
445 
446  $bookings['list'][] = array(
447  'pobject_id' => $sc[$i]['pobject_id'],
448  'type' => $obj_type,
449  'title' => '['.$obj_id.']: ' . $obj_title,
450  'duration' => $sc[$i]['duration'],
451  'vat_rate' => $sc[$i]['vat_rate'],
452  'vat_unit' => $sc[$i]['vat_unit'],
453  'price_string' => $sc[$i]['price_string'],
454  'price' => $sc[$i]['price'],
455  "price_type" => $sc[$i]["price_type"],
456  "duration_from" => $sc[$i]["duration_from"],
457  "duration_until" => $sc[$i]["duration_until"],
458  "b_pay_method" => $pobjectData["pay_method"],
459  'discount'=> $discount,
460  'access_startdate' => $book_obj->getAccessStartdate(),
461  'access_enddate' => $book_obj->getAccessEnddate()
462  );
463 
464  $total += $sc[$i]['price'];
465  $total_vat += $sc[$i]['vat_unit'];
466  $total_discount += $discount;
467 
468  if ($sc[$i]['psc_id']) $this->psc_obj->delete($sc[$i]['psc_id']);
469  }
470 
471  if (!empty($_SESSION['coupons'][$this->session_var]))
472  {
473  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
474  {
475  $this->coupon_obj->setId($coupon['pc_pk']);
476  $this->coupon_obj->setCurrentCoupon($coupon);
477  $this->coupon_obj->addTracking();
478  }
479  }
480  }
481 
482  $bookings['total'] = $total;
483  $bookings['total_vat'] = $total_vat;
484  $bookings['total_discount'] = $total_discount;
485  $bookings['transaction'] = $transaction;
486  $bookings['street'] = $book_obj->getStreet();
487  $bookings['zipcode'] = $book_obj->getZipCode();
488  $bookings['city'] = $book_obj->getCity();
489  if(2 == strlen($book_obj->getCountry()))
490  {
491  $bookings['country'] = $this->__getCountryName(strtoupper($book_obj->getCountry()));
492  }
493  else
494  {
495  $bookings['country'] = $book_obj->getCountry();
496  }
497  $bookings['transaction_extern'] = $book_obj->getTransactionExtern();
498 
499  $this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
500  $_SESSION['forceRedirectToShoppingcart'] = 1;
501 
502  $this->__sendBill($bookings);
503  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static _getObjectData($a_id)
static _addPurchasedObjToDesktop($oPaymentObject, $a_user_id=0)
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilUser
Definition: imgupload.php:15
static _assignPurchasedCourseMemberRole($oPaymentObject, $a_user_id=0)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __buildLocator()

ilPurchaseBaseGUI::__buildLocator ( )

Definition at line 776 of file class.ilPurchaseBaseGUI.php.

References ilUtil\sendInfo().

777  {
778  $this->tpl->addBlockFile('LOCATOR', 'locator', 'tpl.locator.html', 'Services/Locator');
779  $this->tpl->setVariable('TXT_LOCATOR',$this->lng->txt('locator'));
780 
781  $this->tpl->setCurrentBlock('locator_item');
782  $this->tpl->setVariable('ITEM', $this->lng->txt('personal_desktop'));
783  $this->tpl->setVariable('LINK_ITEM','../ilias.php?baseClass=ilPersonalDesktopGUI');
784  $this->tpl->parseCurrentBlock();
785 
786  $this->tpl->setCurrentBlock('locator_item');
787  $this->tpl->setVariable('PREFIX','>&nbsp;');
788  $this->tpl->setVariable('ITEM', 'Payment');
789  $this->tpl->setVariable('LINK_ITEM', './payment.php');
790  $this->tpl->parseCurrentBlock();
791 
792  // CHECK for new mail and info
794 
795  return true;
796  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ __buildStatusline()

ilPurchaseBaseGUI::__buildStatusline ( )

Definition at line 770 of file class.ilPurchaseBaseGUI.php.

771  {
772  $this->tpl->addBlockFile('STATUSLINE', 'statusline', 'tpl.statusline.html');
773 # $this->__buildLocator();
774  }

◆ __buildStylesheet()

ilPurchaseBaseGUI::__buildStylesheet ( )

Definition at line 798 of file class.ilPurchaseBaseGUI.php.

References ilUtil\getStyleSheetLocation().

799  {
800  $this->tpl->setVariable('LOCATION_STYLESHEET',ilUtil::getStyleSheetLocation());
801  }
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
+ Here is the call graph for this function:

◆ __clearSession()

ilPurchaseBaseGUI::__clearSession ( )

Definition at line 754 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, and $session_var.

Referenced by ilPurchaseBMFGUI\sendCreditCard(), and ilPurchaseBMFGUI\sendDebitEntry().

755  {
756  $_SESSION['coupons'][$this->session_var] = '';
758  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
+ Here is the caller graph for this function:

◆ __emptyShoppingCart()

ilPurchaseBaseGUI::__emptyShoppingCart ( )

Definition at line 745 of file class.ilPurchaseBaseGUI.php.

Referenced by ilPurchaseBMFGUI\sendCreditCard(), and ilPurchaseBMFGUI\sendDebitEntry().

746  {
747  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
748 
749  $sc_obj =& new ilPaymentShoppingCart($this->user_obj);
750 
751  return $sc_obj->emptyShoppingCart();
752  }
+ Here is the caller graph for this function:

◆ __getCountries()

ilPurchaseBaseGUI::__getCountries ( )

shows select box f�r countries

Definition at line 806 of file class.ilPurchaseBaseGUI.php.

References ilShopBaseGUI\$lng.

Referenced by __getCountryCode(), __getCountryName(), ilPurchaseBMFGUI\showPersonalData(), and showPersonalData().

807  {
808  global $lng;
809 
810  $lng->loadLanguageModule('meta');
811 
812  $cntcodes = array ('DE','ES','FR','GB','AT','CH','AF','AL','DZ','AS','AD','AO',
813  'AI','AQ','AG','AR','AM','AW','AU','AT','AZ','BS','BH','BD','BB','BY',
814  'BE','BZ','BJ','BM','BT','BO','BA','BW','BV','BR','IO','BN','BG','BF',
815  'BI','KH','CM','CA','CV','KY','CF','TD','CL','CN','CX','CC','CO','KM',
816  'CG','CK','CR','CI','HR','CU','CY','CZ','DK','DJ','DM','DO','TP','EC',
817  'EG','SV','GQ','ER','EE','ET','FK','FO','FJ','FI','FR','FX','GF','PF',
818  'TF','GA','GM','GE','DE','GH','GI','GR','GL','GD','GP','GU','GT','GN',
819  'GW','GY','HT','HM','HN','HU','IS','IN','ID','IR','IQ','IE','IL','IT',
820  'JM','JP','JO','KZ','KE','KI','KP','KR','KW','KG','LA','LV','LB','LS',
821  'LR','LY','LI','LT','LU','MO','MK','MG','MW','MY','MV','ML','MT','MH',
822  'MQ','MR','MU','YT','MX','FM','MD','MC','MN','MS','MA','MZ','MM','NA',
823  'NR','NP','NL','AN','NC','NZ','NI','NE','NG','NU','NF','MP','NO','OM',
824  'PK','PW','PA','PG','PY','PE','PH','PN','PL','PT','PR','QA','RE','RO',
825  'RU','RW','KN','LC','VC','WS','SM','ST','SA','CH','SN','SC','SL','SG',
826  'SK','SI','SB','SO','ZA','GS','ES','LK','SH','PM','SD','SR','SJ','SZ',
827  'SE','SY','TW','TJ','TZ','TH','TG','TK','TO','TT','TN','TR','TM','TC',
828  'TV','UG','UA','AE','GB','UY','US','UM','UZ','VU','VA','VE','VN','VG',
829  'VI','WF','EH','YE','ZR','ZM','ZW');
830  $cntrs = array();
831  foreach($cntcodes as $cntcode)
832  {
833  $cntrs[$cntcode] = $lng->txt('meta_c_'.$cntcode);
834  }
835  asort($cntrs);
836  return $cntrs;
837  }
+ Here is the caller graph for this function:

◆ __getCountryCode()

ilPurchaseBaseGUI::__getCountryCode (   $value = '')

Definition at line 839 of file class.ilPurchaseBaseGUI.php.

References __getCountries().

Referenced by __construct().

840  {
841  $countries = $this->__getCountries();
842  foreach($countries as $code => $text)
843  {
844  if ($text == $value)
845  {
846  return $code;
847  }
848  }
849  return true;
850  }
__getCountries()
shows select box f�r countries
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getCountryName()

ilPurchaseBaseGUI::__getCountryName (   $value = '')

Definition at line 852 of file class.ilPurchaseBaseGUI.php.

References __getCountries().

Referenced by __addBookings().

853  {
854  $countries = $this->__getCountries();
855  return $countries[$value];
856  }
__getCountries()
shows select box f�r countries
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getShoppingCart()

ilPurchaseBaseGUI::__getShoppingCart ( )
private

Definition at line 858 of file class.ilPurchaseBaseGUI.php.

References ilPaymentPrices\_getPrice(), and ilObjectFactory\getInstanceByRefId().

Referenced by __getTotalAmount().

859  {
860  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
861 
862  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
863  {
864  return 0;
865  }
866 
867  $counter = 0;
868  foreach($items as $item)
869  {
870  $tmp_pobject =& new ilPaymentObject($this->user_obj,$item['pobject_id']);
871 
872  $tmp_obj =& ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
873  if($tmp_obj)
874  {
875  $f_result[$counter]["object_title"] = $tmp_obj->getTitle();
876  }
877  else
878  {
879  $f_result[$counter]["object_title"] = $this->lng->txt('object_not_found');
880  }
881 
882  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
883 
884  $price = (float) $price_arr['price'];
885  $f_result[$counter]['price'] = $price * 1.0;
886 
887  unset($tmp_obj);
888  unset($tmp_pobject);
889 
890  ++$counter;
891  }
892 
893  return $f_result;
894  }
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getPrice($a_price_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getTotalAmount()

ilPurchaseBaseGUI::__getTotalAmount ( )

depricated!?

Returns
int

Definition at line 899 of file class.ilPurchaseBaseGUI.php.

References $result, and __getShoppingCart().

900  {
901  $amount = 0;
902 
903  if (is_array($result = $this->__getShoppingCart()))
904  {
905  for ($i = 0; $i < count($result); $i++)
906  {
907  $amount += $result[$i]['price'];
908  }
909  }
910  return $amount;
911  }
$result
+ Here is the call graph for this function:

◆ __loadTemplate()

ilPurchaseBaseGUI::__loadTemplate ( )

Definition at line 760 of file class.ilPurchaseBaseGUI.php.

Referenced by __construct().

761  {
762  global $ilTabs;
763 
764  parent::prepareOutput();
765 
766  $ilTabs->setTabActive('paya_shopping_cart');
767  $this->tpl->getStandardTemplate();
768  }
+ Here is the caller graph for this function:

◆ __sendBill()

ilPurchaseBaseGUI::__sendBill (   $bookings)

Definition at line 505 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, $ilSetting, $tpl, ilUtil\_getHttpPath(), ilPaymentSettings\_getInstance(), ilRTE\_replaceMediaObjectImageSrc(), ilDatePresentation\formatDate(), ilMimeMail\From(), ilPayMethods\getStringByPaymethod(), ilUtil\html2pdf(), IL_CAL_DATE, IL_CAL_UNIX, ilUtil\makeDir(), ilBillingMailPlaceholdersPropertyGUI\replaceBillingMailPlaceholders(), and ilDatePresentation\setUseRelativeDates().

Referenced by __addBookings().

506  {
507  global $tpl, $ilSetting;
508 
509  $i = 0;
510 
511  include_once './Services/UICore/classes/class.ilTemplate.php';
512  include_once './Services/Utilities/classes/class.ilUtil.php';
513  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
514  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
515  include_once 'Services/Mail/classes/class.ilMimeMail.php';
516 
517 // $psc_obj = new ilPaymentShoppingCart($this->user_obj);
519  $currency = $genSet->get('currency_unit');
520 
521 // $tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
522  $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
523 
524  if($tpl->placeholderExists('HTTP_PATH'))
525  {
526  $http_path = ilUtil::_getHttpPath();
527  $tpl->setVariable('HTTP_PATH', $http_path);
528  }
530  $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['order_date'], IL_CAL_UNIX))));
531  $tpl->setVariable('TXT_CREDIT', utf8_decode($this->lng->txt('credit')));
532  $tpl->setVariable('TXT_DAY_OF_SERVICE_PROVISION',$this->lng->txt('day_of_service_provision'));
533  include_once './Services/Payment/classes/class.ilPayMethods.php';
534  $str_paymethod = ilPayMethods::getStringByPaymethod($bookings['list'][$i]['b_pay_method']);
535  if(strlen(trim($bookings['transaction_extern'])))
536  {
537  $tpl->setVariable('TXT_EXTERNAL_BILL_NO', str_replace('%s',$str_paymethod,utf8_decode($this->lng->txt('external_bill_no'))));
538  $tpl->setVariable('EXTERNAL_BILL_NO', $bookings['transaction_extern']);
539  }
540  $tpl->setVariable('TXT_POSITION',$this->lng->txt('position'));
541  $tpl->setVariable('TXT_AMOUNT',$this->lng->txt('amount'));
542  $tpl->setVariable('TXT_UNIT_PRICE', utf8_decode($this->lng->txt('unit_price')));
543 
544  $tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address'))));
545  $tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info'))));
546  $tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data'))));
547  $tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data')));
548 
549 
550  $tpl->setVariable('CUSTOMER_FIRSTNAME', utf8_decode($this->user_obj->getFirstname()));
551  $tpl->setVariable('CUSTOMER_LASTNAME',utf8_decode( $this->user_obj->getLastname()));
552  if($bookings['po_box']== '')
553  {
554  $tpl->setVariable('CUSTOMER_STREET', utf8_decode( $bookings['street'])); // contains also housenumber
555  }
556  else
557  {
558  $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings['po_box']));
559  }
560  $tpl->setVariable('CUSTOMER_ZIPCODE', utf8_decode($bookings['zipcode']));
561  $tpl->setVariable('CUSTOMER_CITY', utf8_decode($bookings['city']));
562  $tpl->setVariable('CUSTOMER_COUNTRY', utf8_decode($bookings['country']));
563 
564  $tpl->setVariable('BILL_NO', $bookings['transaction']);
565  $tpl->setVariable('DATE', date('d.m.Y'));
566 
567  $tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill')));
568  $tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no')));
569  $tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date')));
570 
571  $tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article')));
572  $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
573  $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
574  $tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a')));
575 
576  for ($i = 0; $i < count($bookings['list']); $i++)
577  {
578  $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings['list'][$i]['pobject_id']);
579 
580  $assigned_coupons = '';
581  if (!empty($_SESSION['coupons'][$this->session_var]))
582  {
583  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
584  {
585  $this->coupon_obj->setId($coupon['pc_pk']);
586  $this->coupon_obj->setCurrentCoupon($coupon);
587 
588  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
589  {
590  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
591  }
592  }
593  }
594 
595  $tpl->setCurrentBlock('loop');
596  $tpl->setVariable('LOOP_POSITION', $i+1);
597  $tpl->setVariable('LOOP_AMOUNT', '1');
598  $tpl->setVariable('LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt('period_of_service_provision')));
599 
600  $tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($bookings['list'][$i]['type'])));
601  $tpl->setVariable('LOOP_TITLE',$tmp = utf8_decode($bookings['list'][$i]['title']));
602  $tpl->setVariable('LOOP_COUPON', utf8_decode( $assigned_coupons));
603  $tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve')));
604 
605  if( $bookings['list'][$i]['duration'] == 0 && $bookings['list'][$i]['access_enddate'] == NULL)
606  {
607  $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
608  }
609  else
610  {
611  $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_startdate'], IL_CAL_DATE)));
612  $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings['list'][$i]['access_enddate'], IL_CAL_DATE)));
613 
614 
615  $tmp_duration = $access_startdate.' - '.$access_enddate;
616  if($bookings['list'][$i]['duration'] > 0)
617  {
618  $tmp_duration .= ' / '.$bookings['list'][$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months'));
619  }
620  $tpl->setVariable('LOOP_DURATION', $tmp_duration);
621  }
622  #$currency = $bookings['list'][$i]['currency_unit'];
623  $tpl->setVariable('LOOP_VAT_RATE', number_format($bookings['list'][$i]['vat_rate'], 2, ',', '.').' %');
624  $tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings['list'][$i]['vat_unit'], 2, ',', '.').' '.$currency);
625  $tpl->setVariable('LOOP_PRICE', number_format($bookings['list'][$i]['price'], 2, ',', '.').' '.$currency);
626  $tpl->setVariable('LOOP_UNIT_PRICE',number_format($bookings['list'][$i]['price'], 2, ',', '.').' '.$currency);
627  $tpl->parseCurrentBlock('loop');
628 
629 
630  $bookings['total'] += (float)$bookings[$i]['price'];
631  $bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
632  #$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
633  unset($tmp_pobject);
634 
635  $sub_total_amount = $bookings['total'];
636  }
637 
638  $bookings['total'] += $bookings['total_discount'];
639  if($bookings['total_discount'] < 0)
640  {
641  $tpl->setCurrentBlock('cloop');
642 
643  $tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount')));
644  $tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency);
645 
646  $tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon')));
647  $tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency);
648  $tpl->parseCurrentBlock();
649  }
650 
651  if ($bookings['total'] < 0)
652  {
653  $bookings['total'] = 0.00;
654  // $bookings['total_vat'] = 0.0;
655  }
656  $total_net_price = $sub_total_amount-$bookings['total_vat'];
657 
658  $tpl->setVariable('TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt('total_netprice')));
659  $tpl->setVariable('TOTAL_NETPRICE', number_format($total_net_price, 2, ',', '.') . ' ' . $currency);
660 
661  $tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount')));
662  $tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency);
663  if ($bookings['total_vat'] > 0)
664  {
665  $tpl->setVariable('TOTAL_VAT',number_format( $bookings['total_vat'], 2, ',', '.') . ' ' .$currency);
666  $tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('plus_vat')));
667  }
668  if(1 == $bookings['list'][0]['b_pay_method'])
669  {
670  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
671  }
672  else
673  {
674  $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
675  }
676 
677  if (!@file_exists($genSet->get('pdf_path')))
678  {
679 
680  ilUtil::makeDir($genSet->get('pdf_path'));
681  }
682 
683  $file_name = time();
684  if (@file_exists($genSet->get('pdf_path')))
685  {
686  ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
687  }
688 
689  if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf') &&
690  $this->user_obj->getEmail() != '' &&
691  $ilSetting->get('admin_email') != '')
692  {
693  $m= new ilMimeMail; // create the mail
694  $m->From( $ilSetting->get('admin_email') );
695  $m->To( $this->user_obj->getEmail() );
696  $m->Subject( $this->lng->txt('pay_message_subject') );
697 
698  // if there is no mailbillingtext use this as standard
699  $message = $this->lng->txt('pay_message_hello') . ' ' . $this->user_obj->getFirstname() . ' ' . $this->user_obj->getLastname() . ",\n\n";
700  $message .= $this->lng->txt('pay_message_thanks') . "\n\n";
701  $message .= $this->lng->txt('pay_message_attachment') . "\n\n";
702  $message .= $this->lng->txt('pay_message_regards') . "\n\n";
703  $message .= strip_tags($genSet->get('address'));
704 
705  //replacePlaceholders...
706  $billing_text = $genSet->getMailBillingText();
707  if(!$billing_text)
708  {
709  $message = '';
710  }
711  if($genSet->getMailUsePlaceholders() == 1)
712  {
713  include_once './Services/Payment/classes/class.ilBillingMailPlaceholdersPropertyGUI.php';
714  $message = ilBillingMailPlaceholdersPropertyGUI::replaceBillingMailPlaceholders($billing_text, $this->user_obj->getId());
715  }
716 
717  $m->Body( $message ); // set the body
718  $m->Attach( $genSet->get('pdf_path') . '/' . $file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
719  if($genSet->get('attach_sr_invoice') == 1)
720  {
721  require_once 'Services/RTE/classes/class.ilRTE.php';
722  $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'),1);
723  $reg_file_name = 'statutory_regulations';
724  if (@file_exists($genSet->get('pdf_path')))
725  {
726  ilUtil::html2pdf($regulations, $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf');
727  }
728 
729  $m->Attach( $genSet->get('pdf_path') . '/' . $reg_file_name . '.pdf', 'application/pdf' ) ; // attach a file of type image/gif
730  }
731 
732  $m->Send(); // send the mail
733  }
734 
735  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
736  @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
737 
738  unset($current_booking_id);
739  unset($pobject);
740  unset($_SESSION['coupons'][$this->session_var]);
741 
742  $this->ctrl->redirectByClass('ilShopBoughtObjectsGUI', '');
743  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static getStringByPaymethod($a_type)
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static html2pdf($html, $pdf_file)
produce pdf out of html with htmldoc
Class for single dates.
this class encapsulates the PHP mail() function.
From($from)
set the sender of the mail
special template class to simplify handling of ITX/PEAR
static formatDate(ilDateTime $date)
Format a date public.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
const IL_CAL_DATE
static _getHttpPath()
global $ilSetting
Definition: privfeed.php:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showItemsTable()

ilPurchaseBaseGUI::__showItemsTable (   $a_result_set)
private

Definition at line 1003 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, $pm_id, ilPaymentSettings\_getInstance(), and ilPaymentPrices\_getPrice().

Referenced by __showShoppingCart().

1004  {
1005  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
1006 
1007  $genSet = ilPaymentSettings::_getInstance();
1008  include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
1009 
1010  $tbl = new ilShoppingCartTableGUI($this);
1011  $tbl->setId('tbl_id_'.$this->session_var);
1012  $tbl->setTitle($this->lng->txt('paya_shopping_cart'));
1013  /*
1014  " (".$this->lng->txt('payment_system').": ".
1015  ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) .")");
1016  */
1017  $tbl->setRowTemplate("tpl.shop_shoppingcart_row.html", "Services/Payment");
1018  $tbl->addColumn('','item','1%');
1019  $tbl->addColumn($this->lng->txt('title'), 'title', '30%');
1020  $tbl->addColumn($this->lng->txt('duration'),'duration', '30%');
1021  $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '15%');
1022  $tbl->addColumn($this->lng->txt('vat_unit'), 'vat_unit', '15%');
1023  $tbl->addColumn($this->lng->txt('price_a'), 'price', '10%');
1024  $tbl->disable('sort');
1025 
1026  #$tbl->setPrefix("table". $a_pay_method['pm_title']."_");
1027 
1028  // show total amount of costs
1029  $sc_obj = new ilPaymentShoppingCart($this->user_obj);
1030  $totalAmount = $sc_obj->getTotalAmount();
1031 
1032  if (!empty($_SESSION['coupons'][$this->session_var]))
1033  {
1034  if (count($items = $sc_obj->getEntries($this->pm_id)))
1035  {
1036  $tbl->setTotalData('TXT_SUB_TOTAL', $this->lng->txt('pay_bmf_subtotal_amount') . ": ");
1037  $tbl->setTotalData('VAL_SUB_TOTAL', number_format($totalAmount[$this->pm_id], 2, ',', '.') . " " . $genSet->get('currency_unit'));
1038  #$tbl->setTotalData('VAL_SUB_TOTAL',ilPaymentPrices::_formatPriceToString($totalAmount[$a_pay_method['pm_id']], (int)$this->default_currency['currency_id'] ));
1039 
1040  $totalAmount['current_coupon_bonus'] = 0;
1041  foreach ($_SESSION['coupons'][$this->session_var] as $coupon)
1042  {
1043  $this->coupon_obj->setId($coupon['pc_pk']);
1044  $this->coupon_obj->setCurrentCoupon($coupon);
1045 
1046  $total_object_price = 0.0;
1047  $current_coupon_bonus = 0.0;
1048 
1049  foreach ($items as $item)
1050  {
1051  $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
1052 
1053  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
1054  {
1055  $price_data = ilPaymentPrices::_getPrice($item['price_id']);
1056  $price = (float) $price_data['price'];
1057 
1058  $total_object_price += $price;
1059  }
1060  unset($tmp_pobject);
1061  }
1062  $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
1063  $totalAmount['current_coupon_bonus'] += $current_coupon_bonus * (-1);
1064  }
1065  $tbl->setTotalData('TXT_COUPON_BONUS', $this->lng->txt('paya_coupons_coupon') . ": ");# . $coupon['pcc_code'] . ": ");
1066  $tbl->setTotalData('VAL_COUPON_BONUS', number_format($totalAmount['current_coupon_bonus'], 2, ',', '.') . " " . $genSet->get('currency_unit'));
1067 
1068 
1069  if ($totalAmount[$this->pm_id] < 0)
1070  {
1071  $totalAmount[$this->pm_id] = 0;
1072  $this->totalVat = 0;
1073  }
1074  }
1075  }
1076 
1077  $this->totalAmount[$this->pm_id] = $totalAmount[$this->pm_id]-($totalAmount['current_coupon_bonus'] * (-1));
1078 
1079  $tbl->setTotalData('TXT_TOTAL_AMOUNT', $this->lng->txt('pay_bmf_total_amount').": ");
1080  $tbl->setTotalData('VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$this->pm_id] , 2, ',', '.') . " " . $genSet->get('currency_unit')); #.$item['currency']);
1081 
1082  if ($this->totalVat > 0)
1083  {
1084  $tbl->setTotalData('TXT_TOTAL_VAT', $this->lng->txt('pay_bmf_vat_included') . ": ");
1085  $tbl->setTotalData('VAL_TOTAL_VAT', number_format($this->totalVat , 2, ',', '.') . " " . $genSet->get('currency_unit'));
1086  }
1087 
1088  $tbl->setData($a_result_set);
1089  $this->tpl->setVariable('ITEMS_TABLE',$tbl->getCartHTML());
1090 
1091  return true;
1092  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
Class ilShoppingCartTableGUI.
static _getPrice($a_price_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showShoppingCart()

ilPurchaseBaseGUI::__showShoppingCart ( )

Definition at line 922 of file class.ilPurchaseBaseGUI.php.

References $_SESSION, __showItemsTable(), ilShopUtils\_formatVAT(), ilPaymentSettings\_getInstance(), ilPaymentPrices\_getPrice(), ilDatePresentation\formatDate(), ilObjectFactory\getInstanceByRefId(), IL_CAL_DATE, ilUtil\sendInfo(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

Referenced by showBillConfirm(), ilPurchaseBMFGUI\showCreditCard(), and ilPurchaseBMFGUI\showDebitEntry().

923  {
924  include_once './Services/Payment/classes/class.ilPaymentSettings.php';
925 
927 
928  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
929 
930  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
931  {
932  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
933  }
934 
935  $counter = 0;
936  foreach($items as $item)
937  {
938  $tmp_pobject = new ilPaymentObject($this->user_obj,$item['pobject_id']);
939 
940  $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject->getRefId(), false);
941 
942  $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
943 
944  $assigned_coupons = '';
945  if (!empty($_SESSION['coupons'][$this->session_var]))
946  {
947  foreach ($_SESSION['coupons'][$this->session_var] as $key => $coupon)
948  {
949  $this->coupon_obj->setId($coupon['pc_pk']);
950  $this->coupon_obj->setCurrentCoupon($coupon);
951 
952  if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId()))
953  {
954  $assigned_coupons .= '<br />' . $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
955  }
956  }
957  }
958  $f_result[$counter]['item'] = '';
959  if($tmp_obj)
960  {
961  $f_result[$counter]['title'] = $tmp_obj->getTitle();
962  }
963  else
964  {
965  $f_result[$counter]['title'] = $this->lng->txt('object_not_found');
966  }
967  if ($assigned_coupons != '') $f_result[$counter][count($f_result[$counter]) - 1] .= $assigned_coupons;
968 
969  switch($price_arr['price_type'])
970  {
972  $f_result[$counter]['duration'] = $price_arr['duration'] . ' ' . $this->lng->txt('paya_months');
973  break;
975  $f_result[$counter]['duration'] =
976  ilDatePresentation::formatDate(new ilDate($price_arr['duration_from'], IL_CAL_DATE))
977  .' - '.ilDatePresentation::formatDate(new ilDate($price_arr['duration_until'], IL_CAL_DATE));
978  break;
980  $f_result[$counter]['duration'] = $this->lng->txt('unlimited_duration');
981  break;
982  }
983 
984  $oVAT = new ilShopVats((int)$tmp_pobject->getVatId());
985  $f_result[$counter]['vat_rate'] = ilShopUtils::_formatVAT($oVAT->getRate());
986 
987  $float_price = $price_arr['price'];
988 
989  $f_result[$counter]['vat_unit'] = $tmp_pobject->getVat($float_price, 'GUI').' '.$genSet->get('currency_unit');
990  $this->totalVat = $this->totalVat + $tmp_pobject->getVat($float_price);
991 
992  $f_result[$counter]['price'] = number_format($float_price, 2, ',', '.') .' '.$genSet->get('currency_unit');
993 
994  unset($tmp_obj);
995  unset($tmp_pobject);
996 
997  ++$counter;
998  }
999 
1000  return $this->__showItemsTable($f_result);
1001  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
Class ilShopVats.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getPrice($a_price_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class for single dates.
static formatDate(ilDateTime $date)
Format a date public.
static _formatVAT($a_vat)
Formats a vat rate for gui output.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilPurchaseBaseGUI::cancel ( )

Definition at line 98 of file class.ilPurchaseBaseGUI.php.

References ilUtil\redirect().

99  {
100  ilUtil::redirect('./payment.php');
101  }
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ executeCommand()

ilPurchaseBaseGUI::executeCommand ( )

execute command

Definition at line 269 of file class.ilPurchaseBaseGUI.php.

References $cmd.

270  {
271  $cmd = $this->ctrl->getCmd();
272 
273  switch ($this->ctrl->getNextClass($this))
274  {
275  default:
276  if(!$cmd = $this->ctrl->getCmd())
277  {
278  $cmd = 'showPersonalData';
279  }
280  $this->$cmd();
281  break;
282  }
283  }
$cmd
Definition: sahs_server.php:35

◆ getAccess()

ilPurchaseBaseGUI::getAccess ( )
Returns
int

Definition at line 1097 of file class.ilPurchaseBaseGUI.php.

References $access.

Referenced by __addBookings().

1098  {
1099  return $this->access;
1100  }
+ Here is the caller graph for this function:

◆ getBill()

ilPurchaseBaseGUI::getBill ( )

Definition at line 914 of file class.ilPurchaseBaseGUI.php.

References __addBookings(), and ilUtil\sendInfo().

915  {
916  $this->error = '';
917  ilUtil::sendInfo($this->lng->txt('pay_message_thanks'));
918 
919  $this->__addBookings();
920  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
__addBookings($external_data=null)
+ Here is the call graph for this function:

◆ getPayed()

ilPurchaseBaseGUI::getPayed ( )
Returns
int

Definition at line 1113 of file class.ilPurchaseBaseGUI.php.

References $payed.

Referenced by __addBookings().

1114  {
1115  return $this->payed;
1116  }
+ Here is the caller graph for this function:

◆ getPersonalData()

ilPurchaseBaseGUI::getPersonalData ( )

Definition at line 185 of file class.ilPurchaseBaseGUI.php.

References $_POST, $_SESSION, $session_var, ilUtil\sendInfo(), showBillConfirm(), and showPersonalData().

186  {
187 
188  if ($_SESSION[$this->session_var]['personal_data']['firstname'] == '' ||
189  $_SESSION[$this->session_var]['personal_data']['lastname'] == '' ||
190  $_POST['zipcode'] == '' ||
191  $_POST['city'] == '' ||
192  $_POST['country'] == '' ||
193  $_SESSION[$this->session_var]['personal_data']['email'] == '')
194  {
195 
196  $this->error = $this->lng->txt('pay_bmf_personal_data_not_valid');
197  ilUtil::sendInfo($this->error);
198  $this->showPersonalData();
199  return;
200  }
201 
202  if (($_POST['street'] == '' && $_POST['house_number'] == '' && $_POST['po_box'] == '') ||
203  (($_POST['street'] != '' || $_POST['house_number'] != '') && $_POST['po_box'] != '') ||
204  ($_POST['street'] != '' && $_POST['house_number'] == '') ||
205  ($_POST['street'] == '' && $_POST['house_number'] != ''))
206  {
207  $this->error = $this->lng->txt('pay_bmf_street_or_pobox');
208  ilUtil::sendInfo($this->error);
209  $this->showPersonalData();
210  return;
211  }
212 
213  $_SESSION[$this->session_var]['personal_data']['firstname'] = $this->user_obj->getFirstname();
214  $_SESSION[$this->session_var]['personal_data']['lastname'] = $this->user_obj->getLastname();
215  $_SESSION[$this->session_var]['personal_data']['street'] = $_POST['street'];
216  $_SESSION[$this->session_var]['personal_data']['house_number'] = $_POST['house_number'];
217  $_SESSION[$this->session_var]['personal_data']['po_box'] = $_POST['po_box'];
218  $_SESSION[$this->session_var]['personal_data']['zipcode'] = $_POST['zipcode'];
219  $_SESSION[$this->session_var]['personal_data']['city'] = $_POST['city'];
220  $_SESSION[$this->session_var]['personal_data']['country'] = $_POST['country'];
221 
222  $_SESSION[$this->session_var]['personal_data']['email'] = $this->user_obj->getEmail();
223  $_SESSION[$this->session_var]['personal_data']['language'] = $this->user_obj->getLanguage();
224 
225  $this->error = '';
226  $this->showBillConfirm();
227 
228  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ setAccess()

ilPurchaseBaseGUI::setAccess (   $access)
Parameters
int$access

Definition at line 1105 of file class.ilPurchaseBaseGUI.php.

References $access.

Referenced by ilPurchaseBillGUI\__construct().

1106  {
1107  $this->access = $access;
1108  }
+ Here is the caller graph for this function:

◆ setPayed()

ilPurchaseBaseGUI::setPayed (   $payed)
Parameters
int$payed

Definition at line 1121 of file class.ilPurchaseBaseGUI.php.

References $payed.

Referenced by ilPurchaseBillGUI\__construct().

1122  {
1123  $this->payed = $payed;
1124  }
+ Here is the caller graph for this function:

◆ showBillConfirm()

ilPurchaseBaseGUI::showBillConfirm ( )

Definition at line 230 of file class.ilPurchaseBaseGUI.php.

References __showShoppingCart(), and ilUtil\sendInfo().

Referenced by getPersonalData().

231  {
232  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
233 
234  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
235  {
236  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
237  $this->tpl->touchBlock('stop_floating');
238  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
239  }
240  else
241  {
242  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bill_confirm.html','Services/Payment');
243 
244  $this->__showShoppingCart();
245 
246  $this->tpl->setVariable('BILL_CONFIRM_FORMACTION',$this->ctrl->getFormAction($this));
247 
248  // set table header
249  $this->tpl->setVariable('ALT_IMG',$this->lng->txt('obj_usr'));
250 
251  // set plain text variables
252  $this->tpl->setVariable('TXT_CONFIRM_ORDER',$this->lng->txt('pay_confirm_order'));
253 
254  $this->tpl->setVariable('INPUT_VALUE',$this->lng->txt('pay_send_order'));
255  $this->tpl->setVariable('CANCEL',$this->lng->txt('cancel'));
256 
257  // Button
258  $this->tpl->addBlockfile('BUTTONS', 'buttons', 'tpl.buttons.html');
259  $this->tpl->setCurrentBlock('btn_cell');
260  $this->tpl->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'showPersonalData'));
261  $this->tpl->setVariable('BTN_TXT', $this->lng->txt('pay_bmf_back'));
262  $this->tpl->parseCurrentBlock('btn_cell');
263  }
264  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPersonalData()

ilPurchaseBaseGUI::showPersonalData ( )

Definition at line 103 of file class.ilPurchaseBaseGUI.php.

References $_POST, $_SESSION, __getCountries(), ilUtil\prepareFormOutput(), ilUtil\sendInfo(), ilSelectInputGUI\setOptions(), ilTextInputGUI\setValue(), and ilNonEditableValueGUI\setValue().

Referenced by getPersonalData().

104  {
105  $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
106 
107  if(!count($items = $this->psc_obj->getEntries($this->pm_id)))
108  {
109  $this->tpl->setVariable('HEADER',$this->lng->txt('pay_bmf_your_order'));
110  $this->tpl->touchBlock('stop_floating');
111  ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
112  }
113  else
114  {
115  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
116 
117  $oForm = new ilPropertyFormGUI();
118  $oForm->setFormAction($this->ctrl->getFormAction($this, 'getPersonalData'));
119  $oForm->setTitle($this->lng->txt('pay_bmf_personal_data'));
120 
121  $oFirstname = new ilNonEditableValueGUI($this->lng->txt('firstname'));
122  $oFirstname->setValue($this->user_obj->getFirstname());
123  $oForm->addItem($oFirstname);
124 
125  $oLastname = new ilNonEditableValueGUI($this->lng->txt('lastname'));
126  $oLastname->setValue($this->user_obj->getLastname());
127  $oForm->addItem($oLastname);
128 
129  $oStreet = new ilTextInputGUI($this->lng->txt('street'),'street');
130  $oStreet->setValue($this->error != '' && isset($_POST['street'])
131  ? ilUtil::prepareFormOutput($_POST['street'],true)
132  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['street'],true));
133  $oForm->addItem($oStreet);
134 
135  $oHouseNumber = new ilTextInputGUI($this->lng->txt('pay_bmf_house_number'), 'house_number');
136  $oHouseNumber->setValue($this->error != '' && isset($_POST['house_number'])
137  ? ilUtil::prepareFormOutput($_POST['house_number'],true)
138  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['house_number'],true));
139  $oForm->addItem($oHouseNumber);
140 
141  $oPoBox = new ilTextInputGUI($this->lng->txt('pay_bmf_or').' '.$this->lng->txt('pay_bmf_po_box'), 'po_box');
142  $oPoBox->setValue($this->error != '' && isset($_POST['po_box'])
143  ? ilUtil::prepareFormOutput($_POST['po_box'],true)
144  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['po_box'],true));
145  $oForm->addItem($oPoBox);
146 
147  $oZipCode = new ilTextInputGUI($this->lng->txt('zipcode'), 'zipcode');
148  if($this->user_obj->getZipCode() && !isset($_POST['zipcode']))
149  $oZipCode->setValue($this->user_obj->getZipCode());
150  else
151  $oZipCode->setValue($this->error != '' && isset($_POST['zipcode'])
152  ? ilUtil::prepareFormOutput($_POST['zipcode'],true)
153  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['zipcode'],true));
154  $oForm->addItem($oZipCode);
155 
156  $oCity = new ilTextInputGUI($this->lng->txt('city'), 'city');
157  if($this->user_obj->getCity()&& !isset($_POST['city']))
158  $oCity->setValue($this->user_obj->getCity());
159  else
160  $oCity->setValue($this->error != '' && isset($_POST['city'])
161  ? ilUtil::prepareFormOutput($_POST['city'],true)
162  : ilUtil::prepareFormOutput($_SESSION[$this->session_var]['personal_data']['city'],true));
163  $oForm->addItem($oCity);
164 
165  $oCountry = new ilSelectInputGUI($this->lng->txt('country'), 'country');
166  $oCountry->setOptions($this->__getCountries());
167 
168  if($this->user_obj->getSelectedCountry()&& !isset($_POST['country']))
169  $oCountry->setValue($this->user_obj->getSelectedCountry());
170  else
171  $oCountry->setValue($this->error != '' && isset($_POST['country']) ? $_POST['country']
172  : $_SESSION[$this->session_var]['personal_data']['country']);
173  $oForm->addItem($oCountry);
174 
175  $oEmail = new ilNonEditableValueGUI($this->lng->txt('email'));
176  $oEmail->setValue($this->user_obj->getEmail());
177  $oForm->addItem($oEmail);
178 
179  $oForm->addcommandButton('getPersonalData',ucfirst($this->lng->txt('next')));
180 
181  $this->tpl->setVariable('FORM', $oForm->getHTML());
182  }
183  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
$_POST['username']
Definition: cron.php:12
This class represents a selection list property in a property form.
This class represents a property form user interface.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents a text property in a property form.
setOptions($a_options)
Set Options.
This class represents a non editable value in a property form.
setValue($a_value)
Set Value.
__getCountries()
shows select box f�r countries
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilPurchaseBaseGUI::$access = 1
private

Definition at line 39 of file class.ilPurchaseBaseGUI.php.

Referenced by getAccess(), and setAccess().

◆ $coupon_obj

ilPurchaseBaseGUI::$coupon_obj = null

Definition at line 30 of file class.ilPurchaseBaseGUI.php.

◆ $ctrl

ilPurchaseBaseGUI::$ctrl

Definition at line 24 of file class.ilPurchaseBaseGUI.php.

◆ $error

ilPurchaseBaseGUI::$error

Definition at line 31 of file class.ilPurchaseBaseGUI.php.

◆ $payed

ilPurchaseBaseGUI::$payed = 1
private

Definition at line 38 of file class.ilPurchaseBaseGUI.php.

Referenced by getPayed(), and setPayed().

◆ $pm_id

ilPurchaseBaseGUI::$pm_id = 0
private

Definition at line 34 of file class.ilPurchaseBaseGUI.php.

Referenced by __showItemsTable().

◆ $pmethod_obj

ilPurchaseBaseGUI::$pmethod_obj = null

Definition at line 33 of file class.ilPurchaseBaseGUI.php.

◆ $psc_obj

ilPurchaseBaseGUI::$psc_obj = null

Definition at line 27 of file class.ilPurchaseBaseGUI.php.

◆ $session_var

ilPurchaseBaseGUI::$session_var = null
private

◆ $totalVat

ilPurchaseBaseGUI::$totalVat = 0
private

Definition at line 35 of file class.ilPurchaseBaseGUI.php.

◆ $tpl

ilPurchaseBaseGUI::$tpl

Definition at line 25 of file class.ilPurchaseBaseGUI.php.

Referenced by __construct(), and __sendBill().

◆ $user_obj

ilPurchaseBaseGUI::$user_obj = null

Definition at line 28 of file class.ilPurchaseBaseGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: