Exemple #1
0
function cpm_project_actions($project_id)
{
    if (isset($_GET['action']) && $_GET['action'] == 'single') {
        $action = __('Action', 'cpm');
        $class = 'cpm-single-action';
    } else {
        $action = '';
        $class = 'cpm-action';
    }
    ?>
    <div class="<?php 
    echo $class;
    ?>
">

    <div class="cpm-settings-bind cpm-settings-icon-cog"><span><?php 
    echo $action;
    ?>
</span></div>

        <ul class="cpm-right cpm-settings" >
            <li>
                <span class="cpm-icons-cross"></span>
                <a href="<?php 
    echo cpm_url_projects();
    ?>
" class="cpm-project-delete-link" title="<?php 
    esc_attr_e('Delete project', 'cpm');
    ?>
" <?php 
    cpm_data_attr(array('confirm' => __('Are you sure to delete this project?', 'cpm'), 'project_id' => $project_id));
    ?>
>
                    <span><?php 
    _e('Delete', 'cpm');
    ?>
</span>
                </a>
            </li>
            <li>
                <span class="cpm-icons-checkmark"></span>
                <?php 
    if (get_post_meta($project_id, '_project_active', true) == 'yes') {
        ?>
                    <a class="cpm-archive" data-type="archive" data-project_id="<?php 
        echo $project_id;
        ?>
" href="#"><span><?php 
        _e('Completed', 'cpm');
        ?>
</span></a>
                <?php 
    } else {
        ?>
                    <a class="cpm-archive" data-type="restore" data-project_id="<?php 
        echo $project_id;
        ?>
" href="#"><span><?php 
        _e('Restore', 'cpm');
        ?>
</span></a>
                <?php 
    }
    ?>
            </li>
            <li>
                <span class="cpm-icons-docs"></span>
                <a class="cpm-duplicate-project" href="<?php 
    echo add_query_arg(array('page' => 'cpm_projects'), get_permalink());
    ?>
" data-project_id="<?php 
    echo $project_id;
    ?>
"><span><?php 
    _e('Duplicate', 'cpm');
    ?>
</span></a>
            </li>
        </ul>
    </div>
    <?php 
}
Exemple #2
0
/**
 * Generates markup for a single milestone
 *
 * @since 0.1
 * @param object $milestone
 * @param int $project_id
 */
function cpm_show_milestone($milestone, $project_id)
{
    $milestone_obj = CPM_Milestone::getInstance();
    $task_obj = CPM_Task::getInstance();
    $due = strtotime($milestone->due_date);
    $is_left = cpm_is_left(time(), $due);
    $milestone_completed = (int) $milestone->completed;
    if ($milestone_completed) {
        $class = 'complete';
    } else {
        $class = $is_left == true ? 'left' : 'late';
    }
    $string = $is_left == true ? __('left', 'cpm') : __('late', 'cpm');
    $milestone_private = $milestone->private == 'yes' ? 'cpm-lock' : 'cpm-unlock';
    ?>
    <div class="cpm-milestone <?php 
    echo $class;
    ?>
">

        <div class="milestone-detail">
            <h3>
                <?php 
    echo $milestone->post_title;
    ?>
                <?php 
    if (!$milestone_completed) {
        ?>
                    <span class="time-left">(<?php 
        printf('%s %s - %s', human_time_diff(time(), $due), $string, cpm_get_date($milestone->due_date));
        ?>
)</span>
                <?php 
    }
    ?>
                <?php 
    if (cpm_user_can_delete_edit($project_id, $milestone)) {
        ?>
                        <ul class="cpm-links cpm-right">
                            <li>
                                <a class="cpm-icon-edit" <?php 
        cpm_data_attr(array('id' => $milestone->ID, 'project_id' => $project_id));
        ?>
 href="#" title="<?php 
        esc_attr_e('Edit milestone', 'cpm');
        ?>
"><span><?php 
        _e('Edit', 'cpm');
        ?>
</span></a>
                            </li>
                            <li>
                                <a class="cpm-icon-delete cpm-milestone-delete" <?php 
        cpm_data_attr(array('project' => $project_id, 'id' => $milestone->ID, 'confirm' => __('Are you sure?', 'cpm')));
        ?>
 title="<?php 
        esc_attr_e('Delete milestone', 'cpm');
        ?>
" href="#"><span><?php 
        _e('Delete', 'cpm');
        ?>
</span></a>
                            </li>

                            <?php 
        if ($milestone->completed == '0') {
            ?>
                                <li><a class="cpm-icon-tick grey cpm-milestone-complete" data-project="<?php 
            echo $project_id;
            ?>
" data-id="<?php 
            echo esc_attr($milestone->ID);
            ?>
" title="<?php 
            esc_attr_e('Mark as complete', 'cpm');
            ?>
" href="#"><span><?php 
            _e('Mark as complete', 'cpm');
            ?>
</span></a></li>
                            <?php 
        } else {
            ?>
                                <li><a class="cpm-icon-tick green cpm-milestone-open" data-project="<?php 
            echo $project_id;
            ?>
" data-id="<?php 
            echo esc_attr($milestone->ID);
            ?>
" title="<?php 
            esc_attr_e('Mark un-complete', 'cpm');
            ?>
" href="#"><span><?php 
            _e('Reopen', 'cpm');
            ?>
</span></a></li>
                            <?php 
        }
        ?>
                            <li>
                                <span class="<?php 
        echo $milestone_private;
        ?>
"></span>
                            </li>
                        </ul>
                <?php 
    }
    ?>
            </h3>

            <div class="detail">
                <?php 
    echo cpm_get_content($milestone->post_content);
    ?>
</p>
            </div>
        </div>

        <div class="cpm-milestone-edit-form"></div>

        <?php 
    if (cpm_user_can_access($project_id, 'tdolist_view_private')) {
        $tasklists = $milestone_obj->get_tasklists($milestone->ID, true);
    } else {
        $tasklists = $milestone_obj->get_tasklists($milestone->ID);
    }
    if (cpm_user_can_access($project_id, 'msg_view_private')) {
        $messages = $milestone_obj->get_messages($milestone->ID, true);
    } else {
        $messages = $milestone_obj->get_messages($milestone->ID);
    }
    if ($tasklists) {
        ?>
            <h3><?php 
        _e('To-do List', 'cpm');
        ?>
</h3>

            <ul class="dash">
                <?php 
        foreach ($tasklists as $tasklist) {
            ?>
                    <li>
                        <a href="<?php 
            echo cpm_url_single_tasklist($project_id, $tasklist->ID);
            ?>
"><?php 
            echo stripslashes($tasklist->post_title);
            ?>
</a>
                        <div class="cpm-right">
                            <?php 
            $complete = $task_obj->get_completeness($tasklist->ID, $project_id);
            echo cpm_task_completeness($complete['total'], $complete['completed']);
            ?>
                        </div>
                        <div class="cpm-clear"></div>
                    </li>
                <?php 
        }
        ?>
            </ul>

        <?php 
    }
    ?>

        <?php 
    if ($messages) {
        ?>
            <h3><?php 
        _e('Messages', 'cpm');
        ?>
</h3>

            <ul class="dash">
                <?php 
        foreach ($messages as $message) {
            ?>
                    <li>
                        <a href="<?php 
            echo cpm_url_single_message($project_id, $message->ID);
            ?>
"><?php 
            echo stripslashes($message->post_title);
            ?>
</a>
                        (<?php 
            echo cpm_get_date($message->post_date, true);
            ?>
 | <?php 
            echo get_the_author_meta('display_name', $message->post_author);
            ?>
)
                    </li>
                <?php 
        }
        ?>
            </ul>

        <?php 
    }
    ?>

        <?php 
    if ($milestone_completed) {
        ?>
            <span class="cpm-milestone-completed">
                <?php 
        _e('Completed on:', 'cpm');
        ?>
 <?php 
        echo cpm_get_date($milestone->completed_on, true);
        ?>
            </span>
        <?php 
    }
    ?>
    </div>
    <?php 
}
Exemple #3
0
<h3 class="cpm-nav-title">
    <?php 
_e('Project Activity', 'cpm');
if (cpm_user_can_access($project_id)) {
    cpm_project_actions($project_id);
}
?>
</h3>

<ul class="cpm-activity dash">
    <?php 
$count = get_comment_count($project_id);
$activities = CPM_project::getInstance()->get_activity($project_id, array());
if ($activities) {
    echo cpm_activity_html($activities);
}
?>
</ul>

<?php 
if ($count['approved'] > count($activities)) {
    ?>
    <a href="#" <?php 
    cpm_data_attr(array('project_id' => $project_id, 'start' => count($activities) + 1, 'total' => $count['approved']));
    ?>
 class="button cpm-load-more"><?php 
    _e('Load More...', 'cpm');
    ?>
</a>
<?php 
}
    echo date_i18n('j M, Y', strtotime($message->post_date));
    ?>
</span></td>
            <td class="comment-count"><span><?php 
    echo cpm_get_number($message->comment_count);
    ?>
</span></td>
            <td class="cpm-actions">
                <?php 
    if ($message->post_author == get_current_user_id() || $pro_obj->has_admin_rights()) {
        ?>
                <a href="#" class="delete-message cpm-icon-delete" title="<?php 
        esc_attr_e('Delete this message', 'cpm');
        ?>
" <?php 
        cpm_data_attr(array('msg_id' => $message->ID, 'project_id' => $project_id, 'confirm' => __('Are you sure to delete this message?', 'cpm')));
        ?>
>
                    <span><?php 
        _e('Delete', 'cpm');
        ?>
</span>
                </a>
                <?php 
    }
    ?>
            </td>
        </tr>
        <?php 
}
?>
<?php
/**
 * Project dashboard page
 */
cpm_get_header( __( 'Activity', 'cpm' ), $project_id );
?>
<h3 class="cpm-nav-title">
    <?php _e( 'Project Activity', 'wedevs' ); ?>

    <?php if ( current_user_can( 'delete_others_posts' ) ) { //editor ?>
        <span class="cpm-right">
            <a href="#" class="cpm-icon-delete cpm-project-delete-link" title="<?php esc_attr_e( 'Delete project', 'cpm' ); ?>" <?php cpm_data_attr( array('confirm' => 'Are you sure to delete this project', 'project_id' => $project_id) ) ?>>
                <span><?php _e( 'Delete', 'cpm' ); ?></span>
            </a>
        </span>
    <?php } ?>
</h3>

<ul class="cpm-activity dash">
    <?php
    $activities = CPM_Comment::getInstance()->get_comments( $project_id, 'DESC' );

    if ( $activities ) {
        foreach ($activities as $activity) {
            ?>
            <li>
                <?php echo do_shortcode( $activity->comment_content ); ?> <span class="date">- <?php echo cpm_get_date( $activity->comment_date, true ); ?></span>
            </li>
            <?
        }
    }
Exemple #6
0
    /**
     * Display activities for a project
     *
     * @since 1.0
     * @param int $project_id
     */
    function project_activity($project_id)
    {
        $pro_obj = CPM_Project::getInstance();
        ?>
        <ul class="cpm-activity dash">
            <?php 
        $count = get_comment_count($project_id);
        $activities = $pro_obj->get_activity($project_id, array());
        if ($activities) {
            echo cpm_activity_html($activities);
        }
        ?>
        </ul>

        <?php 
        if ($count['approved'] > count($activities)) {
            ?>
            <a href="#" <?php 
            cpm_data_attr(array('project_id' => $project_id, 'start' => count($activities) + 1, 'total' => $count['approved']));
            ?>
 class="button cpm-load-more"><?php 
            _e('Load More...', 'cpm');
            ?>
</a>
        <?php 
        }
        ?>

        <?php 
    }