Ejemplo n.º 1
0
function cpm_filter_category($current_category_id)
{
    return cpm_dropdown_category($current_category_id, false, false);
}
Ejemplo n.º 2
0
/**
 * Generates markup for add/edit project form
 *
 * @since 0.1
 * @param object|null $project
 */
function cpm_project_form($project = null)
{
    $name = $details = '';
    $users = array();
    $submit = __('Add New Project', 'cpm');
    $action = 'cpm_project_new';
    $project_category = -1;
    if (!is_null($project)) {
        $name = $project->post_title;
        $details = $project->post_content;
        $users = empty($project->users) ? array() : $project->users;
        $action = 'cpm_project_update';
        $submit = __('Update Project', 'cpm');
    }
    ?>
    <form action="" method="post" class="cpm-project-form">

        <?php 
    wp_nonce_field('cpm_project');
    ?>

        <div class="cpm-form-item project-name">
            <input type="text" name="project_name" id="project_name" placeholder="<?php 
    esc_attr_e('Name of the project', 'cpm');
    ?>
" value="<?php 
    echo esc_attr($name);
    ?>
" size="45" />
        </div>
        
        <div class="cpm-form-item project-category">
            <?php 
    if ($project) {
        $terms = get_the_terms($project->ID, 'project_category');
        if ($terms && !is_wp_error($terms)) {
            $project_category = $terms[0]->term_id;
        }
    }
    echo cpm_dropdown_category($project_category, false, false, 'chosen-select');
    ?>
         </div>

        <div class="cpm-form-item project-detail">
            <textarea name="project_description" class="cpm-project-description" id="" cols="50" rows="3" placeholder="<?php 
    _e('Some details about the project (optional)', 'cpm');
    ?>
"><?php 
    echo esc_textarea($details);
    ?>
</textarea>
        </div>
        <div class="cpm-form-item cpm-project-role">
            <table><?php 
    echo CPM_Ajax::getInstance()->user_role_table_generator($project);
    ?>
</table>
        </div>
        <div class="cpm-form-item project-users">
            <input class="cpm-project-coworker" type="text" name="" placeholder="<?php 
    esc_attr_e('Type 3 or more characters to search users...', 'cpm');
    ?>
" size="45">
        </div>

        <div class="cpm-form-item project-notify">
            <input type="hidden" name="project_notify" value="no" />
            <label>
                <input type="checkbox" name="project_notify" id="project-notify" value="yes" />
                <?php 
    _e('Notify Co-workers', 'cpm');
    ?>
            </label>
        </div>


        <?php 
    do_action('cpm_project_form', $project);
    ?>

        <div class="submit">

            <?php 
    if ($project) {
        ?>
                <input type="hidden" name="project_id" value="<?php 
        echo $project->ID;
        ?>
">
            <?php 
    }
    ?>

            <input type="hidden" name="action" value="<?php 
    echo $action;
    ?>
">
            <span class="cpm-pro-update-spinner"></span>
            <input type="submit" name="add_project" id="add_project" class="button-primary" value="<?php 
    echo esc_attr($submit);
    ?>
">
            <a class="button project-cancel" href="#"><?php 
    _e('Cancel', 'cpm');
    ?>
</a>
        </div>
        <div class="cpm-loading" style="display: none;"><?php 
    _e('Saving...', 'cpm');
    ?>
</div>
    </form>
    <?php 
}