$query = SurveyPosPresencial::query();
// O que coloco aqui para receber do Form ??
$tipoPESSOA = 1;
$query->select('id', 'nome_professor', 'nome_disciplina', 'nome_curso_base', 'nome_turma', 'data_inicio', 'tipo');
// $query->where(‘id’,’=’,1 );
$query->where(‘tipo’,’=’,$tipoPESSOA );
$query->whereDate('data_inicio', date('Y-m-d'));
$presenciais = $query->get(['nome_disciplina'],['nome_professor'],['nome_curso_base'],['nome_turma'],['data_inicio'],['tipo']);
foreach ($presenciais as $presencial){
$presencial->nome_professor;
$presencial->nome_disciplina;
$presencial->nome_curso_base;
$presencial->nome_turma;
$presencial->data_inicio;
$presencial->tipo;
};
$limeSurvey = new LimesurveyApiHandle(Config::get('limesurveyApiHandle.url'), Config::get('limesurveyApiHandle.username'), Config::get('limesurveyApiHandle.password'));
if ($presencial->tipo == 1) {
$iSurveyID = 328117;
$newNameProfessor = 'Avaliação do(a) professor(a) '.$presencial->nome_professor.' sobre a disciplina '.$presencial->nome_disciplina.' do curso de '.$presencial->nome_curso_base;
$newSurvey = $limeSurvey->copy_survey($iSurveyID, $newNameProfessor);
}else{
$iSurveyID = 958744;
$newNamePalestrante = 'Avaliação Disciplina de Seminários - Palestrante: '.$presencial->nome_professor;
$newSurvey = $limeSurvey->copy_survey($iSurveyID, $newNamePalestrante);
}
if ($newSurvey['status'] !== 'OK') {
return;
}
$idSurvey = $newSurvey['newsid'];
$parametrosDATES = [
'startdate',
'expires'
];
$hora = '23:59';
$datainicio = $presencial->data_inicio.' 00:00';
$datafechar = date('Y-m-d', strtotime('+10 day', strtotime($datainicio)));
$datesSurvey = $limeSurvey->get_survey_properties($idSurvey, $parametrosDATES);
$datesSurvey['startdate'] = $datainicio;
$datesSurvey['expires'] = $datafechar.' '.$hora;
$datesSurvey = $limeSurvey->set_survey_properties($idSurvey, $datesSurvey);
**** COMO PEGA ESSAS VARIAVEIS E ALTERO ELES NA TABELA ?
ELES SÃO GERADOS DEPOIS QUE CRIO A PESQUISA EM OUTRO SISTEMA.
$codigoSurvey = $idSurvey;
** $datafecharmodificar = $datafechar.’ '.$hora;**
** $statusmodificar = 1;**