Пример #1
0
 function _product_edit()
 {
     global $_ARRAYLANG;
     $this->objTemplate->loadTemplateFile('module_gov_product_edit.html');
     if (intval($_REQUEST['id']) == 0) {
         $this->_pageTitle = $_ARRAYLANG['TXT_EGOV_ADD_NEW_PRODUCT'];
     } else {
         $this->_pageTitle = $_ARRAYLANG['TXT_EGOV_EDIT_PRODUCT'];
     }
     $product_id = intval($_REQUEST['id']);
     $jsSubmitFunction = 'createContentSite()';
     if ($product_id) {
         $jsSubmitFunction = 'updateContentSite()';
     }
     $TargetEmail = EgovLibrary::GetProduktValue('product_target_email', $product_id);
     if ($TargetEmail == '') {
         $TargetEmail = EgovLibrary::GetSettings('set_recipient_email');
     }
     $StatusChecked = 'checked="checked"';
     if ($product_id != 0) {
         if (EgovLibrary::GetProduktValue('product_status', $product_id) != 1) {
             $StatusChecked = '';
         }
     }
     $AutoJaChecked = '';
     $AutoNeinChecked = 'checked="checked"';
     if (EgovLibrary::GetProduktValue('product_autostatus', $product_id) == 1) {
         $AutoJaChecked = 'checked="checked"';
         $AutoNeinChecked = '';
     }
     $electro_checked = '';
     if (EgovLibrary::GetProduktValue('product_electro', $product_id) == 1) {
         $electro_checked = 'checked="checked"';
     }
     $ProductSenderName = EgovLibrary::GetProduktValue('product_sender_name', $product_id);
     if ($ProductSenderName == '') {
         $ProductSenderName = EgovLibrary::GetSettings('set_sender_name');
     }
     $ProductSenderEmail = EgovLibrary::GetProduktValue('product_sender_email', $product_id);
     if ($ProductSenderEmail == '') {
         $ProductSenderEmail = EgovLibrary::GetSettings('set_sender_email');
     }
     $ProductTargetSubject = EgovLibrary::GetProduktValue('product_target_subject', $product_id);
     if ($ProductTargetSubject == '') {
         $ProductTargetSubject = EgovLibrary::GetSettings('set_state_subject');
     }
     $ProductTargetBody = EgovLibrary::GetProduktValue('product_target_body', $product_id);
     if ($ProductTargetBody == '') {
         $ProductTargetBody = EgovLibrary::GetSettings('set_state_email');
     }
     $PaypayCheckedYes = EgovLibrary::GetProduktValue('product_paypal', $product_id) == 1 ? 'checked="checked"' : '';
     $PaypayCheckedNo = $PaypayCheckedYes == '' ? 'checked="checked"' : '';
     $currency = EgovLibrary::GetProduktValue('product_paypal_currency', $product_id);
     $paypalEmail = EgovLibrary::GetProduktValue('product_paypal_sandbox', $product_id);
     if ($paypalEmail == '') {
         $paypalEmail = EgovLibrary::GetSettings('set_paypal_email');
     }
     if ($currency == '') {
         $currency = EgovLibrary::GetSettings('set_paypal_currency');
     }
     $currencyMenuoptions = EgovManager::getCurrencyMenuoptions($currency);
     $yellowpayCheckedYes = EgovLibrary::GetProduktValue('yellowpay', $product_id) ? 'checked="checked"' : '';
     $yellowpayCheckedNo = $yellowpayCheckedYes == '' ? 'checked="checked"' : '';
     $this->objTemplate->setGlobalVariable($_ARRAYLANG);
     $this->objTemplate->setVariable(array('TXT_ACTION_TITLE' => $this->_pageTitle, 'PRODUCT_FORM_DESC' => new \Cx\Core\Wysiwyg\Wysiwyg('contactFormDesc', EgovLibrary::GetProduktValue("product_desc", $product_id), 'full'), 'PRODUCT_FORM_QUANTITY' => EgovLibrary::GetProduktValue("product_quantity", $product_id), 'PRODUCT_FORM_NAME' => EgovLibrary::GetProduktValue('product_name', $product_id), 'PRODUCT_FORM_EMAIL' => $TargetEmail, 'PRODUCT_FORM_TARGET_URL' => EgovLibrary::GetProduktValue("product_target_url", $product_id), 'PRODUCT_FORM_TARGET_MESSAGE' => new \Cx\Core\Wysiwyg\Wysiwyg('productFormTargetMessage', EgovLibrary::GetProduktValue("product_message", $product_id), 'full'), 'PRODUCT_FORM_PRICE' => EgovLibrary::GetProduktValue("product_price", $product_id), 'PRODUCT_ID' => $product_id, 'EGOV_JS_SUBMIT_FUNCTION' => $jsSubmitFunction, 'STATE_CHECKED' => $StatusChecked, 'AUTOSTATUS_CHECKED_YES' => $AutoJaChecked, 'AUTOSTATUS_CHECKED_NO' => $AutoNeinChecked, 'ELECTRO_CHECKED' => $electro_checked, 'PRODUCT_FORM_FILE' => EgovLibrary::GetProduktValue("product_file", $product_id), 'PRODUCT_SENDER_NAME' => $ProductSenderName, 'PRODUCT_SENDER_EMAIL' => $ProductSenderEmail, 'PRODUCT_TARGET_SUBJECT' => $ProductTargetSubject, 'PRODUCT_TARGET_BODY' => $ProductTargetBody, 'PAYPAL_YES' => $PaypayCheckedYes, 'PAYPAL_NO' => $PaypayCheckedNo, 'SANDBOX_EMAIL' => $paypalEmail, 'YELLOWPAY_CHECKED_YES' => $yellowpayCheckedYes, 'YELLOWPAY_CHECKED_NO' => $yellowpayCheckedNo, 'EGOV_CURRENCY_MENUOPTIONS' => $currencyMenuoptions, 'EGOV_PRODUCT_QUANTITY_LIMIT' => EgovLibrary::GetProduktValue('product_quantity_limit', $product_id), 'ALTERNATIVE_NAMES' => EgovLibrary::GetProduktValue('alternative_names', $product_id)));
     if (EgovLibrary::GetProduktValue('product_per_day', $product_id) == 'yes') {
         $this->objTemplate->setVariable('PER_DAY_CHECKED_YES', 'checked="checked"');
     } else {
         $this->objTemplate->setVariable('PER_DAY_CHECKED_NO', 'checked="checked"');
     }
     $lastFieldId = 0;
     if ($product_id != 0) {
         $arrFields = EgovLibrary::getFormFields($product_id);
     } else {
         $this->objTemplate->setVariable(array('EGOV_FORM_FIELD_NAME' => '', 'EGOV_FORM_FIELD_ID' => 1, 'EGOV_FORM_FIELD_TYPE_MENU' => $this->_getFormFieldTypesMenu('contactFormFieldType[1]', 'text', 'id="contactFormFieldType_1" ' . 'onchange="setFormFieldAttributeBox(this.getAttribute(\'id\'), this.value)"'), 'EGOV_FORM_FIELD_CHECK_MENU' => $this->_getFormFieldCheckTypesMenu('contactFormFieldCheckType[1]', 'contactFormFieldCheckType_1', 'text', 1), 'EGOV_FORM_FIELD_CHECK_BOX' => $this->_getFormFieldRequiredCheckBox('contactFormFieldRequired[1]', 'contactFormFieldRequired_1', 'text', false), 'EGOV_FORM_FIELD_ATTRIBUTES' => $this->_getFormFieldAttribute(1, 'text', '')));
         $this->objTemplate->parse('egov_form_field_list');
         $lastFieldId = 1;
     }
     if (isset($arrFields) && is_array($arrFields)) {
         foreach ($arrFields as $fieldId => $arrField) {
             $this->objTemplate->setVariable(array('EGOV_FORM_FIELD_NAME' => $arrField['name'], 'EGOV_FORM_FIELD_ID' => $fieldId, 'EGOV_FORM_FIELD_TYPE_MENU' => $this->_getFormFieldTypesMenu('contactFormFieldType[' . $fieldId . ']', $arrField['type'], 'id="contactFormFieldType_' . $fieldId . '" onchange="setFormFieldAttributeBox(this.getAttribute(\'id\'), this.value)"'), 'EGOV_FORM_FIELD_CHECK_MENU' => $this->_getFormFieldCheckTypesMenu('contactFormFieldCheckType[' . $fieldId . ']', 'contactFormFieldCheckType_' . $fieldId, $arrField['type'], $arrField['check_type']), 'EGOV_FORM_FIELD_CHECK_BOX' => $this->_getFormFieldRequiredCheckBox('contactFormFieldRequired[' . $fieldId . ']', 'contactFormFieldRequired_' . $fieldId, $arrField['type'], $arrField['is_required'] == 1 ? true : false), 'EGOV_FORM_FIELD_ATTRIBUTES' => $this->_getFormFieldAttribute($fieldId, $arrField['type'], $arrField['attributes'])));
             $this->objTemplate->parse('egov_form_field_list');
             $lastFieldId = $fieldId > $lastFieldId ? $fieldId : $lastFieldId;
         }
     }
     $this->objTemplate->setVariable(array('CONTACT_FORM_FIELD_NEXT_ID' => $lastFieldId + 1, 'CONTACT_FORM_FIELD_NEXT_TEXT_TPL' => $this->_getFormFieldAttribute($lastFieldId + 1, 'text', ''), 'CONTACT_FORM_FIELD_LABEL_TPL' => $this->_getFormFieldAttribute($lastFieldId + 1, 'label', ''), 'CONTACT_FORM_FIELD_CHECK_MENU_NEXT_TPL' => $this->_getFormFieldCheckTypesMenu('contactFormFieldCheckType[' . ($lastFieldId + 1) . ']', 'contactFormFieldCheckType_' . ($lastFieldId + 1), 'text', 1), 'CONTACT_FORM_FIELD_CHECK_MENU_TPL' => $this->_getFormFieldCheckTypesMenu('contactFormFieldCheckType[0]', 'contactFormFieldCheckType_0', 'text', 1), 'CONTACT_FORM_FIELD_CHECK_BOX_NEXT_TPL' => $this->_getFormFieldRequiredCheckBox('contactFormFieldRequired[' . ($lastFieldId + 1) . ']', 'contactFormFieldRequired_' . ($lastFieldId + 1), 'text', false), 'CONTACT_FORM_FIELD_CHECK_BOX_TPL' => $this->_getFormFieldRequiredCheckBox('contactFormFieldRequired[0]', 'contactFormFieldRequired_0', 'text', false), 'CONTACT_FORM_FIELD_TYPE_MENU_TPL' => $this->_getFormFieldTypesMenu('contactFormFieldType[' . ($lastFieldId + 1) . ']', key($this->_arrFormFieldTypes), 'id="contactFormFieldType_' . ($lastFieldId + 1) . '" onchange="setFormFieldAttributeBox(this.getAttribute(\'id\'), this.value)"'), 'CONTACT_FORM_FIELD_TEXT_TPL' => $this->_getFormFieldAttribute(0, 'text', ''), 'CONTACT_FORM_FIELD_CHECKBOX_TPL' => $this->_getFormFieldAttribute(0, 'checkbox', 0), 'CONTACT_FORM_FIELD_CHECKBOX_GROUP_TPL' => $this->_getFormFieldAttribute(0, 'checkboxGroup', ''), 'CONTACT_FORM_FIELD_HIDDEN_TPL' => $this->_getFormFieldAttribute(0, 'hidden', ''), 'CONTACT_FORM_FIELD_RADIO_TPL' => $this->_getFormFieldAttribute(0, 'radio', ''), 'CONTACT_FORM_FIELD_SELECT_TPL' => $this->_getFormFieldAttribute(0, 'select', ''), 'CONTACT_JS_SUBMIT_FUNCTION' => $jsSubmitFunction));
 }