ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPaymentObjectGUI Class Reference
+ Inheritance diagram for ilPaymentObjectGUI:
+ Collaboration diagram for ilPaymentObjectGUI:

Public Member Functions

 __construct ($user_obj)
 
 executeCommand ()
 
 resetObjectFilter ()
 
 deleteObject ()
 
 performDelete ()
 
 editPayMethod ()
 
 performAddPrice ()
 
 performDeletePrice ()
 
 deletePrice ()
 
 ORg_updatePrice ()
 
 updateDetails ()
 
 showSelectedObject ()
 
 addObject ()
 
 updatePrice ()
 
- Public Member Functions inherited from ilShopBaseGUI
 __construct ()
 

Data Fields

 $ctrl
 
 $lng
 
 $user_obj
 
 $pobject = null
 

Private Member Functions

 __getStatus ()
 
 __showObjectsTable ($a_result_set)
 
 __initPaymentObject ($a_pobject_id=0)
 

Additional Inherited Members

- Protected Member Functions inherited from ilShopBaseGUI
 prepareOutput ()
 
 addPager ($result)
 
- Protected Attributes inherited from ilShopBaseGUI
 $ctrl = null
 
 $lng = null
 
 $tpl = null
 
 $settings = null
 

Detailed Description

Definition at line 20 of file class.ilPaymentObjectGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPaymentObjectGUI::__construct (   $user_obj)

Definition at line 31 of file class.ilPaymentObjectGUI.php.

References $user_obj, ilShopBaseGUI\prepareOutput(), and ilDatePresentation\setUseRelativeDates().

32  {
33  parent::__construct();
34 
35  $this->user_obj = $user_obj;
36  $this->lng->loadLanguageModule('crs');
38  }
static setUseRelativeDates($a_status)
set use relative dates
+ Here is the call graph for this function:

Member Function Documentation

◆ __getStatus()

ilPaymentObjectGUI::__getStatus ( )
private

Definition at line 1394 of file class.ilPaymentObjectGUI.php.

Referenced by resetObjectFilter().

1395  {
1396  $option = array();
1397  $option[$this->pobject->STATUS_NOT_BUYABLE] = $this->lng->txt('paya_not_buyable');
1398  $option[$this->pobject->STATUS_BUYABLE] = $this->lng->txt('paya_buyable');
1399  $option[$this->pobject->STATUS_EXPIRES] = $this->lng->txt('paya_expires');
1400 
1401  return $option;
1402  }
+ Here is the caller graph for this function:

◆ __initPaymentObject()

ilPaymentObjectGUI::__initPaymentObject (   $a_pobject_id = 0)
private

Definition at line 1445 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, ilPaymentSettings\_getInstance(), ilPaymentPrices\_getPrice(), ilRadioOption\addSubItem(), IL_CAL_DATE, ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setRows(), ilRadioOption\setTitle(), ilRadioOption\setValue(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

Referenced by editPayMethod(), executeCommand(), performDelete(), performDeletePrice(), resetObjectFilter(), and updateDetails().

1446  {
1447  include_once './Services/Payment/classes/class.ilPaymentObject.php';
1448 
1449  $this->pobject = new ilPaymentObject($this->user_obj, $a_pobject_id);
1450 
1451  return true;
1452  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __showObjectsTable()

ilPaymentObjectGUI::__showObjectsTable (   $a_result_set)
private

Definition at line 1404 of file class.ilPaymentObjectGUI.php.

References $data, and $path.

Referenced by resetObjectFilter().

1405  {
1406  $tbl = new ilShopTableGUI($this);
1407  $tbl->setTitle($this->lng->txt('objects'));
1408 
1409  $tbl->setId('tbl_objects');
1410  $tbl->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment");
1411 
1412  $tbl->addColumn($this->lng->txt('title'), 'title', '10%');
1413  $tbl->addColumn($this->lng->txt('status'), 'status', '10%');
1414  $tbl->addColumn($this->lng->txt('paya_pay_method'), 'pay_method', '10%');
1415  $tbl->addColumn($this->lng->txt('vat_rate'), 'vat_rate', '15%');
1416  $tbl->addColumn($this->lng->txt('paya_vendor'), 'vendor', '10%');
1417  $tbl->addColumn($this->lng->txt('paya_count_purchaser'), 'purchasers', '10%');
1418  $tbl->addColumn('', 'options', '10%');
1419 
1420  $tbl->setData($a_result_set);
1421 
1422  $this->tpl->setVariable('TABLE', $tbl->getHTML());
1423 
1424  return true;
1425  }
Class ilShopTableGUI.
+ Here is the caller graph for this function:

◆ addObject()

ilPaymentObjectGUI::addObject ( )

Definition at line 1309 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, $options, ilPaymentObject\_checkExcSubtype(), ilPaymentTrustees\_getVendorsForObjects(), ilPaymentObject\_isPurchasable(), ilObjectFactory\getInstanceByObjId(), ilUtil\sendInfo(), and showSelectedObject().

1310  {
1311  if(!$_GET['sell_id'])
1312  {
1313  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1314 
1315  return $this->showObjectSelector();
1316  }
1317  if(!(int)$_POST['vendor'])
1318  {
1319  ilUtil::sendInfo($this->lng->txt('paya_no_vendor_selected'));
1320 
1321  return $this->showSelectedObject();
1322  }
1323 
1324  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
1325  $p_obj = new ilPaymentObject($this->user_obj);
1326 
1327  if($check_subtypes = ilPaymentObject::_checkExcSubtype($_GET['sell_id']))
1328  {
1329  if(!in_array('download', $check_subtypes))
1330  $p_obj->setSubtype('download');
1331  else
1332  if(!in_array('upload', $check_subtypes))
1333  $p_obj->setSubtype('upload');
1334 
1335 
1336  }
1337  else
1338  if(ilPaymentObject::_isPurchasable($_GET['sell_id']))
1339  {
1340  // means that current object already exits in payment_objects _table ...
1341  ilUtil::sendInfo($this->lng->txt('paya_object_not_purchasable'));
1342 
1343  return $this->showObjectSelector();
1344  }
1345 
1346  $p_obj->setRefId((int)$_GET['sell_id']);
1347  $p_obj->setStatus($p_obj->STATUS_NOT_BUYABLE);
1348  $p_obj->setPayMethod($p_obj->PAY_METHOD_NOT_SPECIFIED);
1349  $p_obj->setVendorId((int)$_POST['vendor']);
1350  $p_obj->setTopicId((int)$_POST['topic_id']);
1351  $p_obj->setVatId((int)$_POST['vat_id']);
1352 
1353  $new_id = $p_obj->add();
1354  if($new_id)
1355  {
1356  ilUtil::sendInfo($this->lng->txt('paya_added_new_object'));
1357  $_GET['pobject_id'] = $new_id;
1358  $this->editPrices();
1359  return true;
1360  }
1361  else
1362  {
1363  ilUtil::sendInfo($this->lng->txt('paya_err_adding_object'));
1364  return $this->showObjects();
1365  }
1366  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static _isPurchasable($a_ref_id, $a_vendor_id=0, $a_check_trustee=false, $a_check_status=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _checkExcSubtype($a_ref_id)
+ Here is the call graph for this function:

◆ deleteObject()

ilPaymentObjectGUI::deleteObject ( )

Definition at line 493 of file class.ilPaymentObjectGUI.php.

References $_GET, ilPaymentBookings\_getCountBookingsByObject(), ilUtil\sendFailure(), and ilUtil\sendInfo().

494  {
495  include_once './Services/Payment/classes/class.ilPaymentBookings.php';
496 
497  if(!$_GET['pobject_id'])
498  {
499  ilUtil::sendFailure($this->lng->txt('paya_no_object_selected'));
500 
501  $this->showObjects();
502  return true;
503  }
505  {
506  ilUtil::sendInfo($this->lng->txt('paya_bookings_available'));
507  $this->editDetails();
508 
509  return false;
510  }
511  else
512  {
513 
514  $this->editDetails(true);
515 
516  return true;
517  }
518  }
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _getCountBookingsByObject($a_pobject_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ deletePrice()

ilPaymentObjectGUI::deletePrice ( )

Definition at line 1006 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, $_SESSION, and ilUtil\sendInfo().

1007  {
1008  if(!$_GET['pobject_id'])
1009  {
1010  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1011 
1012  $this->showObjects();
1013  return true;
1014  }
1015 
1016  if(!count($_POST['price_ids']))
1017  {
1018  ilUtil::sendInfo($this->lng->txt('paya_no_prices_selected'));
1019 
1020  $this->editPrices();
1021  return true;
1022  }
1023  $_SESSION['price_ids'] = $_POST['price_ids'];
1024 
1025  $this->editPrices(true);
1026  return true;
1027  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ editPayMethod()

ilPaymentObjectGUI::editPayMethod ( )

Definition at line 548 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, $_SESSION, $data, ilShopBaseGUI\$tpl, __initPaymentObject(), ilPaymentSettings\_getInstance(), ilFormat\_getLocalMoneyFormat(), ilRadioOption\addSubItem(), ilDatePresentation\formatDate(), ilObjectFactory\getInstanceByRefId(), ilNonEditableValueGUI\getTitle(), IL_CAL_DATE, ilUtil\sendFailure(), ilUtil\sendInfo(), ilCheckboxInputGUI\setChecked(), ilTextAreaInputGUI\setRows(), ilRadioOption\setTitle(), ilRadioOption\setValue(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

549  {
550  $this->__initPaymentObject((int)$_GET['pobject_id']);
551 
552  switch($this->pobject->getPayMethod())
553  {
554  case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
555  ilUtil::sendFailure($this->lng->txt('paya_select_pay_method_first'));
556  $this->editDetails();
557  return true;
558 
559  default:
560  ilUtil::sendInfo($this->lng->txt('paya_no_settings_necessary'));
561  $this->editDetails();
562  return true;
563  }
564  }
__initPaymentObject($a_pobject_id=0)
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ executeCommand()

ilPaymentObjectGUI::executeCommand ( )

Definition at line 53 of file class.ilPaymentObjectGUI.php.

References $_GET, $cmd, $ret, __initPaymentObject(), ilPageObject\_exists(), ilObjStyleSheet\getContentStylePath(), ilShopBaseGUI\prepareOutput(), and ilUtil\sendInfo().

54  {
55  $cmd = $this->ctrl->getCmd();
56  switch($this->ctrl->getNextClass($this))
57  {
58  case 'ilshoppagegui':
59  $this->prepareOutput();
60  $ret = $this->forwardToPageObject();
61  if($ret != '')
62  {
63  $this->tpl->setContent($ret);
64  }
65  break;
66 
67  default:
68  if(!$cmd)
69  {
70  $cmd = 'showObjects';
71  }
72  $this->prepareOutput();
73  $this->$cmd();
74  break;
75  }
76  }
$cmd
Definition: sahs_server.php:35
+ Here is the call graph for this function:

◆ ORg_updatePrice()

ilPaymentObjectGUI::ORg_updatePrice ( )

Definition at line 1029 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, and ilUtil\sendInfo().

1030  {
1031  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
1032 
1033  if(!$_GET['pobject_id'] && !$_POST['pobject_id'])
1034  {
1035  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1036 
1037  $this->showObjects();
1038  return true;
1039  }
1040  if(isset($_GET['pobject_id']))
1041  {
1042  $pobject_id = (int)$_GET['pobject_id'];
1043  }
1044  else
1045  {
1046  $pobject_id = (int)$_POST['pobject_id'];
1047  }
1048  $po = new ilPaymentPrices($pobject_id);
1049 
1050  $this->ctrl->setParameter($this, 'pobject_id', $pobject_id);
1051 
1052  $price_id = (int)$_POST['price_id'];
1053 
1054  // validate
1055  $old_price = $po->getPrice($price_id);
1056 
1057 
1058  $po->setDuration((int)$_POST['duration']);
1059  $po->setUnlimitedDuration($_POST['unlimited_duration']);
1060  $po->setPrice($_POST['price']);
1061  $po->setPriceType($_POST['price_type']);
1062  $po->setCurrency($old_price['currency']);
1063  $po->setExtension((int)$_POST['extension']);
1064 
1065  if(!$po->validate())
1066  {
1067  $error = true;
1068  }
1069  if($error)
1070  {
1071  ilUtil::sendInfo($this->lng->txt('paya_insert_only_numbers'));
1072 
1073  $this->editPrices();
1074  return false;
1075  }
1076 
1077  foreach($_POST['prices'] as $price_id => $price)
1078  {
1079  $old_price = $po->getPrice($price_id);
1080  if(isset($_POST['duration_ids']))
1081  {
1082 // $search = in_array((string)$price_id, $_POST['duration_ids']);
1083  if($_POST['duration_ids'] == NULL)
1084  {
1085  $po->setUnlimitedDuration(0);
1086  $po->setDuration($price['duration']);
1087  }
1088 
1089  else if($search = in_array((string)$price_id, $_POST['duration_ids']))
1090  {
1091  $po->setUnlimitedDuration(1);
1092  $po->setDuration(0);
1093  }
1094  else
1095  {
1096  $po->setUnlimitedDuration(0);
1097  }
1098  }
1099 
1100  if(isset($_POST['extension_ids']))
1101  {
1102 // $search = in_array((string)$price_id, $_POST['extension_ids']);
1103  if($search = in_array((string)$price_id, $_POST['extension_ids']))
1104  {
1105  $po->setExtension(1);
1106  }
1107  else
1108  {
1109  $po->setExtension(0);
1110  }
1111  }
1112 
1113  $po->setDuration($price['duration']);
1114 
1115  $po->setPrice($price['price']);
1116  $po->setCurrency($old_price['currency']);
1117  $po->update($price_id);
1118  }
1119  ilUtil::sendInfo($this->lng->txt('paya_updated_prices'));
1120  $this->editPrices();
1121 
1122  return true;
1123  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ performAddPrice()

ilPaymentObjectGUI::performAddPrice ( )

Definition at line 882 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, ilPaymentCurrency\_getAvailableCurrencies(), ilUtil\sendInfo(), ilUtil\stripSlashes(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

883  {
884  if(!(int)$_GET['pobject_id'])
885  {
886  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
887 
888  $this->showObjects();
889  return true;
890  }
891 
892  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
893  include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
894 
896 
897  $po = new ilPaymentPrices((int)$_GET['pobject_id']);
898 
899  switch($_POST['price_type'])
900  {
901  case 'unlimited_duration':
902  $po->setPriceType(ilPaymentPrices::TYPE_UNLIMITED_DURATION);
903  $po->setDuration(0);
904  $po->setDurationFrom(NULL);
905  $po->setDurationUntil(NULL);
906  $po->setUnlimitedDuration(1);
907 
908  break;
909 
910  case 'duration_date':
911 
912  $po->setPriceType(ilPaymentPrices::TYPE_DURATION_DATE);
913  $po->setDuration(NULL);
914  $po->setDurationFrom(ilUtil::stripSlashes(
915  $_POST['duration_date_from']['date']['y'] . '-' .
916  $_POST['duration_date_from']['date']['m'] . '-' .
917  $_POST['duration_date_from']['date']['d']));
918  $po->setDurationUntil(ilUtil::stripSlashes(
919  $_POST['duration_date_until']['date']['y'] . '-' .
920  $_POST['duration_date_until']['date']['m'] . '-' .
921  $_POST['duration_date_until']['date']['d']));
922  break;
923 
924  default:
925  case 'duration_month':
926  $po->setPriceType(ilPaymentPrices::TYPE_DURATION_MONTH);
927  $po->setDuration($_POST['duration_month']);
928  $po->setDurationFrom(NULL);
929  $po->setDurationUntil(NULL);
930  break;
931  }
932 
933  $po->setDescription($_POST['description'] ? ilUtil::stripSlashes($_POST['description']) : NULL);
934  $po->setPrice(ilUtil::stripSlashes($_POST['price']));
935  $po->setCurrency($currency[1]['currency_id']);
936 
937  if($_POST['extension_price'])
938  {
939  $po->setExtension(1);
940  }
941  else
942  {
943  $po->setExtension(0);
944  }
945 
946  try
947  {
948  $po->validate();
949  $po->add();
950  ilUtil::sendInfo($this->lng->txt('paya_added_new_price'));
951 
952  return $this->editPrices();
953 
954  }
955  catch(ilShopException $e)
956  {
957  ilUtil::sendInfo($e->getMessage());
958  return $this->addPrice();
959  }
960 
961  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Class for shop related exception handling in ILIAS.
+ Here is the call graph for this function:

◆ performDelete()

ilPaymentObjectGUI::performDelete ( )

Definition at line 520 of file class.ilPaymentObjectGUI.php.

References $_GET, __initPaymentObject(), and ilUtil\sendInfo().

521  {
522  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
523 
524  if(!$_GET['pobject_id'])
525  {
526  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
527 
528  $this->showObjects();
529  return true;
530  }
531  $this->__initPaymentObject((int)$_GET['pobject_id']);
532 
533  // delete object data
534  $this->pobject->delete();
535 
536  // delete payment prices
537  $price_obj = new ilPaymentPrices((int)$_GET['pobject_id']);
538  $price_obj->deleteAllPrices();
539  unset($price_obj);
540 
541  ilUtil::sendInfo($this->lng->txt('paya_deleted_object'));
542 
543  $this->showObjects();
544 
545  return true;
546  }
__initPaymentObject($a_pobject_id=0)
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ performDeletePrice()

ilPaymentObjectGUI::performDeletePrice ( )

Definition at line 963 of file class.ilPaymentObjectGUI.php.

References $_GET, $_SESSION, __initPaymentObject(), and ilUtil\sendInfo().

964  {
965  if(!$_GET['pobject_id'])
966  {
967  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
968 
969  $this->showObjects();
970  return true;
971  }
972 
973  if(!count($_SESSION['price_ids']))
974  {
975  ilUtil::sendInfo($this->lng->txt('paya_no_prices_selected'));
976 
977  $this->editPrices();
978  return true;
979  }
980  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
981 
982  $prices = new ilPaymentPrices((int)$_GET['pobject_id']);
983 
984  foreach($_SESSION['price_ids'] as $price_id)
985  {
986  $prices->delete($price_id);
987  }
988 
989  // check if it was last price otherwise set status to 'not_buyable'
990  if(!count($prices->getPrices()))
991  {
992  $this->__initPaymentObject((int)$_GET['pobject_id']);
993 
994  $this->pobject->setStatus($this->pobject->STATUS_NOT_BUYABLE);
995  $this->pobject->update();
996 
997  ilUtil::sendInfo($this->lng->txt('paya_deleted_last_price'));
998  }
999  unset($prices);
1000  unset($_SESSION['price_ids']);
1001 
1002  return $this->editPrices();
1003  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
__initPaymentObject($a_pobject_id=0)
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ resetObjectFilter()

ilPaymentObjectGUI::resetObjectFilter ( )

Definition at line 123 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, $_SESSION, $data, __getStatus(), __initPaymentObject(), __showObjectsTable(), ilPaymentObject\_checkExcSubtype(), ilShopUtils\_formatVAT(), ilPaymentBookings\_getCountBookingsByObject(), ilObject\_getIcon(), ilPaymentSettings\_getInstance(), ilShopTopics\_getInstance(), ilPaymentObject\_getObjectsData(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), ilPayMethods\getStringByPaymethod(), ilUtil\sendInfo(), ilCheckboxInputGUI\setChecked(), ilSelectInputGUI\setOptions(), ilRadioOption\setValue(), and ilNonEditableValueGUI\setValue().

124  {
125  unset($_SESSION['pay_objects']);
126  unset($_POST['title_type']);
127  unset($_POST['title_value']);
128  unset($_POST['vendor']);
129  unset($_POST['pay_method']);
130  unset($_POST['updateView']);
131  unset($_POST['show_filter']);
132 
133  ilUtil::sendInfo($this->lng->txt('paya_filter_reseted'));
134 
135  return $this->showObjects();
136  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$_POST['username']
Definition: cron.php:12
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:

◆ showSelectedObject()

ilPaymentObjectGUI::showSelectedObject ( )

Definition at line 1239 of file class.ilPaymentObjectGUI.php.

References $_GET, ilObject\_getIcon(), ilObjectFactory\getInstanceByRefId(), ilUtil\sendInfo(), ilSelectInputGUI\setOptions(), and ilNonEditableValueGUI\setValue().

Referenced by addObject().

1240  {
1241  global $ilToolbar;
1242 
1243  if(!(int)$_GET['sell_id'])
1244  {
1245  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1246  return $this->showObjectSelector();
1247  }
1248 
1249  $ilToolbar->addButton($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
1250 
1251  // save ref_id of selected object
1252  $this->ctrl->setParameter($this, 'sell_id', (int)$_GET['sell_id']);
1253 
1254  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1255  $oForm = new ilPropertyFormGUI();
1256  $oForm->setFormAction($this->ctrl->getFormAction($this, 'updateDetails'));
1257  $oForm->setTitle($this->lng->txt('details'));
1258  $tmp_obj = ilObjectFactory::getInstanceByRefId($_GET['sell_id'], false);
1259  $oForm->setTitleIcon(ilObject::_getIcon($tmp_obj->getId()));
1260 
1261  if(is_object($tmp_obj))
1262  {
1263  $tmp_object['title'] = $tmp_obj->getTitle();
1264  $tmp_object['description'] = $tmp_obj->getDescription();
1265  $tmp_object['owner'] = $tmp_obj->getOwnerName();
1266  $tmp_object['path'] = $this->__getHTMLPath((int)$_GET['sell_id']);
1267  }
1268  else
1269  {
1270  $tmp_object['title'] = $this->lng->txt('object_not_found');
1271  $tmp_object['description'] = '';
1272  $tmp_object['owner'] = '';
1273  $tmp_object['path'] = '';
1274  }
1275 
1276  // title
1277  $oTitleGUI = new ilNonEditableValueGUI($this->lng->txt('title'));
1278  $oTitleGUI->setValue($tmp_object['title']);
1279  $oForm->addItem($oTitleGUI);
1280 
1281  // description
1282  $oDescriptionGUI = new ilNonEditableValueGUI($this->lng->txt('description'));
1283  $oDescriptionGUI->setValue($tmp_object['description']);
1284  $oForm->addItem($oDescriptionGUI);
1285 
1286  // owner
1287  $oOwnerGUI = new ilNonEditableValueGUI($this->lng->txt('owner'));
1288  $oOwnerGUI->setValue($tmp_object['owner']);
1289  $oForm->addItem($oOwnerGUI);
1290 
1291  // repository path
1292  $oPathGUI = new ilNonEditableValueGUI($this->lng->txt('path'));
1293  $oPathGUI->setValue($tmp_object['path']);
1294  $oForm->addItem($oPathGUI);
1295 
1296  // vendors
1297  $oVendorsGUI = new ilSelectInputGUI($this->lng->txt('paya_vendor'), 'vendor');
1298  $oVendorsGUI->setOptions($this->__getVendors());
1299  $oForm->addItem($oVendorsGUI);
1300 
1301  // buttons
1302  $oForm->addCommandButton('addObject', $this->lng->txt('next'));
1303  $oForm->addCommandButton('showObjects', $this->lng->txt('cancel'));
1304 
1305  $this->tpl->setVariable('ADM_CONTENT', $oForm->getHTML());
1306  return true;
1307  }
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
This class represents a selection list property in a property form.
This class represents a property form user interface.
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setOptions($a_options)
Set Options.
This class represents a non editable value in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateDetails()

ilPaymentObjectGUI::updateDetails ( )

Definition at line 1125 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, __initPaymentObject(), ilPaymentShoppingCart\_deleteShoppingCartEntries(), ilFileDataShop\assignFileToPaymentObject(), ilFileDataShop\deassignFileFromPaymentObject(), and ilUtil\sendInfo().

1126  {
1127  if(!$_GET['pobject_id'])
1128  {
1129  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1130 
1131  $this->showObjects();
1132  return true;
1133  }
1134  $this->__initPaymentObject((int)$_GET['pobject_id']);
1135  $this->ctrl->setParameter($this, 'pobject_id', (int)$_GET['pobject_id']);
1136 
1137  // read old settings
1138  $old_status = $this->pobject->getStatus();
1139 
1140  // check status changed from not_buyable
1141  if($old_status == $this->pobject->STATUS_NOT_BUYABLE and
1142  (int)$_POST['status'] != $old_status
1143  )
1144  {
1145  // check pay_method edited
1146  switch((int)$_POST['pay_method'])
1147  {
1148  case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
1149  ilUtil::sendInfo($this->lng->txt('paya_select_pay_method_first'));
1150  $this->editDetails();
1151 
1152  return false;
1153 
1154  default:
1155  ;
1156  }
1157  // check minimum one price
1158  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
1159 
1160  $prices_obj = new ilPaymentPrices((int)$_GET['pobject_id']);
1161  if(!count($prices_obj->getPrices()))
1162  {
1163  ilUtil::sendInfo($this->lng->txt('paya_edit_prices_first'));
1164  $this->editDetails();
1165 
1166  return false;
1167  }
1168  }
1169 
1170  if((int)$_POST['status'] == 0)
1171  {
1172  // Status: not buyable -> delete depending shoppingcart entries
1173  include_once './Services/Payment/classes/class.ilPaymentShoppingCart.php';
1174  ilPaymentShoppingCart::_deleteShoppingCartEntries($this->pobject->getPobjectId());
1175  }
1176 
1177  $this->pobject->setStatus((int)$_POST['status']);
1178  $this->pobject->setVendorId((int)$_POST['vendor']);
1179  $this->pobject->setPayMethod((int)$_POST['pay_method']);
1180  $this->pobject->setTopicId((int)$_POST['topic_id']);
1181  $this->pobject->setVatId((int)$_POST['vat_id']);
1182  $this->pobject->setSubtype((string)$_POST['exc_subtype']);
1183  $this->pobject->setSpecial((int)$_POST['is_special']);
1184 
1185  if((int)$_POST['thumbnail_delete'])
1186  {
1187  $oFile = new ilFileDataShop($this->pobject->getPobjectId());
1189  }
1190  else if($_FILES['thumbnail']['tmp_name'] != '')
1191  {
1192  $this->lng->loadLanguageModule('form');
1193  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1194  $oThumbnail = new ilImageFileInputGUI($this->lng->txt('pay_thumbnail'), 'thumbnail');
1195  if($oThumbnail->checkInput())
1196  {
1197  $oFile = new ilFileDataShop($this->pobject->getPobjectId());
1198  if(($oFile->storeUploadedFile($_FILES['thumbnail'])) !== false)
1199  {
1200  $oFile->assignFileToPaymentObject();
1201  }
1202  }
1203  else
1204  {
1205  ilUtil::sendInfo($oThumbnail->getAlert());
1206  return $this->editDetails();
1207  }
1208  }
1209 
1210  $this->pobject->update();
1211 
1212  ilUtil::sendInfo($this->lng->txt('paya_details_updated'));
1213  $this->showObjects();
1214 
1215  return true;
1216  }
__initPaymentObject($a_pobject_id=0)
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static _deleteShoppingCartEntries($a_pobject_id)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
This class represents an image file property in a property form.
This class handles all operations on files in directory data/shop.
+ Here is the call graph for this function:

◆ updatePrice()

ilPaymentObjectGUI::updatePrice ( )

Definition at line 1555 of file class.ilPaymentObjectGUI.php.

References $_GET, $_POST, ilUtil\sendInfo(), ilUtil\stripSlashes(), ilPaymentPrices\TYPE_DURATION_DATE, ilPaymentPrices\TYPE_DURATION_MONTH, and ilPaymentPrices\TYPE_UNLIMITED_DURATION.

1556  {
1557  include_once './Services/Payment/classes/class.ilPaymentPrices.php';
1558 
1559  if(!$_GET['pobject_id'] && !$_POST['pobject_id'])
1560  {
1561  ilUtil::sendInfo($this->lng->txt('paya_no_object_selected'));
1562 
1563  $this->showObjects();
1564  return true;
1565  }
1566  if(isset($_GET['pobject_id']))
1567  {
1568  $pobject_id = (int)$_GET['pobject_id'];
1569  }
1570  else
1571  {
1572  $pobject_id = (int)$_POST['pobject_id'];
1573  }
1574 
1575  if(!(int)$_GET['price_id'] && !$_POST['price_id'])
1576  {
1577  ilUtil::sendInfo($this->lng->txt('payment_no_price_selected'));
1578  return $this->editPrices();
1579  }
1580  if(isset($_GET['price_id']))
1581  {
1582  $price_id = (int)$_GET['price_id'];
1583  }
1584  else
1585  {
1586  $price_id = (int)$_POST['price_id'];
1587  }
1588 
1589  $po = new ilPaymentPrices((int)$pobject_id);
1590  switch($_POST['price_type'])
1591  {
1593  $po->setPriceType(ilPaymentPrices::TYPE_UNLIMITED_DURATION);
1594  $po->setDuration(NULL);
1595  $po->setDurationFrom(NULL);
1596  $po->setDurationUntil(NULL);
1597  $po->setUnlimitedDuration(1);
1598 
1599  break;
1600 
1602 
1603  $po->setPriceType(ilPaymentPrices::TYPE_DURATION_DATE);
1604  $po->setDuration(NULL);
1605  $po->setDurationFrom(ilUtil::stripSlashes(
1606  $_POST['duration_date_from']['date']['y'] . '-' .
1607  $_POST['duration_date_from']['date']['m'] . '-' .
1608  $_POST['duration_date_from']['date']['d']));
1609  $po->setDurationUntil(ilUtil::stripSlashes(
1610  $_POST['duration_date_until']['date']['y'] . '-' .
1611  $_POST['duration_date_until']['date']['m'] . '-' .
1612  $_POST['duration_date_until']['date']['d']));
1613  break;
1614 
1615  default:
1617  $po->setPriceType(ilPaymentPrices::TYPE_DURATION_MONTH);
1618  $po->setDuration($_POST['duration_month']);
1619  $po->setDurationFrom(NULL);
1620  $po->setDurationUntil(NULL);
1621  break;
1622  }
1623 
1624  $po->setDescription($_POST['description'] ? ilUtil::stripSlashes($_POST['description']) : NULL);
1625  $po->setPrice(ilUtil::stripSlashes($_POST['price']));
1626  $po->setCurrency(ilUtil::stripSlashes($_POST['currency']));
1627  if($_POST['extension'])
1628  {
1629  $po->setExtension(1);
1630  }
1631  else
1632  {
1633  $po->setExtension(0);
1634  }
1635  try
1636  {
1637  $po->validate();
1638  $po->update($price_id);
1639  ilUtil::sendInfo($this->lng->txt('paya_updated_price'));
1640  return $this->editPrices();
1641  }
1642  catch(ilShopException $e)
1643  {
1644  ilUtil::sendInfo($e->getMessage());
1645  return $this->editPrices();
1646  }
1647  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Class for shop related exception handling in ILIAS.
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilPaymentObjectGUI::$ctrl

Definition at line 23 of file class.ilPaymentObjectGUI.php.

◆ $lng

ilPaymentObjectGUI::$lng

Definition at line 25 of file class.ilPaymentObjectGUI.php.

◆ $pobject

ilPaymentObjectGUI::$pobject = null

Definition at line 29 of file class.ilPaymentObjectGUI.php.

◆ $user_obj

ilPaymentObjectGUI::$user_obj

Definition at line 27 of file class.ilPaymentObjectGUI.php.

Referenced by __construct().


The documentation for this class was generated from the following file: