PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 5.2.1
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v5.2.1
6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 3.6.66 All 195 releases
fluentform / app / Modules / DashboardWidgetModule.php

DashboardWidgetModule.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 5.2.1, at app/Modules/DashboardWidgetModule.php

118 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Modules;
4
5 use FluentForm\App\Helpers\Helper;
6 use FluentForm\App\Models\Submission;
7
8 class DashboardWidgetModule
9 {
10 public function showStat()
11 {
12 global $wpdb;
13 $stats = Submission::select([
14 'fluentform_forms.title',
15 'fluentform_submissions.form_id',
16 wpFluent()->raw('count(' . $wpdb->prefix . 'fluentform_submissions.id) as total'),
17 wpFluent()->raw('max(' . $wpdb->prefix . 'fluentform_submissions.id) as max_id'),
18 ])
19 ->orderBy('max_id', 'DESC')
20 ->groupBy('fluentform_submissions.form_id')
21 ->join('fluentform_forms', 'fluentform_forms.id', '=', 'fluentform_submissions.form_id')
22 ->limit(10)
23 ->get();
24
25 if (!$stats) {
26 echo 'You can see your submission stats here';
27 return;
28 }
29
30 foreach ($stats as $stat) {
31 $stat->unreadCount = Helper::unreadCount($stat->form_id);
32 }
33
34 $this->printStats($stats);
35 return;
36 }
37
38 private function printStats($stats)
39 {
40 ?>
41 <ul class="ff_dashboard_stats">
42 <?php foreach ($stats as $stat): ?>
43 <li>
44 <a
45 href="<?php echo esc_url(admin_url('admin.php?page=fluent_forms&route=entries&form_id=' . $stat->form_id)); ?>">
46 <?php echo esc_html($stat->title); ?>
47 <span class="ff_total"><?php echo esc_attr($stat->unreadCount); ?>/<?php echo esc_attr($stat->total); ?></span>
48 </a>
49 </li>
50 <?php endforeach; ?>
51 </ul>
52 <?php if (!defined('FLUENTCRM') && !defined('FLUENTFORMPRO')) : ?>
53 <div class="ff_recommended_plugin">
54 Recommended Plugin: <b>FluentCRM - Email Marketing Automation For WordPress</b> <br />
55 <a
56 href="<?php echo esc_url($this->getInstallUrl('fluent-crm')); ?>">Install</a>
57 | <a target="_blank" rel="noopener" href="https://wordpress.org/plugins/fluent-crm/">Learn More</a>
58 </div>
59 <?php endif; ?>
60 <style>
61 ul.ff_dashboard_stats {
62 margin: 0;
63 padding: 0;
64 list-style: none;
65 }
66
67 ul.ff_dashboard_stats li {
68 padding: 8px 12px;
69 border-bottom: 1px solid #eeeeee;
70 margin: 0 -12px;
71 cursor: pointer;
72 }
73
74 ul.ff_dashboard_stats li:hover {
75 background: #fafafa;
76 border-bottom: 1px solid #eeeeee;
77 }
78
79 ul.ff_dashboard_stats li:hover a {
80 color: black;
81 }
82
83 ul.ff_dashboard_stats li:nth-child(2n+2) {
84 background: #f9f9f9;
85 }
86
87 ul.ff_dashboard_stats li span.ff_total {
88 float: right;
89 }
90
91 ul.ff_dashboard_stats li a {
92 display: block;
93 color: #0073aa;
94 font-weight: 500;
95 font-size: 105%;
96 }
97
98 .ff_recommended_plugin {
99 padding: 15px 0px 0px;
100 }
101
102 .ff_recommended_plugin a {
103 font-weight: bold;
104 font-size: 110%;
105 }
106 </style>
107 <?php
108 }
109
110 private function getInstallUrl($plugin)
111 {
112 return wp_nonce_url(
113 self_admin_url('update.php?action=install-plugin&plugin=' . $plugin),
114 'install-plugin_' . $plugin
115 );
116 }
117 }
118