/** * Generate the To-Do List * @param $todo_items * @param int $completed * @param int $visible * @return array $posts_to_exclude */ protected function show_todo_list_items($todo_items, $completed = 0, $visible = 0) { $atts = shortcode_atts(array('title' => '', 'type' => 'list', 'priorities' => 1, 'assigned' => 1, 'deadline' => 1, 'progress' => 1, 'addedby' => 1, 'date' => 0, 'list_type' => 'ol', 'category' => '0', 'completed_date' => 0), $this->atts, 'todolist'); while ($todo_items->have_posts()) { $todo_items->the_post(); $id = get_the_ID(); $posts_to_exclude[] = $id; if ($visible == 0) { list($the_priority, $assign_meta, $deadline_meta, $completed_meta, $progress_meta) = CTDL_Lib::get_todo_meta($id); $priority_class = CTDL_Lib::set_priority_class($the_priority); if ($atts['type'] == 'list' && CTDL_Loader::$settings['categories'] == 1 && CTDL_Loader::$settings['sort_order'] == 'cat_id') { $this->show_category_headings(get_the_terms($id, 'todocategories'), $atts['list_type'], $completed); } if ($atts['type'] == 'table') { $this->list .= '<tr id="todo-' . esc_attr($id) . '"' . $priority_class . '>'; } else { $this->list .= '<li' . $priority_class . '>'; } $this->show_todo_text(get_the_content(), $atts['type']); if (($atts['priorities'] == 'show' || $atts['priorities'] == 1) && $atts['type'] == 'table') { $this->show_priority($the_priority); } if (($atts['progress'] == 'show' || $atts['progress'] == 1) && CTDL_Loader::$settings['show_progress'] == 1) { $this->show_progress($progress_meta, $atts['type'], $completed); } if ($atts['category'] == 0 && $atts['type'] == 'table' && CTDL_Loader::$settings['categories'] == 1) { $this->show_category(get_the_terms($id, 'todocategories')); } if (($atts['assigned'] == 'show' || $atts['assigned'] == 1) && ((CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 0 && current_user_can(CTDL_Loader::$settings['view_all_assigned_capability']) || CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 1) && CTDL_Loader::$settings['assign'] == 0)) { $this->show_assigned($assign_meta, $atts['type']); } if (($atts['addedby'] == 'show' || $atts['addedby'] == 1) && CTDL_Loader::$settings['list_view'] == 1 && CTDL_Loader::$settings['todo_author'] == 0) { $this->show_addedby(get_the_author(), $atts['type']); } if (($atts['deadline'] == 'show' || $atts['deadline'] == 1) && CTDL_Loader::$settings['show_deadline'] == 1) { $this->show_deadline($deadline_meta, $atts['type']); } if ($atts['date'] == 1 && CTDL_Loader::$settings['show_date_added'] == 1) { $this->show_date_added(get_the_date('Ymd'), get_the_date(CTDL_Loader::$settings['date_format']), $atts['type']); } if ($atts['completed_date'] == 1 && CTDL_Loader::$settings['show_completed_date'] && $completed == 1) { $this->show_completed($completed_meta, $atts['type']); } $this->list .= do_action('ctdl_list_items'); if ($atts['type'] == 'table') { $this->list .= '</tr>'; } else { $this->list .= '</li>'; } } } wp_reset_postdata(); return $posts_to_exclude; }
/** * Generate the To-Do List * @param object $todo_items * @param int $completed * @param int $visible * @return array $posts_to_exclude */ protected function show_todo_list_items($todo_items, $completed = 0, $visible = 0) { while ($todo_items->have_posts()) { $todo_items->the_post(); $id = get_the_ID(); $posts_to_exclude[] = $id; if ($visible == 0) { list($priority, $assign_meta, $deadline_meta, $completed_meta, $progress_meta, $planner_meta) = CTDL_Lib::get_todo_meta($id); $priority_class = CTDL_Lib::set_priority_class($priority); $this->list .= '<tr id="todo-' . esc_attr($id) . '"' . $priority_class . '>'; $this->show_id($id); $this->show_checkbox($id, $completed); $this->show_todo_text(get_the_content()); $this->show_priority($priority); $this->show_progress($progress_meta, 'table', $completed); $this->show_category(get_the_terms($id, 'todocategories')); if (CTDL_PP) { $this->show_planner($planner_meta); } $this->show_assigned($assign_meta); $this->show_addedby(get_the_author()); $this->show_deadline($deadline_meta); $this->show_date_added(get_the_date('Ymd'), get_the_date(CTDL_Loader::$settings['date_format'])); if ($completed == 1) { $this->show_completed($completed_meta); } $this->list .= do_action('ctdl_list_items'); $this->show_edit_link($id); $this->list .= '</tr>'; } } wp_reset_postdata(); return $posts_to_exclude; }