public static function listOption2($arrayOption, $chaine, $first, $name_id, $father = "") { $i = 1; foreach ($arrayOption as $key => $value) { //if(is_array($value)) if (empty($value["value"]) && empty($value["label"])) { //var_dump($value); $otherfather = $father . "." . $key; if ($first == true && $i == 1) { $chaine = CityOpenData::listOption2($value, $chaine, true, $name_id, $otherfather); } else { $chaine = CityOpenData::listOption2($value, $chaine, false, $name_id, $otherfather); } } else { if ($first == true && $i == 1) { $list = '<option value="' . $father . '.' . $key . '" checked>' . $value["label"] . '</option>'; } else { $list = '<option value="' . $name_id . $father . '.' . $key . '">' . $value["label"] . '</option>'; } $chaine = $chaine . $list; // var_dump($chaine); $i++; } } return $chaine; }
</select> </div> <div id="divTypeOption" class="col-sm-4 col-xs-12"> <label for="typeOption" />Option : </label> <select id="typeOption" class="col-sm-12 col-xs-12" multiple="multiple"> <?php $typeData = "population"; $where = array("insee" => $_GET['insee'], $typeData => array('$exists' => 1)); $fields = array($typeData); $option = City::getWhereData($where, $fields); $chaine = ""; foreach ($option as $key => $value) { foreach ($value as $k => $v) { if ($k == $typeData) { $chaine = CityOpenData::listOption2($v, $chaine, true, ""); } } } echo $chaine; ?> </select> </div> <div class="col-sm-4 col-xs-12"> <label for="typeGraph"/>Graphe :</label> <select id="typeGraph" class="col-sm-12 col-xs-12"> <option value="multibart">Multi-Bar</option> <option value="piechart">PieChart</option> </select> </div>