_html = ''; $this->_object = NULL; $this->_css = ''; $this->_script = ''; $this->_js = ''; $this->_messages = ''; $this->_selectCheck = false; $this->_dateTime = false; } public function renderForm($display = true, $action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){ $this->generateForms(); $this->_script .= ''; if ($this->_selectCheck) $this->includeSelectCheck(); if ($this->_dateTime) $this->includeDateTime(); $this->addFilters(); $form = '' . $this->_script . ($this->_messages ? implode("\n", $this->_messages) : '') . $this->_html . $this->_js; // display user js after render form if ($display) echo $form; return $form; } public function generateForms($action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){ if (!$this->_forms || empty($this->_forms)) return; if (!$method) $method = 'POST'; if (!$enctype) $enctype = 'multipart/form-data'; foreach ($this->_forms as $form) { $action = isset($form['action']) ? $form['action'] : $action; $method = isset($form['method']) ? $form['method'] : $method; $enctype = isset($form['enctype']) ? $form['enctype'] : $enctype; $css = isset($form['style']) ? $form['style'] : ''; // OPEN FORM $this->_html .= '
'; } } public function addJs($js){ $this->_js .= $js; } public function addCss($css){ $this->_css .= $css; } public function addInput($input){ if (!isset($input['type'])) return false; $html = (isset($input['html']) && $input['html']) ? $input['html'] : NULL; switch ($input['type']) { case 'text': $this->inputText($input); break; case 'select': $this->inputSelect($input); break; case 'select-styled': $this->inputSelectStyled($input); break; case 'bool': case 'radio': $this->inputBool($input); break; case 'checkbox': $this->inputCheckbox($input); break; case 'date': $this->inputDate($input); break; case 'textarea': $this->inputRte($input); break; case 'checkList': case 'selectCheck': $this->selectCheck($input); break; case 'file': $this->inputFile($input); break; case 'hidden': $this->inputHidden($input); break; case 'html': $this->_html .= $input['value']; break; default: return false; } } public function addAction($action){ if (!isset($action['type']) || !isset($action['name'])) return false; $css = (isset($action['css']) && $action['css']) ? $action['css'] : NULL; switch ($action['type']) { case 'button': $this->inputButton($action); break; case 'submit': $this->inputSubmit($action); break; default: return false; } } public function includeSelectCheck(){ $this->_css .= ' a.multiSelect { background: #FFF url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown.gif) right -1px no-repeat; border: 1px solid #e0d0b1; padding-right: 20px; position: relative; cursor: default; text-decoration: none; color: black; display: -moz-inline-stack; display: inline-block; vertical-align: top; margin-top: 2px; } a.multiSelect:link, a.multiSelect:visited, a.multiSelect:hover, a.multiSelect:active { color: black; text-decoration: none; } a.multiSelect span { margin: 1px 0px 1px 3px; overflow: hidden; display: -moz-inline-stack; display: inline-block; white-space: nowrap; font-size: 12px; } a.multiSelect.hover { background-image: url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown_hover.gif); } a.multiSelect.active, a.multiSelect.focus { border: inset 1px #000000; } a.multiSelect.active { background-image: url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown_active.gif); } .multiSelectOptions { margin-top: -1px; overflow-y: auto; overflow-x: hidden; border: solid 1px #b2b2b2; background: #ffffff; } .multiSelectOptions label { padding: 0px 2px; display: block; white-space: nowrap; float: none; text-align: left; width: auto; } .multiSelectOptions label.optGroup { font-weight: bold; } .multiSelectOptions .optGroupContainer label { padding-left: 10px; font-size: 12px; color: #333333; padding: 2px 0px; } .multiSelectOptions.optGroupHasCheckboxes .optGroupContainer label { padding-left: 18px; } .multiSelectOptions input { vertical-align: middle; margin-right: 5px; } .multiSelectOptions label.checked { background-color: #dce5f8; } .multiSelectOptions label.optGroup { color: #000000; font-size: 12px; margin-bottom: 2px; } .multiSelectOptions label.selectAll { border-bottom: dotted 1px #cccccc; font-size: 12px; color: #333333; padding-top: 2px; margin: 0px 0px 6px; } .multiSelectOptions label.hover { background-color: #3399ff; color: #ffffff; }'; $this->_script .= ' '; } public function includeDateTime(){ $this->_css .= ' .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } .ui-timepicker-div dl { text-align: left; } .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } .ui-timepicker-div td { font-size: 90%; } .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }'; $this->_script .= ' '; $this->_js .= ' '; } public function addFilters(){ $this->_script .= ' '; } public function openFieldset($legend, $id = NULL, $img_src='../img/admin/edit.gif', $css = false){ $this->_html .= ''; } public function inputText($p = array()){ if (isset($p['lang']) && $p['lang'] === true) return $this->inputTextL($p); $default_value = (isset($p['default']) ? $p['default'] : ''); $disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : ''); $this->_html .= ''.$p['hint'].'
' : '') . ' ' . ((isset($p['help']) && $p['help']) ? ''.$p['help'].'
' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ''.$p['hint'].'
' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ''.$p['hint'].'
' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ''.$p['hint'].'
' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . ''.$p['hint'].'
' : '') . ' ' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '