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

Generated on Fri Dec 13 2013 09:06:37 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1