/**
  * 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;
     }
 }
 /**
  * pridana validace natvrdo - bez js neni mozne, aby form prosel
  */
 public function process()
 {
     try {
         if ($this->getValue() != $this->default) {
             $this->exceptionsValidations[LBoxExceptionFormValidator::CODE_FORM_VALIDATION_SPAMDEFENSEJS_NOT_PASS] = new LBoxExceptionFormValidator(LBoxExceptionFormValidator::MSG_FORM_VALIDATION_SPAMDEFENSEJS_NOT_PASS, LBoxExceptionFormValidator::CODE_FORM_VALIDATION_SPAMDEFENSEJS_NOT_PASS);
         }
         return parent::process();
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #3
0
 /**
  * vraci control pro spamdefense
  * @return LBoxFormControlSpamDefense
  */
 protected function getSpamDefenseControl()
 {
     try {
         if ($this->spamDefenseControl instanceof LBoxFormControl) {
             return $this->spamDefenseControl;
         }
         $this->spamDefenseControl = new LBoxFormControlSpamDefense();
         $this->spamDefenseControl->setForm($this);
         return $this->spamDefenseControl;
     } catch (Exception $e) {
         throw $e;
     }
 }
Example #4
0
 /**
  * getter na editacni form pro AJAX GUI
  * @return LBoxForm
  */
 public function getForm()
 {
     try {
         if (!$this->isActive()) {
             return NULL;
         }
         if ($this->form instanceof LBoxForm) {
             return $this->form;
         }
         $type = get_class($this);
         $nodeType = eval("return {$type}::TYPE;");
         $nodeControlClassName = eval("return {$type}::XT_FORM_CTRL_CLASSNAME;");
         $nodeControlTemplate = eval("return {$type}::XT_FORM_CTRL_TEMPLATE_FILENAME;");
         $seq = $this->seq;
         $callerID = $this->caller->id;
         $formID = "metanode-{$callerID}-{$seq}-{$nodeType}";
         $ctrlType = new LBoxFormControlFillHidden("type", "", $nodeType);
         $ctrlType->setTemplateFileName("metanode_hidden.html");
         $ctrlSeq = new LBoxFormControlFillHidden("seq", "", $seq);
         $ctrlSeq->setTemplateFileName("metanode_hidden.html");
         $ctrlCallerID = new LBoxFormControlFillHidden("caller_id", "", $callerID);
         $ctrlCallerID->setTemplateFileName("metanode_hidden.html");
         $ctrlCallerType = new LBoxFormControlFillHidden("caller_type", "", $this->caller instanceof LBoxPage || $this->caller instanceof PageList ? "page" : "component");
         $ctrlCallerType->setTemplateFileName("metanode_hidden.html");
         $ctrlLng = new LBoxFormControlFillHidden("lng", "", LBoxFront::getDisplayLanguage());
         $ctrlLng->setTemplateFileName("metanode_hidden.html");
         $ctrlContent = new $nodeControlClassName("content", "", $this->getContent());
         $ctrlContent->setTemplateFileName($nodeControlTemplate);
         // vlozime ho do dialog boxu pro JS GUI
         $ctrlDialog = new LBoxFormControlMultiple("dialog", "");
         $ctrlDialog->setTemplateFileName("metanode_dialog.html");
         $ctrlDialog->addControl($ctrlContent);
         $this->form = new LBoxForm($formID, "post", "", "editovat");
         $this->form->setTemplateFileName("metanode_xt_toedit.html");
         $this->form->action = LBoxConfigSystem::getInstance()->getParamByPath("metanodes/api/url");
         $this->form->addControl($ctrlDialog);
         $this->form->addProcessor(new ProcessorMetanodeXTToEdit());
         $this->form->className = "metanode";
         $this->form->addControl($ctrlType);
         $this->form->addControl($ctrlSeq);
         $this->form->addControl($ctrlCallerID);
         $this->form->addControl($ctrlCallerType);
         $this->form->addControl($ctrlLng);
         return $this->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;
     }
 }