summaryrefslogtreecommitdiffstats
path: root/main/survey/app/Controllers/Vprasanja/SystemVariableController.php
blob: f0551df183a121c8a80f0086e9ceb591a2456e79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/***************************************
 * Description: Special system variables
 *
 * Autor: Robert Šmalc
 * Created date: 09.03.2016
 *****************************************/

namespace App\Controllers\Vprasanja;

// Osnovni razredi
use App\Controllers\Controller;
use App\Models\Model;

class SystemVariableController extends Controller
{

    public function __construct()
    {
        parent::getGlobalVariables();
    }

    /************************************************
     * Get instance
     ************************************************/
    private static $_instance;

    public static function getInstance()
    {
        if (self::$_instance)
            return self::$_instance;

        return new SystemVariableController();
    }

    /**
     * @desc Prikaže checkboxe za vrednosti 99,98,97
     */
    public static function display($spremenljivka, $oblika)
    {
        $sql1 = sisplet_query("SELECT id, naslov FROM srv_vrednost WHERE spr_id = '$spremenljivka' AND other IN (99,98,97) ORDER BY vrstni_red ");
        $selected = Model::getOtherValue($spremenljivka);
        echo '<input name="other_selected_vrednost_' . $spremenljivka . '" id="other_selected_vrednost_' . $spremenljivka . '" value="' . $selected . '" type="hidden">';
        while ($row1 = mysqli_fetch_array($sql1)) {

            if ($selected == $row1['id'])
                $sel = true;
            else
                $sel = false;

            echo '<div class="variabla' . $oblika['cssFloat'] . '">';
            echo '<label for="missing_value_spremenljivka_' . $spremenljivka . '_vrednost_' . $row1['id'] . '">';
            echo '<input type="checkbox" name="vrednost_' . $spremenljivka . '[]" id="missing_value_spremenljivka_' . $spremenljivka . '_vrednost_' . $row1['id'] . '" value="' . $row1['id'] . '"' . ($sel ? ' checked' : '') . ' spremenljivka="' . $spremenljivka . '" onclick=" checkBranching();"> ';
			// Font awesome checkbox
			echo '<span class="enka-checkbox-radio" '.((Helper::getCustomCheckbox() != 0) ? 'style="font-size:' . Helper::getCustomCheckbox() . 'px;"' : '').'></span>';
			echo '' . $row1['naslov'] . '</label>';
            echo '</div>' . "\n";

        }
    }

}