function menuPrinter($file, $list) { global $mainlist; // cycle through all the items in the $mainlist array for ($i = 0; $i < count($mainlist[url]); $i++) { // we use a 'name' value of "hidden" so that certain menu items cause // the menu to appear but don't show up themselves -- see the // "CreatureList" array for an example $mainlist currently doesn't use // any but you never know... if ($mainlist[name][$i] != "hidden") { // $list is empty if no submenu needs to be displayed (see function // findFile), so we only create a submenu if $list has a value if ($list != "") { // knowing that we have to create a submenu, we look for // the first item in the sublist ($list) if ($mainlist[url][$i] == $list[url][0]) { // we print the first item in $list, using printSelected if // it matches $file and printBoldUnselected if not if ($file == $list[url][0]) { printSelected($list[url][0], $list[name][0]); } else { printBoldUnselected($list[url][0], $list[name][0]); } // now we begin to cycle through the items in $list for ($j = 1; $j < count($list[url]); $j++) { // again with the "hidden" trick if ($list[name][$j] != "hidden") { if ($file == $list[url][$j]) { printSubSelected($list[url][$j], $list[name][$j]); } else { printSubUnselected($list[url][$j], $list[name][$j]); } // if not } } } elseif ($file != $mainlist["url"][$i]) { printUnselected($mainlist[url][$i], $mainlist[name][$i]); } } else { // when we get to the filename that matches our current file, // mark it as "selected" if ($file == $mainlist[url][$i]) { printSelected($mainlist[url][$i], $mainlist[name][$i]); } elseif ($file != $mainlist[url][$i]) { printUnselected($mainlist[url][$i], $mainlist[name][$i]); } } } } }
<td class="col_var6"> <p><input type="checkbox" name="var6[]" value="1" title="Publicados" <?php printSelected($var6, 1); ?> >Publicados</input></p> <p><input type="checkbox" name="var6[]" value="2" title="Rechazados, Inconstitucionales, Inadmisibles" <?php printSelected($var6, 2); ?> >Rechazados, Inconstitucionales, Inadmisibles</input></p> <p><input type="checkbox" name="var6[]" value="3" title="En tramitación" <?php printSelected($var6, 3); ?> >En tramitación</input></p> <p><input type="checkbox" name="var6[]" value="4" title="Retirados" <?php printSelected($var6, 4); ?> >Retirados</input></p> <p><input type="checkbox" name="var6[]" value="5" title="Archivados, Solicitud de archivos" <?php printSelected($var6, 5); ?> >Archivados, Solicitud de archivos</input></p> </td> </tr> </tbody> </table> <p><input type="submit" value="Filtra"> </form> <!-- partial _detalle para mostrar detalles del proyectoLey --> <?php include_partial('ProyectoLey/balancechart', array('proyecto' => $proyecto_ley, 'var1' => $var1, 'var2' => $var2, 'var3' => $var3, 'var4' => $var4, 'var5' => $var5, 'var6' => $var6));