32 include_once
'./payment/classes/class.ilPaymentObject.php';
42 $this->ctrl->saveParameter($this,
'baseClass');
44 $this->user_obj = $user_obj;
56 $ilTabs->setTabActive(
'paya_header');
57 $ilTabs->setSubTabActive(
'bookings');
62 $cmd = $this->ctrl->getCmd();
64 switch ($this->ctrl->getNextClass($this))
67 if(!
$cmd = $this->ctrl->getCmd())
69 $cmd =
'showStatistics';
80 unset(
$_POST[
"transaction_type"]);
81 unset(
$_POST[
"transaction_value"]);
82 unset(
$_POST[
"from"][
"day"]);
83 unset(
$_POST[
"from"][
"month"]);
84 unset(
$_POST[
"from"][
"year"]);
85 unset(
$_POST[
"til"][
"day"]);
86 unset(
$_POST[
"til"][
"month"]);
87 unset(
$_POST[
"til"][
"year"]);
91 unset(
$_POST[
"pay_method"]);
92 unset(
$_POST[
"updateView"]);
98 $this->
showButton(
'showObjectSelector',$this->lng->txt(
'paya_add_customer'));
100 if (
$_POST[
"updateView"] == 1)
102 $_SESSION[
"pay_statistics"][
"updateView"] =
true;
103 $_SESSION[
"pay_statistics"][
"transaction_type"] =
$_POST[
"transaction_type"];
104 $_SESSION[
"pay_statistics"][
"transaction_value"] =
$_POST[
"transaction_value"];
106 $_SESSION[
"pay_statistics"][
"from"][
"month"] =
$_POST[
"from"][
"month"];
117 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_statistic.html',
'payment');
119 $this->tpl->setVariable(
"TXT_FILTER",$this->lng->txt(
'pay_filter'));
120 $this->tpl->setVariable(
"FORM_ACTION",$this->ctrl->getFormAction($this));
121 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
122 $this->tpl->setVariable(
"TXT_STARTING",$this->lng->txt(
'pay_starting'));
123 $this->tpl->setVariable(
"TXT_ENDING",$this->lng->txt(
'pay_ending'));
124 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
125 $this->tpl->setVariable(
"TXT_ALL",$this->lng->txt(
'pay_all'));
126 $this->tpl->setVariable(
"TXT_YES",$this->lng->txt(
'yes'));
127 $this->tpl->setVariable(
"TXT_NO",$this->lng->txt(
'no'));
128 $this->tpl->setVariable(
"TXT_BILL",$this->lng->txt(
'pays_bill'));
129 $this->tpl->setVariable(
"TXT_BMF",$this->lng->txt(
'pays_bmf'));
130 $this->tpl->setVariable(
"TXT_PAYPAL",$this->lng->txt(
'pays_paypal'));
131 $this->tpl->setVariable(
"TXT_CUSTOMER",$this->lng->txt(
'paya_customer'));
132 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
133 $this->tpl->setVariable(
"TXT_PAYMENT",$this->lng->txt(
'payment_system'));
134 $this->tpl->setVariable(
"TXT_ORDER_DATE_FROM",$this->lng->txt(
'pay_order_date_from'));
135 $this->tpl->setVariable(
"TXT_ORDER_DATE_TIL",$this->lng->txt(
'pay_order_date_til'));
136 $this->tpl->setVariable(
"TXT_UPDATE_VIEW",$this->lng->txt(
'pay_update_view'));
137 $this->tpl->setVariable(
"TXT_RESET_FILTER",$this->lng->txt(
'pay_reset_filter'));
139 $this->tpl->setVariable(
"TRANSACTION_TYPE_" .
$_SESSION[
"pay_statistics"][
"transaction_type"],
" selected");
141 $this->tpl->setVariable(
"PAYED_" .
$_SESSION[
"pay_statistics"][
"payed"],
" selected");
142 $this->tpl->setVariable(
"ACCESS_" .
$_SESSION[
"pay_statistics"][
"access"],
" selected");
143 $this->tpl->setVariable(
"PAYMENT_" .
$_SESSION[
"pay_statistics"][
"pay_method"],
" selected");
145 for ($i = 1; $i <= 31; $i++)
147 $this->tpl->setCurrentBlock(
"loop_from_day");
148 $this->tpl->setVariable(
"LOOP_FROM_DAY", $i < 10 ?
"0" . $i : $i);
149 if (
$_SESSION[
"pay_statistics"][
"from"][
"day"] == $i)
151 $this->tpl->setVariable(
"LOOP_FROM_DAY_SELECTED",
" selected");
153 $this->tpl->parseCurrentBlock(
"loop_from_day");
154 $this->tpl->setCurrentBlock(
"loop_til_day");
155 $this->tpl->setVariable(
"LOOP_TIL_DAY", $i < 10 ?
"0" . $i : $i);
156 if (
$_SESSION[
"pay_statistics"][
"til"][
"day"] == $i)
158 $this->tpl->setVariable(
"LOOP_TIL_DAY_SELECTED",
" selected");
160 $this->tpl->parseCurrentBlock(
"loop_til_day");
162 for ($i = 1; $i <= 12; $i++)
164 $this->tpl->setCurrentBlock(
"loop_from_month");
165 $this->tpl->setVariable(
"LOOP_FROM_MONTH", $i < 10 ?
"0" . $i : $i);
166 if (
$_SESSION[
"pay_statistics"][
"from"][
"month"] == $i)
168 $this->tpl->setVariable(
"LOOP_FROM_MONTH_SELECTED",
" selected");
170 $this->tpl->parseCurrentBlock(
"loop_from_month");
171 $this->tpl->setCurrentBlock(
"loop_til_month");
172 $this->tpl->setVariable(
"LOOP_TIL_MONTH", $i < 10 ?
"0" . $i : $i);
173 if (
$_SESSION[
"pay_statistics"][
"til"][
"month"] == $i)
175 $this->tpl->setVariable(
"LOOP_TIL_MONTH_SELECTED",
" selected");
177 $this->tpl->parseCurrentBlock(
"loop_til_month");
179 for ($i = 2004; $i <= date(
"Y"); $i++)
181 $this->tpl->setCurrentBlock(
"loop_from_year");
182 $this->tpl->setVariable(
"LOOP_FROM_YEAR", $i);
183 if (
$_SESSION[
"pay_statistics"][
"from"][
"year"] == $i)
185 $this->tpl->setVariable(
"LOOP_FROM_YEAR_SELECTED",
" selected");
187 $this->tpl->parseCurrentBlock(
"loop_from_year");
188 $this->tpl->setCurrentBlock(
"loop_til_year");
189 $this->tpl->setVariable(
"LOOP_TIL_YEAR", $i);
190 if (
$_SESSION[
"pay_statistics"][
"til"][
"year"] == $i)
192 $this->tpl->setVariable(
"LOOP_TIL_YEAR_SELECTED",
" selected");
194 $this->tpl->parseCurrentBlock(
"loop_til_year");
197 if(!
$_SESSION[
'pay_statistics'][
'updateView'])
199 $this->tpl->setVariable(
'FILTER_MESSAGE', $this->lng->txt(
'statistics_filter_advice'));
205 if(!count($bookings = $this->booking_obj->getBookings()))
211 # $this->__showButton('excelExport',$this->lng->txt('excel_export'));
213 $img_change =
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
214 $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
215 "\" border=\"0\" vspace=\"0\"/>";
217 include_once
'Services/User/classes/class.ilObjUser.php';
218 $object_title_cache = array();
219 $user_title_cache = array();
222 foreach($bookings as $booking)
224 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
226 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
231 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
233 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
235 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
240 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
242 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
244 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
249 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
252 $transaction = $booking[
'transaction_extern'];
253 switch ($booking[
'b_pay_method'])
255 case $this->pobject->PAY_METHOD_BILL :
256 $transaction .=
" (" . $this->lng->txt(
"pays_bill") .
")";
258 case $this->pobject->PAY_METHOD_BMF :
259 $transaction .=
" (" . $this->lng->txt(
"pays_bmf") .
")";
261 case $this->pobject->PAY_METHOD_PAYPAL :
262 $transaction .=
" (" . $this->lng->txt(
"pays_paypal") .
")";
265 $f_result[$counter][] = $transaction;
266 $f_result[$counter][] = ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
267 $f_result[$counter][] = ($tmp_vendor !=
'' ?
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
268 $f_result[$counter][] = ($tmp_purchaser !=
'' ?
'['.$tmp_purchaser.
']' : $this->lng->txt(
'user_deleted'));
269 $f_result[$counter][] = date(
'Y-m-d H:i:s', $booking[
'order_date']);
271 if($booking[
'duration'] == 0)
273 $booking[
'duration'] = $this->lng->txt(
'unlimited_duration');
276 $f_result[$counter][] = $booking[
'duration'];
278 $f_result[$counter][] = $booking[
'discount'];
280 $payed_access = $booking[
'payed'] ?
281 $this->lng->txt(
'yes') :
282 $this->lng->txt(
'no');
284 $payed_access .=
'/';
285 $payed_access .= $booking[
'access'] ?
286 $this->lng->txt(
'yes') :
287 $this->lng->txt(
'no');
289 $f_result[$counter][] = $payed_access;
291 $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
292 # $link_change = "<a href=\"".$this->ctrl->getLinkTarget($this,"editStatistic")."\"> ".
293 # $img_change."</a>";
294 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
296 $f_result[$counter][] = $link_change;
300 unset($tmp_purchaser);
309 include_once
'./payment/classes/class.ilPaymentExcelWriterAdapter.php';
318 $workbook =& $pewa->getWorkbook();
324 include_once
'./payment/classes/class.ilPaymentVendors.php';
328 $workbook =& $pewa->getWorkbook();
329 $worksheet =& $workbook->addWorksheet($this->lng->txt(
'bookings'));
331 $worksheet->mergeCells(0,0,0,8);
332 $worksheet->setColumn(0,0,16);
333 $worksheet->setColumn(0,1,32);
334 $worksheet->setColumn(0,2,32);
335 $worksheet->setColumn(0,3,16);
336 $worksheet->setColumn(0,4,16);
337 $worksheet->setColumn(0,5,16);
338 $worksheet->setColumn(0,6,24);
339 $worksheet->setColumn(0,7,8);
340 $worksheet->setColumn(0,8,12);
341 $worksheet->setColumn(0,9,16);
344 $title = $this->lng->txt(
'bookings');
345 $title .=
' '.$this->lng->txt(
'as_of');
346 $title .= strftime(
'%Y-%m-%d %R',time());
348 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
350 $worksheet->writeString(1,0,$this->lng->txt(
'payment_system'),$pewa->getFormatHeader());
351 $worksheet->writeString(1,1,$this->lng->txt(
'paya_transaction'),$pewa->getFormatHeader());
352 $worksheet->writeString(1,2,$this->lng->txt(
'title'),$pewa->getFormatHeader());
353 $worksheet->writeString(1,3,$this->lng->txt(
'paya_vendor'),$pewa->getFormatHeader());
354 $worksheet->writeString(1,4,$this->lng->txt(
'pays_cost_center'),$pewa->getFormatHeader());
355 $worksheet->writeString(1,5,$this->lng->txt(
'paya_customer'),$pewa->getFormatHeader());
356 $worksheet->writeString(1,6,$this->lng->txt(
'paya_order_date'),$pewa->getFormatHeader());
357 $worksheet->writeString(1,7,$this->lng->txt(
'duration'),$pewa->getFormatHeader());
358 $worksheet->writeString(1,8,$this->lng->txt(
'price_a'),$pewa->getFormatHeader());
359 $worksheet->writeString(1,9,$this->lng->txt(
'paya_payed_access'),$pewa->getFormatHeader());
361 if(!count($bookings = $this->booking_obj->getBookings()))
366 include_once
'Services/User/classes/class.ilObjUser.php';
367 $object_title_cache = array();
368 $user_title_cache = array();
371 foreach($bookings as $booking)
373 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
375 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
380 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
382 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
384 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
389 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
391 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
393 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
398 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
401 switch ($booking[
'b_pay_method'])
403 case $this->pobject->PAY_METHOD_BILL :
406 case $this->pobject->PAY_METHOD_BMF :
409 case $this->pobject->PAY_METHOD_PAYPAL :
414 $worksheet->writeString($counter,1,$booking[
'transaction_extern']);
415 $worksheet->writeString($counter,2,($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
416 $worksheet->writeString($counter,3,($tmp_vendor !=
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted')));
418 $worksheet->writeString($counter,5,($tmp_purchaser !=
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted')));
419 $worksheet->writeString($counter,6,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
428 $worksheet->writeString($counter,7,$booking[
'duration']);
429 $worksheet->writeString($counter,8,$booking[
'price']);
431 $payed_access = $booking[
'payed'] ?
432 $this->lng->txt(
'yes') :
433 $this->lng->txt(
'no');
435 $payed_access .=
'/';
436 $payed_access .= $booking[
'access'] ?
437 $this->lng->txt(
'yes') :
438 $this->lng->txt(
'no');
440 $worksheet->writeString($counter,9,$payed_access);
444 unset($tmp_purchaser);
452 if(!isset(
$_GET[
'booking_id']))
460 $this->
showButton(
'showStatistics',$this->lng->txt(
'back'));
462 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_edit_statistic.html',
'payment');
463 $this->ctrl->setParameter($this,
'booking_id',(
int)
$_GET[
'booking_id']);
466 if($a_show_confirm_delete)
468 $this->tpl->setCurrentBlock(
"confirm_delete");
469 $this->tpl->setVariable(
"CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
470 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
471 $this->tpl->setVariable(
"CONFIRM_CMD",
'performDelete');
472 $this->tpl->setVariable(
"TXT_CONFIRM",$this->lng->txt(
'confirm'));
473 $this->tpl->parseCurrentBlock();
478 $bookings = $this->booking_obj->getBookings();
479 $booking = $bookings[(int) $_GET[
'booking_id']];
486 $this->tpl->setVariable(
"STAT_FORMACTION",$this->ctrl->getFormAction($this));
488 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
489 if(is_object($tmp_user))
491 $this->tpl->setVariable(
'TITLE', $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']');
495 $this->tpl->setVariable(
'TITLE', $this->lng->txt(
'user_deleted'));
502 $this->tpl->setVariable(
"TXT_OBJECT",$this->lng->txt(
'title'));
503 $this->tpl->setVariable(
"OBJECT", ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
505 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
506 $this->tpl->setVariable(
"TXT_VENDOR",$this->lng->txt(
'paya_vendor'));
507 $this->tpl->setVariable(
"TXT_PAY_METHOD",$this->lng->txt(
'paya_pay_method'));
508 $this->tpl->setVariable(
"TXT_ORDER_DATE",$this->lng->txt(
'paya_order_date'));
509 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'duration'));
510 $this->tpl->setVariable(
"TXT_PRICE",$this->lng->txt(
'price_a'));
511 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
512 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
514 $this->tpl->setVariable(
"TRANSACTION",$booking[
'transaction']);
517 if(is_object($tmp_vendor))
519 $this->tpl->setVariable(
'VENDOR', $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
523 $this->tpl->setVariable(
'VENDOR', $this->lng->txt(
'user_deleted'));
526 switch($booking[
'b_pay_method'])
528 case $this->pobject->PAY_METHOD_BILL:
529 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_bill'));
532 case $this->pobject->PAY_METHOD_BMF:
533 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_bmf'));
536 case $this->pobject->PAY_METHOD_PAYPAL:
537 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_paypal'));
541 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'paya_pay_method_not_specified'));
544 $this->tpl->setVariable(
"ORDER_DATE",date(
'Y m d H:i:s',$booking[
'order_date']));
546 if($booking[
'duration'] != 0)
548 $this->tpl->setVariable(
"DURATION",$booking[
'duration'].
' '.$this->lng->txt(
'paya_months'));
552 $this->tpl->setVariable(
"DURATION",$this->lng->txt(
"unlimited_duration"));
558 $yes_no = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
560 $this->tpl->setVariable(
"PAYED",
ilUtil::formSelect((
int) $booking[
'payed'],
'payed',$yes_no,
false,
true));
561 $this->tpl->setVariable(
"ACCESS",
ilUtil::formSelect((
int) $booking[
'access'],
'access',$yes_no,
false,
true));
564 $this->tpl->setVariable(
"INPUT_CMD",
'updateStatistic');
565 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'save'));
567 $this->tpl->setVariable(
"DELETE_CMD",
'deleteStatistic');
568 $this->tpl->setVariable(
"DELETE_VALUE",$this->lng->txt(
'delete'));
573 if(!isset(
$_GET[
'booking_id']))
582 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
583 $this->booking_obj->setAccess((
int)
$_POST[
'access']);
584 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
586 if($this->booking_obj->update())
604 if(!isset(
$_GET[
'booking_id']))
620 if(!isset(
$_GET[
'booking_id']))
629 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
630 if(!$this->booking_obj->delete())
632 die(
'Error deleting booking');
645 include_once
'./payment/classes/class.ilPaymentObjectSelector.php';
647 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_object_selector.html",
'payment');
648 $this->
showButton(
'showStatistics',$this->lng->txt(
'back'));
652 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
653 $exp->
setExpand(
$_GET[
"paya_link_expand"] ?
$_GET[
"paya_link_expand"] : $tree->readRootId());
654 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
658 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
665 if(!isset(
$_GET[
'sell_id']))
673 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_user_search.html",
'payment');
674 $this->
showButton(
'showObjectSelector',$this->lng->txt(
'back'));
676 $this->lng->loadLanguageModule(
'search');
678 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
679 $this->tpl->setVariable(
"F_ACTION",$this->ctrl->getFormAction($this));
680 $this->tpl->setVariable(
"SEARCH_ASSIGN_USR",$this->lng->txt(
"search_user"));
681 $this->tpl->setVariable(
"SEARCH_SEARCH_TERM",$this->lng->txt(
"search_search_term"));
682 $this->tpl->setVariable(
"SEARCH_VALUE",
$_SESSION[
"pays_search_str_user_sp"] ?
$_SESSION[
"pays_search_str_user_sp"] :
"");
683 $this->tpl->setVariable(
"BTN2_VALUE",$this->lng->txt(
"cancel"));
684 $this->tpl->setVariable(
"BTN1_VALUE",$this->lng->txt(
"search"));
685 $this->tpl->setVariable(
"SEARCH",
"performSearch");
686 $this->tpl->setVariable(
"CANCEL",
"showStatistics");
697 if(!trim(
$_POST[
"search_str"]))
712 if(!isset(
$_GET[
'sell_id']))
720 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_usr_selection.html",
'payment');
721 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
722 $this->
showButton(
"searchUser",$this->lng->txt(
"back"));
732 $f_result[$counter][] = ilUtil::formRadiobutton(0,
"user_id",$user[
"id"]);
733 $f_result[$counter][] = $tmp_obj->getLogin();
734 $f_result[$counter][] = $tmp_obj->getFirstname();
735 $f_result[$counter][] = $tmp_obj->getLastname();
748 if(!isset(
$_GET[
'sell_id']))
756 if(!isset(
$_POST[
'user_id']))
764 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
765 $this->
showButton(
'searchUser',$this->lng->txt(
'back'));
767 $this->ctrl->setParameter($this,
"user_id",
$_POST[
"user_id"]);
779 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_add_customer.html',
'payment');
781 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
784 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
785 $this->tpl->setVariable(
"TITLE",$tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']');
788 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
791 $this->tpl->setVariable(
"TXT_OBJECT",$this->lng->txt(
'title'));
794 $this->tpl->setVariable(
"OBJECT",$tmp_obj->getTitle());
798 $this->tpl->setVariable(
"OBJECT",$this->lng->txt(
'object_not_found'));
800 $this->tpl->setVariable(
"TXT_VENDOR",$this->lng->txt(
'paya_vendor'));
801 $this->tpl->setVariable(
"VENDOR",$tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
803 $this->tpl->setVariable(
"TXT_PAY_METHOD",$this->lng->txt(
'paya_pay_method'));
804 $this->tpl->setVariable(
"TXT_PAY_METHOD_BILL",$this->lng->txt(
'pays_bill'));
805 $this->tpl->setVariable(
"TXT_PAY_METHOD_BMF",$this->lng->txt(
'pays_bmf'));
806 $this->tpl->setVariable(
"TXT_PAY_METHOD_PAYPAL",$this->lng->txt(
'pays_paypal'));
807 $this->tpl->setVariable(
"PAY_METHOD_".
$_POST[
"pay_method"],
" selected");
809 $this->tpl->setVariable(
"TXT_ORDER_DATE",$this->lng->txt(
'paya_order_date'));
812 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'duration'));
813 include_once
'./payment/classes/class.ilPaymentPrices.php';
815 if (is_array($prices = $prices_obj->getPrices()))
817 foreach($prices as $price)
819 $this->tpl->setCurrentBlock(
"duration_loop");
820 if (
$_POST[
"duration"] == $price[
"price_id"]) $this->tpl->setVariable(
"DURATION_LOOP_SELECTED",
" selected");
821 $this->tpl->setVariable(
"DURATION_LOOP_ID", $price[
"price_id"]);
822 $this->tpl->setVariable(
"DURATION_LOOP_NAME", $price[
"duration"].
" ".$this->lng->txt(
"paya_months").
", ".
ilPaymentPrices::_getPriceString($price[
"price_id"]));
823 $this->tpl->parseCurrentBlock();
827 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
828 if (
$_POST[
"payed"] == 1) $this->tpl->setVariable(
"PAYED_1",
" selected");
829 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
830 if (
$_POST[
"access"] == 1) $this->tpl->setVariable(
"ACCESS_1",
" selected");
832 $this->tpl->setVariable(
"TXT_NO",$this->lng->txt(
'no'));
833 $this->tpl->setVariable(
"TXT_YES",$this->lng->txt(
'yes'));
834 $this->tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save'));
835 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
836 $this->tpl->setVariable(
"STATISTICS",
"showStatistics");
842 global
$ilias,$ilObjDataCache, $ilUser;
845 if(!isset(
$_GET[
'sell_id']))
853 if(!isset(
$_GET[
'user_id']))
861 if (
$_POST[
"pay_method"] ==
"" ||
875 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$this->user_obj->getId().
'_'.substr((
string) time(),-3);
876 $transaction = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
877 $this->booking_obj->setTransaction($transaction);
878 $this->booking_obj->setTransactionExtern(
$_POST[
"transaction"]);
879 $this->booking_obj->setPobjectId($pObjectId);
880 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
881 $this->booking_obj->setVendorId($obj->getVendorId());
882 $this->booking_obj->setPayMethod((
int)
$_POST[
"pay_method"]);
883 $this->booking_obj->setOrderDate(time());
886 $this->booking_obj->setDuration($price[
"duration"]);
888 $this->booking_obj->setAccess((
int) $_POST[
'access']);
889 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
890 $this->booking_obj->setVoucher(
'');
892 $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
893 $obj_type = $ilObjDataCache->lookupType($obj_id);
894 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
896 include_once
'Services/Payment/classes/class.ilShopVatsList.php';
897 $oVAT =
new ilShopVats((
int)$obj->getVatId());
898 $obj_vat_rate = $oVAT->
getRate();
899 $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
901 $this->booking_obj->setObjectTitle($obj_title);
902 $this->booking_obj->setVatRate($obj_vat_rate);
903 $this->booking_obj->setVatUnit($obj_vat_unit);
905 include_once
'./payment/classes/class.ilPayMethods.php';
911 if($save_user_adr_bill == 1 || $save_user_adr_bmf == 1
912 || $save_user_adr_paypal == 1 || $save_user_adr_epay == 1)
915 $user_id[] =
$_GET[
"user_id"];
919 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
921 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
922 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
923 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
926 if($this->booking_obj->add())
944 $tpl =& $tbl->getTemplateObject();
947 $tpl->setCurrentBlock(
"tbl_form_header");
949 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
950 $tpl->parseCurrentBlock();
952 $tbl->setTitle($this->lng->txt(
"bookings"),
"icon_pays.gif",$this->lng->txt(
"bookings"));
953 $tbl->setHeaderNames(array($this->lng->txt(
"paya_transaction"),
954 $this->lng->txt(
"title"),
955 $this->lng->txt(
"paya_vendor"),
956 $this->lng->txt(
"paya_customer"),
957 $this->lng->txt(
"paya_order_date"),
958 $this->lng->txt(
"duration"),
959 $this->lng->txt(
"price_a"),
960 $this->lng->txt(
"paya_coupons_coupons"),
961 $this->lng->txt(
"paya_payed_access"),
963 $header_params = $this->ctrl->getParameterArray($this,
'');
964 $tbl->setHeaderVars(array(
"transaction",
973 "options"),$header_params);
975 $offset =
$_GET[
"offset"];
976 $order =
$_GET[
"sort_by"];
977 $direction =
$_GET[
"sort_order"] ?
$_GET[
'sort_order'] :
'desc';
979 $tbl->setOrderColumn($order,
'order_date');
980 $tbl->setOrderDirection($direction);
981 $tbl->setOffset($offset);
982 $tbl->setLimit(
$_GET[
"limit"]);
983 $tbl->setMaxCount(count($a_result_set));
984 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
985 $tbl->setData($a_result_set);
987 $tpl->setVariable(
"COLUMN_COUNTS",10);
988 $tpl->setCurrentBlock(
"plain_buttons");
989 $tpl->setVariable(
"PBTN_NAME",
"excelExport");
990 $tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"excel_export"));
991 $tpl->parseCurrentBlock();
995 $this->tpl->setVariable(
"STATISTIC_TABLE",$tbl->tpl->get());
1002 include_once
'./payment/classes/class.ilPaymentBookings.php';
1009 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
1012 $this->tpl->setCurrentBlock(
"btn_cell");
1013 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
1014 $this->tpl->setVariable(
"BTN_TXT",$a_text);
1017 $this->tpl->setVariable(
"BTN_TARGET",$a_target);
1020 $this->tpl->parseCurrentBlock();
1025 include_once(
"./classes/class.ilSearch.php");
1027 $this->lng->loadLanguageModule(
"content");
1029 $search =&
new ilSearch($this->user_obj->getId());
1032 $search->setCombination(
"and");
1033 $search->setSearchFor(array(0 =>
'usr'));
1034 $search->setSearchType(
'new');
1036 if($search->validate($message))
1038 $search->performSearch();
1043 $this->ctrl->redirect($this,
"searchUser");
1045 return $search->getResultByType(
'usr');
1050 $tpl =& $tbl->getTemplateObject();
1054 $tpl->setCurrentBlock(
"tbl_form_header");
1055 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
1056 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1057 $tpl->parseCurrentBlock();
1059 $tpl->setCurrentBlock(
"tbl_action_btn");
1060 $tpl->setVariable(
"BTN_NAME",
"addCustomer");
1061 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"add"));
1062 $tpl->parseCurrentBlock();
1064 $tpl->setCurrentBlock(
"tbl_action_btn");
1065 $tpl->setVariable(
"BTN_NAME",
"showStatistics");
1066 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"cancel"));
1067 $tpl->parseCurrentBlock();
1069 $tpl->setCurrentBlock(
"tbl_action_row");
1070 $tpl->setVariable(
"COLUMN_COUNTS",5);
1072 $tpl->parseCurrentBlock();
1074 $tbl->setTitle($this->lng->txt(
"users"),
"icon_usr.gif",$this->lng->txt(
"crs_header_edit_members"));
1075 $tbl->setHeaderNames(array(
"",
1076 $this->lng->txt(
"login"),
1077 $this->lng->txt(
"firstname"),
1078 $this->lng->txt(
"lastname")));
1079 $this->ctrl->setParameter($this,
"cmd",
"addCustomer");
1080 $header_params = $this->ctrl->getParameterArray($this,
'');
1081 $tbl->setHeaderVars(array(
"",
1084 "lastname"), $header_params);
1086 $tbl->setColumnWidth(array(
"3%",
"32%",
"32%",
"32%"));
1091 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());