echo $list->ID;
    ?>
"><?php 
    echo cpm_task_list_html($list, $project_id);
    ?>
</li>
    <?php 
}
?>
</ul>

<h3 class="cpm-comment-title"><?php 
_e('Discuss this to-do list', 'cpm');
?>
</h3>

<ul class="cpm-comment-wrap">
    <?php 
$comments = $task_obj->get_comments($tasklist_id);
if ($comments) {
    $count = 0;
    foreach ($comments as $comment) {
        $class = $count % 2 == 0 ? 'even' : 'odd';
        echo cpm_show_comment($comment, $project_id, $class);
        $count++;
    }
}
?>
</ul>
<?php 
echo cpm_comment_form($project_id, $tasklist_id);
Esempio n. 2
0
 function new_comment()
 {
     check_ajax_referer('cpm_new_message');
     $posted = $_POST;
     $files = array();
     $text = trim($posted['cpm_message']);
     $parent_id = isset($posted['parent_id']) ? intval($posted['parent_id']) : 0;
     $project_id = isset($posted['project_id']) ? intval($posted['project_id']) : 0;
     if (isset($posted['cpm_attachment'])) {
         $files = $posted['cpm_attachment'];
     }
     $data = array('comment_post_ID' => $parent_id, 'comment_content' => $text, 'user_id' => get_current_user_id());
     $comment_obj = CPM_Comment::getInstance();
     $comment_id = $comment_obj->create($data, $files);
     if ($comment_id) {
         $comment = $comment_obj->get($comment_id);
         echo json_encode(array('success' => true, 'placeholder' => __('Add a comment...', 'cpm'), 'content' => cpm_show_comment($comment, $project_id)));
     }
     exit;
 }