commit
064aaec0c3
10
header.php
10
header.php
|
@ -85,10 +85,12 @@
|
||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
<li class="headerItem">
|
<li class="headerItem">
|
||||||
<select id="sort" name="sort" onchange="onSort(this.value)">>
|
<form method="post">
|
||||||
<option value="date">Sortiraj po datumu</option>
|
<select id="sort" name="sort" onchange="onSortChanged(this)">>
|
||||||
<option value="alpha">Sortiraj abecedno</option>
|
<option value="date" <?php echo (!isset($_POST['sort']) || strpos("date", $_POST['sort'])!==FALSE)?"selected":null?>>Sortiraj po datumu</option>
|
||||||
</select>
|
<option value="alpha" <?php echo (isset($_POST['sort']) && strpos("alpha", $_POST['sort'])!==FALSE)?"selected":null?>>Sortiraj abecedno</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
27
index.php
27
index.php
|
@ -4,13 +4,30 @@
|
||||||
<?php include 'header.php'; ?>
|
<?php include 'header.php'; ?>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<?php $newsFile = file($openShiftFolder."vijesti.csv");
|
<?php $newsFile = file($openShiftFolder."vijesti.csv");
|
||||||
foreach ($newsFile as $news) {?>
|
$imagesArray = [];
|
||||||
|
$newsArray = [];
|
||||||
|
$timesArray = [];
|
||||||
|
$counter = 0;
|
||||||
|
foreach ($newsFile as $news) {
|
||||||
|
$nesto = str_getcsv($news);
|
||||||
|
$timesArray[$counter] = $nesto[0];
|
||||||
|
$imagesArray[$counter] = $nesto[1];
|
||||||
|
$newsArray[$counter] = $nesto[2];
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
if(isset($_POST['sort'])) {
|
||||||
|
if($_POST['sort']=='alpha') {
|
||||||
|
print_r('alpha');
|
||||||
|
array_multisort($newsArray, SORT_STRING, $imagesArray, $timesArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for($i = 0; $i < $counter; $i++) {
|
||||||
|
?>
|
||||||
<div class="news">
|
<div class="news">
|
||||||
<?php
|
<?php
|
||||||
$nesto = str_getcsv($news);
|
$image = $imagesArray[$i];
|
||||||
$image = $nesto[1];
|
$timeOfNews = $timesArray[$i];
|
||||||
$timeOfNews = $nesto[0];
|
$newsContent = $newsArray[$i];
|
||||||
$newsContent = $nesto[2];
|
|
||||||
?>
|
?>
|
||||||
<img src="<?php echo (strlen($image)!=0)?$image:'no_image.png' ?>"/>
|
<img src="<?php echo (strlen($image)!=0)?$image:'no_image.png' ?>"/>
|
||||||
<p>
|
<p>
|
||||||
|
|
4
js.js
4
js.js
|
@ -89,6 +89,10 @@ function onFilter(select) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSortChanged(thisThing) {
|
||||||
|
thisThing.parentElement.submit();
|
||||||
|
}
|
||||||
|
|
||||||
function validateCountry(countryCodeField) {
|
function validateCountry(countryCodeField) {
|
||||||
var ajax = new XMLHttpRequest();
|
var ajax = new XMLHttpRequest();
|
||||||
ajax.onreadystatechange = function() {
|
ajax.onreadystatechange = function() {
|
||||||
|
|
BIN
no_image.ong.png
BIN
no_image.ong.png
Binary file not shown.
Before Width: | Height: | Size: 29 KiB |
Loading…
Reference in New Issue