Cognome "; } ?> ">Nome "; } ?> ">Regione "; } ?> ">Provincia "; } ?> ">Comune "; } ?> data['elenco'] as $k => $a ) { foreach ( $a['Regione'] as $kk => $vv ) { foreach ( $a['Provincia'] as $yy => $zz ) { foreach ( $a['Comune'] as $xx => $qq ) { foreach ( $a['Cap'] as $ww => $jj ) { $form->data['elenco'][$k][$kk] = $a['Regione'][$kk]; $form->data['elenco'][$k][$yy] = $a['Provincia'][$yy]; $form->data['elenco'][$k][$xx] = $a['Comune'][$xx]; $form->data['elenco'][$k][$ww] = $a['Cap'][$ww]; echo "".$a['cognome']."".$a['nome']."".$a['Regione'][$kk]."".$a['Provincia'][$yy]."".$a['Comune'][$xx].">";} unset($form->data['elenco'][$k]['Cap']);} unset($form->data['elenco'][$k]['Comune']);} unset($form->data['elenco'][$k]['Provincia']);} unset($form->data['elenco'][$k]['Regione']);}?>"> Let user change order in a custom data display list - Forums

Forums

Let user change order in a custom data display list

Benvenuto 22 Jul, 2013
Hi everybody.
In order to achieve specific requirements, I have to use a Custom Code action in the on submit event to create a custom data list. And it works
But I would give the user the possibility to change column data order form asc to desc and viceversa.
For that reason, I put in the custom code action the following statemente, but it does not order any column data. Is there something wrong in this code?
Thanks a lot everybody
Vinc


<h1>Elenco dei Soci Ordinari e Volontari </h1>
<h2>secondo i criteri di ricerca impostati</h2>
<?php
//start ord
$img="";
if(Jrequest::getVar('direction','','get')=="") {
$ord="asc";
}
if (Jrequest::getVar('direction','','get')=="desc") {
$ord="asc";
$img="desc";
}
if (Jrequest::getVar('direction','','get')=="asc") {
$ord="desc";
$img="asc";
}
// end ord
?>

<table style="width: 100%" id="db_multi_record_loader">
<thead>
<tr>
<th style="width: 20%" class="col1 cell"><a class="order_link direction_asc"
href="index.php?option=com_chronoforms&chronoform=CercaSocioOrdinario&event=submit&order=cognome&direction=<?php echo $ord; ?>">Cognome <?php if (Jrequest::getVar('order','','get')=="cognome") {
echo "<img src=\"media/system/images/sort_".$img.".png\" alt=\"\" />"; } ?> </a></th>
<th style="width: 20%" class="col2 cell"><a class="order_link"
href="index.php?option=com_chronoforms&chronoform=CercaSocioOrdinario&event=submit&order=nome&direction=<?php echo $ord; ?>">Nome <?php if (Jrequest::getVar('order','','get')=="nome") {
echo "<img src=\"media/system/images/sort_".$img.".png\" alt=\"\" />"; } ?> </a></th>
<th style="width: 20%" class="col3 cell"><a class="order_link"
href="index.php?option=com_chronoforms&chronoform=CercaSocioOrdinario&event=submit&order=regione&direction=<?php echo $ord; ?>">Regione <?php if (Jrequest::getVar('order','','get')=="regione") {
echo "<img src=\"media/system/images/sort_".$img.".png\" alt=\"\" />"; } ?> </a></th>
<th style="width: 20%" class="col4 cell"><a class="order_link"
href="index.php?option=com_chronoforms&chronoform=CercaSocioOrdinario&event=submit&order=provincia&direction=<?php echo $ord; ?>">Provincia <?php if (Jrequest::getVar('order','','get')=="provincia") {
echo "<img src=\"media/system/images/sort_".$img.".png\" alt=\"\" />"; } ?> </a></th>
<th style="width: 10%" class="col5 cell"><a class="order_link"
href="index.php?option=com_chronoforms&chronoform=CercaSocioOrdinario&event=submit&order=comune&direction=<?php echo $ord; ?>">Comune <?php if (Jrequest::getVar('order','','get')=="comune") {
echo "<img src=\"media/system/images/sort_".$img.".png\" alt=\"\" />"; } ?> </a></th>
</tr>
</thead>

<?php
foreach ( $form->data['elenco'] as $k => $a ) {
  foreach ( $a['Regione'] as $kk => $vv ) {
     foreach ( $a['Provincia'] as $yy => $zz ) {
       foreach ( $a['Comune'] as $xx => $qq ) {
         foreach ( $a['Cap'] as $ww => $jj ) {
          $form->data['elenco'][$k][$kk] = $a['Regione'][$kk];
          $form->data['elenco'][$k][$yy] = $a['Provincia'][$yy];
          $form->data['elenco'][$k][$xx] = $a['Comune'][$xx]; 
          $form->data['elenco'][$k][$ww] = $a['Cap'][$ww]; 
  
echo "<td><a class=\"order_link\"href=\"index.php?option=com_chronoforms&chronoform=Anagrafica-Modifica&rec=". $a['cf_id']."\" 
title=
\"Cognome = ".$a['cognome'].
"\nNome = ".$a['nome'].
"\nData di nascita = ".$a['data_nascita'].
"\n".$a['tipologia'].
"\nCodice Fiscale = ".$a['cod_fiscale'].
"\nNr Tessera = ".$a['nr_tessera'].
"\nAnno di iscrizione = " .$a['anno_iscrizione'].
"\nUltimo rinnovo = ".$a['anno_rinnovo'].
"\nRegione di residenza = ".$a['Regione'][$kk].
"\nRecapito postale = ".$a['residente_in']." ".$a['Cap'][$ww]." ".$a['Comune'][$xx]." (".$a['Provincia'][$yy].")",
"\nRecapito telefonico = ".$a['telefono'].
"\nIndirizzo e-mail = ".$a['email'].
"\">".$a['cognome']."</a></td><td>".$a['nome']."</td><td>".$a['Regione'][$kk]."</td><td>".$a['Provincia'][$yy]."</td><td>".$a['Comune'][$xx]."</td>><tr>";
}
  unset($form->data['elenco'][$k]['Cap']);
}
  unset($form->data['elenco'][$k]['Comune']);
}
  unset($form->data['elenco'][$k]['Provincia']);
}
  unset($form->data['elenco'][$k]['Regione']);
}
?>
</table>
<p></p>
GreyHead 27 Jul, 2013
Hi Vinc,

I had a look at the code but don't really understand how the second part is supposed to work. Might is be simpler to use ChronoConnectivity?

Bob
This topic is locked and no more replies can be posted.