/
post.php
160 lines (120 loc) · 4.35 KB
/
post.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
<?php
session_start();
if(isset($_SESSION['ultimo_id']))
{
$id = $_SESSION['ultimo_id'];
}
else
{
header('Location: post_pendientes.php');
}
$user = $_SESSION['userblanco'];
include "encabezado.php";
write_header('Peticion');
write_body('Peticicion',$user);
write_notificacion();
//FUNCION PARA OBTENER TODA LA INFO ACTUAL DEL POST PRINCIPAL, RESTO DE LA CONSULTA EN UN POST DE JQUERY CON UN SET INTERVAR
$username = "root";
$password = "critical";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL+++".mysql_error());
$selected = mysql_select_db("Blog",$dbhandle)
or die("Could not select examples");
$sql = 'select * from Solicitud where id_solicitud = ' . $id;
$result = mysql_query($sql,$dbhandle);
$datos_principal = array();
while ($row = mysql_fetch_array($result))
{
$datos_principal = $row;
}
function calcular_tiempo($date)
{
date_default_timezone_set('America/Costa_Rica');
$fecha_actual = strtotime(date("Y-m-d H:i:s"));
$date = strtotime($date);
if(date("Y",$date) != date("Y",$fecha_actual))
{
$cantidad = date("Y",$fecha_actual) - date("Y",$date);
return 'Hace '.$cantidad. ' años';
}
if(date("m",$date) != date("m",$fecha_actual))
{
$cantidad = date("m",$fecha_actual) - date("m",$date);
return 'Hace '.$cantidad. ' meses';
}
if(date("d",$date) != date("d",$fecha_actual))
{
$cantidad = date("d",$fecha_actual) - date("d",$date);
return 'Hace '.$cantidad. ' dias';
}
if(date("H",$date) != date("H",$fecha_actual))
{
$cantidad = date("H",$fecha_actual) - date("H",$date);
return 'Hace '.$cantidad. ' horas';
}
if(date("i",$date) != date("i",$fecha_actual))
{
$cantidad = date("i",$fecha_actual) - date("i",$date);
return 'Hace '.$cantidad. ' minutos';
}
if(date("s",$date) != date("s",$fecha_actual))
{
$cantidad = date("s",$fecha_actual) - date("s",$date);
return 'Hace '.$cantidad. ' segundos';
}
}
?>
<div id="main" role="main">
<div id="post">
<form class="blue">
<fieldset>
<div id="header_post" class="header_post">
<span id="nombre" class="nombre"><?php echo $datos_principal['solicitante'];?></span><span class="fecha"> <?php echo calcular_tiempo($datos_principal['fecha_inicio']); ?></span>
<br />
<span class="departamento"><?php echo $datos_principal['departamento'];?></span>
</div>
<div id="subject_post" class="subject_post">
<span class="subjet">Asunto : <?php echo $datos_principal['asunto']; ?> </span>
<br/>
<span class="cliente"><?php echo $datos_principal['cliente'];?></span>
</div>
<div id="body_post">
<p><?php echo $datos_principal['contenido'];?></p>
</div>
<div id="caso" class="caso">Solicitud # : <span id="id"><?php echo $datos_principal['id_solicitud'];?></span></div>
</fieldset>
</form>
</div>
<div id="grow"></div>
<div id="post">
<form class="dashboard">
<fieldset>
<legend>Ingresar Solicitud al blog</legend>
<ol class="quitar_padding">
<li class="quitar_padding">
<label for="solicitud_label">Solicitud</label>
<br/>
<textarea id='solicitud_area' style='width: 550px; height:150px;'></textarea>
<br/>
</li>
</ol>
<div id="boton_list" class="botton_list">
<button id="enviar" class="icon">Enviar</button>
<button id="add" class="icon">vincular</button>
<button id="eliminar" class="icon">desvincularse</button>
<button id="cerrar" class="icon">Cerrar caso</button>
<button id="person" class="icon">cambiar encargado</button>
</div>
</fieldset>
</form>
<div id="diag_involucrado"></div>
<div id="diag_eliminar"></div>
<div id="diag_cerrar"></div>
<div id="diag_cambiar"></div>
<span id="contador" class="0"></span>
<?php
include "footer.php";
write_footer('peticion');
?>