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

<h1><?php echo $this->escape($this->titleProblemVolumes); ?></h1>

<?php if ($this->resultProblemVolumes): ?>
<table id="box-table">
<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>
	<th scope="col"> <?php print $this->translate->_("First<br />Written"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Last<br />Written"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Autochanger<br />Slot<br />number"); ?> </th>
	<th scope="col"> <?php print $this->translate->_("Can Recycle<br />Volume"); ?> </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>
	<td><?php echo $this->escape($line['firstwritten']);?></td>
	<td><?php echo $this->escape($line['lastwritten']);?></td>
	<td align="right"><?php echo $this->escape($line['slot']);?></td>
	<td align="right"><?php echo $this->Int2Char($this->escape($line['recycle']));?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>

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

<p>&nbsp;</p>


<!-- <h1><?php echo $this->escape($this->titleVolumesNeedReplacement); ?></h1> -->

<?php if ($this->resultVolumesNeedReplacement): ?>
<table id="box-table">
<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->_("Media<br />Type"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Volume Jobs"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Mounts"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Number of writes"); ?> </th>
    <th scope="col"> <?php print $this->translate->_("Errors"); ?> </th>
</tr>
</thead>
<tbody>
<?php foreach($this->resultVolumesNeedReplacement 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->escape($line['mediatype']);?></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="right"><?php echo $this->escape($line['volmounts']);?></td>
    <td align="right"><?php echo $this->escape($line['volwrites']);?></td>

    <?php
        if ( $this->escape($line['volerrors']) == 0 )
            echo '<td align="right"></td>';
        else
            echo '<td  align="right" class="err">' . $this->escape($line['volerrors']) . '</td>';
    ?>

</tr>
<?php endforeach; ?>
</tbody>
</table>

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