• 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                         sendInfo($this->lng->txt('pay_not_buyed_any_object'));
00090 
00091                         return true;
00092                 }
00093                 $counter = 0;
00094                 foreach($bookings as $booking)
00095                 {
00096                         $tmp_obj =& ilObjectFactory::getInstanceByRefId($booking['ref_id']);
00097                         $tmp_vendor =& ilObjectFactory::getInstanceByObjId($booking['b_vendor_id']);
00098                         $tmp_purchaser =& ilObjectFactory::getInstanceByObjId($booking['customer_id']);
00099                         
00100                         $transaction = $booking['transaction_extern'];
00101                         switch ($booking['b_pay_method'])
00102                         {
00103                                 case PAY_METHOD_BILL :
00104                                         $transaction .= " (" . $this->lng->txt("pays_bill") . ")";
00105                                         break;
00106                                 case PAY_METHOD_BMF :
00107                                         $transaction .= " (" . $this->lng->txt("pays_bmf") . ")";
00108                                         break;
00109                                 case PAY_METHOD_PAYPAL :
00110                                         $transaction .= " (" . $this->lng->txt("pays_paypal") . ")";
00111                                         break;
00112                         }
00113                         $f_result[$counter][] = $transaction;
00114 
00115                         $obj_link = ilRepositoryExplorer::buildLinkTarget($booking['ref_id'],$tmp_obj->getType());
00116                         $obj_target = ilRepositoryExplorer::buildFrameTarget($tmp_obj->getType(),$booking['ref_id'],$tmp_obj->getId());
00117                         $f_result[$counter][] = "<a href=\"".$obj_link."\" target=\"".$obj_target."\">".$tmp_obj->getTitle()."</a>";
00118                         
00119                         /*
00120                         if ($tmp_obj->getType() == "crs")
00121                         {
00122                                 $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/repository.php?ref_id=" . 
00123                                         $booking["ref_id"] . "\">" . $tmp_obj->getTitle() . "</a>";
00124                         }
00125                         else if ($tmp_obj->getType() == "lm")
00126                         {
00127                                 $f_result[$counter][] = "<a href=\"" . ILIAS_HTTP_PATH . "/content/lm_presentation.php?ref_id=" . 
00128                                         $booking["ref_id"] . "\" target=\"_blank\">" . $tmp_obj->getTitle() . "</a>";
00129                         }
00130                         else
00131                         {
00132                                 $f_result[$counter][] = $tmp_obj->getTitle();
00133                         }
00134                         */
00135                         $f_result[$counter][] = '['.$tmp_vendor->getLogin().']';
00136                         $f_result[$counter][] = '['.$tmp_purchaser->getLogin().']';
00137                         $f_result[$counter][] = date('Y m d H:i:s',$booking['order_date']);
00138                         $f_result[$counter][] = $booking['duration'];
00139                         $f_result[$counter][] = $booking['price'];
00140 
00141                         $payed_access = $booking['payed'] ? 
00142                                 $this->lng->txt('yes') : 
00143                                 $this->lng->txt('no');
00144 
00145                         $payed_access .= '/';
00146                         $payed_access .= $booking['access'] ?
00147                                 $this->lng->txt('yes') : 
00148                                 $this->lng->txt('no');
00149 
00150                         $f_result[$counter][] = $payed_access;
00151 
00152                         unset($tmp_obj);
00153                         unset($tmp_vendor);
00154                         unset($tmp_purchaser);
00155 
00156                         ++$counter;
00157                 }
00158                 return $this->__showStatisticTable($f_result);
00159         }
00160 
00161         // PRIVATE
00162         function __showStatisticTable($a_result_set)
00163         {
00164                 $tbl =& $this->initTableGUI();
00165                 $tpl =& $tbl->getTemplateObject();
00166 
00167                 // SET FORMAACTION
00168                 $tpl->setCurrentBlock("tbl_form_header");
00169 
00170                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00171                 $tpl->parseCurrentBlock();
00172 
00173 
00174                 $tbl->setTitle($this->lng->txt("paya_buyed_objects"),"icon_pays_access.gif",$this->lng->txt("paya_statistic"));
00175                 $tbl->setHeaderNames(array($this->lng->txt("paya_transaction"),
00176                                                                    $this->lng->txt("title"),
00177                                                                    $this->lng->txt("paya_vendor"),
00178                                                                    $this->lng->txt("paya_customer"),
00179                                                                    $this->lng->txt("paya_order_date"),
00180                                                                    $this->lng->txt("duration"),
00181                                                                    $this->lng->txt("price_a"),
00182                                                                    $this->lng->txt("paya_payed_access")));
00183                 $header_params = $this->ctrl->getParameterArray($this,'');
00184                 $tbl->setHeaderVars(array("transaction",
00185                                                                   "title",
00186                                                                   "vendor",
00187                                                                   "customer",
00188                                                                   "order_date",
00189                                                                   "duration",
00190                                                                   "price",
00191                                                                   "payed_access"),$header_params);
00192                                                                   /*
00193                                                         array("cmd" => "",
00194                                                                   "cmdClass" => "ilpaymentbuyedobjectsgui",
00195                                                                   "baseClass" => "ilPersonalDesktopGUI",
00196                                                                   "cmdNode" => $_GET["cmdNode"]));
00197                                                                   */
00198 
00199                 $offset = $_GET["offset"];
00200                 $order = $_GET["sort_by"];
00201                 $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
00202 
00203                 $tbl->setOrderColumn($order,'order_date');
00204                 $tbl->setOrderDirection($direction);
00205                 $tbl->setOffset($offset);
00206                 $tbl->setLimit($_GET["limit"]);
00207                 $tbl->setMaxCount(count($a_result_set));
00208                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00209                 $tbl->setData($a_result_set);
00210 
00211 
00212                 $tbl->render();
00213 
00214                 $this->tpl->setVariable("STATISTIC_TABLE",$tbl->tpl->get());
00215 
00216                 return true;
00217         }
00218 
00219 
00220         function __initBookingsObject()
00221         {
00222                 include_once './payment/classes/class.ilPaymentBookings.php';
00223 
00224                 $this->bookings_obj =& new ilPaymentBookings();
00225                 
00226                 return true;
00227         }
00228 
00229 }
00230 ?>

Generated on Fri Dec 13 2013 13:52:11 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1