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; }
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); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return GrupoRiesgo the loaded model * @throws CHttpException */ public function loadModel($id) { $model = GrupoRiesgo::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }