• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

payment/classes/class.ilPaymentBuyedObjectsGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00032 include_once './payment/classes/class.ilPaymentBaseGUI.php';
00033 
00034 class ilPaymentBuyedObjectsGUI extends ilPaymentBaseGUI
00035 {
00036         var $ctrl;
00037 
00038         var $lng;
00039         var $user_obj;
00040 
00041         /*
00042          * shopping cart obj
00043          */
00044         var $psc_obj = null;
00045 
00046         function ilPaymentBuyedObjectsGUI(&$user_obj)
00047         {
00048                 global $ilCtrl,$tpl;
00049 
00050                 $this->ctrl =& $ilCtrl;
00051                 $this->tpl =& $tpl;
00052 
00053                 $this->ilPaymentBaseGUI();
00054 
00055                 $this->user_obj =& $user_obj;
00056 
00057         }
00061         function &executeCommand()
00062         {
00063                 global $tree;
00064 
00065                 $cmd = $this->ctrl->getCmd();
00066                 switch ($this->ctrl->getNextClass($this))
00067                 {
00068 
00069                         default:
00070                                 if(!$cmd = $this->ctrl->getCmd())
00071                                 {
00072                                         $cmd = 'showItems';
00073                                 }
00074                                 $this->$cmd();
00075                                 break;
00076                 }
00077         }
00078 
00079         function showItems()
00080         {
00081                 include_once "./classes/class.ilRepositoryExplorer.php";
00082 
00083                 $this->__initBookingsObject();
00084 
00085                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.pay_personal_statistic.html','payment');
00086 
00087                 if(!count($bookings = $this->bookings_obj->getBookingsOfCustomer($this->user_obj->getId())))
00088                 {
00089                         ilUtil::sendInfo($this->lng->txt('pay_not_buyed_any_object'));
00090 
00091                         return true;
00092                 }
00093                 
00094                 $counter = 0;
00095                                 
00096                 foreach($bookings as $booking)
00097                 {
00098                         $tmp_obj =& ilObjectFactory::getInstanceByRefId($booking['ref_id']);
00099                         $tmp_vendor =& ilObjectFactory::getInstanceByObjId($booking['b_vendor_id']);
00100                         $tmp_purchaser =& ilObjectFactory::getInstanceByObjId($booking['customer_id']);
00101                         
00102                         $transaction = $booking['transaction_extern'];
00103                         switch ($booking['b_pay_method'])
00104                         {
00105                                 case PAY_METHOD_BILL :
00106                                         $transaction .= " (" . $this->lng->txt("pays_bill") . ")";
00107                                         break;
00108                                 case PAY_METHOD_BMF :
00109                                         $transaction .= " (" . $this->lng->txt("pays_bmf") . ")";
00110                                         break;
00111                                 case PAY_METHOD_PAYPAL :
00112                                         $transaction .= " (" . $this->lng->txt("pays_paypal") . ")";
00113                                         break;
00114                         }
00115                         $f_result[$counter][] = $transaction;
00116 
00117                         $obj_link = ilRepositoryExplorer::buildLinkTarget($booking['ref_id'],$tmp_obj->getType());
00118                         $obj_target = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$booking['ref_id'],$tmp_obj->getId());
00119                         $f_result[$counter][] = "<a href=\"".$obj_link."\" target=\"".$obj_target."\">".$tmp_obj->getTitle()."</a>";
00120                         
00121                         /*
00122                         if ($tmp_obj->getType() == "crs")
00123                         {
00124                                 $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" . 
00125                                         $booking["ref_id"] . "\">" . $tmp_obj->getTitle() . "</a>";
00126                         }
00127                         else if ($tmp_obj->getType() == "lm")
00128                         {
00129                                 $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" . 
00130                                         $booking["ref_id"] . "\" target=\"_blank\">" . $tmp_obj->getTitle() . "</a>";
00131                         }
00132                         else
00133                         {
00134                                 $f_result[$counter][] = $tmp_obj->getTitle();
00135                         }
00136                         */
00137                         $f_result[$counter][] = '['.$tmp_vendor->getLogin().']';
00138                         $f_result[$counter][] = '['.$tmp_purchaser->getLogin().']';
00139                         $f_result[$counter][] = date("Y-m-d H:i:s", $booking['order_date']);
00140                         $f_result[$counter][] = $booking['duration'];
00141                         $f_result[$counter][] = $booking['price'];
00142                         $f_result[$counter][] = ($booking['discount'] != '' ? $booking['discount'] : '&nbsp;');
00143 
00144                         $payed_access = $booking['payed'] ? 
00145                                 $this->lng->txt('yes') : 
00146                                 $this->lng->txt('no');
00147 
00148                         $payed_access .= '/';
00149                         $payed_access .= $booking['access'] ?
00150                                 $this->lng->txt('yes') : 
00151                                 $this->lng->txt('no');
00152 
00153                         $f_result[$counter][] = $payed_access;
00154 
00155                         unset($tmp_obj);
00156                         unset($tmp_vendor);
00157                         unset($tmp_purchaser);
00158 
00159                         ++$counter;
00160                 }
00161                 return $this->__showStatisticTable($f_result);
00162         }
00163 
00164         // PRIVATE
00165         function __showStatisticTable($a_result_set)
00166         {
00167                 $tbl =& $this->initTableGUI();
00168                 $tpl =& $tbl->getTemplateObject();
00169 
00170                 // SET FORMAACTION
00171                 $tpl->setCurrentBlock("tbl_form_header");
00172 
00173                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00174                 $tpl->parseCurrentBlock();
00175 
00176 
00177                 $tbl->setTitle($this->lng->txt("paya_buyed_objects"),"icon_pays_access.gif",$this->lng->txt("paya_statistic"));
00178                 $tbl->setHeaderNames(array($this->lng->txt("paya_transaction"),
00179                                                                    $this->lng->txt("title"),
00180                                                                    $this->lng->txt("paya_vendor"),
00181                                                                    $this->lng->txt("paya_customer"),
00182                                                                    $this->lng->txt("paya_order_date"),
00183                                                                    $this->lng->txt("duration"),
00184                                                                    $this->lng->txt("price_a"),
00185                                                                    $this->lng->txt("paya_coupons_coupon"),
00186                                                                    $this->lng->txt("paya_payed_access")));
00187                 $header_params = $this->ctrl->getParameterArray($this,'');
00188                 $tbl->setHeaderVars(array("transaction",
00189                                                                   "title",
00190                                                                   "vendor",
00191                                                                   "customer",
00192                                                                   "order_date",
00193                                                                   "duration",
00194                                                                   "price",
00195                                                                   "discount",
00196                                                                   "payed_access"),$header_params);
00197                                                                   /*
00198                                                         array("cmd" => "",
00199                                                                   "cmdClass" => "ilpaymentbuyedobjectsgui",
00200                                                                   "baseClass" => "ilPersonalDesktopGUI",
00201                                                                   "cmdNode" => $_GET["cmdNode"]));
00202                                                                   */
00203 
00204                 $offset = $_GET["offset"];
00205                 $order = $_GET["sort_by"];
00206                 $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
00207 
00208                 $tbl->setOrderColumn($order,'order_date');
00209                 $tbl->setOrderDirection($direction);
00210                 $tbl->setOffset($offset);
00211                 $tbl->setLimit($_GET["limit"]);
00212                 $tbl->setMaxCount(count($a_result_set));
00213                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00214                 $tbl->setData($a_result_set);
00215 
00216 
00217                 $tbl->render();
00218 
00219                 $this->tpl->setVariable("STATISTIC_TABLE",$tbl->tpl->get());
00220 
00221                 return true;
00222         }
00223 
00224 
00225         function __initBookingsObject()
00226         {
00227                 include_once './payment/classes/class.ilPaymentBookings.php';
00228 
00229                 $this->bookings_obj =& new ilPaymentBookings();
00230                 
00231                 return true;
00232         }
00233 
00234 }
00235 ?>

Generated on Fri Dec 13 2013 17:56:54 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1