/** * @var Store */ protected $store = null; /** * @var Evaluate */ protected $evaluate = null; /** * @var string */ private $formId = null; /** * @var Sip */ private $sip = null; /** * AbstractBuildForm constructor. * * @param array $formSpec * @param array $feSpecAction * @param array $feSpecNative */ public function __construct(array $formSpec, array $feSpecAction, array $feSpecNative) { $this->formSpec = $formSpec; $this->feSpecAction = $feSpecAction; $this->feSpecNative = $feSpecNative; $this->store = Store::getInstance(); $this->db = new Database(); $this->evaluate = new Evaluate($this->store, $this->db); $this->showDebugInfoFlag = Support::findInSet(SYSTEM_SHOW_DEBUG_INFO_YES, $this->store->getVar(SYSTEM_SHOW_DEBUG_INFO, STORE_SYSTEM)); $this->sip = $this->store->getSipInstance(); // render mode specific $this->fillWrap(); $this->buildElementFunctionName = [ 'checkbox' => 'Checkbox', 'date' => 'DateTime', 'datetime' => 'DateTime', 'dateJQW' => 'DateJQW', 'datetimeJQW' => 'DateJQW', 'email' => 'Input', 'gridJQW' => 'GridJQW', FE_TYPE_EXTRA => 'Extra', 'text' => 'Input', 'editor' => 'Editor', 'time' => 'DateTime', 'note' => 'Note', 'password' => 'Input', 'radio' => 'Radio', 'select' => 'Select', 'subrecord' => 'Subrecord', 'upload' => 'File', 'fieldset' => 'Fieldset', 'pill' => 'Pill', 'templateGroup' => 'TemplateGroup' ]; $this->buildRowName = [ 'checkbox' => 'Native', 'date' => 'Native', 'datetime' => 'Native', 'dateJQW' => 'Native', 'datetimeJQW' => 'Native', 'email' => 'Native', 'gridJQW' => 'Native', FE_TYPE_EXTRA => 'Native', 'text' => 'Native', 'editor' => 'Native', 'time' => 'Native', 'note' => 'Native', 'password' => 'Native', 'radio' => 'Native', 'select' => 'Native', 'subrecord' => 'Subrecord', 'upload' => 'Native', 'fieldset' => 'Fieldset', 'pill' => 'Pill', 'templateGroup' => 'TemplateGroup' ]; $this->symbol[SYMBOL_EDIT] = ""; $this->symbol[SYMBOL_NEW] = ""; $this->symbol[SYMBOL_DELETE] = ""; $this->inputCheckPattern = Sanitize::inputCheckPatternArray(); } abstract public function fillWrap(); /** * Builds complete 'form'. Depending of form specification, the layout will be 'plain' / 'table' / 'bootstrap'. * * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE * @return string|array $mode=LOAD_FORM: The whole form as HTML, $mode=FORM_UPDATE: array of all formElement.dynamicUpdate-yes values/states * @throws CodeException * @throws DbException * @throws \qfq\UserFormException */ public function process($mode, $htmlElementNameIdZero = false) { $htmlHead = ''; $htmlTail = ''; $htmlT3vars = ''; $htmlSubrecords = ''; $htmlElements = ''; $json = array(); $modeCollectFe = FLAG_DYNAMIC_UPDATE; $storeUse = STORE_USE_DEFAULT; if ($mode === FORM_SAVE) { $modeCollectFe = FLAG_ALL; $storeUse = STORE_RECORD . STORE_TABLE_DEFAULT; } //