コード例 #1
0
 public function editPriceObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id'];
     $price = ilPaymentPrices::_getPrice($price_id);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']);
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false);
     if ($tmp_obj) {
         $form->setTitle($tmp_obj->getTitle());
     } else {
         $form->setTitle($this->lng->txt('object_not_found'));
     }
     //price_type
     $radio_group = new ilRadioGroupInputGUI('', 'price_type');
     $radio_group->setTitle($this->lng->txt('duration'));
     $radio_group->setRequired(true);
     $radio_group->setValue($price['price_type']);
     $radio_group->setPostVar('price_type');
     $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH);
     // duration month
     $oDuration = new ilNumberInputGUI();
     $oDuration->setTitle($this->lng->txt('paya_months'));
     $oDuration->setSize('20%');
     $oDuration->setValue($price['duration']);
     $oDuration->setPostVar('duration_month');
     $radio_option_1->addSubItem($oDuration);
     $radio_group->addOption($radio_option_1);
     $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE);
     // duration_date from
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setTitle($this->lng->txt('cal_from'));
     $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE));
     $o_date_from->setPostVar('duration_date_from');
     $radio_option_3->addSubItem($o_date_from);
     // duration_date until
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setTitle($this->lng->txt('cal_until'));
     $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE));
     $o_date_until->setPostVar('duration_date_until');
     $radio_option_3->addSubItem($o_date_until);
     $radio_group->addOption($radio_option_3);
     $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION);
     $radio_group->addOption($radio_option_2);
     $form->addItem($radio_group);
     // description
     $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $oDescription->setRows(4);
     $oDescription->setCols(35);
     $oDescription->setValue($price['description']);
     $form->addItem($oDescription);
     // price
     $oPrice = new ilNumberInputGUI();
     $oPrice->setTitle($this->lng->txt('price_a'));
     $oPrice->setSize('20%');
     $oPrice->setRequired(true);
     $oPrice->setValue($price['price']);
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $oPrice->setInfo($genSet->get('currency_unit'));
     $oPrice->setPostVar('price');
     $oPrice->allowDecimals(true);
     $form->addItem($oPrice);
     //extension
     $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension');
     $oExtension->setChecked($price['extension']);
     $form->addItem($oExtension);
     $o_hidden_1 = new ilHiddenInputGUI('pobject_id');
     $o_hidden_1->setValue((int) $_GET['pobject_id']);
     $o_hidden_1->setPostVar('pobject_id');
     $o_hidden_2 = new ilHiddenInputGUI('price_id');
     $o_hidden_2->setValue((int) $_GET['price_id']);
     $o_hidden_2->setPostVar('price_id');
     $form->addItem($o_hidden_1);
     $form->addItem($o_hidden_2);
     $form->addCommandButton('updatePrice', $this->lng->txt('save'));
     $form->addCommandButton('editPrices', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
 }
コード例 #2
0
 public function showGeneralFilter($a_count_result = 0)
 {
     global $ilUser;
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['content_filter']['updateView'] = $_POST['updateView'];
             $_SESSION['content_filter']['show_filter'] = $_POST['show_filter'];
             $_SESSION['content_filter']['sel_filter_type'] = $_POST['sel_filter_type'];
             $_SESSION['content_filter']['filter_text'] = $_POST['filter_text'];
             $_SESSION['content_filter']['filter_topic_id'] = $_POST['filter_topic_id'];
             $_SESSION['content_filter']['order_field'] = $_POST['order_field'];
             $_SESSION['content_filter']['order_direction'] = $_POST['order_direction'];
             $_SESSION['content_filter']['topics_sorting_type'] = $_POST['topics_sorting_type'];
             $_SESSION['content_filter']['topics_sorting_direction'] = $_POST['topics_sorting_direction'];
         }
     }
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     // FILTER FORM
     $filter_form = new ilPropertyFormGUI();
     $filter_form->setFormAction($this->ctrl->getFormAction($this));
     $filter_form->setTitle($this->lng->txt('pay_filter'));
     $filter_form->setId('formular');
     $filter_form->setTableWidth('100 %');
     $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter');
     $o_hide_check->setValue(1);
     $o_hide_check->setChecked($_SESSION['content_filter']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     $o_filter = new ilSelectInputGUI();
     $filter_option = array('title' => $this->lng->txt('title'), 'author' => $this->lng->txt('author'), 'metadata' => $this->lng->txt('meta_data'));
     $o_filter->setTitle($this->lng->txt('search_in'));
     $o_filter->setOptions($filter_option);
     $o_filter->setValue($_SESSION['content_filter']['sel_filter_type']);
     $o_filter->setPostVar('sel_filter_type');
     $o_hide_check->addSubItem($o_filter);
     $o_filter_by = new ilTextInputGUI($this->lng->txt('filter_by'));
     $o_filter_by->setValue($_SESSION['content_filter']['filter_text']);
     $o_filter_by->setPostVar('filter_text');
     $o_hide_check->addSubItem($o_filter_by);
     ilShopTopics::_getInstance()->setIdFilter(false);
     ilShopTopics::_getInstance()->read();
     $topic_option = array();
     if (count(ilShopTopics::_getInstance()->getTopics())) {
         $topic_option[''] = $this->lng->txt('please_select');
         foreach (ilShopTopics::_getInstance()->getTopics() as $oTopic) {
             $topic_option[$oTopic->getId()] = $oTopic->getTitle();
         }
     } else {
         $topic_option[''] = $this->lng->txt('no_topics_yet');
     }
     $o_topic = new ilSelectInputGUI();
     $o_topic->setTitle($this->lng->txt('topic'));
     $o_topic->setOptions($topic_option);
     $o_topic->setValue($_SESSION['content_filter']['filter_topic_id']);
     $o_topic->setPostVar('filter_topic_id');
     $o_hide_check->addSubItem($o_topic);
     #if(count($oResult->getResults()))
     if ($a_count_result) {
         $objects = (bool) $this->oGeneralSettings->get('objects_allow_custom_sorting');
         if ($objects) {
             // sorting form
             $allow_objects_option = array('title' => $this->lng->txt('title'), 'author' => $this->lng->txt('author'), 'price' => $this->lng->txt('price_a'));
             $o_allow_objects = new ilSelectInputGUI();
             $o_allow_objects->setTitle($this->lng->txt('sort_by'));
             $o_allow_objects->setOptions($allow_objects_option);
             $o_allow_objects->setValue($this->getSortField());
             $o_allow_objects->setPostVar('order_field');
             //objects_sorting_type
             $o_hide_check->addSubItem($o_allow_objects);
             $direction_option = array('asc' => $this->lng->txt('sort_asc'), 'desc' => $this->lng->txt('sort_desc'));
             $o_object_direction = new ilSelectInputGUI();
             $o_object_direction->setOptions($direction_option);
             $o_object_direction->setValue($this->getSortDirection());
             $o_object_direction->setPostVar('order_direction');
             //objects_sorting_direction
             $o_hide_check->addSubItem($o_object_direction);
         }
         $topics = (bool) $this->oGeneralSettings->get('topics_allow_custom_sorting');
         if ($topics) {
             // sorting form
             $allow_topics_option = array(ilShopTopics::TOPICS_SORT_BY_TITLE => $this->lng->txt('sort_topics_by_title'), ilShopTopics::TOPICS_SORT_BY_CREATEDATE => $this->lng->txt('sort_topics_by_date'));
             if (ANONYMOUS_USER_ID != $ilUser->getId()) {
                 $allow_topics_option[ilShopTopics::TOPICS_SORT_MANUALLY] = $this->lng->txt('sort_topics_manually');
             }
             $o_allow_topics = new ilSelectInputGUI();
             $o_allow_topics->setTitle($this->lng->txt('sort_topics_by'));
             $o_allow_topics->setOptions($allow_topics_option);
             $o_allow_topics->setValue($this->getSortingTypeTopics());
             $o_allow_topics->setPostVar('topics_sorting_type');
             $o_hide_check->addSubItem($o_allow_topics);
             $direction_option = array('asc' => $this->lng->txt('sort_asc'), 'desc' => $this->lng->txt('sort_desc'));
             $o_topics_direction = new ilSelectInputGUI();
             $o_topics_direction->setOptions($direction_option);
             $o_topics_direction->setValue($this->getSortingDirectionTopics());
             $o_topics_direction->setPostVar('topics_sorting_direction');
             //objects_sorting_type
             $o_hide_check->addSubItem($o_topics_direction);
         }
     }
     $filter_form->addCommandButton('setFilter', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     return $filter_form->getHTML();
 }
コード例 #3
0
 public function showStatistics()
 {
     global $rbacsystem, $ilToolbar, $ilObjDataCache;
     // MINIMUM ACCESS LEVEL = 'read'
     /*	if(!$rbacsystem->checkAccess('read', $this->getRefId()))
     		{
     			$this->ilias->raiseError($this->lng->txt('msg_no_perm_read'),$this->ilias->error_obj->MESSAGE);
     		}
     	*/
     $ilToolbar->addButton($this->lng->txt('paya_add_customer'), $this->ctrl->getLinkTarget($this, 'showObjectSelector'));
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['pay_statistics']['show_filter'] = $_POST['show_filter'];
             $_SESSION['pay_statistics']['updateView'] = true;
             $_SESSION['pay_statistics']['until_check'] = $_POST['until_check'];
             $_SESSION['pay_statistics']['from_check'] = $_POST['from_check'];
             $_SESSION['pay_statistics']['transaction_type'] = isset($_POST['transaction_type']) ? $_POST['transaction_type'] : '';
             $_SESSION['pay_statistics']['transaction_value'] = isset($_POST['transaction_value']) ? $_POST['transaction_value'] : '';
             $_SESSION['pay_statistics']['filter_title_id'] = (int) $_POST['filter_title_id'];
             if ($_SESSION['pay_statistics']['from_check'] == '1') {
                 $_SESSION['pay_statistics']['from']['date']['d'] = $_POST['from']['date']['d'];
                 $_SESSION['pay_statistics']['from']['date']['m'] = $_POST['from']['date']['m'];
                 $_SESSION['pay_statistics']['from']['date']['y'] = $_POST['from']['date']['y'];
             } else {
                 $_SESSION['pay_statistics']['from']['date']['d'] = '';
                 $_SESSION['pay_statistics']['from']['date']['m'] = '';
                 $_SESSION['pay_statistics']['from']['date']['y'] = '';
             }
             if ($_SESSION['pay_statistics']['until_check'] == '1') {
                 $_SESSION['pay_statistics']['til']['date']['d'] = $_POST['til']['date']['d'];
                 $_SESSION['pay_statistics']['til']['date']['m'] = $_POST['til']['date']['m'];
                 $_SESSION['pay_statistics']['til']['date']['y'] = $_POST['til']['date']['y'];
             } else {
                 $_SESSION['pay_statistics']['til']['date']['d'] = '';
                 $_SESSION['pay_statistics']['til']['date']['m'] = '';
                 $_SESSION['pay_statistics']['til']['date']['y'] = '';
             }
             $_SESSION['pay_statistics']['payed'] = $_POST['payed'];
             $_SESSION['pay_statistics']['access'] = $_POST['access'];
             $_SESSION['pay_statistics']['pay_method'] = $_POST['pay_method'];
             $_SESSION['pay_statistics']['customer'] = isset($_POST['customer']) ? $_POST['customer'] : '';
             $_SESSION['pay_statistics']['vendor'] = isset($_POST['vendor']) ? $_POST['vendor'] : '';
         }
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     // FILTER FORM
     $filter_form = new ilPropertyFormGUI();
     $filter_form->setFormAction($this->ctrl->getFormAction($this));
     $filter_form->setTitle($this->lng->txt('pay_filter'));
     $filter_form->setId('formular');
     $filter_form->setTableWidth('100 %');
     $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter');
     $o_hide_check->setValue(1);
     $o_hide_check->setChecked($_SESSION['pay_statistics']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     $o_transaction_type = new ilSelectInputGUI();
     $trans_option = array($this->lng->txt('pay_starting'), $this->lng->txt('pay_ending'));
     $trans_value = array('0', '1');
     $o_transaction_type->setTitle($this->lng->txt('paya_transaction'));
     $o_transaction_type->setOptions($trans_option);
     $o_transaction_type->setValue($_SESSION['pay_statistics']['transaction_type']);
     $o_transaction_type->setPostVar('transaction_type');
     $o_hide_check->addSubItem($o_transaction_type);
     $o_transaction_val = new ilTextInputGUI();
     $o_transaction_val->setValue($_SESSION['pay_statistics']['transaction_value']);
     $o_transaction_val->setPostVar('transaction_value');
     $o_hide_check->addSubItem($o_transaction_val);
     $o_customer = new ilTextInputGUI();
     $o_customer->setTitle($this->lng->txt('paya_customer'));
     $o_customer->setValue($_SESSION['pay_statistics']['customer']);
     $o_customer->setPostVar('customer');
     $o_hide_check->addSubItem($o_customer);
     $o_vendor = new ilTextInputGUI();
     $o_vendor->setTitle($this->lng->txt('paya_vendor'));
     $o_vendor->setValue($_SESSION['pay_statistics']['vendor']);
     $o_vendor->setPostVar('vendor');
     $o_hide_check->addSubItem($o_vendor);
     $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_from'), 'from_check');
     $o_from_check->setValue(1);
     $o_from_check->setChecked($_SESSION['pay_statistics']['from_check'] ? 1 : 0);
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setPostVar('from');
     $_POST['from'] = $_SESSION['pay_statistics']['from'];
     if ($_SESSION['pay_statistics']['from_check'] == '1') {
         $o_date_from->checkInput();
     }
     $o_from_check->addSubItem($o_date_from);
     $o_hide_check->addSubItem($o_from_check);
     $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_til'), 'until_check');
     $o_until_check->setValue(1);
     $o_until_check->setChecked($_SESSION['pay_statistics']['until_check'] ? 1 : 0);
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setPostVar('til');
     $_POST['til'] = $_SESSION['pay_statistics']['til'];
     if ($_SESSION['pay_statistics']['until_check'] == '1') {
         $o_date_until->checkInput();
     }
     $o_until_check->addSubItem($o_date_until);
     $o_hide_check->addSubItem($o_until_check);
     // title filter
     $this->__initBookingObject();
     $title_options['all'] = $this->lng->txt('pay_all');
     $unique_titles = $this->booking_obj->getUniqueTitles();
     if (is_array($unique_titles) && count($unique_titles)) {
         foreach ($unique_titles as $ref_id) {
             $title_options[$ref_id] = $ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($ref_id));
         }
     }
     $o_object_title = new ilSelectInputGUI();
     $o_object_title->setTitle($this->lng->txt('title'));
     $o_object_title->setOptions($title_options);
     $o_object_title->setValue($_SESSION["pay_statistics"]["filter_title_id"]);
     $o_object_title->setPostVar('filter_title_id');
     $o_hide_check->addSubItem($o_object_title);
     $o_payed = new ilSelectInputGUI();
     $payed_option = array('all' => $this->lng->txt('pay_all'), '1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_payed->setTitle($this->lng->txt('paya_payed'));
     $o_payed->setOptions($payed_option);
     $o_payed->setValue($_SESSION['pay_statistics']['payed']);
     $o_payed->setPostVar('payed');
     $o_hide_check->addSubItem($o_payed);
     $o_access = new ilSelectInputGUI();
     $access_option = array('all' => $this->lng->txt('pay_all'), '1' => $this->lng->txt('yes'), '0' => $this->lng->txt('no'));
     $o_access->setTitle($this->lng->txt('paya_access'));
     $o_access->setOptions($access_option);
     $o_access->setValue($_SESSION['pay_statistics']['access']);
     $o_access->setPostVar('access');
     $o_hide_check->addSubItem($o_access);
     $o_paymethod = new ilSelectInputGUI();
     $o_paymethod->setTitle($this->lng->txt('payment_system'));
     $o_paymethod->setOptions(ilPayMethods::getPayMethodsOptions('all'));
     $o_paymethod->setValue($_SESSION['pay_statistics']['pay_method']);
     $o_paymethod->setPostVar('pay_method');
     $o_hide_check->addSubItem($o_paymethod);
     $filter_form->addCommandButton('showStatistics', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     $this->tpl->setVariable('FORM', $filter_form->getHTML());
     // STATISTICS TABLE
     $this->__initBookingObject();
     if (!count($bookings = $this->booking_obj->getBookings())) {
         ilUtil::sendInfo($this->lng->txt('paya_no_bookings'));
         return true;
     }
     #		$this->__showButton('excelExport',$this->lng->txt('excel_export'));
     include_once 'Services/User/classes/class.ilObjUser.php';
     $object_title_cache = array();
     $user_title_cache = array();
     $counter = 0;
     foreach ($bookings as $booking) {
         if (array_key_exists($booking['ref_id'], $object_title_cache)) {
             $tmp_obj = $object_title_cache[$booking['ref_id']];
         } else {
             $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id']));
             $object_title_cache[$booking['ref_id']] = $tmp_obj;
         }
         if (array_key_exists($booking['b_vendor_id'], $user_title_cache)) {
             $tmp_vendor = $user_title_cache[$booking['b_vendor_id']];
         } else {
             $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']);
             $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor;
         }
         if (array_key_exists($booking['customer_id'], $user_title_cache)) {
             $tmp_purchaser = $user_title_cache[$booking['customer_id']];
         } else {
             $tmp_purchaser = ilObjUser::_lookupLogin($booking['customer_id']);
             $user_title_cache[$booking['customer_id']] = $tmp_purchaser;
         }
         $transaction = $booking['transaction_extern'];
         $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']);
         $transaction .= " (" . $str_paymethod . ")";
         $f_result[$counter]['transaction'] = $transaction;
         $f_result[$counter]['object_title'] = $tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted');
         $f_result[$counter]['vendor'] = $tmp_vendor != '' ? '[' . $tmp_vendor . ']' : $this->lng->txt('user_deleted');
         $f_result[$counter]['customer'] = $tmp_purchaser != '' ? '[' . $tmp_purchaser . ']' : $this->lng->txt('user_deleted');
         $f_result[$counter]['order_date'] = ilDatePresentation::formatDate(new ilDateTime($booking['order_date'], IL_CAL_UNIX));
         if ($booking['duration'] == 0) {
             $booking['duration'] = $this->lng->txt('unlimited_duration');
         }
         $f_result[$counter]['duration'] = $booking['duration'];
         $f_result[$counter]['price'] = ilFormat::_getLocalMoneyFormat($booking['price']) . ' ' . $booking['currency_unit'];
         $f_result[$counter]['discount'] = $booking['discount'] . ' ' . $booking['currency_unit'];
         $payed_access = $booking['payed'] ? $this->lng->txt('yes') : $this->lng->txt('no');
         $payed_access .= '/';
         $payed_access .= $booking['access_granted'] ? $this->lng->txt('yes') : $this->lng->txt('no');
         $f_result[$counter]['payed_access'] = $payed_access;
         $this->ctrl->setParameter($this, "booking_id", $booking['booking_id']);
         $link_change = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "editStatistic") . "\">" . $this->lng->txt("edit") . "</a></div>";
         $f_result[$counter]['edit'] = $link_change;
         unset($tmp_obj);
         unset($tmp_vendor);
         unset($tmp_purchaser);
         ++$counter;
     }
     return $this->__showStatisticTable($f_result);
 }
コード例 #4
0
 public function showCoupons()
 {
     global $ilToolbar;
     include_once "Services/User/classes/class.ilObjUser.php";
     $ilToolbar->addButton($this->lng->txt('paya_coupons_add'), $this->ctrl->getLinkTarget($this, 'addCoupon'));
     if (!$_POST['show_filter'] && $_POST['updateView'] == '1') {
         $this->resetFilter();
     } else {
         if ($_POST['updateView'] == 1) {
             $_SESSION['pay_coupons']['show_filter'] = $_POST['show_filter'];
             $_SESSION['pay_coupons']['updateView'] = true;
             $_SESSION['pay_coupons']['until_check'] = $_POST['until_check'];
             $_SESSION['pay_coupons']['from_check'] = $_POST['from_check'];
             $_SESSION['pay_coupons']['title_type'] = isset($_POST['title_type']) ? $_POST['title_type'] : '';
             $_SESSION['pay_coupons']['title_value'] = isset($_POST['title_value']) ? $_POST['title_value'] : '';
             if ($_SESSION['pay_coupons']['from_check'] == '1') {
                 $_SESSION['pay_coupons']['from']['date']['d'] = $_POST['from']['date']['d'];
                 $_SESSION['pay_coupons']['from']['date']['m'] = $_POST['from']['date']['m'];
                 $_SESSION['pay_coupons']['from']['date']['y'] = $_POST['from']['date']['y'];
             } else {
                 $_SESSION['pay_coupons']['from']['date']['d'] = '';
                 $_SESSION['pay_coupons']['from']['date']['m'] = '';
                 $_SESSION['pay_coupons']['from']['date']['y'] = '';
             }
             if ($_SESSION['pay_coupons']['until_check'] == '1') {
                 $_SESSION['pay_coupons']['til']['date']['d'] = $_POST['til']['date']['d'];
                 $_SESSION['pay_coupons']['til']['date']['m'] = $_POST['til']['date']['m'];
                 $_SESSION['pay_coupons']['til']['date']['y'] = $_POST['til']['date']['y'];
             } else {
                 $_SESSION['pay_coupons']['til']['date']['d'] = '';
                 $_SESSION['pay_coupons']['til']['date']['m'] = '';
                 $_SESSION['pay_coupons']['til']['date']['y'] = '';
             }
             $_SESSION['pay_coupons']['coupon_type'] = $_POST['coupon_type'];
         }
     }
     $this->coupon_obj->setSearchTitleType(ilUtil::stripSlashes($_SESSION['pay_coupons']['title_type']));
     $this->coupon_obj->setSearchTitleValue(ilUtil::stripSlashes($_SESSION['pay_coupons']['title_value']));
     $this->coupon_obj->setSearchType(ilUtil::stripSlashes($_SESSION['pay_coupons']['coupon_type']));
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $filter_form = new ilPropertyFormGUI();
     $filter_form->setFormAction($this->ctrl->getFormAction($this));
     $filter_form->setTitle($this->lng->txt('pay_filter'));
     $filter_form->setId('formular');
     $filter_form->setTableWidth('100 %');
     $o_hide_check = new ilCheckBoxInputGUI($this->lng->txt('show_filter'), 'show_filter');
     $o_hide_check->setValue(1);
     $o_hide_check->setChecked($_SESSION['pay_coupons']['show_filter'] ? 1 : 0);
     $o_hidden = new ilHiddenInputGUI('updateView');
     $o_hidden->setValue(1);
     $o_hidden->setPostVar('updateView');
     $o_hide_check->addSubItem($o_hidden);
     // Title type
     $o_title_type = new ilSelectInputGUI();
     $title_option = array($this->lng->txt('pay_starting'), $this->lng->txt('pay_ending'));
     $title_value = array('0', '1');
     $o_title_type->setTitle($this->lng->txt('title'));
     $o_title_type->setOptions($title_option);
     $o_title_type->setValue($_SESSION['pay_coupons']['title_type']);
     $o_title_type->setPostVar('title_type');
     $o_hide_check->addSubItem($o_title_type);
     // Title value
     $o_title_val = new ilTextInputGUI();
     $o_title_val->setValue($_SESSION['pay_coupons']['title_value']);
     $o_title_val->setPostVar('title_value');
     $o_hide_check->addSubItem($o_title_val);
     //coupon type
     $o_coupon_type = new ilSelectInputGUI();
     $coupon_option = array('' => '', 'fix' => $this->lng->txt('paya_coupons_fix'), 'percent' => $this->lng->txt('paya_coupons_percentaged'));
     $o_coupon_type->setTitle($this->lng->txt('coupon_type'));
     $o_coupon_type->setOptions($coupon_option);
     $o_coupon_type->setValue($_SESSION['pay_coupons']['coupon_type']);
     $o_coupon_type->setPostVar('coupon_type');
     $o_hide_check->addSubItem($o_coupon_type);
     // date from
     $o_from_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_from'), 'from_check');
     $o_from_check->setValue(1);
     $o_from_check->setChecked($_SESSION['pay_coupons']['from_check'] ? 1 : 0);
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setPostVar('from');
     $_POST['from'] = $_SESSION['pay_coupons']['from'];
     if ($_SESSION['pay_coupons']['from_check'] == '1') {
         $o_date_from->checkInput();
     }
     $o_from_check->addSubItem($o_date_from);
     $o_hide_check->addSubItem($o_from_check);
     // date until
     $o_until_check = new ilCheckBoxInputGUI($this->lng->txt('pay_order_date_til'), 'until_check');
     $o_until_check->setValue(1);
     $o_until_check->setChecked($_SESSION['pay_coupons']['until_check'] ? 1 : 0);
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setPostVar('til');
     $_POST['til'] = $_SESSION['pay_coupons']['til'];
     if ($_SESSION['pay_coupons']['until_check'] == '1') {
         $o_date_until->checkInput();
     }
     $o_until_check->addSubItem($o_date_until);
     $o_hide_check->addSubItem($o_until_check);
     $filter_form->addCommandButton('showCoupons', $this->lng->txt('pay_update_view'));
     $filter_form->addCommandButton('resetFilter', $this->lng->txt('pay_reset_filter'));
     $filter_form->addItem($o_hide_check);
     $this->tpl->setVariable('FORM', $filter_form->getHTML());
     if (!count($coupons = $this->coupon_obj->getCoupons())) {
         ilUtil::sendInfo($this->lng->txt('paya_coupons_not_found'));
         //if ($_POST['updateView'] == '1') ilUtil::sendInfo($this->lng->txt('paya_coupons_not_found'));
         //else ilUtil::sendInfo($this->lng->txt('paya_coupons_not_available'));
         return true;
     }
     $counter = 0;
     foreach ($coupons as $coupon) {
         $f_result[$counter]['pc_title'] = $coupon['pc_title'];
         $f_result[$counter]['number_of_codes'] = $coupon['number_of_codes'];
         $f_result[$counter]['usage_of_codes'] = $coupon['usage_of_codes'];
         if (!empty($coupon['objects'])) {
             $objects = "";
             for ($i = 0; $i < count($coupon['objects']); $i++) {
                 $tmp_obj = ilObjectFactory::getInstanceByRefId($coupon['objects'][$i], false);
                 if ($tmp_obj) {
                     $objects .= $tmp_obj->getTitle();
                 } else {
                     $objects .= $this->lng->txt('object_not_found');
                 }
                 if ($i < count($coupon['objects']) - 1) {
                     $objects .= "<br />";
                 }
                 unset($tmp_obj);
             }
         } else {
             $objects = "";
         }
         $f_result[$counter]['objects'] = $objects;
         $f_result[$counter]['pc_from'] = $coupon['pc_from'] != NULL && $coupon['pc_from_enabled'] == '1' ? $coupon['pc_from'] : '';
         $f_result[$counter]['pc_till'] = $coupon['pc_till'] != NULL && $coupon['pc_till_enabled'] == '1' ? $coupon['pc_till'] : '';
         $f_result[$counter]['pc_last_changed'] = $coupon['pc_last_changed'] != NULL ? $coupon['pc_last_changed'] : '';
         $f_result[$counter]['pc_last_changed_author'] = $coupon['pc_last_change_usr_id'] > 0 ? ilObjUser::_lookupLogin($coupon['pc_last_change_usr_id']) : ilObjUser::_lookupLogin($coupon['usr_id']);
         $this->ctrl->setParameter($this, 'coupon_id', $coupon['pc_pk']);
         $f_result[$counter]['options'] = "<div class=\"il_ContainerItemCommands\"><a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "addCoupon") . "\">" . $this->lng->txt("edit") . "</a>";
         $f_result[$counter]['options'] .= " <a class=\"il_ContainerItemCommand\" href=\"" . $this->ctrl->getLinkTarget($this, "deleteCoupon") . "\">" . $this->lng->txt("delete") . "</a></div>";
         ++$counter;
     }
     return $this->__showCouponsTable($f_result);
 }