Skip to content

Commit

Permalink
refs 1: Change selection of program using a combo box
Browse files Browse the repository at this point in the history
  • Loading branch information
kimicol authored and ofaurax committed Apr 29, 2024
1 parent 8895564 commit dd2bfa6
Showing 1 changed file with 48 additions and 35 deletions.
83 changes: 48 additions & 35 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,54 @@
?>
<!-- <p style="float:right;padding:0;margin:0"><em><?php echo $f ?></em></p> -->
<h1 class="entry-title">Arvin <span style="color:#ff379b">l'archiviste</span></h1>

<!-- Select program -->
<form method="get" class="noprint">
<?php
if($token_ok)
{
echo '<input type="hidden" name="token" value="'.$token.'" />';
}
?>
Programme :
<select name="s">
<?php
$tmpd = opendir($arv_config['pgm_dir']);
$programmes = [];
while($d = readdir($tmpd))
{
if($d[0] == '.') continue;
$r = preg_match("/(\d+)/", $d, $m);
if($r)
{
$k = $m[0];
}
else
$k = "Autre";
$programmes[$k][] = $d;
}
krsort($programmes);

foreach($programmes as $k => $p)
{
foreach($p as $d)
{
if(substr($d, -4) != '.txt') continue;
$p = substr($d, 0, -4);
echo "<option value=\"pgm:{$p}\"";
if($sv == "pgm:{$p}") echo " selected";
echo ">{$p}</option>";
}
}
echo "<option value=\"\"";
if(substr($sv, 0, 4) != 'pgm:') echo " selected";
echo ">Tous</option>";
?>
</select>
<input type="submit" value="Go"/>
</form>
<br/>

<form method="get" class="noprint">
<?php
if($token_ok)
Expand Down Expand Up @@ -376,41 +424,6 @@ function tri_par_completion($a, $b) {return tri_ligne($a, $b, 'completion');}
}
echo '</table>';

// Listing programmes
$tmpd = opendir($arv_config['pgm_dir']);

echo '<h3>Programmes</h3>';
$sep = '';
$programmes = [];

while($d = readdir($tmpd))
{
if($d[0] == '.') continue;
$r = preg_match("/(\d+)/", $d, $m);
if($r)
{
$k = $m[0];
}
else
$k = "Autre";
$programmes[$k][] = $d;
}
krsort($programmes);

foreach($programmes as $k => $p)
{
echo $k." : ";
$sep = '';
foreach($p as $d)
{
if(substr($d, -4) != '.txt') continue;
$p = substr($d, 0, -4);
echo $sep.'<a href="?token='.$token.'&amp;s=pgm:'.$p.'">'.
$p.'</a>'."\n";
$sep = ' | ';
}
echo '<br/>';
}
//echo '</p>';


Expand Down

0 comments on commit dd2bfa6

Please sign in to comment.