| @@ -1,122 +1,0 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | -function acym_modal($button, $data, $id = null, $attributesModal = '', $attributesButton = '', $isButton = true, $isLarge = true, $classesModal = ''): string | |
| 4 | -{ | |
| 5 | - if (empty($id)) { | |
| 6 | - $id = 'acymodal_'.rand(1000, 9000); | |
| 7 | - } | |
| 8 | - | |
| 9 | - $buttonParams = ''; | |
| 10 | - if (is_array($attributesButton)) { | |
| 11 | - foreach ($attributesButton as $oneAttribute => $oneValue) { | |
| 12 | - $buttonParams .= ' '.$oneAttribute.'="'.acym_escape($oneValue).'"'; | |
| 13 | - } | |
| 14 | - } else { | |
| 15 | - $buttonParams = $attributesButton; | |
| 16 | - } | |
| 17 | - | |
| 18 | - $modal = $isButton ? '<button type="button" data-open="'.$id.'" '.$buttonParams.'>'.$button.'</button>' : $button; | |
| 19 | - $modal .= '<div class="reveal '.$classesModal.'" '.($isLarge ? 'data-reveal-larger' : '').' id="'.$id.'" '.$attributesModal.' data-reveal>'; | |
| 20 | - $modal .= $data; | |
| 21 | - $modal .= '<button class="close-button" data-close aria-label="Close reveal" type="button">'; | |
| 22 | - $modal .= '<span aria-hidden="true">×</span>'; | |
| 23 | - $modal .= '</button></div>'; | |
| 24 | - | |
| 25 | - return $modal; | |
| 26 | -} | |
| 27 | - | |
| 28 | -function acym_modal_include($button, $file, $id, $data, $attributes = '', $classModal = '', $containerAttributes = '') | |
| 29 | -{ | |
| 30 | - return acym_modalInclude($button, $file, $id, $data, $attributes = '', $classModal = '', $containerAttributes = ''); | |
| 31 | -} | |
| 32 | - | |
| 33 | -function acym_modalInclude($button, $file, $id, $data, $attributes = '', $classModal = '', $containerAttributes = '') | |
| 34 | -{ | |
| 35 | - if (empty($id)) { | |
| 36 | - $id = 'acymodal_'.rand(1000, 9000); | |
| 37 | - } | |
| 38 | - | |
| 39 | - $dataModal = $data; | |
| 40 | - | |
| 41 | - $modal = '<div data-open="'.acym_escape($id).'" '.$containerAttributes.'>'.$button; | |
| 42 | - $modal .= '<div class="reveal '.$classModal.'" id="'.acym_escape($id).'" '.$attributes.' data-reveal>'; | |
| 43 | - ob_start(); | |
| 44 | - include $file; | |
| 45 | - $modal .= ob_get_clean(); | |
| 46 | - $modal .= '<button type="button" class="close-button" data-close aria-label="Close reveal">'; | |
| 47 | - $modal .= '<span aria-hidden="true">×</span>'; | |
| 48 | - $modal .= '</button></div></div>'; | |
| 49 | - | |
| 50 | - return $modal; | |
| 51 | -} | |
| 52 | - | |
| 53 | -function acym_modalPaginationLists($inputEventId = '', $checkedLists = '[]', $needDisplaySubscribers = false, $attributesModal = '') | |
| 54 | -{ | |
| 55 | - $searchField = acym_filterSearch('', 'modal_search_lists'); | |
| 56 | - | |
| 57 | - $data = ''; | |
| 58 | - if (!empty($inputEventId)) { | |
| 59 | - $data .= '<input type="hidden" id="'.$inputEventId.'">'; | |
| 60 | - } | |
| 61 | - if ($needDisplaySubscribers) { | |
| 62 | - $data .= '<input type="hidden" id="modal__pagination__need__display__sub">'; | |
| 63 | - } | |
| 64 | - | |
| 65 | - $data .= '<div class="cell grid-x" '.$attributesModal.'> | |
| 66 | - <input type="hidden" name="show_selected" value="false" id="modal__pagination__show-information"> | |
| 67 | - <input type="hidden" id="modal__pagination__search__lists"> | |
| 68 | - <input type="hidden" name="lists_selected" id="acym__modal__lists-selected" value="'.acym_escape($checkedLists).'"> | |
| 69 | - <div class="cell grid-x"> | |
| 70 | - <h4 class="cell text-center acym__title acym__title__secondary">'.acym_translation('ACYM_CHOOSE_LISTS').'</h4> | |
| 71 | - </div> | |
| 72 | - <div class="cell grid-x modal__pagination__search"> | |
| 73 | - '.$searchField.' | |
| 74 | - </div> | |
| 75 | - <div class="cell text-center padding-top-1" id="modal__pagination__search__spinner" style="display: none"> | |
| 76 | - <i class="acymicon-circle-o-notch acymicon-spin"></i> | |
| 77 | - </div> | |
| 78 | - <div class="cell medium-6 modal__pagination__show"> | |
| 79 | - <a href="#" class="acym__color__blue modal__pagination__show-selected modal__pagination__show-button selected">'.acym_translation('ACYM_SHOW_SELECTED_LISTS').'</a> | |
| 80 | - <a href="#" class="acym__color__blue modal__pagination__show-all modal__pagination__show-button">'.acym_translation('ACYM_SHOW_ALL_LISTS').'</a> | |
| 81 | - </div> | |
| 82 | - <div class="cell grid-x modal__pagination__listing__lists"> | |
| 83 | - <div class="cell modal__pagination__listing__lists__in-form"></div> | |
| 84 | - </div> | |
| 85 | - </div>'; | |
| 86 | - | |
| 87 | - return $data; | |
| 88 | -} | |
| 89 | - | |
| 90 | -function acym_frontModal($iframeSrc, $buttonText, $isButton, $identifier = null, $iframeClass = null, $additionalContent = '') | |
| 91 | -{ | |
| 92 | - static $loaded = false; | |
| 93 | - if (empty($loaded)) { | |
| 94 | - $loaded = true; | |
| 95 | - acym_addStyle(false, ACYM_CSS.'modal.min.css?v='.filemtime(ACYM_MEDIA.'css'.DS.'modal.min.css')); | |
| 96 | - acym_addScript(false, ACYM_JS.'modal.min.js?v='.filemtime(ACYM_MEDIA.'js'.DS.'modal.min.js')); | |
| 97 | - } | |
| 98 | - | |
| 99 | - if (empty($identifier)) { | |
| 100 | - $identifier = 'identifier_'.rand(1000, 9000); | |
| 101 | - } | |
| 102 | - | |
| 103 | - if (empty($iframeClass)) { | |
| 104 | - $iframeClass = 'acym__modal__iframe'; | |
| 105 | - } | |
| 106 | - | |
| 107 | - ob_start(); | |
| 108 | - ?> | |
| 109 | - <a class="<?php echo $isButton ? 'btn ' : ''; ?>acym__modal__handle" data-acym-modal="<?php echo acym_escape($identifier); ?>" href="#"> | |
| 110 | - <?php echo acym_translation($buttonText); ?> | |
| 111 | - </a> | |
| 112 | - <div class="acym__modal" id="acym__modal__<?php echo $identifier; ?>" style="display: none;"> | |
| 113 | - <div class="acym__modal__content"> | |
| 114 | - <div class="acym__modal__close"><span>×</span></div> | |
| 115 | - <?php echo $additionalContent; ?> | |
| 116 | - <iframe class="<?php echo $iframeClass; ?>" src="<?php echo $iframeSrc; ?>"></iframe> | |
| 117 | - </div> | |
| 118 | - </div> | |
| 119 | - <?php | |
| 120 | - | |
| 121 | - return ob_get_clean(); | |
| 122 | -} | |