<!-- volume/problem-dashboard.phtml -->

<h1 class="dashboard">
	<a href="<?php echo $this->baseUrl;?>/volume/problem" id="dashboard">
		<?php echo $this->escape($this->titleProblemVolumes); ?>
	</a>
</h1>

<?php if ($this->resultProblemVolumes): ?>
<table id="box-table-dashboard">
<thead>
<tr>
	<th scope="col"> <?php print $this->translate->_("Volume Name"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Volume Status"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Volume Bytes"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Max Volume<br />Bytes"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Volume Jobs"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Volume<br />Retention<br />(days)"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Media<br />Type"); ?> </th>
</tr>
</thead>
<tbody>
<?php foreach($this->resultProblemVolumes as $line) : ?>
<tr>
	<td align="left">
	<a href="<?php echo $this->baseUrl.'/volume/detail/mediaid/'.$this->escape($line['mediaid']);?>"
	   title="<?php echo $this->translate->_("Detail Volume");?>"><?php echo $this->escape($line['volumename']);?>
    </a>
    </td>

	<?php
		// http://www.bacula.org/developers/Catalog_Services.html
		// Status of media: Full, Archive, Append, Recycle, Read-Only, Disabled, Error, Busy
		if ( $this->escape($line['volstatus']) == 'Disabled' )
			echo '<td class="warn" align="center">', $this->escape($line['volstatus']), '</td>';
		elseif ( $this->escape($line['volstatus']) == 'Error' )
			echo '<td class="err" align="center">', $this->escape($line['volstatus']), '</td>';
		else
			echo '<td align="center">', $this->escape($line['volstatus']), '</td>';
	?>

	<td align="right"><?php echo $this->ConvBytes($this->escape($line['volbytes']));?></td>
	<td align="right"><?php echo $this->ConvBytes($this->escape($line['maxvolbytes']));?></td>

	<?php
		if ( ( isset($line['firstwritten'])) && ($this->escape($line['voljobs']) <= 0) )
			echo '<td class="warn" align="right">', number_format($this->escape($line['voljobs'])), '</td>';
		else
		    echo '<td align="right"> <a href="', $this->baseUrl, '/job/find-volume-name/volname/', $this->escape($line['volumename']), '" ',
		        'title="', $this->translate->_("List Jobs by Volume Name"), '">',
                number_format($this->escape($line['voljobs'])), '</a></td>';
	?>

	<td align="center"><?php echo $this->ConvSecondsToDays($this->escape($line['volretention']));?></td>
	<td><?php echo $this->escape($line['mediatype']);?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

<?php else: ?>
<div class="ui-widget" style="float: left;">
	<div class="ui-state-highlight ui-corner-all">
		<p class="dashboard"><span class="ui-icon ui-icon-circle-check" style="float: left; margin-right: 0.3em;"></span>
		<?php print $this->translate->_("Information from DB Catalog : All Volumes are OK.");?></p>
	</div>
</div>
<div style="clear: both;"><!--  --></div>
<?php endif; ?>