views/assertions.php
author viric@mandarina
Sun, 28 Dec 2008 17:20:55 +0000
changeset 4 fcb273554da6
parent 3 f3e55c2386a1
child 5 cb13c07e7e5d
permissions -rw-r--r--
Fixing problems recalculating, and showing values as %2.2f

<?php
if(isset($title))
    echo "<h2>$title</h2>";
    
?>
<table border=1>
<tr>
<th>
<?php if(isset($show_influences))
        $colspan=3;
      else
        $colspan=2;?>
<th colspan="<?=$colspan?>"><?=$user_name?>
<th colspan="<?=$colspan?>"><?=$other_user_name?>
<tr>
<th>Id
<?php if(isset($show_influences)):?>
<th>Influo
<?php endif;?>
<th>Valoro
<th>Kalkulita
<?php if(isset($show_influences)):?>
<th>Influo
<?php endif;?>
<th>Valoro
<th>Kalkulita
<th>Teksto
<th>Ŝanĝi
<?php foreach($assertions as $assertion):?>
<?=form_open("opiniarbo/index/$assertionid/$other_user");?>
<tr>
<?="<input type=\"hidden\" name=\"id\" id=\"id\" value=\"{$assertion['id']}\"/>";?>
<?php
    if(isset($assertion['parent']))
        echo "<input type=\"hidden\" name=\"parent\" id=\"parent\" value=\"{$assertion['parent']}\"/>";
    echo "<td>{$assertion['id']}";
    if(isset($assertion['value1']))
    {
        $value1 = $assertion['value1'];
        // We suppose any value1 comes with vid
        echo "<input type=\"hidden\" name=\"vid\" id=\"vid\" value=\"{$assertion['vid']}\">";
    }
    else
        $value1 = "";
    if (isset($show_influences))
    {
        if (isset($assertion['parent']))
        {
            if(isset($assertion['influence1']))
                $influence1 = $assertion['influence1'];
            else
                $influence1 = "";
            echo "<td><input type=\"text\" name=\"influence\" id=\"influence\" value=\"".
               sprintf("%2.2f", $influence1)."\" maxlength=\"5\" size=\"3\" />";
        }
        else
            echo "<td>";
    }

    echo "<td><input type=\"text\" name=\"value\" id=\"value\" value=\"".
        sprintf("%2.2f", $value1)."\" maxlength=\"5\" size=\"3\" />";

    if (isset($assertion['calc_value1']))
        echo "<td>".sprintf("%2.2f", $assertion['calc_value1']);
    else
        echo "<td>";

    if (isset($show_influences))
    {
        if (isset($assertion['parent']))
        {
            if(isset($assertion['influence2']))
                $influence2 = $assertion['influence2'];
            else
                $influence2 = "";
            echo "<td>".sprintf("%2.2f", $influence2);
        }
        else
            echo "<td>";
    }

    if (isset($assertion['value2']))
        echo "<td>".sprintf("%2.2f", $assertion['value2']);
    else
        echo "<td>";

    if (isset($assertion['calc_value2']))
        echo "<td>".sprintf("%2.2f", $assertion['calc_value2']);
    else
        echo "<td>";
    echo "<td>" . anchor("opiniarbo/index/{$assertion['id']}/{$other_user}",
        $assertion['text']);
?>
<td>
<?php  if(isset($assertion['value1'])):?>
    <input type="submit" name="modify" value="Ŝanĝi"/>
    <input type="submit" name="delete" value="Forigi"/>
<?php  else:?>
    <input type="submit" name="addvalue" value="Taksi"/>
<?php  endif;?>
</form>
<?php endforeach;?>
</table>