I have a directory viewer that generates rows based on the files present in the directory that are displayed on the grid. I'm trying to add checkboxes that, when checked, will add the selected files to a zip archive. Currently my code is this
<div id="directory-list-header">
<div class="row">
<div class="col-md-7 col-sm-6 col-xs-10">File</div>
<div class="col-md-1 col-sm-2 col-xs-2 text-right">Size</div>
<div class="col-md-2 col-sm-2 hidden-xs text-right">Last Modified</div>
<div class="col-md-2 col-sm-2 col-xs-2 text-right">Select</div>
</div>
</div>
<ul id="directory-listing" class="nav nav-pills nav-stacked">
<?php foreach($dirArray as $name => $fileInfo): ?>
<li data-name="<?php echo $name; ?>" data-href="<?php echo $fileInfo['url_path']; ?>">
<a href="<?php echo $fileInfo['url_path']; ?>" class="clearfix" data-name="<?php echo $name; ?>">
<div class="row">
<span class="file-name col-md-7 col-sm-6 col-xs-9">
<i class="fa <?php echo $fileInfo['icon_class']; ?> fa-fw"></i>
<?php echo $name; ?>
</span>
<span class="file-size col-md-1 col-sm-2 col-xs-3 text-right">
<?php echo $fileInfo['file_size']; ?>
</span>
<span class="file-modified col-md-2 col-sm-2 hidden-xs text-right">
<?php echo $fileInfo['mod_time']; ?>
</span>
<span class="selected col-md-2 col-sm-2 col-xs-1 text-right">
<form method="get">
<input type="checkbox" name="selected[]" value="<?php echo $fileInfo['url_path']; ?>">
</form>
</span>
</div>
I added the <span>
tag and I was thinking that I should add any files that are checked to an array, then send that array to a zip using ZipArchive()
and serving it to the client via a stream, however I'm not sure how the code would look for the checkbox logic since this is my first foray into HTML/PHP. Any help would be appreciated, I have the user interface squared away, it's just a matter of getting the background working