Foros del Web » Programando para Internet » PHP »

mostrar respuesta en mismo lugar

Estas en el tema de mostrar respuesta en mismo lugar en el foro de PHP en Foros del Web. que tal; estoy implementando el wiris y para ello hago q las variables que me presente sean aleatorias: Código PHP: $questiontext  =  $objPregunta -> getEnunciado ...
  #1 (permalink)  
Antiguo 22/01/2013, 06:08
Avatar de zeuzft  
Fecha de Ingreso: junio-2009
Ubicación: peru
Mensajes: 358
Antigüedad: 14 años, 9 meses
Puntos: 2
Exclamación mostrar respuesta en mismo lugar

que tal; estoy implementando el wiris y para ello hago q las variables que me presente sean aleatorias:
Código PHP:
$questiontext $objPregunta->getEnunciado();
        
$questiontextInicial $objPregunta->getEnunciado();
        
// regla: si es para marcar se necesita calcular los valores de las alternativas
        
if ($objPregunta->getObjTipoSolucion()->getIdTipoSolucion() == 1) {
            
$opcionCorrecta $objPregunta->getOpcionCorrecta();
            
$opcionIncorrecta1 $objPregunta->getOpcionIncorrecta1();
            
$opcionIncorrecta2 $objPregunta->getOpcionIncorrecta2();
            
$questiontext $questiontext " " $opcionCorrecta " " $opcionIncorrecta1 " " $opcionIncorrecta2;
        }
        
$variable $objPregunta->getOpcionCorrecta();
        
$session $objPregunta->getAlgoritmo();
        
//get the variable names from the question text
        
$vars extractVariableNames($questiontext);
        
//build the question part of input message.
        
$question questionInputMessage($session$variable'equivalent_symbolic');
        
//build a XML input message asking for the variable values.
        
$msg getVariablesInputMessage($question$vars$seed);
        
//call the WIRIS API
        
$res callWIRISAPI4($msg);
        
//get the values from the XML output message
        
$vals getVariablesResult($res);

        
//regla: si es para marcar se barajan las alternativas
        
        
$alternativas = array();
        if (
$objPregunta->getObjTipoSolucion()->getIdTipoSolucion() == 1) {
            
$opcionCorrecta replaceVariables($vals$objPregunta->getOpcionCorrecta());
            
$opcionIncorrecta1 replaceVariables($vals$objPregunta->getOpcionIncorrecta1());
            
$opcionIncorrecta2 replaceVariables($vals$objPregunta->getOpcionIncorrecta2());
            
$indiceCorrecta substr($objPregunta->getOpcionCorrecta(), 1);
            
$indiceIncorrecta1 substr($objPregunta->getOpcionIncorrecta1(), 1);
            
$indiceIncorrecta2 substr($objPregunta->getOpcionIncorrecta2(), 1);
            
$alternativas[] = array($opcionCorrecta => $vals[$indiceCorrecta]);
            
$alternativas[] = array($opcionIncorrecta1 => $vals[$indiceIncorrecta1]);
            
$alternativas[] = array($opcionIncorrecta2 => $vals[$indiceIncorrecta2]);
            
shuffle($alternativas);
        }
        
//replace the values in the question text
        
$text replaceVariables($vals$questiontextInicial);
        
$variablesPreparadas = array();
        
$variablesPreparadas[0] = $alternativas// aquí están las variables
        
$variablesPreparadas[1] = $text// aquí está el enunciado
        
return $variablesPreparadas
hasta ahi todo bien; pero ahora que el usuario haya seleccionado su respuesta quisiera que se presente pero en el orden inicial ya que para mostrar la respuesta vuelvo a invocar al wiris; por lo tanto me muestra las respuesta de manera aleatoria de nuevo.
como puedo hacer para que las respuestas se muestren en el orden inicial?

Etiquetas: lugar, respuesta, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:21.