| @@ -1,109 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -use AcyMailing\Helpers\CaptchaHelper; | |
| 4 | - | |
| 5 | -$listsContent = ''; | |
| 6 | -if (!empty($visibleLists)) { | |
| 7 | - $listsContent .= '<table class="acym_lists">'; | |
| 8 | - foreach ($visibleLists as $myListId) { | |
| 9 | - $check = ''; | |
| 10 | - if (in_array($myListId, $checkedLists)) { | |
| 11 | - $check = 'checked="checked"'; | |
| 12 | - } | |
| 13 | - | |
| 14 | - $listsContent .= ' | |
| 15 | - <tr> | |
| 16 | - <td> | |
| 17 | - <input type="checkbox" class="acym_checkbox" name="subscription[]" id="acylist_'.$myListId.'_'.$formName.'" '.$check.' value="'.$myListId.'"/> | |
| 18 | - <label for="acylist_'.$myListId.'_'.$formName.'">'.(!empty($allLists[$myListId]->display_name) ? $allLists[$myListId]->display_name | |
| 19 | - : $allLists[$myListId]->name).'</label> | |
| 20 | - </td> | |
| 21 | - </tr>'; | |
| 22 | - } | |
| 23 | - $listsContent .= '</table>'; | |
| 24 | -} | |
| 25 | -if ($listPosition == 'before') echo $listsContent; | |
| 26 | -?> | |
| 27 | - | |
| 28 | -<table class="acym_form"> | |
| 29 | - <tr> | |
| 30 | - <?php | |
| 31 | - foreach ($fields as $field) { | |
| 32 | - $field->option = !empty($field->option) ? json_decode($field->option) : new stdClass(); | |
| 33 | - $fieldDB = empty($field->option->fieldDB) ? '' : json_decode($field->option->fieldDB); | |
| 34 | - $field->value = empty($field->value) ? '' : json_decode($field->value); | |
| 35 | - $valuesArray = []; | |
| 36 | - if (!empty($field->value)) { | |
| 37 | - foreach ($field->value as $value) { | |
| 38 | - $valueTmp = new stdClass(); | |
| 39 | - $valueTmp->text = $value->title; | |
| 40 | - $valueTmp->value = $value->value; | |
| 41 | - if ($value->disabled == 'y') $valueTmp->disable = true; | |
| 42 | - $valuesArray[$value->value] = $valueTmp; | |
| 43 | - } | |
| 44 | - } | |
| 45 | - if (!empty($fieldDB) && !empty($fieldDB->value)) { | |
| 46 | - $fromDB = $fieldClass->getValueFromDB($fieldDB); | |
| 47 | - foreach ($fromDB as $value) { | |
| 48 | - $valuesArray[$value->value] = $value->title; | |
| 49 | - } | |
| 50 | - } | |
| 51 | - | |
| 52 | - echo '<td class="onefield acyfield_'.$field->id.' acyfield_'.$field->type.'">'; | |
| 53 | - echo $fieldClass->displayField($field, $field->default_value, $valuesArray, $displayOutside, true, $identifiedUser); | |
| 54 | - echo '</td>'; | |
| 55 | - if (!$displayInline) echo '</tr><tr>'; | |
| 56 | - | |
| 57 | - if ($field->id == 2 && $config->get('email_confirmation')) { | |
| 58 | - echo $fieldClass->setEmailConfirmationField($displayOutside, $field, 'td', $displayInline); | |
| 59 | - } | |
| 60 | - } | |
| 61 | - | |
| 62 | - if ($listPosition != 'before') { | |
| 63 | - echo '<td>'.$listsContent.'</td>'; | |
| 64 | - if (!$displayInline) echo '</tr><tr>'; | |
| 65 | - } | |
| 66 | - | |
| 67 | - if (empty($identifiedUser->id) && $config->get('captcha', 'none') !== 'none' && acym_level(ACYM_ESSENTIAL)) { | |
| 68 | - echo '<td class="captchakeymodule" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>'; | |
| 69 | - $captcha = new CaptchaHelper(); | |
| 70 | - echo $captcha->display($formName); | |
| 71 | - echo '</td>'; | |
| 72 | - if (!$displayInline) echo '</tr><tr>'; | |
| 73 | - } | |
| 74 | - | |
| 75 | - if (!empty($termslink)) { | |
| 76 | - echo '<td class="acyterms" '.($displayOutside && !$displayInline ? 'colspan="2"' : '').'>'; | |
| 77 | - echo '<input id="mailingdata_terms_'.$formName.'" class="checkbox" type="checkbox" name="terms" title="'.acym_translation('ACYM_TERMS_CONDITIONS').'"/> '.$termslink; | |
| 78 | - echo '</td>'; | |
| 79 | - if (!$displayInline) echo '</tr><tr>'; | |
| 80 | - } | |
| 81 | - ?> | |
| 82 | - | |
| 83 | - <td <?php if ($displayOutside && !$displayInline) echo 'colspan="2"'; ?> class="acysubbuttons"> | |
| 84 | - <noscript> | |
| 85 | - <?php echo acym_translation('ACYM_NO_JAVASCRIPT'); ?> | |
| 86 | - </noscript> | |
| 87 | - <?php | |
| 88 | - $onclickSubscribe = 'try{ return submitAcymForm("subscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}'; | |
| 89 | - $onclickUnsubscribe = 'try{ return submitAcymForm("unsubscribe","'.$formName.'"); }catch(err){alert("The form could not be submitted "+err);return false;}'; | |
| 90 | - if ($disableButtons) { | |
| 91 | - $onclickSubscribe = 'return false;'; | |
| 92 | - $onclickUnsubscribe = 'return false;'; | |
| 93 | - } | |
| 94 | - ?> | |
| 95 | - <button type="submit" | |
| 96 | - class="btn btn-primary button subbutton" | |
| 97 | - onclick="<?php echo acym_escape($onclickSubscribe); ?>"> | |
| 98 | - <?php echo acym_escape(acym_translation($subscribeText)); ?> | |
| 99 | - </button> | |
| 100 | - <?php if ($unsubButton === '2' || ($unsubButton === '1' && !empty($countUnsub))) { ?> | |
| 101 | - <button type="submit" | |
| 102 | - class="btn button unsubbutton" | |
| 103 | - onclick="<?php echo acym_escape($onclickUnsubscribe); ?>"> | |
| 104 | - <?php echo acym_escape(acym_translation($unsubscribeText)); ?> | |
| 105 | - </button> | |
| 106 | - <?php } ?> | |
| 107 | - </td> | |
| 108 | - </tr> | |
| 109 | -</table> | |