Пример #1
0
function get_list_statement($data, $listid, $thesisid)
{
    $vote = char_to_value($data['answers'][$listid][$thesisid]['selection']);
    $etext = $data['answers'][$listid][$thesisid]['statement'];
    $name = $data['lists'][$listid]['name'];
    $listclass = "list-" . str_replace(' ', '', $data['lists'][$listid]['name']);
    $prefix = "";
    if ($vote === 'skip') {
        $prefix = "<span class='label label-default'>{$name}</span>\n";
    } elseif ($vote == 1) {
        $prefix = "<span class='label label-success'>{$name}</span>\n";
    } elseif ($vote == 0) {
        $prefix = "<span class='label label-warning'>{$name}</span>\n";
    } elseif ($vote == -1) {
        $prefix = "<span class='label label-danger'>{$name}</span>\n";
    }
    return "<div class='{$listclass}'>\n\t{$prefix} \n\t<p>{$etext}</p>\n\t</div>\n\n";
}
Пример #2
0
  
  <div class="container mow-container" style="margin-top: 20px;">
      <img src="img/mahlowat_logo.png" title="Mahlowat Logo" class="pull-right" onclick="changeText()"/>
	<p id="spruch" class="pull-right"></p>
	
      <div class="bottom-buffer top-buffer">
    
    <h1>Ergebnisse</h1>
    <p>Klicke auf die Titel, um die zugehörige These anzuzeigen.</p>
      <table class="table table-bordered">
            <tr><th style="width: 320px;">Deine Wahl</th><th>Doppelt gewichten</th>
            <?php 
for ($i = 0; $i < sizeof($ans); $i = $i + 1) {
    $emph[$i] == 2 ? $active = "btn-info active" : ($active = "btn-default");
    $emph[$i] == 2 ? $multbutton = "These wird doppelt gewichtet" : ($multbutton = "These doppelt gewichten");
    $btnclass = code_to_btnclass(char_to_value($ans[$i]));
    $labelclass = code_to_labelclass($ans[$i]);
    echo "<tr>";
    echo "<td><a id='thesis{$i}' class='btn {$btnclass} btn-block' onclick='toggleNext(this)'>" . $theses[$i]['s'] . "</a></td>\n                  <td><button id='thesis{$i}-multiply' class='btn btn-block weight {$active}' data-toggle='button'>{$multbutton}</button></td>";
    echo "</tr>\n";
    echo "<tr class='multheseslong'><td class='mtl' colspan='2'><!--<span class='label {$labelclass}'>These " . ($i + 1) . ": " . $theses[$i]['s'] . "</span><br>--> " . $theses[$i]['l'] . "</td></tr>";
}
?>
     
      </table>
      <button id="commit" class="btn btn-primary">Neu Auswerten</button>
    
    <div class="text-right">
    <hr />
      <small>Du kannst die Befragung 
      <a href="index.php" title="Von vorn beginnen">neu starten</a>
Пример #3
0
function calculate_points($list, $answers)
{
    $max = max(sizeof($answers), sizeof($list));
    $pointvector = array();
    /*  my = skip:                skip / skip
     *  my != skip && list = skip: +0 / +0
     * |my - list| = 0:            +2 / +4
     * |my - list| = 1:            +1 / +2
     * |my - list| = 2:            +0 / +0
     */
    for ($i = 0; $i < $max; $i = $i + 1) {
        $pointvector[$i] = 0;
        $value = char_to_value($list[$i]['selection']);
        if (char_to_value($answers[$i]) === 'skip') {
            continue;
        } elseif (!('skip' === char_to_value($answers[$i])) and $value === 'skip') {
            $pointvector[$i] = 0;
        } else {
            $pointvector[$i] = 2 - abs(char_to_value($answers[$i]) - $value);
        }
    }
    $multiply = array();
    for ($i = 0; $i < sizeof($answers); $i++) {
        $multiply[$i] = char_to_multiply($answers[$i]);
    }
    $pointvector = vec_mul($pointvector, $multiply);
    return vectorsum($pointvector);
}