Skip to content
This repository
Browse code

Add export archive sub template

  • Loading branch information...
commit 74c57ef2ade9e694fdaa4bd65cbb02576628d1f2 1 parent dd4cc01
Nikolai Plath authored April 29, 2012
2  administrator/components/com_easycreator/version.txt
... ...
@@ -1 +1 @@
1  
-0.0.16-37-ga0e1ae9
  1
+0.0.16-38-gdd4cc01
77  administrator/components/com_easycreator/views/templates/tmpl/export_archive.php
... ...
@@ -0,0 +1,77 @@
  1
+<?php defined('_JEXEC') || die('=;)');
  2
+/**
  3
+ * @package    EasyCreator
  4
+ * @subpackage Views
  5
+ * @author     Nikolai Plath
  6
+ * @author     Created on 28-Apr-2012
  7
+ * @license    GNU/GPL, see JROOT/LICENSE.php
  8
+ */
  9
+
  10
+$exportTypes = JFolder::folders(ECRPATH_EXPORTS);
  11
+
  12
+echo '<h2>'.jgettext('Exports').'</h2>';
  13
+
  14
+foreach($exportTypes as $exportType) :
  15
+    echo '<h3>'.jgettext($exportType).'</h3>';
  16
+    $exportFiles = JFolder::files(ECRPATH_EXPORTS.DS.$exportType, 'gz$');
  17
+
  18
+    if(! count($exportFiles)) :
  19
+        EcrHtml::displayMessage(jgettext('Archive is empty'));
  20
+
  21
+        continue;
  22
+    endif;
  23
+
  24
+    $base_href = str_replace(JPATH_ROOT.DS, '', ECRPATH_EXPORTS.DS.$exportType);
  25
+    $base_href = str_replace(DS, '/', $base_href);
  26
+    $base_href = JURI::Root().$base_href;
  27
+
  28
+    rsort($exportFiles);
  29
+    ?>
  30
+<table class="adminlist" cellspacing="5">
  31
+    <tbody>
  32
+    <tr style="background-color: #eee;">
  33
+        <th><?php echo jgettext('File'); ?></th>
  34
+        <th><?php echo jgettext('Modified'); ?></th>
  35
+        <th><?php echo jgettext('Size'); ?></th>
  36
+        <th><?php echo jgettext('Action'); ?></th>
  37
+    </tr>
  38
+        <?php
  39
+        $k = 0;
  40
+
  41
+        foreach($exportFiles as $fileName) :
  42
+            $info = lstat(ECRPATH_EXPORTS.DS.$exportType.DS.$fileName);
  43
+            $date = JFactory::getDate($info[9]);
  44
+            $href = $base_href.'/'.$fileName;
  45
+            $fsize = $info[7];
  46
+
  47
+            $js_delete = '';
  48
+            $js_delete .= " document.adminForm.file_name.value='".$fileName."';";
  49
+
  50
+            $js_delete .= " document.adminForm.file_path.value='"
  51
+                .str_replace(JPATH_ROOT.DS, '', ECRPATH_EXPORTS.DS.$exportType)."';";
  52
+
  53
+            $js_delete .= " submitbutton('delete');";
  54
+
  55
+            $js_delete .= ' onclick="'.$js_delete.'"';
  56
+
  57
+            ?>
  58
+        <tr id="row<?php echo $fileName; ?>" class="<?php echo 'row'.$k; ?>">
  59
+            <td><a href="<?php echo $href; ?>"><?php echo $fileName; ?></a></td>
  60
+            <td><?php echo $date->toFormat(); ?></td>
  61
+            <td><?php echo EcrHtml::byte_convert($fsize); ?></td>
  62
+            <td width="2%">
  63
+                <a href="javascript:" style="padding-left: 20px; height: 14px;"
  64
+                   class="ecr_button img icon-16-delete hasEasyTip"
  65
+                   title="<?php echo jgettext('Delete').'::'.$fileName; ?>" <?php echo $js_delete; ?>>
  66
+                </a>
  67
+            </td>
  68
+        </tr>
  69
+            <?php
  70
+            $k = 1 - $k;
  71
+        endforeach;
  72
+        ?>
  73
+    </tbody>
  74
+</table>
  75
+<?php
  76
+
  77
+endforeach;

0 notes on commit 74c57ef

Please sign in to comment.
Something went wrong with that request. Please try again.