public function showObjects() { $this->coupon_obj->setId($_GET['coupon_id']); $this->__initPaymentObject(); $this->ctrl->setParameter($this, 'coupon_id', $_GET['coupon_id']); $this->__showButtons(); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment'); $objects = $this->pobject->_getObjectsData($this->user_obj->getId()); $this->coupon_obj->getCouponById(ilUtil::stripSlashes($_GET['coupon_id'])); $counter_assigned = 0; $counter_unassigned = 0; $f_result_assigned = array(); $f_result_unassigned = array(); foreach ($objects as $data) { if ($this->coupon_obj->isObjectAssignedToCoupon($data['ref_id'])) { $p_counter =& $counter_assigned; $p_result =& $f_result_assigned; } else { $p_counter =& $counter_unassigned; $p_result =& $f_result_unassigned; } $tmp_obj = ilObjectFactory::getInstanceByRefId($data['ref_id'], false); if ($tmp_obj) { $p_result[$p_counter]['object_id'] = ilUtil::formCheckbox(0, 'object_id[]', $data['ref_id']); $p_result[$p_counter]['title'] = $tmp_obj->getTitle(); switch ($data['status']) { case $this->pobject->STATUS_BUYABLE: $p_result[$p_counter]['status'] = $this->lng->txt('paya_buyable'); break; case $this->pobject->STATUS_NOT_BUYABLE: $p_result[$p_counter]['status'] = $this->lng->txt('paya_not_buyable'); break; case $this->pobject->STATUS_EXPIRES: $p_result[$p_counter]['status'] = $this->lng->txt('paya_expires'); break; } include_once './Services/Payment/classes/class.ilPayMethods.php'; $p_result[$p_counter]['pay_method'] = ilPaymethods::getStringByPaymethod($data['pay_method']); } else { $p_result[$p_counter]['object_id'] = ''; $p_result[$p_counter]['title'] = $this->lng->txt('object_not_found'); $p_result[$p_counter]['status'] = ''; $p_result[$p_counter]['pay_method'] = ''; } ++$p_counter; unset($tmp_obj); } $this->ctrl->setParameter($this, "cmd", "showObjects"); if (count($f_result_assigned) > 0) { $tbl = new ilShopTableGUI($this); $tbl->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt("paya_coupons_assigned_objects")); $tbl->setId('tbl_show_assigned'); $tbl->setPrefix('assigned'); $tbl->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment"); $tbl->addColumn('', 'object_id', '1%'); $tbl->addColumn($this->lng->txt('title'), 'title', '10%'); $tbl->addColumn($this->lng->txt('status'), 'status', '30%'); $tbl->addColumn($this->lng->txt('paya_pay_method'), 'paya_pay_method', '60%'); $tbl->setSelectAllCheckbox('object_id'); $tbl->addMultiCommand('unassignObjects', $this->lng->txt('remove')); $tbl->setData($f_result_assigned); $this->tpl->setVariable('TABLE', $tbl->getHTML()); } if (count($f_result_unassigned) > 0) { $tbl_2 = new ilShopTableGUI($this); $tbl_2->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt("paya_coupons_unassigned_objects")); $tbl_2->setId('tbl_show_unassigned'); $tbl_2->setPrefix('unassigned'); $tbl_2->setRowTemplate("tpl.shop_objects_row.html", "Services/Payment"); $tbl_2->addColumn('', 'object_id', '1%'); $tbl_2->addColumn($this->lng->txt('title'), 'title', '10%'); $tbl_2->addColumn($this->lng->txt('status'), 'status', '30%'); $tbl_2->addColumn($this->lng->txt('paya_pay_method'), 'pay_method', '60%'); $tbl_2->setSelectAllCheckbox('object_id'); $tbl_2->addMultiCommand('assignObjects', $this->lng->txt('add')); $tbl_2->setData($f_result_unassigned); $this->tpl->setVariable('TABLE_2', $tbl_2->getHTML()); } return true; }