PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.1.2
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.1.2
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 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.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 3.10.4 All 148 releases
visualizer / classes / Visualizer / Render / Layout.php

Layout.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.1.2, at classes/Visualizer/Render/Layout.php

130 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // +----------------------------------------------------------------------+
4 // | Copyright 2013 Madpixels (email : visualizer@madpixels.net) |
5 // +----------------------------------------------------------------------+
6 // | This program is free software; you can redistribute it and/or modify |
7 // | it under the terms of the GNU General Public License, version 2, as |
8 // | published by the Free Software Foundation. |
9 // | |
10 // | This program is distributed in the hope that it will be useful, |
11 // | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 // | GNU General Public License for more details. |
14 // | |
15 // | You should have received a copy of the GNU General Public License |
16 // | along with this program; if not, write to the Free Software |
17 // | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
18 // | MA 02110-1301 USA |
19 // +----------------------------------------------------------------------+
20 // | Author: Eugene Manuilov <eugene@manuilov.org> |
21 // +----------------------------------------------------------------------+
22 /**
23 * Layout rendering class.
24 *
25 * @category Visualizer
26 * @package Render
27 */
28 class Visualizer_Render_Layout extends Visualizer_Render {
29
30 /**
31 * Renders template.
32 *
33 * @since 1.0.0
34 *
35 * @abstract
36 * @access protected
37 */
38 protected function _toHTML() {
39 // empty.
40 }
41
42 /**
43 * Show the layout by delegating the call to the layout-specific method with the params.
44 *
45 * @access public
46 */
47 public static function show( $layout ) {
48 return call_user_func( array( __CLASS__, '_render' . str_replace( ' ', '', ucwords( str_replace( '-', ' ', $layout ) ) ) ), func_get_args() );
49 }
50
51 /**
52 * Show the fake editor (just an empty div).
53 *
54 * @access public
55 */
56 public static function _renderFauxEditor( $args ) {
57 echo '<div id="chart-lhs" class="visualizer-editor-lhs" style="display: none"></div>';
58 }
59
60 /**
61 * Show the DB query box.
62 *
63 * @access public
64 */
65 public static function _renderDbQuery( $args ) {
66 $query = $args[1];
67 ?>
68 <div id='visualizer-db-query' style="display: none">
69 <div class="visualizer-db-query-form">
70 <div>
71 <form id='db-query-form'>
72 <textarea name='query' class='visualizer-db-query' placeholder="<?php _e( 'Your query goes here', 'visualizer' ); ?>"><?php echo $query; ?></textarea>
73 </form>
74 <div class='db-wizard-error'></div>
75 </div>
76 <div>
77 <input type="button" class="button button-primary" id='visualizer-query-fetch' value='<?php _e( 'Show Results', 'visualizer' ); ?>'>
78 </div>
79 </div>
80 <div class='db-wizard-hints'>
81 <ul>
82 <li><?php echo sprintf( __( 'For examples of queries and links to resources that you can use with this feature, please click %1$shere%2$s', 'visualizer' ), '<a href="' . VISUALIZER_DB_QUERY_DOC_URL . '" target="_blank">', '</a>' ); ?></li>
83 <li><?php echo sprintf( __( 'Use %1$sControl+Space%2$s for autocompleting keywords or table names.', 'visualizer' ), '<span class="visualizer-emboss">', '</span>' ); ?></li>
84 </ul>
85 </div>
86 <div class='db-wizard-results'></div>
87
88 </div>
89 <?php
90 }
91
92 /**
93 * Show the DB wizard's results table.
94 *
95 * @access public
96 */
97 public static function _renderDbWizardResults( $args ) {
98 $headers = $args[1];
99 $results = $args[2];
100 ob_start();
101 ?>
102 <table cellspacing="0" width="100%" id="results">
103 <thead>
104 <tr>
105 <?php
106 foreach ( $headers as $header ) {
107 echo '<th>' . $header['label'] . '</th>';
108 }
109 ?>
110 </tr>
111 </thead>
112 <tfoot>
113 </tfoot>
114 <tbody>
115 <?php
116 foreach ( $results as $result ) {
117 echo '<tr>';
118 foreach ( $result as $r ) {
119 echo '<td>' . $r . '</td>';
120 }
121 echo '</tr>';
122 }
123 ?>
124 </tbody>
125 </table>
126 <?php
127 return ob_get_clean();
128 }
129 }
130