<?php

	/**
	 * Template für die Liste der Produkte innerhalb der Bestellansicht, wird per Ajax neu geladen
	 */

?>
<?php if (wpsg_isSizedArray($this->view['messages'])) { ?>
<?php foreach ($this->view['messages'] as $m) { ?>
<div class="updated"><p><?php echo wpsg_hspc($m); ?></p></div>
<?php } ?>
<?php } ?>
<?php if (wpsg_isSizedArray($this->view['errors'])) { ?>
<?php foreach ($this->view['errors'] as $e) { ?>
<div class="error"><p><?php echo wpsg_hspc($e); ?></p></div>
<?php } ?>
<?php } ?>
<table class="wpsg_mod_videodownload_order_view_filelist">
	<tr>
		<th class="col_file"><?php echo __('Datei', 'wpsg'); ?></th>
		<th class="col_status"><?php echo __('Status', 'wpsg'); ?></th>
		<th class="col_counter">#</th>
		<th class="col_action"></th>				
	</tr>
	<?php foreach ($this->view['arFiles'] as $f) { ?>
	<tr class="<?php echo (($f[1] !== false && $f[1]['raid'] === true)?'row_raid':''); ?>">
		<td class="col_file">
			<?php if ($f[1] !== false && strtotime($f[1]['done']) > 0) { ?>
			<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_videodownload&cmd=download_indivfile&edit_id=<?php echo $f[1]['o_id']; ?>&file=<?php echo rawurlencode($f[1]['out_file']); ?>&noheader=1">
			<?php } ?>
			<?php echo wpsg_hspc(substr($this->callMod('wpsg_mod_videodownload', 'getNewName', array($f[0], $_REQUEST['edit_id'])), 0, 25)); ?>
			<?php if ($f[1] !== false && strtotime($f[1]['done']) > 0) { ?>
			</a>
			<?php } ?>
		</td>
		<td class="col_status">
			<?php if ($f[1] === false) { ?>
			<?php echo __('Noch nicht geplant.', 'wpsg'); ?>
			<?php } else if (strtotime($f[1]['scheduled']) > 0 && strtotime($f[1]['done']) <= 0) { ?>
			<?php echo wpsg_translate(__('Geplant am #1#', 'wpsg'), wpsg_fromDate($f[1]['scheduled'])); ?>
			<?php } else if (strtotime($f[1]['done']) > 0) { ?>
			<?php echo wpsg_translate(__('Durchgeführt am #1#', 'wpsg'), wpsg_fromDate($f[1]['done'])); ?>			
			<?php } ?>
		</td>
		<td class="col_counter"><?php echo (($f[1] !== false)?$f[1]['counter']:'0'); ?></td>
		<td class="col_action">
			<?php if ($f[1] === false) { ?>
			<a href="#" onclick="return wpsg_mod_videodownload_schedule('<?php echo rawurldecode($f[0]); ?>');"><?php echo __('Planen', 'wpsg'); ?></a>
			<?php } else if (strtotime($f[1]['scheduled']) > 0 && strtotime($f[1]['done']) <= 0) { ?>
			<a href="#" onclick="return wpsg_mod_videodownload_cangelschedule('<?php echo rawurldecode($f[0]); ?>');"><?php echo __('Abbrechen', 'wpsg'); ?></a>
			<?php } ?>
		</td>
	</tr>
	<?php } ?>
</table>
<br />
<input type="button" onclick="return wpsg_mod_videodownload_send();" value="<?php echo __('Fertige Downloads an Kunden senden', 'wpsg'); ?>" /><br />
<input type="button" onclick="return wpsg_mod_videodownload_reindiv();" value="<?php echo __('Alle Dokumente neu planen', 'wpsg'); ?>" />
<input type="button" onclick="return wpsg_mod_videodownload_reset();" value="<?php echo __('Zähler zurücksetzen', 'wpsg'); ?>" />