PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
wp-data-access / WPDataProjects / Project / WPDP_Project_Project_List.php

WPDP_Project_Project_List.php in WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards 5.5.84, at WPDataProjects/Project/WPDP_Project_Project_List.php

118 lines 3.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
5 *
6 * @package WPDataProjects\Project
7 */
8 namespace WPDataProjects\Project;
9
10 use WPDataAccess\WPDA;
11 use WPDataProjects\Parent_Child\WPDP_Parent_List_Table;
12 /**
13 * Class WPDP_Project_Project_List extends WPDP_Parent_List_Table
14 *
15 * @see WPDP_Parent_List_Table
16 *
17 * @author Peter Schulz
18 * @since 2.0.0
19 */
20 class WPDP_Project_Project_List extends WPDP_Parent_List_Table {
21 /**
22 * WPDP_Project_Project_List constructor
23 *
24 * @param array $args
25 */
26 public function __construct( array $args = array() ) {
27 $args['column_headers'] = self::column_headers_labels();
28 $args['allow_import'] = 'off';
29 $args['allow_insert'] = 'on';
30 parent::__construct( $args );
31 }
32
33 /**
34 * Overwrites method add_header_button to add arguments to insert button
35 */
36 protected function add_header_button() {
37 ?>
38 <form
39 method="post"
40 action="?page=<?php
41 echo esc_attr( $this->page );
42 ?>"
43 style="display: inline-block; vertical-align: unset;"
44 >
45 <div>
46 <input type="hidden" name="action" value="new">
47 <input type="hidden" name="mode" value="edit">
48 <input type="hidden" name="table_name" value="<?php
49 echo esc_attr( $this->table_name );
50 ?>">
51 <button type="submit" class="page-title-action wpda_tooltip"
52 title="Add new project to repository"
53 >
54 <i class="fas fa-plus-circle wpda_icon_on_button"></i>
55 <?php
56 esc_html_e( 'Add New', 'wp-data-access' );
57 ?>
58 </button>
59 </div>
60 </form>
61 <?php
62 }
63
64 /**
65 * Overwrites method column_default_add_action to rewrite export action
66 *
67 * Default export supports single table export only. Project export support exporting child rows as well.
68 *
69 * @param array $item
70 * @param string $column_name
71 * @param array $actions
72 */
73 protected function column_default_add_action( $item, $column_name, &$actions ) {
74 parent::column_default_add_action( $item, $column_name, $actions );
75 $wp_nonce_action = 'wpdp-export-project-' . $item['project_id'];
76 $wp_nonce = wp_create_nonce( $wp_nonce_action );
77 $src = '?action=wpda_export_project&project_id=' . $item['project_id'] . '&wpnonce=' . $wp_nonce;
78 $actions['export'] = sprintf( '
79 <a href="%s" target="_blank" title="Export project" class="wpda_tooltip">
80 <span style="white-space:nowrap">
81 <i class="fas fa-cloud-download wpda_icon_on_button"></i>
82 %s
83 </span>
84 </a>
85 ', $src, __( 'Export', 'wp-data-access' ) );
86 }
87
88 public static function column_headers_labels() {
89 return array(
90 'project_id' => __( 'Project ID', 'wp-data-access' ),
91 'project_name' => __( 'Project Name', 'wp-data-access' ),
92 'project_description' => __( 'Project Description', 'wp-data-access' ),
93 'add_to_menu' => __( 'Add To Menu', 'wp-data-access' ),
94 'menu_name' => __( 'Menu Name', 'wp-data-access' ),
95 'project_sequence' => __( 'Seq#', 'wp-data-access' ),
96 );
97 }
98
99 // Overwrite method
100 public function show() {
101 parent::show();
102 WPDA::shortcode_popup();
103 }
104
105 public function get_bulk_actions() {
106 $actions = parent::get_bulk_actions();
107 unset(
108 $actions['bulk-export'],
109 $actions['bulk-export-xml'],
110 $actions['bulk-export-json'],
111 $actions['bulk-export-excel'],
112 $actions['bulk-export-csv']
113 );
114 return $actions;
115 }
116
117 }
118