PluginProbe ʕ •ᴥ•ʔ
PowerBI Embed Reports / 1.2.1
PowerBI Embed Reports v1.2.1
trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4
embed-power-bi-reports / View / adminView.php
embed-power-bi-reports / View Last commit date
accountSetup.php 9 months ago adminView.php 9 months ago appConfig.php 9 months ago feedbackForm.php 9 months ago integrations.php 9 months ago powerBI.php 9 months ago powerBIsettings.php 9 months ago support_form.php 9 months ago
adminView.php
261 lines
1 <?php
2 /**
3 * Handles Admin View
4 *
5 * @package embed-power-bi-reports\View
6 */
7
8 namespace MoEmbedPowerBI\View;
9
10 use MoEmbedPowerBI\View\powerBI;
11 use MoEmbedPowerBI\View\support_form;
12 use MoEmbedPowerBI\Wrappers\secureInput;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Class to handle all the view and show the tab nav bar.
20 */
21 class adminView {
22
23 /**
24 * Holds the instance of AdminView class.
25 *
26 * @var AdminView
27 */
28 private static $instance;
29
30 /**
31 * Object instance(AdminView) getter method.
32 *
33 * @return AdminView
34 */
35 public static function get_view() {
36 if ( ! isset( self::$instance ) ) {
37 $class = __CLASS__;
38 self::$instance = new $class();
39 }
40 return self::$instance;
41 }
42
43 /**
44 * Function to display the menu.
45 *
46 * @return void
47 */
48 public function mo_epbr_menu_display() {
49 // Get tab parameter using secure input handler
50 $active_tab = secureInput::mo_epbr_get_safe_param( 'tab', 'text', 'app_config' );
51 echo '<div style="display:flex;">';
52 $this->mo_epbr_display_tabs( $active_tab );
53
54 echo '</div>';
55 }
56
57 /**
58 * Function to display the tab with support form.
59 *
60 * @param string $active_tab Holds the current active tab value.
61 * @return void
62 */
63 private function mo_epbr_display_tabs( $active_tab ) {
64
65 if ( 'licensing_plans' !== $active_tab ) {
66 echo '<div style="display:flex;justify-content:space-between;align-items:flex-start;padding-top:8px;margin-right:-1.5rem;width:100%">
67 <div style="width:100%;" id="mo_epbr_container" class="mo-container">';
68 $this->mo_epbr_display__header_menu();
69 $this->mo_epbr_display__tabs( $active_tab );
70 echo '<div style="display:flex;justify-content:space-between;align-items:flex-start;">';
71 $this->mo_epbr_display__tab_content( $active_tab );
72 $handler = support_form::get_view();
73 $handler->mo_epbr_display_support_form();
74 echo '</div></div>';
75 echo '</div>';
76 }
77 }
78
79 /**
80 * Function to display the header menu.
81 *
82 * @return void
83 */
84 private function mo_epbr_display__header_menu() {
85 ?>
86 <div style="display: flex;">
87 <img id="mo-ms-title-logo" src="<?php echo esc_url( plugin_dir_url( MO_EPBR_PLUGIN_FILE ) . 'images/miniorange.png' ); ?>">
88 <h1><label for="power_bi_integrator">WP Embed Power BI Reports</label></h1>
89 <span><a href="<?php echo esc_url( 'https://sandbox.miniorange.com/?mo_plugin=mo_power_bi' ); ?>" target="_blank" class="mo-button mo-button-demo-request">Demo Request</a> </span>
90 <span><a href="<?php echo esc_url( 'https://plugins.miniorange.com/wordpress-power-bi-embed' ); ?>" target="_blank" class="mo-button mo-button-setup">Setup Guide</a> </span>
91 <span><a href="<?php echo esc_url( 'https://plugins.miniorange.com/microsoft-power-bi-embed-for-wordpress#pricing-cards' ); ?>" target="_blank" class="mo-button mo-button-licensing">Features & Pricing<img class="crown-icon" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../images/crown.png' ); ?>" alt="powerbi paid Plans Logo"></a></span>
92 </div>
93 <?php
94 }
95
96 /**
97 * Function to display the tabs.
98 *
99 * @param string $active_tab Holds the value of current selected tab.
100 * @return void
101 */
102 private function mo_epbr_display__tabs( $active_tab ) {
103 ?>
104 <div class="mo-ms-tab ms-tab-background mo-ms-tab-border">
105 <ul class="mo-ms-tab-ul">
106 <li id="app_config" class="mo-ms-tab-li">
107 <a href="<?php echo esc_url( add_query_arg( 'tab', 'app_config' ) ); ?>">
108 <div id="application_div_id" class="mo-ms-tab-li-div
109 <?php
110 if ( 'app_config' === $active_tab ) {
111 echo 'mo-ms-tab-li-div-active';
112 }
113 ?>
114 " aria-label="Application" title="Application Configuration" role="button" tabindex="0">
115 <div class="mo-ms-tab-centre">
116 <div id="add_icon" class="mo-ms-tab-li-icon" >
117 <span class="dashicons dashicons-align-wide"></span>
118 </div>
119 <div id="add_app_label" class="mo-ms-tab-li-label">
120 Manage Application
121 </div>
122 </div>
123
124 </div>
125 </a>
126 </li>
127 &nbsp
128 <li id="pb_app_config" class="mo-ms-tab-li">
129 <a href="<?php echo esc_url( add_query_arg( 'tab', 'pb_app_config' ) ); ?>">
130 <div id="application_div_id" class="mo-ms-tab-li-div
131 <?php
132 if ( 'pb_app_config' === $active_tab ) {
133 echo 'mo-ms-tab-li-div-active';
134 }
135 ?>
136 " aria-label="PowerBI" title="PowerBI Configuration" role="button" tabindex="0">
137 <div class="mo-ms-tab-centre">
138 <div id="add_icon" class="mo-ms-tab-li-icon" >
139 <img class="power_bi_tab_image" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../images/power-bi.svg' ); ?>">
140 </div>
141 <div id="add_app_label" class="mo-ms-tab-li-label">
142 Embed Power BI
143 </div>
144 </div>
145 </div>
146 </a>
147 </li>
148 &nbsp
149 <li id="settings_tab" class="mo-ms-tab-li">
150 <a href="<?php echo esc_url( add_query_arg( 'tab', 'settings_tab' ) ); ?>">
151 <div id="application_div_id" class="mo-ms-tab-li-div
152 <?php
153 if ( 'settings_tab' === $active_tab ) {
154 echo 'mo-ms-tab-li-div-active';
155 }
156 ?>
157 " aria-label="Settings Tab" title="Settings Tab" role="button" tabindex="0">
158 <div class="mo-ms-tab-centre">
159 <div id="add_icon" class="mo-ms-tab-li-icon" >
160 <span class="dashicons dashicons-admin-tools"></span>
161 </div>
162 <div id="settings_tab" class="mo-ms-tab-li-label">
163 Settings
164 </div>
165 </div>
166 </div>
167 </a>
168 </li>
169 &nbsp
170 <li id="integrations_tab" class="mo-ms-tab-li">
171 <a href="<?php echo esc_url( add_query_arg( 'tab', 'integrations_tab' ) ); ?>">
172 <div id="application_div_id" class="mo-ms-tab-li-div
173 <?php
174 if ( 'integrations_tab' === $active_tab ) {
175 echo 'mo-ms-tab-li-div-active';
176 }
177 ?>
178 " aria-label="integrations Tab" title="Integrations Tab" role="button" tabindex="0">
179 <div class="mo-ms-tab-centre">
180 <div id="add_icon" class="mo-ms-tab-li-icon" >
181 <span class="dashicons dashicons-networking"></span>
182 </div>
183 <div id="integrations_tab" class="mo-ms-tab-li-label">
184 Integrations
185 </div>
186 </div>
187
188 </div>
189 </a>
190 </li>
191 &nbsp
192 <li id="account_setup_tab" class="mo-ms-tab-li">
193 <a href="<?php echo esc_url( add_query_arg( 'tab', 'account_setup_tab' ) ); ?>">
194 <div id="application_div_id" class="mo-ms-tab-li-div
195 <?php
196 if ( 'account_setup_tab' === $active_tab ) {
197 echo 'mo-ms-tab-li-div-active';
198 }
199 ?>
200 " aria-label="account setup tab" title="Account Setup Tab" role="button" tabindex="0">
201 <div class="mo-ms-tab-centre">
202 <div id="add_icon" class="mo-ms-tab-li-icon" >
203 <!-- <span class="dashicons dashicons-share-alt"></span> -->
204 <img class="account_setup_logo" src="<?php echo esc_url( plugin_dir_url( __FILE__ ) . '../images/login.png' ); ?>">
205 </div>
206 <div id="account_setup_tab" class="mo-ms-tab-li-label">
207 Account Setup
208 </div>
209 </div>
210
211 </div>
212 </a>
213 </li>
214 </ul>
215 </div>
216 <?php
217 }
218
219 /**
220 * Function to display the tab content according to the current selected tab.
221 *
222 * @param string $active_tab Holds the current active tab.
223 * @return void
224 */
225 private function mo_epbr_display__tab_content( $active_tab ) {
226 $handler = self::get_view();
227 switch ( $active_tab ) {
228 case 'app_config':
229 $handler = appConfig::get_view();
230 break;
231
232 case 'pb_app_config':
233 $handler = powerBI::get_view();
234 break;
235
236 case 'settings_tab':
237 $handler = powerBIsettings::get_view();
238 break;
239
240 case 'integrations_tab':
241 $handler = integrations::get_view();
242 break;
243
244 case 'account_setup_tab':
245 $handler = accountSetup::get_view();
246 break;
247
248 }
249 $handler->mo_epbr_display__tab_details();
250 }
251
252 /**
253 * Function to show if any class is missing.
254 *
255 * @return void
256 */
257 private function mo_epbr_display__tab_details() {
258 esc_html_e( "Class missing. Please check if you've installed the plugin correctly.", 'embed-power-bi-reports' );
259 }
260 }
261