예제 #1
0
/**
 * Creates form for creating applications
 *
 */
function cvtx_create_application_form($cvtx_application_prename, $cvtx_application_surname, $cvtx_application_photo, $cvtx_application_top, $cvtx_application_text, $cvtx_application_cv, $cvtx_application_mail, $cvtx_application_email_public, $cvtx_application_birthdate, $cvtx_application_gender, $cvtx_application_topics, $cvtx_application_kv, $cvtx_application_bv, $cvtx_application_website, $show_recaptcha = true)
{
    global $cvtx_allowed_image_types;
    $options = get_option('cvtx_options');
    ?>
    <form id="create_application_form" class="cvtx_application_form cvtx_form" method="post" action="" enctype="multipart/form-data">
        <?php 
    echo wp_nonce_field('cvtx_form_create_application', 'cvtx_form_create_application_submitted');
    ?>
        <!-- Name -->
        <fieldset class="fieldset">
            <div class="legend"><h3><?php 
    _e('Personal Data', 'cvtx');
    ?>
</h3></div>
            <div class="form-item">
                <label for="cvtx_application_prename"><?php 
    _e('First Name', 'cvtx');
    ?>
: <span class="form-required" title="'.__('This field is mandatory', 'cvtx').'">*</span></label>
                <input type="text" id="cvtx_application_prename" name="cvtx_application_prename" class="required" value="<?php 
    echo $cvtx_application_prename;
    ?>
" size="70" /><br/>
            </div>
            <div class="form-item">
                <label for="cvtx_application_surname"><?php 
    _e('Family Name', 'cvtx');
    ?>
: <span class="form-required" title="'__('This field is mandatory', 'cvtx').'">*</span></label>
                <input type="text" id="cvtx_application_surname" name="cvtx_application_surname" class="required" value="<?php 
    echo $cvtx_application_surname;
    ?>
" size="70" /><br/>
            </div>
            <div class="form-item">
                <label for="cvtx_application_photo"><?php 
    _e('Photo', 'cvtx');
    ?>
: </label>
                <input type="file" name="cvtx_application_photo" id="cvt_application_photo" />
                <p><small>
                    <?php 
    $max_image_size = $options['cvtx_max_image_size'];
    echo __('Allowed file endings: ', 'cvtx');
    $i = 0;
    foreach ($cvtx_allowed_image_types as $ending => $type) {
        echo '<span class="ending">' . $ending . '</span>';
        if ($i++ != count($cvtx_allowed_image_types) - 1) {
            echo ', ';
        }
    }
    echo '. ' . __('Max. file size: ', 'cvtx') . $max_image_size . ' KB';
    ?>
                </small></p>
            </div>
            <div class="form-item">
                <label for="cvtx_application_mail"><?php 
    _e('e-mail address', 'cvtx');
    ?>
: <span class="form-required" title="'.__('This field is mandatory', 'cvtx').'">*</span></label>
                <input type="text" id="cvtx_application_mail" name="cvtx_application_mail" class="required mail" value="<?php 
    echo $cvtx_application_mail;
    ?>
" size="70" /><br/>
            </div>
            <div class="form-item">
                <label for="cvtx_application_email_public"><?php 
    _e('E-Mail-Adresse veröffentlichen', 'cvtx');
    ?>
:</label>
                <input type="checkbox" id="cvtx_application_email_public" name="cvtx_application_email_public" <?php 
    echo $cvtx_application_email_public ? 'checked="checked"' : '';
    ?>
/><br/>
            </div>
            <div class="form-item">
                <label for="cvtx_application_birthdate"><?php 
    _e('Date of Birth', 'cvtx');
    ?>
: <span class="form-required" title="'.__('This field is mandatory', 'cvtx').'">*</span></label>
                <input type="text" id="cvtx_application_birthdate" name="cvtx_application_birthdate" class="required date" value="<?php 
    echo $cvtx_application_birthdate;
    ?>
" size="70" /><br/>
            </div>
            <?php 
    if (isset($options['cvtx_application_gender_check']) && $options['cvtx_application_gender_check']) {
        ?>
            <div class="form-item">
                <label for="cvtx_application_gender"><?php 
        _e('Gender', 'cvtx');
        ?>
:</label>
                <select name="cvtx_application_gender" id="cvtx_application_gender">
                    <option value="1" <?php 
        echo $cvtx_application_gender == 1 ? 'selected="selected"' : '';
        ?>
><?php 
        _e('female', 'cvtx');
        ?>
</option>
                    <option value="2" <?php 
        echo $cvtx_application_gender == 2 ? 'selected="selected"' : '';
        ?>
><?php 
        _e('male', 'cvtx');
        ?>
</option>
                    <option value="3" <?php 
        echo $cvtx_application_gender == 3 ? 'selected="selected"' : '';
        ?>
><?php 
        _e('not specified', 'cvtx');
        ?>
</option>
                </select>
            </div>
            <?php 
    }
    ?>
            <div class="form-item">
                <label for="cvtx_application_topics"><?php 
    _e('Themenschwerpunkte (bitte maximal 2 auswählen, um mehrere auszuwählen, STRG gedrückt halten)', 'cvtx');
    ?>
: </label>
                <select name="cvtx_application_topics[]" id="cvtx_application_topics" multiple="multiple">
                    <?php 
    $topics = $options['cvtx_application_topics'];
    for ($i = 0; $i < count($topics); $i++) {
        echo '<option value ="' . $i . '"' . (in_array($i, $cvtx_application_topics) ? ' selected="selected"' : '') . '>' . $topics[$i] . '</option>';
    }
    ?>
                </select>
            </div>
            <?php 
    if (!empty($options['cvtx_application_kvs_name']) && !empty($options['cvtx_application_kvs'])) {
        ?>
                <div class="form-item">
                    <label for="cvtx_application_kv"><?php 
        echo $options['cvtx_application_kvs_name'];
        ?>
: </label>
                    <select name="cvtx_application_kv" id="cvtx_application_kv">
                        <?php 
        $kvs = $options['cvtx_application_kvs'];
        for ($i = 0; $i < count($kvs); $i++) {
            echo '<option value ="' . $i . '"' . ($i == $cvtx_application_kv ? ' selected="selected"' : '') . '>' . $kvs[$i] . '</option>';
        }
        ?>
                    </select>
                </div>
            <?php 
    }
    ?>
            <?php 
    if (!empty($options['cvtx_application_bvs_name']) && !empty($options['cvtx_application_bvs'])) {
        ?>
                <div class="form-item">
                    <label for="cvtx_application_bv"><?php 
        echo $options['cvtx_application_bvs_name'];
        ?>
: </label>
                    <select name="cvtx_application_bv" id="cvtx_application_bv">
                        <?php 
        $bvs = $options['cvtx_application_bvs'];
        for ($i = 0; $i < count($bvs); $i++) {
            echo '<option value ="' . $i . '"' . ($i == $cvtx_application_bv ? ' selected="selected"' : '') . '>' . $bvs[$i] . '</option>';
        }
        ?>
                    </select>
                </div>
            <?php 
    }
    ?>
            <div class="form-item">
                <label for="cvtx_application_website"><?php 
    _e('Website', 'cvtx');
    ?>
:</label>
                <input type="text" id="cvtx_application_website" name="cvtx_application_website" value="<?php 
    echo $cvtx_application_website;
    ?>
" size="70" /><br/>
            </div>
        </fieldset>
        
        <fieldset class="fieldset">
            <div class="legend"><h3><?php 
    _e('Applying for', 'cvtx');
    ?>
</h3></div>
            <div class="form-item">
                <label for="cvtx_application_top"><?php 
    _e('Agenda point', 'cvtx');
    ?>
: <span class="form-required" title="<?php 
    _e('This field is mandatory', 'cvtx');
    ?>
">*</span></label>
                <?php 
    echo cvtx_dropdown_tops($cvtx_application_top, __('No agenda points enabled to applications.', 'cvtx'), '', true);
    ?>
<br />
            </div>
        </fieldset>
                
        <fieldset class="fieldset">
            <div class="legend"><h3><?php 
    _e('Application', 'cvtx');
    ?>
</h3></div>
            <div class="form-item">
                <label for="cvtx_application_text"><?php 
    _e('Application text', 'cvtx');
    ?>
: <span class="form-required" title="<?php 
    _e('This field is mandatory', 'cvtx');
    ?>
">*</span></label><p/>
                <?php 
    if (is_plugin_active('html-purified/html-purified.php')) {
        wp_editor($cvtx_application_text, 'cvtx_application_text', array('media_buttons' => false, 'textarea_name' => 'cvtx_application_text', 'tinymce' => cvtx_tinymce_settings(), 'quicktags' => false, 'teeny' => false));
    } else {
        ?>
                        <textarea id="cvtx_application_text" name="cvtx_application_text" size="100%" cols="60" rows="10" /><?php 
        echo $cvtx_application_text;
        ?>
</textarea><br/>
                <?php 
    }
    ?>
            </div>
            <div class="form-item">
                <label for="cvtx_application_cv"><?php 
    _e('Life career', 'cvtx');
    ?>
: <span class="form-required" title="<?php 
    _e('This field is mandatory', 'cvtx');
    ?>
">*</span></label><p/>
                <?php 
    if (is_plugin_active('html-purified/html-purified.php')) {
        wp_editor($cvtx_application_cv, 'cvtx_application_cv', array('media_buttons' => false, 'textarea_name' => 'cvtx_application_cv', 'tinymce' => cvtx_tinymce_settings(), 'quicktags' => false, 'teeny' => false));
    } else {
        ?>
                        <textarea id="cvtx_application_cv" name="cvtx_application_cv" size="100%" cols="60" rows="10" /><?php 
        echo $cvtx_application_cv;
        ?>
</textarea><br/>
                <?php 
    }
    ?>
            </div>
        </fieldset>
        
        <fieldset class="fieldset">
            <div class="legend"><h3><?php 
    _e('Submit', 'cvtx');
    ?>
</h3></div>
            <?php 
    // embed reCaptcha
    if (is_plugin_active('wp-recaptcha/wp-recaptcha.php') && $show_recaptcha) {
        $ropt = get_option('recaptcha_options');
        ?>
                <div class="form-item">
                    <?php 
        echo recaptcha_get_html($ropt['public_key']);
        ?>
                </div>
            <?php 
    }
    ?>
            <div class="form-item">
                <input type="submit" id="cvtx_application_submit" class="submit" value="<?php 
    _e('Submit application', 'cvtx');
    ?>
">
            </div><br/>
        </fieldset>
    </form>
    <?php 
}
예제 #2
0
function cvtx_application_meta()
{
    global $post;
    $top_id = get_post_meta($post->ID, 'cvtx_application_top', true);
    $event_id = get_post_meta($post->ID, 'cvtx_application_event', false);
    echo '<label for="cvtx_application_event_select">' . __('Event', 'cvtx') . ':</label><br />';
    echo cvtx_dropdown_events($event_id, $post->post_type, __('No events available.', 'cvtx'), true);
    echo '<br />';
    echo '<label for="cvtx_antrag_top_select">' . __('Agenda point', 'cvtx') . ':</label><br />';
    echo cvtx_dropdown_tops($top_id, __('No agenda points enabled to applications.', 'cvtx') . '.', '', true);
    echo '<br />';
    echo '<label for="cvtx_application_ord_field">' . __('Application number', 'cvtx') . ':</label><br />';
    echo '<input name="cvtx_application_ord" id="cvtx_application_ord_field" type="text" maxlength="5" value="' . get_post_meta($post->ID, 'cvtx_application_ord', true) . '" />';
    echo '<p id="admin_message" class="error">';
    echo ' <span id="unique_error_cvtx_application_ord" class="cvtx_unique_error">' . __('This number is used.', 'cvtx') . '</span> ';
    echo ' <span id="empty_error_cvtx_application_ord" class="cvtx_empty_error">' . __('Please insert number.', 'cvtx') . '</span> ';
    echo '</p>';
}
예제 #3
0
파일: cvtx.php 프로젝트: alexfecke/cvtx
/**
 * Retrieves all tops that are assigned to an event
 */
function cvtx_top_for_event()
{
    if (isset($_REQUEST['event_id']) && isset($_REQUEST['post_type'])) {
        $out = cvtx_dropdown_tops($selected = $_REQUEST['current_top'], $message = 'ERR', $_REQUEST['post_type'] == 'cvtx_antrag', $_REQUEST['post_type'] == 'cvtx_application', $event_id = $_REQUEST['event_id']);
        echo $out;
    }
    exit;
}