Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 110 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| OlzNotificationSubscriptionsForm | |
0.00% |
0 / 110 |
|
0.00% |
0 / 1 |
600 | |
0.00% |
0 / 1 |
| getHtml | |
0.00% |
0 / 110 |
|
0.00% |
0 / 1 |
600 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Apps\Newsletter\Components\OlzNotificationSubscriptionsForm; |
| 4 | |
| 5 | use Olz\Components\Common\OlzComponent; |
| 6 | use Olz\Entity\NotificationSubscription; |
| 7 | |
| 8 | /** @extends OlzComponent<array<string, mixed>> */ |
| 9 | class OlzNotificationSubscriptionsForm extends OlzComponent { |
| 10 | public function getHtml(mixed $args): string { |
| 11 | $subscriptions = $args['subscriptions']; |
| 12 | $out = ''; |
| 13 | |
| 14 | $daily_summary_checked = ''; |
| 15 | $deadline_warning_checked = ''; |
| 16 | $deadline_warning_1_selected = ''; |
| 17 | $deadline_warning_2_selected = ''; |
| 18 | $deadline_warning_3_selected = ' selected'; |
| 19 | $deadline_warning_7_selected = ''; |
| 20 | $monthly_preview_checked = ''; |
| 21 | $weekly_preview_checked = ''; |
| 22 | $weekly_summary_checked = ''; |
| 23 | $daily_summary_aktuell_checked = ''; |
| 24 | $daily_summary_blog_checked = ''; |
| 25 | $daily_summary_forum_checked = ''; |
| 26 | $daily_summary_galerie_checked = ''; |
| 27 | $daily_summary_termine_checked = ''; |
| 28 | $weekly_summary_aktuell_checked = ''; |
| 29 | $weekly_summary_blog_checked = ''; |
| 30 | $weekly_summary_forum_checked = ''; |
| 31 | $weekly_summary_galerie_checked = ''; |
| 32 | $weekly_summary_termine_checked = ''; |
| 33 | foreach ($subscriptions as $subscription) { |
| 34 | $notification_type = $subscription->getNotificationType(); |
| 35 | $args = json_decode($subscription->getNotificationTypeArgs(), true); |
| 36 | switch ($notification_type) { |
| 37 | case NotificationSubscription::TYPE_DAILY_SUMMARY: |
| 38 | $daily_summary_checked = ' checked'; |
| 39 | if ($args['aktuell'] ?? false) { |
| 40 | $daily_summary_aktuell_checked = ' checked'; |
| 41 | } |
| 42 | if ($args['blog'] ?? false) { |
| 43 | $daily_summary_blog_checked = ' checked'; |
| 44 | } |
| 45 | if ($args['forum'] ?? false) { |
| 46 | $daily_summary_forum_checked = ' checked'; |
| 47 | } |
| 48 | if ($args['galerie'] ?? false) { |
| 49 | $daily_summary_galerie_checked = ' checked'; |
| 50 | } |
| 51 | if ($args['termine'] ?? false) { |
| 52 | $daily_summary_termine_checked = ' checked'; |
| 53 | } |
| 54 | break; |
| 55 | case NotificationSubscription::TYPE_DEADLINE_WARNING: |
| 56 | $deadline_warning_checked = ' checked'; |
| 57 | switch (intval($args['days'] ?? 3)) { |
| 58 | case 1: |
| 59 | $deadline_warning_1_selected = ' selected'; |
| 60 | $deadline_warning_3_selected = ''; |
| 61 | break; |
| 62 | case 2: |
| 63 | $deadline_warning_2_selected = ' selected'; |
| 64 | $deadline_warning_3_selected = ''; |
| 65 | break; |
| 66 | case 3: |
| 67 | $deadline_warning_3_selected = ' selected'; |
| 68 | break; |
| 69 | case 7: |
| 70 | $deadline_warning_7_selected = ' selected'; |
| 71 | $deadline_warning_3_selected = ''; |
| 72 | break; |
| 73 | default: |
| 74 | break; |
| 75 | } |
| 76 | break; |
| 77 | case NotificationSubscription::TYPE_MONTHLY_PREVIEW: |
| 78 | $monthly_preview_checked = ' checked'; |
| 79 | break; |
| 80 | case NotificationSubscription::TYPE_WEEKLY_PREVIEW: |
| 81 | $weekly_preview_checked = ' checked'; |
| 82 | break; |
| 83 | case NotificationSubscription::TYPE_WEEKLY_SUMMARY: |
| 84 | $weekly_summary_checked = ' checked'; |
| 85 | if ($args['aktuell'] ?? false) { |
| 86 | $weekly_summary_aktuell_checked = ' checked'; |
| 87 | } |
| 88 | if ($args['blog'] ?? false) { |
| 89 | $weekly_summary_blog_checked = ' checked'; |
| 90 | } |
| 91 | if ($args['forum'] ?? false) { |
| 92 | $weekly_summary_forum_checked = ' checked'; |
| 93 | } |
| 94 | if ($args['galerie'] ?? false) { |
| 95 | $weekly_summary_galerie_checked = ' checked'; |
| 96 | } |
| 97 | if ($args['termine'] ?? false) { |
| 98 | $weekly_summary_termine_checked = ' checked'; |
| 99 | } |
| 100 | break; |
| 101 | default: |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | $is_disabled = $args['disabled'] ?? false; |
| 107 | $disabled_attribute = $is_disabled ? ' disabled' : ''; |
| 108 | |
| 109 | $out .= <<<ZZZZZZZZZZ |
| 110 | <p class='card-text'> |
| 111 | <input type='checkbox' name='monthly-preview'{$monthly_preview_checked}{$disabled_attribute} /> |
| 112 | Monatsvorschau |
| 113 | </p> |
| 114 | <p class='card-text'> |
| 115 | <input type='checkbox' name='weekly-preview'{$weekly_preview_checked}{$disabled_attribute} /> |
| 116 | Wochenvorschau |
| 117 | </p> |
| 118 | <p class='card-text'> |
| 119 | <input type='checkbox' name='deadline-warning'{$deadline_warning_checked}{$disabled_attribute} /> |
| 120 | Meldeschluss-Warnung |
| 121 | <select name='deadline-warning-days'{$disabled_attribute}> |
| 122 | <option{$deadline_warning_7_selected}>7</option> |
| 123 | <option{$deadline_warning_3_selected}>3</option> |
| 124 | <option{$deadline_warning_2_selected}>2</option> |
| 125 | <option{$deadline_warning_1_selected}>1</option> |
| 126 | </select> |
| 127 | Tage vorher |
| 128 | </p> |
| 129 | <p class='card-text'> |
| 130 | <input |
| 131 | type='checkbox' |
| 132 | name='daily-summary' |
| 133 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 134 | {$daily_summary_checked} |
| 135 | {$disabled_attribute} |
| 136 | /> |
| 137 | Tageszusammenfassung |
| 138 | <br /> |
| 139 | |
| 140 | <input |
| 141 | type='checkbox' |
| 142 | name='daily-summary-aktuell' |
| 143 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 144 | {$daily_summary_aktuell_checked} |
| 145 | {$disabled_attribute} |
| 146 | /> |
| 147 | Aktuell-Beiträge |
| 148 | <br /> |
| 149 | |
| 150 | <input |
| 151 | type='checkbox' |
| 152 | name='daily-summary-blog' |
| 153 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 154 | {$daily_summary_blog_checked} |
| 155 | {$disabled_attribute} |
| 156 | /> |
| 157 | Kaderblog |
| 158 | <br /> |
| 159 | |
| 160 | <input |
| 161 | type='checkbox' |
| 162 | name='daily-summary-forum' |
| 163 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 164 | {$daily_summary_forum_checked} |
| 165 | {$disabled_attribute} |
| 166 | /> |
| 167 | Forumseinträge |
| 168 | <br /> |
| 169 | |
| 170 | <input |
| 171 | type='checkbox' |
| 172 | name='daily-summary-galerie' |
| 173 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 174 | {$daily_summary_galerie_checked} |
| 175 | {$disabled_attribute} |
| 176 | /> |
| 177 | Neue Galerien |
| 178 | <br /> |
| 179 | |
| 180 | <input |
| 181 | type='checkbox' |
| 182 | name='daily-summary-termine' |
| 183 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 184 | {$daily_summary_termine_checked} |
| 185 | {$disabled_attribute} |
| 186 | /> |
| 187 | Relevante Termine-Änderungen |
| 188 | <div id='olz-notification-subscriptions-form-daily-summary-warn-message' class='alert alert-warning' role='alert'></div> |
| 189 | </p> |
| 190 | <p class='card-text'> |
| 191 | <input |
| 192 | type='checkbox' |
| 193 | name='weekly-summary' |
| 194 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 195 | {$weekly_summary_checked} |
| 196 | {$disabled_attribute} |
| 197 | /> |
| 198 | Wochenzusammenfassung |
| 199 | <br /> |
| 200 | |
| 201 | <input |
| 202 | type='checkbox' |
| 203 | name='weekly-summary-aktuell' |
| 204 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 205 | {$weekly_summary_aktuell_checked} |
| 206 | {$disabled_attribute} |
| 207 | /> |
| 208 | Aktuell-Beiträge |
| 209 | <br /> |
| 210 | |
| 211 | <input |
| 212 | type='checkbox' |
| 213 | name='weekly-summary-blog' |
| 214 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 215 | {$weekly_summary_blog_checked} |
| 216 | {$disabled_attribute} |
| 217 | /> |
| 218 | Kaderblog |
| 219 | <br /> |
| 220 | |
| 221 | <input |
| 222 | type='checkbox' |
| 223 | name='weekly-summary-forum' |
| 224 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 225 | {$weekly_summary_forum_checked} |
| 226 | {$disabled_attribute} |
| 227 | /> |
| 228 | Forumseinträge |
| 229 | <br /> |
| 230 | |
| 231 | <input |
| 232 | type='checkbox' |
| 233 | name='weekly-summary-galerie' |
| 234 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 235 | {$weekly_summary_galerie_checked} |
| 236 | {$disabled_attribute} |
| 237 | /> |
| 238 | Neue Galerien |
| 239 | <br /> |
| 240 | |
| 241 | <input |
| 242 | type='checkbox' |
| 243 | name='weekly-summary-termine' |
| 244 | onchange='olzNewsletter.olzNotificationSubscriptionsFormOnChange(this)' |
| 245 | {$weekly_summary_termine_checked} |
| 246 | {$disabled_attribute} |
| 247 | /> |
| 248 | Relevante Termine-Änderungen |
| 249 | <div id='olz-notification-subscriptions-form-weekly-summary-warn-message' class='alert alert-warning' role='alert'></div> |
| 250 | </p> |
| 251 | ZZZZZZZZZZ; |
| 252 | |
| 253 | return $out; |
| 254 | } |
| 255 | } |