/**
  * 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 TipoAccion the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = TipoAccion::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 2
0
}
function DameTuSumaEstocastica($id)
{
    $cantidad = 0;
    $criteria = new CDbCriteria();
    $riesgoss = Riesgo::model()->findAllByAttributes(array('estado' => 1));
    for ($index = 0; $index < count($riesgoss); $index++) {
        if ($riesgoss[$index]->id_grupo_riesgo == $id) {
            $cantidad = $cantidad + (int) $riesgoss[$index]->riesgo_estocastico;
        }
    }
    return $cantidad;
}
//LLENAR FILTRO TIPO  DE ACCION
$arregloTipoAccion = [];
$arrayTA = TipoAccion::model()->findAll();
for ($index3 = 0; $index3 < count($arrayTA); $index3++) {
    $arregloTipoAccion[$index3] = $arrayTA[$index3]->nombre;
}
$arregloTipoAccionDeterministico = [];
for ($index2 = 0; $index2 < count($arrayTA); $index2++) {
    $aux = DameTuSumaDeterministicaTA($arrayTA[$index2]->id_tipo_accion);
    $arregloTipoAccionDeterministico[$index2] = $aux;
}
function DameTuSumaDeterministicaTA($id)
{
    $cantidad = 0;
    $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_deterministico;