-
Notifications
You must be signed in to change notification settings - Fork 0
/
pregunta.php
261 lines (245 loc) · 13.5 KB
/
pregunta.php
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?php
include('headerdocente.php');
require_once 'pregunta.entidad.php';
require_once 'pregunta.model.php';
$buttonname = 'Registrar';
// Logica
$preg = new Pregunta();
$model = new PreguntaModel();
//dame tareas para el combobox
function dametarea(){
$consulta_mysql="
SELECT
tb_tarea.intidtarea,
tb_tarea.nvchtarea
FROM
tb_tarea
";
$resultado_consulta_mysql=mysql_query($consulta_mysql);
while($registro = mysql_fetch_array($resultado_consulta_mysql)){
echo "
<option value='".$registro['intidtarea']."'>
".$registro['nvchtarea']."
</option>
";
}
}
//end dame tareas para el combobox
if(isset($_REQUEST['action']))
{
switch($_REQUEST['action'])
{
case 'actualizar':
$preg->__SET('intidpregunta',$_REQUEST['intidpregunta']);
$preg->__SET('intidtarea',$_REQUEST['intidtarea']);
$preg->__SET('nvchpregunta',$_REQUEST['nvchpregunta']);
$preg->__SET('nvchdescripcion',$_REQUEST['nvchdescripcion']);
$preg->__SET('chrhabilitado',$_REQUEST['chrhabilitado']);
$model->Actualizar($preg);
header('Location: pregunta.php');
break;
case 'registrar':
//$preg->__SET('intidpregunta',$_REQUEST['intidpregunta']);
$preg->__SET('intidtarea',$_REQUEST['intidtarea']);
$preg->__SET('nvchpregunta',$_REQUEST['nvchpregunta']);
$preg->__SET('nvchdescripcion',$_REQUEST['nvchdescripcion']);
$preg->__SET('chrhabilitado',$_REQUEST['chrhabilitado']);
$model->Registrar($preg);
header('Location: pregunta.php');
break;
case 'eliminar':
$model->Eliminar($_REQUEST['intidpregunta']);
header('Location: pregunta.php');
break;
case 'editar':
$preg = $model->Obtener($_REQUEST['intidpregunta']);
break;
}
}
?>
<div class="main-panel">
<nav class="navbar navbar-default navbar-fixed">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigation-example-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Mi perfil</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-left">
<li>
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-dashboard"></i>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-globe"></i>
<b class="caret"></b>
<span class="notification">5</span>
</a>
<ul class="dropdown-menu">
<li><a href="#">Notification 1</a></li>
<li><a href="#">Notification 2</a></li>
<li><a href="#">Notification 3</a></li>
<li><a href="#">Notification 4</a></li>
<li><a href="#">Another notification</a></li>
</ul>
</li>
<li>
<a href="">
<i class="fa fa-search"></i>
</a>
</li>
</ul>
<?php include('salir.php'); ?>
</div>
</div>
</nav>
<form action="?action=<?php echo $preg->intidpregunta > 0 ? 'actualizar' : 'registrar'; ?>" method="post">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card">
<div style="margin-top:10px">
</div>
<div class="header">
<h4 class="title">Registro de preguntas del tema: </h4>
</div>
<div class="content">
<form action="?action=<?php echo $preg->intidpregunta > 0 ? 'actualizar' : 'registrar'; ?>" method="post">
<div class="row">
<input type="hidden" name="intidpregunta" value="<?php echo $preg->__GET('intidpregunta'); ?>" />
<div class="col-md-2">
<div class="form-group">
<label>Id tarea</label>
<!--input type="text" class="form-control" id="" name="intidtarea" value="<?php echo $preg->__GET('intidtarea'); ?>"-->
<select name="intidtarea" class="form-control" id="">
<?php dametarea(); ?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Pregunta</label>
<input type="text" class="form-control" id="" name="nvchpregunta" value="<?php echo $preg->__GET('nvchpregunta'); ?>" placeholder='Ingrese la pregunta' required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1">descripción</label>
<input type="text" placeholder='Ingrese una descripción opcional' class="form-control" id="" name="nvchdescripcion" value="<?php echo $preg->__GET('nvchdescripcion'); ?>" required>
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label>estado</label>
<select class='form-control' name="chrhabilitado" style="width:100%;" required>
<option value="A" <?php echo $preg->__GET('chrhabilitado') == 'A' ? 'selected' : ''; ?>>Habilitado</option>
<option value="D" <?php echo $preg->__GET('chrhabilitado') == 'D' ? 'selected' : ''; ?>>Desabilitado</option>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-info btn-fill pull-right"><?php echo $buttonname; ?>
</button>
<a style='margin-right: 10px' type="submit" href="pregunta.php" class="btn btn-success btn-fill pull-right">LIMPIAR
</a>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="header">
<h4 class="title">Tabla de Preguntas</h4>
</div>
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card card-plain">
<div class="content table-responsive table-full-width">
<table class="table table-hover">
<thead>
<tr>
<th style="text-align:left;">tarea</th>
<th style="text-align:left;">descripcion</th>
<th style="text-align:left;">Pregunta</th>
<th style="text-align:left;">Estado</th>
<th style="text-align:left;">Opciones</th>
</tr>
</thead>
<?php foreach($model->Listar() as $r): ?>
<tr>
<td>
<label for="">
<?php echo $r->__GET('intidtarea'); ?>
</label>
</td>
<td>
<label for="">
<?php echo $r->__GET('nvchdescripcion'); ?>
</label>
</td>
<td>
<label for="">
<?php echo $r->__GET('nvchpregunta'); ?>
</label>
</td>
<td>
<?php $bthbltd = $r->__GET('chrhabilitado');
if ($bthbltd == 'a' || $bthbltd == 'A') {
echo "<label> Activado</label>";
} else
if ($bthbltd == 'd' || $bthbltd == 'D') {
echo "<label>Desactivado</label>";
} else{
echo "-";
}
?>
</td>
<td>
<label for="">
<a class="label label-success" style ='font-size: 10px' href="?action=editar&intidpregunta=<?php echo $r->intidpregunta; ?>">Editar</a>
</label>
<label for="">
<a class="label label-danger" style ='font-size: 10px' href="?action=eliminar&intidpregunta=<?php echo $r->intidpregunta; ?>">Eliminar</a>
</label>
<label for="">
<a class="label label-info" style ='font-size: 10px' href="respuesta.php?intidpregunta=<?php echo $r->intidpregunta; ?>">+
respuesta(s)</a>
</label>
<?php //echo $r->__GET('intidpregunta'); ?>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
<style>
html{
margin-top:0;
}
</style>
<?php include('footer.php'); ?>