Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // @TODO: Pasarlo a libreria
- // ESTE ES EL METODO QUE USO PARA GENERAR LOS RADIO BUTTONS
- function __generarEstrellasSoloLectura()
- {
- $value = 10;
- $numargs = func_num_args();
- $valor = '';
- $checked = '';
- $radioFormat = "<input name=\"%s\" type=\"radio\" class=\"star {half:true}\" value=\"%s\" id=\"%d\" disabled=\"disabled\" %s />"
- if (3 == $numargs) {
- $name = func_get_arg(0);
- $id_sub = func_get_arg(1);
- $calificacion = func_get_arg(2);
- //$str=null;
- $link = new Conexion();
- $mysqli = $link->getLink();
- for ($i=0; $i < 10; $i++) {
- $valor = $value . '-' . $id_sub;
- $checked = $value == $calificacion ? ' checked="checked"' : '';
- printf($radioFormat, $name, $valor, $id_sub, $checked);
- $value += 10;
- }
- } // if
- unset($link);
- //return $str;
- } // funcion
- // OBTENGO MI RANKING DE EMPLEADOS DESDE UNA CONSULTA DE SQL
- $ranking = $evaluacion->obtenerRanking($_SESSION['id_empresa']);
- ?>
- <table border="0" width="100%" align="center" cellspacing="2" cellpadding="2">
- <?php foreach ($ranking as $r) :
- $estrellas = round($r['estrellas']);
- $cal = $evaluacion->calcularCalificacion($estrellas);
- ?>
- <tr>
- <td width="60%" style="color:#fff;">
- <a href="VerEmpleado.php?id=<?php echo $r['id'] ?>"><?php echo $r['nombre'] ?></a>
- </td>
- <?php
- /* MANDO LLAMAR A MI METODO QUE ME GENERA LOS RADIO BUTTONS DE ACUERDO A SU CALIFICACION Y DESPUES ESTOS SE CONVIERTEN A ESTRELLAS CON JQUERY * /
- ?>
- <td width="40%" style="color:#000;" align="center">
- <?php $evaluacion->__generarEstrellasSoloLectura($cont, $cont, $cal) ?>
- </td>
- </tr>
- <?php $cont++; endforeach; ?>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement