4include_once 
'Services/Payment/classes/class.ilPaymentObject.php';
 
    5include_once 
'Services/Payment/classes/class.ilPaymentBookings.php';
 
    6include_once 
'Services/Payment/classes/class.ilFileDataShop.php';
 
    7include_once 
'Services/Payment/classes/class.ilShopVatsList.php';
 
    8include_once 
'./Services/Payment/classes/class.ilShopTableGUI.php';
 
   33                parent::__construct();
 
   36                $this->lng->loadLanguageModule(
'crs');
 
   47                parent::prepareOutput();
 
   49                $ilTabs->setTabActive(
'paya_header');
 
   50                $ilTabs->setSubTabActive(
'paya_object');
 
   55                $cmd = $this->ctrl->getCmd();
 
   56                switch($this->ctrl->getNextClass($this))
 
   60                                $ret = $this->forwardToPageObject();
 
   63                                        $this->tpl->setContent(
$ret);
 
   78        public function forwardToPageObject()
 
   85                if(!(
int)
$_GET[
'pobject_id'])
 
   88                        return $this->showObjects();
 
   90                $this->ctrl->setParameter($this, 
'pobject_id', (
int)
$_GET[
'pobject_id']);
 
   93                $this->lng->loadLanguageModule(
'content');
 
   95                $ilTabs->clearTargets();
 
   96                $ilTabs->clearSubTabs();
 
   97                $ilTabs->setBackTarget($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'editDetails'), 
'_top');
 
  100                include_once 
'Services/Payment/classes/class.ilShopPage.php';
 
  101                include_once 
'Services/Payment/classes/class.ilShopPageGUI.php';
 
  102                include_once(
'./Services/Style/classes/class.ilObjStyleSheet.php');
 
  110                        $new_page_object->setParentId(0);
 
  111                        $new_page_object->setId($this->pobject->getPobjectId());
 
  112                        $new_page_object->createFromXML();
 
  115                $this->ctrl->setReturnByClass(
'ilshoppagegui', 
'edit');
 
  117                $page_gui = 
new ilShopPageGUI($this->pobject->getPobjectId());
 
  118                $this->ctrl->setParameter($page_gui, 
'pobject_id', (
int)
$_GET[
'pobject_id']);
 
  120                return $this->ctrl->forwardCommand($page_gui);
 
  126                unset(
$_POST[
'title_type']);
 
  127                unset(
$_POST[
'title_value']);
 
  129                unset(
$_POST[
'pay_method']);
 
  130                unset(
$_POST[
'updateView']);
 
  131                unset(
$_POST[
'show_filter']);
 
  135                return $this->showObjects();
 
  138        public function showObjects()
 
  144                include_once 
'./Services/Payment/classes/class.ilPayMethods.php';
 
  146                $ilToolbar->addButton($this->lng->txt(
'paya_sell_object'), $this->ctrl->getLinkTarget($this, 
'showObjectSelector'));
 
  148                if(!
$_POST[
'show_filter'] && 
$_POST[
'updateView'] == 
'1')
 
  153                        if(
$_POST[
'updateView'] == 1)
 
  163                $this->tpl->addBlockfile(
'ADM_CONTENT', 
'adm_content', 
'tpl.main_view.html', 
'Services/Payment');
 
  166                $this->lng->loadLanguageModule(
'search');
 
  169                $filter_form->setFormAction($this->ctrl->getFormAction($this));
 
  170                $filter_form->setTitle($this->lng->txt(
'pay_filter'));
 
  171                $filter_form->setId(
'filter_form');
 
  172                $filter_form->setTableWidth(
'100 %');
 
  175                $o_hide_check = 
new ilCheckBoxInputGUI($this->lng->txt(
'show_filter'), 
'show_filter');
 
  176                $o_hide_check->setValue(1);
 
  177                $o_hide_check->setChecked(
$_SESSION[
'pay_objects'][
'show_filter'] ? 1 : 0);
 
  180                $o_hidden->setValue(1);
 
  181                $o_hidden->setPostVar(
'updateView');
 
  182                $o_hide_check->addSubItem($o_hidden);
 
  186                $radio_option = 
new ilRadioOption($this->lng->txt(
'search_any_word'), 
'or');
 
  187                $radio_group->addOption($radio_option);
 
  188                $radio_option = 
new ilRadioOption($this->lng->txt(
'search_all_words'), 
'and');
 
  189                $radio_group->addOption($radio_option);
 
  191                $radio_group->setRequired(
false);
 
  192                $radio_group->setValue(
'or');
 
  193                $radio_group->setPostVar(
'title_type');
 
  196                $o_title->setValue(
$_SESSION[
'pay_objects'][
'title_value']);
 
  197                $o_title->setPostVar(
'title_value');
 
  198                $o_title->setTitle($this->lng->txt(
'title'));
 
  200                $o_hide_check->addSubItem($radio_group);
 
  201                $o_hide_check->addSubItem($o_title);
 
  205                $o_vendor->setTitle($this->lng->txt(
'paya_vendor'));
 
  206                $o_vendor->setValue(
$_SESSION[
'pay_objects'][
'vendor']);
 
  207                $o_vendor->setPostVar(
'vendor');
 
  208                $o_hide_check->addSubItem($o_vendor);
 
  212                $o_paymethod->setTitle($this->lng->txt(
'payment_system'));
 
  213                $o_paymethod->setOptions(ilPaymethods::getPayMethodsOptions(
'all'));
 
  214                $o_paymethod->setValue(
$_SESSION[
'pay_objects'][
'pay_method']);
 
  215                $o_paymethod->setPostVar(
'pay_method');
 
  216                $o_hide_check->addSubItem($o_paymethod);
 
  218                $filter_form->addCommandButton(
'showObjects', $this->lng->txt(
'pay_update_view'));
 
  219                $filter_form->addCommandButton(
'resetObjectFilter', $this->lng->txt(
'pay_reset_filter'));
 
  221                $filter_form->addItem($o_hide_check);
 
  228                $this->tpl->setVariable(
'FORM', $filter_form->getHTML());
 
  231                foreach($objects as 
$data)
 
  237                                $f_result[$counter][
'title'] = $tmp_obj->getTitle();
 
  241                                $f_result[$counter][
'title'] = $this->lng->txt(
'object_not_found');
 
  245                        switch(
$data[
'status'])
 
  247                                case $this->pobject->STATUS_BUYABLE:
 
  248                                        $f_result[$counter][
'status'] = $this->lng->txt(
'paya_buyable');
 
  251                                case $this->pobject->STATUS_NOT_BUYABLE:
 
  252                                        $f_result[$counter][
'status'] = $this->lng->txt(
'paya_not_buyable');
 
  255                                case $this->pobject->STATUS_EXPIRES:
 
  256                                        $f_result[$counter][
'status'] = $this->lng->txt(
'paya_expires');
 
  260                        $f_result[$counter][
'pay_method'] = $str_paymethod;
 
  262                        if(
$data[
'vat_id'] <= 0)
 
  264                                $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
 
  275                                        $vat_rate = $this->lng->txt(
'payment_vat_has_to_be_defined_by_administration_short');
 
  278                        $f_result[$counter][
'vat_rate'] = $vat_rate;
 
  282                        $f_result[$counter][
'vendor'] = $tmp_user->getFullname() . 
' [' . $tmp_user->getLogin() . 
']';
 
  288                        $this->ctrl->setParameter($this, 
'pobject_id', 
$data[
'pobject_id']);
 
  289                        $link_change = 
"<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, 
"editDetails") . 
"\">" . $this->lng->txt(
"edit") . 
"</a></div>";
 
  291                        $f_result[$counter][
'options'] = $link_change;
 
  301        public function editDetails($a_show_confirm = 
false)
 
  308                include_once 
'./Services/Payment/classes/class.ilPaymentSettings.php';
 
  312                if(!(
int)
$_GET[
'pobject_id'])
 
  315                        return $this->showObjects();
 
  320                $this->ctrl->setParameter($this, 
'pobject_id', (
int)
$_GET[
'pobject_id']);
 
  322                $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(
'ilshoppagegui'), 
'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                $oPathGUI->setValue($this->__getHTMLPath($this->pobject->getRefId()));
 
  373                $oForm->addItem($oPathGUI);
 
  375                switch($tmp_object[
'type'])
 
  378                                $exc_subtype_option = array();
 
  381                                if(!in_array(
'download', $check_subtypes) || $this->pobject->getSubtype() == 
'download')
 
  382                                        $exc_subtype_option[
'download'] = $this->lng->txt(
'download');
 
  383                                if(!in_array(
'upload', $check_subtypes) || $this->pobject->getSubtype() == 
'upload')
 
  384                                        $exc_subtype_option[
'upload'] = $this->lng->txt(
'upload');
 
  386                                $oExcSubtype = 
new ilSelectInputGUI($this->lng->txt(
'select_subtype'), 
'exc_subtype');
 
  387                                $oExcSubtype->setOptions($exc_subtype_option);
 
  388                                $oExcSubtype->setValue($this->pobject->getSubtype());
 
  389                                $oForm->addItem($oExcSubtype);
 
  398                $oForm->addItem($oPurchasersGUI);
 
  401                $oVendorsGUI = 
new ilSelectInputGUI($this->lng->txt(
'paya_vendor'), 
'vendor');
 
  402                $oVendorsGUI->setOptions($this->__getVendors());
 
  403                $oVendorsGUI->setValue($this->pobject->getVendorId());
 
  404                $oForm->addItem($oVendorsGUI);
 
  409                $oStatusGUI->setValue($this->pobject->getStatus());
 
  410                $oForm->addItem($oStatusGUI);
 
  413                $oPayMethodsGUI = 
new ilSelectInputGUI($this->lng->txt(
'paya_pay_method'), 
'pay_method');
 
  414                $PMoptions      = ilPaymethods::getPayMethodsOptions(
'not_specified');
 
  415                $oPayMethodsGUI->setOptions($PMoptions);
 
  416                $oPayMethodsGUI->setValue($this->pobject->getPayMethod());
 
  417                $oForm->addItem($oPayMethodsGUI);
 
  422                $shopTopicsObj->read();
 
  423                if(is_array($topics = $shopTopicsObj->getTopics()) && count($topics))
 
  426                        include_once 
'Services/Payment/classes/class.ilShopTopics.php';
 
  429                        $shopTopicsObj->read();
 
  430                        $topic_options     = array();
 
  431                        $topic_options[
''] = $this->lng->txt(
'please_choose');
 
  434                        foreach($topics as $oTopic)
 
  436                                $topic_options[$oTopic->getId()] = $oTopic->getTitle();
 
  439                        $oTopicsGUI->setOptions($topic_options);
 
  440                        $oTopicsGUI->setValue($this->pobject->getTopicId());
 
  441                        $oForm->addItem($oTopicsGUI);
 
  446                $oShopVatsList->read();
 
  447                if($oShopVatsList->hasItems())
 
  451                        $vats_options = array();
 
  453                        foreach($oShopVatsList as $oVAT)
 
  458                        $oVatsGUI->setOptions($vats_options);
 
  459                        $oVatsGUI->setValue($this->pobject->getVatId());
 
  460                        $oForm->addItem($oVatsGUI);
 
  465                        $oVatsGUI->setValue($this->lng->txt(
'paya_no_vats_assigned'));
 
  466                        $oForm->addItem($oVatsGUI);
 
  471                if(($webpath_file = $oFile->getCurrentImageWebPath()) !== 
false)
 
  473                        $oThumbnail->setImage($webpath_file);
 
  475                $oForm->addItem($oThumbnail);
 
  477                if($genSet->get(
'use_shop_specials'))
 
  481                        $oSpecial->setChecked((
int)$this->pobject->getSpecial());
 
  482                        $oSpecial->setInfo($this->lng->txt(
'special_info'));
 
  483                        $oForm->addItem($oSpecial);
 
  486                $oForm->addCommandButton(
'updateDetails', $this->lng->txt(
'save'));
 
  487                $oForm->addCommandButton(
'deleteObject', $this->lng->txt(
'delete'));
 
  489                $this->tpl->setVariable(
'FORM', $oForm->getHTML());
 
  495                include_once 
'./Services/Payment/classes/class.ilPaymentBookings.php';
 
  497                if(!
$_GET[
'pobject_id'])
 
  501                        $this->showObjects();
 
  507                        $this->editDetails();
 
  514                        $this->editDetails(
true);
 
  522                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
  524                if(!
$_GET[
'pobject_id'])
 
  528                        $this->showObjects();
 
  534                $this->pobject->delete();
 
  538                $price_obj->deleteAllPrices();
 
  543                $this->showObjects();
 
  552                switch($this->pobject->getPayMethod())
 
  554                        case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
 
  556                                $this->editDetails();
 
  561                                $this->editDetails();
 
  566        public function editPrices($a_show_delete = 
false)
 
  573                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
  574                include_once 
'./Services/Payment/classes/class.ilPaymentCurrency.php';
 
  575                include_once 
'./Services/Utilities/classes/class.ilConfirmationGUI.php';
 
  576                include_once 
'./Services/Payment/classes/class.ilPaymentSettings.php';
 
  580                if($a_show_delete == 
false) unset(
$_SESSION[
'price_ids']);
 
  588                        $this->showObjects();
 
  592                if(isset(
$_GET[
'pobject_id']))
 
  594                        $pobject_id = (int)
$_GET[
'pobject_id'];
 
  598                        $pobject_id = (int)
$_POST[
'pobject_id'];
 
  601                $this->ctrl->setParameter($this, 
'pobject_id', $pobject_id);
 
  604                $this->tpl->addBlockfile(
"ADM_CONTENT", 
"adm_content", 
'tpl.main_view.html', 
'Services/Payment');
 
  608                $standard_prices  = array();
 
  609                $extension_prices = array();
 
  610                $standard_prices  = $price_obj->getPrices();
 
  611                $extension_prices = $price_obj->getExtensionPrices();
 
  613                $prices = array_merge($standard_prices, $extension_prices);
 
  619                        $ilToolbar->addButton($this->lng->txt(
'paya_add_price'), $this->ctrl->getLinkTarget($this, 
'addPrice'));
 
  623                else if(!count($standard_prices))
 
  626                        $this->pobject->setStatus(0);
 
  627                        $this->pobject->update();
 
  637                        $oConfirmationGUI->setFormAction($this->ctrl->getFormAction($this, 
"performDeletePrice"));
 
  638                        $oConfirmationGUI->setHeaderText($this->lng->txt(
"paya_sure_delete_selected_prices"));
 
  639                        $oConfirmationGUI->setCancel($this->lng->txt(
"cancel"), 
"editPrices");
 
  640                        $oConfirmationGUI->setConfirm($this->lng->txt(
"confirm"), 
"performDeletePrice");
 
  644                        foreach($prices as $price)
 
  646                                $currency = $genSet->get(
'currency_unit');
 
  647                                if(in_array($price[
'price_id'], 
$_SESSION[
'price_ids']))
 
  650                                        if($price[
'unlimited_duration'] == 
'1')
 
  652                                                $tmp_price = $this->lng->txt(
'unlimited_duration');
 
  656                                                $tmp_price = $price[
'duration'] . 
' ' . $this->lng->txt(
'paya_months');
 
  658                                        $delete_row = 
'' . $tmp_price . 
'  :  ' .
 
  662                                        $oConfirmationGUI->addItem(
'', $delete_row, $delete_row);
 
  668                        $this->tpl->setVariable(
'CONFIRMATION', $oConfirmationGUI->getHTML());
 
  673                $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this, 
'editDetails'));
 
  674                $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this, 
'editPrices'));
 
  675                $ilToolbar->addButton($this->lng->txt(
'pay_edit_abstract'), $this->ctrl->getLinkTargetByClass(array(
'ilshoppagegui'), 
'edit'));
 
  682                $tpl->setCurrentBlock(
'tbl_form_header');
 
  684                $tpl->setVariable(
'FORMACTION', $this->ctrl->getFormAction($this));
 
  685                $tpl->parseCurrentBlock();
 
  688                include_once 
'./Services/Calendar/classes/class.ilDatePresentation.php';
 
  689                foreach($prices as $price)
 
  691                        $data[$counter][
'price_id'] = ilUtil::formCheckBox(in_array($price[
'price_id'], 
$_SESSION[
'price_ids']) ? 1 : 0,
 
  692                                'price_ids[]', $price[
'price_id']);
 
  694                        switch($price[
'price_type'])
 
  697                                        $data[$counter][
'duration'] = $price[
'duration'] . 
' ' . $this->lng->txt(
'paya_months');
 
  705                                        $data[$counter][
'duration'] = $this->lng->txt(
'unlimited_duration');
 
  709                        $data[$counter][
'currency_unit'] = $genSet->get(
'currency_unit');
 
  710                        $data[$counter][
'extension']     = ilUtil::formCheckBox($price[
'extension'] ? 1 : 0,
 
  711                                'extension_ids[]', (
int)$price[
'price_id'], 
true);
 
  713                        $this->ctrl->setParameter($this, 
"price_id", $price[
'price_id']);
 
  714                        $data[$counter][
'edit'] =
 
  715                                "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, 
"editPrice") . 
"\">" . $this->lng->txt(
"edit") . 
"</a></div>";
 
  719                $this->__editPricesTable(
$data);
 
  724        private function __editPricesTable($a_result_set)
 
  732                        $tbl->setTitle($tmp_obj->getTitle());
 
  736                        $tbl->setTitle($this->lng->txt(
'object_not_found'));
 
  739                $tbl->setId(
'tbl_bookings');
 
  740                $tbl->setRowTemplate(
"tpl.shop_prices_row.html", 
"Services/Payment");
 
  742                $tbl->addColumn(
' ', 
'price_id', 
'5%');
 
  743                $tbl->addColumn($this->lng->txt(
'duration'), 
'duration', 
'40%');
 
  744                $tbl->addColumn($this->lng->txt(
'price_a'), 
'price', 
'1%');
 
  745                $tbl->addColumn($this->lng->txt(
'currency'), 
'currency_unit', 
'10%');
 
  746                $tbl->addColumn($this->lng->txt(
'extension_price'), 
'extension', 
'10%');
 
  747                $tbl->addColumn(
'', 
'edit', 
'30%');
 
  749                $tbl->setSelectAllCheckbox(
'price_id');
 
  750                $tbl->addCommandButton(
'addPrice', $this->lng->txt(
'paya_add_price'));
 
  752                $tbl->addMultiCommand(
"deletePrice", $this->lng->txt(
"paya_delete_price"));
 
  755                $tbl->setData($a_result_set);
 
  757                $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
 
  762        public function addPrice()
 
  769                if(!
$_GET[
'pobject_id'])
 
  773                        $this->showObjects();
 
  777                include_once 
'./Services/Payment/classes/class.ilPaymentSettings.php';
 
  781                $this->ctrl->setParameter($this, 
'pobject_id', (
int)
$_GET[
'pobject_id']);
 
  785                $ilToolbar->addButton($this->lng->txt(
'paya_edit_details'), $this->ctrl->getLinkTarget($this, 
'editDetails'));
 
  786                $ilToolbar->addButton($this->lng->txt(
'paya_edit_prices'), $this->ctrl->getLinkTarget($this, 
'editPrices'));
 
  788                $this->tpl->addBlockfile(
'ADM_CONTENT', 
'adm_content', 
'tpl.main_view.html', 
'Services/Payment');
 
  791                $form->setFormAction($this->ctrl->getFormAction($this));
 
  792                $form->setTitle($this->lng->txt(
'paya_add_price_title'));
 
  798                if(is_object($tmp_obj))
 
  800                        $oTitle->setValue($tmp_obj->getTitle());
 
  804                        $oTitle->setValue($this->lng->txt(
'object_not_found'));
 
  806                $form->addItem($oTitle);
 
  811                $radio_group->setTitle($this->lng->txt(
'duration'));
 
  812                $radio_group->setRequired(
true);
 
  813                $radio_group->setValue(
$_POST[
'price_type']);
 
  814                $radio_group->setPostVar(
'price_type');
 
  816                $radio_option_1 = 
new ilRadioOption($this->lng->txt(
'duration_month'), 
'duration_month');
 
  820                $oDuration->setTitle($this->lng->txt(
'paya_months'));
 
  821                $oDuration->setSize(
'30%');
 
  822                $oDuration->setValue(
$_POST[
'duration_month']);
 
  824                $oDuration->setPostVar(
'duration_month');
 
  825                $radio_option_1->addSubItem($oDuration);
 
  827                $radio_group->addOption($radio_option_1);
 
  829                $radio_option_3 = 
new ilRadioOption($this->lng->txt(
'duration_date'), 
'duration_date');
 
  833                $o_date_from->setTitle($this->lng->txt(
'from'));
 
  834                $o_date_from->setPostVar(
'duration_date_from');
 
  835                $radio_option_3->addSubItem($o_date_from);
 
  839                $o_date_until->setTitle($this->lng->txt(
'until'));
 
  840                $o_date_until->setPostVar(
'duration_date_until');
 
  841                $radio_option_3->addSubItem($o_date_until);
 
  843                $radio_group->addOption($radio_option_3);
 
  845                $radio_option_2 = 
new ilRadioOption($this->lng->txt(
'unlimited_duration'), 
'unlimited_duration');
 
  846                $radio_group->addOption($radio_option_2);
 
  848                $form->addItem($radio_group);
 
  850                $oDescription = 
new ilTextAreaInputGUI($this->lng->txt(
'description'), 
'description');
 
  851                $oDescription->setRows(4);
 
  852                $oDescription->setCols(35);
 
  853                $oDescription->setValue(
$_POST[
'description']);
 
  854                $form->addItem($oDescription);
 
  858                $oPrice->setTitle($this->lng->txt(
'price_a'));
 
  859                $oPrice->setValue(
$_POST[
'price']);
 
  860                $oPrice->setPostVar(
'price');
 
  861                $oPrice->setRequired(
true);
 
  862                $oPrice->allowDecimals(
true);
 
  863                $form->addItem($oPrice);
 
  866                $this->tpl->setVariable(
'TXT_PRICE_A', $genSet->get(
'currency_unit'));
 
  869                $oExtension = 
new ilCheckboxInputGUI($this->lng->txt(
'extension_price'), 
'extension');
 
  870                isset(
$_POST[
'extension']) ? $ext_value = 1 : $ext_value = 0;
 
  871                $oExtension->setChecked($ext_value);
 
  873                $form->addItem($oExtension);
 
  875                $form->addCommandButton(
'performAddPrice', $this->lng->txt(
'paya_add_price'));
 
  876                $form->addCommandButton(
'editPrices', $this->lng->txt(
'cancel'));
 
  877                $this->tpl->setVariable(
'FORM', $form->getHTML());
 
  884                if(!(
int)
$_GET[
'pobject_id'])
 
  888                        $this->showObjects();
 
  892                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
  893                include_once 
'./Services/Payment/classes/class.ilPaymentCurrency.php';
 
  899                switch(
$_POST[
'price_type'])
 
  901                        case 'unlimited_duration':
 
  904                                $po->setDurationFrom(NULL);
 
  905                                $po->setDurationUntil(NULL);
 
  906                                $po->setUnlimitedDuration(1);
 
  910                        case 'duration_date':
 
  913                                $po->setDuration(NULL);
 
  915                                        $_POST[
'duration_date_from'][
'date'][
'y'] . 
'-' .
 
  916                                                $_POST[
'duration_date_from'][
'date'][
'm'] . 
'-' .
 
  917                                                $_POST[
'duration_date_from'][
'date'][
'd']));
 
  919                                        $_POST[
'duration_date_until'][
'date'][
'y'] . 
'-' .
 
  920                                                $_POST[
'duration_date_until'][
'date'][
'm'] . 
'-' .
 
  921                                                $_POST[
'duration_date_until'][
'date'][
'd']));
 
  925                        case 'duration_month':
 
  927                                $po->setDuration(
$_POST[
'duration_month']);
 
  928                                $po->setDurationFrom(NULL);
 
  929                                $po->setDurationUntil(NULL);
 
  935                $po->setCurrency($currency[1][
'currency_id']);
 
  937                if(
$_POST[
'extension_price'])
 
  939                        $po->setExtension(1);
 
  943                        $po->setExtension(0);
 
  952                        return $this->editPrices();
 
  958                        return $this->addPrice();
 
  965                if(!
$_GET[
'pobject_id'])
 
  969                        $this->showObjects();
 
  980                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
  984                foreach(
$_SESSION[
'price_ids'] as $price_id)
 
  986                        $prices->delete($price_id);
 
  990                if(!count($prices->getPrices()))
 
  994                        $this->pobject->setStatus($this->pobject->STATUS_NOT_BUYABLE);
 
  995                        $this->pobject->update();
 
 1002                return $this->editPrices();
 
 1008                if(!
$_GET[
'pobject_id'])
 
 1012                        $this->showObjects();
 
 1016                if(!count(
$_POST[
'price_ids']))
 
 1020                        $this->editPrices();
 
 1025                $this->editPrices(
true);
 
 1031                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
 1037                        $this->showObjects();
 
 1040                if(isset(
$_GET[
'pobject_id']))
 
 1042                        $pobject_id = (int)
$_GET[
'pobject_id'];
 
 1046                        $pobject_id = (int)
$_POST[
'pobject_id'];
 
 1050                $this->ctrl->setParameter($this, 
'pobject_id', $pobject_id);
 
 1052                $price_id = (int)
$_POST[
'price_id'];
 
 1055                $old_price = $po->getPrice($price_id);
 
 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']);
 
 1065                if(!$po->validate())
 
 1073                        $this->editPrices();
 
 1077                foreach(
$_POST[
'prices'] as $price_id => $price)
 
 1079                        $old_price = $po->getPrice($price_id);
 
 1080                        if(isset(
$_POST[
'duration_ids']))
 
 1083                                if(
$_POST[
'duration_ids'] == NULL)
 
 1085                                        $po->setUnlimitedDuration(0);
 
 1086                                        $po->setDuration($price[
'duration']);
 
 1089                                else if($search = in_array((
string)$price_id, 
$_POST[
'duration_ids']))
 
 1091                                        $po->setUnlimitedDuration(1);
 
 1092                                        $po->setDuration(0);
 
 1096                                        $po->setUnlimitedDuration(0);
 
 1100                        if(isset(
$_POST[
'extension_ids']))
 
 1103                                if($search = in_array((
string)$price_id, 
$_POST[
'extension_ids']))
 
 1105                                        $po->setExtension(1);
 
 1109                                        $po->setExtension(0);
 
 1113                        $po->setDuration($price[
'duration']);
 
 1115                        $po->setPrice($price[
'price']);
 
 1116                        $po->setCurrency($old_price[
'currency']);
 
 1117                        $po->update($price_id);
 
 1120                $this->editPrices();
 
 1127                if(!
$_GET[
'pobject_id'])
 
 1131                        $this->showObjects();
 
 1135                $this->ctrl->setParameter($this, 
'pobject_id', (
int)
$_GET[
'pobject_id']);
 
 1138                $old_status = $this->pobject->getStatus();
 
 1141                if($old_status == $this->pobject->STATUS_NOT_BUYABLE and
 
 1142                        (
int)
$_POST[
'status'] != $old_status
 
 1146                        switch((
int)
$_POST[
'pay_method'])
 
 1148                                case $this->pobject->PAY_METHOD_NOT_SPECIFIED:
 
 1150                                        $this->editDetails();
 
 1158                        include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
 1161                        if(!count($prices_obj->getPrices()))
 
 1164                                $this->editDetails();
 
 1170                if((
int)
$_POST[
'status'] == 0)
 
 1173                        include_once 
'./Services/Payment/classes/class.ilPaymentShoppingCart.php';
 
 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']);
 
 1185                if((
int)
$_POST[
'thumbnail_delete'])
 
 1188                        $oFile->deassignFileFromPaymentObject();
 
 1190                else if($_FILES[
'thumbnail'][
'tmp_name'] != 
'')
 
 1192                        $this->lng->loadLanguageModule(
'form');
 
 1193                        include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1195                        if($oThumbnail->checkInput())
 
 1198                                if(($oFile->storeUploadedFile($_FILES[
'thumbnail'])) !== 
false)
 
 1200                                        $oFile->assignFileToPaymentObject();
 
 1206                                return $this->editDetails();
 
 1210                $this->pobject->update();
 
 1213                $this->showObjects();
 
 1218        public function showObjectSelector()
 
 1224                $this->tpl->addBlockFile(
'ADM_CONTENT', 
'adm_content', 
'tpl.paya_object_selector.html', 
'Services/Payment');
 
 1225                $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'showObjects'));
 
 1229                include_once(
"./Services/Payment/classes/class.ilPaymentObjectSelector.php");
 
 1231                if (!$exp->handleCommand())
 
 1233                        $this->tpl->setLeftNavContent($exp->getHTML());
 
 1243                if(!(
int)
$_GET[
'sell_id'])
 
 1246                        return $this->showObjectSelector();
 
 1249                $ilToolbar->addButton($this->lng->txt(
'back'), $this->ctrl->getLinkTarget($this, 
'showObjectSelector'));
 
 1252                $this->ctrl->setParameter($this, 
'sell_id', (
int)
$_GET[
'sell_id']);
 
 1254                include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1256                $oForm->setFormAction($this->ctrl->getFormAction($this, 
'updateDetails'));
 
 1257                $oForm->setTitle($this->lng->txt(
'details'));
 
 1261                if(is_object($tmp_obj))
 
 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']);
 
 1270                        $tmp_object[
'title']       = $this->lng->txt(
'object_not_found');
 
 1271                        $tmp_object[
'description'] = 
'';
 
 1272                        $tmp_object[
'owner']       = 
'';
 
 1273                        $tmp_object[
'path']        = 
'';
 
 1278                $oTitleGUI->setValue($tmp_object[
'title']);
 
 1279                $oForm->addItem($oTitleGUI);
 
 1283                $oDescriptionGUI->setValue($tmp_object[
'description']);
 
 1284                $oForm->addItem($oDescriptionGUI);
 
 1288                $oOwnerGUI->setValue($tmp_object[
'owner']);
 
 1289                $oForm->addItem($oOwnerGUI);
 
 1293                $oPathGUI->setValue($tmp_object[
'path']);
 
 1294                $oForm->addItem($oPathGUI);
 
 1297                $oVendorsGUI = 
new ilSelectInputGUI($this->lng->txt(
'paya_vendor'), 
'vendor');
 
 1298                $oVendorsGUI->setOptions($this->__getVendors());
 
 1299                $oForm->addItem($oVendorsGUI);
 
 1302                $oForm->addCommandButton(
'addObject', $this->lng->txt(
'next'));
 
 1303                $oForm->addCommandButton(
'showObjects', $this->lng->txt(
'cancel'));
 
 1305                $this->tpl->setVariable(
'ADM_CONTENT', $oForm->getHTML());
 
 1311                if(!
$_GET[
'sell_id'])
 
 1315                        return $this->showObjectSelector();
 
 1317                if(!(
int)
$_POST[
'vendor'])
 
 1324                include_once 
'Services/Payment/classes/class.ilPaymentObject.php';
 
 1329                        if(!in_array(
'download', $check_subtypes))
 
 1330                                $p_obj->setSubtype(
'download');
 
 1332                                if(!in_array(
'upload', $check_subtypes))
 
 1333                                        $p_obj->setSubtype(
'upload');
 
 1343                                return $this->showObjectSelector();
 
 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']);
 
 1353                $new_id = $p_obj->add();
 
 1357                        $_GET[
'pobject_id'] = $new_id;
 
 1358                        $this->editPrices();
 
 1364                        return $this->showObjects();
 
 1368        private function __getVendors()
 
 1370                include_once 
'Services/Payment/classes/class.ilPaymentVendors.php';
 
 1374                if(ilPaymentVendors::_isVendor($this->user_obj->getId()))
 
 1376                        $vendors[] = $this->user_obj->getId();
 
 1380                        $vendors = array_merge($vendors, $vend);
 
 1383                foreach($vendors as $vendor)
 
 1387                        $options[$vendor] = $tmp_obj->getFullname() . 
' [' . $tmp_obj->getLogin() . 
']';
 
 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');
 
 1407                $tbl->setTitle($this->lng->txt(
'objects'));
 
 1409                $tbl->setId(
'tbl_objects');
 
 1410                $tbl->setRowTemplate(
"tpl.shop_objects_row.html", 
"Services/Payment");
 
 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%');
 
 1420                $tbl->setData($a_result_set);
 
 1422                $this->tpl->setVariable(
'TABLE', $tbl->getHTML());
 
 1428        private function __getHTMLPath($a_ref_id)
 
 1434                $path = $tree->getPathFull($a_ref_id);
 
 1440                        $html .= 
$data[
'title'] . 
' > ';
 
 1442                return substr($html, 0, -2);
 
 1447                include_once 
'./Services/Payment/classes/class.ilPaymentObject.php';
 
 1454        public function editPrice()
 
 1456                $this->tpl->addBlockfile(
'ADM_CONTENT', 
'adm_content', 
'tpl.main_view.html', 
'Services/Payment');
 
 1462                include_once 
'Services/Form/classes/class.ilPropertyFormGUI.php';
 
 1464                $form->setFormAction($this->ctrl->getFormAction($this));
 
 1468                $radio_group->setTitle($this->lng->txt(
'duration'));
 
 1469                $radio_group->setRequired(
true);
 
 1470                $radio_group->setValue($price[
'price_type']);
 
 1471                $radio_group->setPostVar(
'price_type');
 
 1477                $oDuration->setTitle($this->lng->txt(
'paya_months'));
 
 1478                $oDuration->setSize(
'20%');
 
 1479                $oDuration->setValue($price[
'duration']);
 
 1480                $oDuration->setPostVar(
'duration_month');
 
 1481                $radio_option_1->addSubItem($oDuration);
 
 1483                $radio_group->addOption($radio_option_1);
 
 1487                $now_date = date(
'Y-m-d');
 
 1491                $o_date_from->setTitle($this->lng->txt(
'from'));
 
 1493                $o_date_from->setDate(
new ilDate($price[
'duration_from'] == NULL ? $now_date : $price[
'duration_from'], 
IL_CAL_DATE));
 
 1494                $o_date_from->setPostVar(
'duration_date_from');
 
 1495                $radio_option_3->addSubItem($o_date_from);
 
 1499                $o_date_until->setTitle($this->lng->txt(
'until'));
 
 1500                $o_date_until->setDate(
new ilDate($price[
'duration_until'] == NULL ? $now_date : $price[
'duration_until'], 
IL_CAL_DATE));
 
 1501                $o_date_until->setPostVar(
'duration_date_until');
 
 1502                $radio_option_3->addSubItem($o_date_until);
 
 1504                $radio_group->addOption($radio_option_3);
 
 1507                $radio_group->addOption($radio_option_2);
 
 1509                $form->addItem($radio_group);
 
 1512                $oDescription = 
new ilTextAreaInputGUI($this->lng->txt(
'description'), 
'description');
 
 1513                $oDescription->setRows(4);
 
 1514                $oDescription->setCols(35);
 
 1515                $oDescription->setValue($price[
'description']);
 
 1516                $form->addItem($oDescription);
 
 1520                $oPrice->setTitle($this->lng->txt(
'price_a'));
 
 1521                $oPrice->allowDecimals(
true);
 
 1522                $oPrice->setRequired(
true);
 
 1523                $oPrice->setSize(
'20%');
 
 1524                $oPrice->setValue($price[
'price']);
 
 1525                include_once 
'./Services/Payment/classes/class.ilPaymentSettings.php';
 
 1528                $oPrice->setInfo($genSet->get(
'currency_unit'));
 
 1529                $oPrice->setPostVar(
'price');
 
 1530                $oPrice->allowDecimals(
true);
 
 1531                $form->addItem($oPrice);
 
 1534                $oExtension = 
new ilCheckboxInputGUI($this->lng->txt(
'extension_price'), 
'extension');
 
 1535                $oExtension->setChecked((
int)$price[
'extension']);
 
 1536                $form->addItem($oExtension);
 
 1539                $o_hidden_1->setValue((
int)
$_GET[
'pobject_id']);
 
 1540                $o_hidden_1->setPostVar(
'pobject_id');
 
 1543                $o_hidden_2->setValue((
int)
$_GET[
'price_id']);
 
 1544                $o_hidden_2->setPostVar(
'price_id');
 
 1546                $form->addItem($o_hidden_1);
 
 1547                $form->addItem($o_hidden_2);
 
 1549                $form->addCommandButton(
'updatePrice', $this->lng->txt(
'save'));
 
 1550                $form->addCommandButton(
'editPrices', $this->lng->txt(
'cancel'));
 
 1552                $this->tpl->setVariable(
'FORM', $form->getHTML());
 
 1557                include_once 
'./Services/Payment/classes/class.ilPaymentPrices.php';
 
 1563                        $this->showObjects();
 
 1566                if(isset(
$_GET[
'pobject_id']))
 
 1568                        $pobject_id = (int)
$_GET[
'pobject_id'];
 
 1572                        $pobject_id = (int)
$_POST[
'pobject_id'];
 
 1575                if(!(
int)
$_GET[
'price_id'] && !
$_POST[
'price_id'])
 
 1578                        return $this->editPrices();
 
 1580                if(isset(
$_GET[
'price_id']))
 
 1582                        $price_id = (int)
$_GET[
'price_id'];
 
 1586                        $price_id = (int)
$_POST[
'price_id'];
 
 1590                switch(
$_POST[
'price_type'])
 
 1594                                $po->setDuration(NULL);
 
 1595                                $po->setDurationFrom(NULL);
 
 1596                                $po->setDurationUntil(NULL);
 
 1597                                $po->setUnlimitedDuration(1);
 
 1604                                $po->setDuration(NULL);
 
 1606                                        $_POST[
'duration_date_from'][
'date'][
'y'] . 
'-' .
 
 1607                                                $_POST[
'duration_date_from'][
'date'][
'm'] . 
'-' .
 
 1608                                                $_POST[
'duration_date_from'][
'date'][
'd']));
 
 1610                                        $_POST[
'duration_date_until'][
'date'][
'y'] . 
'-' .
 
 1611                                                $_POST[
'duration_date_until'][
'date'][
'm'] . 
'-' .
 
 1612                                                $_POST[
'duration_date_until'][
'date'][
'd']));
 
 1618                                $po->setDuration(
$_POST[
'duration_month']);
 
 1619                                $po->setDurationFrom(NULL);
 
 1620                                $po->setDurationUntil(NULL);
 
 1629                        $po->setExtension(1);
 
 1633                        $po->setExtension(0);
 
 1638                        $po->update($price_id);
 
 1640                        return $this->editPrices();
 
 1645                        return $this->editPrices();
 
Confirmation screen class.
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
This class handles all operations on files in directory data/shop.
This class represents a non editable value in a property form.
getContentStylePath($a_style_id)
get content style path
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
_isInTrash($a_ref_id)
checks wether object is in trash
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
static getStringByPaymethod($a_type)
static _getCountBookingsByObject($a_pobject_id)
static _getAvailableCurrencies()
__initPaymentObject($a_pobject_id=0)
__showObjectsTable($a_result_set)
static _checkExcSubtype($a_ref_id)
static _isPurchasable($a_ref_id, $a_vendor_id=0, $a_check_trustee=false, $a_check_status=false)
static _getObjectsData($a_user_id)
const TYPE_UNLIMITED_DURATION
static _getPrice($a_price_id)
const TYPE_DURATION_MONTH
static _getVendorsForObjects($a_usr_id)
This class represents an option in a radio group.
Class for shop related exception handling in ILIAS.
static _formatVAT($a_vat)
Formats a vat rate for gui output.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_array($argv)) $options