public function actionRiesgoFiltradoPolar() { /* Este */ $id = $_POST['id']; $id = (int) $id; $arregloFiltradoUN = []; $arregloIDGRFiltradoUN = []; $GrupoRiesgos = GrupoRiesgo::model()->findAll(); // $riesgoss = Riesgo::model()->findAllByAttributes(array('estado' => 1)); // $riesgoUnidadNegocio = RiesgoUnidadNegocio::model()->findAllByAttributes(array('id_unidad_negocio' => $id)); for ($index1 = 0; $index1 < count($GrupoRiesgos); $index1++) { $arregloIDGRFiltradoUN[$index1] = $GrupoRiesgos[$index1]->id_grupo_riesgo; } for ($index2 = 0; $index2 < count($GrupoRiesgos); $index2++) { $arregloFiltradoUN[$index2] = DameTuCantidadFiltrada($arregloIDGRFiltradoUN[$index2], $id); } echo json_encode($arregloFiltradoUN); }
function DameArregloFiltradoUN($id) { $id = (int) $id; $arregloFiltradoUN = []; $arregloIDGRFiltradoUN = []; $GrupoRiesgos = GrupoRiesgo::model()->findAll(); // $riesgoss = Riesgo::model()->findAllByAttributes(array('estado' => 1)); // $riesgoUnidadNegocio = RiesgoUnidadNegocio::model()->findAllByAttributes(array('id_unidad_negocio' => $id)); for ($index1 = 0; $index1 < count($GrupoRiesgos); $index1++) { $arregloIDGRFiltradoUN[$index1] = $GrupoRiesgos[$index1]->id_grupo_riesgo; } for ($index2 = 0; $index2 < count($GrupoRiesgos); $index2++) { $arregloFiltradoUN[$index2] = DameTuCantidadFiltrada($arregloIDGRFiltradoUN[$index2], $id); } return $arregloFiltradoUN; }