4 include_once
'Services/Payment/classes/class.ilPaymentObject.php';
5 include_once
'Services/Payment/classes/class.ilPaymentBookings.php';
6 include_once
'Services/Payment/classes/class.ilFileDataShop.php';
7 include_once
'Services/Payment/classes/class.ilShopVatsList.php';
8 include_once
'./Services/Payment/classes/class.ilShopTableGUI.php';
32 $this->lng->loadLanguageModule(
'crs');
43 $ilTabs->setTabActive(
'paya_header');
44 $ilTabs->setSubTabActive(
'paya_object');
49 $cmd = $this->ctrl->getCmd();
50 switch($this->ctrl->getNextClass($this))
52 case 'ilpageobjectgui':
57 $this->tpl->setContent(
$ret);
62 if(!
$cmd = $this->ctrl->getCmd())
76 if(!(
int)
$_GET[
'pobject_id'])
81 $this->ctrl->setParameter($this,
'pobject_id', (
int)$_GET[
'pobject_id']);
84 $this->lng->loadLanguageModule(
'content');
86 $ilTabs->clearTargets();
87 $ilTabs->clearSubTabs();
88 $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'editDetails'),
'_top');
91 include_once
'Services/COPage/classes/class.ilPageObject.php';
92 include_once
'Services/COPage/classes/class.ilPageObjectGUI.php';
93 include_once(
'./Services/Style/classes/class.ilObjStyleSheet.php');
101 $new_page_object->setParentId(0);
102 $new_page_object->setId($this->pobject->getPobjectId());
103 $new_page_object->createFromXML();
106 $this->ctrl->setReturnByClass(
'ilpageobjectgui',
'edit');
108 $page_gui =
new ilPageObjectGUI(
'shop', $this->pobject->getPobjectId());
109 $this->ctrl->setParameter($page_gui,
'pobject_id', (
int)$_GET[
'pobject_id']);
111 $page_gui->setTemplateTargetVar(
'ADM_CONTENT');
112 $page_gui->setLinkXML(
'');
113 $page_gui->setFileDownloadLink($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'downloadFile'));
114 $page_gui->setFullscreenLink($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'displayMediaFullscreen'));
115 $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'download_paragraph'));
116 $page_gui->setPresentationTitle(
'');
117 $page_gui->setTemplateOutput(
false);
118 $page_gui->setHeader(
'');
119 $page_gui->setEnabledRepositoryObjects(
false);
120 $page_gui->setEnabledFileLists(
true);
121 $page_gui->setEnabledMaps(
true);
122 $page_gui->setEnabledPCTabs(
true);
124 return $this->ctrl->forwardCommand($page_gui);
130 unset(
$_POST[
'title_type']);
131 unset(
$_POST[
'title_value']);
133 unset(
$_POST[
'pay_method']);
134 unset(
$_POST[
'updateView']);
135 unset(
$_POST[
'show_filter']);
146 include_once
'./Services/Payment/classes/class.ilPayMethods.php';
148 $ilToolbar->addButton($this->lng->txt(
'paya_sell_object'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
150 if(!
$_POST[
'show_filter'] &&
$_POST[
'updateView'] ==
'1')
155 if (
$_POST[
'updateView'] == 1)
165 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
168 $this->lng->loadLanguageModule(
'search');
171 $filter_form->setFormAction($this->ctrl->getFormAction($this));
172 $filter_form->setTitle($this->lng->txt(
'pay_filter'));
173 $filter_form->setId(
'filter_form');
174 $filter_form->setTableWidth(
'100 %');
177 $o_hide_check =
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'),
'show_filter');
178 $o_hide_check->setValue(1);
179 $o_hide_check->setChecked(
$_SESSION[
'pay_objects'][
'show_filter'] ? 1 : 0);
182 $o_hidden->setValue(1);
183 $o_hidden->setPostVar(
'updateView');
184 $o_hide_check->addSubItem($o_hidden);
188 $radio_option =
new ilRadioOption($this->lng->txt(
'search_any_word'),
'or');
189 $radio_group->addOption($radio_option);
190 $radio_option =
new ilRadioOption($this->lng->txt(
'search_all_words'),
'and');
191 $radio_group->addOption($radio_option);
193 $radio_group->setRequired(
false);
195 $radio_group->setPostVar(
'title_type');
198 $o_title->setValue(
$_SESSION[
'pay_objects'][
'title_value']);
199 $o_title->setPostVar(
'title_value');
200 $o_title->setTitle($this->lng->txt(
'title'));
202 $o_hide_check->addSubItem($radio_group);
203 $o_hide_check->addSubItem($o_title);
207 $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
208 $o_vendor->setValue(
$_SESSION[
'pay_objects'][
'vendor']);
209 $o_vendor->setPostVar(
'vendor');
210 $o_hide_check->addSubItem($o_vendor);
214 $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
215 $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions(
'all'));
216 $o_paymethod->setValue(
$_SESSION[
'pay_objects'][
'pay_method']);
217 $o_paymethod->setPostVar(
'pay_method');
218 $o_hide_check->addSubItem($o_paymethod);
220 $filter_form->addCommandButton(
'showObjects', $this->lng->txt(
'pay_update_view'));
221 $filter_form->addCommandButton(
'resetObjectFilter', $this->lng->txt(
'pay_reset_filter'));
223 $filter_form->addItem($o_hide_check);
230 $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
232 $img_change =
"<img src=\"".ilUtil::getImagePath(
"edit.gif").
"\" alt=\"".
233 $this->lng->txt(
"edit").
"\" title=\"".$this->lng->txt(
"edit").
234 "\" border=\"0\" vspace=\"0\"/>";
237 foreach($objects as
$data)
243 $f_result[$counter][
'title'] = $tmp_obj->getTitle();
247 $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
251 switch($data[
'status'])
253 case $this->pobject->STATUS_BUYABLE:
254 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_buyable');
257 case $this->pobject->STATUS_NOT_BUYABLE:
258 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_not_buyable');
261 case $this->pobject->STATUS_EXPIRES:
262 $f_result[$counter][
'status'] = $this->lng->txt(
'paya_expires');
266 $f_result[$counter][
'pay_method'] = $str_paymethod;
268 if($data[
'vat_id'] <= 0)
270 $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
281 $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
284 $f_result[$counter][
'vat_rate'] = $vat_rate;
287 $f_result[$counter][
'vendor'] = $tmp_user->getFullname().
' ['.$tmp_user->getLogin().
']';
293 $this->ctrl->setParameter($this,
'pobject_id',$data[
'pobject_id']);
294 $link_change =
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"".$this->ctrl->getLinkTarget($this,
"editDetails").
"\">".$this->lng->txt(
"edit").
"</a></div>";
296 $f_result[$counter][
'options'] = $link_change;
310 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
313 if(!(
int)
$_GET[
'pobject_id'])
321 $this->ctrl->setParameter($this,
'pobject_id', (
int)$_GET[
'pobject_id']);
323 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
325 if(is_object($tmp_obj))
330 $trash =
' ('.$this->lng->txt(
'object_deleted').
')';
332 $tmp_object[
'title'] = $tmp_obj->getTitle().
''.$trash;
333 $tmp_object[
'type'] = $tmp_obj->getType();
337 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
338 $tmp_object[
'type'] =
false;
343 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
347 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDelete"));
348 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_object"));
349 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"editDetails");
350 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDelete");
352 $oConfirmationGUI->addItem(
'', $tmp_object[
'title'], $tmp_object[
'title']);
353 $this->tpl->setVariable(
'CONFIRMATION',$oConfirmationGUI->getHTML());
358 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
359 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
360 $ilToolbar->addButton($this->lng->txt(
'pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'edit'));
362 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
364 $oForm->setFormAction($this->ctrl->getFormAction($this,
'updateDetails'));
365 $oForm->setTitle($tmp_object[
'title']);
366 if($tmp_object[
'type'])
372 $oForm->addItem($oPathGUI);
374 switch ($tmp_object[
'type'])
377 $exc_subtype_option = array();
380 if(!in_array(
'download', $check_subtypes) || $this->pobject->getSubtype() ==
'download')
381 $exc_subtype_option[
'download'] = $this->lng->txt(
'download');
382 if(!in_array(
'upload', $check_subtypes) || $this->pobject->getSubtype() ==
'upload')
383 $exc_subtype_option[
'upload'] = $this->lng->txt(
'upload');
385 $oExcSubtype =
new ilSelectInputGUI($this->lng->txt(
'select_subtype'),
'exc_subtype');
386 $oExcSubtype->
setOptions($exc_subtype_option);
387 $oExcSubtype->setValue($this->pobject->getSubtype());
388 $oForm->addItem($oExcSubtype);
396 $oForm->addItem($oPurchasersGUI);
399 $oVendorsGUI =
new ilSelectInputGUI($this->lng->txt(
'paya_vendor'),
'vendor');
401 $oVendorsGUI->setValue($this->pobject->getVendorId());
402 $oForm->addItem($oVendorsGUI);
407 $oStatusGUI->setValue($this->pobject->getStatus());
408 $oForm->addItem($oStatusGUI);
411 $oPayMethodsGUI =
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'),
'pay_method');
412 $PMoptions = ilPaymethods::getPayMethodsOptions(
'not_specified');
413 $oPayMethodsGUI->setOptions($PMoptions);
414 $oPayMethodsGUI->setValue($this->pobject->getPayMethod());
415 $oForm->addItem($oPayMethodsGUI);
422 include_once
'Services/Payment/classes/class.ilShopTopics.php';
424 $topic_options = array();
425 $topic_options[
''] = $this->lng->txt(
'please_choose');
427 foreach($topics as $oTopic)
429 $topic_options[$oTopic->getId()] = $oTopic->getTitle();
432 $oTopicsGUI->setOptions($topic_options);
433 $oTopicsGUI->setValue($this->pobject->getTopicId());
434 $oForm->addItem($oTopicsGUI);
439 $oShopVatsList->read();
440 if($oShopVatsList->hasItems())
444 $vats_options = array();
445 foreach($oShopVatsList as $oVAT)
450 $oVatsGUI->setOptions($vats_options);
451 $oVatsGUI->setValue($this->pobject->getVatId());
452 $oForm->addItem($oVatsGUI);
457 $oVatsGUI->
setValue($this->lng->txt(
'paya_no_vats_assigned'));
458 $oForm->addItem($oVatsGUI);
463 if(($webpath_file = $oFile->getCurrentImageWebPath()) !==
false)
465 $oThumbnail->setImage($webpath_file);
467 $oForm->addItem($oThumbnail);
469 if($genSet->get(
'use_shop_specials'))
473 $oSpecial->
setChecked((
int)$this->pobject->getSpecial());
474 $oSpecial->setInfo($this->lng->txt(
'special_info'));
475 $oForm->addItem($oSpecial);
478 $oForm->addCommandButton(
'updateDetails', $this->lng->txt(
'save'));
479 $oForm->addCommandButton(
'deleteObject', $this->lng->txt(
'delete'));
481 $this->tpl->setVariable(
'FORM', $oForm->getHTML());
486 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
488 if(!
$_GET[
'pobject_id'])
513 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
515 if(!
$_GET[
'pobject_id'])
525 $this->pobject->delete();
529 $price_obj->deleteAllPrices();
543 switch($this->pobject->getPayMethod())
545 case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
560 public function editPrices($a_show_delete =
false, $oConfirmationGUI =
'')
563 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
564 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
565 include_once
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
566 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
569 if($a_show_delete ==
false) unset(
$_SESSION[
'price_ids']);
573 if(!
$_GET[
'pobject_id'])
577 $this->objectsObject();
580 $this->ctrl->setParameter($this,
'pobject_id',(
int)
$_GET[
'pobject_id']);
583 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
'tpl.main_view.html',
'Services/Payment');
587 $standard_prices = array();
588 $extension_prices = array();
589 $standard_prices = $price_obj->getPrices();
590 $extension_prices = $price_obj->getExtensionPrices();
592 $prices = array_merge($standard_prices, $extension_prices );
598 $ilToolbar->addButton($this->lng->txt(
'paya_add_price'), $this->ctrl->getLinkTarget($this,
'addPrice'));
602 else if(!count($standard_prices))
605 $this->pobject->setStatus(0);
606 $this->pobject->update();
616 $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this,
"performDeletePrice"));
617 $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_selected_prices"));
618 $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"),
"editPrices");
619 $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"),
"performDeletePrice");
623 foreach($prices as $price)
625 $currency = $genSet->get(
'currency_unit');
626 if(in_array($price[
'price_id'],
$_SESSION[
'price_ids']))
629 if ($price[
'unlimited_duration'] ==
'1')
631 $tmp_price = $this->lng->txt(
'unlimited_duration');
635 $tmp_price = $price[
'duration'].
' '.$this->lng->txt(
'paya_months');
637 $delete_row =
''.$tmp_price.
' : '.
641 $oConfirmationGUI->addItem(
'',$delete_row, $delete_row);
647 $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
652 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
653 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
654 $ilToolbar->addButton($this->lng->txt(
'pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array(
'ilpageobjectgui'),
'edit'));
660 $tpl->setCurrentBlock(
'tbl_form_header');
662 $tpl->setVariable(
'FORMACTION',$this->ctrl->getFormAction($this));
663 $tpl->parseCurrentBlock();
666 foreach($prices as $price)
669 if($a_show_delete ==
true )
671 $this->ctrl->setParameter($this,
'show_delete',
'true');
673 if(in_array($price[
'price_id'],
$_SESSION[
'price_ids']))
675 $data[$counter][
'price_id'] = ilUtil::formCheckBox(0,
676 'price_ids[]', (
int)$price[
'price_id']);
678 $data[$counter][
'duration'] =$price[
'duration'] ;
679 $data[$counter][
'month'] = $this->lng->txt(
'paya_months');
681 $data[$counter][
'unlimited_duration'] = ilUtil::formCheckBox($price[
'unlimited_duration'] ? 1 : 0,
682 'duration_ids[]', (
int)$price[
'price_id']);
685 $data[$counter][
'currency_unit'] = $genSet->get(
'currency_unit');
686 $data[$counter][
'extension'] = ilUtil::formCheckBox($price[
'extension'] ? 1 : 0,
687 'extension_ids[]', (
int)$price[
'price_id']);
693 $data[$counter][
'price_id'] = ilUtil::formCheckBox(in_array($price[
'price_id'],
$_SESSION[
'price_ids']) ? 1 : 0,
694 'price_ids[]', $price[
'price_id']);
696 $data[$counter][
'duration'] =
ilUtil::formInput(
'prices['.$price[
'price_id'].
'][duration]',$price[
'duration']);
697 $data[$counter][
'month'] = $this->lng->txt(
'paya_months');
699 $data[$counter][
'unlimited_duration'] = ilUtil::formCheckBox($price[
'unlimited_duration'] ? 1 : 0,
700 'duration_ids[]', (
int)$price[
'price_id']);
703 $data[$counter][
'currency_unit'] = $genSet->get(
'currency_unit');
704 $data[$counter][
'extension'] = ilUtil::formCheckBox($price[
'extension'] ? 1 : 0,
705 'extension_ids[]', (
int)$price[
'price_id']);
738 $tbl->setTitle($tmp_obj->getTitle());
742 $tbl->setTitle($this->lng->txt(
'object_not_found'));
745 $tbl->setId(
'tbl_bookings');
746 $tbl->setRowTemplate(
"tpl.shop_prices_row.html",
"Services/Payment");
748 $tbl->addColumn(
' ',
'price_id',
'5%');
749 $tbl->addColumn($this->lng->txt(
'duration'),
'duration',
'10%');
750 $tbl->addColumn(
'',
'month',
'10%');
751 $tbl->addColumn($this->lng->txt(
'unlimited_duration'),
'unlimitied_duration',
'15%');
752 $tbl->addColumn($this->lng->txt(
'price_a'),
'price',
'10%');
753 $tbl->addColumn($this->lng->txt(
'currency'),
'currency_unit',
'10%');
754 $tbl->addColumn($this->lng->txt(
'extension_price'),
'extension',
'40%');
756 $tbl->setSelectAllCheckbox(
'price_id');
757 $tbl->addCommandButton(
'updatePrice',$this->lng->txt(
'paya_update_price'));
758 $tbl->addCommandButton(
'addPrice',$this->lng->txt(
'paya_add_price'));
760 $tbl->addMultiCommand(
"deletePrice", $this->lng->txt(
"paya_delete_price"));
763 $tbl->setData($a_result_set);
765 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
774 if(!
$_GET[
'pobject_id'])
782 include_once
'./Services/Payment/classes/class.ilPaymentSettings.php';
787 $this->ctrl->setParameter($this,
'pobject_id',(
int)
$_GET[
'pobject_id']);
791 $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this,
'editDetails'));
792 $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this,
'editPrices'));
794 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.main_view.html',
'Services/Payment');
797 $form->setFormAction($this->ctrl->getFormAction($this));
798 $form->setTitle($this->lng->txt(
'paya_add_price_title'));
803 if(is_object($tmp_obj))
805 $oTitle->setValue($tmp_obj->
getTitle());
809 $oTitle->setValue($this->lng->txt(
'object_not_found'));
811 $form->addItem($oTitle);
815 $oDuration->setTitle($this->lng->txt(
'duration'));
816 $oDuration->setValue(
$_POST[
'duration']);
817 $oDuration->setInfo($this->lng->txt(
'paya_months'));
818 $oDuration->setPostVar(
'duration');
819 $form->addItem($oDuration);
821 $oUnlimitedDuration =
new ilCheckboxInputGUI($this->lng->txt(
'unlimited_duration'),
'unlimited_duration');
824 $form->addItem($oUnlimitedDuration);
828 $oPrice->setTitle($this->lng->txt(
'price_a'));
829 $oPrice->setValue(
$_POST[
'price']);
830 $oPrice->setPostVar(
'price');
831 $oPrice->setRequired(
true);
832 $form->addItem($oPrice);
835 $this->tpl->setVariable(
'TXT_PRICE_A',$genSet->get(
'currency_unit'));
838 $oExtension =
new ilCheckboxInputGUI($this->lng->txt(
'extension_price'),
'extension');
839 isset(
$_POST[
'extension']) ? $ext_value = 1 : $ext_value = 0;
842 $form->addItem($oExtension);
866 $form->addCommandButton(
'performAddPrice',$this->lng->txt(
'paya_add_price'));
867 $form->addCommandButton(
'editPrices', $this->lng->txt(
'cancel'));
868 $this->tpl->setVariable(
'FORM',$form->getHTML());
876 if(!
$_GET[
'pobject_id'])
884 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
885 include_once
'./Services/Payment/classes/class.ilPaymentCurrency.php';
891 $prices->setDuration(
$_POST[
'duration']);
892 $prices->setUnlimitedDuration(
$_POST[
'unlimited_duration']);
893 if(
$_POST[
'unlimited_duration'] ==
'1')
895 $prices->setUnlimitedDuration(1);
898 $prices->setPrice((
float)
$_POST[
'price']);
899 $prices->setCurrency($currency[1][
'currency_id']);
900 if($_POST[
'extension'] ==
'1')
902 $prices->setExtension(1);
905 $prices->setExtension(0);
908 if(!$prices->validate())
925 if(!
$_GET[
'pobject_id'])
940 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
944 foreach(
$_SESSION[
'price_ids'] as $price_id)
946 $prices->delete($price_id);
950 if(!count($prices->getPrices()))
954 $this->pobject->setStatus($this->pobject->STATUS_NOT_BUYABLE);
955 $this->pobject->update();
968 if(!
$_GET[
'pobject_id'])
976 if(!count(
$_POST[
'price_ids']))
991 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
993 if(!
$_GET[
'pobject_id'])
1002 $this->ctrl->setParameter($this,
'pobject_id',(
int) $_GET[
'pobject_id']);
1005 foreach(
$_POST[
'prices'] as $price_id => $price)
1007 $old_price = $po->getPrice($price_id);
1009 $po->setDuration($price[
'duration']);
1010 $po->setUnlimitedDuration($price[
'unlimited_duration']);
1011 $po->setPrice($price[
'price']);
1012 $po->setCurrency($old_price[
'currency']);
1013 $po->setExtension($price[
'extension']);
1015 if(!$po->validate())
1028 foreach(
$_POST[
'prices'] as $price_id => $price)
1030 $old_price = $po->getPrice($price_id);
1031 if(isset(
$_POST[
'duration_ids']))
1033 $search = in_array((
string)$price_id,
$_POST[
'duration_ids']);
1035 if(
$_POST[
'duration_ids'] == NULL)
1037 $po->setUnlimitedDuration(0);
1038 $po->setDuration($price[
'duration']);
1041 else if( $search = in_array((
string)$price_id,
$_POST[
'duration_ids']))
1043 $po->setUnlimitedDuration(1);
1044 $po->setDuration(0);
1048 $po->setUnlimitedDuration(0);
1052 if(isset(
$_POST[
'extension_ids']))
1054 $search = in_array((
string)$price_id,
$_POST[
'extension_ids']);
1056 if( $search = in_array((
string)$price_id,
$_POST[
'extension_ids']))
1058 $po->setExtension(1);
1062 $po->setExtension(0);
1067 $po->setDuration($price[
'duration']);
1069 $po->setPrice($price[
'price']);
1070 $po->setCurrency($old_price[
'currency']);
1072 $po->update($price_id);
1083 if(!
$_GET[
'pobject_id'])
1091 $this->ctrl->setParameter($this,
'pobject_id', (
int)$_GET[
'pobject_id']);
1094 $old_pay_method = $this->pobject->getPayMethod();
1095 $old_status = $this->pobject->getStatus();
1098 if($old_status == $this->pobject->STATUS_NOT_BUYABLE and
1099 (
int)
$_POST[
'status'] != $old_status)
1102 switch((
int)
$_POST[
'pay_method'])
1104 case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
1114 include_once
'./Services/Payment/classes/class.ilPaymentPrices.php';
1117 if(!count($prices_obj->getPrices()))
1126 if((
int)
$_POST[
'status'] == 0)
1129 include_once
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
1133 $this->pobject->setStatus((
int)
$_POST[
'status']);
1134 $this->pobject->setVendorId((
int)$_POST[
'vendor']);
1135 $this->pobject->setPayMethod((
int)$_POST[
'pay_method']);
1136 $this->pobject->setTopicId((
int)$_POST[
'topic_id']);
1137 $this->pobject->setVatId((
int)$_POST[
'vat_id']);
1138 $this->pobject->setSubtype((
string)$_POST[
'exc_subtype']);
1139 $this->pobject->setSpecial((
int)$_POST[
'is_special']);
1141 if((
int)$_POST[
'thumbnail_delete'])
1146 else if($_FILES[
'thumbnail'][
'tmp_name'] !=
'')
1148 $this->lng->loadLanguageModule(
'form');
1149 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1151 if($oThumbnail->checkInput())
1154 if(($oFile->storeUploadedFile($_FILES[
'thumbnail'])) !==
false)
1166 $this->pobject->update();
1176 global $tree, $ilToolbar;
1178 include_once
'./Services/Payment/classes/class.ilPaymentObjectSelector.php';
1180 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.paya_object_selector.html',
'Services/Payment');
1181 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjects'));
1186 $exp =
new ilPaymentObjectSelector($this->ctrl->getLinkTarget($this,
'showObjectSelector'), strtolower(get_class($this)));
1187 $exp->
setExpand(
$_GET[
'paya_link_expand'] ?
$_GET[
'paya_link_expand'] : $tree->readRootId());
1188 $exp->setExpandTarget($this->ctrl->getLinkTarget($this,
'showObjectSelector'));
1192 $this->tpl->setVariable(
"EXPLORER",$exp->getOutput());
1201 if(!(
int)
$_GET[
'sell_id'])
1207 $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
'showObjectSelector'));
1210 $this->ctrl->setParameter($this,
'sell_id', (
int)$_GET[
'sell_id']);
1212 include_once
'Services/Form/classes/class.ilPropertyFormGUI.php';
1214 $oForm->setFormAction($this->ctrl->getFormAction($this,
'updateDetails'));
1215 $oForm->setTitle($this->lng->txt(
'details'));
1219 if(is_object($tmp_obj))
1221 $tmp_object[
'title'] = $tmp_obj->getTitle();
1222 $tmp_object[
'description'] = $tmp_obj->getDescription();
1223 $tmp_object[
'owner'] = $tmp_obj->getOwnerName();
1224 $tmp_object[
'path'] = $this->
__getHTMLPath((
int)$_GET[
'sell_id']);
1228 $tmp_object[
'title'] = $this->lng->txt(
'object_not_found');
1229 $tmp_object[
'description'] =
'';
1230 $tmp_object[
'owner'] =
'';
1231 $tmp_object[
'path'] =
'';
1236 $oTitleGUI->
setValue($tmp_object[
'title']);
1237 $oForm->addItem($oTitleGUI);
1241 $oDescriptionGUI->
setValue($tmp_object[
'description']);
1242 $oForm->addItem($oDescriptionGUI);
1246 $oOwnerGUI->
setValue($tmp_object[
'owner']);
1247 $oForm->addItem($oOwnerGUI);
1251 $oPathGUI->
setValue($tmp_object[
'path']);
1252 $oForm->addItem($oPathGUI);
1255 $oVendorsGUI =
new ilSelectInputGUI($this->lng->txt(
'paya_vendor'),
'vendor');
1257 $oForm->addItem($oVendorsGUI);
1260 $oForm->addCommandButton(
'addObject', $this->lng->txt(
'next'));
1261 $oForm->addCommandButton(
'showObjects', $this->lng->txt(
'cancel'));
1263 $this->tpl->setVariable(
'ADM_CONTENT', $oForm->getHTML());
1268 if(!
$_GET[
'sell_id'])
1274 if(!(
int)
$_POST[
'vendor'])
1281 include_once
'Services/Payment/classes/class.ilPaymentObject.php';
1286 if(!in_array(
'download',$check_subtypes))
1287 $p_obj->setSubtype(
'download');
1289 if(!in_array(
'upload',$check_subtypes))
1290 $p_obj->setSubtype(
'upload');
1303 $p_obj->setRefId((
int)
$_GET[
'sell_id']);
1304 $p_obj->setStatus($p_obj->STATUS_NOT_BUYABLE);
1305 $p_obj->setPayMethod($p_obj->PAY_METHOD_NOT_SPECIFIED);
1306 $p_obj->setVendorId((
int)$_POST[
'vendor']);
1307 $p_obj->setTopicId((
int)$_POST[
'topic_id']);
1308 $p_obj->setVatId((
int)$_POST[
'vat_id']);
1310 $new_id = $p_obj->add();
1314 $_GET[
'pobject_id'] = $new_id;
1326 include_once
'Services/Payment/classes/class.ilPaymentVendors.php';
1332 $vendors[] = $this->user_obj->getId();
1336 $vendors = array_merge($vendors, $vend);
1341 $options[
$vendor] = $tmp_obj->getFullname().
' ['.$tmp_obj->getLogin().
']';
1351 $option[$this->pobject->STATUS_NOT_BUYABLE] = $this->lng->txt(
'paya_not_buyable');
1352 $option[$this->pobject->STATUS_BUYABLE] = $this->lng->txt(
'paya_buyable');
1353 $option[$this->pobject->STATUS_EXPIRES] = $this->lng->txt(
'paya_expires');
1361 $tbl->setTitle($this->lng->txt(
'objects'));
1363 $tbl->setId(
'tbl_objects');
1364 $tbl->setRowTemplate(
"tpl.shop_objects_row.html",
"Services/Payment");
1366 $tbl->addColumn($this->lng->txt(
'title'),
'title',
'10%');
1367 $tbl->addColumn($this->lng->txt(
'status'),
'status',
'10%');
1368 $tbl->addColumn($this->lng->txt(
'paya_pay_method'),
'pay_method',
'10%');
1369 $tbl->addColumn($this->lng->txt(
'vat_rate'),
'vat_rate',
'15%');
1370 $tbl->addColumn($this->lng->txt(
'paya_vendor'),
'vendor',
'10%');
1371 $tbl->addColumn($this->lng->txt(
'paya_count_purchaser'),
'purchasers',
'10%');
1372 $tbl->addColumn(
'',
'options',
'10%');
1374 $tbl->setData($a_result_set);
1376 $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
1386 $path = $tree->getPathFull($a_ref_id);
1391 $html .= $data[
'title'].
' > ';
1393 return substr($html,0,-2);
1398 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';