123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <?php
-
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
- $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "long":
- case "int":
- $theValue = ($theValue != "") ? intval($theValue) : "NULL";
- break;
- case "double":
- $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "defined":
- $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
- break;
- }
- return $theValue;
- }
-
- function presentaPregsRangoSelect($min_val,$min_text,$max_val,$max_text,$id_q)
- {
- //print $id_q;
- print('<select class="form-control" name="question'.$id_q.'" required>');
- print('<option></option>');
- print('<option value="'.$min_val.'">'.$min_val." - ".$min_text.'</option>');
- print("\n");
- for($i=$min_val+1;$i<($max_val);$i++)
- {
- print('<option value="'.$i.'">'.$i.'</option>');
- print($i);
- print("\n");
- }
- print('<option value="'.$max_val.'">'.$max_val." - ".$max_text.'</option>');
- print("\n");
- print("</select>");
- print("\n");
- }
-
- function presentaPregsRangoSlider($min_val,$min_text,$max_val,$max_text,$id_q)
- {
- //print('<div class="slidecontainer">');
- print('<input type="range" class="form-control-range slider" value="0" min="'.$min_val.'" max="'.$max_val.'" name="question'.$id_q.'" id="question'.$id_q.'" required>');
- print('<div class="row">');
-
- print('<div class="col-4">');
- print("<small>$min_text</small>");
- print('</div>');
- print('<div class="col-4 text-center">');
- print('<span id="val'.$id_q.'"></span>');
- print('</div>');
- print('<div class="col-4 text-right">');
- print("<small>$max_text</small>");
- print('</div>');
- print('</div>');
-
- print('
- <script>
- var slider'.$id_q.' = document.getElementById("question'.$id_q.'");
- var output'.$id_q.' = document.getElementById("val'.$id_q.'");
- output'.$id_q.'.innerHTML = slider'.$id_q.'.value;
-
- slider'.$id_q.'.onclick = function() {
- output'.$id_q.'.innerHTML = this.value;
- }
- </script>
- ');
- //print('</div>');
- }
-
- function presentaPregsRangoRadio($min_val,$min_text,$max_val,$max_text,$id_q)
- {
- print('<div class="row-sm">');
- print('<div class="form-check">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$min_val.'" value="'.$min_val.'" required>');
- print('<label class="form-check-label" for="radio'.$min_val.'">'.$min_val.' - '.$min_text.'</label>');
- print('</div>');
-
- for($i=$min_val+1;$i<($max_val);$i++)
- {
- print('<div class="form-check">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$i.'" value="'.$i.'">');
- print('<label class="form-check-label" for="radio'.$i.'">'.$i.'</label>');
- print('</div>');
- }
- print('<div class="form-check">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$max_val.'" value="'.$max_val.'">');
- print('<label class="form-check-label" for="radio'.$max_val.'">'.$max_val.' - '.$max_text.'</label>');
- print('</div>');
- print('</div>');
-
- }
-
- function presentaPregsRangoRadio2($min_val,$min_text,$max_val,$max_text,$id_q)
- {
- print('<div class="row-sm">');
- print('<div class="col">');
- print('<div class="form-check form-check-inline">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$min_val.'" value="'.$min_val.'">');
- print('</div>');
- print('</div>');
-
- for($i=$min_val+1;$i<($max_val);$i++)
- {
- print('<div class="col">');
- print('<div class="form-check form-check-inline">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$i.'" value="'.$i.'">');
- print('</div>');
- print('</div>');
- }
-
- print('<div class="col">');
- print('<div class="form-check form-check-inline">');
- print('<input class="form-check-input" type="radio" name="question'.$id_q.'" id="radio'.$max_val.'" value="'.$max_val.'">');
- print('</div>');
- print('</div>');
-
- print('</div>');
- print('<div class="row-sm">');
- print('<div class="col">');
- print('<label class="form-check-label" for="radio'.$min_val.'">'.$min_val.' - '.$min_text.'</label>');
- print('</div>');
- for($i=$min_val+1;$i<($max_val);$i++)
- {
- print('<div class="col">');
- print('<label class="form-check-label" for="radio'.$i.'">'.$i.'</label>');
- print('</div>');
- }
- print('<div class="col">');
- print('<label class="form-check-label" for="radio'.$max_val.'">'.$max_val.' - '.$max_text.'</label>');
- print('</div>');
-
- print('</div>');
-
- }
- ?>
|