public function generateCodes($view = "choice")
 {
     $this->coupon_obj->setId($_GET['coupon_id']);
     $this->ctrl->setParameter($this, 'coupon_id', $_GET['coupon_id']);
     $this->__showButtons();
     $this->coupon_obj->getCouponById(ilUtil::stripSlashes($_GET['coupon_id']));
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $oForm_1 = new ilPropertyFormGUI();
     $oForm_1->setId('save_frm');
     $oForm_1->setFormAction($this->ctrl->getFormAction($this), 'saveCodeForm');
     $oForm_1->setTitle($this->lng->txt("paya_coupons_coupon") . " " . $this->coupon_obj->getTitle() . ": " . $this->lng->txt('paya_coupons_code_generation'));
     if ($view == "choice") {
         $oTypeRadio = new ilRadioGroupInputGUI($this->lng->txt('paya_coupons_generate_codes'), 'generate_type');
         $radio_option = new ilRadioOption($this->lng->txt('paya_coupons_type_auto'), 'auto');
         $oTypeRadio->addOption($radio_option);
         $radio_option = new ilRadioOption($this->lng->txt('paya_coupons_type_self'), 'self');
         $oTypeRadio->addOption($radio_option);
         $oTypeRadio->setValue(isset($_POST["generate_type"]) ? $_POST["generate_type"] : "auto");
         $oTypeRadio->setPostVar('generate_type');
         $oForm_1->addItem($oTypeRadio);
         $oNumCodes = new ilNumberInputGUI($this->lng->txt("paya_coupons_number_of_codes"), 'generate_number');
         $oNumCodes->setSize(5);
         $oNumCodes->setValue($_POST['generate_number']);
         $oNumCodes->setRequired(true);
         $oForm_1->addItem($oNumCodes);
         $oLength = new ilNumberInputGUI($this->lng->txt("paya_coupons_code_length"), 'generate_length');
         $oLength->setSize(5);
         $oLength->setValue($_POST['generate_length']);
         $oLength->setRequired(true);
         $oLength->setInfo($this->lng->txt('paya_coupons_type_self'));
         $oForm_1->addItem($oLength);
         $oForm_1->addCommandButton('saveCodeForm', $this->lng->txt('save'));
         $this->tpl->setVariable('FORM', $oForm_1->getHTML());
         $oForm_2 = new ilPropertyformGUI();
         $oForm_2->setId('import_frm');
         $oForm_2->setFormAction($this->ctrl->getFormAction($this), 'showCodeImport');
         $oForm_2->addCommandButton('showCodeImport', $this->lng->txt('import'));
         $this->tpl->setVariable('FORM_2', $oForm_2->getHTML());
     } else {
         if ($view == "input") {
             if (is_numeric($_POST['generate_number']) && $_POST['generate_number'] > 0) {
                 for ($i = 0; $i < $_POST['generate_number']; $i++) {
                     $index = $i + 1;
                     $oLoopCode = new ilTextInputGUI('#' . $index, 'codes[' . $i . ']');
                     $oForm_1->addItem($oLoopCode);
                 }
                 $oForm_1->addCommandButton('saveCodeForm', $this->lng->txt('save'));
             }
             $this->tpl->setVariable('FORM', $oForm_1->getHTML());
             $oLoopCode = new ilTextInputGUI();
         }
     }
     return true;
 }