13 include_once 
'./Services/Payment/classes/class.ilPaymentObject.php';
 
   14 include_once 
'./Services/Payment/classes/class.ilPayMethods.php';
 
   15 include_once 
'./Services/Payment/classes/class.ilPaymentCurrency.php';
 
   16 include_once 
'./Services/Form/classes/class.ilPropertyFormGUI.php';
 
   17 include_once 
'./Services/Payment/classes/class.ilShopTableGUI.php';
 
   28                 $this->ctrl->saveParameter($this, 
'baseClass');
 
   30                 $this->user_obj = $user_obj;
 
   43                 $ilTabs->setTabActive(
'paya_header');
 
   44                 $ilTabs->setSubTabActive(
'bookings');
 
   49                 $cmd = $this->ctrl->getCmd();
 
   51                 switch ($this->ctrl->getNextClass($this))
 
   54                                 if(!
$cmd = $this->ctrl->getCmd())
 
   56                                         $cmd = 
'showStatistics';
 
   67                 unset(
$_POST[
"transaction_type"]);
 
   68                 unset(
$_POST[
"transaction_value"]);
 
   69                 unset(
$_POST[
"from"][
"day"]);
 
   70                 unset(
$_POST[
"from"][
"month"]);
 
   71                 unset(
$_POST[
"from"][
"year"]);
 
   72                 unset(
$_POST[
"til"][
"day"]);
 
   73                 unset(
$_POST[
"til"][
"month"]);
 
   74                 unset(
$_POST[
"til"][
"year"]);
 
   78                 unset(
$_POST[
"pay_method"]);
 
   79                 unset(
$_POST[
"updateView"]);
 
   80                 unset(
$_POST[
"filter_title_id"]);
 
   87                 global $rbacsystem, $ilToolbar, $ilObjDataCache;
 
   97                 $ilToolbar->addButton($this->lng->txt(
'paya_add_customer'), $this->ctrl->getLinkTarget($this, 
'showObjectSelector'));
 
   98                 if(!
$_POST[
'show_filter'] && 
$_POST[
'updateView'] == 
'1')
 
  103                 if (
$_POST[
'updateView'] == 1)
 
  106                         $_SESSION[
'pay_statistics'][
'updateView'] = 
true;
 
  109                         $_SESSION[
'pay_statistics'][
'transaction_type'] = isset(
$_POST[
'transaction_type']) ? 
$_POST[
'transaction_type'] : 
'' ;
 
  110                         $_SESSION[
'pay_statistics'][
'transaction_value'] = isset(
$_POST[
'transaction_value']) ?  
$_POST[
'transaction_value'] : 
'';
 
  111                         $_SESSION[
'pay_statistics'][
'filter_title_id'] = (int)
$_POST[
'filter_title_id'];
 
  113                         if(
$_SESSION[
'pay_statistics'][
'from_check'] == 
'1')
 
  115                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] = 
$_POST[
'from'][
'date'][
'd'];
 
  116                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] = 
$_POST[
'from'][
'date'][
'm'];
 
  117                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] = 
$_POST[
'from'][
'date'][
'y'];
 
  121                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'd'] = 
'';
 
  122                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'm'] = 
'';
 
  123                                 $_SESSION[
'pay_statistics'][
'from'][
'date'][
'y'] = 
'';
 
  126                         if(
$_SESSION[
'pay_statistics'][
'until_check']== 
'1')
 
  128                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] = 
$_POST[
'til'][
'date'][
'd'];
 
  129                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] = 
$_POST[
'til'][
'date'][
'm'];
 
  130                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] = 
$_POST[
'til'][
'date'][
'y'];
 
  134                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'd'] = 
'';
 
  135                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'm'] = 
'';
 
  136                                 $_SESSION[
'pay_statistics'][
'til'][
'date'][
'y'] = 
'';
 
  146                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
 
  148                 include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
  151                 $filter_form->setFormAction($this->ctrl->getFormAction($this));
 
  152                 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
 
  153                 $filter_form->setId(
'formular');
 
  154                 $filter_form->setTableWidth(
'100 %');
 
  157                 $o_hide_check = 
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
 
  158                 $o_hide_check->setValue(1);             
 
  159                 $o_hide_check->setChecked(
$_SESSION[
'pay_statistics'][
'show_filter'] ? 1 : 0);          
 
  162                 $o_hidden->setValue(1);
 
  163                 $o_hidden->setPostVar(
'updateView');
 
  164                 $o_hide_check->addSubItem($o_hidden);
 
  167                 $trans_option = array($this->lng->txt(
'pay_starting'),$this->lng->txt(
'pay_ending'));
 
  168                 $trans_value = array(
'0',
'1'); 
 
  169                 $o_transaction_type->setTitle($this->lng->txt(
'paya_transaction'));
 
  170                 $o_transaction_type->setOptions($trans_option);
 
  171                 $o_transaction_type->setValue(
$_SESSION[
'pay_statistics'][
'transaction_type']);         
 
  172                 $o_transaction_type->setPostVar(
'transaction_type');
 
  173                 $o_hide_check->addSubItem($o_transaction_type);
 
  176                 $o_transaction_val->setValue(
$_SESSION[
'pay_statistics'][
'transaction_value']);         
 
  177                 $o_transaction_val->setPostVar(
'transaction_value');
 
  178                 $o_hide_check->addSubItem($o_transaction_val);
 
  181                 $o_customer->setTitle($this->lng->txt(
'paya_customer'));
 
  182                 $o_customer->setValue(
$_SESSION[
'pay_statistics'][
'customer']);         
 
  183                 $o_customer->setPostVar(
'customer');
 
  184                 $o_hide_check->addSubItem($o_customer);
 
  187                 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
 
  188                 $o_vendor->setValue(
$_SESSION[
'pay_statistics'][
'vendor']);                             
 
  189                 $o_vendor->setPostVar(
'vendor');
 
  190                 $o_hide_check->addSubItem($o_vendor);
 
  192                 $o_from_check = 
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_from'),
'from_check');
 
  193                 $o_from_check->setValue(1);             
 
  194                 $o_from_check->setChecked(
$_SESSION[
'pay_statistics'][
'from_check'] ? 1 : 0);           
 
  197                 $o_date_from->setPostVar(
'from');                       
 
  200                 if(
$_SESSION[
'pay_statistics'][
'from_check'] == 
'1') 
 
  202                         $o_date_from->checkInput();     
 
  205                 $o_from_check->addSubItem($o_date_from);
 
  206                 $o_hide_check->addSubItem($o_from_check);
 
  208                 $o_until_check = 
new ilCheckBoxInputGUI($this->lng->txt(
'pay_order_date_til'), 
'until_check');
 
  209                 $o_until_check->setValue(1);    
 
  210                 $o_until_check->setChecked(
$_SESSION[
'pay_statistics'][
'until_check'] ? 1 : 0);                         
 
  213                 $o_date_until->setPostVar(
'til');
 
  216                 if(
$_SESSION[
'pay_statistics'][
'until_check'] == 
'1') 
 
  218                         $o_date_until->checkInput();    
 
  221                 $o_until_check->addSubItem($o_date_until);
 
  222                 $o_hide_check->addSubItem($o_until_check);      
 
  227                 $title_options[
'all']=$this->lng->txt(
'pay_all');
 
  228                 $unique_titles = $this->booking_obj->getUniqueTitles();
 
  230                 if(is_array($unique_titles) && count($unique_titles))
 
  232                         foreach($unique_titles as 
$ref_id)
 
  234                                 $title_options[
$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
 
  239                 $o_object_title->setTitle($this->lng->txt(
'title'));
 
  240                 $o_object_title->setOptions($title_options);
 
  241                 $o_object_title->setValue(
$_SESSION[
"pay_statistics"][
"filter_title_id"]);
 
  242                 $o_object_title->setPostVar(
'filter_title_id');
 
  243                 $o_hide_check->addSubItem($o_object_title);
 
  246                 $payed_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
 
  248                 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
 
  249                 $o_payed->setOptions($payed_option);
 
  250                 $o_payed->setValue(
$_SESSION[
'pay_statistics'][
'payed']);
 
  251                 $o_payed->setPostVar(
'payed');          
 
  253                 $o_hide_check->addSubItem($o_payed);
 
  256                 $access_option = array(
'all'=>$this->lng->txt(
'pay_all'),
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
 
  258                 $o_access->setTitle($this->lng->txt(
'paya_access'));
 
  259                 $o_access->setOptions($access_option);
 
  260                 $o_access->setValue(
$_SESSION[
'pay_statistics'][
'access']);
 
  261                 $o_access->setPostVar(
'access');
 
  262                 $o_hide_check->addSubItem($o_access);           
 
  265                 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
 
  267                 $o_paymethod->setValue(
$_SESSION[
'pay_statistics'][
'pay_method']);
 
  268                 $o_paymethod->setPostVar(
'pay_method');
 
  269                 $o_hide_check->addSubItem($o_paymethod);                                
 
  271                 $filter_form->addCommandButton(
'showStatistics', $this->lng->txt(
'pay_update_view'));
 
  272                 $filter_form->addCommandButton(
'resetFilter', $this->lng->txt(
'pay_reset_filter'));
 
  274                 $filter_form->addItem($o_hide_check);           
 
  276                 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
 
  282                 if(!count($bookings = $this->booking_obj->getBookings()))
 
  288 #               $this->__showButton('excelExport',$this->lng->txt('excel_export')); 
  290                 $img_change = 
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
 
  291                         $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
 
  292                         "\" border=\"0\" vspace=\"0\"/>";
 
  294                 include_once 
'Services/User/classes/class.ilObjUser.php';
 
  295                 $object_title_cache = array();
 
  296                 $user_title_cache = array();
 
  299                 foreach($bookings as $booking)
 
  301                         if(array_key_exists($booking[
'ref_id'], $object_title_cache))
 
  303                                 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
 
  308                                 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
 
  310                         if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
 
  312                                 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
 
  317                                 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
 
  319                         if(array_key_exists($booking[
'customer_id'], $user_title_cache))
 
  321                                 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
 
  326                                 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
 
  329                         $transaction = $booking[
'transaction_extern'];
 
  331                         $transaction .= 
" (" . $str_paymethod . 
")";
 
  333                         $f_result[$counter][
'transaction'] = $transaction;
 
  334                         $f_result[$counter][
'object_title'] = ($tmp_obj != 
'' ?  $tmp_obj : $this->lng->txt(
'object_deleted'));
 
  335                         $f_result[$counter][
'vendor'] = ($tmp_vendor != 
'' ?  
'['.$tmp_vendor.
']' : $this->lng->txt(
'user_deleted'));
 
  336                         $f_result[$counter][
'customer'] = ($tmp_purchaser != 
'' ?  
'['.$tmp_purchaser.
']' : $this->lng->txt(
'user_deleted'));
 
  339                         if($booking[
'duration'] == 0)
 
  341                                 $booking[
'duration'] = $this->lng->txt(
'unlimited_duration');
 
  344                         $f_result[$counter][
'duration'] = $booking[
'duration'];
 
  346                         $f_result[$counter][
'discount'] = $booking[
'discount'].
' '.$booking[
'currency_unit'];
 
  348                         $payed_access = $booking[
'payed'] ? 
 
  349                                 $this->lng->txt(
'yes') : 
 
  350                                 $this->lng->txt(
'no');
 
  352                         $payed_access .= 
'/';
 
  353                         $payed_access .= $booking[
'access_granted'] ?
 
  354                                 $this->lng->txt(
'yes') : 
 
  355                                 $this->lng->txt(
'no');
 
  357                         $f_result[$counter][
'payed_access'] = $payed_access;
 
  359                         $this->ctrl->setParameter($this,
"booking_id",$booking[
'booking_id']);
 
  360                         $link_change = 
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editStatistic").
"\">".$this->lng->txt(
"edit").
"</a></div>";
 
  362                         $f_result[$counter][
'edit'] = $link_change;
 
  366                         unset($tmp_purchaser);
 
  375                 include_once 
'./Services/Payment/classes/class.ilPaymentExcelWriterAdapter.php';
 
  384                 $workbook = $pewa->getWorkbook();
 
  390                 include_once 
'./Services/Payment/classes/class.ilPaymentVendors.php';
 
  394                 $workbook = $pewa->getWorkbook();
 
  395                 $worksheet = $workbook->addWorksheet($this->lng->txt(
'bookings'));              
 
  397                 $worksheet->mergeCells(0,0,0,8);
 
  398                 $worksheet->setColumn(0,0,16);
 
  399                 $worksheet->setColumn(0,1,32);
 
  400                 $worksheet->setColumn(0,2,32);
 
  401                 $worksheet->setColumn(0,3,16);
 
  402                 $worksheet->setColumn(0,4,16);
 
  403                 $worksheet->setColumn(0,5,16);
 
  404                 $worksheet->setColumn(0,6,24);
 
  405                 $worksheet->setColumn(0,7,8);
 
  406                 $worksheet->setColumn(0,8,12);
 
  407                 $worksheet->setColumn(0,9,16);
 
  409                 $title = $this->lng->txt(
'bookings');
 
  410                 $title .= 
' '.$this->lng->txt(
'as_of');
 
  411                 $title .= strftime(
'%Y-%m-%d %R',time());
 
  413                 $worksheet->writeString(0,0,
$title,$pewa->getFormatTitle());
 
  415                 $worksheet->writeString(1,0,$this->lng->txt(
'payment_system'),$pewa->getFormatHeader());
 
  416                 $worksheet->writeString(1,1,$this->lng->txt(
'paya_transaction'),$pewa->getFormatHeader());
 
  417                 $worksheet->writeString(1,2,$this->lng->txt(
'title'),$pewa->getFormatHeader());
 
  418                 $worksheet->writeString(1,3,$this->lng->txt(
'paya_vendor'),$pewa->getFormatHeader());
 
  419                 $worksheet->writeString(1,4,$this->lng->txt(
'pays_cost_center'),$pewa->getFormatHeader());
 
  420                 $worksheet->writeString(1,5,$this->lng->txt(
'paya_customer'),$pewa->getFormatHeader());
 
  421                 $worksheet->writeString(1,6,$this->lng->txt(
'paya_order_date'),$pewa->getFormatHeader());
 
  422                 $worksheet->writeString(1,7,$this->lng->txt(
'duration'),$pewa->getFormatHeader());
 
  423                 $worksheet->writeString(1,8,$this->lng->txt(
'price_a'),$pewa->getFormatHeader());
 
  424                 $worksheet->writeString(1,9,$this->lng->txt(
'paya_payed_access'),$pewa->getFormatHeader());
 
  426                 if(!count($bookings = $this->booking_obj->getBookings()))
 
  431                 include_once 
'Services/User/classes/class.ilObjUser.php';
 
  432                 $object_title_cache = array();
 
  433                 $user_title_cache = array();
 
  436                 foreach($bookings as $booking)
 
  438                         if(array_key_exists($booking[
'ref_id'], $object_title_cache))
 
  440                                 $tmp_obj = $object_title_cache[$booking[
'ref_id']];
 
  445                                 $object_title_cache[$booking[
'ref_id']] = $tmp_obj;
 
  447                         if(array_key_exists($booking[
'b_vendor_id'], $user_title_cache))
 
  449                                 $tmp_vendor = $user_title_cache[$booking[
'b_vendor_id']];
 
  454                                 $user_title_cache[$booking[
'b_vendor_id']] = $tmp_vendor;
 
  456                         if(array_key_exists($booking[
'customer_id'], $user_title_cache))
 
  458                                 $tmp_purchaser = $user_title_cache[$booking[
'customer_id']];
 
  463                                 $user_title_cache[$booking[
'customer_id']] = $tmp_purchaser;
 
  469                         $worksheet->writeString($counter,1,$booking[
'transaction_extern']);
 
  470                         $worksheet->writeString($counter,2,($tmp_obj != 
'' ?  $tmp_obj : $this->lng->txt(
'object_deleted')));
 
  471                         $worksheet->writeString($counter,3,($tmp_vendor != 
'' ? $tmp_vendor : $this->lng->txt(
'user_deleted')));
 
  473                         $worksheet->writeString($counter,5,($tmp_purchaser != 
'' ? $tmp_purchaser : $this->lng->txt(
'user_deleted')));
 
  474                         $worksheet->writeString($counter,6,strftime(
'%Y-%m-%d %R',$booking[
'order_date']));
 
  475                         $worksheet->writeString($counter,7,$booking[
'duration']);
 
  476                         $worksheet->writeString($counter,8,$booking[
'price']);
 
  478                         $payed_access = $booking[
'payed'] ? 
 
  479                                 $this->lng->txt(
'yes') : 
 
  480                                 $this->lng->txt(
'no');
 
  482                         $payed_access .= 
'/';
 
  483                         $payed_access .= $booking[
'access_granted'] ?
 
  484                                 $this->lng->txt(
'yes') : 
 
  485                                 $this->lng->txt(
'no');
 
  487                         $worksheet->writeString($counter,9,$payed_access);
 
  491                         unset($tmp_purchaser);
 
  501                 if(!isset(
$_GET[
'booking_id']))
 
  509                 include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  510                 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'showStatistics'));
 
  512                 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');  
 
  514                 $this->ctrl->setParameter($this,
'booking_id',(
int) 
$_GET[
'booking_id']);
 
  516                 $bookings = $this->booking_obj->getBookings();
 
  517                 $booking = $bookings[(int) $_GET[
'booking_id']];
 
  520                 if($a_show_confirm_delete)
 
  525                         $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDelete"));
 
  526                         $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_stat"));
 
  527                         $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"), 
"editStatistic");
 
  528                         $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"), 
"performDelete");                     
 
  533                         $oConfirmationGUI->addItem(
'booking_id', $_GET[
'booking_id'], $tmp_obj);
 
  535                         $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
 
  543                 $oForm->setFormAction($this->ctrl->getFormAction($this));
 
  544                 $oForm->setId(
'stat_form');
 
  545                 $oForm->setTableWidth(
'50 %');          
 
  547                 if(is_object($tmp_user))
 
  549                         $frm_user = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
 
  553                         $frm_user = $this->lng->txt(
'user_deleted');
 
  555                 $oForm->setTitle($frm_user);
 
  562                 $oTitleGUI->
setValue($tmp_obj != 
'' ?  $tmp_obj : $this->lng->txt(
'object_deleted'));
 
  563                 $oForm->addItem($oTitleGUI);
 
  567                 $oTransactionGUI->
setValue($booking[
'transaction']);
 
  568                 $oForm->addItem($oTransactionGUI);
 
  573                 if(is_object($tmp_vendor))
 
  575                         $frm_vendor = $tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']';
 
  579                         $frm_vendor =  $this->lng->txt(
'user_deleted');
 
  582                 $oForm->addItem($oVendorGUI);
 
  587                 $oForm->addItem($oPaymethodGUI);        
 
  592                 $oForm->addItem($oOrderdateGUI);        
 
  596                 if($booking[
'duration'] != 0)
 
  598                         $frm_duration = $booking[
'duration'].
' '.$this->lng->txt(
'paya_months');
 
  602                         $frm_duration = $this->lng->txt(
"unlimited_duration");
 
  604                 $oDurationGUI->
setValue($frm_duration);
 
  605                 $oForm->addItem($oDurationGUI);         
 
  609                 $oPriceGUI->
setValue($booking[
'price'].
' '.$booking[
'currency_unit'] );
 
  610                 $oForm->addItem($oPriceGUI);
 
  614                 $payed_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
 
  616                 $oPayedGUI->setTitle($this->lng->txt(
'paya_payed'));
 
  617                 $oPayedGUI->setOptions($payed_option);
 
  618                 $oPayedGUI->setValue($booking[
'payed']);
 
  619                 $oPayedGUI->setPostVar(
'payed');                
 
  620                 $oForm->addItem($oPayedGUI);
 
  624                 $access_option = array(0 => $this->lng->txt(
'no'),1 => $this->lng->txt(
'yes'));
 
  626                 $oAccessGUI->setTitle($this->lng->txt(
'paya_access'));
 
  627                 $oAccessGUI->setOptions($payed_option);
 
  628                 $oAccessGUI->setValue($booking[
'access_granted']);
 
  629                 $oAccessGUI->setPostVar(
'access');              
 
  630                 $oForm->addItem($oAccessGUI);
 
  632                 $oForm->addCommandButton(
'updateStatistic',$this->lng->txt(
'save'));
 
  633                 $oForm->addCommandButton(
'deleteStatistic',$this->lng->txt(
'delete'));
 
  635                 $this->tpl->setVariable(
'FORM',$oForm->getHTML());
 
  687                 if(!isset(
$_GET[
'booking_id']))
 
  696                 $this->booking_obj->setBookingId((
int) 
$_GET[
'booking_id']);
 
  697                 $this->booking_obj->setAccess((
int) 
$_POST[
'access']);
 
  698                 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
 
  700                 if($this->booking_obj->update())
 
  718                 if(!isset(
$_GET[
'booking_id']))
 
  733                 if(!isset(
$_GET[
'booking_id']))
 
  742                 $this->booking_obj->setBookingId((
int) 
$_GET[
'booking_id']);
 
  743                 if(!$this->booking_obj->delete())
 
  745                         die(
'Error deleting booking');
 
  756                 global $tree, $ilToolbar;
 
  758                 include_once 
'./Services/Payment/classes/class.ilPaymentObjectSelector.php';
 
  760                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.paya_object_selector.html",
'Services/Payment');
 
  761                 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'showStatistics'));
 
  765                 $exp = 
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
 
  766                 $exp->
setExpand(
$_GET[
"paya_link_expand"] ? 
$_GET[
"paya_link_expand"] : $tree->readRootId());
 
  767                 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
 
  771                 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
 
  780                 if(!isset(
$_GET[
'sell_id']))
 
  788                 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
 
  790                 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'showObjectSelector'));
 
  792                 $this->lng->loadLanguageModule(
'search');
 
  793                 $this->ctrl->setParameter($this, 
"sell_id", 
$_GET[
"sell_id"]);
 
  796                 $form_gui->setFormAction($this->ctrl->getFormAction($this),
'performSearch');
 
  797                 $form_gui->setTitle($this->lng->txt(
'grp_search_members'));
 
  798                 $form_gui->setId(
'search_form');
 
  800                 $oTitle = 
new ilTextInputGUI($this->lng->txt(
'search_search_term'), 
'search_str');
 
  802                 $oTitle->setSize(40);
 
  803                 $oTitle->setValue(
$_POST[
'search_str']);
 
  804                 $form_gui->addItem($oTitle);            
 
  807                 $form_gui->addCommandButton(
'performSearch', $this->lng->txt(
'search'));
 
  808                 $form_gui->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));       
 
  810                 $this->tpl->setVariable(
'FORM',$form_gui->getHTML());   
 
  821                 if(!trim(
$_POST[
"search_str"]))
 
  836                 if(!isset(
$_GET[
'sell_id']))
 
  844                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.main_view.html",
'Services/Payment');
 
  845                 $this->ctrl->setParameter($this, 
"sell_id", 
$_GET[
"sell_id"]);
 
  847                 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'searchUser'));        
 
  858                         $f_result[$counter][
'user_id'] = $user[
"id"];
 
  859                         $f_result[$counter][
'login'] = $tmp_obj->getLogin();
 
  860                         $f_result[$counter][
'firstname'] = $tmp_obj->getFirstname();
 
  861                         $f_result[$counter][
'lastname'] = $tmp_obj->getLastname();
 
  874                 isset(
$_POST[
'sell_id']) ? $sell_id = 
$_POST[
'sell_id'] : $sell_id = 
$_GET[
'sell_id'];
 
  875                 isset(
$_POST[
'user_id']) ? $user_id = 
$_POST[
'user_id'] : $user_id = 
$_GET[
'user_id'];
 
  896                 $this->tpl->addBlockFile(
"ADM_CONTENT", 
"adm_content", 
"tpl.main_view.html",
'Services/Payment');
 
  897                 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'searchUser'));        
 
  898                 $ilCtrl->setParameter($this, 
"sell_id", $sell_id);
 
  899                 $ilCtrl->setParameter($this, 
"user_id", $user_id);
 
  908                         $tmp_object[
'title'] = $tmp_obj->getTitle();
 
  912                         $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
 
  921                 $oForm->setFormAction($ilCtrl->getFormAction($this, 
'saveCustomer'));
 
  923                 $oForm->setTitle($this->lng->txt($tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']'));
 
  927                 $oTransaction->setTitle($this->lng->txt(
'paya_transaction'));
 
  929                 $oTransaction->setPostVar(
'transaction');
 
  930                 $oForm->addItem($oTransaction);
 
  934                 $oObject->
setValue($tmp_object[
'title']);
 
  935                 $oForm->addItem($oObject);
 
  939                 $oVendor->
setValue($tmp_vendor->getFullname().
' ['.$tmp_vendor->getLogin().
']');
 
  940                 $oForm->addItem($oVendor);
 
  943                 $oPayMethods = 
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'), 
'pay_method');
 
  946                 $oPayMethods->setOptions($payOptions);
 
  947                 $oPayMethods->setValue(
$_POST[
'pay_method']);
 
  948                 $oPayMethods->setPostVar(
'pay_method');
 
  949                 $oForm->addItem($oPayMethods);  
 
  952                 $duration_opions = array();     
 
  954                 if (is_array($prices = $prices_obj->getPrices()))
 
  956                         foreach($prices as $price)
 
  958                                 $duration_options[$price[
'price_id']] = 
 
  965                 $oDuration->setValue(
$_POST[
'duration']);
 
  966                 $oForm->addItem($oDuration);    
 
  970                 $payed_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
 
  972                 $o_payed->setTitle($this->lng->txt(
'paya_payed'));
 
  973                 $o_payed->setOptions($payed_option);
 
  974                 $o_payed->setValue(
$_POST[
'payed']);
 
  975                 $o_payed->setPostVar(
'payed');          
 
  976                 $oForm->addItem($o_payed);      
 
  979                 $access_option = array(
'1'=>$this->lng->txt(
'yes'),
'0'=>$this->lng->txt(
'no'));
 
  981                 $o_access->setTitle($this->lng->txt(
'paya_access'));
 
  982                 $o_access->setOptions($access_option);
 
  983                 $o_access->setValue(
$_POST[
'access']);
 
  984                 $o_access->setPostVar(
'access');
 
  985                 $oForm->addItem($o_access);     
 
  987                 $oForm->addCommandButton(
'saveCustomer',$this->lng->txt(
'save'));
 
  988                 $oForm->addCommandButton(
'showStatistics', $this->lng->txt(
'cancel'));  
 
  990                 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
 
  995                 global 
$ilias,$ilObjDataCache, $ilUser;
 
  998                 if(!isset(
$_GET[
'sell_id']))
 
 1006                 if(!isset(
$_GET[
'user_id']))
 
 1014                 if (
$_POST[
"pay_method"] == 
"" ||
 
 1015                         $_POST[
"duration"] == 
"")
 
 1028                 $inst_id_time = $ilias->getSetting(
'inst_id').
'_'.$this->user_obj->getId().
'_'.substr((
string) time(),-3);
 
 1029                 $transaction = $inst_id_time.substr(md5(uniqid(rand(), 
true)), 0, 4);
 
 1030                 $this->booking_obj->setTransaction($transaction);
 
 1031                 $this->booking_obj->setTransactionExtern(
$_POST[
"transaction"]);
 
 1032                 $this->booking_obj->setPobjectId($pObjectId);
 
 1033                 $this->booking_obj->setCustomerId(
$_GET[
"user_id"]);
 
 1034                 $this->booking_obj->setVendorId($obj->getVendorId());
 
 1035                 $this->booking_obj->setPayMethod((
int) 
$_POST[
"pay_method"]);
 
 1036                 $this->booking_obj->setOrderDate(time());
 
 1040                 $this->booking_obj->setDuration($price[
"duration"]);
 
 1043                 $this->booking_obj->setAccess((
int) $_POST[
'access']);
 
 1044                 $this->booking_obj->setPayed((
int) $_POST[
'payed']);
 
 1045                 $this->booking_obj->setVoucher(
'');
 
 1047                         $obj_id = $ilObjDataCache->lookupObjId($obj->getRefId());
 
 1048                         $obj_type = $ilObjDataCache->lookupType($obj_id);
 
 1049                         $obj_title = $ilObjDataCache->lookupTitle($obj_id);
 
 1051                         include_once 
'Services/Payment/classes/class.ilShopVatsList.php';
 
 1052                         $oVAT = 
new ilShopVats((
int)$obj->getVatId());
 
 1053                         $obj_vat_rate = $oVAT->
getRate();
 
 1054                         $obj_vat_unit = $obj->getVat($this->booking_obj->getPrice());
 
 1056                         $this->booking_obj->setObjectTitle($obj_title);
 
 1057                         $this->booking_obj->setVatRate($obj_vat_rate);
 
 1058                         $this->booking_obj->setVatUnit($obj_vat_unit);
 
 1060                         include_once 
'./Services/Payment/classes/class.ilPayMethods.php';
 
 1072                                 $user_id[] = 
$_GET[
"user_id"];
 
 1076                                 $this->booking_obj->setStreet($cust_obj[
$_GET[
"user_id"]][
'street'],
'');
 
 1078                                 $this->booking_obj->setZipcode($cust_obj[$_GET[
"user_id"]][
'zipcode']);
 
 1079                                 $this->booking_obj->setCity($cust_obj[$_GET[
"user_id"]][
'city']);
 
 1080                                 $this->booking_obj->setCountry($cust_obj[$_GET[
"user_id"]][
'country']);
 
 1083                 if($this->booking_obj->add())
 
 1101                 $tbl->setTitle($this->lng->txt(
"bookings"));
 
 1102                 $tbl->setId(
'tbl_bookings');
 
 1103                 $tbl->setRowTemplate(
"tpl.shop_statistics_row.html", 
"Services/Payment");
 
 1105                 $tbl->addColumn($this->lng->txt(
'paya_transaction'), 
'transaction', 
'10%');
 
 1106                 $tbl->addColumn($this->lng->txt(
'title'), 
'object_title', 
'10%');
 
 1107                 $tbl->addColumn($this->lng->txt(
'paya_vendor'), 
'vendor', 
'10%');
 
 1108                 $tbl->addColumn($this->lng->txt(
'paya_customer'), 
'customer', 
'10%');
 
 1109                 $tbl->addColumn($this->lng->txt(
'paya_order_date'), 
'order_date', 
'10%');
 
 1110                 $tbl->addColumn($this->lng->txt(
'duration'), 
'duration', 
'10%');
 
 1111                 $tbl->addColumn($this->lng->txt(
'price_a'), 
'price', 
'5%');
 
 1112                 $tbl->addColumn($this->lng->txt(
'paya_coupons_coupon'), 
'discount', 
'5%');
 
 1113                 $tbl->addColumn($this->lng->txt(
'paya_payed_access'), 
'payed_access', 
'5%');
 
 1114                 $tbl->addColumn($this->lng->txt(
'edit'), 
'edit', 
'5%');
 
 1115                 $tbl->setData($a_result_set);
 
 1117                 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
 
 1124                 include_once 
'./Services/Payment/classes/class.ilPaymentBookings.php';
 
 1131                 include_once(
"./classes/class.ilSearch.php");
 
 1133                 $this->lng->loadLanguageModule(
"content");
 
 1135                 $search = 
new ilSearch($this->user_obj->getId());
 
 1138                 $search->setCombination(
"and");
 
 1139                 $search->setSearchFor(array(0 => 
'usr'));
 
 1140                 $search->setSearchType(
'new');
 
 1142                 if($search->validate($message))
 
 1144                         $search->performSearch();
 
 1149                         $this->ctrl->redirect($this,
"searchUser");
 
 1151                 return $search->getResultByType(
'usr');
 
 1155                 $this->ctrl->setParameter($this, 
"sell_id", 
$_GET[
"sell_id"]);
 
 1158                 $tbl->setTitle($this->lng->txt(
"users"));
 
 1159                 $tbl->setId(
'tbl_users_search');
 
 1160                 $tbl->setRowTemplate(
"tpl.shop_users_row.html", 
"Services/Payment");
 
 1161                 $tbl->addColumn(
'', 
'user_id', 
'1%', 
true);
 
 1162                 $tbl->addColumn($this->lng->txt(
'login'), 
'login', 
'10%');
 
 1163                 $tbl->addColumn($this->lng->txt(
'firstname'), 
'firstname', 
'10%');
 
 1164                 $tbl->addColumn($this->lng->txt(
'lastname'), 
'lastname', 
'10%');
 
 1166                 $tbl->addMultiCommand(
'addCustomer', $this->lng->txt(
'add'));
 
 1167                 $tbl->setData($a_result_set);
 
 1169                 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());