-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintQuestionario.php
More file actions
91 lines (59 loc) · 2.2 KB
/
printQuestionario.php
File metadata and controls
91 lines (59 loc) · 2.2 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
require_once 'includes/class.Db.php';
require_once 'includes/class.PhpOpenRosa.php';
require_once 'includes/connectMongo.php';
require_once 'includes/config.php';
?>
<html>
<body>
<?php
/* Vou conectar com a collections familias */
try {
$familias = $dbMongo->familias;
} catch (Exception $e) {
$sql = 'insert into log(error_msg) values ("erro de conversao")';
$db->query($sql);
}
$sql = 'select url from pesquisas where tipopesquisa = "'. $_REQUEST['tipoPesquisa'] . '"';
$resultTipo = $db->query($sql);
$rowT = $resultTipo->fetch_assoc();
/* Se foi passado o ID é porque é um questionário com dados, se não é apenas o modelo */
if(isset($_REQUEST['id'])) {
$familia = $familias->findOne(array('_id' => new MongoId($_REQUEST['id'])));
$openRosa = new PhpOpenRosa($rowT['url'],true,$familia);
} else {
$openRosa = new PhpOpenRosa($rowT['url']);
}
foreach($openRosa->formulario as $form) {
if($form->type == 'label') { echo '<b>'; }
echo utf8_decode($form->label) . '<br/>';
if($form->type == 'label') { echo '</b><br/>'; }
echo '<br/>';
if($form->type == 'input') {
echo '<input type="text" size="100" readonly value="'. utf8_decode($form->resultText) .'"/>';
echo '<br/><br/>';
}
if($form->type == 'geopoint') {
echo '<input type="text" size="100" readonly value="'. utf8_decode($form->resultText) .'"/>';
echo '<br/><br/>';
}
if($form->type == 'select') {
foreach($form->options as $option) {
echo '<input type="checkbox" disabled ' . $option['checked'] . ' />' . utf8_decode($option['label']) . '<br/>';
}
echo '<br/><br/>';
}
if($form->type == 'select1') {
foreach($form->options as $option) {
echo '<input type="radio" disabled ' . $option['checked'] . '/>' . utf8_decode($option['label']) . '<br/>';
}
echo '<br/><br/>';
}
if($form->type == 'upload') {
echo '<img src="formularios//' . $form->resultText . '" />';
echo '<br/><br/>';
}
}
?>
</body>
</html>