3 function CONTENIDO_admin() {
4 global $session, $database, $form;
6 function displayUsers(){
8 $q = "SELECT username,nombre,userlevel,email,timestamp FROM ".TBL_USERS
." ORDER BY userlevel DESC;";
9 $result = $database->query($q);
10 /* Error occurred, return given name by default */
11 $num_rows = mysql_numrows($result);
12 if(!$result ||
($num_rows < 0)){
13 echo "Error displaying info";
17 echo "Database table empty";
20 /* Display table contents */
21 echo '<table border="1" cellspacing="0" cellpadding="3">';
22 echo "<tr><td><b>Código</b></td><td><b>Nombre</b></td><td><b>Nivel</b></td><td><b>Email</b></td><td><b>Última actividad</b></td></tr>\n";
23 for($i=0; $i<$num_rows; $i++
){
24 $uname = mysql_result($result,$i,"username");
25 $nombre = mysql_result($result,$i,"nombre");
26 $ulevel = mysql_result($result,$i,"userlevel");
27 $email = mysql_result($result,$i,"email");
28 $time = mysql_result($result,$i,"timestamp");
29 //$horarios ='<a href="./?x=hr&forzar='.$uname.'">Ver</a>';
30 $uname = '<a href=./?'._ACC_
.'=usuario+info&usr='.$uname.'>'.$uname.'</a>';
31 echo "<tr><td>$uname</td><td>$nombre</td><td>$ulevel</td><td>$email</td><td>$time</td></tr>\n";
33 echo "</table><br>\n";
36 echo '<h2>Centro de Administración</h2><hr />';
37 if($form->num_errors
> 0){
38 echo "<font size=\"4\" color=\"#ff0000\">"
39 ."!*** Error con petición, por favor corregir</font><br><br>";
41 echo '<h3>Instructores registrados en el sistema:</h3>';
44 echo '<h3>Establecer permisos a instructor</h3>';
45 echo $form->error("upduser");
47 <form action
="include/adminprocess.php" method
="POST">
51 <input type
="text" name
="upduser" maxlength
="30" value
="<? echo $form->value("upduser
"); ?>"></td
>
54 <select name
="updlevel">
61 <input type
="hidden" name
="subupdlevel" value
="1">
62 <input type
="submit" value
="Actualizar">
66 <h3
>Quitar Instructor
</h3
>
67 <?
echo $form->error("deluser"); ?
>
68 <form action
="contenido/adminprocess.php" method
="POST">
71 <input type
="text" name
="deluser" maxlength
="30" value
="<? echo $form->value("deluser
"); ?>"></td
>
72 <td
><input type
="hidden" name
="subdeluser" value
="1"></td
>
73 <td
><input type
="submit" value
="Quitar Instructor"></td
>