function DameTuSumaEstocasticaTA($id) { $cantidad = 0; $criteria = new CDbCriteria(); $riesgoss = Riesgo::model()->findAllByAttributes(array('estado' => 1)); for ($index = 0; $index < count($riesgoss); $index++) { if ($riesgoss[$index]->id_tipo_accion == $id) { $cantidad = $cantidad + (int) $riesgoss[$index]->riesgo_estocastico; //aqui va la estocastica } } return $cantidad; } //LLENAR FILTRO TIPO DE RIESGO $arregloTipoRiesgo = []; $arrayTR = TipoRiesgo::model()->findAll(); for ($index3 = 0; $index3 < count($arrayTR); $index3++) { $arregloTipoRiesgo[$index3] = $arrayTR[$index3]->nombre; } $arregloTipoRiesgoDeterministico = []; for ($index2 = 0; $index2 < count($arrayTR); $index2++) { $aux = DameTuSumaDeterministicaTR($arrayTR[$index2]->id_tipo_riesgo); $arregloTipoRiesgoDeterministico[$index2] = $aux; } function DameTuSumaDeterministicaTR($id) { $cantidad = 0; $riesgoss = Riesgo::model()->findAllByAttributes(array('estado' => 1)); for ($index = 0; $index < count($riesgoss); $index++) { if ($riesgoss[$index]->id_tipo_riesgo == $id) { $cantidad = $cantidad + (int) $riesgoss[$index]->riesgo_deterministico;
/** * 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 TipoRiesgo the loaded model * @throws CHttpException */ public function loadModel($id) { $model = TipoRiesgo::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }