/** * Prints project activities * * @since 0.3.1 * * @param array $activities * @return string */ function cpm_projects_activity_html($activities) { global $_get_shorcode_attr; $list = array(); $html = ''; foreach ($activities as $activity) { cpm_custom_do_shortcode($activity->comment_content); $task_privacy = cpm_check_task_privicy($_get_shorcode_attr, $activity); $tasklist_privacy = cpm_check_tasklist_privicy($_get_shorcode_attr, $activity); $milestone_privacy = cpm_check_milestone_privicy($_get_shorcode_attr, $activity); $message_privacy = cpm_check_message_privicy($_get_shorcode_attr, $activity); $_get_shorcode_attr = ''; if (!$task_privacy || !$tasklist_privacy || !$milestone_privacy || !$message_privacy) { continue; } $date = strtotime(date('F j, Y', strtotime($activity->comment_date))); $list[$date][] = $activity; } foreach ($list as $key => $items) { $html .= sprintf('<li class="cpm-progress-wrap"><div class="cpm-activity-heads"><span>%s</span></div><ul>', date_i18n('F j, Y', $key)); foreach ($items as $activity) { $post = get_post($activity->comment_post_ID); $project_url = cpm_url_project_details($activity->comment_post_ID); $title = '<a class="cpm-progress-label" href="' . $project_url . '">' . $post->post_title . '</a>'; cpm_custom_do_shortcode($activity->comment_content); $task_privacy = cpm_check_task_privicy($_get_shorcode_attr, $activity); $tasklist_privacy = cpm_check_tasklist_privicy($_get_shorcode_attr, $activity); $milestone_privacy = cpm_check_milestone_privicy($_get_shorcode_attr, $activity); $message_privacy = cpm_check_message_privicy($_get_shorcode_attr, $activity); $_get_shorcode_attr = ''; if (!$task_privacy || !$tasklist_privacy || !$milestone_privacy || !$message_privacy) { continue; } $html .= sprintf('<li>%s <span class="date">%s %s</span></li>', $title, do_shortcode($activity->comment_content), cpm_get_date($activity->comment_date, true)); } $html .= '</li></ul>'; } return $html; }
/** * Prints project activities * * @since 0.3.1 * * @param array $activities * @return string */ function cpm_activity_html($activities) { global $_get_shorcode_attr; $list = array(); $html = ''; foreach ($activities as $activity) { cpm_custom_do_shortcode($activity->comment_content); $task_privacy = cpm_check_task_privicy($_get_shorcode_attr, $activity); $tasklist_privacy = cpm_check_tasklist_privicy($_get_shorcode_attr, $activity); $milestone_privacy = cpm_check_milestone_privicy($_get_shorcode_attr, $activity); $message_privacy = cpm_check_message_privicy($_get_shorcode_attr, $activity); $_get_shorcode_attr = ''; if (!$task_privacy || !$tasklist_privacy || !$milestone_privacy || !$message_privacy) { continue; } $date = strtotime(date('F j, Y', strtotime($activity->comment_date))); $list[$date][] = $activity; } foreach ($list as $key => $items) { $html .= sprintf('<li><div class="cpm-activity-heads">%s</div><ul>', date_i18n('F j, Y', $key)); foreach ($items as $activity) { cpm_custom_do_shortcode($activity->comment_content); $task_privacy = cpm_check_task_privicy($_get_shorcode_attr, $activity); $tasklist_privacy = cpm_check_tasklist_privicy($_get_shorcode_attr, $activity); $milestone_privacy = cpm_check_milestone_privicy($_get_shorcode_attr, $activity); $message_privacy = cpm_check_message_privicy($_get_shorcode_attr, $activity); $_get_shorcode_attr = ''; if (!$task_privacy || !$tasklist_privacy || !$milestone_privacy || !$message_privacy) { continue; } $html .= sprintf('<li>%s <span class="date">- %s</span></li>', do_shortcode($activity->comment_content), cpm_get_date($activity->comment_date, true)); } $html .= '</li></ul>'; } return $html; }