pid = $pid; parent::__construct( array( 'singular' => 'singular_form', 'plural' => 'plural_form', 'ajax' => false ) ); } protected function get_views() { $link = "?page=ajtodo_admin_project&ptype=team&ajtodo_type=doc&pid=".$this->pid; $qry = array( array( 'key' => 'ajtodo_pid', 'value' => $this->pid, 'compare' => '=', ) ); $post_status = ajtodo_get("post_status",""); $a_cnt = count( get_posts( array( 'post_type' => 'ajtododoc', 'meta_query' => $qry, 'nopaging' => true ))); $p_cnt = count( get_posts( array( 'post_type' => 'ajtododoc', 'meta_query' => $qry, 'post_status' => 'publish', 'nopaging' => true ))); $d_cnt = count( get_posts( array( 'post_type' => 'ajtododoc', 'meta_query' => $qry, 'post_status' => 'draft', 'nopaging' => true ))); $t_cnt = count( get_posts( array( 'post_type' => 'ajtododoc', 'meta_query' => $qry, 'post_status' => 'trash', 'nopaging' => true ))); $status_links = array( "all" => "".__("전체","ajtodo")."(".$a_cnt.")", "published" => "".__("발행됨","ajtodo")."(".$p_cnt.")", "drafted" => "".__("임시글","ajtodo")."(".$d_cnt.")", "trashed" => "".__("휴지통","ajtodo")."(".$t_cnt.")" ); return $status_links; } public function prepare_items() { $columns = $this->get_columns(); $hidden = $this->get_hidden_columns(); $sortable = $this->get_sortable_columns(); $data = $this->table_data(); usort( $data, array( &$this, 'sort_data' ) ); $perPage = 10; $currentPage = $this->get_pagenum(); $totalItems = count($data); $this->set_pagination_args( array( 'total_items' => $totalItems, 'per_page' => $perPage ) ); $data = array_slice($data,(($currentPage-1)*$perPage),$perPage); $this->_column_headers = array($columns); $this->items = $data; } public function get_columns() { $columns = array( 'post_title' => __('문서 제목', 'ajtodo' ), 'link_item' => __('관련 항목', 'ajtodo' ), 'post_author' => __('작성자', 'ajtodo' ), 'post_date' => __('발행일', 'ajtodo' ), ); return $columns; } public function filter_table_data( $table_data, $search_key ) { $filtered_table_data = array_values( array_filter( $table_data, function( $row ) use( $search_key ) { foreach( $row as $row_val ) { if( stripos( $row_val, $search_key ) !== false ) { return true; } } } ) ); return $filtered_table_data; } function column_post_title($post) { $restore_link = wp_nonce_url( "post.php?action=untrash&post=$post->ID", "untrash-post_$post->ID" ); $del_link = wp_nonce_url( "post.php?action=delete&post=$post->ID", "delete-post_$post->ID" ); if($post->post_status == 'trash') { if($this->project->hasPerm("tp_doc_create")){ $actionLinks = '