/** * Returns the HTML code of the form. * @return string $return_value HTML code of the form */ public function returnForm() { $error = false; /** @var HTML_QuickForm_element $element */ foreach ($this->_elements as $element) { if (!is_null(parent::getElementError($element->getName()))) { $error = true; break; } } $returnValue = ''; $js = null; if ($error) { $returnValue = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning'); } $returnValue .= $js; $returnValue .= parent::toHtml(); // Add div-element which is to hold the progress bar if (isset($this->with_progress_bar) && $this->with_progress_bar) { $returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>'; } return $returnValue; }
/** * Returns the HTML code of the form. * If an element in the form didn't validate, an error message is showed * asking the user to complete the form. * * @return string $return_value HTML code of the form * * @author Patrick Cool <*****@*****.**>, Ghent University, august 2006 */ public function return_form() { $error = false; $addDateLibraries = false; $dateElementTypes = array('date_range_picker', 'date_time_picker', 'date_picker', 'datepicker', 'datetimepicker'); /** @var HTML_QuickForm_element $element */ foreach ($this->_elements as $element) { if (in_array($element->getType(), $dateElementTypes)) { $addDateLibraries = true; } if (!is_null(parent::getElementError($element->getName()))) { $error = true; break; } } $return_value = ''; $js = null; if ($addDateLibraries) { /* $js = api_get_js('jquery-ui/jquery-ui-i18n.min.js'); $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.js" type="text/javascript"></script>'; $js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'datetimepicker/jquery-ui-timepicker-addon.css" rel="stylesheet" type="text/css" />'; $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/moment.min.js" type="text/javascript"></script>'; $js .= '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker.js" type="text/javascript"></script>'; $js .= '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'daterange/daterangepicker-bs2.css" rel="stylesheet" type="text/css" />'; $isocode = api_get_language_isocode(); if ($isocode != 'en') { $js .= '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/datetimepicker/i18n/jquery-ui-timepicker-'.$isocode.'.js" type="text/javascript"></script>'; $js .= '<script> $(function(){ $.datepicker.setDefaults($.datepicker.regional["'.$isocode.'"]); moment.lang("'.$isocode.'"); }); </script>'; }*/ } if ($error) { $return_value = Display::return_message(get_lang('FormHasErrorsPleaseComplete'), 'warning'); } $return_value .= $js; $return_value .= parent::toHtml(); // Add div-element which is to hold the progress bar if (isset($this->with_progress_bar) && $this->with_progress_bar) { $return_value .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>'; } return $return_value; }
$params['MESSAGE'] = '<h2>Product could not be entered into the database.</h2>'; } } else { $params['TYPE'] = 'warning'; $params['MESSAGE'] = '<h2>This product already exits.</h2>'; } // done! } else { //$this->content .= $this->getTabs(array('details', 'description', 'price', 'attributes', 'image')); $session = Utility::encodeString(session_id()); $this->addScriptDeclaration("UthandoAdmin.sid = ['" . $session[0] . "','" . $session[1] . "'];"); $this->loadJavaScript(array('/editors/tiny_mce/tiny_mce_gzip.js', '/uthando-js/uthando/admin/tinyMCEGz.js')); $this->addComponentJS('products'); $this->addComponentCSS(array('FileManager', 'Additions')); foreach ($errors as $value) { $err = $form->getElementError($value); if ($err) { $this->registry->Warning($err); } } $renderer = new UthandoForm(TEMPLATES . $template); $renderer->setFormTemplate('form'); $renderer->setHeaderTemplate('header'); $renderer->setElementTemplate('element'); $form->accept($renderer); // output the form $this->content .= $renderer->toHtml(); } } else { $params['TYPE'] = 'info'; if (!$tax_codes) {
/** * Returns the HTML code of the form. * @return string $return_value HTML code of the form */ public function returnForm() { $returnValue = ''; /** @var HTML_QuickForm_element $element */ foreach ($this->_elements as $element) { $elementError = parent::getElementError($element->getName()); if (!is_null($elementError)) { $returnValue .= Display::return_message($elementError, 'warning') . '<br />'; break; } } $returnValue .= parent::toHtml(); // Add div-element which is to hold the progress bar if (isset($this->with_progress_bar) && $this->with_progress_bar) { $returnValue .= '<div id="dynamic_div" style="display:block; margin-left:40%; margin-top:10px; height:50px;"></div>'; } return $returnValue; }