<?php cpm_get_header(__('Files', 'cpm'), $project_id); $args = array('post_type' => 'attachment', 'meta_key' => '_project', 'meta_value' => $project_id, 'numberposts' => -1); $attachments = get_posts($args); $base_image_url = admin_url('admin-ajax.php?action=cpm_file_get'); if ($attachments) { echo '<ul class="cpm-files">'; foreach ($attachments as $attachment) { $file = CPM_Comment::getInstance()->get_file($attachment->ID); $topic_url = '#'; if (!$attachment->post_parent) { $parent_id = get_post_meta($attachment->ID, '_parent', true); $parent = get_post($parent_id); } else { $parent = get_post($attachment->post_parent); } $post_type_object = get_post_type_object($parent->post_type); if ($parent->post_type == 'task') { $task_list = get_post($parent->post_parent); $topic_url = cpm_url_single_task($project_id, $task_list->ID, $parent->ID); } else { if ($parent->post_type == 'task_list') { $topic_url = cpm_url_single_tasklist($project_id, $parent->ID); } else { if ($parent->post_type == 'message') { $topic_url = cpm_url_single_message($project_id, $parent->ID); } } } $file_url = sprintf('%s&file_id=%d&project_id=%d', $base_image_url, $file['id'], $project_id);
<?php $task_obj = CPM_Task::getInstance(); $list = $task_obj->get_task_list($tasklist_id); cpm_get_header(__('To-do List', 'cpm'), $project_id); ?> <h3 class="cpm-nav-title"> <a href="<?php echo cpm_url_tasklist_index($project_id); ?> "><?php _e('← back', 'cpm'); ?> </a> <span class="sep">|</span> <?php _e('Task List', 'cpm'); ?> : <?php echo get_the_title($list->ID); ?> </h3> <ul class="cpm-todolists"> <?php if ($list) { ?> <li id="cpm-list-<?php echo $list->ID; ?> "><?php
<?php cpm_get_header(__('Milestones', 'cpm'), $project_id); ?> <h3 class="cpm-nav-title"> <?php _e('Milestones', 'cpm'); ?> <a id="cpm-add-milestone" href="#" class="add-new-h2"><?php _e('Add Milestone', 'cpm'); ?> </a> </h3> <?php $milestone_obj = CPM_Milestone::getInstance(); $milestones = $milestone_obj->get_by_project($project_id); $completed_milestones = array(); $late_milestones = array(); $upcoming_milestones = array(); if ($milestones) { foreach ($milestones as $milestone) { $due = strtotime($milestone->due_date); $is_left = cpm_is_left(time(), $due); $milestone_completed = (int) $milestone->completed; if ($milestone_completed) { $completed_milestones[] = $milestone; } else { if ($is_left) {
<?php /** * Project dashboard page */ cpm_get_header(__('Activity', 'cpm'), $project_id); ?> <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']));
<?php /** * This page displays all the messages attached with a project * */ $msg_obj = CPM_Message::getInstance(); $pro_obj = CPM_Project::getInstance(); cpm_get_header(__('Messages', 'cpm'), $project_id); ?> <h3 class="cpm-nav-title"> <?php _e('Messages', 'cpm'); ?> <a class="add-new-h2 cpm-new-message-btn" href="#"><?php _e('Add New', 'cpm'); ?> </a> </h3> <div class="cpm-new-message-form"> <h3><?php _e('Create a new message', 'cpm'); ?> </h3> <?php echo cpm_message_form($project_id); ?> </div>
<?php $updated = false; if (isset($_POST['sub_seettings'])) { unset($_POST['sub_seettings']); $updated = true; update_post_meta($project_id, '_settings', $_POST); } $settings = get_post_meta($project_id, '_settings', true); $labels = cpm_settings_label(); cpm_get_header(__('Settings', 'cpm'), $project_id); ?> <h3 class="cpm-nav-title"> <?php _e('Project Permission Settings', 'cpm'); ?> </h3> <?php if ($updated) { ?> <div class="updated"> <p><?php _e('Saved changes successfully!', 'cpm'); ?> </p> </div> <?php } ?>
/** * Display a single project * * @since 1.0 * @param int $project_id */ function single_project($project_id) { remove_filter('comments_clauses', 'cpm_hide_comments', 99); $pro_obj = CPM_Project::getInstance(); $activities = $pro_obj->get_activity($project_id, array()); $tab = isset($_GET['tab']) ? $_GET['tab'] : 'activity'; $action = isset($_GET['action']) ? $_GET['action'] : 'index'; switch ($tab) { case 'activity': cpm_get_header(__('Activity', 'cpm'), $project_id); $this->project_activity($project_id); break; case 'settings': cpm_get_header(__('Activity', 'cpm'), $project_id); $this->project_settings($project_id); break; case 'message': switch ($action) { case 'single': $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : 0; $this->message_single($project_id, $message_id); break; default: $this->message_index($project_id); break; } break; case 'task': switch ($action) { case 'single': $list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : 0; $this->tasklist_single($project_id, $list_id); break; case 'todo': $list_id = isset($_GET['list_id']) ? intval($_GET['list_id']) : 0; $task_id = isset($_GET['task_id']) ? intval($_GET['task_id']) : 0; $this->task_single($project_id, $list_id, $task_id); break; default: $this->tasklist_index($project_id); break; } break; case 'milestone': $this->milestone_index($project_id); break; case 'files': $this->files_index($project_id); break; default: break; } do_action('cpmf_project_tab', $project_id, $tab, $action); // add the filter again add_filter('comments_clauses', 'cpm_hide_comments', 99); }