<?php
/**
 * YAWIK
 *
 * @filesource
 * @copyright https://yawik.org/COPYRIGHT.php
 * @license   MIT
 */

$this->headTitle($this->translate('Apply'));

$job = $this->job;

// @TODO own viewhelper
// does serverUrl do the right thing ? basePath und url don't
function getImageRef($url, $self) {
    if (preg_match('/^https?:\/\//',$url)) {
        // pass
    }
    else {
        $url = $self->basePath('/' . ltrim($url, '/'));
        $url = $self->serverUrl($url);
    }
    return $url;
}

?>
    <h1><?php echo $this->translate('Application')?></h1>
<div class="container">
    <div class="row">
        <div class="col-md-8">
            <p class="lead">
                <?php printf($this->translate('You have applied to "%1$s" from "%2$s"'),
                    $job->title, $job->company ) ?>
            </p>
        </div>
        <div class="col-md-4">
            <?php if (!empty($this->application->job->logoRef)):?>
                <img src="<?php echo getImageRef($this->application->job->logoRef, $this) ?>">
            <?php endif;?>
        </div>
    </div>
<?php
/**
 * if Applicant tracking System is disabled
 */

?>
<div class="alert alert-success">
    <p><?php echo $this->translate('your application had been posted. Godspeed.') ?></p>
</div>