Show only best performance per event per name

gbdi

New Member
Hi I am bulding a rankings system for an athletics site using fabrik 1.06, Joomla 1.015, I have it working but have a couple of questions.

1/ How can I only have the best performance of each athlete show in each event, they will be entering more than one performance in more than one event.
I was thinking javascript on the search form but dont know how to write it.
The track events are separate to the field events (different forms ) as the results for track are descending and field are ascending. Separate forms for men and women also. A common name group is used (details)
Search is done by age group and event, the time or distance is in performance group.

2/ Is it possible to have the performance time structured as HH:MM.SS
at present I use text field with 2 decimal places.

3/ In the resulting search table is it possible to show the ranking of the athlete ie number the row of the table
1
2
3
4
to give a ranking next to the name and performance

This is a wonderful component, thankyou. I never thought i would be able to build this and have been able to get to a workable stage in just a few evenings.
 
for 1 im not sure sorry - perhaps you could create a mySQL view whose query gives you that data and then make a fabrik table pointing to that view.

2) use a date element and set its formatting to HH:MM.SS

3) Perhaps you will need to make a custom table template to do this, e.g. copy /components/com_fabrik/views/table/tmpl/default and rename the folder to ranking

edit the template.php file inside it

replace

Code:
<?php } else {
        foreach ($this->rows as $gkey => $group) {?>
        <table class="fabrikTable">
            <tr>
            <?php foreach ($this->headings as $heading) {?>
                <th><?php echo $heading;?></th>
                <?php }?>
            </tr>
            <?php
            $c = 0;
            foreach ($group as $rkey => $row) { ?>
                <tr class="oddrow<?php echo $c;?> <?php echo implode(' ',$this->rowClasses[$gkey][$rkey]); ?> ">
                <?php
                foreach ($this->headings as $heading=>$label) { ?>
                    <td class="<?php echo $this->cellClasses[$gkey][$rkey][$heading];?>"><?php  echo($row->$heading);?></td>
                <?php }?>
                </tr>
                <?php $c = 1-$c;
            }
        }?>

with

Code:
<?php } else {
$rank = 0;
        foreach ($this->rows as $gkey => $group) {
        ?>
        <table class="fabrikTable">
            <tr>
<th>Rank</th>
            <?php foreach ($this->headings as $heading) {?>
                <th><?php echo $heading;?></th>
                <?php }?>
            </tr>
            <?php
            $c = 0;
            foreach ($group as $rkey => $row) {
                $rank ++; ?>
                <tr class="oddrow<?php echo $c;?> <?php echo implode(' ',$this->rowClasses[$gkey][$rkey]); ?> ">
<td><?php echo $rank;?></td>
                <?php
                foreach ($this->headings as $heading=>$label) { ?>
                    <td class="<?php echo $this->cellClasses[$gkey][$rkey][$heading];?>"><?php  echo($row->$heading);?></td>
                <?php }?>
                </tr>
                <?php $c = 1-$c;
            }
        }?>
<tr>
 
Thanks Rob,
I was able to resolve the time format issue by just using a text field,the ordering works fine ascending or descending.
The script to include row numbering works a treat thanks for that.

I will work around the individual listings at the moment by having an email sent on submission and deleting theold entry by hand at the moment, not sure how to go about the mySQL query.

Thanks for your time, you will probably hear from me as I try to refine the site.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top