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

payment/classes/class.ilPaymentStatisticGUI.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.ilPaymentObject.php';
00033 
00034 class ilPaymentStatisticGUI extends ilPaymentBaseGUI
00035 {
00036         var $ctrl;
00037 
00038         var $lng;
00039         var $user_obj;
00040         var $pobject = null;
00041 
00042         function ilPaymentStatisticGUI(&$user_obj)
00043         {
00044                 global $ilCtrl;
00045 
00046                 $this->ctrl =& $ilCtrl;
00047                 $this->ctrl->saveParameter($this, "baseClass");
00048 
00049                 $this->ilPaymentBaseGUI();
00050 
00051                 $this->user_obj =& $user_obj;
00052 
00053                 $this->pobject =& new ilPaymentObject($this->user_obj);
00054 
00055         }
00059         function &executeCommand()
00060         {
00061                 global $tree;
00062 
00063                 $cmd = $this->ctrl->getCmd();
00064                 switch ($this->ctrl->getNextClass($this))
00065                 {
00066                         default:
00067                                 if(!$cmd = $this->ctrl->getCmd())
00068                                 {
00069                                         $cmd = 'showStatistics';
00070                                 }
00071                                 $this->$cmd();
00072                                 break;
00073                 }
00074         }
00075 
00076         function resetFilter()
00077         {
00078                 unset($_SESSION["pay_statistics"]);
00079                 unset($_POST["transaction_type"]);
00080                 unset($_POST["transaction_value"]);
00081                 unset($_POST["from"]["day"]);
00082                 unset($_POST["from"]["month"]);
00083                 unset($_POST["from"]["year"]);
00084                 unset($_POST["til"]["day"]);
00085                 unset($_POST["til"]["month"]);
00086                 unset($_POST["til"]["year"]);
00087                 unset($_POST["payed"]);
00088                 unset($_POST["access"]);
00089                 unset($_POST["customer"]);
00090                 unset($_POST["pay_method"]);
00091                 unset($_POST["updateView"]);
00092                 $this->showStatistics();
00093         }
00094 
00095         function showStatistics()
00096         {
00097                 $this->showButton('showObjectSelector',$this->lng->txt('paya_add_customer'));
00098 
00099                 if ($_POST["updateView"] == 1)
00100                 {
00101                         $_SESSION["pay_statistics"]["updateView"] = true;
00102                         $_SESSION["pay_statistics"]["transaction_type"] = $_POST["transaction_type"];
00103                         $_SESSION["pay_statistics"]["transaction_value"] = $_POST["transaction_value"];
00104                         $_SESSION["pay_statistics"]["from"]["day"] = $_POST["from"]["day"];
00105                         $_SESSION["pay_statistics"]["from"]["month"] = $_POST["from"]["month"];
00106                         $_SESSION["pay_statistics"]["from"]["year"] = $_POST["from"]["year"];
00107                         $_SESSION["pay_statistics"]["til"]["day"] = $_POST["til"]["day"];
00108                         $_SESSION["pay_statistics"]["til"]["month"] = $_POST["til"]["month"];
00109                         $_SESSION["pay_statistics"]["til"]["year"] = $_POST["til"]["year"];
00110                         $_SESSION["pay_statistics"]["payed"] = $_POST["payed"];
00111                         $_SESSION["pay_statistics"]["access"] = $_POST["access"];
00112                         $_SESSION["pay_statistics"]["customer"] = $_POST["customer"];
00113                         $_SESSION["pay_statistics"]["pay_method"] = $_POST["pay_method"];
00114                 }
00115 
00116                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.paya_statistic.html','payment');
00117                 
00118                 $this->tpl->setVariable("TXT_FILTER",$this->lng->txt('pay_filter'));
00119                 $this->tpl->setVariable("FORM_ACTION",$this->ctrl->getFormAction($this));
00120                 $this->tpl->setVariable("TXT_TRANSACTION",$this->lng->txt('paya_transaction'));
00121                 $this->tpl->setVariable("TXT_STARTING",$this->lng->txt('pay_starting'));
00122                 $this->tpl->setVariable("TXT_ENDING",$this->lng->txt('pay_ending'));
00123                 $this->tpl->setVariable("TXT_PAYED",$this->lng->txt('paya_payed'));
00124                 $this->tpl->setVariable("TXT_ALL",$this->lng->txt('pay_all'));
00125                 $this->tpl->setVariable("TXT_YES",$this->lng->txt('yes'));
00126                 $this->tpl->setVariable("TXT_NO",$this->lng->txt('no'));
00127                 $this->tpl->setVariable("TXT_BILL",$this->lng->txt('pays_bill'));
00128                 $this->tpl->setVariable("TXT_BMF",$this->lng->txt('pays_bmf'));
00129                 $this->tpl->setVariable("TXT_PAYPAL",$this->lng->txt('pays_paypal'));
00130                 $this->tpl->setVariable("TXT_CUSTOMER",$this->lng->txt('paya_customer'));
00131                 $this->tpl->setVariable("TXT_ACCESS",$this->lng->txt('paya_access'));
00132                 $this->tpl->setVariable("TXT_PAYMENT",$this->lng->txt('payment_system'));
00133                 $this->tpl->setVariable("TXT_ORDER_DATE_FROM",$this->lng->txt('pay_order_date_from'));
00134                 $this->tpl->setVariable("TXT_ORDER_DATE_TIL",$this->lng->txt('pay_order_date_til'));
00135                 $this->tpl->setVariable("TXT_UPDATE_VIEW",$this->lng->txt('pay_update_view'));
00136                 $this->tpl->setVariable("TXT_RESET_FILTER",$this->lng->txt('pay_reset_filter'));
00137 
00138                 $this->tpl->setVariable("TRANSACTION_TYPE_" . $_SESSION["pay_statistics"]["transaction_type"], " selected");
00139                 $this->tpl->setVariable("TRANSACTION_VALUE", ilUtil::prepareFormOutput($_SESSION["pay_statistics"]["transaction_value"], true));
00140                 $this->tpl->setVariable("PAYED_" . $_SESSION["pay_statistics"]["payed"], " selected");
00141                 $this->tpl->setVariable("ACCESS_" . $_SESSION["pay_statistics"]["access"], " selected");
00142                 $this->tpl->setVariable("PAYMENT_" . $_SESSION["pay_statistics"]["pay_method"], " selected");
00143                 $this->tpl->setVariable("CUSTOMER", ilUtil::prepareFormOutput($_SESSION["pay_statistics"]["customer"], true));
00144                 for ($i = 1; $i <= 31; $i++)
00145                 {
00146                         $this->tpl->setCurrentBlock("loop_from_day");
00147                         $this->tpl->setVariable("LOOP_FROM_DAY", $i < 10 ? "0" . $i : $i);
00148                         if ($_SESSION["pay_statistics"]["from"]["day"] == $i)
00149                         {
00150                                 $this->tpl->setVariable("LOOP_FROM_DAY_SELECTED", " selected");
00151                         }
00152                         $this->tpl->parseCurrentBlock("loop_from_day");
00153                         $this->tpl->setCurrentBlock("loop_til_day");
00154                         $this->tpl->setVariable("LOOP_TIL_DAY", $i < 10 ? "0" . $i : $i);
00155                         if ($_SESSION["pay_statistics"]["til"]["day"] == $i)
00156                         {
00157                                 $this->tpl->setVariable("LOOP_TIL_DAY_SELECTED", " selected");
00158                         }
00159                         $this->tpl->parseCurrentBlock("loop_til_day");
00160                 }
00161                 for ($i = 1; $i <= 12; $i++)
00162                 {
00163                         $this->tpl->setCurrentBlock("loop_from_month");
00164                         $this->tpl->setVariable("LOOP_FROM_MONTH", $i < 10 ? "0" . $i : $i);
00165                         if ($_SESSION["pay_statistics"]["from"]["month"] == $i)
00166                         {
00167                                 $this->tpl->setVariable("LOOP_FROM_MONTH_SELECTED", " selected");
00168                         }
00169                         $this->tpl->parseCurrentBlock("loop_from_month");
00170                         $this->tpl->setCurrentBlock("loop_til_month");
00171                         $this->tpl->setVariable("LOOP_TIL_MONTH", $i < 10 ? "0" . $i : $i);
00172                         if ($_SESSION["pay_statistics"]["til"]["month"] == $i)
00173                         {
00174                                 $this->tpl->setVariable("LOOP_TIL_MONTH_SELECTED", " selected");
00175                         }
00176                         $this->tpl->parseCurrentBlock("loop_til_month");
00177                 }
00178                 for ($i = 2004; $i <= date("Y"); $i++)
00179                 {
00180                         $this->tpl->setCurrentBlock("loop_from_year");
00181                         $this->tpl->setVariable("LOOP_FROM_YEAR", $i);
00182                         if ($_SESSION["pay_statistics"]["from"]["year"] == $i)
00183                         {
00184                                 $this->tpl->setVariable("LOOP_FROM_YEAR_SELECTED", " selected");
00185                         }
00186                         $this->tpl->parseCurrentBlock("loop_from_year");
00187                         $this->tpl->setCurrentBlock("loop_til_year");
00188                         $this->tpl->setVariable("LOOP_TIL_YEAR", $i);
00189                         if ($_SESSION["pay_statistics"]["til"]["year"] == $i)
00190                         {
00191                                 $this->tpl->setVariable("LOOP_TIL_YEAR_SELECTED", " selected");
00192                         }
00193                         $this->tpl->parseCurrentBlock("loop_til_year");
00194                 }
00195                 
00196                 if(!$_SESSION['pay_statistics']['updateView'])
00197                 {
00198                         $this->tpl->setVariable('FILTER_MESSAGE', $this->lng->txt('statistics_filter_advice'));
00199                         return true;
00200                 }
00201 
00202                 $this->__initBookingObject();
00203 
00204                 if(!count($bookings = $this->booking_obj->getBookings()))
00205                 {
00206                         ilUtil::sendInfo($this->lng->txt('paya_no_bookings'));
00207 
00208                         return true;
00209                 }
00210 #               $this->__showButton('excelExport',$this->lng->txt('excel_export'));
00211 
00212                 $img_change = "<img src=\"".ilUtil::getImagePath("edit.gif")."\" alt=\"".
00213                         $this->lng->txt("edit")."\" title=\"".$this->lng->txt("edit").
00214                         "\" border=\"0\" vspace=\"0\"/>";
00215                         
00216                 include_once 'Services/User/classes/class.ilObjUser.php';
00217                 $object_title_cache = array();
00218                 $user_title_cache = array();
00219                 
00220                 $counter = 0;
00221                 foreach($bookings as $booking)
00222                 {
00223                         if(array_key_exists($booking['ref_id'], $object_title_cache))
00224                         {
00225                                 $tmp_obj = $object_title_cache[$booking['ref_id']];
00226                         }
00227                         else
00228                         {
00229                                 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));                          
00230                                 $object_title_cache[$booking['ref_id']] = $tmp_obj;
00231                         }
00232                         if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
00233                         {
00234                                 $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
00235                         }
00236                         else
00237                         {
00238                                 $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
00239                                 $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
00240                         }
00241                         if(array_key_exists($booking['customer_id'], $user_title_cache))
00242                         {
00243                                 $tmp_purchaser = $user_title_cache[$booking['customer_id']];
00244                         }
00245                         else
00246                         {
00247                                 $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
00248                                 $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
00249                         }
00250                         
00251                         $transaction = $booking['transaction_extern'];
00252                         switch ($booking['b_pay_method'])
00253                         {
00254                                 case $this->pobject->PAY_METHOD_BILL :
00255                                         $transaction .= " (" . $this->lng->txt("pays_bill") . ")";
00256                                         break;
00257                                 case $this->pobject->PAY_METHOD_BMF :
00258                                         $transaction .= " (" . $this->lng->txt("pays_bmf") . ")";
00259                                         break;
00260                                 case $this->pobject->PAY_METHOD_PAYPAL :
00261                                         $transaction .= " (" . $this->lng->txt("pays_paypal") . ")";
00262                                         break;
00263                         }
00264                         $f_result[$counter][] = $transaction;
00265                         $f_result[$counter][] = ($tmp_obj != '' ?  $tmp_obj : $this->lng->txt('object_deleted'));
00266                         $f_result[$counter][] = ($tmp_vendor != '' ?  '['.$tmp_vendor.']' : $this->lng->txt('user_deleted'));
00267                         $f_result[$counter][] = ($tmp_purchaser != '' ?  '['.$tmp_purchaser.']' : $this->lng->txt('user_deleted'));
00268                         $f_result[$counter][] = date('Y-m-d H:i:s', $booking['order_date']);
00269                         $f_result[$counter][] = $booking['duration'];
00270                         $f_result[$counter][] = $booking['price'];
00271                         $f_result[$counter][] = $booking['discount'];
00272 
00273                         $payed_access = $booking['payed'] ? 
00274                                 $this->lng->txt('yes') : 
00275                                 $this->lng->txt('no');
00276 
00277                         $payed_access .= '/';
00278                         $payed_access .= $booking['access'] ?
00279                                 $this->lng->txt('yes') : 
00280                                 $this->lng->txt('no');
00281 
00282                         $f_result[$counter][] = $payed_access;
00283 
00284                         $this->ctrl->setParameter($this,"booking_id",$booking['booking_id']);
00285 #                       $link_change = "<a href=\"".$this->ctrl->getLinkTarget($this,"editStatistic")."\"> ".
00286 #                               $img_change."</a>";
00287                         $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,"editStatistic")."\">".$this->lng->txt("edit")."</a></div>";
00288 
00289                         $f_result[$counter][] = $link_change;
00290 
00291                         unset($tmp_obj);
00292                         unset($tmp_vendor);
00293                         unset($tmp_purchaser);
00294 
00295                         ++$counter;
00296                 }
00297                 return $this->__showStatisticTable($f_result);
00298 
00299         }
00300 
00301         function excelExport()
00302         {
00303                 include_once './payment/classes/class.ilPaymentExcelWriterAdapter.php';
00304 
00305                 $pewa =& new ilPaymentExcelWriterAdapter('payment_vendors.xls');
00306 
00307                 // add/fill worksheet
00308                 $this->addStatisticWorksheet($pewa);
00309 
00310                 // HEADER SENT
00311                 
00312                 $workbook =& $pewa->getWorkbook();
00313                 $workbook->close();
00314         }
00315 
00316         function addStatisticWorksheet(&$pewa)
00317         {
00318                 include_once './payment/classes/class.ilPaymentVendors.php';
00319 
00320                 $this->__initBookingObject();
00321 
00322                 if(!count($bookings = $this->booking_obj->getBookings()))
00323                 {
00324                         return false;
00325                 }
00326 
00327                 $workbook =& $pewa->getWorkbook();
00328                 $worksheet =& $workbook->addWorksheet($this->lng->txt('paya_statistic'));
00329                 
00330                 $worksheet->mergeCells(0,0,0,8);
00331                 $worksheet->setColumn(0,0,16);
00332                 $worksheet->setColumn(0,1,32);
00333                 $worksheet->setColumn(0,2,32);
00334                 $worksheet->setColumn(0,3,16);
00335                 $worksheet->setColumn(0,4,16);
00336                 $worksheet->setColumn(0,5,16);
00337                 $worksheet->setColumn(0,6,24);
00338                 $worksheet->setColumn(0,7,8);
00339                 $worksheet->setColumn(0,8,12);
00340                 $worksheet->setColumn(0,9,16);
00341 
00342                 $title = $this->lng->txt('paya_statistic');
00343                 $title .= ' '.$this->lng->txt('as_of');
00344                 $title .= strftime('%Y-%m-%d %R',time());
00345 
00346                 $worksheet->writeString(0,0,$title,$pewa->getFormatTitle());
00347 
00348                 $worksheet->writeString(1,0,$this->lng->txt('payment_system'),$pewa->getFormatHeader());
00349                 $worksheet->writeString(1,1,$this->lng->txt('paya_transaction'),$pewa->getFormatHeader());
00350                 $worksheet->writeString(1,2,$this->lng->txt('title'),$pewa->getFormatHeader());
00351                 $worksheet->writeString(1,3,$this->lng->txt('paya_vendor'),$pewa->getFormatHeader());
00352                 $worksheet->writeString(1,4,$this->lng->txt('pays_cost_center'),$pewa->getFormatHeader());
00353                 $worksheet->writeString(1,5,$this->lng->txt('paya_customer'),$pewa->getFormatHeader());
00354                 $worksheet->writeString(1,6,$this->lng->txt('paya_order_date'),$pewa->getFormatHeader());
00355                 $worksheet->writeString(1,7,$this->lng->txt('duration'),$pewa->getFormatHeader());
00356                 $worksheet->writeString(1,8,$this->lng->txt('price_a'),$pewa->getFormatHeader());
00357                 $worksheet->writeString(1,9,$this->lng->txt('paya_payed_access'),$pewa->getFormatHeader());
00358         
00359                 include_once 'Services/User/classes/class.ilObjUser.php';
00360                 $object_title_cache = array();
00361                 $user_title_cache = array();
00362 
00363                 $counter = 2;
00364                 foreach($bookings as $booking)
00365                 {
00366                         if(array_key_exists($booking['ref_id'], $object_title_cache))
00367                         {
00368                                 $tmp_obj = $object_title_cache[$booking['ref_id']];
00369                         }
00370                         else
00371                         {
00372                                 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));                          
00373                                 $object_title_cache[$booking['ref_id']] = $tmp_obj;
00374                         }
00375                         if(array_key_exists($booking['b_vendor_id'], $user_title_cache))
00376                         {
00377                                 $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
00378                         }
00379                         else
00380                         {
00381                                 $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
00382                                 $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
00383                         }
00384                         if(array_key_exists($booking['customer_id'], $user_title_cache))
00385                         {
00386                                 $tmp_purchaser = $user_title_cache[$booking['customer_id']];
00387                         }
00388                         else
00389                         {
00390                                 $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
00391                                 $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
00392                         }
00393                         
00394                         switch ($booking['b_pay_method'])
00395                         {
00396                                 case $this->pobject->PAY_METHOD_BILL :
00397                                         $pay_method = $this->lng->txt("pays_bill");
00398                                         break;
00399                                 case $this->pobject->PAY_METHOD_BMF :
00400                                         $pay_method = $this->lng->txt("pays_bmf");
00401                                         break;
00402                                 case $this->pobject->PAY_METHOD_PAYPAL :
00403                                         $pay_method = $this->lng->txt("pays_paypal");
00404                                         break;
00405                         }
00406                         $worksheet->writeString($counter,0,$pay_method);
00407                         $worksheet->writeString($counter,1,$booking['transaction_extern']);
00408                         $worksheet->writeString($counter,2,($tmp_obj != '' ?  $tmp_obj : $this->lng->txt('object_deleted')));
00409                         $worksheet->writeString($counter,3,($tmp_vendor != '' ? $tmp_vendor : $this->lng->txt('user_deleted')));
00410                         $worksheet->writeString($counter,4,ilPaymentVendors::_getCostCenter($booking['b_vendor_id']));
00411                         $worksheet->writeString($counter,5,($tmp_purchaser != '' ? $tmp_purchaser : $this->lng->txt('user_deleted')));
00412                         $worksheet->writeString($counter,6,strftime('%Y-%m-%d %R',$booking['order_date']));
00413                         /*
00414                         $worksheet->write($counter,5,ilUtil::excelTime(date('Y',$booking['order_date']),
00415                                                                                                                    date('m',$booking['order_date']),
00416                                                                                                                    date('d',$booking['order_date']),
00417                                                                                                                    date('H',$booking['order_date']),
00418                                                                                                                    date('i',$booking['order_date']),
00419                                                                                                                    date('s',$booking['order_date'])),$pewa->getFormatDate());
00420                         */
00421                         $worksheet->writeString($counter,7,$booking['duration']);
00422                         $worksheet->writeString($counter,8,$booking['price']);
00423                         
00424                         $payed_access = $booking['payed'] ? 
00425                                 $this->lng->txt('yes') : 
00426                                 $this->lng->txt('no');
00427 
00428                         $payed_access .= '/';
00429                         $payed_access .= $booking['access'] ?
00430                                 $this->lng->txt('yes') : 
00431                                 $this->lng->txt('no');
00432 
00433                         $worksheet->writeString($counter,9,$payed_access);
00434 
00435                         unset($tmp_obj);
00436                         unset($tmp_vendor);
00437                         unset($tmp_purchaser);
00438 
00439                         ++$counter;
00440                 }
00441         }               
00442 
00443         function editStatistic($a_show_confirm_delete = false)
00444         {
00445                 if(!isset($_GET['booking_id']))
00446                 {
00447                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00448                         $this->showStatistics();
00449 
00450                         return true;
00451                 }
00452 
00453                 $this->showButton('showStatistics',$this->lng->txt('back'));
00454 
00455                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.paya_edit_statistic.html','payment');
00456                 $this->ctrl->setParameter($this,'booking_id',(int) $_GET['booking_id']);
00457 
00458                 // confirm delete
00459                 if($a_show_confirm_delete)
00460                 {
00461                         $this->tpl->setCurrentBlock("confirm_delete");
00462                         $this->tpl->setVariable("CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
00463                         $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00464                         $this->tpl->setVariable("CONFIRM_CMD",'performDelete');
00465                         $this->tpl->setVariable("TXT_CONFIRM",$this->lng->txt('confirm'));
00466                         $this->tpl->parseCurrentBlock();
00467                 }
00468                         
00469 
00470                 $this->__initBookingObject();
00471                 $bookings = $this->booking_obj->getBookings();
00472                 $booking = $bookings[(int) $_GET['booking_id']];
00473 
00474                 // get customer_obj
00475                 $tmp_user = ilObjectFactory::getInstanceByObjId($booking['customer_id'], false);
00476 
00477 
00478 
00479                 $this->tpl->setVariable("STAT_FORMACTION",$this->ctrl->getFormAction($this));
00480                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_usr.gif'));
00481                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00482                 if(is_object($tmp_user))
00483                 {
00484                         $this->tpl->setVariable('TITLE', $tmp_user->getFullname().' ['.$tmp_user->getLogin().']');
00485                 }
00486                 else
00487                 {
00488                         $this->tpl->setVariable('TITLE', $this->lng->txt('user_deleted'));
00489                 }
00490 
00491                 // TXT
00492                 $pObj = new ilPaymentObject($this->user_obj, $booking["pobject_id"]);
00493                 $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($pObj->getRefId()));                           
00494 
00495                 $this->tpl->setVariable("TXT_OBJECT",$this->lng->txt('title'));
00496                 $this->tpl->setVariable("OBJECT", ($tmp_obj != '' ?  $tmp_obj : $this->lng->txt('object_deleted')));
00497 
00498                 $this->tpl->setVariable("TXT_TRANSACTION",$this->lng->txt('paya_transaction'));
00499                 $this->tpl->setVariable("TXT_VENDOR",$this->lng->txt('paya_vendor'));
00500                 $this->tpl->setVariable("TXT_PAY_METHOD",$this->lng->txt('paya_pay_method'));
00501                 $this->tpl->setVariable("TXT_ORDER_DATE",$this->lng->txt('paya_order_date'));
00502                 $this->tpl->setVariable("TXT_DURATION",$this->lng->txt('duration'));
00503                 $this->tpl->setVariable("TXT_PRICE",$this->lng->txt('price_a'));
00504                 $this->tpl->setVariable("TXT_PAYED",$this->lng->txt('paya_payed'));
00505                 $this->tpl->setVariable("TXT_ACCESS",$this->lng->txt('paya_access'));
00506 
00507                 $this->tpl->setVariable("TRANSACTION",$booking['transaction']);
00508 
00509                 $tmp_vendor = ilObjectFactory::getInstanceByObjId($booking['b_vendor_id'], false);
00510                 if(is_object($tmp_vendor))
00511                 {
00512                         $this->tpl->setVariable('VENDOR', $tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']');
00513                 }
00514                 else
00515                 {
00516                         $this->tpl->setVariable('VENDOR', $this->lng->txt('user_deleted'));
00517                 }
00518 
00519                 switch($booking['b_pay_method'])
00520                 {
00521                         case $this->pobject->PAY_METHOD_BILL:
00522                                 $this->tpl->setVariable("PAY_METHOD",$this->lng->txt('pays_bill'));
00523                                 break;
00524 
00525                         case $this->pobject->PAY_METHOD_BMF:
00526                                 $this->tpl->setVariable("PAY_METHOD",$this->lng->txt('pays_bmf'));
00527                                 break;
00528 
00529                         case $this->pobject->PAY_METHOD_PAYPAL:
00530                                 $this->tpl->setVariable("PAY_METHOD",$this->lng->txt('pays_paypal'));
00531                                 break;
00532 
00533                         default:
00534                                 $this->tpl->setVariable("PAY_METHOD",$this->lng->txt('paya_pay_method_not_specified'));
00535                                 break;
00536                 }
00537                 $this->tpl->setVariable("ORDER_DATE",date('Y m d H:i:s',$booking['order_date']));
00538                 $this->tpl->setVariable("DURATION",$booking['duration'].' '.$this->lng->txt('paya_months'));
00539                 $this->tpl->setVariable("PRICE",$booking['price']);
00540                 
00541                 $yes_no = array(0 => $this->lng->txt('no'),1 => $this->lng->txt('yes'));
00542 
00543                 $this->tpl->setVariable("PAYED",ilUtil::formSelect((int) $booking['payed'],'payed',$yes_no,false,true));
00544                 $this->tpl->setVariable("ACCESS",ilUtil::formSelect((int) $booking['access'],'access',$yes_no,false,true));
00545 
00546                 // buttons
00547                 $this->tpl->setVariable("INPUT_CMD",'updateStatistic');
00548                 $this->tpl->setVariable("INPUT_VALUE",$this->lng->txt('save'));
00549 
00550                 $this->tpl->setVariable("DELETE_CMD",'deleteStatistic');
00551                 $this->tpl->setVariable("DELETE_VALUE",$this->lng->txt('delete'));
00552         }
00553 
00554         function updateStatistic()
00555         {
00556                 if(!isset($_GET['booking_id']))
00557                 {
00558                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00559                         $this->showStatistics();
00560 
00561                         return true;
00562                 }
00563                 $this->__initBookingObject();
00564 
00565                 $this->booking_obj->setBookingId((int) $_GET['booking_id']);
00566                 $this->booking_obj->setAccess((int) $_POST['access']);
00567                 $this->booking_obj->setPayed((int) $_POST['payed']);
00568                 
00569                 if($this->booking_obj->update())
00570                 {
00571                         ilUtil::sendInfo($this->lng->txt('paya_updated_booking'));
00572 
00573                         $this->showStatistics();
00574                         return true;
00575                 }
00576                 else
00577                 {
00578                         ilUtil::sendInfo($this->lng->txt('paya_error_update_booking'));
00579                         $this->showStatistics();
00580                         
00581                         return true;
00582                 }
00583         }
00584 
00585         function deleteStatistic()
00586         {
00587                 if(!isset($_GET['booking_id']))
00588                 {
00589                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00590                         $this->showStatistics();
00591 
00592                         return true;
00593                 }
00594                 ilUtil::sendInfo($this->lng->txt('paya_sure_delete_stat'));
00595 
00596                 $this->editStatistic(true);
00597 
00598                 return true;
00599         }
00600 
00601         function performDelete()
00602         {
00603                 if(!isset($_GET['booking_id']))
00604                 {
00605                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00606                         $this->showStatistics();
00607 
00608                         return true;
00609                 }
00610 
00611                 $this->__initBookingObject();
00612                 $this->booking_obj->setBookingId((int) $_GET['booking_id']);
00613                 if(!$this->booking_obj->delete())
00614                 {
00615                         die('Error deleting booking');
00616                 }
00617                 ilUtil::sendInfo($this->lng->txt('pay_deleted_booking'));
00618 
00619                 $this->showStatistics();
00620 
00621                 return true;
00622         }
00623 
00624         function showObjectSelector()
00625         {
00626                 global $tree;
00627 
00628                 include_once './payment/classes/class.ilPaymentObjectSelector.php';
00629 
00630                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paya_object_selector.html",'payment');
00631                 $this->showButton('showStatistics',$this->lng->txt('back'));
00632 
00633                 ilUtil::sendInfo($this->lng->txt("paya_select_object_to_sell"));
00634 
00635                 $exp = new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,'showObjectSelector'), strtolower(get_class($this)));
00636                 $exp->setExpand($_GET["paya_link_expand"] ? $_GET["paya_link_expand"] : $tree->readRootId());
00637                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'showObjectSelector'));
00638                 
00639                 $exp->setOutput(0);
00640 
00641                 $this->tpl->setVariable("EXPLORER",$exp->getOutput());
00642 
00643                 return true;
00644         }
00645 
00646         function searchUser()
00647         {
00648                 if(!isset($_GET['sell_id']))
00649                 {
00650                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00651                         $this->showObjectSelector();
00652 
00653                         return false;
00654                 }
00655 
00656                 $this->tpl->addBlockFile("ADM_CONTENT","adm_content","tpl.paya_user_search.html",'payment');
00657                 $this->showButton('showObjectSelector',$this->lng->txt('back'));
00658 
00659                 $this->lng->loadLanguageModule('search');
00660 
00661                 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
00662                 $this->tpl->setVariable("F_ACTION",$this->ctrl->getFormAction($this));
00663                 $this->tpl->setVariable("SEARCH_ASSIGN_USR",$this->lng->txt("search_user"));
00664                 $this->tpl->setVariable("SEARCH_SEARCH_TERM",$this->lng->txt("search_search_term"));
00665                 $this->tpl->setVariable("SEARCH_VALUE",$_SESSION["pays_search_str_user_sp"] ? $_SESSION["pays_search_str_user_sp"] : "");
00666                 $this->tpl->setVariable("BTN2_VALUE",$this->lng->txt("cancel"));
00667                 $this->tpl->setVariable("BTN1_VALUE",$this->lng->txt("search"));
00668                 $this->tpl->setVariable("SEARCH","performSearch");
00669                 $this->tpl->setVariable("CANCEL","showStatistics");
00670 
00671                 return true;
00672         }
00673 
00674         function performSearch()
00675         {
00676                 // SAVE it to allow sort in tables
00677                 $_SESSION["pays_search_str_user_sp"] = $_POST["search_str"] = $_POST["search_str"] ? $_POST["search_str"] : $_SESSION["pays_search_str_user_sp"];
00678 
00679 
00680                 if(!trim($_POST["search_str"]))
00681                 {
00682                         ilUtil::sendInfo($this->lng->txt("search_no_search_term"));
00683                         $this->showStatistics();
00684 
00685                         return false;
00686                 }
00687                 if(!count($result = $this->__search(ilUtil::stripSlashes($_POST["search_str"]))))
00688                 {
00689                         ilUtil::sendInfo($this->lng->txt("search_no_match"));
00690                         $this->searchUser();
00691 
00692                         return false;
00693                 }
00694 
00695                 if(!isset($_GET['sell_id']))
00696                 {
00697                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00698                         $this->showObjectSelector();
00699 
00700                         return false;
00701                 }
00702 
00703                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.paya_usr_selection.html",'payment');
00704                 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
00705                 $this->showButton("searchUser",$this->lng->txt("back"));
00706                 
00707                 $counter = 0;
00708                 $f_result = array();
00709                 foreach($result as $user)
00710                 {
00711                         if(!$tmp_obj = ilObjectFactory::getInstanceByObjId($user["id"],false))
00712                         {
00713                                 continue;
00714                         }
00715                         $f_result[$counter][] = ilUtil::formRadiobutton(0,"user_id",$user["id"]);
00716                         $f_result[$counter][] = $tmp_obj->getLogin();
00717                         $f_result[$counter][] = $tmp_obj->getFirstname();
00718                         $f_result[$counter][] = $tmp_obj->getLastname();
00719                         
00720                         unset($tmp_obj);
00721                         ++$counter;
00722                 }
00723                 $this->__showSearchUserTable($f_result);
00724         }
00725 
00726         function addCustomer()
00727         {
00728                 if ($_POST["sell_id"] != "") $_GET["sell_id"] = $_POST["sell_id"];
00729                 if ($_GET["user_id"] != "") $_POST["user_id"] = $_GET["user_id"];
00730 
00731                 if(!isset($_GET['sell_id']))
00732                 {
00733                         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
00734                         $this->showObjectSelector();
00735 
00736                         return true;
00737                 }
00738 
00739                 if(!isset($_POST['user_id']))
00740                 {
00741                         ilUtil::sendInfo($this->lng->txt('paya_no_user_id_given'));
00742                         $this->searchUser();
00743 
00744                         return true;
00745                 }
00746 
00747                 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
00748                 $this->showButton('searchUser',$this->lng->txt('back'));
00749 
00750                 $this->ctrl->setParameter($this, "user_id", $_POST["user_id"]);
00751 
00752                 $pObjectId = ilPaymentObject::_lookupPobjectId($_GET["sell_id"]);
00753                 $obj =& new ilPaymentObject($this->user_obj, $pObjectId);
00754 
00755                 // get obj
00756                 $tmp_obj =& ilObjectFactory::getInstanceByRefId($_GET["sell_id"]);
00757                 // get customer_obj
00758                 $tmp_user =& ilObjectFactory::getInstanceByObjId($_POST["user_id"]);
00759                 // get vendor_obj
00760                 $tmp_vendor =& ilObjectFactory::getInstanceByObjId($obj->getVendorId());
00761 
00762                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.paya_add_customer.html','payment');
00763 
00764                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00765 
00766                 $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_usr.gif'));
00767                 $this->tpl->setVariable("ALT_IMG",$this->lng->txt('obj_usr'));
00768                 $this->tpl->setVariable("TITLE",$tmp_user->getFullname().' ['.$tmp_user->getLogin().']');
00769 
00770                 // TXT
00771                 $this->tpl->setVariable("TXT_TRANSACTION",$this->lng->txt('paya_transaction'));
00772                 $this->tpl->setVariable("TRANSACTION",ilUtil::prepareFormOutput($_POST["transaction"], true));
00773 
00774                 $this->tpl->setVariable("TXT_OBJECT",$this->lng->txt('title'));
00775                 $this->tpl->setVariable("OBJECT",$tmp_obj->getTitle());
00776 
00777                 $this->tpl->setVariable("TXT_VENDOR",$this->lng->txt('paya_vendor'));
00778                 $this->tpl->setVariable("VENDOR",$tmp_vendor->getFullname().' ['.$tmp_vendor->getLogin().']');
00779 
00780                 $this->tpl->setVariable("TXT_PAY_METHOD",$this->lng->txt('paya_pay_method'));
00781                 $this->tpl->setVariable("TXT_PAY_METHOD_BILL",$this->lng->txt('pays_bill'));
00782                 $this->tpl->setVariable("TXT_PAY_METHOD_BMF",$this->lng->txt('pays_bmf'));
00783                 $this->tpl->setVariable("TXT_PAY_METHOD_PAYPAL",$this->lng->txt('pays_paypal'));
00784                 $this->tpl->setVariable("PAY_METHOD_".$_POST["pay_method"], " selected");
00785 
00786                 $this->tpl->setVariable("TXT_ORDER_DATE",$this->lng->txt('paya_order_date'));
00787                 $this->tpl->setVariable("ORDER_DATE",ilFormat::formatUnixTime(time(), true));
00788 
00789                 $this->tpl->setVariable("TXT_DURATION",$this->lng->txt('duration'));
00790                 include_once './payment/classes/class.ilPaymentPrices.php';
00791                 $prices_obj =& new ilPaymentPrices($pObjectId);
00792                 if (is_array($prices = $prices_obj->getPrices()))
00793                 {
00794                         foreach($prices as $price)
00795                         {
00796                                 $this->tpl->setCurrentBlock("duration_loop");
00797                                 if ($_POST["duration"] == $price["price_id"]) $this->tpl->setVariable("DURATION_LOOP_SELECTED", " selected");
00798                                 $this->tpl->setVariable("DURATION_LOOP_ID", $price["price_id"]);
00799                                 $this->tpl->setVariable("DURATION_LOOP_NAME", $price["duration"]." ".$this->lng->txt("paya_months").", ".ilPaymentPrices::_getPriceString($price["price_id"]));
00800                                 $this->tpl->parseCurrentBlock();
00801                         }
00802                 }
00803 
00804                 $this->tpl->setVariable("TXT_PAYED",$this->lng->txt('paya_payed'));
00805                 if ($_POST["payed"] == 1) $this->tpl->setVariable("PAYED_1", " selected");
00806                 $this->tpl->setVariable("TXT_ACCESS",$this->lng->txt('paya_access'));
00807                 if ($_POST["access"] == 1) $this->tpl->setVariable("ACCESS_1", " selected");
00808 
00809                 $this->tpl->setVariable("TXT_NO",$this->lng->txt('no'));
00810                 $this->tpl->setVariable("TXT_YES",$this->lng->txt('yes'));
00811                 $this->tpl->setVariable("TXT_SAVE",$this->lng->txt('save'));
00812                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00813                 $this->tpl->setVariable("STATISTICS","showStatistics");
00814 
00815         }
00816 
00817         function saveCustomer()
00818         {
00819                 global $ilias;
00820 
00821                 if(!isset($_GET['sell_id']))
00822                 {
00823                         ilUtil::sendInfo($this->lng->txt('paya_error_no_object_id_given'));
00824                         $this->showObjectSelector();
00825 
00826                         return true;
00827                 }
00828 
00829                 if(!isset($_GET['user_id']))
00830                 {
00831                         ilUtil::sendInfo($this->lng->txt('paya_error_no_user_id_given'));
00832                         $this->searchUser();
00833 
00834                         return true;
00835                 }
00836 
00837                 if ($_POST["pay_method"] == "" ||
00838                         $_POST["duration"] == "")
00839                 {
00840                         ilUtil::sendInfo($this->lng->txt('paya_error_mandatory_fields'));
00841                         $this->addCustomer();
00842 
00843                         return true;
00844                 }
00845 
00846                 $pObjectId = ilPaymentObject::_lookupPobjectId($_GET["sell_id"]);
00847                 $obj =& new ilPaymentObject($this->user_obj, $pObjectId);
00848 
00849                 $this->__initBookingObject();
00850 
00851                 $inst_id_time = $ilias->getSetting('inst_id').'_'.$this->user_obj->getId().'_'.substr((string) time(),-3);
00852                 $transaction = $inst_id_time.substr(md5(uniqid(rand(), true)), 0, 4);
00853                 $this->booking_obj->setTransaction($transaction);
00854                 $this->booking_obj->setTransactionExtern($_POST["transaction"]);
00855                 $this->booking_obj->setPobjectId($pObjectId);
00856                 $this->booking_obj->setCustomerId($_GET["user_id"]);
00857                 $this->booking_obj->setVendorId($obj->getVendorId());
00858                 $this->booking_obj->setPayMethod((int) $_POST["pay_method"]);
00859                 $this->booking_obj->setOrderDate(time());
00860                 $price = ilPaymentPrices::_getPrice($_POST["duration"]);
00861                 $this->booking_obj->setDuration($price["duration"]);
00862                 $this->booking_obj->setPrice(ilPaymentPrices::_getPriceString($_POST["duration"]));
00863                 $this->booking_obj->setAccess((int) $_POST['access']);
00864                 $this->booking_obj->setPayed((int) $_POST['payed']);
00865                 $this->booking_obj->setVoucher('');
00866 
00867                 if($this->booking_obj->add())
00868                 {
00869                         ilUtil::sendInfo($this->lng->txt('paya_customer_added_successfully'));
00870                         $this->showStatistics();
00871                 }
00872                 else
00873                 {
00874                         ilUtil::sendInfo($this->lng->txt('paya_error_adding_customer'));
00875                         $this->addCustomer();
00876                 }
00877 
00878                 return true;
00879         }
00880 
00881         // PRIVATE
00882         function __showStatisticTable($a_result_set)
00883         {
00884                 $tbl =& $this->initTableGUI();
00885                 $tpl =& $tbl->getTemplateObject();
00886 
00887                 // SET FORMAACTION
00888                 $tpl->setCurrentBlock("tbl_form_header");
00889 
00890                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00891                 $tpl->parseCurrentBlock();
00892 
00893                 /*
00894                 $tpl->setCurrentBlock("tbl_action_row");
00895                 $tpl->setCurrentBlock("plain_buttons");
00896                 $tpl->parseCurrentBlock();
00897 
00898                 $tpl->setVariable("COLUMN_COUNTS",6);
00899                 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00900 
00901                 $tpl->setCurrentBlock("tbl_action_button");
00902                 $tpl->setVariable("BTN_NAME","deleteTrustee");
00903                 $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
00904                 $tpl->parseCurrentBlock();
00905                 $tpl->setCurrentBlock("tbl_action_row");
00906                 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
00907                 $tpl->parseCurrentBlock();
00908                 */
00909 
00910                 $tbl->setTitle($this->lng->txt("paya_statistic"),"icon_pays.gif",$this->lng->txt("paya_statistic"));
00911                 $tbl->setHeaderNames(array($this->lng->txt("paya_transaction"),
00912                                                                    $this->lng->txt("title"),
00913                                                                    $this->lng->txt("paya_vendor"),
00914                                                                    $this->lng->txt("paya_customer"),
00915                                                                    $this->lng->txt("paya_order_date"),
00916                                                                    $this->lng->txt("duration"),
00917                                                                    $this->lng->txt("price_a"),
00918                                                                    $this->lng->txt("paya_coupons_coupons"),
00919                                                                    $this->lng->txt("paya_payed_access"),
00920                                                                    ''));
00921                 $header_params = $this->ctrl->getParameterArray($this,'');
00922                 $tbl->setHeaderVars(array("transaction",
00923                                                                   "title",
00924                                                                   "vendor",
00925                                                                   "customer",
00926                                                                   "order_date",
00927                                                                   "duration",
00928                                                                   "price",
00929                                                                   "discount",
00930                                                                   "payed_access",
00931                                                                   "options"),$header_params);
00932                                                                   /*
00933                                                         array("cmd" => "",
00934                                                                   "cmdClass" => "ilpaymentstatisticgui",
00935                                                                   "baseClass" => "ilPersonalDesktopGUI",
00936                                                                   "cmdNode" => $_GET["cmdNode"]));
00937                                                                   */
00938 
00939                 $offset = $_GET["offset"];
00940                 $order = $_GET["sort_by"];
00941                 $direction = $_GET["sort_order"] ? $_GET['sort_order'] : 'desc';
00942 
00943                 $tbl->setOrderColumn($order,'order_date');
00944                 $tbl->setOrderDirection($direction);
00945                 $tbl->setOffset($offset);
00946                 $tbl->setLimit($_GET["limit"]);
00947                 $tbl->setMaxCount(count($a_result_set));
00948                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00949                 $tbl->setData($a_result_set);
00950 
00951                 $tpl->setVariable("COLUMN_COUNTS",10);
00952                 $tpl->setCurrentBlock("plain_buttons");
00953                 $tpl->setVariable("PBTN_NAME","excelExport");
00954                 $tpl->setVariable("PBTN_VALUE",$this->lng->txt("excel_export"));
00955                 $tpl->parseCurrentBlock();
00956 
00957                 $tbl->render();
00958 
00959                 $this->tpl->setVariable("STATISTIC_TABLE",$tbl->tpl->get());
00960 
00961                 return true;
00962         }
00963 
00964         function __initBookingObject()
00965         {
00966                 include_once './payment/classes/class.ilPaymentBookings.php';
00967 
00968                 $this->booking_obj =& new ilPaymentBookings($this->user_obj->getId());
00969         }
00970 
00971         function __showButton($a_cmd,$a_text,$a_target = '')
00972         {
00973                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00974                 
00975                 // display button
00976                 $this->tpl->setCurrentBlock("btn_cell");
00977                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,$a_cmd));
00978                 $this->tpl->setVariable("BTN_TXT",$a_text);
00979                 if($a_target)
00980                 {
00981                         $this->tpl->setVariable("BTN_TARGET",$a_target);
00982                 }
00983 
00984                 $this->tpl->parseCurrentBlock();
00985         }               
00986 
00987         function __search($a_search_string)
00988         {
00989                 include_once("./classes/class.ilSearch.php");
00990 
00991                 $this->lng->loadLanguageModule("content");
00992 
00993                 $search =& new ilSearch($this->user_obj->getId());
00994                 $search->setPerformUpdate(false);
00995                 $search->setSearchString(ilUtil::stripSlashes($a_search_string));
00996                 $search->setCombination("and");
00997                 $search->setSearchFor(array(0 => 'usr'));
00998                 $search->setSearchType('new');
00999 
01000                 if($search->validate($message))
01001                 {
01002                         $search->performSearch();
01003                 }
01004                 else
01005                 {
01006                         ilUtil::sendInfo($message,true);
01007                         $this->ctrl->redirect($this,"searchUser");
01008                 }
01009                 return $search->getResultByType('usr');
01010         }
01011         function __showSearchUserTable($a_result_set)
01012         {
01013                 $tbl =& $this->initTableGUI();
01014                 $tpl =& $tbl->getTemplateObject();
01015 
01016 
01017                 // SET FORMACTION
01018                 $tpl->setCurrentBlock("tbl_form_header");
01019                 $this->ctrl->setParameter($this, "sell_id", $_GET["sell_id"]);
01020                 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01021                 $tpl->parseCurrentBlock();
01022 
01023                 $tpl->setCurrentBlock("tbl_action_btn");
01024                 $tpl->setVariable("BTN_NAME","addCustomer");
01025                 $tpl->setVariable("BTN_VALUE",$this->lng->txt("add"));
01026                 $tpl->parseCurrentBlock();
01027 
01028                 $tpl->setCurrentBlock("tbl_action_btn");
01029                 $tpl->setVariable("BTN_NAME","showStatistics");
01030                 $tpl->setVariable("BTN_VALUE",$this->lng->txt("cancel"));
01031                 $tpl->parseCurrentBlock();
01032 
01033                 $tpl->setCurrentBlock("tbl_action_row");
01034                 $tpl->setVariable("COLUMN_COUNTS",5);
01035                 $tpl->setVariable("IMG_ARROW",ilUtil::getImagePath("arrow_downright.gif"));
01036                 $tpl->parseCurrentBlock();
01037 
01038                 $tbl->setTitle($this->lng->txt("users"),"icon_usr.gif",$this->lng->txt("crs_header_edit_members"));
01039                 $tbl->setHeaderNames(array("",
01040                                                                    $this->lng->txt("login"),
01041                                                                    $this->lng->txt("firstname"),
01042                                                                    $this->lng->txt("lastname")));
01043                 $this->ctrl->setParameter($this, "cmd", "addCustomer");
01044                 $header_params = $this->ctrl->getParameterArray($this,'');
01045                 $tbl->setHeaderVars(array("",
01046                                                                   "login",
01047                                                                   "firstname",
01048                                                                   "lastname"), $header_params);
01049                                                                   /*
01050                                                         array("cmd" => 'performSearch',
01051                                                                   "cmdClass" => "ilpaymentstatisticgui",
01052                                                                   "cmdNode" => $_GET["cmdNode"]));
01053                                                                   */
01054 
01055                 $tbl->setColumnWidth(array("3%","32%","32%","32%"));
01056 
01057                 $this->setTableGUIBasicData($tbl,$a_result_set);
01058                 $tbl->render();
01059                 
01060                 $this->tpl->setVariable("SEARCH_RESULT_TABLE",$tbl->tpl->get());
01061 
01062                 return true;
01063         }
01064 }
01065 ?>

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