/** * vraci instanci formu pro hlasovani * @return LBoxForm */ protected function getForm() { try { $control = new LBoxFormControlFillHidden("ref_option", "", $this->getID()); $control->addValidator(new LBoxFormValidatorInquiryOptionValidOnlyLastInquiry()); $form = new LBoxForm("inquiry-option-" . $this->getID(), "post", "", "hlasovat"); $form->setTemplateFileName("lbox_form_inquiries_votefor.html"); $form->addControl($control); $form->addProcessor(new LBoxFormProcessorInquiryVoteFor()); $form->setAntiSpam(true); return $form; } catch (Exception $e) { throw $e; } }
/** * vraci form pro delete clanku * @return LBoxForm * @throws LBoxException */ protected function getFormXTDelete() { try { if (!constant('CLI')) { if (!LBoxXTProject::isLoggedAdmin()) { return ""; } } if ($this->formDelete instanceof LBoxForm) { return $this->formDelete; } $instanceType = get_class($this->instance); $idColName = eval("return {$instanceType}::\$idColName;"); $id = $this->instance->getParamDirect($idColName); $controlID = new LBoxFormControlFillHidden("id", "", $id); foreach ($this->formDeleteValidators as $validatorDeleteID) { $controlID->addValidator($validatorDeleteID); } if (strlen($this->formDeleteTemplateControlID) > 0) { $controlID->setTemplateFileName($this->formDeleteTemplateControlID); } $controlType = new LBoxFormControlFillHidden("type", "", $instanceType); $form = new LBoxForm("record_xt_delete_{$id}", "post", "", "delete"); $form->setTemplateFileName("lbox_form_xt_btn_delete.html"); $form->addControl($controlID); $form->addControl($controlType); $form->addProcessor(new ProcessorRecordDelete()); $form->item_name = strlen($this->instance->name) > 0 ? $this->instance->name : $this->instance->{$idColName}; return $this->formDelete = $form; } catch (Exception $e) { throw $e; } }