Created
January 19, 2017 03:23
-
-
Save go-cristian/c768af589e8501e6b1df851a15e053db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Tablero de control | |
Nivel 1 | |
Profesor Sesion 1 Sesion 2 Sesion 3 Sesion 4 | |
Pepito _ _ _ _ _ _ _ _ _ _ _ | |
Menganita _ _ _ _ _ _ _ _ _ _ _ | |
Sultaneira _ _ _ _ _ _ _ _ _ _ _ | |
Nivel 2 | |
Profesor Sesion 1 Sesion 2 Sesion 3 Sesion 4 | |
Pepito _ _ _ _ _ _ _ _ _ _ _ | |
Menganita _ _ _ _ _ _ _ _ _ _ _ | |
Sultaneira _ _ _ _ _ _ _ _ _ _ _ | |
Nivel 3 | |
Profesor Sesion 1 Sesion 2 Sesion 3 Sesion 4 | |
Pepito _ _ _ _ _ _ _ _ _ _ _ _ | |
Menganita _ _ _ _ _ _ _ _ _ _ _ _ | |
Sultaneira _ _ _ _ _ _ _ _ _ _ _ _ | |
Nivel 4 | |
Profesor Sesion 1 Sesion 2 Sesion 3 Sesion 4 | |
Pepito _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
Menganita _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
Sultaneira _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
*/ | |
$queries = new Queries(); | |
$niveles = $queries->niveles(); | |
foreach ($niveles as $key => $nivel) { | |
echo "<p>".$nivel["name"]."</p>"; | |
var $profesores = $nivel["profesores"]; | |
foreach ($profesores as $key => $profesor) { | |
echo "<td>".$profesor["name"]."</td>"; | |
var $sesiones = $profesor["sesiones"]; | |
foreach ($sesiones as $key => $sesion) { | |
echo "<td>"; | |
var $productos = $sesion["productos"]; | |
foreach ($productos as $key => $producto) { | |
if ($producto == true) { | |
echo "<img src='/checked.png'/>"; | |
} else { | |
echo "<img src='/unchecked.png'/>"; | |
} | |
} | |
echo "</td>"; | |
} | |
} | |
} | |
/*================================*/ | |
function niveles() { | |
var $profesores = array(); | |
var $resultado = array(); | |
var $niveles = this->query("... from niveles"); // ["nivel 1", "nivel 2"] array("Nivel 1, Nivel 2", ...) | |
for (var $i = 0; $i < count($niveles); $i++) { | |
var $nivel = $niveles[$i]; | |
// [("name": "pepito"), ("name": "fulanito")] | |
var $profesores_aux = $this->query("select name from profesores"); | |
//opcional | |
//$profesores = $this->trim($profesores_aux, $profesores) | |
foreach ($profesores as $key => $profesor) { | |
//[("name": "sesion 1"), ("name": "sesion 1")] | |
var $sesiones = $this->query("select id, name from sesiones where nivel=".$nivel); | |
foreach ($sesiones as $key => $sesion) { | |
var $productos = $this->query("...."); | |
$sesion["productos"] = $produtos; | |
} | |
$profesor["sesiones"] = $sesiones; | |
} | |
$nivel["profesores"] = $profesores_aux; | |
} | |
return $resultado; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment