示例#1
0
 function getSourceCodeBackend($id, $preview = false, $flagBackend = true)
 {
     global $objDatabase, $_ARRAYLANG;
     $arrFields = EgovLibrary::getFormFields($id);
     $strCalendarSource = '';
     if (EgovLibrary::GetProduktValue('product_per_day', $id) == 'yes') {
         $strCalendarSource = $this->getCalendarSourceBackend($id, $flagBackend);
     }
     $FormActionTarget = ($preview ? '../' : '') . ($flagBackend ? "index.php?cmd=Egov&act=detail&id={$id}" : "index.php?section=Egov&id={$id}");
     $sourcecode = $this->_getJsSourceCodeBackend($arrFields, $preview, $flagBackend) . "\n" . "<div id=\"alertbox\" style=\"overflow: auto; display: none;\">" . $_ARRAYLANG['TXT_EGOV_CHECK_YOUR_INPUT'] . "\n" . "</div><br />\n" . "<!-- BEGIN contact_form -->\n" . "<form action=\"{$FormActionTarget}\" " . "method=\"post\" enctype=\"multipart/form-data\" " . "onsubmit=\"return checkAllFields();\" id=\"contactForm\">\n" . "<input type=\"hidden\" name=\"send\" value=\"1\" />\n" . '<table summary="" border="0" cellpadding="3" cellspacing="0" class="adminlist" width="100%">' . "\n" . '  <tbody style="vertical-align:top;">' . "\n" . '    <tr>' . "\n" . '      <th colspan="2">' . $this->GetProduktValue('product_name', $id) . ' (ID ' . $id . ')</th>' . "\n" . '    </tr>' . "\n" . '    <tr>' . "\n" . "<td>&nbsp;</td><td>{$strCalendarSource}</td></tr>\n";
     $i = 1;
     foreach ($arrFields as $fieldId => $arrField) {
         $feldbezeichnung = $arrField['name'];
         if ($feldbezeichnung == "AGB") {
             if ($flagBackend) {
                 continue;
             }
             $feldbezeichnung = '<a href="index.php?section=Agb" target="_blank">AGB akzeptieren</a>';
         }
         $sourcecode .= "<tr" . ' class="row' . (++$i % 2 + 1) . '"' . ">\n<td style=\"width:180px;\">" . ($arrField['type'] != 'hidden' && $arrField['type'] != 'label' ? $feldbezeichnung : '&nbsp;') . ($arrField['is_required'] ? ' <span style="color: red;">*</span>' : '') . "</td>\n<td>";
         switch ($arrField['type']) {
             case 'text':
                 $sourcecode .= "<input style=\"width:300px;\" type=\"text\" " . "name=\"contactFormField_{$fieldId}\" " . "value=\"" . $arrField['attributes'] . "\" />\n";
                 break;
             case 'label':
                 $sourcecode .= $arrField['attributes'] . "\n";
                 break;
             case 'checkbox':
                 $sourcecode .= "<input type=\"checkbox\" " . "name=\"contactFormField_{$fieldId}\" " . "value=\"1\"" . ($arrField['attributes'] == '1' ? ' checked="checked"' : '') . " />\n";
                 break;
             case 'checkboxGroup':
                 $options = explode(',', $arrField['attributes']);
                 $nr = 0;
                 foreach ($options as $option) {
                     $sourcecode .= "<input type=\"checkbox\" " . "name=\"contactFormField_{$fieldId}[]\" " . "id=\"contactFormField_{$nr}_{$fieldId}\" " . "value=\"{$option}\" />" . "<label for=\"contactFormField_{$nr}_{$fieldId}\">{$option}</label>\n";
                     ++$nr;
                 }
                 break;
             case 'file':
                 $sourcecode .= "<input style=\"width:300px;\" type=\"file\" " . "name=\"contactFormField_{$fieldId}\" />\n";
                 break;
             case 'hidden':
                 $sourcecode .= "<input type=\"hidden\" " . "name=\"contactFormField_{$fieldId}\" " . "value=\"" . $arrField['attributes'] . "\" />\n";
                 break;
             case 'password':
                 $sourcecode .= "<input style=\"width:300px;\" type=\"password\" " . "name=\"contactFormField_{$fieldId}\" value=\"\" />\n";
                 break;
             case 'radio':
                 $options = explode(',', $arrField['attributes']);
                 $nr = 0;
                 foreach ($options as $option) {
                     $sourcecode .= "<input type=\"radio\" name=\"contactFormField_{$fieldId}\" id=\"contactFormField_{$nr}_{$fieldId}\" value=\"{$option}\" />" . "<label for=\"contactFormField_{$nr}_{$fieldId}\">{$option}</label>\n";
                     ++$nr;
                 }
                 break;
             case 'select':
                 $options = explode(',', $arrField['attributes']);
                 $nr = 0;
                 $sourcecode .= "<select style=\"width:300px;\" name=\"contactFormField_{$fieldId}\">\n";
                 foreach ($options as $option) {
                     $sourcecode .= "<option>{$option}</option>\n";
                 }
                 $sourcecode .= "</select>\n";
                 break;
             case 'textarea':
                 $sourcecode .= "<textarea style=\"width:300px; height:100px;\" name=\"contactFormField_{$fieldId}\"></textarea>\n";
                 break;
         }
         $sourcecode .= "</td>\n</tr>\n";
     }
     if (count($arrFields) > 0) {
         $sourcecode .= "  </tbody>\n" . "</table>\n" . "<br /><br /><input type=\"reset\" value=\"" . $_ARRAYLANG['TXT_EGOV_DELETE'] . "\" />\n" . "<input type=\"submit\" name=\"submitContactForm\" value=\"" . $_ARRAYLANG['TXT_EGOV_SUBMIT'] . "\" />\n";
     }
     $sourcecode .= "</form>\n" . "<!-- END contact_form -->\n";
     return $sourcecode;
 }
示例#2
0
 /**
  * Save any order received from the form page.
  * @return  string              The status message if an error occurred,
  *                              the empty string otherwise
  */
 function _saveOrder()
 {
     global $objDatabase, $_ARRAYLANG;
     $product_id = intval($_REQUEST['id']);
     $datum_db = date('Y-m-d H:i:s');
     $ip_adress = $_SERVER['REMOTE_ADDR'];
     $arrFields = EgovLibrary::getFormFields($product_id);
     $FormValue = '';
     foreach ($arrFields as $fieldId => $arrField) {
         $FormValue .= $arrField['name'] . '::' . contrexx_addslashes(strip_tags($_REQUEST['contactFormField_' . $fieldId])) . ';;';
     }
     $quantity = 0;
     if (EgovLibrary::GetProduktValue('product_per_day', $product_id) == 'yes') {
         $quantity = intval($_REQUEST['contactFormField_Quantity']);
         $FormValue = EgovLibrary::GetSettings('set_calendar_date_label') . '::' . contrexx_addslashes(strip_tags($_REQUEST['contactFormField_1000'])) . ';;' . $FormValue;
         $FormValue = $_ARRAYLANG['TXT_EGOV_QUANTITY'] . '::' . $quantity . ';;' . $FormValue;
     }
     $objDatabase->Execute("\n            INSERT INTO " . DBPREFIX . "module_egov_orders (\n                order_date, order_ip, order_product, order_values\n            ) VALUES (\n                '{$datum_db}', '{$ip_adress}', '{$product_id}', '{$FormValue}'\n            )\n        ");
     $order_id = $objDatabase->Insert_ID();
     $calD = $calM = $calY = NULL;
     if (EgovLibrary::GetProduktValue('product_per_day', $product_id) == 'yes') {
         list($calD, $calM, $calY) = explode('[.]', $_REQUEST['contactFormField_1000']);
         for ($x = 0; $x < $quantity; ++$x) {
             $objDatabase->Execute("\n                    INSERT INTO " . DBPREFIX . "module_egov_product_calendar (\n                        calendar_product, calendar_order, calendar_day,\n                        calendar_month, calendar_year\n                    ) VALUES (\n                        '{$product_id}', '{$order_id}', '{$calD}',\n                        '{$calM}', '{$calY}'\n                    )\n                ");
         }
     }
     // update the order right away
     if (EgovManager::GetOrderValue('order_state', $order_id) == 0) {
         // If any non-empty string is returned, an error occurred.
         $ReturnValue = $this->updateOrder($order_id);
         if (!empty($ReturnValue)) {
             $this->_strErrMessage = $_ARRAYLANG['TXT_EGOV_ERROR_ADDING_RESERVATION'];
             return false;
         }
     }
     $this->_strOkMessage = $_ARRAYLANG['TXT_EGOV_RESERVATION_ADDED_SUCCESSFULLY'];
     return true;
 }