예제 #1
0
	function gravarProvaResposta(Resposta $resposta){

		if (strlen($resposta->getPergunta())==0){
			throw new Exception('Informe a pergunta!');
		}else{
			$resposta->Xpergunta = $resposta->getPergunta();
		}
		
		if (strlen($resposta->getRespostaCorreta())==0){
			$resposta->Xresposta_correta = " NULL ";
		}else{
			$resposta->Xresposta_correta = "'".$resposta->getRespostaCorreta()."'";
		}		

		if (strlen($resposta->getRespostaTexto())==0){
			$resposta->Xresposta_texto = " NULL ";
		}else{
			$resposta->Xresposta_texto = "'".$resposta->getRespostaTexto()."'";
		}

		if (!is_object($resposta->getRespostaFilho())){
			$resposta->Xresposta_filho = " NULL ";
		}else{
			$resposta->Xresposta_filho = $resposta->getRespostaFilho()->getId();
		}

		$provaRespostaDAO = new ProvaRespostaDAO(); 
		$provaRespostaDAO->setBancoDados($this->banco); 
		return $provaRespostaDAO->gravaDadosProvaResposta($resposta); 
	}