objeto = $objeto; $this->rol = $rol; if($idioma == ""){ $this->idioma = "sp"; }else{ $this->idioma = $idioma; } } function getSiguientes($estado){ $consulta = "SELECT final, nombre, rol FROM ".$this->objeto."_transiciones, ".$this->objeto."_estados WHERE inicial='$estado' AND idioma='$this->idioma'" . " AND ".$this->objeto."_transiciones.final = ".$this->objeto."_estados.cod AND ".$this->objeto."_transiciones.rol <> ''"; $bd = new BD(); $resultado = $bd->execQuery($consulta); while($rows = mysql_fetch_assoc($resultado)){ $final = $rows["final"]; $nombre = $rows["nombre"]; $rol = $rows["rol"]; if($this->tienePermisos($rows["rol"])){ $lista[$final] = $nombre; } } if(count($lista) == 0) $lista = array(); return $lista; } private function tienePermisos($rolTrans){ if($rolTrans == "") return true; $arrayRolUsr = explode(".", $this->rol); $arrayRolTrans = explode(".", $rolTrans); foreach($arrayRolUsr as $rol){ if(in_array($rol, $arrayRolTrans)){ return true; } } return false; } function getTransicion($inicial, $final){ $consulta = "SELECT transicion, rol FROM ".$this->objeto."_transiciones WHERE inicial='$inicial' AND final='$final'"; $bd = new BD(); $resultado = $bd->execQuery($consulta); while($rows = mysql_fetch_assoc($resultado)){ $rol = $rows["rol"]; if($this->tienePermisos($rows["rol"])){ $transicion = $rows["transicion"]; } } return $transicion; } } ?>