/**
  * Display the to-do list with checkboxes
  */
 public function display($complete = 0)
 {
     $atts = shortcode_atts(array('title' => '', 'priority' => 0, 'assigned' => 0, 'deadline' => 0, 'progress' => 0, 'category' => 0, 'addedby' => 0, 'date' => 0, 'todoid' => '', 'editlink' => 0, 'completed' => 0), $this->atts, 'todochecklist');
     global $current_user;
     get_currentuserinfo();
     $this->add_script = true;
     $layout = 'list';
     $this->list = '';
     list($this->url, $this->action) = CTDL_Lib::set_variables();
     $class = 'todo-checklist';
     $class = $atts['completed'] == 1 ? $class . ' completed-checklist' : $class . ' uncompleted-checklist';
     $this->list .= '<div class="' . $class . '">';
     /** @var $title string */
     if ($atts['title'] != '') {
         $this->list .= '<h2>' . esc_html($atts['title']) . '</h2>';
     }
     // get to-do items
     if ($atts['todoid'] != '') {
         $post = CTDL_Lib::get_todo($atts['todoid']);
         if ($post) {
             $id = $post->ID;
             list($the_priority, $assign_meta, $deadline_meta, $completed_meta, $progress_meta) = CTDL_Lib::get_todo_meta($id);
             if (CTDL_Loader::$settings['list_view'] == 2) {
                 $completed = $atts['todoid'] != '' && get_post_meta($id, '_user_' . $current_user->ID . '_status', true) == 1 ? 1 : 0;
             } else {
                 $completed = $atts['todoid'] != '' && get_post_meta($id, '_status', true) == 1 ? 1 : 0;
             }
             $this->show_checkbox($id, $completed, $layout, ' single');
             $this->show_todo_text($post->post_content, 'list');
             if ($atts['priority'] == 1) {
                 $this->show_priority($the_priority);
             }
             if ($atts['progress'] == 1) {
                 $this->show_progress($progress_meta, 'list', $completed);
             }
             if ($atts['assigned'] == 1) {
                 $this->show_assigned($assign_meta);
             }
             if ($atts['addedby'] == 1) {
                 $this->show_addedby(get_the_author());
             }
             if ($atts['deadline'] == 1) {
                 $this->show_deadline($deadline_meta);
             }
             if ($atts['date'] == 1) {
                 $this->show_date_added(get_the_date(), get_the_date(CTDL_Loader::$settings['date_format']));
             }
             $this->list .= do_action('ctdl_list_items');
             if ($atts['editlink'] == 1) {
                 $this->show_edit_link($id);
             }
         } else {
             /* if there are no to-do items, display this message */
             $this->list .= '<p>' . apply_filters('ctdl_no_items', esc_html__('No items to do.', 'cleverness-to-do-list')) . '</p>';
         }
     } else {
         $this->loop_through_todos($atts['completed'], $atts['category']);
     }
     $this->list .= '</div>';
     wp_reset_postdata();
 }
 /**
  * Get the to-do item data and display the edit form
  */
 protected function edit_todo_item()
 {
     $id = absint($_GET['id']);
     $todo_item = CTDL_Lib::get_todo($id);
     $this->list .= $this->create_edit_todo_form($todo_item);
     if (is_admin()) {
         $this->url = 'admin.php?page=cleverness-to-do-list';
     }
     $this->list .= '<p><a href="' . $this->url . '">&laquo; ' . apply_filters('ctdl_return', esc_html__('Return to To-Do List', 'cleverness-to-do-list')) . '</a></p>';
 }