ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilPaymentBuyedObjectsGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
32 include_once './payment/classes/class.ilPaymentBaseGUI.php';
33 
35 {
36  var $ctrl;
37 
38  var $lng;
39  var $user_obj;
40 
41  /*
42  * shopping cart obj
43  */
44  var $psc_obj = null;
45 
47  {
48  global $ilCtrl,$tpl;
49 
50  $this->ctrl =& $ilCtrl;
51  $this->tpl =& $tpl;
52 
53  $this->ilPaymentBaseGUI();
54 
55  $this->user_obj =& $user_obj;
56 
57  }
61  function &executeCommand()
62  {
63  global $tree;
64 
65  $cmd = $this->ctrl->getCmd();
66  switch ($this->ctrl->getNextClass($this))
67  {
68 
69  default:
70  if(!$cmd = $this->ctrl->getCmd())
71  {
72  $cmd = 'showItems';
73  }
74  $this->$cmd();
75  break;
76  }
77  }
78 
79  function showItems()
80  {
81  include_once "./classes/class.ilRepositoryExplorer.php";
82 
83  $this->__initBookingsObject();
84 
85  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_personal_statistic.html','payment');
86 
87  if(!count($bookings = $this->bookings_obj->getBookingsOfCustomer($this->user_obj->getId())))
88  {
89  ilUtil::sendInfo($this->lng->txt('pay_not_buyed_any_object'));
90 
91  return true;
92  }
93 
94  $counter = 0;
95 
96  foreach($bookings as $booking)
97  {
98  $tmp_obj =& ilObjectFactory::getInstanceByRefId($booking['ref_id']);
99  $tmp_vendor =& ilObjectFactory::getInstanceByObjId($booking['b_vendor_id']);
100  $tmp_purchaser =& ilObjectFactory::getInstanceByObjId($booking['customer_id']);
101 
102  $transaction = $booking['transaction_extern'];
103  switch ($booking['b_pay_method'])
104  {
105  case PAY_METHOD_BILL :
106  $transaction .= " (" . $this->lng->txt("pays_bill") . ")";
107  break;
108  case PAY_METHOD_BMF :
109  $transaction .= " (" . $this->lng->txt("pays_bmf") . ")";
110  break;
111  case PAY_METHOD_PAYPAL :
112  $transaction .= " (" . $this->lng->txt("pays_paypal") . ")";
113  break;
114  }
115  $f_result[$counter][] = $transaction;
116 
117  $obj_link = ilRepositoryExplorer::buildLinkTarget($booking['ref_id'],$tmp_obj->getType());
118  $obj_target = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$booking['ref_id'],$tmp_obj->getId());
119  $f_result[$counter][] = "<a href=\"".$obj_link."\" target=\"".$obj_target."\">".$tmp_obj->getTitle()."</a>";
120 
121  /*
122  if ($tmp_obj->getType() == "crs")
123  {
124  $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" .
125  $booking["ref_id"] . "\">" . $tmp_obj->getTitle() . "</a>";
126  }
127  else if ($tmp_obj->getType() == "lm")
128  {
129  $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" .
130  $booking["ref_id"] . "\" target=\"_blank\">" . $tmp_obj->getTitle() . "</a>";
131  }
132  else
133  {
134  $f_result[$counter][] = $tmp_obj->getTitle();
135  }
136  */
137  $f_result[$counter][] = '['.$tmp_vendor->getLogin().']';
138  $f_result[$counter][] = '['.$tmp_purchaser->getLogin().']';
139  $f_result[$counter][] = date("Y-m-d H:i:s", $booking['order_date']);
140  $f_result[$counter][] = $booking['duration'];
141  $f_result[$counter][] = $booking['price'];
142  $f_result[$counter][] = ($booking['discount'] != '' ? $booking['discount'] : '&nbsp;');
143 
144  $payed_access = $booking['payed'] ?
145  $this->lng->txt('yes') :
146  $this->lng->txt('no');
147 
148  $payed_access .= '/';
149  $payed_access .= $booking['access'] ?
150  $this->lng->txt('yes') :
151  $this->lng->txt('no');
152 
153  $f_result[$counter][] = $payed_access;
154 
155  unset($tmp_obj);
156  unset($tmp_vendor);
157  unset($tmp_purchaser);
158 
159  ++$counter;
160  }
161  return $this->__showStatisticTable($f_result);
162  }
163 
164  // PRIVATE
165  function __showStatisticTable($a_result_set)
166  {
167  $tbl =& $this->initTableGUI();
168  $tpl =& $tbl->getTemplateObject();
169 
170  // SET FORMAACTION
171  $tpl->setCurrentBlock("tbl_form_header");
172 
173  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
174  $tpl->parseCurrentBlock();
175 
176 
177  $tbl->setTitle($this->lng->txt("paya_buyed_objects"),"icon_pays_access.gif",$this->lng->txt("paya_statistic"));
178  $tbl->setHeaderNames(array($this->lng->txt("paya_transaction"),
179  $this->lng->txt("title"),
180  $this->lng->txt("paya_vendor"),
181  $this->lng->txt("paya_customer"),
182  $this->lng->txt("paya_order_date"),
183  $this->lng->txt("duration"),
184  $this->lng->txt("price_a"),
185  $this->lng->txt("paya_coupons_coupon"),
186  $this->lng->txt("paya_payed_access")));
187  $header_params = $this->ctrl->getParameterArray($this,'');
188  $tbl->setHeaderVars(array("transaction",
189  "title",
190  "vendor",
191  "customer",
192  "order_date",
193  "duration",
194  "price",
195  "discount",
196  "payed_access"),$header_params);
197  /*
198  array("cmd" => "",
199  "cmdClass" => "ilpaymentbuyedobjectsgui",
200  "baseClass" => "ilPersonalDesktopGUI",
201  "cmdNode" => $_GET["cmdNode"]));
202  */
203 
204  $offset = $_GET["offset"];
205  $order = $_GET["sort_by"];
206  $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
207 
208  $tbl->setOrderColumn($order,'order_date');
209  $tbl->setOrderDirection($direction);
210  $tbl->setOffset($offset);
211  $tbl->setLimit($_GET["limit"]);
212  $tbl->setMaxCount(count($a_result_set));
213  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
214  $tbl->setData($a_result_set);
215 
216 
217  $tbl->render();
218 
219  $this->tpl->setVariable("STATISTIC_TABLE",$tbl->tpl->get());
220 
221  return true;
222  }
223 
224 
226  {
227  include_once './payment/classes/class.ilPaymentBookings.php';
228 
229  $this->bookings_obj =& new ilPaymentBookings();
230 
231  return true;
232  }
233 
234 }
235 ?>