PluginProbe
Chartify – WordPress Chart Plugin / trunk
Chartify – WordPress Chart Plugin vtrunk
3.8.1 3.8.0 3.7.9 3.7.8 3.7.7 3.7.6 3.7.5 trunk 1.0.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 All 84 releases
chart-builder / admin / partials / charts / chart-builder-charts-display.php

chart-builder-charts-display.php in Chartify – WordPress Chart Plugin trunk, at admin/partials/charts/chart-builder-charts-display.php

184 lines 13.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $items = $this->db_obj->get_items();
3 $all_items = CBFunctions()->get_all_charts_count();
4 $chart_count_per_page = count($items) > 0 ? $all_items/$this->db_obj->get_pagination_count() : 0;
5 $chart_paged = isset($_GET['paged']) && $_GET['paged'] != '' ? absint( sanitize_text_field($_GET['paged'])) : '';
6 ?>
7 <div class="wrap">
8 <h1 class="wp-heading-inline">
9 <?php
10 echo __( esc_html( get_admin_page_title() ), "chart-builder" );
11 echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary mx-2 chart-add-new-bttn">' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add');
12 ?>
13 </h1>
14
15 <div id="poststuff">
16 <div id="post-body" class="metabox-holder">
17 <div id="post-body-content">
18 <div class="meta-box-sortables ui-sortable">
19 <?php
20 // $this->surveys_categories_obj->views();
21 ?>
22 <form method="post">
23 <?php
24 // $this->surveys_categories_obj->prepare_items();
25 // $this->surveys_categories_obj->display();
26 ?>
27 <table class="chart-list-table table">
28 <thead>
29 <tr>
30 <th class="column-cb">
31 <input type="checkbox" class="form-check-input select-all" value="" />
32 </th>
33 <th class="column-title"><?php echo esc_html(__( 'Title', "chart-builder" )); ?></th>
34 <th class="column-type"><?php echo esc_html(__( 'Type', "chart-builder" )); ?></th>
35 <th class="column-shortcode"><?php echo esc_html(__( 'Shortcode', "chart-builder" )); ?></th>
36 <th class="column-author"><?php echo esc_html(__( 'Author', "chart-builder" )); ?></th>
37 <th class="column-status"><?php echo esc_html(__( 'Status', "chart-builder" )); ?></th>
38 <th class="column-id"><?php echo esc_html(__( 'ID', "chart-builder" )); ?></th>
39 </tr>
40 </thead>
41 <tbody>
42 <?php if ( !empty( $items ) ): ?>
43 <?php foreach ( $items as $key => $item ): ?>
44 <tr>
45 <td class="column-cb">
46 <input type="checkbox" class="form-check-input check-current-row" name="bulk-delete[]" value="<?php echo esc_attr($item['id']) ?>" />
47 </td>
48 <td class="column-title"><?php
49 if($item['status'] == 'trashed'){
50 $delete_nonce = wp_create_nonce( $this->plugin_name . '-delete-item' );
51 }else{
52 $delete_nonce = wp_create_nonce( $this->plugin_name . '-trash-item' );
53 }
54 $chart_title = stripcslashes( $item['title'] );
55 $q = esc_attr( $chart_title );
56 $title = sprintf( '<a href="?page=%s&action=%s&id=%d" title="%s">%s</a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, stripcslashes($item['title']));
57
58 $actions = array();
59 if($item['status'] == 'trashed'){
60 $title = sprintf( '<strong><a>%s</a></strong>', $chart_title );
61 $actions['restore'] = sprintf( '<a href="?page=%s&action=%s&id=%d&_wpnonce=%s">'. __('Restore', "chart-builder") .'</a>', esc_attr( $_REQUEST['page'] ), 'restore', absint( $item['id'] ), $delete_nonce );
62 $actions['delete'] = sprintf( '<a class="ays_confirm_del" data-message="%s" href="?page=%s&action=%s&id=%s&_wpnonce=%s">'. __('Delete Permanently', "chart-builder") .'</a>', $chart_title, esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce );
63 }else{
64 $draft_text = '';
65 if( $item['status'] == 'draft' && !( isset( $_GET['fstatus'] ) && $_GET['fstatus'] == 'draft' )){
66 $draft_text = ' — ' . '<span class="post-state">' . __( "Draft", "chart-builder" ) . '</span>';
67 }
68 $title = sprintf( '<strong><a href="?page=%s&action=%s&id=%d" title="%s">%s</a>%s</strong>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ), $q, $chart_title, $draft_text );
69
70 $actions['edit'] = sprintf( '<a href="?page=%s&action=%s&id=%d">'. __('Edit', "chart-builder") .'</a>', esc_attr( $_REQUEST['page'] ), 'edit', absint( $item['id'] ) );
71 $actions['delete'] = sprintf( '<a href="?page=%s&action=%s&id=%s&_wpnonce=%s">'. __('Delete', "chart-builder") .'</a>', esc_attr( $_REQUEST['page'] ), 'delete', absint( $item['id'] ), $delete_nonce );
72 }
73 echo wp_kses_post($title);
74
75 echo '<p class="chart-list-table-actions-row">';
76 foreach ( $actions as $action => $action_html ){
77 $link_class = '';
78 if( $action == 'delete' ){
79 $link_class = 'link-danger';
80 }
81 echo '<span class="chart-list-table-action-link ' . $link_class . '">' . $action_html . '</span>';
82 }
83 echo '</p>';
84 ?></td>
85 <td class="column-type"><?php
86 switch ($item['source_chart_type']) {
87 case 'bar_chart':
88 echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/bar-chart.png" . "' width='20px'>";
89 echo "<span style='margin-left: 8px'>" . __('Bar Chart', "chart-builder") . "</span></p>";
90 break;
91
92 case 'pie_chart':
93 echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/pie-chart.png" . "' width='20px'>";
94 echo "<span style='margin-left: 8px'>" . __('Pie Chart', "chart-builder") . "</span></p>";
95 break;
96
97 case 'column_chart':
98 echo "<p><img src='" . esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/column-chart.png" . "' width='20px'>";
99 echo "<span style='margin-left: 8px'>" . __('Column Chart', "chart-builder") . "</span></p>";
100 break;
101 }
102 ?></td>
103 <td class="column-shortcode">
104 <!-- <input type="text" onClick="this.setSelectionRange(0, this.value.length)" readonly value="--><?//= esc_attr('[ays_chart id="'. $item['id'] .'"]') ?><!--" />-->
105 <div class="ays-chart-shortcode-container">
106 <div class="ays-chart-copy-image" data-toggle="tooltip" title="<?php echo esc_html(__('Click for copy.',"chart-builder"));?>">
107 <img src='<?php echo esc_url(CHART_BUILDER_ADMIN_URL) . "/images/icons/copy-image.svg" ?>'>
108 </div>
109 <!-- <input type="text" class="ays-chart-shortcode-input" onClick="this.setSelectionRange(0, this.value.length)" readonly value="<//?= esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" /> -->
110 <input type="text" class="ays-chart-shortcode-input" readonly value="<?php echo esc_attr('[ays_chart id="'. $item['id'] .'"]') ?>" />
111 </div>
112 </td>
113 <td class="column-author"><?php
114 $author = get_user_by("id", $item['author_id']);
115 if( $author ){
116 $author_name = $author->data->display_name;
117 echo esc_html($author_name);
118 }
119 ?></td>
120 <td class="column-status"><?php
121 $status = ucfirst( $item['status'] );
122 $date = date( 'Y/m/d', strtotime( $item['date_modified'] ) );
123 $title_date = date( 'l jS \of F Y h:i:s A', strtotime( $item['date_modified'] ) );
124 $html = "<p style='font-size:14px;margin:0;'>" . $status . "</p>";
125 $html .= "<p style=';font-size:14px;margin:0;text-decoration: dotted underline;' title='" . $title_date . "'>" . $date . "</p>";
126 // $html = "<p style=';font-size:14px;margin:0;text-decoration: dotted underline;' title='" . $title_date . "'>" . $date . "</p>";
127
128 echo wp_kses_post( $html );
129 ?></td>
130 <td class="column-id"><?php echo esc_attr($item['id']) ?></td>
131 </tr>
132 <?php endforeach; ?>
133 <?php else: ?>
134 <tr>
135 <td colspan="7"><?php echo esc_html(__( 'There are no items yet.', "chart-builder" )); ?></td>
136 </tr>
137 <?php endif; ?>
138 </tbody>
139 <tfoot>
140 <?php if($chart_count_per_page > 1):?>
141 <tr>
142 <td colspan="7">
143 <nav aria-label="Pagination" class="m-0">
144 <ul class="pagination m-0 p-2">
145 <?php for( $i = 0; $i < $chart_count_per_page; $i++ ):
146 $url = esc_url_raw( remove_query_arg( false ) );
147 $url = esc_url_raw( add_query_arg( array(
148 'paged' => $i + 1
149 ), $url ) );
150
151 $active = '';
152 if( $chart_paged != '' ){
153 if( $chart_paged == $i + 1 ) {
154 $active = 'active';
155 }
156 } else {
157 wp_safe_redirect($_SERVER['REQUEST_URI'] . "&paged=1");
158 }
159 ?>
160 <li class="page-item <?php echo esc_attr($active) ?>">
161 <a class="page-link" href="<?php echo esc_url($url) ?>"><?php echo esc_attr(absint($i)) + 1; ?></a>
162 </li>
163 <?php endfor; ?>
164 </ul>
165 </nav>
166 </td>
167 </tr>
168 <?php endif; ?>
169 </tfoot>
170 </table>
171 </form>
172 </div>
173 </div>
174 </div>
175 <br class="clear">
176 </div>
177 <h1 class="wp-heading-inline">
178 <?php
179 echo __( esc_html( get_admin_page_title() ), "chart-builder" );
180 echo sprintf( '<a href="?page=%s&action=%s" class="btn btn-primary mx-2 chart-add-new-bttn">' . __( 'Add New', "chart-builder" ) . '</a>', esc_attr( $_REQUEST['page'] ), 'add');
181 ?>
182 </h1>
183 </div>
184