| @@ -8,8 +8,13 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | namespace MainWP\Dashboard; |
| 11 | 11 | |
| 12 | +// Exit if accessed directly. | |
| 13 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 14 | + exit; | |
| 15 | +} | |
| 16 | + | |
| 12 | 17 | /** |
| 13 | 18 | * Class MainWP_Client_Overview_Info |
| 14 | 19 | * |
| 15 | 20 | * Displays the Client info. |
| @@ -51,155 +56,143 @@ | ||
| 51 | 56 | ); |
| 52 | 57 | $client_info = MainWP_DB_Client::instance()->get_wp_client_by( 'client_id', $client_id, ARRAY_A, $params ); |
| 53 | 58 | $client_status = ''; |
| 54 | 59 | if ( 0 === intval( $client_info['suspended'] ) ) { |
| 55 | - $client_status = '<span class="ui green label">' . esc_html__( 'Active', 'mainwp' ) . '</span>'; | |
| 60 | + $client_status = '<span class="ui green basic button">' . esc_html__( 'Active', 'mainwp' ) . '</span>'; | |
| 56 | 61 | } elseif ( 1 === intval( $client_info['suspended'] ) ) { |
| 57 | - $client_status = '<span class="ui yellow label">' . esc_html__( 'Suspended', 'mainwp' ) . '</span>'; | |
| 62 | + $client_status = '<span class="ui yellow button">' . esc_html__( 'Suspended', 'mainwp' ) . '</span>'; | |
| 58 | 63 | } elseif ( 2 === intval( $client_info['suspended'] ) ) { |
| 59 | - $client_status = '<span class="ui blue label">' . esc_html__( 'Lead', 'mainwp' ) . '</span>'; | |
| 64 | + $client_status = '<span class="ui blue button">' . esc_html__( 'Lead', 'mainwp' ) . '</span>'; | |
| 60 | 65 | } elseif ( 3 === intval( $client_info['suspended'] ) ) { |
| 61 | - $client_status = '<span class="ui red label">' . esc_html__( 'Lost', 'mainwp' ) . '</span>'; | |
| 66 | + $client_status = '<span class="ui red button">' . esc_html__( 'Lost', 'mainwp' ) . '</span>'; | |
| 62 | 67 | } |
| 68 | + | |
| 69 | + $client_contacts = MainWP_DB_Client::instance()->get_wp_client_contact_by( 'client_id', $client_id, ARRAY_A ); // phpcs:ignore WordPress.Security.NonceVerification,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 70 | + | |
| 63 | 71 | ?> |
| 64 | 72 | <div class="mainwp-widget-header"> |
| 65 | - <h3 class="ui header handle-drag"> | |
| 66 | - <?php echo esc_html( $client_info['name'] ); ?> <?php echo $client_status; //phpcs:ignore -- ok. ?> | |
| 67 | - <div class="ui hidden divider"></div> | |
| 68 | - <div class="sub header"> | |
| 69 | - <?php echo MainWP_System_Utility::get_site_tags( $client_info, true ); // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 73 | + <div class="ui grid"> | |
| 74 | + <div class="twelve wide column"> | |
| 75 | + <h2 class="ui header handle-drag"> | |
| 76 | + <?php echo esc_html__( 'Client Info', 'mainwp' ); ?> | |
| 77 | + </h2> | |
| 70 | 78 | </div> |
| 71 | - </h3> | |
| 79 | + <div class="four wide right aligned column"> | |
| 80 | + | |
| 81 | + </div> | |
| 82 | + </div> | |
| 72 | 83 | </div> |
| 73 | 84 | |
| 74 | 85 | <div class="mainwp-widget-client-card mainwp-scrolly-overflow" client-id="<?php echo intval( $client_id ); ?>"> |
| 75 | - <?php | |
| 76 | - /** | |
| 77 | - * Actoin: mainwp_clients_overview_overview_widget_top | |
| 78 | - * | |
| 79 | - * Fires at the top of the Site Info widget on the Individual site overview page. | |
| 80 | - * | |
| 81 | - * @param object $client_info Object containing the child site info. | |
| 82 | - * | |
| 83 | - * @since 4.0 | |
| 84 | - */ | |
| 85 | - do_action( 'mainwp_clients_overview_overview_widget_top', $client_info ); | |
| 86 | - ?> | |
| 87 | - <?php | |
| 88 | - if ( $client_info ) { | |
| 89 | - $selected_sites = isset( $client_info['selected_sites'] ) ? trim( $client_info['selected_sites'] ) : ''; | |
| 90 | - ?> | |
| 91 | - <div class="ui stackable grid"> | |
| 92 | - <div class="four wide middle aligned column"> | |
| 93 | - <?php | |
| 94 | - $client_display_image = MainWP_Client_Handler::get_client_contact_image( $client_info, 'client', 'card' ); | |
| 95 | - echo $client_display_image; //phpcs:ignore -- ok. | |
| 96 | - ?> | |
| 86 | + <?php | |
| 87 | + /** | |
| 88 | + * Actoin: mainwp_clients_overview_overview_widget_top | |
| 89 | + * | |
| 90 | + * Fires at the top of the Site Info widget on the Individual site overview page. | |
| 91 | + * | |
| 92 | + * @param object $client_info Object containing the child site info. | |
| 93 | + * | |
| 94 | + * @since 4.0 | |
| 95 | + */ | |
| 96 | + do_action( 'mainwp_clients_overview_overview_widget_top', $client_info ); | |
| 97 | + ?> | |
| 98 | + <?php if ( $client_info ) : ?> | |
| 99 | + <?php $selected_sites = isset( $client_info['selected_sites'] ) ? trim( $client_info['selected_sites'] ) : ''; ?> | |
| 100 | + <div class="ui grid"> | |
| 101 | + <div class="sixteen wide center aligned column"> | |
| 102 | + <div class="ui image"> | |
| 103 | + <?php echo MainWP_Client_Handler::get_client_contact_image( $client_info, 'client', 'small' ); //phpcs:ignore -- ok. ?> | |
| 97 | 104 | </div> |
| 98 | - <div class="twelve wide middle aligned column"> | |
| 99 | - <div class="ui relaxed list"> | |
| 100 | - <?php if ( isset( $client_info['client_email'] ) && '' !== $client_info['client_email'] ) : ?> | |
| 101 | - <div class="item"> | |
| 102 | - <i class="envelope grey icon"></i> | |
| 103 | - <div class="content"><a href="mailto:<?php echo esc_url( $client_info['client_email'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_email'] ); ?></a> <i data-clipboard-text="<?php echo esc_html( $client_info['client_email'] ); ?>" style="cursor:pointer" class="copy green icon copy-to-clipboard"></i></div> | |
| 104 | - </div> | |
| 105 | - <?php endif; ?> | |
| 106 | - <?php if ( isset( $client_info['client_phone'] ) && '' !== $client_info['client_phone'] ) : ?> | |
| 107 | - <div class="item"> | |
| 108 | - <i class="phone grey rotated icon"></i> | |
| 109 | - <div class="content"><a href="tel:<?php echo esc_url( $client_info['client_phone'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_phone'] ); ?></a></div> | |
| 110 | - </div> | |
| 111 | - <?php endif; ?> | |
| 112 | - <?php if ( isset( $client_info['client_facebook'] ) && '' !== $client_info['client_facebook'] ) : ?> | |
| 113 | - <div class="item"> | |
| 114 | - <i class="facebook grey icon"></i> | |
| 115 | - <div class="content"><a href="<?php echo esc_url( $client_info['client_facebook'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_facebook'] ); ?></a></div> | |
| 116 | - </div> | |
| 117 | - <?php endif; ?> | |
| 118 | - <?php if ( isset( $client_info['client_twitter'] ) && '' !== $client_info['client_twitter'] ) : ?> | |
| 119 | - <div class="item"> | |
| 120 | - <i class="twitter grey icon"></i> | |
| 121 | - <div class="content"><a href="<?php echo esc_url( $client_info['client_twitter'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_twitter'] ); ?></a></div> | |
| 122 | - </div> | |
| 123 | - <?php endif; ?> | |
| 124 | - <?php if ( isset( $client_info['client_instagram'] ) && '' !== $client_info['client_instagram'] ) : ?> | |
| 125 | - <div class="item"> | |
| 126 | - <i class="instagram grey icon"></i> | |
| 127 | - <div class="content"><a href="<?php echo esc_url( $client_info['client_instagram'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_instagram'] ); ?></a></div> | |
| 128 | - </div> | |
| 129 | - <?php endif; ?> | |
| 130 | - <?php if ( isset( $client_info['client_linkedin'] ) && '' !== $client_info['client_linkedin'] ) : ?> | |
| 131 | - <div class="item"> | |
| 132 | - <i class="linkedin grey icon"></i> | |
| 133 | - <div class="content"><a href="<?php echo esc_url( $client_info['client_linkedin'] ); ?>" target="_blank"><?php echo esc_html( $client_info['client_linkedin'] ); ?></a></div> | |
| 134 | - </div> | |
| 135 | - <?php endif; ?> | |
| 136 | - <?php if ( ( isset( $client_info['address_1'] ) && '' !== $client_info['address_1'] ) || ( isset( $client_info['address_2'] ) && '' !== $client_info['address_2'] ) || ( isset( $client_info['city'] ) && '' !== $client_info['city'] ) || ( isset( $client_info['state'] ) && '' !== $client_info['state'] ) || ( isset( $client_info['zip'] ) && '' !== $client_info['zip'] ) || ( isset( $client_info['country'] ) && '' !== $client_info['country'] ) ) : ?> | |
| 137 | - <div class="item"> | |
| 138 | - <i class="map marker grey icon"></i> | |
| 139 | - <div class="content"> | |
| 140 | - <?php if ( isset( $client_info['address_1'] ) && '' !== $client_info['address_1'] ) : ?> | |
| 141 | - <?php echo esc_html( $client_info['address_1'] ); ?> | |
| 142 | - <?php endif; ?> | |
| 143 | - <?php if ( isset( $client_info['address_2'] ) && '' !== $client_info['address_2'] ) : ?> | |
| 144 | - <?php echo esc_html( $client_info['address_2'] ); ?> | |
| 145 | - <?php endif; ?> | |
| 146 | - <?php if ( isset( $client_info['city'] ) && '' !== $client_info['city'] ) : ?> | |
| 147 | - <?php echo esc_html( $client_info['city'] ); ?> | |
| 148 | - <?php endif; ?> | |
| 149 | - <?php if ( isset( $client_info['zip'] ) && '' !== $client_info['zip'] ) : ?> | |
| 150 | - <?php echo esc_html( $client_info['zip'] ); ?> | |
| 151 | - <?php endif; ?> | |
| 152 | - <?php if ( isset( $client_info['state'] ) && '' !== $client_info['state'] ) : ?> | |
| 153 | - <?php echo esc_html( $client_info['state'] ); ?> | |
| 154 | - <?php endif; ?> | |
| 155 | - <?php if ( isset( $client_info['country'] ) && '' !== $client_info['country'] ) : ?> | |
| 156 | - <?php echo esc_html( $client_info['country'] ); ?> | |
| 157 | - <?php endif; ?> | |
| 158 | - </div> | |
| 159 | - </div> | |
| 160 | - <?php endif; ?> | |
| 105 | + </div> | |
| 106 | + <div class="sixteen wide center aligned column"> | |
| 107 | + <h2 class="ui center aligned header"> | |
| 108 | + <div class="content"> | |
| 109 | + <?php echo esc_html( $client_info['name'] ); ?> | |
| 161 | 110 | <?php if ( isset( $client_info['created'] ) && ! empty( $client_info['created'] ) ) : ?> |
| 162 | - <div class="item"> | |
| 163 | - <i class="calendar icon"></i> | |
| 164 | - <div class="content"><?php echo esc_html( MainWP_Utility::format_date( $client_info['created'] ) ); ?></div> | |
| 111 | + <div class="sub header"> | |
| 112 | + <i class="calendar grey icon"></i> <?php esc_html_e( 'Added ', 'mainwp' ); ?><span data-tooltip="<?php esc_attr_e( MainWP_Utility::format_date( $client_info['created'] ) ); ?>" data-inverted="" data-position="top center"><?php echo MainWP_Utility::time_elapsed_string( $client_info['created'] ); //phpcs:ignore -- ok. ?></span>. | |
| 165 | 113 | </div> |
| 166 | 114 | <?php endif; ?> |
| 167 | - </div> | |
| 115 | + </div> | |
| 116 | + </h2> | |
| 168 | 117 | </div> |
| 118 | + <div class="sixteen wide center aligned column"> | |
| 119 | + <?php echo $client_status; //phpcs:ignore -- ok. ?> | |
| 120 | + </div> | |
| 121 | + | |
| 122 | + <div class="sixteen wide center aligned column"> | |
| 123 | + <?php if ( isset( $client_info['client_email'] ) && '' !== $client_info['client_email'] ) : ?> | |
| 124 | + <a href="mailto:<?php echo esc_attr( $client_info['client_email'] ); ?>" class="ui basic icon button" target="_blank" data-tooltip="<?php echo esc_attr( $client_info['client_email'] ); ?>" data-inverted="" data-position="top center"> | |
| 125 | + <i class="envelope grey icon"></i> | |
| 126 | + </a> | |
| 127 | + <?php endif; ?> | |
| 128 | + <?php if ( isset( $client_info['client_phone'] ) && '' !== $client_info['client_phone'] ) : ?> | |
| 129 | + <a href="tel:<?php echo esc_attr( $client_info['client_phone'] ); ?>" class="ui basic icon button" target="_blank" data-tooltip="<?php echo esc_attr( $client_info['client_phone'] ); ?>" data-inverted="" data-position="top center"> | |
| 130 | + <i class="phone grey icon"></i> | |
| 131 | + </a> | |
| 132 | + <?php endif; ?> | |
| 133 | + | |
| 134 | + | |
| 135 | + <?php if ( isset( $client_info['client_facebook'] ) && '' !== $client_info['client_facebook'] ) : ?> | |
| 136 | + <a href="<?php echo esc_url( $client_info['client_facebook'] ); ?>" class="ui basic icon button" target="_blank"><i class="facebook grey icon"></i></a> | |
| 137 | + <?php endif; ?> | |
| 138 | + <?php if ( isset( $client_info['client_twitter'] ) && '' !== $client_info['client_twitter'] ) : ?> | |
| 139 | + <a href="<?php echo esc_url( $client_info['client_twitter'] ); ?>" class="ui basic icon button" target="_blank"><i class="twitter grey icon"></i></a> | |
| 140 | + <?php endif; ?> | |
| 141 | + <?php if ( isset( $client_info['client_instagram'] ) && '' !== $client_info['client_instagram'] ) : ?> | |
| 142 | + <a href="<?php echo esc_url( $client_info['client_instagram'] ); ?>" class="ui basic icon button" target="_blank"><i class="instagram grey icon"></i></a> | |
| 143 | + <?php endif; ?> | |
| 144 | + <?php if ( isset( $client_info['client_linkedin'] ) && '' !== $client_info['client_linkedin'] ) : ?> | |
| 145 | + <a href="<?php echo esc_url( $client_info['client_linkedin'] ); ?>" class="ui basic icon button" target="_blank"><i class="linkedin grey icon"></i></a> | |
| 146 | + <?php endif; ?> | |
| 147 | + </div> | |
| 169 | 148 | </div> |
| 170 | - <script type="text/javascript"> | |
| 171 | - jQuery( document ).ready( function ($) { | |
| 172 | - new ClipboardJS('.copy-to-clipboard'); | |
| 173 | - } ); | |
| 174 | - </script> | |
| 175 | - <?php } ?> | |
| 176 | - <?php | |
| 177 | - /** | |
| 178 | - * Action: mainwp_clients_overview_overview_widget_bottom | |
| 179 | - * | |
| 180 | - * Fires at the bottom of the Site Info widget on the Individual site overview page. | |
| 181 | - * | |
| 182 | - * @param object $client_info Object containing the child site info. | |
| 183 | - * | |
| 184 | - * @since 4.0 | |
| 185 | - */ | |
| 186 | - do_action( 'mainwp_clients_overview_overview_widget_bottom', $client_info ); | |
| 149 | + <?php endif; ?> | |
| 150 | + <?php if ( $client_contacts ) : ?> | |
| 151 | + <div class="ui divider"></div> | |
| 152 | + <?php foreach ( $client_contacts as $contact ) : ?> | |
| 153 | + <h2 class="ui header"> | |
| 154 | + <?php echo MainWP_Client_Handler::get_client_contact_image( $contact, 'contact', 'small' ); //phpcs:ignore -- ok. ?> | |
| 155 | + <div class="content"> | |
| 156 | + <?php echo esc_html( $contact['contact_name'] ); ?> | |
| 157 | + <div class="sub header"><?php echo esc_html( $contact['contact_role'] ); ?></div> | |
| 158 | + </div> | |
| 159 | + </h2> | |
| 160 | + <?php endforeach; ?> | |
| 161 | + <?php endif; ?> | |
| 162 | + | |
| 163 | + <?php | |
| 164 | + /** | |
| 165 | + * Action: mainwp_clients_overview_overview_widget_bottom | |
| 166 | + * | |
| 167 | + * Fires at the bottom of the Site Info widget on the Individual site overview page. | |
| 168 | + * | |
| 169 | + * @param object $client_info Object containing the child site info. | |
| 170 | + * | |
| 171 | + * @since 4.0 | |
| 172 | + */ | |
| 173 | + do_action( 'mainwp_clients_overview_overview_widget_bottom', $client_info ); | |
| 174 | + ?> | |
| 175 | + </div> | |
| 176 | + <div class="mainwp-widget-footer" client-id="<?php echo intval( $client_id ); ?>"> | |
| 177 | + <a href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $client_id ); ?>" class="ui green mini button"><?php esc_html_e( 'Edit Client', 'mainwp' ); ?></a> | |
| 178 | + <?php if ( 0 === intval( $client_info['suspended'] ) || 1 === intval( $client_info['suspended'] ) ) : ?> | |
| 179 | + <a href="javascript:void(0);" suspend-status="<?php echo intval( $client_info['suspended'] ); ?>" class="ui basic mini button client-suspend-unsuspend-sites"><?php echo empty( $client_info['suspended'] ) ? esc_html__( 'Suspend', 'mainwp' ) : esc_html__( 'Unsuspend', 'mainwp' ); ?></a> | |
| 180 | + <?php endif; ?> | |
| 181 | + <?php | |
| 182 | + if ( is_plugin_active( 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php' ) ) { | |
| 183 | + $report_url = add_query_arg( | |
| 184 | + array( | |
| 185 | + 'page' => 'Extensions-Mainwp-Pro-Reports-Extension', | |
| 186 | + 'tab' => 'report', | |
| 187 | + 'action' => 'newreport', | |
| 188 | + 'selected_sites' => $selected_sites, | |
| 189 | + ), | |
| 190 | + 'admin.php' | |
| 191 | + ); | |
| 187 | 192 | ?> |
| 188 | - </div> | |
| 189 | - <div class="mainwp-widget-footer ui four columns stackable grid" client-id="<?php echo intval( $client_id ); ?>"> | |
| 190 | - <div class="column"><a href="admin.php?page=ClientAddNew&client_id=<?php echo intval( $client_id ); ?>" title="" class="ui button mini fluid green"><?php echo esc_html__( 'Edit Client', 'mainwp' ); ?></a></div> | |
| 191 | - <div class="column"><a class="ui green basic mini fluid button" href="admin.php?page=managesites&client=<?php echo intval( $client_id ); ?>"><?php esc_html_e( 'Manage Sites', 'mainwp' ); ?></a></div> | |
| 192 | - <div class="column"> | |
| 193 | - <?php if ( is_plugin_active( 'mainwp-pro-reports-extension/mainwp-pro-reports-extension.php' ) ) { ?> | |
| 194 | - <a class="ui green basic mini fluid button" href="admin.php?page=Extensions-Mainwp-Pro-Reports-Extension&tab=report&action=newreport&selected_sites=<?php echo esc_html( $selected_sites ); ?>"><?php esc_html_e( 'Create Report', 'mainwp' ); ?></a> | |
| 195 | - <?php } ?> | |
| 196 | - </div> | |
| 197 | - <div class="column"> | |
| 198 | - <?php if ( 0 === intval( $client_info['suspended'] ) || 1 === intval( $client_info['suspended'] ) ) : ?> | |
| 199 | - <a href="javascript:void(0);" suspend-status="<?php echo intval( $client_info['suspended'] ); ?>" title="" class="ui mini fluid button client-suspend-unsuspend-sites"><?php echo empty( $client_info['suspended'] ) ? esc_html__( 'Suspend Sites', 'mainwp' ) : esc_html__( 'Unsuspend Sites', 'mainwp' ); ?></a> | |
| 200 | - <?php endif; ?> | |
| 201 | - </div> | |
| 193 | + <a class="ui basic mini right floated button" href="<?php echo esc_url( $report_url ); ?>"><?php echo esc_html__( 'Create Report', 'mainwp' ); ?></a> | |
| 194 | + <?php } ?> | |
| 202 | 195 | </div> |
| 203 | 196 | <?php |
| 204 | 197 | } |
| 205 | 198 | } |