<!-- job/statusdir.phtml -->

<?php if ( $this->result_error ): ?>
	<div class="ui-widget" style="width: 60%; margin-left: 2em;">
		<div class="ui-state-error ui-corner-all" style="padding: 0pt 0.7em;">
			<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: 0.3em;"></span>
			<strong>
	<?php
	    echo $this->escape($this->title), '<br>';
        switch ( $this->result_error )
        {
            case 'ERROR_BCONSOLE': // ошибка при запуске bconsole
                $msg = $this->translate->_('ERROR: There was a problem executing bconsole.');
                break;
            case 'NOFOUND_BCONSOLE': // bconsole не найден
                $msg = $this->translate->_('ERROR: bconsole not found.');
                break;
            default: $msg = '';
        }
        echo $msg;
        if ( $this->command_output )
        {
            foreach ($this->command_output as $line) {
			 echo '<br>', $line, '<br>';
		  }
        }
	?>
			</strong></p>
		</div>
	</div>

<?php else: ?>

    <table id="table-dir-output">
    <caption><?php echo $this->escape($this->title); ?></caption>
    <tr><td>
	    <!-- director output -->
    	<b><?php print $this->translate->_("Director output:"); ?></b>
	    <?php
        if ( $this->command_output )
        {
            echo '<pre>';
            foreach ($this->command_output as $line) {
                if ( preg_match('/(ERR|not found|invalid|Expected)/i', $line) )   {
                    echo '<div style="color: white; background-color: red;">', $line, '</div><br>';
                } else {
                    echo $line, '<br>';
                }
	    	}
		    echo '</pre>';
        } ?>
    </td></tr>
	</table>
<?php endif; ?>
