| 1 |
<?php |
| 2 |
|
| 3 |
function acym_radio($options, $name, $selected = null, $attributes = [], $params = [], $frontDisplay = false, $disabledOptions = []) |
| 4 |
{ |
| 5 |
$id = preg_replace( |
| 6 |
'#[^a-zA-Z0-9_]+#mi', |
| 7 |
'_', |
| 8 |
str_replace( |
| 9 |
['[', ']'], |
| 10 |
['_', ''], |
| 11 |
empty($params['id']) ? $name : $params['id'] |
| 12 |
) |
| 13 |
); |
| 14 |
|
| 15 |
$objValue = empty($params['objectValue']) ? 'value' : $params['objectValue']; |
| 16 |
$objText = empty($params['objectText']) ? 'text' : $params['objectText']; |
| 17 |
|
| 18 |
$attributes['type'] = 'radio'; |
| 19 |
$attributes['name'] = $name; |
| 20 |
if (empty($params['containerClass'])) $params['containerClass'] = ''; |
| 21 |
|
| 22 |
$return = '<div class="acym_radio_group '.$params['containerClass'].'">'; |
| 23 |
$k = 0; |
| 24 |
foreach ($options as $value => $label) { |
| 25 |
$attributes['class'] = ''; |
| 26 |
if (is_object($label)) { |
| 27 |
if (!empty($label->class)) { |
| 28 |
$attributes['class'] = $label->class; |
| 29 |
} |
| 30 |
|
| 31 |
$value = $label->$objValue; |
| 32 |
$label = $label->$objText; |
| 33 |
} |
| 34 |
|
| 35 |
$currentId = empty($params['useIncrement']) ? $id.$value : $id.$k; |
| 36 |
|
| 37 |
$attributes['value'] = $value; |
| 38 |
$attributes['id'] = $currentId; |
| 39 |
|
| 40 |
if (isset($attributes['related'][$value])) { |
| 41 |
$attributes['acym-data-related'] = $attributes['related'][$value]; |
| 42 |
} |
| 43 |
|
| 44 |
$checked = (string)$value == (string)$selected ? ' checked="checked"' : ''; |
| 45 |
|
| 46 |
$disabled = ''; |
| 47 |
$extraClass = ''; |
| 48 |
if (!empty($disabledOptions[$value])) { |
| 49 |
$disabled = ' disabled'; |
| 50 |
$extraClass = ' '.$disabledOptions[$value]['disabledClass']; |
| 51 |
$attributes['class'] .= $extraClass; |
| 52 |
} |
| 53 |
|
| 54 |
$formattedAttributes = ''; |
| 55 |
foreach ($attributes as $attribute => $val) { |
| 56 |
if ($attribute === 'related') continue; |
| 57 |
$formattedAttributes .= ' '.$attribute.'="'.acym_escape($val).'"'; |
| 58 |
} |
| 59 |
if (!empty($params['required'])) { |
| 60 |
$formattedAttributes .= ' required'; |
| 61 |
unset($params['required']); |
| 62 |
} |
| 63 |
|
| 64 |
$elementClass = empty($elementClass) ? '' : ' class="'.$elementClass.'"'; |
| 65 |
|
| 66 |
$currentOption = ''; |
| 67 |
if (!$frontDisplay) { |
| 68 |
$currentOption .= '<i data-radio="'.$currentId.'" class="acymicon-radio-button-checked acym_radio_checked'.$extraClass.'"></i>'; |
| 69 |
$currentOption .= '<i data-radio="'.$currentId.'" class="acymicon-radio-button-unchecked acym_radio_unchecked'.$extraClass.'"></i>'; |
| 70 |
} |
| 71 |
|
| 72 |
$currentOption .= '<input'.$formattedAttributes.$checked.$disabled.' />'; |
| 73 |
$currentOption .= '<label for="'.$currentId.'" id="'.$currentId.'-lbl" class="'.$extraClass.'">'.acym_translation($label).'</label>'; |
| 74 |
|
| 75 |
if (!empty($disabledOptions[$value]['tooltipTxt'])) { |
| 76 |
$currentOption = acym_tooltip( |
| 77 |
[ |
| 78 |
'hoveredText' => $currentOption, |
| 79 |
'textShownInTooltip' => $disabledOptions[$value]['tooltipTxt'], |
| 80 |
] |
| 81 |
); |
| 82 |
} |
| 83 |
|
| 84 |
$return .= $currentOption; |
| 85 |
|
| 86 |
if (!empty($params['pluginMode'])) $return .= '<br />'; |
| 87 |
$k++; |
| 88 |
} |
| 89 |
$return .= '</div>'; |
| 90 |
|
| 91 |
return $return; |
| 92 |
} |
| 93 |
|
| 94 |
function acym_boolean($name, $selected = null, $id = null, $attributes = [], $yes = 'ACYM_YES', $no = 'ACYM_NO') |
| 95 |
{ |
| 96 |
$options = [ |
| 97 |
'1' => acym_translation($yes), |
| 98 |
'0' => acym_translation($no), |
| 99 |
]; |
| 100 |
|
| 101 |
$params = ['id' => $id]; |
| 102 |
if (!empty($attributes['containerClass'])) { |
| 103 |
$params['containerClass'] = $attributes['containerClass']; |
| 104 |
unset($attributes['containerClass']); |
| 105 |
} |
| 106 |
|
| 107 |
return acym_radio( |
| 108 |
$options, |
| 109 |
$name, |
| 110 |
$selected ? 1 : 0, |
| 111 |
$attributes, |
| 112 |
$params, |
| 113 |
!acym_isAdmin() |
| 114 |
); |
| 115 |
} |
| 116 |
|
| 117 |
function acym_select($data, $name, $selected = null, $attribs = null, $optKey = 'value', $optText = 'text', $idtag = false, $translate = false) |
| 118 |
{ |
| 119 |
$idtag = str_replace(['[', ']', ' '], '', empty($idtag) ? $name : $idtag); |
| 120 |
|
| 121 |
$attributes = ''; |
| 122 |
if (!empty($attribs)) { |
| 123 |
if (is_array($attribs)) { |
| 124 |
foreach ($attribs as $attribName => $attribValue) { |
| 125 |
if (is_array($attribValue) || is_object($attribValue)) { |
| 126 |
$attribValue = json_encode($attribValue); |
| 127 |
} |
| 128 |
$attribName = str_replace([' ', '"', "'"], '_', $attribName); |
| 129 |
$attributes .= ' '.$attribName; |
| 130 |
if ($attribValue !== true) { |
| 131 |
$attributes .= '="'.acym_escape($attribValue).'"'; |
| 132 |
} |
| 133 |
} |
| 134 |
} else { |
| 135 |
$attributes = $attribs; |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
$dropdown = '<select id="'.acym_escape($idtag).'" name="'.acym_escape($name).'" '.$attributes.'>'; |
| 140 |
|
| 141 |
foreach ($data as $key => $oneOption) { |
| 142 |
$disabled = false; |
| 143 |
if (is_object($oneOption)) { |
| 144 |
$value = $oneOption->$optKey; |
| 145 |
$text = $oneOption->$optText; |
| 146 |
if (isset($oneOption->disable)) { |
| 147 |
$disabled = $oneOption->disable; |
| 148 |
} |
| 149 |
} else { |
| 150 |
$value = $key; |
| 151 |
$text = $oneOption; |
| 152 |
} |
| 153 |
|
| 154 |
if ($translate) { |
| 155 |
$text = acym_translation($text); |
| 156 |
} |
| 157 |
|
| 158 |
if (strtolower($value) == '<optgroup>') { |
| 159 |
$dropdown .= '<optgroup label="'.acym_escape($text).'">'; |
| 160 |
} elseif (strtolower($value) == '</optgroup>') { |
| 161 |
$dropdown .= '</optgroup>'; |
| 162 |
} else { |
| 163 |
$cleanValue = acym_escape($value); |
| 164 |
$cleanText = acym_escape($text); |
| 165 |
$dropdown .= '<option value="'.$cleanValue.'"'.(strval($value) === strval($selected) ? ' selected="selected"' : '').($disabled ? ' disabled="disabled"' |
| 166 |
: '').'>'.$cleanText.'</option>'; |
| 167 |
} |
| 168 |
} |
| 169 |
|
| 170 |
$dropdown .= '</select>'; |
| 171 |
|
| 172 |
return $dropdown; |
| 173 |
} |
| 174 |
|
| 175 |
function acym_selectMultiple($data, $name, $selected = [], $attribs = [], $optValue = 'value', $optText = 'text', $translate = false) |
| 176 |
{ |
| 177 |
if (substr($name, -2) !== '[]') { |
| 178 |
$name .= '[]'; |
| 179 |
} |
| 180 |
|
| 181 |
$attribs['multiple'] = 'multiple'; |
| 182 |
|
| 183 |
$dropdown = '<select name="'.acym_escape($name).'"'; |
| 184 |
foreach ($attribs as $attribKey => $attribValue) { |
| 185 |
$dropdown .= ' '.$attribKey.'="'.addslashes($attribValue).'"'; |
| 186 |
} |
| 187 |
$dropdown .= '>'; |
| 188 |
|
| 189 |
foreach ($data as $oneDataKey => $oneDataValue) { |
| 190 |
$disabled = ''; |
| 191 |
|
| 192 |
if (is_object($oneDataValue)) { |
| 193 |
$value = $oneDataValue->$optValue; |
| 194 |
$text = $oneDataValue->$optText; |
| 195 |
|
| 196 |
if (!empty($oneDataValue->disable)) { |
| 197 |
$disabled = ' disabled="disabled"'; |
| 198 |
} |
| 199 |
} else { |
| 200 |
$value = $oneDataKey; |
| 201 |
$text = $oneDataValue; |
| 202 |
} |
| 203 |
|
| 204 |
if ($translate) { |
| 205 |
$text = acym_translation($text); |
| 206 |
} |
| 207 |
|
| 208 |
if (strtolower($value) == '<optgroup>') { |
| 209 |
$dropdown .= '<optgroup label="'.acym_escape($text).'">'; |
| 210 |
} elseif (strtolower($value) == '</optgroup>') { |
| 211 |
$dropdown .= '</optgroup>'; |
| 212 |
} else { |
| 213 |
$text = acym_escape($text); |
| 214 |
$dropdown .= '<option value="'.acym_escape($value).'"'.(in_array($value, $selected) ? ' selected="selected"' : '').$disabled.'>'.$text.'</option>'; |
| 215 |
} |
| 216 |
} |
| 217 |
|
| 218 |
$dropdown .= '</select>'; |
| 219 |
|
| 220 |
return $dropdown; |
| 221 |
} |
| 222 |
|
| 223 |
function acym_selectOption($value, $text = '', $optKey = 'value', $optText = 'text', $disable = false) |
| 224 |
{ |
| 225 |
$option = new stdClass(); |
| 226 |
$option->$optKey = $value; |
| 227 |
$option->$optText = acym_translation($text); |
| 228 |
$option->disable = $disable; |
| 229 |
|
| 230 |
return $option; |
| 231 |
} |
| 232 |
|
| 233 |
function acym_switch( |
| 234 |
$name, |
| 235 |
$value, |
| 236 |
$label = null, |
| 237 |
$attrInput = [], |
| 238 |
$labelClass = 'medium-6 small-9', |
| 239 |
$switchContainerClass = 'auto', |
| 240 |
$switchClass = '', |
| 241 |
$toggle = null, |
| 242 |
$toggleOpen = true, |
| 243 |
$vModel = '', |
| 244 |
$disabled = false, |
| 245 |
$disabledMessage = '' |
| 246 |
) { |
| 247 |
static $occurrence = 100; |
| 248 |
$occurrence++; |
| 249 |
|
| 250 |
$id = acym_escape('switch_'.$occurrence); |
| 251 |
$checked = $value == 1 ? 'checked="checked"' : ''; |
| 252 |
|
| 253 |
$switch = ' |
| 254 |
<div class="switch '.acym_escape($switchClass).'"> |
| 255 |
<input type="hidden" name="'.acym_escape($name).'" data-switch="'.$id.'" value="'.acym_escape($value).'" '.$vModel; |
| 256 |
|
| 257 |
if (!empty($toggle)) { |
| 258 |
$switch .= ' data-toggle-switch="'.acym_escape($toggle).'" data-toggle-switch-open="'.($toggleOpen ? 'show' : 'hide').'"'; |
| 259 |
} |
| 260 |
|
| 261 |
foreach ($attrInput as $oneAttributeName => $oneAttributeValue) { |
| 262 |
$switch .= ' '.$oneAttributeName.'="'.acym_escape($oneAttributeValue).'"'; |
| 263 |
} |
| 264 |
$switch .= '>'; |
| 265 |
$labelSwitchDisabled = !$disabled ? '' : ' disabled'; |
| 266 |
$inputSwitchDisabled = !$disabled ? '' : ' disabled="disabled"'; |
| 267 |
$disabledTooltip = !$disabled || empty($disabledMessage) ? '' : ' data-acym-tooltip="'.$disabledMessage.'"'; |
| 268 |
$switch .= ' |
| 269 |
<input class="switch-input" type="checkbox" id="'.$id.'" value="1" '.$checked.$inputSwitchDisabled.'> |
| 270 |
<label class="switch-paddle switch-label'.$labelSwitchDisabled.'" '.$disabledTooltip.' for="'.$id.'"> |
| 271 |
<span class="switch-active" aria-hidden="true">1</span> |
| 272 |
<span class="switch-inactive" aria-hidden="true">0</span> |
| 273 |
</label> |
| 274 |
</div>'; |
| 275 |
|
| 276 |
if (!empty($label)) { |
| 277 |
$switch = '<label for="'.$id.'" class="cell '.$labelClass.' switch-label">'.$label.'</label><div class="cell '.$switchContainerClass.'">'.$switch.'</div>'; |
| 278 |
} |
| 279 |
|
| 280 |
return $switch; |
| 281 |
} |
| 282 |
|
| 283 |
function acym_showMore($toggle, $text = 'ACYM_SHOW_MORE', $class = '') |
| 284 |
{ |
| 285 |
$showMore = '<div class="showmore '.$class.'" data-toggle-showmore="'.$toggle.'">'; |
| 286 |
$showMore .= '<label>'.acym_translation($text).'<i class="acymicon-keyboard-arrow-down"></i></label>'; |
| 287 |
$showMore .= '</div>'; |
| 288 |
|
| 289 |
return $showMore; |
| 290 |
} |
| 291 |
|
| 292 |
function acym_generateCountryNumber($name, $defaultvalue = '') |
| 293 |
{ |
| 294 |
$flagPosition = []; |
| 295 |
$flagPosition['93'] = ['x' => -48, 'y' => 0]; |
| 296 |
$flagPosition['355'] = ['x' => -96, 'y' => 0]; |
| 297 |
$flagPosition['213'] = ['x' => -160, 'y' => -33]; |
| 298 |
$flagPosition['1684'] = ['x' => -176, 'y' => 0]; |
| 299 |
$flagPosition['376'] = ['x' => -16, 'y' => 0]; |
| 300 |
$flagPosition['244'] = ['x' => -144, 'y' => 0]; |
| 301 |
$flagPosition['1264'] = ['x' => -80, 'y' => 0]; |
| 302 |
$flagPosition['672'] = ['x' => 0, 'y' => -176]; //antartica |
| 303 |
$flagPosition['1268'] = ['x' => -64, 'y' => 0]; |
| 304 |
$flagPosition['54'] = ['x' => -160, 'y' => 0]; |
| 305 |
$flagPosition['374'] = ['x' => -112, 'y' => 0]; |
| 306 |
$flagPosition['297'] = ['x' => -224, 'y' => 0]; |
| 307 |
$flagPosition['247'] = ['x' => -16, 'y' => -176]; //ascenscion island |
| 308 |
$flagPosition['61'] = ['x' => -208, 'y' => 0]; |
| 309 |
$flagPosition['43'] = ['x' => -192, 'y' => 0]; |
| 310 |
$flagPosition['994'] = ['x' => -240, 'y' => 0]; |
| 311 |
$flagPosition['1242'] = ['x' => -208, 'y' => -11]; |
| 312 |
$flagPosition['973'] = ['x' => -96, 'y' => -11]; |
| 313 |
$flagPosition['880'] = ['x' => -32, 'y' => -11]; |
| 314 |
$flagPosition['1246'] = ['x' => -16, 'y' => -11]; |
| 315 |
$flagPosition['375'] = ['x' => -16, 'y' => -22]; |
| 316 |
$flagPosition['32'] = ['x' => -48, 'y' => -11]; |
| 317 |
$flagPosition['501'] = ['x' => -32, 'y' => -22]; |
| 318 |
$flagPosition['229'] = ['x' => -128, 'y' => -11]; |
| 319 |
$flagPosition['1441'] = ['x' => -144, 'y' => -11]; |
| 320 |
$flagPosition['975'] = ['x' => -224, 'y' => -11]; |
| 321 |
$flagPosition['591'] = ['x' => -176, 'y' => -11]; |
| 322 |
$flagPosition['387'] = ['x' => 0, 'y' => -11]; |
| 323 |
$flagPosition['267'] = ['x' => 0, 'y' => -22]; |
| 324 |
$flagPosition['55'] = ['x' => -192, 'y' => -11]; |
| 325 |
$flagPosition['1284'] = ['x' => -240, 'y' => -154]; |
| 326 |
$flagPosition['673'] = ['x' => -160, 'y' => -11]; |
| 327 |
$flagPosition['359'] = ['x' => -80, 'y' => -11]; |
| 328 |
$flagPosition['226'] = ['x' => -64, 'y' => -11]; |
| 329 |
$flagPosition['257'] = ['x' => -112, 'y' => -11]; |
| 330 |
$flagPosition['855'] = ['x' => -64, 'y' => -77]; |
| 331 |
$flagPosition['237'] = ['x' => -192, 'y' => -22]; |
| 332 |
$flagPosition['1'] = ['x' => -48, 'y' => -22]; |
| 333 |
$flagPosition['238'] = ['x' => -16, 'y' => -33]; |
| 334 |
$flagPosition['1345'] = ['x' => -192, 'y' => -77]; |
| 335 |
$flagPosition['236'] = ['x' => -96, 'y' => -22]; |
| 336 |
$flagPosition['235'] = ['x' => -112, 'y' => -143]; |
| 337 |
$flagPosition['56'] = ['x' => -176, 'y' => -22]; |
| 338 |
$flagPosition['86'] = ['x' => -208, 'y' => -22]; |
| 339 |
$flagPosition['6724'] = ['x' => -32, 'y' => -176]; //christmas island |
| 340 |
$flagPosition['6722'] = ['x' => -48, 'y' => -176]; //coco keeling island |
| 341 |
$flagPosition['57'] = ['x' => -224, 'y' => -22]; |
| 342 |
$flagPosition['269'] = ['x' => -96, 'y' => -77]; |
| 343 |
$flagPosition['243'] = ['x' => -80, 'y' => -22]; |
| 344 |
$flagPosition['242'] = ['x' => -112, 'y' => -22]; |
| 345 |
$flagPosition['682'] = ['x' => -160, 'y' => -22]; |
| 346 |
$flagPosition['506'] = ['x' => -240, 'y' => -22]; |
| 347 |
$flagPosition['225'] = ['x' => -144, 'y' => -22]; |
| 348 |
$flagPosition['385'] = ['x' => 0, 'y' => -66]; |
| 349 |
$flagPosition['53'] = ['x' => 0, 'y' => -33]; |
| 350 |
$flagPosition['357'] = ['x' => -48, 'y' => -33]; |
| 351 |
$flagPosition['420'] = ['x' => -64, 'y' => -33]; |
| 352 |
$flagPosition['45'] = ['x' => -112, 'y' => -33]; |
| 353 |
$flagPosition['253'] = ['x' => -96, 'y' => -33]; |
| 354 |
$flagPosition['1767'] = ['x' => -128, 'y' => -33]; |
| 355 |
$flagPosition['1809'] = ['x' => -144, 'y' => -33]; |
| 356 |
$flagPosition['593'] = ['x' => -176, 'y' => -33]; |
| 357 |
$flagPosition['20'] = ['x' => -208, 'y' => -33]; |
| 358 |
$flagPosition['503'] = ['x' => -32, 'y' => -143]; |
| 359 |
$flagPosition['240'] = ['x' => -96, 'y' => -55]; |
| 360 |
$flagPosition['291'] = ['x' => 0, 'y' => -44]; |
| 361 |
$flagPosition['372'] = ['x' => -192, 'y' => -33]; |
| 362 |
$flagPosition['251'] = ['x' => -32, 'y' => -44]; |
| 363 |
$flagPosition['500'] = ['x' => -96, 'y' => -44]; |
| 364 |
$flagPosition['298'] = ['x' => -128, 'y' => -44]; |
| 365 |
$flagPosition['679'] = ['x' => -80, 'y' => -44]; |
| 366 |
$flagPosition['358'] = ['x' => -64, 'y' => -44]; |
| 367 |
$flagPosition['33'] = ['x' => -144, 'y' => -44]; |
| 368 |
$flagPosition['596'] = ['x' => -80, 'y' => -99]; |
| 369 |
$flagPosition['594'] = ['x' => -128, 'y' => -176]; //french guiana |
| 370 |
$flagPosition['689'] = ['x' => -224, 'y' => -110]; |
| 371 |
$flagPosition['241'] = ['x' => -160, 'y' => -44]; |
| 372 |
$flagPosition['220'] = ['x' => -48, 'y' => -55]; |
| 373 |
$flagPosition['995'] = ['x' => -208, 'y' => -44]; |
| 374 |
$flagPosition['49'] = ['x' => -80, 'y' => -33]; |
| 375 |
$flagPosition['233'] = ['x' => 0, 'y' => -55]; |
| 376 |
$flagPosition['350'] = ['x' => -16, 'y' => -55]; |
| 377 |
$flagPosition['30'] = ['x' => -112, 'y' => -55]; |
| 378 |
$flagPosition['299'] = ['x' => -32, 'y' => -55]; |
| 379 |
$flagPosition['1473'] = ['x' => -192, 'y' => -44]; |
| 380 |
$flagPosition['590'] = ['x' => -80, 'y' => -55]; |
| 381 |
$flagPosition['1671'] = ['x' => -160, 'y' => -55]; |
| 382 |
$flagPosition['502'] = ['x' => -144, 'y' => -55]; |
| 383 |
$flagPosition['224'] = ['x' => -64, 'y' => -55]; |
| 384 |
$flagPosition['245'] = ['x' => -176, 'y' => -55]; |
| 385 |
$flagPosition['592'] = ['x' => -192, 'y' => -55]; |
| 386 |
$flagPosition['509'] = ['x' => -16, 'y' => -66]; |
| 387 |
$flagPosition['504'] = ['x' => -240, 'y' => -55]; |
| 388 |
$flagPosition['852'] = ['x' => -208, 'y' => -55]; |
| 389 |
$flagPosition['36'] = ['x' => -32, 'y' => -66]; |
| 390 |
$flagPosition['354'] = ['x' => -192, 'y' => -66]; |
| 391 |
$flagPosition['91'] = ['x' => -128, 'y' => -66]; |
| 392 |
$flagPosition['62'] = ['x' => -64, 'y' => -66]; |
| 393 |
$flagPosition['964'] = ['x' => -160, 'y' => -66]; |
| 394 |
$flagPosition['98'] = ['x' => -176, 'y' => -66]; |
| 395 |
$flagPosition['353'] = ['x' => -80, 'y' => -66]; |
| 396 |
$flagPosition['972'] = ['x' => -96, 'y' => -66]; |
| 397 |
$flagPosition['39'] = ['x' => -208, 'y' => -66]; |
| 398 |
$flagPosition['1876'] = ['x' => -240, 'y' => -66]; |
| 399 |
$flagPosition['81'] = ['x' => -16, 'y' => -77]; |
| 400 |
$flagPosition['962'] = ['x' => 0, 'y' => -77]; |
| 401 |
$flagPosition['254'] = ['x' => -32, 'y' => -77]; |
| 402 |
$flagPosition['686'] = ['x' => -80, 'y' => -77]; |
| 403 |
$flagPosition['3774'] = ['x' => -64, 'y' => -176]; //kosovo |
| 404 |
$flagPosition['965'] = ['x' => -176, 'y' => -77]; |
| 405 |
$flagPosition['996'] = ['x' => -48, 'y' => -77]; |
| 406 |
$flagPosition['856'] = ['x' => -224, 'y' => -77]; |
| 407 |
$flagPosition['371'] = ['x' => -112, 'y' => -88]; |
| 408 |
$flagPosition['961'] = ['x' => -240, 'y' => -77]; |
| 409 |
$flagPosition['266'] = ['x' => -64, 'y' => -88]; |
| 410 |
$flagPosition['231'] = ['x' => -48, 'y' => -88]; |
| 411 |
$flagPosition['218'] = ['x' => -128, 'y' => -88]; |
| 412 |
$flagPosition['423'] = ['x' => -16, 'y' => -88]; |
| 413 |
$flagPosition['370'] = ['x' => -80, 'y' => -88]; |
| 414 |
$flagPosition['352'] = ['x' => -96, 'y' => -88]; |
| 415 |
$flagPosition['853'] = ['x' => -48, 'y' => -99]; |
| 416 |
$flagPosition['389'] = ['x' => -240, 'y' => -88]; |
| 417 |
$flagPosition['261'] = ['x' => -208, 'y' => -88]; |
| 418 |
$flagPosition['265'] = ['x' => -176, 'y' => -99]; |
| 419 |
$flagPosition['60'] = ['x' => -208, 'y' => -99]; |
| 420 |
$flagPosition['960'] = ['x' => -160, 'y' => -99]; |
| 421 |
$flagPosition['223'] = ['x' => 0, 'y' => -99]; |
| 422 |
$flagPosition['356'] = ['x' => -128, 'y' => -99]; |
| 423 |
$flagPosition['692'] = ['x' => -224, 'y' => -88]; |
| 424 |
$flagPosition['222'] = ['x' => -96, 'y' => -99]; |
| 425 |
$flagPosition['230'] = ['x' => -144, 'y' => -99]; |
| 426 |
$flagPosition['52'] = ['x' => -192, 'y' => -99]; |
| 427 |
$flagPosition['691'] = ['x' => -112, 'y' => -44]; |
| 428 |
$flagPosition['373'] = ['x' => -176, 'y' => -88]; |
| 429 |
$flagPosition['377'] = ['x' => -160, 'y' => -88]; |
| 430 |
$flagPosition['976'] = ['x' => -32, 'y' => -99]; |
| 431 |
$flagPosition['382'] = ['x' => -192, 'y' => -88]; |
| 432 |
$flagPosition['1664'] = ['x' => -112, 'y' => -99]; |
| 433 |
$flagPosition['212'] = ['x' => -144, 'y' => -88]; |
| 434 |
$flagPosition['258'] = ['x' => -224, 'y' => -99]; |
| 435 |
$flagPosition['95'] = ['x' => -16, 'y' => -99]; |
| 436 |
$flagPosition['264'] = ['x' => -240, 'y' => -99]; |
| 437 |
$flagPosition['674'] = ['x' => -128, 'y' => -110]; |
| 438 |
$flagPosition['977'] = ['x' => -112, 'y' => -110]; |
| 439 |
$flagPosition['31'] = ['x' => -80, 'y' => -110]; |
| 440 |
$flagPosition['599'] = ['x' => -128, 'y' => 0]; |
| 441 |
$flagPosition['687'] = ['x' => 0, 'y' => -110]; |
| 442 |
$flagPosition['64'] = ['x' => -160, 'y' => -110]; |
| 443 |
$flagPosition['505'] = ['x' => -64, 'y' => -110]; |
| 444 |
$flagPosition['227'] = ['x' => -16, 'y' => -110]; |
| 445 |
$flagPosition['234'] = ['x' => -48, 'y' => -110]; |
| 446 |
$flagPosition['683'] = ['x' => -144, 'y' => -110]; |
| 447 |
$flagPosition['6723'] = ['x' => -32, 'y' => -110]; |
| 448 |
$flagPosition['850'] = ['x' => -128, 'y' => -77]; |
| 449 |
$flagPosition['47'] = ['x' => -96, 'y' => -110]; |
| 450 |
$flagPosition['968'] = ['x' => -176, 'y' => -110]; |
| 451 |
$flagPosition['92'] = ['x' => -16, 'y' => -121]; |
| 452 |
$flagPosition['680'] = ['x' => -80, 'y' => -176]; //palau |
| 453 |
$flagPosition['970'] = ['x' => -96, 'y' => -121]; |
| 454 |
$flagPosition['507'] = ['x' => -192, 'y' => -110]; |
| 455 |
$flagPosition['675'] = ['x' => -240, 'y' => -110]; |
| 456 |
$flagPosition['595'] = ['x' => -144, 'y' => -121]; |
| 457 |
$flagPosition['51'] = ['x' => -208, 'y' => -110]; |
| 458 |
$flagPosition['63'] = ['x' => 0, 'y' => -121]; |
| 459 |
$flagPosition['48'] = ['x' => -32, 'y' => -121]; |
| 460 |
$flagPosition['351'] = ['x' => -112, 'y' => -121]; |
| 461 |
$flagPosition['1787'] = ['x' => -80, 'y' => -121]; |
| 462 |
$flagPosition['974'] = ['x' => -160, 'y' => -121]; |
| 463 |
$flagPosition['262'] = ['x' => -144, 'y' => -176]; //reunion island |
| 464 |
$flagPosition['40'] = ['x' => -192, 'y' => -121]; |
| 465 |
$flagPosition['7'] = ['x' => -224, 'y' => -121]; |
| 466 |
$flagPosition['250'] = ['x' => -240, 'y' => -121]; |
| 467 |
$flagPosition['1670'] = ['x' => -96, 'y' => -176]; //marianne |
| 468 |
$flagPosition['378'] = ['x' => -176, 'y' => -132]; |
| 469 |
$flagPosition['239'] = ['x' => -16, 'y' => -143]; |
| 470 |
$flagPosition['966'] = ['x' => 0, 'y' => -132]; |
| 471 |
$flagPosition['221'] = ['x' => -192, 'y' => -132]; |
| 472 |
$flagPosition['381'] = ['x' => -208, 'y' => -121]; |
| 473 |
$flagPosition['248'] = ['x' => -32, 'y' => -132]; |
| 474 |
$flagPosition['232'] = ['x' => -160, 'y' => -132]; |
| 475 |
$flagPosition['65'] = ['x' => -96, 'y' => -132]; |
| 476 |
$flagPosition['421'] = ['x' => -144, 'y' => -132]; |
| 477 |
$flagPosition['386'] = ['x' => -128, 'y' => -132]; |
| 478 |
$flagPosition['677'] = ['x' => -16, 'y' => -132]; |
| 479 |
$flagPosition['252'] = ['x' => -208, 'y' => -132]; |
| 480 |
$flagPosition['685'] = ['x' => -112, 'y' => -176]; //somoa |
| 481 |
$flagPosition['27'] = ['x' => -128, 'y' => -165]; |
| 482 |
$flagPosition['82'] = ['x' => -144, 'y' => -77]; |
| 483 |
$flagPosition['34'] = ['x' => -16, 'y' => -44]; |
| 484 |
$flagPosition['94'] = ['x' => -32, 'y' => -88]; |
| 485 |
$flagPosition['290'] = ['x' => -112, 'y' => -132]; |
| 486 |
$flagPosition['1869'] = ['x' => -112, 'y' => -77]; |
| 487 |
$flagPosition['1758'] = ['x' => 0, 'y' => -88]; |
| 488 |
$flagPosition['508'] = ['x' => -48, 'y' => -121]; |
| 489 |
$flagPosition['1784'] = ['x' => -208, 'y' => -154]; |
| 490 |
$flagPosition['249'] = ['x' => -64, 'y' => -132]; |
| 491 |
$flagPosition['597'] = ['x' => -240, 'y' => -132]; |
| 492 |
$flagPosition['268'] = ['x' => -80, 'y' => -143]; |
| 493 |
$flagPosition['46'] = ['x' => -80, 'y' => -132]; |
| 494 |
$flagPosition['41'] = ['x' => -128, 'y' => -22]; |
| 495 |
$flagPosition['963'] = ['x' => -64, 'y' => -143]; |
| 496 |
$flagPosition['886'] = ['x' => -64, 'y' => -154]; |
| 497 |
$flagPosition['992'] = ['x' => -176, 'y' => -143]; |
| 498 |
$flagPosition['255'] = ['x' => -80, 'y' => -154]; |
| 499 |
$flagPosition['66'] = ['x' => -160, 'y' => -143]; |
| 500 |
$flagPosition['228'] = ['x' => -144, 'y' => -143]; |
| 501 |
$flagPosition['690'] = ['x' => -192, 'y' => -143]; |
| 502 |
$flagPosition['676'] = ['x' => 0, 'y' => -154]; |
| 503 |
$flagPosition['1868'] = ['x' => -32, 'y' => -154]; |
| 504 |
$flagPosition['216'] = ['x' => -240, 'y' => -143]; |
| 505 |
$flagPosition['90'] = ['x' => -16, 'y' => -154]; |
| 506 |
$flagPosition['993'] = ['x' => -224, 'y' => -143]; |
| 507 |
$flagPosition['1649'] = ['x' => -96, 'y' => -143]; |
| 508 |
$flagPosition['688'] = ['x' => -48, 'y' => -154]; |
| 509 |
$flagPosition['256'] = ['x' => -112, 'y' => -154]; |
| 510 |
$flagPosition['380'] = ['x' => -96, 'y' => -154]; |
| 511 |
$flagPosition['971'] = ['x' => -32, 'y' => 0]; |
| 512 |
$flagPosition['44'] = ['x' => -176, 'y' => -44]; |
| 513 |
$flagPosition['598'] = ['x' => -160, 'y' => -154]; |
| 514 |
$flagPosition['1 '] = ['x' => -144, 'y' => -154]; |
| 515 |
$flagPosition['998'] = ['x' => -176, 'y' => -154]; |
| 516 |
$flagPosition['678'] = ['x' => -32, 'y' => -165]; |
| 517 |
$flagPosition['3966'] = ['x' => -192, 'y' => -154]; |
| 518 |
$flagPosition['58'] = ['x' => -224, 'y' => -154]; |
| 519 |
$flagPosition['84'] = ['x' => -16, 'y' => -165]; |
| 520 |
$flagPosition['1340'] = ['x' => 0, 'y' => -165]; |
| 521 |
$flagPosition['681'] = ['x' => -64, 'y' => -165]; |
| 522 |
$flagPosition['967'] = ['x' => -96, 'y' => -165]; |
| 523 |
$flagPosition['260'] = ['x' => -160, 'y' => -165]; |
| 524 |
$flagPosition['263'] = ['x' => -176, 'y' => -165]; |
| 525 |
$flagPosition[''] = ['x' => -160, 'y' => -176]; |
| 526 |
|
| 527 |
|
| 528 |
$country = []; |
| 529 |
$country['93'] = 'Afghanistan'; |
| 530 |
$country['355'] = 'Albania'; |
| 531 |
$country['213'] = 'Algeria'; |
| 532 |
$country['1684'] = 'American Samoa'; |
| 533 |
$country['376'] = 'Andorra'; |
| 534 |
$country['244'] = 'Angola'; |
| 535 |
$country['1264'] = 'Anguilla'; |
| 536 |
$country['672'] = 'Antarctica'; |
| 537 |
$country['1268'] = 'Antigua & Barbuda'; |
| 538 |
$country['54'] = 'Argentina'; |
| 539 |
$country['374'] = 'Armenia'; |
| 540 |
$country['297'] = 'Aruba'; |
| 541 |
$country['247'] = 'Ascension Island'; |
| 542 |
$country['61'] = 'Australia'; |
| 543 |
$country['43'] = 'Austria'; |
| 544 |
$country['994'] = 'Azerbaijan'; |
| 545 |
$country['1242'] = 'Bahamas'; |
| 546 |
$country['973'] = 'Bahrain'; |
| 547 |
$country['880'] = 'Bangladesh'; |
| 548 |
$country['1246'] = 'Barbados'; |
| 549 |
$country['375'] = 'Belarus'; |
| 550 |
$country['32'] = 'Belgium'; |
| 551 |
$country['501'] = 'Belize'; |
| 552 |
$country['229'] = 'Benin'; |
| 553 |
$country['1441'] = 'Bermuda'; |
| 554 |
$country['975'] = 'Bhutan'; |
| 555 |
$country['591'] = 'Bolivia'; |
| 556 |
$country['387'] = 'Bosnia/Herzegovina'; |
| 557 |
$country['267'] = 'Botswana'; |
| 558 |
$country['55'] = 'Brazil'; |
| 559 |
$country['1284'] = 'British Virgin Islands'; |
| 560 |
$country['673'] = 'Brunei'; |
| 561 |
$country['359'] = 'Bulgaria'; |
| 562 |
$country['226'] = 'Burkina Faso'; |
| 563 |
$country['257'] = 'Burundi'; |
| 564 |
$country['855'] = 'Cambodia'; |
| 565 |
$country['237'] = 'Cameroon'; |
| 566 |
$country['1'] = 'Canada/USA'; |
| 567 |
$country['238'] = 'Cape Verde Islands'; |
| 568 |
$country['1345'] = 'Cayman Islands'; |
| 569 |
$country['236'] = 'Central African Republic'; |
| 570 |
$country['235'] = 'Chad Republic'; |
| 571 |
$country['56'] = 'Chile'; |
| 572 |
$country['86'] = 'China'; |
| 573 |
$country['6724'] = 'Christmas Island'; |
| 574 |
$country['6722'] = 'Cocos Keeling Island'; |
| 575 |
$country['57'] = 'Colombia'; |
| 576 |
$country['269'] = 'Comoros'; |
| 577 |
$country['243'] = 'Congo Democratic Republic'; |
| 578 |
$country['242'] = 'Congo, Republic of'; |
| 579 |
$country['682'] = 'Cook Islands'; |
| 580 |
$country['506'] = 'Costa Rica'; |
| 581 |
$country['225'] = 'Cote D\'Ivoire'; |
| 582 |
$country['385'] = 'Croatia'; |
| 583 |
$country['53'] = 'Cuba'; |
| 584 |
$country['357'] = 'Cyprus'; |
| 585 |
$country['420'] = 'Czech Republic'; |
| 586 |
$country['45'] = 'Denmark'; |
| 587 |
$country['253'] = 'Djibouti'; |
| 588 |
$country['1767'] = 'Dominica'; |
| 589 |
$country['1809'] = 'Dominican Republic'; |
| 590 |
$country['593'] = 'Ecuador'; |
| 591 |
$country['20'] = 'Egypt'; |
| 592 |
$country['503'] = 'El Salvador'; |
| 593 |
$country['240'] = 'Equatorial Guinea'; |
| 594 |
$country['291'] = 'Eritrea'; |
| 595 |
$country['372'] = 'Estonia'; |
| 596 |
$country['251'] = 'Ethiopia'; |
| 597 |
$country['500'] = 'Falkland Islands'; |
| 598 |
$country['298'] = 'Faroe Island'; |
| 599 |
$country['679'] = 'Fiji Islands'; |
| 600 |
$country['358'] = 'Finland'; |
| 601 |
$country['33'] = 'France'; |
| 602 |
$country['596'] = 'French Antilles/Martinique'; |
| 603 |
$country['594'] = 'French Guiana'; |
| 604 |
$country['689'] = 'French Polynesia'; |
| 605 |
$country['241'] = 'Gabon Republic'; |
| 606 |
$country['220'] = 'Gambia'; |
| 607 |
$country['995'] = 'Georgia'; |
| 608 |
$country['49'] = 'Germany'; |
| 609 |
$country['233'] = 'Ghana'; |
| 610 |
$country['350'] = 'Gibraltar'; |
| 611 |
$country['30'] = 'Greece'; |
| 612 |
$country['299'] = 'Greenland'; |
| 613 |
$country['1473'] = 'Grenada'; |
| 614 |
$country['590'] = 'Guadeloupe'; |
| 615 |
$country['1671'] = 'Guam'; |
| 616 |
$country['502'] = 'Guatemala'; |
| 617 |
$country['224'] = 'Guinea Republic'; |
| 618 |
$country['245'] = 'Guinea-Bissau'; |
| 619 |
$country['592'] = 'Guyana'; |
| 620 |
$country['509'] = 'Haiti'; |
| 621 |
$country['504'] = 'Honduras'; |
| 622 |
$country['852'] = 'Hong Kong'; |
| 623 |
$country['36'] = 'Hungary'; |
| 624 |
$country['354'] = 'Iceland'; |
| 625 |
$country['91'] = 'India'; |
| 626 |
$country['62'] = 'Indonesia'; |
| 627 |
$country['964'] = 'Iraq'; |
| 628 |
$country['98'] = 'Iran'; |
| 629 |
$country['353'] = 'Ireland'; |
| 630 |
$country['972'] = 'Israel'; |
| 631 |
$country['39'] = 'Italy'; |
| 632 |
$country['1876'] = 'Jamaica'; |
| 633 |
$country['81'] = 'Japan'; |
| 634 |
$country['962'] = 'Jordan'; |
| 635 |
$country['254'] = 'Kenya'; |
| 636 |
$country['686'] = 'Kiribati'; |
| 637 |
$country['3774'] = 'Kosovo'; |
| 638 |
$country['965'] = 'Kuwait'; |
| 639 |
$country['996'] = 'Kyrgyzstan'; |
| 640 |
$country['856'] = 'Laos'; |
| 641 |
$country['371'] = 'Latvia'; |
| 642 |
$country['961'] = 'Lebanon'; |
| 643 |
$country['266'] = 'Lesotho'; |
| 644 |
$country['231'] = 'Liberia'; |
| 645 |
$country['218'] = 'Libya'; |
| 646 |
$country['423'] = 'Liechtenstein'; |
| 647 |
$country['370'] = 'Lithuania'; |
| 648 |
$country['352'] = 'Luxembourg'; |
| 649 |
$country['853'] = 'Macau'; |
| 650 |
$country['389'] = 'Macedonia'; |
| 651 |
$country['261'] = 'Madagascar'; |
| 652 |
$country['265'] = 'Malawi'; |
| 653 |
$country['60'] = 'Malaysia'; |
| 654 |
$country['960'] = 'Maldives'; |
| 655 |
$country['223'] = 'Mali Republic'; |
| 656 |
$country['356'] = 'Malta'; |
| 657 |
$country['692'] = 'Marshall Islands'; |
| 658 |
$country['222'] = 'Mauritania'; |
| 659 |
$country['230'] = 'Mauritius'; |
| 660 |
$country['52'] = 'Mexico'; |
| 661 |
$country['691'] = 'Micronesia'; |
| 662 |
$country['373'] = 'Moldova'; |
| 663 |
$country['377'] = 'Monaco'; |
| 664 |
$country['976'] = 'Mongolia'; |
| 665 |
$country['382'] = 'Montenegro'; |
| 666 |
$country['1664'] = 'Montserrat'; |
| 667 |
$country['212'] = 'Morocco'; |
| 668 |
$country['258'] = 'Mozambique'; |
| 669 |
$country['95'] = 'Myanmar (Burma)'; |
| 670 |
$country['264'] = 'Namibia'; |
| 671 |
$country['674'] = 'Nauru'; |
| 672 |
$country['977'] = 'Nepal'; |
| 673 |
$country['31'] = 'Netherlands'; |
| 674 |
$country['599'] = 'Netherlands Antilles'; |
| 675 |
$country['687'] = 'New Caledonia'; |
| 676 |
$country['64'] = 'New Zealand'; |
| 677 |
$country['505'] = 'Nicaragua'; |
| 678 |
$country['227'] = 'Niger Republic'; |
| 679 |
$country['234'] = 'Nigeria'; |
| 680 |
$country['683'] = 'Niue Island'; |
| 681 |
$country['6723'] = 'Norfolk'; |
| 682 |
$country['850'] = 'North Korea'; |
| 683 |
$country['47'] = 'Norway'; |
| 684 |
$country['968'] = 'Oman Dem Republic'; |
| 685 |
$country['92'] = 'Pakistan'; |
| 686 |
$country['680'] = 'Palau Republic'; |
| 687 |
$country['970'] = 'Palestine'; |
| 688 |
$country['507'] = 'Panama'; |
| 689 |
$country['675'] = 'Papua New Guinea'; |
| 690 |
$country['595'] = 'Paraguay'; |
| 691 |
$country['51'] = 'Peru'; |
| 692 |
$country['63'] = 'Philippines'; |
| 693 |
$country['48'] = 'Poland'; |
| 694 |
$country['351'] = 'Portugal'; |
| 695 |
$country['1787'] = 'Puerto Rico'; |
| 696 |
$country['974'] = 'Qatar'; |
| 697 |
$country['262'] = 'Reunion Island'; |
| 698 |
$country['40'] = 'Romania'; |
| 699 |
$country['7'] = 'Russia'; |
| 700 |
$country['250'] = 'Rwanda Republic'; |
| 701 |
$country['1670'] = 'Saipan/Mariannas'; |
| 702 |
$country['378'] = 'San Marino'; |
| 703 |
$country['239'] = 'Sao Tome/Principe'; |
| 704 |
$country['966'] = 'Saudi Arabia'; |
| 705 |
$country['221'] = 'Senegal'; |
| 706 |
$country['381'] = 'Serbia'; |
| 707 |
$country['248'] = 'Seychelles Island'; |
| 708 |
$country['232'] = 'Sierra Leone'; |
| 709 |
$country['65'] = 'Singapore'; |
| 710 |
$country['421'] = 'Slovakia'; |
| 711 |
$country['386'] = 'Slovenia'; |
| 712 |
$country['677'] = 'Solomon Islands'; |
| 713 |
$country['252'] = 'Somalia Republic'; |
| 714 |
$country['685'] = 'Somoa'; |
| 715 |
$country['27'] = 'South Africa'; |
| 716 |
$country['82'] = 'South Korea'; |
| 717 |
$country['34'] = 'Spain'; |
| 718 |
$country['94'] = 'Sri Lanka'; |
| 719 |
$country['290'] = 'St. Helena'; |
| 720 |
$country['1869'] = 'St. Kitts'; |
| 721 |
$country['1758'] = 'St. Lucia'; |
| 722 |
$country['508'] = 'St. Pierre'; |
| 723 |
$country['1784'] = 'St. Vincent'; |
| 724 |
$country['249'] = 'Sudan'; |
| 725 |
$country['597'] = 'Suriname'; |
| 726 |
$country['268'] = 'Swaziland'; |
| 727 |
$country['46'] = 'Sweden'; |
| 728 |
$country['41'] = 'Switzerland'; |
| 729 |
$country['963'] = 'Syria'; |
| 730 |
$country['886'] = 'Taiwan'; |
| 731 |
$country['992'] = 'Tajikistan'; |
| 732 |
$country['255'] = 'Tanzania'; |
| 733 |
$country['66'] = 'Thailand'; |
| 734 |
$country['228'] = 'Togo Republic'; |
| 735 |
$country['690'] = 'Tokelau'; |
| 736 |
$country['676'] = 'Tonga Islands'; |
| 737 |
$country['1868'] = 'Trinidad & Tobago'; |
| 738 |
$country['216'] = 'Tunisia'; |
| 739 |
$country['90'] = 'Turkey'; |
| 740 |
$country['993'] = 'Turkmenistan'; |
| 741 |
$country['1649'] = 'Turks & Caicos Island'; |
| 742 |
$country['688'] = 'Tuvalu'; |
| 743 |
$country['256'] = 'Uganda'; |
| 744 |
$country['380'] = 'Ukraine'; |
| 745 |
$country['971'] = 'United Arab Emirates'; |
| 746 |
$country['44'] = 'United Kingdom'; |
| 747 |
$country['598'] = 'Uruguay'; |
| 748 |
$country['1 '] = 'USA/Canada'; |
| 749 |
$country['998'] = 'Uzbekistan'; |
| 750 |
$country['678'] = 'Vanuatu'; |
| 751 |
$country['3966'] = 'Vatican City'; |
| 752 |
$country['58'] = 'Venezuela'; |
| 753 |
$country['84'] = 'Vietnam'; |
| 754 |
$country['1340'] = 'Virgin Islands (US)'; |
| 755 |
$country['681'] = 'Wallis/Futuna Islands'; |
| 756 |
$country['967'] = 'Yemen Arab Republic'; |
| 757 |
$country['260'] = 'Zambia'; |
| 758 |
$country['263'] = 'Zimbabwe'; |
| 759 |
$country[''] = acym_translation('ACYM_PHONE_NOCOUNTRY'); |
| 760 |
|
| 761 |
$countryCodeForSelect = []; |
| 762 |
|
| 763 |
foreach ($country as $key => $one) { |
| 764 |
$countryCodeForSelect[$key] = '+'.$key.' ('.$one.')'; |
| 765 |
} |
| 766 |
|
| 767 |
return acym_select( |
| 768 |
$countryCodeForSelect, |
| 769 |
$name, |
| 770 |
empty($defaultvalue) ? '' : $defaultvalue, |
| 771 |
['class' => 'acym__select__country acym__select'] |
| 772 |
); |
| 773 |
} |
| 774 |
|
| 775 |
function acym_cancelButton(string $text = 'ACYM_CANCEL', string $url = '', string $class = 'button medium-6 large-shrink'): string |
| 776 |
{ |
| 777 |
if (empty($url)) { |
| 778 |
$url = acym_completeLink(acym_getVar('cmd', 'ctrl').'&task=listing'); |
| 779 |
} |
| 780 |
|
| 781 |
return '<a href="'.$url.'" class="cell '.$class.' acym__button__cancel">'.acym_escape(acym_translation($text)).'</a>'; |
| 782 |
} |
| 783 |
|
| 784 |
function acym_tooltip(array $options): string |
| 785 |
{ |
| 786 |
if (!isset($options['classContainer'])) $options['classContainer'] = ''; |
| 787 |
if (!isset($options['classText'])) $options['classText'] = ''; |
| 788 |
if (!isset($options['titleShownInTooltip'])) $options['titleShownInTooltip'] = ''; |
| 789 |
if (!isset($options['textShownInTooltip'])) $options['textShownInTooltip'] = ''; |
| 790 |
if (!isset($options['hoveredText'])) $options['hoveredText'] = ''; |
| 791 |
if (!isset($options['classLink'])) $options['classLink'] = ''; |
| 792 |
|
| 793 |
if (!empty($options['link'])) { |
| 794 |
$options['hoveredText'] = '<a href="'.$options['link'].'" title="'.acym_escape($options['titleShownInTooltip']).'" target="_blank" class="'.acym_escape( |
| 795 |
$options['classLink'] |
| 796 |
).'">'.$options['hoveredText'].'</a>'; |
| 797 |
} |
| 798 |
|
| 799 |
if (!empty($options['titleShownInTooltip'])) { |
| 800 |
$options['titleShownInTooltip'] = '<span class="acym__tooltip__title">'.$options['titleShownInTooltip'].'</span>'; |
| 801 |
} |
| 802 |
|
| 803 |
$tooltip = '<span class="acym__tooltip '.$options['classContainer'].'">'; |
| 804 |
$tooltip .= '<span class="acym__tooltip__text '.$options['classText'].'">'; |
| 805 |
$tooltip .= $options['titleShownInTooltip'].$options['textShownInTooltip'].'</span>'.$options['hoveredText'].'</span>'; |
| 806 |
|
| 807 |
return $tooltip; |
| 808 |
} |
| 809 |
|
| 810 |
function acym_info($options, $class = '', $containerClass = '', $classText = '', $warningInfo = false): string |
| 811 |
{ |
| 812 |
if (!is_array($options)) { |
| 813 |
$options = [ |
| 814 |
'textShownInTooltip' => $options, |
| 815 |
'classContainer' => $containerClass, |
| 816 |
'classIcon' => $class, |
| 817 |
'classText' => $classText, |
| 818 |
'isWarning' => $warningInfo, |
| 819 |
]; |
| 820 |
} |
| 821 |
|
| 822 |
if (!isset($options['textShownInTooltip'])) $options['textShownInTooltip'] = ''; |
| 823 |
if (!isset($options['classContainer'])) $options['classContainer'] = ''; |
| 824 |
if (!isset($options['classText'])) $options['classText'] = ''; |
| 825 |
if (!isset($options['classIcon'])) $options['classIcon'] = ''; |
| 826 |
if (!isset($options['isWarning'])) $options['isWarning'] = false; |
| 827 |
|
| 828 |
$classWarning = $options['isWarning'] ? 'acym__tooltip__info__warning' : ''; |
| 829 |
|
| 830 |
return acym_tooltip( |
| 831 |
[ |
| 832 |
'hoveredText' => '<span class="acym__tooltip__info__container '.$options['classIcon'].'"><i class="acym__tooltip__info__icon acymicon-info-circle '.$classWarning.'"></i></span>', |
| 833 |
'textShownInTooltip' => acym_translation($options['textShownInTooltip']), |
| 834 |
'classContainer' => 'acym__tooltip__info '.$options['classContainer'], |
| 835 |
'classText' => $options['classText'], |
| 836 |
] |
| 837 |
); |
| 838 |
} |
| 839 |
|
| 840 |
function acym_sortBy($options, $listing, $default = '', $defaultSortOrdering = 'desc') |
| 841 |
{ |
| 842 |
$default = empty($default) ? reset($options) : $default; |
| 843 |
|
| 844 |
$selected = acym_getVar('string', $listing.'_ordering', $default); |
| 845 |
$orderingSortOrder = acym_getVar('string', $listing.'_ordering_sort_order', $defaultSortOrdering); |
| 846 |
$classSortOrder = $orderingSortOrder == 'asc' ? 'acymicon-sort-amount-asc' : 'acymicon-sort-amount-desc'; |
| 847 |
|
| 848 |
$display = '<span class="acym__color__dark-gray">'.acym_translation('ACYM_SORT_BY').'</span>'; |
| 849 |
$display .= acym_select( |
| 850 |
$options, |
| 851 |
$listing.'_ordering', |
| 852 |
$selected, |
| 853 |
[ |
| 854 |
'id' => 'acym__listing__ordering', |
| 855 |
'class' => 'acym__select acym__select__sort', |
| 856 |
] |
| 857 |
); |
| 858 |
|
| 859 |
$tooltipText = $orderingSortOrder == 'asc' ? acym_translation('ACYM_SORT_ASC') : acym_translation('ACYM_SORT_DESC'); |
| 860 |
$display .= acym_tooltip( |
| 861 |
[ |
| 862 |
'hoveredText' => '<i class="'.$classSortOrder.' acym__listing__ordering__sort-order" aria-hidden="true"></i>', |
| 863 |
'textShownInTooltip' => $tooltipText, |
| 864 |
] |
| 865 |
); |
| 866 |
|
| 867 |
$display .= '<input type="hidden" id="acym__listing__ordering__sort-order--input" name="'.$listing.'_ordering_sort_order" value="'.$orderingSortOrder.'">'; |
| 868 |
|
| 869 |
return $display; |
| 870 |
} |
| 871 |
|
| 872 |
function acym_checkbox($values, $name, $selected = [], $label = '', $parentClass = '', $labelClass = '', $dataAttr = '') |
| 873 |
{ |
| 874 |
echo '<div class="'.$parentClass.'"><div class="cell acym__label '.$labelClass.'">'.$label.'</div><div class="cell auto grid-x">'; |
| 875 |
foreach ($values as $key => $value) { |
| 876 |
$dtAttr = ''; |
| 877 |
if (!empty($dataAttr[$key])) $dtAttr = 'data-attr="'.$dataAttr[$key].'"'; |
| 878 |
echo '<label class="cell grid-x margin-top-1"><input type="checkbox" name="'.$name.'" value="'.$key.'" '.(in_array( |
| 879 |
$key, |
| 880 |
$selected |
| 881 |
) ? 'checked' : '').' '.$dtAttr.'>'.$value.'</label>'; |
| 882 |
} |
| 883 |
echo '</div></div>'; |
| 884 |
} |
| 885 |
|
| 886 |
function acym_switchFilter($switchOptions, $selected, $name, $addClass = '') |
| 887 |
{ |
| 888 |
$return = '<input type="hidden" id="acym__type-template-'.$name.'" name="'.$name.'" value="'.$selected.'">'; |
| 889 |
foreach ($switchOptions as $value => $text) { |
| 890 |
$class = 'button button-secondary acym__type__choosen cell small-6 xlarge-auto large-shrink'; |
| 891 |
if ($value == $selected) { |
| 892 |
$class .= ' is-active'; |
| 893 |
} |
| 894 |
$class .= ' '.$addClass; |
| 895 |
$return .= '<button class="'.acym_escape($class).'" type="button" data-type="'.acym_escape($value).'">'.acym_translation($text).'</button>'; |
| 896 |
} |
| 897 |
|
| 898 |
return $return; |
| 899 |
} |
| 900 |
|
| 901 |
function acym_filterStatus($options, $selected, $name) |
| 902 |
{ |
| 903 |
$filterStatus = '<input type="hidden" id="acym_filter_status" name="'.acym_escape($name).'" value="'.acym_escape($selected).'"/>'; |
| 904 |
|
| 905 |
foreach ($options as $value => $text) { |
| 906 |
$class = 'acym__filter__status '; |
| 907 |
if ($value == $selected) { |
| 908 |
$class .= ' font-bold acym__status__select'; |
| 909 |
} |
| 910 |
|
| 911 |
$extraIcon = ''; |
| 912 |
if (!empty($text[2]) && 'pending' == $text[2]) { |
| 913 |
$extraIcon = ' <i class="acymicon-exclamation-triangle acym__color__orange" style="font-size: 15px;"></i>'; |
| 914 |
} |
| 915 |
|
| 916 |
if (is_null($text[1])) { |
| 917 |
$disabled = ''; |
| 918 |
$userCount = ''; |
| 919 |
} else { |
| 920 |
$disabled = empty($text[1]) ? ' disabled' : ''; |
| 921 |
$userCount = ' ('.$text[1].')'; |
| 922 |
} |
| 923 |
$filterStatus .= '<button type="button" acym-data-status="'.acym_escape($value).'" class="'.acym_escape($class).'"'.$disabled.'>'; |
| 924 |
$filterStatus .= acym_translation($text[0]).$extraIcon.'<span class="acym__filter__status__number">'.$userCount.'</span></button>'; |
| 925 |
} |
| 926 |
|
| 927 |
return $filterStatus; |
| 928 |
} |
| 929 |
|
| 930 |
function acym_filterSearch($search, $name, $placeholder = 'ACYM_SEARCH', $showClearBtn = true, $additionnalClasses = '') |
| 931 |
{ |
| 932 |
$searchField = '<div class="input-group acym__search-area '.$additionnalClasses.'"> |
| 933 |
<div class="input-group-button"> |
| 934 |
<button class="button acym__search__button"><i class="acymicon-search"></i></button> |
| 935 |
</div> |
| 936 |
<input class="input-group-field acym__search-field" type="text" name="'.acym_escape($name).'" placeholder="'.acym_escape( |
| 937 |
acym_translation($placeholder) |
| 938 |
).'" value="'.acym_escape($search).'">'; |
| 939 |
if ($showClearBtn) { |
| 940 |
$searchField .= '<span class="acym__search-clear"><i class="acymicon-close"></i></span>'; |
| 941 |
} |
| 942 |
$searchField .= '</div>'; |
| 943 |
|
| 944 |
return $searchField; |
| 945 |
} |
| 946 |
|
| 947 |
function acym_displayParam($type, $value, $name, $params = []) |
| 948 |
{ |
| 949 |
if (!include_once ACYM_FRONT.'params'.DS.$type.'.php') return ''; |
| 950 |
|
| 951 |
$class = 'JFormField'.ucfirst($type); |
| 952 |
|
| 953 |
$field = new $class(); |
| 954 |
$field->value = $value; |
| 955 |
$field->name = $name; |
| 956 |
|
| 957 |
if (!empty($params)) { |
| 958 |
foreach ($params as $param => $val) { |
| 959 |
$field->$param = $val; |
| 960 |
} |
| 961 |
} |
| 962 |
|
| 963 |
return $field->getInput(); |
| 964 |
} |
| 965 |
|
| 966 |
function acym_externalLink($text, $link, $displayIcon = true, $openInNewTab = true, $classesA = []) |
| 967 |
{ |
| 968 |
$target = $openInNewTab ? 'target="_blank"' : ''; |
| 969 |
$link = 'href="'.$link.'"'; |
| 970 |
$icon = $displayIcon ? ' <i class="acymicon-external-link"></i>' : ''; |
| 971 |
$translatedText = acym_translation($text); |
| 972 |
$classesA[] = 'acym__external__link'; |
| 973 |
$classesAHtml = 'class="'.implode(' ', $classesA).'"'; |
| 974 |
|
| 975 |
return '<a '.$target.' '.$link.' '.$classesAHtml.'>'.$translatedText.$icon.'</a>'; |
| 976 |
} |
| 977 |
|