eastside/application/views/gallery/index.php
Linus Miller cd141ef6fa Initial commit.
Former-commit-id: d2e17d67fe98124db4e87b10597af9d54d14d0de
2013-12-07 17:43:26 +01:00

56 lines
2.1 KiB
PHP

<div id="site-nav" class="r">
<div class="c -m12">
<p class="structure"><?= anchor('', $this->config->item('site_name')) ?> > <span class="current">Tavlor</span></p>
</div>
</div>
<div class="r">
<div id="gallery" class="c -m12">
<div class="r">
<?php foreach($paintings as $p): ?>
<div class="painting c -m3" id="<?= $p['id'] ?>">
<div class="container">
<?php if($p['has_image'] == 1): ?>
<div class="image"><?= img('img/paintings/' . $p['code'] . '_cube-200.jpg') ?></div>
<?php else: ?>
<div class="image"><?= img('img/paintings/no-image.png') ?></div>
<?php endif; ?>
<?php
$w = $p['canvas_width'];
$h = $p['canvas_height'];
$ratio = round($w / $h, 4);
$org_ratio = $ratio;
if($ratio > 1) {
$ratio = 1 / $ratio;
$p_hor = '0';
$p_ver = (0.5 - $ratio / 2) * 100 . '%';
} else {
$p_hor = (0.5 - $ratio / 2) * 100 . '%';
$p_ver = '0';
}
?>
<div class="info">
<div class="ratio">
<div class="ratio-container">
<div style="margin: <?= $p_ver ?> <?= $p_hor ?>;" class="ratio-box">&nbsp;</div>
</div>
</div>
<h3>Ingen titel</h3>
<p class="artist">Okänd konstnär</p>
<p class="price">SEK <?= number_format($p['price'], 2, ',','.') ?></p>
<p>Akvarell på papper<br />
<strong>Mått (motiv):</strong> <?= $p['canvas_width'] ?>x<?= $p['canvas_height'] ?> cm<br />
<?php if($p['frame'] == 1): ?>
<strong>Mått (rulle):</strong> <?= $p['frame_width'] ?>x<?= $p['frame_height'] ?> cm<br /><?php endif; ?></p>
</div>
</div>
</div><!-- END .painting.c -->
<?php endforeach; ?>
</div><!-- END .r -->
</div><!-- END #gallery.c -->
</div><!-- END .r --->
<script type="text/javascript">
$('#gallery div.painting').click(function(e){
window.location = '<?= base_url('index.php/gallery') ?>/' + $(this).attr('id');
});
</script>