| @@ -1,0 +1,209 @@ | ||
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * @package VikBooking | |
| 4 | + * @subpackage core | |
| 5 | + * @author E4J s.r.l. | |
| 6 | + * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. | |
| 7 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL | |
| 8 | + * @link https://vikwp.com | |
| 9 | + */ | |
| 10 | + | |
| 11 | +// No direct access | |
| 12 | +defined('ABSPATH') or die('No script kiddies please!'); | |
| 13 | + | |
| 14 | +JHtml::fetch('vbohtml.scripts.ajaxcsrf'); | |
| 15 | + | |
| 16 | +$rows = $this->rows; | |
| 17 | + | |
| 18 | +$canEdit = JFactory::getUser()->authorise('core.admin', 'com_vikbooking'); | |
| 19 | +?> | |
| 20 | + | |
| 21 | +<form action="index.php?option=com_vikbooking" method="post" name="adminForm" id="adminForm"> | |
| 22 | + | |
| 23 | +<?php | |
| 24 | +if (count($rows) == 0) | |
| 25 | +{ | |
| 26 | + ?> | |
| 27 | + <p class="warn"><?php echo JText::translate('JGLOBAL_NO_MATCHING_RESULTS'); ?></p> | |
| 28 | + <?php | |
| 29 | +} | |
| 30 | +else | |
| 31 | +{ | |
| 32 | + ?> | |
| 33 | + <div class="vbo-list-form"> | |
| 34 | + <div class="table-responsive"> | |
| 35 | + <table cellpadding="4" cellspacing="0" border="0" width="100%" class="table table-striped vbo-list-table"> | |
| 36 | + <thead> | |
| 37 | + <tr> | |
| 38 | + | |
| 39 | + <th width="1%"> | |
| 40 | + <input type="checkbox" onclick="Joomla.checkAll(this)" value="" name="checkall-toggle"> | |
| 41 | + </th> | |
| 42 | + | |
| 43 | + <!-- DATE --> | |
| 44 | + | |
| 45 | + <th class="title left" width="20%" style="text-align: left;"> | |
| 46 | + <a href="index.php?option=com_vikbooking&view=backups&filter_order=createdon&filter_order_Dir=<?php echo ($this->ordering == "createdon" && $this->orderDir == "ASC" ? "DESC" : "ASC"); ?>" class="<?php echo ($this->ordering == "createdon" && $this->orderDir == "ASC" ? "vbo-list-activesort" : ($this->ordering == "createdon" ? "vbo-list-activesort" : "")); ?>"> | |
| 47 | + <?php echo JText::translate('VBOINVDATE').($this->ordering == "createdon" && $this->orderDir == "ASC" ? '<i class="'.VikBookingIcons::i('sort-asc').'"></i>' : ($this->ordering == "createdon" ? '<i class="'.VikBookingIcons::i('sort-desc').'"></i>' : '<i class="'.VikBookingIcons::i('sort').'"></i>')); ?> | |
| 48 | + </a> | |
| 49 | + </th> | |
| 50 | + | |
| 51 | + <!-- TYPE --> | |
| 52 | + | |
| 53 | + <th class="title left" width="20%" style="text-align: left;"> | |
| 54 | + <?php echo JText::translate('VBO_CONFIG_BACKUP_TYPE'); ?> | |
| 55 | + </th> | |
| 56 | + | |
| 57 | + <!-- SIZE --> | |
| 58 | + | |
| 59 | + <th class="title hidden-phone nowrap" width="8%" style="text-align: center;"> | |
| 60 | + <a href="index.php?option=com_vikbooking&view=backups&filter_order=filesize&filter_order_Dir=<?php echo ($this->ordering == "filesize" && $this->orderDir == "ASC" ? "DESC" : "ASC"); ?>" class="<?php echo ($this->ordering == "filesize" && $this->orderDir == "ASC" ? "vbo-list-activesort" : ($this->ordering == "filesize" ? "vbo-list-activesort" : "")); ?>"> | |
| 61 | + <?php echo JText::translate('VBO_BACKUP_SIZE').($this->ordering == "filesize" && $this->orderDir == "ASC" ? '<i class="'.VikBookingIcons::i('sort-asc').'"></i>' : ($this->ordering == "filesize" ? '<i class="'.VikBookingIcons::i('sort-desc').'"></i>' : '<i class="'.VikBookingIcons::i('sort').'"></i>')); ?> | |
| 62 | + </a> | |
| 63 | + </th> | |
| 64 | + | |
| 65 | + <!-- ACTIONS --> | |
| 66 | + | |
| 67 | + <?php | |
| 68 | + if ($canEdit) | |
| 69 | + { | |
| 70 | + ?> | |
| 71 | + <th class="title hidden-phone nowrap" width="14%" style="text-align: center;" colspan="2"> | |
| 72 | + <?php echo JText::translate('VBCRONACTIONS'); ?> | |
| 73 | + </th> | |
| 74 | + <?php | |
| 75 | + } | |
| 76 | + ?> | |
| 77 | + | |
| 78 | + </tr> | |
| 79 | + </thead> | |
| 80 | + | |
| 81 | + <?php | |
| 82 | + for ($i = 0, $n = count($rows); $i < $n; $i++) | |
| 83 | + { | |
| 84 | + $row = $rows[$i]; | |
| 85 | + ?> | |
| 86 | + <tr class="row<?php echo ($i % 2); ?>"> | |
| 87 | + | |
| 88 | + <td> | |
| 89 | + <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $this->escape($row->name); ?>" onclick="Joomla.isChecked(this.checked);"> | |
| 90 | + </td> | |
| 91 | + | |
| 92 | + <!-- NAME --> | |
| 93 | + | |
| 94 | + <td> | |
| 95 | + <?php echo JHtml::fetch('date', $row->date, 'Y-m-d H:i:s'); ?> | |
| 96 | + </td> | |
| 97 | + | |
| 98 | + <!-- TYPE --> | |
| 99 | + | |
| 100 | + <td> | |
| 101 | + <?php echo $row->type->name; ?> | |
| 102 | + </td> | |
| 103 | + | |
| 104 | + <!-- SIZE --> | |
| 105 | + | |
| 106 | + <td style="text-align: center;" class="hidden-phone"> | |
| 107 | + <?php echo JHtml::fetch('number.bytes', $row->size); ?> | |
| 108 | + </td> | |
| 109 | + | |
| 110 | + <!-- ACTIONS --> | |
| 111 | + | |
| 112 | + <?php | |
| 113 | + if ($canEdit) | |
| 114 | + { | |
| 115 | + ?> | |
| 116 | + <td style="text-align: right;" class="hidden-phone" width="7%"> | |
| 117 | + <a href="<?php echo VBOFactory::getPlatform()->getUri()->addCSRF('index.php?option=com_vikbooking&task=backup.restore&cid[]=' . $this->escape($row->name), $xhtml = true); ?>" class="backup-restore-link btn btn-danger"> | |
| 118 | + <?php echo JText::translate('VBO_WIDGETS_RESTDEFAULTSHORT'); ?> | |
| 119 | + </a> | |
| 120 | + </td> | |
| 121 | + | |
| 122 | + <td style="text-align: left;" class="hidden-phone" width="7%"> | |
| 123 | + <a href="<?php echo $row->url; ?>" class="btn btn-primary"> | |
| 124 | + <?php echo JText::translate('VBO_BACKUP_DOWNLOAOD'); ?> | |
| 125 | + </a> | |
| 126 | + </td> | |
| 127 | + <?php | |
| 128 | + } | |
| 129 | + ?> | |
| 130 | + | |
| 131 | + </tr> | |
| 132 | + <?php | |
| 133 | + } | |
| 134 | + ?> | |
| 135 | + </table> | |
| 136 | + </div> | |
| 137 | + </div> | |
| 138 | + <?php | |
| 139 | +} | |
| 140 | +?> | |
| 141 | + | |
| 142 | + <input type="hidden" name="boxchecked" value="0" /> | |
| 143 | + <input type="hidden" name="task" value="" /> | |
| 144 | + <input type="hidden" name="view" value="backups" /> | |
| 145 | + | |
| 146 | + <?php echo JHtml::fetch('form.token'); ?> | |
| 147 | + <?php echo $this->navbut; ?> | |
| 148 | +</form> | |
| 149 | + | |
| 150 | +<?php | |
| 151 | +// render modal script | |
| 152 | +echo VikBooking::getVboApplication()->getJmodalScript(); | |
| 153 | + | |
| 154 | +// load create modal content | |
| 155 | +echo JHtml::fetch( | |
| 156 | + 'bootstrap.renderModal', | |
| 157 | + 'jmodal-newbackup', | |
| 158 | + array( | |
| 159 | + 'title' => JText::translate('VBOMAINTITLENEWBACKUP'), | |
| 160 | + 'closeButton' => true, | |
| 161 | + 'keyboard' => false, | |
| 162 | + 'bodyHeight' => 80, | |
| 163 | + 'width' => 60, | |
| 164 | + 'footer' => '<button type="button" class="btn btn-success" data-role="backup.save">' . JText::translate('VBSAVE') . '</button>', | |
| 165 | + ), | |
| 166 | + $this->loadTemplate('modal') | |
| 167 | +); | |
| 168 | + | |
| 169 | +JText::script('VBOBACKUPRESTORECONF1'); | |
| 170 | +JText::script('VBOBACKUPRESTORECONF2'); | |
| 171 | +?> | |
| 172 | + | |
| 173 | +<script> | |
| 174 | + | |
| 175 | + (function($) { | |
| 176 | + 'use strict'; | |
| 177 | + | |
| 178 | + Joomla.submitbutton = (task) => { | |
| 179 | + if (task === 'backup.add') { | |
| 180 | + vboOpenJModal('newbackup'); | |
| 181 | + } else { | |
| 182 | + Joomla.submitform(task, document.adminForm); | |
| 183 | + } | |
| 184 | + } | |
| 185 | + | |
| 186 | + $(function() { | |
| 187 | + $('a.backup-restore-link').on('click', (event) => { | |
| 188 | + let r = confirm(Joomla.JText._('VBOBACKUPRESTORECONF1')); | |
| 189 | + | |
| 190 | + if (!r) { | |
| 191 | + return false; | |
| 192 | + } | |
| 193 | + | |
| 194 | + r = confirm(Joomla.JText._('VBOBACKUPRESTORECONF2')); | |
| 195 | + | |
| 196 | + if (!r) { | |
| 197 | + return false | |
| 198 | + } | |
| 199 | + | |
| 200 | + return true; | |
| 201 | + }); | |
| 202 | + }); | |
| 203 | + })(jQuery); | |
| 204 | + | |
| 205 | + function vboCloseJModal(id) { | |
| 206 | + jQuery('#jmodal-' + id).modal('toggle'); | |
| 207 | + } | |
| 208 | + | |
| 209 | +</script> | |