Jak user będzie miał jakąś taryfę przeterminowaną to zapytanie zwróci źłe wartości 




-------- Original message --------
From: Marcin <marcin@nicram.net>
Date: 27.04.2015 13:11 (GMT+01:00)
To: lista użytkowników LMS <lms@lists.lms.org.pl>
Subject: Re: [lms] dokumenty - smarty

-------- Original message --------
From: Marcin <marcin@nicram.net>
Date: 27.04.2015 13:11 (GMT+01:00)
To: lista użytkowników LMS <lms@lists.lms.org.pl>
Subject: Re: [lms] dokumenty - smarty

i znowu odpowiadam sobie sam. ale by było dla potomnych.
zrobiłem to w php zamiast w smarty. w engine.php dodałem

#v+
if($customernodes)
    foreach($customernodes as $idx => $row)
    {
        $customernodes[$idx]['net'] = $DB->GetRow('SELECT *, inet_ntoa(address) AS ip FROM networks WHERE address = (inet_aton(mask) & ?)', array($row['ipaddr']));
        foreach ($assignments as $valass){
            foreach ($valass['nodes'] as $lit => $valnod) {
                if ($valnod['id'] == $row['id']){
                    $customernodes[$idx]['down'] = floor($valass['downceil']/1024);
                    $customernodes[$idx]['uplo'] = floor($valass['upceil']/1024);
                }               
            }
        }
    }
#v-

zapewne istnieje łatwiejszy sposób ale moja wiedza z php jest znikoma, więc zrobiłem jak umiałem :) ważne że działa i jest łatwo dostępne w smarty.

W dniu 24 kwietnia 2015 19:55 użytkownik Marcin <marcin@nicram.net> napisał:
Witam
Podpowiedzcie jak w szablonie dokumentu, smarty, wyciągnąć prędkość komputera.
Na umowię wypisuję hosty i chciałbym obok niego wypisać prędkości.
problem w tym, że hosty są przekazywane w tablicy customernodes a prędkość jest w tablicy assignments.

$assignments     Smarty_Variable Object (3)
->value = Array (2)
  0 => Array (29)
    id => "8310"
    tariffid => "516"
    customerid => "2856"
    upceil => "2196"
    downceil => "24196"
    nodes => Array (1)
      0 => Array (2)
        name => "nazwaklienta"
        id => "5817"
 ....

$customernodes     Smarty_Variable Object (3)
->value = Array (1)
  0 => Array (19)
    id => "5817"
    name => "nazwaklienta"
    ip => "192.192.192.192"
    ownerid => "2856"
...


w templatce mam taki kod:
#v+
<div id="urzadzenia">
            <thead>6. Urządzenia Abonenckie przeznaczone do instalacji u Abonenta</thead>
            <table cellpadding="3" cellspacing="0" border="1">
                <tr>
                    <td>{trans("IP Address:")}</td>
                    <td>{trans("Login:")}</td>
                    <td>{trans("Password:")}</td>
                </tr>
                {section name=customernodes loop=$customernodes}
                <tr>
                    <td>{$customernodes[customernodes].ip}</td>
                    <td>{$customernodes[customernodes].name}</td>
                    <td>{$customernodes[customernodes].passwd}</td>
                </tr>
                {/section}
            </table>
        </div>
#v-

i do tego, do każdego komputera chcę dodać prędkość z assignments.
poproszę o wskazówkę jak to osiągnąć w smarty?




--
Pozdrawiam
Marcin / nicraM



--
Pozdrawiam
Marcin / nicraM