ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilShopBoughtObjectsGUI Class Reference

Class ilShopBoughtObjectsGUI. More...

+ Inheritance diagram for ilShopBoughtObjectsGUI:
+ Collaboration diagram for ilShopBoughtObjectsGUI:

Public Member Functions

 __construct ($user_obj)
 executeCommand ()
 showBillHistory ()
 createBill ()
 showItems ()
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()

Protected Member Functions

 buildSubTabs ()
 prepareOutput ()
- Protected Member Functions inherited from ilShopBaseGUI
 addPager ($result, $a_session_key)
 setSection ($a_section)
 getSection ()
 setSubSection ($a_sub_section)
 getSubSection ()
 showButton ($a_cmd, $a_text, $a_target= '')
 initTableGUI ()
 setTableGUIBasicData ($tbl, $result_set, $a_default_order_column= '')

Private Member Functions

 showBillHistoryTable ($a_result_set)
 showStatisticTable ($a_result_set)
 initBookingsObject ()

Private Attributes

 $user_obj
 $psc_obj = null

Additional Inherited Members

- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 $ilias = null
 $lng = null
 $tpl = null
 $oGeneralSettings = null
 $section = 0
 $sub_section = 0

Detailed Description

Constructor & Destructor Documentation

ilShopBoughtObjectsGUI::__construct (   $user_obj)

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

References $user_obj, and ilShopBaseGUI\__construct().

{
$this->user_obj = $user_obj;
}

+ Here is the call graph for this function:

Member Function Documentation

ilShopBoughtObjectsGUI::buildSubTabs ( )
protected

Reimplemented from ilShopBaseGUI.

Definition at line 59 of file class.ilShopBoughtObjectsGUI.php.

{
global $ilTabs, $ilUser, $rbacreview;
$ilTabs->addSubTabTarget('paya_buyed_objects', $this->ctrl->getLinkTarget($this, 'showItems'), '', '', '','showItems');
$ilTabs->addSubTabTarget('paya_bill_history', $this->ctrl->getLinkTarget($this, 'showBillHistory'), '', '', '','showBillHistory');
}
ilShopBoughtObjectsGUI::createBill ( )

Definition at line 117 of file class.ilShopBoughtObjectsGUI.php.

References $_GET, ilShopBaseGUI\$ilias, ilShopBaseGUI\$tpl, $user_obj, ilPaymentBookings\__readBillByTransaction(), ilUtil\deliverFile(), ilDatePresentation\formatDate(), ilUtil\html2pdf(), IL_CAL_UNIX, and ilUtil\makeDir().

{
global $ilUser, $ilias, $tpl,$ilObjDataCache;
$customer=$this->user_obj;
$transaction = $_GET['transaction'];
$total_price = 0;
$total_vat = 0;
$i = 0;
include_once './classes/class.ilTemplate.php';
include_once './Services/Utilities/classes/class.ilUtil.php';
include_once './Services/Payment/classes/class.ilGeneralSettings.php';
$genSet = new ilGeneralSettings();
$currency = $genSet->get('currency_unit');
$user_id = $this->user_obj->getId();
$bookings = ilPaymentBookings::__readBillByTransaction($user_id,$transaction);
if($bookings[$i]['street'] == NULL) $bookings[$i]['street'] = nl2br(utf8_decode($customer->getStreet()));
if($bookings[$i]['zipcode'] == NULL) $bookings[$i]['zipcode'] = nl2br(utf8_decode($customer->getZipcode()));
if($bookings[$i]['city'] == NULL) $bookings[$i]['city'] = nl2br(utf8_decode($customer->getCity()));
if($bookings[$i]['country'] == NULL) $bookings[$i]['country'] = nl2br(utf8_decode($customer->getCountry()));
$i = 0;
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_bill.html','Services/Payment');
$tpl = new ilTemplate('./Services/Payment/templates/default/tpl.pay_bill.html', true, true, true);
$tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address'))));
$tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info'))));
$tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data'))));
$tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data')));
$tpl->setVariable('CUSTOMER_FIRSTNAME',$customer->getFirstName());// $customer['vorname']);
$tpl->setVariable('CUSTOMER_LASTNAME', $customer->getLastName()); //$customer['nachname']);
if($bookings['po_box']== '')
{
$tpl->setVariable('CUSTOMER_STREET',utf8_decode( $bookings[$i]['street']));
}
else
{
$tpl->setVariable('CUSTOMER_STREET', $bookings[$i]['po_box']);
}
$tpl->setVariable('CUSTOMER_ZIPCODE', $bookings[$i]['zipcode']);
$tpl->setVariable('CUSTOMER_CITY', $bookings[$i]['city']);
$tpl->setVariable('CUSTOMER_COUNTRY', $bookings[$i]['country']);
$tpl->setVariable('BILL_NO', $transaction);
$tpl->setVariable('DATE', ilDatePresentation::formatDate(new ilDateTime($bookings[$i]['order_date'], IL_CAL_UNIX)));
$tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill')));
$tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no')));
$tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date')));
$tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article')));
$tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
$tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
$tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a')));
for ($i = 0; $i < count($bookings[$i]); $i++)
{
$tmp_pobject = new ilPaymentObject($this->user_obj, $booking[$i]['pobject_id']);
$obj_id = $ilObjDataCache->lookupObjId($bookings[$i]['ref_id']);
$obj_type = $ilObjDataCache->lookupType($obj_id);
$tpl->setCurrentBlock('loop');
$tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type)));
$tpl->setVariable('LOOP_TITLE', utf8_decode($bookings[$i]['object_title']) . $assigned_coupons);
$tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve')));
if( $bookings[$i]['duration'] == 0)
{
$tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
}
else
{
$tpl->setVariable('LOOP_DURATION', $bookings[$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months')));
}
// old one
$tpl->setVariable('LOOP_VAT_RATE',number_format($bookings[$i]['vat_rate'], 2, ',', '.').' %');
$tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings[$i]['vat_unit'], 2, ',', '.').' '.$currency);
$tpl->setVariable('LOOP_PRICE',number_format($bookings[$i]['price'], 2, ',', '.').' '.$currency);
$tpl->parseCurrentBlock('loop');
// TODO: CURRENCY not finished yet
/*****
$currency_symbol = $bookings[$i]['currency_unit'];
$tpl->setVariable('LOOP_VAT_RATE', $bookings[$i]['vat_rate'].' %');
# $tpl->setVariable('LOOP_VAT_UNIT', number_format( $bookings[$i]['vat_unit'], 2, ',', '.').' '.$currency);
# $tpl->setVariable('LOOP_PRICE',number_format( $bookings[$i]['price'], 2, ',', '.').' '.$currency);
$tpl->setVariable('LOOP_VAT_UNIT',utf8_decode( ilPaymentCurrency::_formatPriceToString($bookings[$i]['vat_unit'], $currency_symbol)));
$tpl->setVariable('LOOP_PRICE', utf8_decode(ilPaymentCurrency::_formatPriceToString($bookings[$i]['price'], $currency_symbol)));
$tpl->parseCurrentBlock('loop');
/***** */
$bookings['total'] += (float)$bookings[$i]['price'];
$bookings['total_vat']+= (float)$bookings[$i]['vat_unit'];
$bookings['total_discount'] +=(float) $bookings[$i]['discount'];
unset($tmp_pobject);
$sub_total_amount = $bookings['total'];
}
if($bookings['total_discount'] < 0)
{
$tpl->setCurrentBlock('cloop');
$tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon') . ' ' . $coupon['pcc_code']));
$tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency);
// TODO: CURRENCY $tpl->setVariable('BONUS', ilPaymentCurrency::_formatPriceToString($current_coupon_bonus * (-1),$currency_symbol));
$tpl->parseCurrentBlock();
}
$bookings['total'] += $bookings['total_discount'];
$tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount')));
$tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency);
// TODO: CURRENCY $tpl->setVariable('SUBTOTAL_AMOUNT', ilPaymentCurrency::_formatPriceToString($sub_total_amount, $currency_symbol));
if ($bookings['total'] < 0)
{
$bookings['total'] = 0.00;
// $bookings['total_vat'] = 0.0;
}
$tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount')));
$tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency);
// TODO: CURRENCY $tpl->setVariable('TOTAL_AMOUNT',utf8_decode(ilPaymentCurrency::_formatPriceToString($bookings['total'], $currency_symbol) ));
if ($bookings['total_vat'] > 0)
{
$tpl->setVariable('TOTAL_VAT',number_format( $bookings['total_vat'], 2, ',', '.') . ' ' .$currency);
// TODO: CURRENCY $tpl->setVariable('TOTAL_VAT',ilPaymentCurrency::_formatPriceToString($bookings['total_vat'],$currency_symbol));
$tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('pay_bmf_vat_included')));
}
$tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
if (!@file_exists($genSet->get('pdf_path')))
{
ilUtil::makeDir($genSet->get('pdf_path'));
}
if (@file_exists($genSet->get('pdf_path')))
{
ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $transaction . '.pdf');
}
if (@file_exists($genSet->get('pdf_path') . '/' . $transaction . '.pdf'))
{
$genSet->get('pdf_path') . '/' . $transaction . '.pdf',
$transaction . '.pdf',
$a_mime = 'application/pdf'
);
}
@unlink($genSet->get('pdf_path') . '/' . $transaction . '.html');
@unlink($genSet->get('pdf_path') . '/' . $transaction . '.pdf');
}

+ Here is the call graph for this function:

ilShopBoughtObjectsGUI::executeCommand ( )

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

References $_SESSION, $cmd, and prepareOutput().

{
global $ilUser;
if(ANONYMOUS_USER_ID == $ilUser->getId() && !isset($_SESSION['download_links']));
{
// $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
}
$cmd = $this->ctrl->getCmd();
switch ($this->ctrl->getNextClass($this))
{
case 'showBillHistory':
$this->$cmd();
break;
default:
$this->prepareOutput();
if(!$cmd = $this->ctrl->getCmd())
{
$cmd = 'showItems';
}
$this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilShopBoughtObjectsGUI::initBookingsObject ( )
private

Definition at line 417 of file class.ilShopBoughtObjectsGUI.php.

Referenced by showBillHistory(), and showItems().

{
include_once './Services/Payment/classes/class.ilPaymentBookings.php';
$this->bookings_obj = new ilPaymentBookings();
return true;
}

+ Here is the caller graph for this function:

ilShopBoughtObjectsGUI::prepareOutput ( )
protected

Reimplemented from ilShopBaseGUI.

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

Referenced by executeCommand().

{
global $ilTabs;
$ilTabs->setTabActive('paya_buyed_objects');
$ilTabs->setSubTabActive('paya_buyed_objects');
}

+ Here is the caller graph for this function:

ilShopBoughtObjectsGUI::showBillHistory ( )

Definition at line 67 of file class.ilShopBoughtObjectsGUI.php.

References ilDatePresentation\formatDate(), IL_CAL_UNIX, initBookingsObject(), ilUtil\sendInfo(), and showBillHistoryTable().

{
global $ilTabs;
include_once "./Services/Repository/classes/class.ilRepositoryExplorer.php";
$ilTabs->setSubTabActive('paya_bill_history');
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
$bookings = $this->bookings_obj->getDistinctTransactions($this->user_obj->getId());
if(!count($bookings))
{
ilUtil::sendInfo($this->lng->txt('pay_not_buyed_any_object'));
return true;
}
$counter = 0;
foreach($bookings as $booking)
{
$f_result[$counter]['transaction'] = "<a href=\"".$this->ctrl->getLinkTarget($this, "createBill")."&transaction=".$booking['transaction']."\">".$booking['transaction'].".pdf</a>";
$f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX));
++$counter;
}
return $this->showBillHistoryTable($f_result);
}

+ Here is the call graph for this function:

ilShopBoughtObjectsGUI::showBillHistoryTable (   $a_result_set)
private

Definition at line 100 of file class.ilShopBoughtObjectsGUI.php.

Referenced by showBillHistory().

{
$this->ctrl->setParameter($this,'cmd','showBillHistory');
$tbl = new ilShopTableGUI($this);
$tbl->setId('tbl_bill_history');
$tbl->setTitle($this->lng->txt("paya_bill_history"));
$tbl->setRowTemplate("tpl.shop_statistics_row.html", "Services/Payment");
$tbl->addColumn($this->lng->txt('paya_transaction'), 'transaction', '10%');
$tbl->addColumn($this->lng->txt('paya_order_date'), 'order_date', '10%');
$tbl->setData($a_result_set);
$this->tpl->setVariable('TABLE', $tbl->getHTML());
return true;
}

+ Here is the caller graph for this function:

ilShopBoughtObjectsGUI::showItems ( )

Definition at line 294 of file class.ilShopBoughtObjectsGUI.php.

References ilRepositoryExplorer\buildFrameTarget(), ilRepositoryExplorer\buildLinkTarget(), ilDatePresentation\formatDate(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), ilPayMethods\getStringByPaymethod(), IL_CAL_UNIX, initBookingsObject(), ilUtil\sendInfo(), and showStatisticTable().

{
include_once "./Services/Repository/classes/class.ilRepositoryExplorer.php";
$this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.main_view.html','Services/Payment');
if(!count($bookings = $this->bookings_obj->getBookingsOfCustomer($this->user_obj->getId())))
{
ilUtil::sendInfo($this->lng->txt('pay_not_buyed_any_object'));
return true;
}
$counter = 0;
foreach($bookings as $booking)
{
$tmp_obj = ilObjectFactory::getInstanceByRefId($booking['ref_id'], false);
$tmp_vendor = ilObjectFactory::getInstanceByObjId($booking['b_vendor_id']);
$tmp_purchaser = ilObjectFactory::getInstanceByObjId($booking['customer_id']);
$transaction = $booking['transaction'];
include_once './Services/Payment/classes/class.ilPayMethods.php';
$str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
$transaction .= " (" . $str_paymethod . ")";
$f_result[$counter]['transaction'] = $transaction;
if($tmp_obj)
{
$obj_link = ilRepositoryExplorer::buildLinkTarget($booking['ref_id'],$tmp_obj->getType());
$obj_target = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$booking['ref_id'],$tmp_obj->getId());
$f_result[$counter]['object_title'] = "<a href=\"".$obj_link."\" target=\"".$obj_target."\">".$tmp_obj->getTitle()."</a>";
}
else
{
$obj_link = '';
$obj_target = '';
$f_result[$counter]['object_title'] = $booking['object_title'].'<br> ('.$this->lng->txt('object_deleted').')';
}
/*
if ($tmp_obj->getType() == "crs")
{
$f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" .
$booking["ref_id"] . "\">" . $tmp_obj->getTitle() . "</a>";
}
else if ($tmp_obj->getType() == "lm")
{
$f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" .
$booking["ref_id"] . "\" target=\"_blank\">" . $tmp_obj->getTitle() . "</a>";
}
else
{
$f_result[$counter][] = $tmp_obj->getTitle();
}
*/
$f_result[$counter]['vendor'] = '['.$tmp_vendor->getLogin().']';
$f_result[$counter]['customer'] = '['.$tmp_purchaser->getLogin().']';
$f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX));
if($booking['duration'] != 0)
{
$f_result[$counter]['duration'] = $booking['duration'].' '.$this->lng->txt('paya_months');
}
else
{
$f_result[$counter]['duration'] = $this->lng->txt("unlimited_duration");
}
$f_result[$counter]['price'] = $booking['price'].' '.$booking['currency_unit'];
$f_result[$counter]['discount'] = ($booking['discount'] != '' ? ($booking['discount'].' '.$booking['currency_unit']) : '&nbsp;');
// TODO CURRENCY
/*
$f_result[$counter][] = ilPaymentCurrency::_formatPriceToString($booking['price'], $booking['currency_unit']);
$f_result[$counter][] = ($booking['discount'] != '' ? ilPaymentCurrency::_formatPriceToString($booking['discount']) : '&nbsp;');
*/
$payed_access = $booking['payed'] ?
$this->lng->txt('yes') :
$this->lng->txt('no');
$payed_access .= '/';
$payed_access .= $booking['access_granted'] ?
$this->lng->txt('yes') :
$this->lng->txt('no');
$f_result[$counter]['payed_access'] = $payed_access;
unset($tmp_obj);
unset($tmp_vendor);
unset($tmp_purchaser);
++$counter;
}
return $this->showStatisticTable($f_result);
}

+ Here is the call graph for this function:

ilShopBoughtObjectsGUI::showStatisticTable (   $a_result_set)
private

Definition at line 393 of file class.ilShopBoughtObjectsGUI.php.

Referenced by showItems().

{
$tbl = new ilShopTableGUI($this);
$tbl->setTitle($this->lng->txt("paya_buyed_objects"));
$tbl->setId('tbl_bought_objects');
$tbl->setRowTemplate("tpl.shop_statistics_row.html", "Services/Payment");
$tbl->addColumn($this->lng->txt('paya_transaction'), 'transaction', '10%');
$tbl->addColumn($this->lng->txt('title'), 'object_title', '10%');
$tbl->addColumn($this->lng->txt('paya_vendor'), 'vendor', '10%');
$tbl->addColumn($this->lng->txt('paya_customer'), 'customer', '10%');
$tbl->addColumn($this->lng->txt('paya_order_date'), 'order_date', '10%');
$tbl->addColumn($this->lng->txt('duration'), 'duration', '10%');
$tbl->addColumn($this->lng->txt('price_a'), 'price', '5%');
$tbl->addColumn($this->lng->txt('paya_coupons_coupon'), 'discount', '5%');
$tbl->addColumn($this->lng->txt('paya_payed_access'), 'payed_access', '5%');
$tbl->setData($a_result_set);
$this->tpl->setVariable('TABLE', $tbl->getHTML());
return true;
}

+ Here is the caller graph for this function:

Field Documentation

ilShopBoughtObjectsGUI::$psc_obj = null
private

Definition at line 22 of file class.ilShopBoughtObjectsGUI.php.

ilShopBoughtObjectsGUI::$user_obj
private

Definition at line 20 of file class.ilShopBoughtObjectsGUI.php.

Referenced by __construct(), and createBill().


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