TOPIC:

Get other form values fro database 1 year 4 months ago #244531

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
did you see my code above? it should solve this

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 4 months ago #244532

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
ah wait, made a mistake, try this
// ADD TEAMS HERE

// clearing the display element first
$items["displayElement"]["value"]  = '';

// getting all element values based on the record id
$db = JFactory::getDbo();
$db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`name` = 'JoinLeagueID' and
            s.`value`= " . $db->quote( $record_id ) );

$list = $db->loadObjectList();
$length = count( $list );

$all_out = array();
$all_joins = array();

for($i = 0; $i < $length; $i++){

    $db->setQuery("
            Select s.* 
            From
            #__facileforms_subrecords As s 
            Where 
            s.`record`= " . $db->quote( $list[$i]->record ) . " Order by s.`value`" );
    $all_joins[] = $db->loadObjectList();
}

$length = count($all_joins);

if( $length ){

    for($i = 0; $i < $length; $i++){

        // adding all fields I want to display in the displayElement field

        $length2 = count($all_joins[$i]);

        $join_record = 0;

        $team = '';
        $owner = '';
        $total = '';

        for($j = 0; $j < $length2; $j++){

            $join_record  = $all_joins[$i][$j]->record;

            switch($all_joins[$i][$j]->name){

                case 'JoinTeamName':
                    $team = '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .'  </div>'  ;
                    break;

                case 'Owner':
                    $owner = '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                    break;

                case 'TeamTotal':
                    $total = '<div style="font-family: Arial;">'  . $all_joins[$i][$j]->value .' </div>'   ;
                    break;


            }
        }

        if(!isset($all_out[$total])){

            $all_out[$total] = array();
        }

        $idx = count($all_out[$total]);

        $all_out[$total][$idx]   = '<div style="display: table;">';

        $all_out[$total][$idx]  .= '<div style="display: table-cell;  margin-right: 50px;font-family: Arial;padding-bottom: 10px;padding-top: 7px;border: 20px solid transparent;min-width: 10px;">{index}</div>';

        $all_out[$total][$idx]  .= '<div style="display: table-cell;  margin-right: 50px;font-family: Arial;border: 20px solid transparent;min-width: 200px;">' . $team . '</div>';

        $all_out[$total][$idx]  .= '<div style="display: table-cell;  margin-right: 50px;font-family: Arial;border: 20px solid transparent;min-width: 200px;">' . $owner . '</div>';

        $all_out[$total][$idx]  .= '<div style="display: table-cell;  margin-right: 50px;font-family: Arial;border: 20px solid transparent;min-width: 200px;">' . $total . '</div>';

        $all_out[$total][$idx]  .= '</div>';

        $all_out[$total][$idx]  .= '<div style="clear:both; border-bottom: solid 1px; border-color: #dddddd;"></div> '    ;


    }

    ksort($all_out, SORT_NATURAL);

    $all_out_cnt = count($all_out);

    $i = 1;
    foreach($all_out As $content){
        foreach($content As $item) {
            $items["displayElement"]["value"] .= str_replace('{index}', $i, $item);
            $i++;
        }
    }
}

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 4 months ago #244534

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
yes sorted, i had to swap to krsort but all good, thanks markus

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 4 months ago #244535

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 4 months ago #244574

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
How would I go about checking if the {index} = 1,2 or 3 amd change the background color accordingly ?

Please Log in or Create an account to join the conversation.

Get other form values fro database 1 year 4 months ago #244599

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
I have had a go and got this so far.
if ( $i==1) $all_out[$total][$idx]  .= '<div class="positionGOLD" style="   display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">{index}</div>';

else

if ( $i==2) $all_out[$total][$idx]  .= '<div class="positionSILVER" style="   display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">{index}</div>';

else

if ( $i==3) $all_out[$total][$idx]  .= '<div class="positionSILVER" style="   display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">{index}</div>';

else

$all_out[$total][$idx]  .= '<div style="   display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">{index}</div>';

It seems to work but skips number 3 for some reason. Have I done it right or is there a better way.

I have set css for the class to get 3 different backgrounds

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.055 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!