示例#1
0
$template_id = rex_request('template_id', 'int');
$content = '';
$show_list = true;
if ($func == 'edit' || $func == 'add') {
    echo rex_view::info(rex_i18n::rawMsg('yform_email_info_text'));
    $form_data = [];
    $form_data[] = 'text|name|translate:yform_email_key';
    $form_data[] = 'validate|empty|name|Bitte key eintragen';
    $form_data[] = 'text|mail_from|translate:yform_email_from';
    $form_data[] = 'text|mail_from_name|translate:yform_email_from_name';
    $form_data[] = 'text|subject|translate:yform_email_subject';
    $form_data[] = 'textarea|body|translate:yform_email_body';
    $form_data[] = 'textarea|body_html|translate:yform_email_body_html';
    $form_data[] = 'be_medialist|attachments|translate:yform_email_attachments';
    $form_data[] = 'action|showtext|Vielen Dank|||1';
    $yform = rex_yform::factory();
    $yform->setObjectparams('form_action', 'index.php?page=yform/email/index&func=' . $func);
    $yform->setFormData(implode("\n", $form_data));
    if ($func == 'edit') {
        $yform->setObjectparams('submit_btn_label', rex_i18n::msg('yform_save'));
        $yform->setHiddenField('template_id', $template_id);
        $yform->setActionField('db', array($table, "id={$template_id}"));
        $yform->setObjectparams('main_id', $template_id);
        $yform->setObjectparams('main_table', $table);
        $yform->setObjectparams('main_where', "id={$template_id}");
        $yform->setObjectparams('getdata', true);
        $title = rex_i18n::msg('yform_email_update');
    } else {
        $yform->setObjectparams('submit_btn_label', rex_i18n::msg('yform_add'));
        $yform->setActionField('db', array($table));
        $title = rex_i18n::msg('yform_email_create');