| @@ -28,9 +28,9 @@ | ||
| 28 | 28 | $numberOfUsers = $usersClass->getCountTotalUsers(); |
| 29 | 29 | |
| 30 | 30 | $data = [ |
| 31 | 31 | 'page_title' => true, |
| 32 | - 'mail_filter' => '', | |
| 32 | + 'mail_filter_options' => [], | |
| 33 | 33 | 'stats_export' => '', |
| 34 | 34 | 'selectedMailid' => '', |
| 35 | 35 | 'show_date_filters' => false, |
| 36 | 36 | 'campaignsScheduled' => $campaignClass->getCampaignForDashboard(), |
| @@ -120,9 +120,8 @@ | ||
| 120 | 120 | $this->getMainLists($data); |
| 121 | 121 | |
| 122 | 122 | $statsController->prepareOpenTimeChart($data); |
| 123 | 123 | $statsController->preparecharts($data); |
| 124 | - $statsController->prepareDefaultRoundCharts($data); | |
| 125 | 124 | $statsController->prepareDefaultLineChart($data); |
| 126 | 125 | $statsController->prepareDefaultDevicesChart($data); |
| 127 | 126 | $statsController->prepareDefaultBrowsersChart($data); |
| 128 | 127 | |
| @@ -132,29 +131,16 @@ | ||
| 132 | 131 | $data['newSubscribers'] = $statsEvolution->totalNewSubscribersEvolution ?? 0; |
| 133 | 132 | parent::display($data); |
| 134 | 133 | } |
| 135 | 134 | |
| 136 | - private function doDisplayBeginnerSteps(array $data): void | |
| 137 | - { | |
| 138 | - if ($this->config->get('install_date', time()) < strtotime('-14 days')) { | |
| 139 | - $this->config->save(['show_beginner_steps' => 0]); | |
| 140 | - } elseif (!$data['listCreated'] || $data['totalSubscribers'] <= 1 || !$data['campaignCreated'] || !$data['campaignSent'] || $data['mailStatsCheckedOnce'] != 1) { | |
| 141 | - $this->config->save(['show_beginner_steps' => 1]); | |
| 142 | - } else { | |
| 143 | - $this->config->save(['show_beginner_steps' => 0]); | |
| 144 | - } | |
| 145 | - } | |
| 146 | - | |
| 147 | 135 | public function getDashboardNotifications(array &$data): void |
| 148 | 136 | { |
| 149 | - $data['dashboardNotifications'] = ''; | |
| 137 | + $data['dashboardNotifications'] = []; | |
| 150 | 138 | |
| 151 | 139 | if (empty($data['notifications'])) { |
| 152 | 140 | return; |
| 153 | 141 | } |
| 154 | 142 | |
| 155 | - $data['dashboardNotifications'] = '<div class="acym__dashboard__notifications">'; | |
| 156 | - | |
| 157 | 143 | $notifications = array_map(fn($notif) => is_array($notif) ? (object)$notif : $notif, $data['notifications']); |
| 158 | 144 | $notifications = array_filter($notifications, fn($notif) => isset($notif->message, $notif->level, $notif->date)); |
| 159 | 145 | |
| 160 | 146 | foreach ($notifications as $notif) { |
| @@ -161,38 +147,29 @@ | ||
| 161 | 147 | if ($notif->level === 'info') { |
| 162 | 148 | continue; |
| 163 | 149 | } |
| 164 | 150 | |
| 165 | - $fullMessageHover = $notif->message ?? ''; | |
| 151 | + $data['dashboardNotifications'][] = [ | |
| 152 | + 'level' => $notif->level, | |
| 153 | + 'message' => $notif->message, | |
| 154 | + 'date' => acym_date($notif->date ?? 'now', 'Y-m-d H:i:s', false), | |
| 155 | + 'removable' => !isset($notif->removable) || $notif->removable != 0, | |
| 156 | + 'name' => $notif->name, | |
| 157 | + ]; | |
| 158 | + } | |
| 159 | + } | |
| 166 | 160 | |
| 167 | - $fullMessageHover = ($fullMessageHover !== $notif->message) | |
| 168 | - ? 'data-acym-full="'.acym_escape($fullMessageHover).'"' | |
| 169 | - : ''; | |
| 170 | - | |
| 171 | - $logo = ($notif->level === 'warning') | |
| 172 | - ? 'acymicon-exclamation-triangle' | |
| 173 | - : 'acymicon-exclamation-circle'; | |
| 174 | - | |
| 175 | - $date = acym_date($notif->date ?? 'now', 'Y-m-d H:i:s', false); | |
| 176 | - | |
| 177 | - $data['dashboardNotifications'] .= '<div class="cell grid-x acym__dashboard__notification acym__dashboard__notification__'.$notif->level.'">' | |
| 178 | - .'<div class="cell shrink small-1 align-center grid-x acym__dashboard__notification__icon"><i class="cell shrink '.$logo.'"></i></div>' | |
| 179 | - .'<div class="cell grid-x small-10"><p class="cell acym__dashboard__notification__message" '.$fullMessageHover.'>'.$notif->message | |
| 180 | - .'<div class="cell acym__dashboard__notification__date">'.$date.'</div></div>'; | |
| 181 | - | |
| 182 | - if (!isset($notif->removable) || $notif->removable != 0) { | |
| 183 | - $data['dashboardNotifications'] .= '<i class="cell shrink small-1 acym__dashboard__notification__delete acymicon-close" data-id="'.acym_escape( | |
| 184 | - $notif->name | |
| 185 | - ).'"></i>'; | |
| 186 | - } | |
| 187 | - | |
| 188 | - $data['dashboardNotifications'] .= '</div><span class="acym__dashboard__light__separator separator"></span>'; | |
| 161 | + private function doDisplayBeginnerSteps(array $data): void | |
| 162 | + { | |
| 163 | + if ($this->config->get('install_date', time()) < strtotime('-14 days')) { | |
| 164 | + $this->config->saveConfig(['show_beginner_steps' => 0]); | |
| 165 | + } elseif (!$data['listCreated'] || $data['totalSubscribers'] <= 1 || !$data['campaignCreated'] || !$data['campaignSent'] || $data['mailStatsCheckedOnce'] != 1) { | |
| 166 | + $this->config->saveConfig(['show_beginner_steps' => 1]); | |
| 167 | + } else { | |
| 168 | + $this->config->saveConfig(['show_beginner_steps' => 0]); | |
| 189 | 169 | } |
| 190 | - | |
| 191 | - $data['dashboardNotifications'] .= '</div>'; | |
| 192 | 170 | } |
| 193 | 171 | |
| 194 | - | |
| 195 | 172 | private function prepareStatsView(array &$data): void |
| 196 | 173 | { |
| 197 | 174 | $data['stats'] = [ |
| 198 | 175 | 'ACYM_SUBSCRIBERS' => [ |
| @@ -217,9 +194,9 @@ | ||
| 217 | 194 | ], |
| 218 | 195 | ]; |
| 219 | 196 | } |
| 220 | 197 | |
| 221 | - public function getCurrentCampaigns(array &$data): void | |
| 198 | + private function getCurrentCampaigns(array &$data): void | |
| 222 | 199 | { |
| 223 | 200 | $queueClass = new QueueClass(); |
| 224 | 201 | $campaignsPerPage = 3; |
| 225 | 202 | $activeCampaigns = $queueClass->getMatchingCampaigns( |
| @@ -238,9 +215,9 @@ | ||
| 238 | 215 | ); |
| 239 | 216 | $data['campaigns'] = array_merge($pausedCampaigns['elements'], $activeCampaigns['elements']); |
| 240 | 217 | } |
| 241 | 218 | |
| 242 | - public function getLastTwoCampaigns(array &$data): void | |
| 219 | + private function getLastTwoCampaigns(array &$data): void | |
| 243 | 220 | { |
| 244 | 221 | $campaignsPerPage = 2; |
| 245 | 222 | $campaignClass = new CampaignClass(); |
| 246 | 223 | $lastTwoCampaigns = $campaignClass->getMatchingElements( |
| @@ -255,9 +232,9 @@ | ||
| 255 | 232 | |
| 256 | 233 | $data['recent_campaigns'] = $lastTwoCampaigns['elements']; |
| 257 | 234 | } |
| 258 | 235 | |
| 259 | - public function getMainLists(array &$data): void | |
| 236 | + private function getMainLists(array &$data): void | |
| 260 | 237 | { |
| 261 | 238 | $listClass = new ListClass(); |
| 262 | 239 | $listPerPage = 5; |
| 263 | 240 | $mainLists = $listClass->getMatchingElements( |
| @@ -271,9 +248,9 @@ | ||
| 271 | 248 | |
| 272 | 249 | $data['main_lists'] = $mainLists['elements']; |
| 273 | 250 | } |
| 274 | 251 | |
| 275 | - public function getUsersCount(array &$data): void | |
| 252 | + private function getUsersCount(array &$data): void | |
| 276 | 253 | { |
| 277 | 254 | $userClass = new UserClass(); |
| 278 | 255 | $matchingUsers = $userClass->getMatchingElements( |
| 279 | 256 | [ |