118 lines
4.1 KiB
PHP
118 lines
4.1 KiB
PHP
<?php
|
|
error_reporting(-1);
|
|
ini_set('display_errors', 'On');
|
|
require_once 'php/inc_functions.php';
|
|
|
|
global $db;
|
|
$intEvenementOld = 434;
|
|
$intEvenementNew = 445;
|
|
$arrEpreuvesChangement = array(
|
|
244 => 321,
|
|
245 => 320,
|
|
246 => 322
|
|
);
|
|
$arrQuestionsChangement = array(
|
|
228 => 294,
|
|
229 => 295,
|
|
230 => 298,
|
|
231 => 296,
|
|
232 => 297,
|
|
233 => 299,
|
|
234 => 307,
|
|
237 => 308,
|
|
246 => 305
|
|
);
|
|
|
|
// sortir le résultat des épreuves 244,245, 246
|
|
$sqlEpreuvesCommandees = "SELECT * FROM resultats_epreuves_commandees WHERE is_cancelled = 0 AND epr_id IN(" . implode(',', array_keys($arrEpreuvesChangement)) . ")";
|
|
$arrEpreuvesCommandees = $db->fxGetResults($sqlEpreuvesCommandees);
|
|
echo('arrEpreuvesCommandees');
|
|
//print_r($arrEpreuvesCommandees);
|
|
echo('<br>');
|
|
|
|
if ($arrEpreuvesCommandees != null) {
|
|
for ($intCtr = 1; $intCtr <= count($arrEpreuvesCommandees); $intCtr++) {
|
|
// insérer les épreuves en modifiants le eve_id, epr_id
|
|
// $count = 0;
|
|
// $fields = '';
|
|
// foreach($arrEpreuvesCommandees[$intCtr] as $col => $val) {
|
|
//
|
|
// if ($count++ != 0) $fields .= ', ';
|
|
// $col = mysql_real_escape_string($col);
|
|
// $val = mysql_real_escape_string($val);
|
|
|
|
$coleve_id=$intEvenementNew;
|
|
|
|
if (array_key_exists($arrEpreuvesCommandees[$intCtr]['epr_id'], $arrEpreuvesChangement)) {
|
|
$colepr_id=$arrEpreuvesChangement[$arrEpreuvesCommandees[$intCtr]['epr_id']];
|
|
} else {
|
|
echo ("pas la bonne epreuve $arrEpreuvesCommandees[$intCtr]['epr_id'] <br>");
|
|
}
|
|
|
|
// if($col!='pec_id' and $col!='pec_id_original')
|
|
// $fields .= "$col = '$val'";
|
|
// else
|
|
// $count =$count -1;
|
|
|
|
|
|
$sqlInsert = "UPDATE resultats_epreuves_commandees SET eve_id=".$coleve_id.",epr_id=".$colepr_id." where pec_id=".$arrEpreuvesCommandees[$intCtr]['pec_id'];
|
|
// $sqlInsert = "INSERT INTO resultats_epreuves_commandees SET $fields";
|
|
echo( $sqlInsert."<br>");
|
|
|
|
$db->fxQuery($sqlInsert);
|
|
}
|
|
}
|
|
|
|
// sortir le résultat des participants 244,245, 246
|
|
$sqlParticipants = "SELECT * FROM resultats_participants WHERE is_cancelled = 0 AND epr_id IN(" . implode(',', array_keys($arrEpreuvesChangement)) . ")";
|
|
$arrParticipants = $db->fxGetResults($sqlParticipants);
|
|
echo(' arrParticipants');
|
|
//print_r($arrParticipants);
|
|
echo('<br>');
|
|
if ($arrParticipants != null) {
|
|
for ($intCtr = 1; $intCtr <= count($arrParticipants); $intCtr++) {
|
|
// insérer les épreuves en modifiants le eve_id, epr_id
|
|
$count = 0;
|
|
$fields = '';
|
|
|
|
$coleve_id=$intEvenementNew;
|
|
|
|
if (array_key_exists($arrParticipants[$intCtr]['epr_id'], $arrEpreuvesChangement)) {
|
|
$colepr_id=$arrEpreuvesChangement[$arrParticipants[$intCtr]['epr_id']];
|
|
} else {
|
|
echo ("pas la bonne epreuve $arrParticipants[$intCtr]['epr_id'] <br>");
|
|
}
|
|
$sqlInsert = "UPDATE resultats_participants SET eve_id=".$coleve_id.",epr_id=".$colepr_id." where par_id=".$arrParticipants[$intCtr]['par_id'];
|
|
|
|
echo( $sqlInsert."<br>");
|
|
|
|
|
|
$db->fxQuery($sqlInsert);
|
|
}
|
|
}
|
|
|
|
// sortir le résultat des questions
|
|
$sqlQuestions = "SELECT * FROM resultats_questions WHERE que_actif = 1 AND que_id IN(" . implode(',', array_keys($arrQuestionsChangement)) . ")";
|
|
$arrQuestions = $db->fxGetResults($sqlQuestions);
|
|
echo(' arrQuestions');
|
|
//print_r($arrQuestions);
|
|
echo('<br>');
|
|
if ($arrQuestions != null) {
|
|
for ($intCtr = 1; $intCtr <= count($arrQuestions); $intCtr++) {
|
|
// insérer les épreuves en modifiants le que_id
|
|
|
|
|
|
|
|
if (array_key_exists($arrQuestions[$intCtr]['que_id'], $arrQuestionsChangement)) {
|
|
$val=$arrQuestionsChangement[$arrQuestions[$intCtr]['que_id']];
|
|
} else {
|
|
echo ("pas la bonne question $arrQuestions[$intCtr]['que_id'] <br>");
|
|
}
|
|
|
|
|
|
$sqlInsert = "UPDATE resultats_questions SET que_id=".$val." where pqu_id=".$arrQuestions[$intCtr]['pqu_id'];
|
|
|
|
echo( $sqlInsert."<br>");
|
|
$db->fxQuery($sqlInsert);
|
|
}
|
|
} |