ILIAS  Release_4_0_x_branch Revision 61816
 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 "./Services/Repository/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'], false);
99 
100  $tmp_vendor =& ilObjectFactory::getInstanceByObjId($booking['b_vendor_id']);
101  $tmp_purchaser =& ilObjectFactory::getInstanceByObjId($booking['customer_id']);
102 
103  $transaction = $booking['transaction_extern'];
104  switch ($booking['b_pay_method'])
105  {
106  case PAY_METHOD_BILL :
107  $transaction .= " (" . $this->lng->txt("pays_bill") . ")";
108  break;
109  case PAY_METHOD_BMF :
110  $transaction .= " (" . $this->lng->txt("pays_bmf") . ")";
111  break;
112  case PAY_METHOD_PAYPAL :
113  $transaction .= " (" . $this->lng->txt("pays_paypal") . ")";
114  break;
115  }
116  $f_result[$counter][] = $transaction;
117 
118  if($tmp_obj)
119  {
120  $obj_link = ilRepositoryExplorer::buildLinkTarget($booking['ref_id'],$tmp_obj->getType());
121  $obj_target = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$booking['ref_id'],$tmp_obj->getId());
122  $f_result[$counter][] = "<a href=\"".$obj_link."\" target=\"".$obj_target."\">".$tmp_obj->getTitle()."</a>";
123  }
124  else
125  {
126  $f_result[$counter][] = $this->lng->txt('object_not_found');
127  }
128  /*
129  if ($tmp_obj->getType() == "crs")
130  {
131  $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" .
132  $booking["ref_id"] . "\">" . $tmp_obj->getTitle() . "</a>";
133  }
134  else if ($tmp_obj->getType() == "lm")
135  {
136  $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" .
137  $booking["ref_id"] . "\" target=\"_blank\">" . $tmp_obj->getTitle() . "</a>";
138  }
139  else
140  {
141  $f_result[$counter][] = $tmp_obj->getTitle();
142  }
143  */
144  $f_result[$counter][] = '['.$tmp_vendor->getLogin().']';
145  $f_result[$counter][] = '['.$tmp_purchaser->getLogin().']';
146  $f_result[$counter][] = date("Y-m-d H:i:s", $booking['order_date']);
147  $f_result[$counter][] = $booking['duration'];
148  $f_result[$counter][] = $booking['price'];
149  $f_result[$counter][] = ($booking['discount'] != '' ? $booking['discount'] : '&nbsp;');
150 
151  $payed_access = $booking['payed'] ?
152  $this->lng->txt('yes') :
153  $this->lng->txt('no');
154 
155  $payed_access .= '/';
156  $payed_access .= $booking['access'] ?
157  $this->lng->txt('yes') :
158  $this->lng->txt('no');
159 
160  $f_result[$counter][] = $payed_access;
161 
162  unset($tmp_obj);
163  unset($tmp_vendor);
164  unset($tmp_purchaser);
165 
166  ++$counter;
167  }
168  return $this->__showStatisticTable($f_result);
169  }
170 
171  // PRIVATE
172  function __showStatisticTable($a_result_set)
173  {
174  $tbl =& $this->initTableGUI();
175  $tpl =& $tbl->getTemplateObject();
176 
177  // SET FORMAACTION
178  $tpl->setCurrentBlock("tbl_form_header");
179 
180  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
181  $tpl->parseCurrentBlock();
182 
183 
184  //$tbl->setTitle($this->lng->txt("paya_buyed_objects"),"icon_pays_access.gif",$this->lng->txt("paya_statistic"));
185  $tbl->setTitle($this->lng->txt("paya_buyed_objects"),"icon_pays_access.gif",$this->lng->txt("bookings"));
186  $tbl->setHeaderNames(array($this->lng->txt("paya_transaction"),
187  $this->lng->txt("title"),
188  $this->lng->txt("paya_vendor"),
189  $this->lng->txt("paya_customer"),
190  $this->lng->txt("paya_order_date"),
191  $this->lng->txt("duration"),
192  $this->lng->txt("price_a"),
193  $this->lng->txt("paya_coupons_coupon"),
194  $this->lng->txt("paya_payed_access")));
195  $header_params = $this->ctrl->getParameterArray($this,'');
196  $tbl->setHeaderVars(array("transaction",
197  "title",
198  "vendor",
199  "customer",
200  "order_date",
201  "duration",
202  "price",
203  "discount",
204  "payed_access"),$header_params);
205  /*
206  array("cmd" => "",
207  "cmdClass" => "ilpaymentbuyedobjectsgui",
208  "baseClass" => "ilPersonalDesktopGUI",
209  "cmdNode" => $_GET["cmdNode"]));
210  */
211 
212  $offset = $_GET["offset"];
213  $order = $_GET["sort_by"];
214  $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
215 
216  $tbl->setOrderColumn($order,'order_date');
217  $tbl->setOrderDirection($direction);
218  $tbl->setOffset($offset);
219  $tbl->setLimit($_GET["limit"]);
220  $tbl->setMaxCount(count($a_result_set));
221  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
222  $tbl->setData($a_result_set);
223 
224 
225  $tbl->render();
226 
227  $this->tpl->setVariable("STATISTIC_TABLE",$tbl->tpl->get());
228 
229  return true;
230  }
231 
232 
234  {
235  include_once './payment/classes/class.ilPaymentBookings.php';
236 
237  $this->bookings_obj =& new ilPaymentBookings();
238 
239  return true;
240  }
241 
242 }
243 ?>