| 1 |
<?php |
| 2 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- View file, its variables are local to the include scope, not true globals. |
| 3 |
defined('ABSPATH') || die('Restricted Access'); |
| 4 |
?> |
| 5 |
<?php echo esc_html($data['warnings']); ?> |
| 6 |
<form id="acym_form" enctype="multipart/form-data" action="<?php echo esc_url(acym_completeLink(acym_getVar('cmd', 'ctrl'))); ?>" method="post" name="acyForm"> |
| 7 |
<div id="acym__file__select"> |
| 8 |
<div class="acym__file__select grid-x"> |
| 9 |
<div class="acym__file__select__area cell grid-x"> |
| 10 |
<?php |
| 11 |
$data['fileTreeType']->display($data['folders'], $data['uploadFolder'], 'currentFolder'); |
| 12 |
|
| 13 |
if (empty($data['files'])) { |
| 14 |
echo esc_html(acym_translation('ACYM_NO_FILE_HERE')); |
| 15 |
} else { |
| 16 |
$preparedFiles = []; |
| 17 |
foreach ($data['files'] as $k => $file) { |
| 18 |
$ext = strtolower(substr($file, strrpos($file, '.') + 1)); |
| 19 |
|
| 20 |
if (!in_array($ext, $data['allowedExtensions'])) { |
| 21 |
continue; |
| 22 |
} |
| 23 |
|
| 24 |
if (in_array($ext, $data['imageExtensions'])) { |
| 25 |
$srcImg = ACYM_LIVE.rtrim($data['uploadFolder'], DS).'/'.$file; |
| 26 |
} else { |
| 27 |
$srcImg = ACYM_LIVE.str_replace(DS, '/', ACYM_MEDIA_FOLDER).'images/icons/file.png'; |
| 28 |
} |
| 29 |
|
| 30 |
$selected = $data['selectedFile'] === $file ? 'acym_clickme' : ''; |
| 31 |
|
| 32 |
$preparedFiles[] = [ |
| 33 |
'image' => $srcImg, |
| 34 |
'file' => $file, |
| 35 |
'ext' => $ext, |
| 36 |
'selected' => $selected, |
| 37 |
]; |
| 38 |
} |
| 39 |
|
| 40 |
// Switch between grid and list views button |
| 41 |
?> |
| 42 |
<div id="acym__file__select__area__switch" class="cell medium-1 grid-x align-right"> |
| 43 |
<button type="button" id="acym__file__select__area__switch__grid" class="is-hidden"><i class="acymicon-th"></i></button> |
| 44 |
<button type="button" id="acym__file__select__area__switch__list"><i class="acymicon-menu"></i></button> |
| 45 |
</div> |
| 46 |
<?php |
| 47 |
// Display the grid view |
| 48 |
echo '<div id="acym__file__select__area__grid" class="margin-top-1 cell grid-x large-up-4 medium-up-3 small-up-2 grid-margin-x align-center">'; |
| 49 |
foreach ($preparedFiles as $oneFile) { |
| 50 |
?> |
| 51 |
<div class="cell acym__file__select__onepic text-center"> |
| 52 |
<a href="#" |
| 53 |
class="acym__file__select__add grid-x <?php echo esc_attr($oneFile['selected']); ?>" |
| 54 |
mapdata="<?php echo esc_attr($oneFile['file']); ?>"> |
| 55 |
<?php |
| 56 |
if (strlen($oneFile['file']) > 20) { |
| 57 |
echo '<span class="cell acym__file__select__title" title="'.esc_attr($oneFile['file']).'">'; |
| 58 |
echo esc_html(substr(rtrim($oneFile['file'], $oneFile['ext']), 0, 12).'...'.$oneFile['ext']); |
| 59 |
echo '</span>'; |
| 60 |
} else { |
| 61 |
echo '<span class="cell acym__file__select__title">'.esc_html($oneFile['file']).'</span>'; |
| 62 |
} |
| 63 |
?> |
| 64 |
<div class="cell"> |
| 65 |
<img src="<?php echo esc_attr($oneFile['image']); ?>" alt="" /> |
| 66 |
</div> |
| 67 |
</a> |
| 68 |
</div> |
| 69 |
<?php |
| 70 |
} |
| 71 |
echo '</div>'; |
| 72 |
|
| 73 |
// Display the list view |
| 74 |
echo '<div id="acym__file__select__area__list" class="margin-top-1 is-hidden cell grid-x">'; |
| 75 |
foreach ($preparedFiles as $oneFile) { |
| 76 |
?> |
| 77 |
<a href="#" class="acym__file__select__add cell grid-x" mapdata="<?php echo esc_attr($oneFile['file']); ?>"> |
| 78 |
<?php echo esc_html($oneFile['file']); ?> |
| 79 |
</a> |
| 80 |
<?php |
| 81 |
} |
| 82 |
echo '</div>'; |
| 83 |
} |
| 84 |
?> |
| 85 |
<input type="hidden" id="acym__file__select__mapid" value="<?php echo esc_attr($data['map']); ?>"> |
| 86 |
</div> |
| 87 |
<div class="acym__file__select__area cell grid-x text-center"> |
| 88 |
<?php acym_inputFile('uploadedFile', '', 'cell medium-shrink'); ?> |
| 89 |
<input type="hidden" name="currentFolder" value="<?php echo esc_attr($data['uploadFolder']); ?>" /> |
| 90 |
<input type="hidden" name="id" value="<?php echo esc_attr($data['map']); ?>" /> |
| 91 |
<div class="cell medium-auto hide-for-small-only"></div> |
| 92 |
<button type="button" |
| 93 |
class="cell medium-shrink button button-secondary acy_button_submit" |
| 94 |
type="submit" |
| 95 |
data-task="select"> <?php echo esc_html(acym_translation('ACYM_IMPORT')); ?> </button> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
<?php acym_formOptions(); ?> |
| 100 |
</form> |
| 101 |
|