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(
'paya_statistic');
62 $cmd = $this->ctrl->getCmd();
63 switch ($this->ctrl->getNextClass($this))
66 if(!
$cmd = $this->ctrl->getCmd())
68 $cmd =
'showStatistics';
79 unset($_POST[
"transaction_type"]);
80 unset($_POST[
"transaction_value"]);
81 unset($_POST[
"from"][
"day"]);
82 unset($_POST[
"from"][
"month"]);
83 unset($_POST[
"from"][
"year"]);
84 unset($_POST[
"til"][
"day"]);
85 unset($_POST[
"til"][
"month"]);
86 unset($_POST[
"til"][
"year"]);
87 unset($_POST[
"payed"]);
88 unset($_POST[
"access"]);
89 unset($_POST[
"customer"]);
90 unset($_POST[
"pay_method"]);
91 unset($_POST[
"updateView"]);
97 $this->
showButton(
'showObjectSelector',$this->lng->txt(
'paya_add_customer'));
99 if ($_POST[
"updateView"] == 1)
101 $_SESSION[
"pay_statistics"][
"updateView"] =
true;
102 $_SESSION[
"pay_statistics"][
"transaction_type"] = $_POST[
"transaction_type"];
103 $_SESSION[
"pay_statistics"][
"transaction_value"] = $_POST[
"transaction_value"];
104 $_SESSION[
"pay_statistics"][
"from"][
"day"] = $_POST[
"from"][
"day"];
105 $_SESSION[
"pay_statistics"][
"from"][
"month"] = $_POST[
"from"][
"month"];
106 $_SESSION[
"pay_statistics"][
"from"][
"year"] = $_POST[
"from"][
"year"];
107 $_SESSION[
"pay_statistics"][
"til"][
"day"] = $_POST[
"til"][
"day"];
108 $_SESSION[
"pay_statistics"][
"til"][
"month"] = $_POST[
"til"][
"month"];
109 $_SESSION[
"pay_statistics"][
"til"][
"year"] = $_POST[
"til"][
"year"];
110 $_SESSION[
"pay_statistics"][
"payed"] = $_POST[
"payed"];
111 $_SESSION[
"pay_statistics"][
"access"] = $_POST[
"access"];
112 $_SESSION[
"pay_statistics"][
"customer"] = $_POST[
"customer"];
113 $_SESSION[
"pay_statistics"][
"pay_method"] = $_POST[
"pay_method"];
116 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_statistic.html',
'payment');
118 $this->tpl->setVariable(
"TXT_FILTER",$this->lng->txt(
'pay_filter'));
119 $this->tpl->setVariable(
"FORM_ACTION",$this->ctrl->getFormAction($this));
120 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
121 $this->tpl->setVariable(
"TXT_STARTING",$this->lng->txt(
'pay_starting'));
122 $this->tpl->setVariable(
"TXT_ENDING",$this->lng->txt(
'pay_ending'));
123 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
124 $this->tpl->setVariable(
"TXT_ALL",$this->lng->txt(
'pay_all'));
125 $this->tpl->setVariable(
"TXT_YES",$this->lng->txt(
'yes'));
126 $this->tpl->setVariable(
"TXT_NO",$this->lng->txt(
'no'));
127 $this->tpl->setVariable(
"TXT_BILL",$this->lng->txt(
'pays_bill'));
128 $this->tpl->setVariable(
"TXT_BMF",$this->lng->txt(
'pays_bmf'));
129 $this->tpl->setVariable(
"TXT_PAYPAL",$this->lng->txt(
'pays_paypal'));
130 $this->tpl->setVariable(
"TXT_CUSTOMER",$this->lng->txt(
'paya_customer'));
131 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
132 $this->tpl->setVariable(
"TXT_PAYMENT",$this->lng->txt(
'payment_system'));
133 $this->tpl->setVariable(
"TXT_ORDER_DATE_FROM",$this->lng->txt(
'pay_order_date_from'));
134 $this->tpl->setVariable(
"TXT_ORDER_DATE_TIL",$this->lng->txt(
'pay_order_date_til'));
135 $this->tpl->setVariable(
"TXT_UPDATE_VIEW",$this->lng->txt(
'pay_update_view'));
136 $this->tpl->setVariable(
"TXT_RESET_FILTER",$this->lng->txt(
'pay_reset_filter'));
138 $this->tpl->setVariable(
"TRANSACTION_TYPE_" .
$_SESSION[
"pay_statistics"][
"transaction_type"],
" selected");
140 $this->tpl->setVariable(
"PAYED_" .
$_SESSION[
"pay_statistics"][
"payed"],
" selected");
141 $this->tpl->setVariable(
"ACCESS_" .
$_SESSION[
"pay_statistics"][
"access"],
" selected");
142 $this->tpl->setVariable(
"PAYMENT_" .
$_SESSION[
"pay_statistics"][
"pay_method"],
" selected");
144 for ($i = 1; $i <= 31; $i++)
146 $this->tpl->setCurrentBlock(
"loop_from_day");
147 $this->tpl->setVariable(
"LOOP_FROM_DAY", $i < 10 ?
"0" . $i : $i);
148 if (
$_SESSION[
"pay_statistics"][
"from"][
"day"] == $i)
150 $this->tpl->setVariable(
"LOOP_FROM_DAY_SELECTED",
" selected");
152 $this->tpl->parseCurrentBlock(
"loop_from_day");
153 $this->tpl->setCurrentBlock(
"loop_til_day");
154 $this->tpl->setVariable(
"LOOP_TIL_DAY", $i < 10 ?
"0" . $i : $i);
155 if (
$_SESSION[
"pay_statistics"][
"til"][
"day"] == $i)
157 $this->tpl->setVariable(
"LOOP_TIL_DAY_SELECTED",
" selected");
159 $this->tpl->parseCurrentBlock(
"loop_til_day");
161 for ($i = 1; $i <= 12; $i++)
163 $this->tpl->setCurrentBlock(
"loop_from_month");
164 $this->tpl->setVariable(
"LOOP_FROM_MONTH", $i < 10 ?
"0" . $i : $i);
165 if (
$_SESSION[
"pay_statistics"][
"from"][
"month"] == $i)
167 $this->tpl->setVariable(
"LOOP_FROM_MONTH_SELECTED",
" selected");
169 $this->tpl->parseCurrentBlock(
"loop_from_month");
170 $this->tpl->setCurrentBlock(
"loop_til_month");
171 $this->tpl->setVariable(
"LOOP_TIL_MONTH", $i < 10 ?
"0" . $i : $i);
172 if (
$_SESSION[
"pay_statistics"][
"til"][
"month"] == $i)
174 $this->tpl->setVariable(
"LOOP_TIL_MONTH_SELECTED",
" selected");
176 $this->tpl->parseCurrentBlock(
"loop_til_month");
178 for ($i = 2004; $i <= date(
"Y"); $i++)
180 $this->tpl->setCurrentBlock(
"loop_from_year");
181 $this->tpl->setVariable(
"LOOP_FROM_YEAR", $i);
182 if (
$_SESSION[
"pay_statistics"][
"from"][
"year"] == $i)
184 $this->tpl->setVariable(
"LOOP_FROM_YEAR_SELECTED",
" selected");
186 $this->tpl->parseCurrentBlock(
"loop_from_year");
187 $this->tpl->setCurrentBlock(
"loop_til_year");
188 $this->tpl->setVariable(
"LOOP_TIL_YEAR", $i);
189 if (
$_SESSION[
"pay_statistics"][
"til"][
"year"] == $i)
191 $this->tpl->setVariable(
"LOOP_TIL_YEAR_SELECTED",
" selected");
193 $this->tpl->parseCurrentBlock(
"loop_til_year");
196 if(!
$_SESSION[
'pay_statistics'][
'updateView'])
198 $this->tpl->setVariable(
'FILTER_MESSAGE', $this->lng->txt(
'statistics_filter_advice'));
204 if(!count($bookings = $this->booking_obj->getBookings()))
210 # $this->__showButton('excelExport',$this->lng->txt('excel_export'));
212 $img_change =
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
213 $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
214 "\" border=\"0\" vspace=\"0\"/>";
216 include_once
'Services/User/classes/class.ilObjUser.php';
217 $object_title_cache = array();
218 $user_title_cache = array();
221 foreach($bookings as $booking)
223 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
225 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
230 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
232 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
234 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
239 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
241 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
243 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
248 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
251 $transaction = $booking[
'transaction_extern'];
252 switch ($booking[
'b_pay_method'])
254 case $this->pobject->PAY_METHOD_BILL :
255 $transaction .=
" (" . $this->lng->txt(
"pays_bill") .
")";
257 case $this->pobject->PAY_METHOD_BMF :
258 $transaction .=
" (" . $this->lng->txt(
"pays_bmf") .
")";
260 case $this->pobject->PAY_METHOD_PAYPAL :
261 $transaction .=
" (" . $this->lng->txt(
"pays_paypal") .
")";
264 $f_result[$counter][] = $transaction;
265 $f_result[$counter][] = ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted'));
266 $f_result[$counter][] = ($tmp_vendor !=
'' ?
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
267 $f_result[$counter][] = ($tmp_purchaser !=
'' ?
'['.$tmp_purchaser.
']' : $this->lng->txt(
'user_deleted'));
268 $f_result[$counter][] = date(
'Y-m-d H:i:s', $booking[
'order_date']);
269 $f_result[$counter][] = $booking[
'duration'];
270 $f_result[$counter][] = $booking[
'price'];
271 $f_result[$counter][] = $booking[
'discount'];
273 $payed_access = $booking[
'payed'] ?
274 $this->lng->txt(
'yes') :
275 $this->lng->txt(
'no');
277 $payed_access .=
'/';
278 $payed_access .= $booking[
'access'] ?
279 $this->lng->txt(
'yes') :
280 $this->lng->txt(
'no');
282 $f_result[$counter][] = $payed_access;
284 $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
285 # $link_change = "<a href=\"".$this->ctrl->getLinkTarget($this,"editStatistic")."\"> ".
286 # $img_change."</a>";
287 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
289 $f_result[$counter][] = $link_change;
293 unset($tmp_purchaser);
302 include_once
'./payment/classes/class.ilPaymentExcelWriterAdapter.php';
311 $workbook =& $pewa->getWorkbook();
317 include_once
'./payment/classes/class.ilPaymentVendors.php';
321 if(!count($bookings = $this->booking_obj->getBookings()))
326 $workbook =& $pewa->getWorkbook();
327 $worksheet =& $workbook->addWorksheet($this->lng->txt(
'paya_statistic'));
329 $worksheet->mergeCells(0,0,0,8);
330 $worksheet->setColumn(0,0,16);
331 $worksheet->setColumn(0,1,32);
332 $worksheet->setColumn(0,2,32);
333 $worksheet->setColumn(0,3,16);
334 $worksheet->setColumn(0,4,16);
335 $worksheet->setColumn(0,5,16);
336 $worksheet->setColumn(0,6,24);
337 $worksheet->setColumn(0,7,8);
338 $worksheet->setColumn(0,8,12);
339 $worksheet->setColumn(0,9,16);
341 $title = $this->lng->txt(
'paya_statistic');
342 $title .=
' '.$this->lng->txt(
'as_of');
343 $title .= strftime(
'%Y-%m-%d %R',time());
345 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
347 $worksheet->writeString(1,0,$this->lng->txt(
'payment_system'),$pewa->getFormatHeader());
348 $worksheet->writeString(1,1,$this->lng->txt(
'paya_transaction'),$pewa->getFormatHeader());
349 $worksheet->writeString(1,2,$this->lng->txt(
'title'),$pewa->getFormatHeader());
350 $worksheet->writeString(1,3,$this->lng->txt(
'paya_vendor'),$pewa->getFormatHeader());
351 $worksheet->writeString(1,4,$this->lng->txt(
'pays_cost_center'),$pewa->getFormatHeader());
352 $worksheet->writeString(1,5,$this->lng->txt(
'paya_customer'),$pewa->getFormatHeader());
353 $worksheet->writeString(1,6,$this->lng->txt(
'paya_order_date'),$pewa->getFormatHeader());
354 $worksheet->writeString(1,7,$this->lng->txt(
'duration'),$pewa->getFormatHeader());
355 $worksheet->writeString(1,8,$this->lng->txt(
'price_a'),$pewa->getFormatHeader());
356 $worksheet->writeString(1,9,$this->lng->txt(
'paya_payed_access'),$pewa->getFormatHeader());
358 include_once
'Services/User/classes/class.ilObjUser.php';
359 $object_title_cache = array();
360 $user_title_cache = array();
363 foreach($bookings as $booking)
365 if(array_key_exists($booking[
'ref_id'], $object_title_cache))
367 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
372 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
374 if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
376 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
381 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
383 if(array_key_exists($booking[
'customer_id'], $user_title_cache))
385 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
390 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
393 switch ($booking[
'b_pay_method'])
395 case $this->pobject->PAY_METHOD_BILL :
396 $pay_method = $this->lng->txt(
"pays_bill");
398 case $this->pobject->PAY_METHOD_BMF :
399 $pay_method = $this->lng->txt(
"pays_bmf");
401 case $this->pobject->PAY_METHOD_PAYPAL :
402 $pay_method = $this->lng->txt(
"pays_paypal");
405 $worksheet->writeString($counter,0,$pay_method);
406 $worksheet->writeString($counter,1,$booking[
'transaction_extern']);
407 $worksheet->writeString($counter,2,($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
408 $worksheet->writeString($counter,3,($tmp_vendor !=
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted')));
410 $worksheet->writeString($counter,5,($tmp_purchaser !=
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted')));
411 $worksheet->writeString($counter,6,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
420 $worksheet->writeString($counter,7,$booking[
'duration']);
421 $worksheet->writeString($counter,8,$booking[
'price']);
423 $payed_access = $booking[
'payed'] ?
424 $this->lng->txt(
'yes') :
425 $this->lng->txt(
'no');
427 $payed_access .=
'/';
428 $payed_access .= $booking[
'access'] ?
429 $this->lng->txt(
'yes') :
430 $this->lng->txt(
'no');
432 $worksheet->writeString($counter,9,$payed_access);
436 unset($tmp_purchaser);
444 if(!isset(
$_GET[
'booking_id']))
452 $this->
showButton(
'showStatistics',$this->lng->txt(
'back'));
454 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_edit_statistic.html',
'payment');
455 $this->ctrl->setParameter($this,
'booking_id',(
int)
$_GET[
'booking_id']);
458 if($a_show_confirm_delete)
460 $this->tpl->setCurrentBlock(
"confirm_delete");
461 $this->tpl->setVariable(
"CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
462 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
463 $this->tpl->setVariable(
"CONFIRM_CMD",
'performDelete');
464 $this->tpl->setVariable(
"TXT_CONFIRM",$this->lng->txt(
'confirm'));
465 $this->tpl->parseCurrentBlock();
470 $bookings = $this->booking_obj->getBookings();
471 $booking = $bookings[(int) $_GET[
'booking_id']];
478 $this->tpl->setVariable(
"STAT_FORMACTION",$this->ctrl->getFormAction($this));
480 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
481 if(is_object($tmp_user))
483 $this->tpl->setVariable(
'TITLE', $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']');
487 $this->tpl->setVariable(
'TITLE', $this->lng->txt(
'user_deleted'));
494 $this->tpl->setVariable(
"TXT_OBJECT",$this->lng->txt(
'title'));
495 $this->tpl->setVariable(
"OBJECT", ($tmp_obj !=
'' ? $tmp_obj : $this->lng->txt(
'object_deleted')));
497 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
498 $this->tpl->setVariable(
"TXT_VENDOR",$this->lng->txt(
'paya_vendor'));
499 $this->tpl->setVariable(
"TXT_PAY_METHOD",$this->lng->txt(
'paya_pay_method'));
500 $this->tpl->setVariable(
"TXT_ORDER_DATE",$this->lng->txt(
'paya_order_date'));
501 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'duration'));
502 $this->tpl->setVariable(
"TXT_PRICE",$this->lng->txt(
'price_a'));
503 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
504 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
506 $this->tpl->setVariable(
"TRANSACTION",$booking[
'transaction']);
509 if(is_object($tmp_vendor))
511 $this->tpl->setVariable(
'VENDOR', $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
515 $this->tpl->setVariable(
'VENDOR', $this->lng->txt(
'user_deleted'));
518 switch($booking[
'b_pay_method'])
520 case $this->pobject->PAY_METHOD_BILL:
521 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_bill'));
524 case $this->pobject->PAY_METHOD_BMF:
525 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_bmf'));
528 case $this->pobject->PAY_METHOD_PAYPAL:
529 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'pays_paypal'));
533 $this->tpl->setVariable(
"PAY_METHOD",$this->lng->txt(
'paya_pay_method_not_specified'));
536 $this->tpl->setVariable(
"ORDER_DATE",date(
'Y m d H:i:s',$booking[
'order_date']));
537 $this->tpl->setVariable(
"DURATION",$booking[
'duration'].
' '.$this->lng->txt(
'paya_months'));
538 $this->tpl->setVariable(
"PRICE",$booking[
'price']);
540 $yes_no = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
542 $this->tpl->setVariable(
"PAYED",
ilUtil::formSelect((
int) $booking[
'payed'],
'payed',$yes_no,
false,
true));
543 $this->tpl->setVariable(
"ACCESS",
ilUtil::formSelect((
int) $booking[
'access'],
'access',$yes_no,
false,
true));
546 $this->tpl->setVariable(
"INPUT_CMD",
'updateStatistic');
547 $this->tpl->setVariable(
"INPUT_VALUE",$this->lng->txt(
'save'));
549 $this->tpl->setVariable(
"DELETE_CMD",
'deleteStatistic');
550 $this->tpl->setVariable(
"DELETE_VALUE",$this->lng->txt(
'delete'));
555 if(!isset(
$_GET[
'booking_id']))
564 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
565 $this->booking_obj->setAccess((
int) $_POST[
'access']);
566 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
568 if($this->booking_obj->update())
586 if(!isset(
$_GET[
'booking_id']))
602 if(!isset(
$_GET[
'booking_id']))
611 $this->booking_obj->setBookingId((
int)
$_GET[
'booking_id']);
612 if(!$this->booking_obj->delete())
614 die(
'Error deleting booking');
627 include_once
'./payment/classes/class.ilPaymentObjectSelector.php';
629 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_object_selector.html",
'payment');
630 $this->
showButton(
'showStatistics',$this->lng->txt(
'back'));
634 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
635 $exp->
setExpand(
$_GET[
"paya_link_expand"] ?
$_GET[
"paya_link_expand"] : $tree->readRootId());
636 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
640 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
647 if(!isset(
$_GET[
'sell_id']))
655 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_user_search.html",
'payment');
656 $this->
showButton(
'showObjectSelector',$this->lng->txt(
'back'));
658 $this->lng->loadLanguageModule(
'search');
660 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
661 $this->tpl->setVariable(
"F_ACTION",$this->ctrl->getFormAction($this));
662 $this->tpl->setVariable(
"SEARCH_ASSIGN_USR",$this->lng->txt(
"search_user"));
663 $this->tpl->setVariable(
"SEARCH_SEARCH_TERM",$this->lng->txt(
"search_search_term"));
664 $this->tpl->setVariable(
"SEARCH_VALUE",
$_SESSION[
"pays_search_str_user_sp"] ?
$_SESSION[
"pays_search_str_user_sp"] :
"");
665 $this->tpl->setVariable(
"BTN2_VALUE",$this->lng->txt(
"cancel"));
666 $this->tpl->setVariable(
"BTN1_VALUE",$this->lng->txt(
"search"));
667 $this->tpl->setVariable(
"SEARCH",
"performSearch");
668 $this->tpl->setVariable(
"CANCEL",
"showStatistics");
676 $_SESSION[
"pays_search_str_user_sp"] = $_POST[
"search_str"] = $_POST[
"search_str"] ? $_POST[
"search_str"] :
$_SESSION[
"pays_search_str_user_sp"];
679 if(!trim($_POST[
"search_str"]))
694 if(!isset(
$_GET[
'sell_id']))
702 $this->tpl->addBlockFile(
"ADM_CONTENT",
"adm_content",
"tpl.paya_usr_selection.html",
'payment');
703 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
704 $this->
showButton(
"searchUser",$this->lng->txt(
"back"));
714 $f_result[$counter][] = ilUtil::formRadiobutton(0,
"user_id",$user[
"id"]);
715 $f_result[$counter][] = $tmp_obj->getLogin();
716 $f_result[$counter][] = $tmp_obj->getFirstname();
717 $f_result[$counter][] = $tmp_obj->getLastname();
727 if ($_POST[
"sell_id"] !=
"")
$_GET[
"sell_id"] = $_POST[
"sell_id"];
728 if (
$_GET[
"user_id"] !=
"") $_POST[
"user_id"] =
$_GET[
"user_id"];
730 if(!isset(
$_GET[
'sell_id']))
738 if(!isset($_POST[
'user_id']))
746 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
747 $this->
showButton(
'searchUser',$this->lng->txt(
'back'));
749 $this->ctrl->setParameter($this,
"user_id", $_POST[
"user_id"]);
761 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_add_customer.html',
'payment');
763 $this->tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
766 $this->tpl->setVariable(
"ALT_IMG",$this->lng->txt(
'obj_usr'));
767 $this->tpl->setVariable(
"TITLE",$tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']');
770 $this->tpl->setVariable(
"TXT_TRANSACTION",$this->lng->txt(
'paya_transaction'));
773 $this->tpl->setVariable(
"TXT_OBJECT",$this->lng->txt(
'title'));
774 $this->tpl->setVariable(
"OBJECT",$tmp_obj->getTitle());
776 $this->tpl->setVariable(
"TXT_VENDOR",$this->lng->txt(
'paya_vendor'));
777 $this->tpl->setVariable(
"VENDOR",$tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
779 $this->tpl->setVariable(
"TXT_PAY_METHOD",$this->lng->txt(
'paya_pay_method'));
780 $this->tpl->setVariable(
"TXT_PAY_METHOD_BILL",$this->lng->txt(
'pays_bill'));
781 $this->tpl->setVariable(
"TXT_PAY_METHOD_BMF",$this->lng->txt(
'pays_bmf'));
782 $this->tpl->setVariable(
"TXT_PAY_METHOD_PAYPAL",$this->lng->txt(
'pays_paypal'));
783 $this->tpl->setVariable(
"PAY_METHOD_".$_POST[
"pay_method"],
" selected");
785 $this->tpl->setVariable(
"TXT_ORDER_DATE",$this->lng->txt(
'paya_order_date'));
788 $this->tpl->setVariable(
"TXT_DURATION",$this->lng->txt(
'duration'));
789 include_once
'./payment/classes/class.ilPaymentPrices.php';
791 if (is_array($prices = $prices_obj->getPrices()))
793 foreach($prices as $price)
795 $this->tpl->setCurrentBlock(
"duration_loop");
796 if ($_POST[
"duration"] == $price[
"price_id"]) $this->tpl->setVariable(
"DURATION_LOOP_SELECTED",
" selected");
797 $this->tpl->setVariable(
"DURATION_LOOP_ID", $price[
"price_id"]);
798 $this->tpl->setVariable(
"DURATION_LOOP_NAME", $price[
"duration"].
" ".$this->lng->txt(
"paya_months").
", ".
ilPaymentPrices::_getPriceString($price[
"price_id"]));
799 $this->tpl->parseCurrentBlock();
803 $this->tpl->setVariable(
"TXT_PAYED",$this->lng->txt(
'paya_payed'));
804 if ($_POST[
"payed"] == 1) $this->tpl->setVariable(
"PAYED_1",
" selected");
805 $this->tpl->setVariable(
"TXT_ACCESS",$this->lng->txt(
'paya_access'));
806 if ($_POST[
"access"] == 1) $this->tpl->setVariable(
"ACCESS_1",
" selected");
808 $this->tpl->setVariable(
"TXT_NO",$this->lng->txt(
'no'));
809 $this->tpl->setVariable(
"TXT_YES",$this->lng->txt(
'yes'));
810 $this->tpl->setVariable(
"TXT_SAVE",$this->lng->txt(
'save'));
811 $this->tpl->setVariable(
"TXT_CANCEL",$this->lng->txt(
'cancel'));
812 $this->tpl->setVariable(
"STATISTICS",
"showStatistics");
820 if(!isset(
$_GET[
'sell_id']))
828 if(!isset(
$_GET[
'user_id']))
836 if ($_POST[
"pay_method"] ==
"" ||
837 $_POST[
"duration"] ==
"")
850 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$this->user_obj->getId().
'_'.substr((
string) time(),-3);
851 $transaction = $inst_id_time.substr(md5(uniqid(rand(),
true)), 0, 4);
852 $this->booking_obj->setTransaction($transaction);
853 $this->booking_obj->setTransactionExtern($_POST[
"transaction"]);
854 $this->booking_obj->setPobjectId($pObjectId);
855 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
856 $this->booking_obj->setVendorId($obj->getVendorId());
857 $this->booking_obj->setPayMethod((
int) $_POST[
"pay_method"]);
858 $this->booking_obj->setOrderDate(time());
860 $this->booking_obj->setDuration($price[
"duration"]);
862 $this->booking_obj->setAccess((
int) $_POST[
'access']);
863 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
864 $this->booking_obj->setVoucher(
'');
866 if($this->booking_obj->add())
884 $tpl =& $tbl->getTemplateObject();
887 $tpl->setCurrentBlock(
"tbl_form_header");
889 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
890 $tpl->parseCurrentBlock();
909 $tbl->setTitle($this->lng->txt(
"paya_statistic"),
"icon_pays.gif",$this->lng->txt(
"paya_statistic"));
910 $tbl->setHeaderNames(array($this->lng->txt(
"paya_transaction"),
911 $this->lng->txt(
"title"),
912 $this->lng->txt(
"paya_vendor"),
913 $this->lng->txt(
"paya_customer"),
914 $this->lng->txt(
"paya_order_date"),
915 $this->lng->txt(
"duration"),
916 $this->lng->txt(
"price_a"),
917 $this->lng->txt(
"paya_coupons_coupons"),
918 $this->lng->txt(
"paya_payed_access"),
920 $header_params = $this->ctrl->getParameterArray($this,
'');
921 $tbl->setHeaderVars(array(
"transaction",
930 "options"),$header_params);
938 $offset =
$_GET[
"offset"];
939 $order =
$_GET[
"sort_by"];
940 $direction =
$_GET[
"sort_order"] ?
$_GET[
'sort_order'] :
'desc';
942 $tbl->setOrderColumn($order,
'order_date');
943 $tbl->setOrderDirection($direction);
944 $tbl->setOffset($offset);
945 $tbl->setLimit(
$_GET[
"limit"]);
946 $tbl->setMaxCount(count($a_result_set));
947 $tbl->setFooter(
"tblfooter",$this->lng->txt(
"previous"),$this->lng->txt(
"next"));
948 $tbl->setData($a_result_set);
950 $tpl->setVariable(
"COLUMN_COUNTS",10);
951 $tpl->setCurrentBlock(
"plain_buttons");
952 $tpl->setVariable(
"PBTN_NAME",
"excelExport");
953 $tpl->setVariable(
"PBTN_VALUE",$this->lng->txt(
"excel_export"));
954 $tpl->parseCurrentBlock();
958 $this->tpl->setVariable(
"STATISTIC_TABLE",$tbl->tpl->get());
965 include_once
'./payment/classes/class.ilPaymentBookings.php';
972 $this->tpl->addBlockfile(
"BUTTONS",
"buttons",
"tpl.buttons.html");
975 $this->tpl->setCurrentBlock(
"btn_cell");
976 $this->tpl->setVariable(
"BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
977 $this->tpl->setVariable(
"BTN_TXT",$a_text);
980 $this->tpl->setVariable(
"BTN_TARGET",$a_target);
983 $this->tpl->parseCurrentBlock();
988 include_once(
"./classes/class.ilSearch.php");
990 $this->lng->loadLanguageModule(
"content");
992 $search =&
new ilSearch($this->user_obj->getId());
995 $search->setCombination(
"and");
996 $search->setSearchFor(array(0 =>
'usr'));
997 $search->setSearchType(
'new');
999 if($search->validate($message))
1001 $search->performSearch();
1006 $this->ctrl->redirect($this,
"searchUser");
1008 return $search->getResultByType(
'usr');
1013 $tpl =& $tbl->getTemplateObject();
1017 $tpl->setCurrentBlock(
"tbl_form_header");
1018 $this->ctrl->setParameter($this,
"sell_id",
$_GET[
"sell_id"]);
1019 $tpl->setVariable(
"FORMACTION",$this->ctrl->getFormAction($this));
1020 $tpl->parseCurrentBlock();
1022 $tpl->setCurrentBlock(
"tbl_action_btn");
1023 $tpl->setVariable(
"BTN_NAME",
"addCustomer");
1024 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"add"));
1025 $tpl->parseCurrentBlock();
1027 $tpl->setCurrentBlock(
"tbl_action_btn");
1028 $tpl->setVariable(
"BTN_NAME",
"showStatistics");
1029 $tpl->setVariable(
"BTN_VALUE",$this->lng->txt(
"cancel"));
1030 $tpl->parseCurrentBlock();
1032 $tpl->setCurrentBlock(
"tbl_action_row");
1033 $tpl->setVariable(
"COLUMN_COUNTS",5);
1035 $tpl->parseCurrentBlock();
1037 $tbl->setTitle($this->lng->txt(
"users"),
"icon_usr.gif",$this->lng->txt(
"crs_header_edit_members"));
1038 $tbl->setHeaderNames(array(
"",
1039 $this->lng->txt(
"login"),
1040 $this->lng->txt(
"firstname"),
1041 $this->lng->txt(
"lastname")));
1042 $this->ctrl->setParameter($this,
"cmd",
"addCustomer");
1043 $header_params = $this->ctrl->getParameterArray($this,
'');
1044 $tbl->setHeaderVars(array(
"",
1047 "lastname"), $header_params);
1054 $tbl->setColumnWidth(array(
"3%",
"32%",
"32%",
"32%"));
1059 $this->tpl->setVariable(
"SEARCH_RESULT_TABLE",$tbl->tpl->get());