예제 #1
0
    $ms = $count * $interval;
    $count++;
}
$width += ($columnWidth + $colMargin * 2) * $count;
// figure out the height of each row
$height = $fontHeight + $rowMargin * 2;
foreach ($tests as &$test) {
    $height += $test['video']['thumbHeight'] + $rowMargin * 2;
}
// create the blank image
$im = imagecreatetruecolor($width, $height);
// define some colors
$background = GetColor($im, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
$textColor = GetColor($im, $color[0], $color[1], $color[2]);
$colChanged = GetColor($im, 254, 179, 1);
$colAFT = GetColor($im, 255, 0, 0);
imagefilledrectangle($im, 0, 0, $width, $height, $background);
// put the time markers across the top
$left = $thumbLeft;
$top = $thumbTop - $fontHeight;
$decimals = $interval >= 100 ? 1 : 3;
$frameCount = 0;
$ms = 0;
while ($ms < $filmstrip_end_time) {
    $ms = $frameCount * $interval;
    $frameCount++;
    $left += $colMargin;
    $val = number_format((double) $ms / 1000.0, $decimals) . 's';
    $x = $left + (int) ($columnWidth / 2.0) - (int) ((double) $fontWidth * ((double) strlen($val) / 2.0));
    imagestring($im, $font, $x, $top, $val, $textColor);
    $left += $columnWidth + $colMargin;
예제 #2
0
파일: addcols.php 프로젝트: jacksir/MagicDB
$sth = $dbHandle->prepare($sql);
$sth->execute();
$sth = $dbHandle->prepare($sql);
$sth->execute();
*/
//open the card file
$lines = file('cardlist.txt');
//loop city
foreach ($lines as $line_num => $line) {
    $ln = explode("\t", $line);
    $card_name = trim($ln[1]);
    $card_type = trim($ln[2]);
    $casting_cost = trim($ln[3]);
    $rarity = trim($ln[4]);
    $set_name = trim($ln[6]);
    $color = GetColor($casting_cost, $card_type);
    $sql = "insert into cards (card_name, set_name, rarity, owned, card_type, casting_cost, color) values(:card_name, :set_name, :rarity, '0', :card_type, :casting_cost, :color)";
    $sth = $dbHandle->prepare($sql);
    $sth->execute(array(':card_name' => $card_name, ':set_name' => $set_name, ':rarity' => $rarity, ':card_type' => $card_type, ':casting_cost' => $casting_cost, ':color' => $color));
    //$sql = "update wwk
    //set color=:color, castingcost=:cc, cardtype=:ct
    //where name=:name";
    //$sth = $dbHandle->prepare($sql);
    //$sth->execute(array(':color' => $color, ':cc' => $castingcost, ':ct' => $ct, ':name' => $name));
}
function GetColor($cc, $ct)
{
    $pos = strpos($ct, "Artifact");
    if ($pos !== false) {
        return "Artifact";
    }
예제 #3
0
$ok = false;
if (isset($ref) && isset($cmp) && is_file($ref) && is_file($cmp)) {
    $refImg = imagecreatefrompng($ref);
    $cmpImg = imagecreatefrompng($cmp);
    if ($refImg !== FALSE && $cmpImg !== FALSE) {
        $refWidth = imagesx($refImg);
        $refHeight = imagesy($refImg);
        $cmpWidth = imagesx($cmpImg);
        $cmpHeight = imagesy($cmpImg);
        if ($refWidth && $refHeight && $cmpWidth && $cmpHeight) {
            $width = max($refWidth, $cmpWidth);
            $height = max($refHeight, $cmpHeight);
            $im = imagecreate($width, $height);
            if ($im !== FALSE) {
                $black = GetColor($im, 0, 0, 0);
                $white = GetColor($im, 255, 255, 255);
                imagefilledrectangle($im, 0, 0, $width, $height, $black);
                // loop through every pixel in the images and compare them
                for ($x = 0; $x < $width; $x++) {
                    for ($y = 0; $y < $height; $y++) {
                        $different = false;
                        if ($x > $refWidth || $x > $cmpWidth || $y > $refHeight || $y > $cmpHeight) {
                            $different = true;
                        } else {
                            $refColor = imagecolorat($refImg, $x, $y);
                            $r = $refColor >> 16 & 0xff;
                            $g = $refColor >> 8 & 0xff;
                            $b = $refColor & 0xff;
                            $cmpColor = imagecolorat($cmpImg, $x, $y);
                            $r2 = $cmpColor >> 16 & 0xff;
                            $g2 = $cmpColor >> 8 & 0xff;
예제 #4
0
    $Info->initiate($size);
    $Info->x = 0;
    $Info->y = $MainText->height + $Info->height;
}
$Image = new Text();
$Image->width = max($MainText->width, $Info->width);
$Image->height = $MainText->height;
$Image->height += $Info->height;
$MainText->x = max(0, floor(($Image->width - $MainText->width) / 2));
$MainText->y = 0;
$Info->x = max(0, floor(($Image->width - $Info->width) / 2));
$Info->y = $MainText->height + 1;
$img = imagecreatetruecolor($Image->width, $Image->height);
imagealphablending($img, FALSE);
imagesavealpha($img, TRUE);
$MainText->color = imagecolorallocate($img, GetColor("r", $Colors[$color]), GetColor("g", $Colors[$color]), Getcolor("b", $Colors[$color]));
$Info->color = $MainText->color;
$transparent = imagecolorallocatealpha($img, 255, 255, 255, 127);
$area = imagefilledrectangle($img, 0, 0, $Image->width, $Image->height, $transparent);
imagettftext($img, $MainText->size, $MainText->angle, $MainText->x, $MainText->y + $MainText->height - 1, $MainText->color, $MainText->font, $MainText->value);
if ($Info->value != "") {
    imagettftext($img, $Info->size, $Info->angle, $Info->x, $Info->y + $Info->height - 1, $Info->color, $Info->font, $Info->value);
}
$new = imagecreatetruecolor(150, $FinalHeight);
imagealphablending($new, FALSE);
imagesavealpha($new, TRUE);
$area = imagefilledrectangle($new, 0, 0, 150, $FinalHeight, $transparent);
$y = floor($MainText->height * $FinalHeight / $Image->height);
imagecopyresampled($new, $img, 0, 0, $MainText->x, $MainText->y, 150, $y, $MainText->width, $MainText->height);
if ($Info->value != "") {
    imagecopyresampled($new, $img, 0, $y + 1, $Info->x, $Info->y, 150, ceil($Info->height * $FinalHeight / $Image->height), $Info->width, $Info->height);
예제 #5
0
function ConstruireEDTProfDuJour($login_edt, $period, $jour)
{
    global $current_edt_id_cours;
    // id_cours utilisé pour les semaines A/B dans GetColor()
    $table_data = array();
    $type_edt = "prof";
    $req_jours = mysqli_query($GLOBALS["mysqli"], "SELECT jour_horaire_etablissement FROM horaires_etablissement WHERE ouvert_horaire_etablissement = 1") or die(mysqli_error($GLOBALS["mysqli"]));
    $jour_sem_tab = array();
    $entetes = ConstruireEnteteEDT();
    while (!isset($entetes['entete'][$jour])) {
        $jour--;
    }
    $jour_sem_tab[$jour] = $entetes['entete'][$jour];
    $tab_data['entete'][$jour] = $entetes['entete'][$jour];
    $req_id_creneaux = mysqli_query($GLOBALS["mysqli"], "SELECT id_definie_periode FROM edt_creneaux\r\n\t\t\t\t\t\t\tWHERE type_creneaux != 'pause'") or die(mysqli_error($GLOBALS["mysqli"]));
    $nbre_lignes = mysqli_num_rows($req_id_creneaux);
    if ($nbre_lignes == 0) {
        $nbre_lignes = 1;
    }
    if ($nbre_lignes > 10) {
        $nbre_lignes = 10;
    }
    $tab_data['nb_creneaux'] = $nbre_lignes;
    $index_box = 0;
    while (isset($jour_sem_tab[$jour])) {
        if ($type_edt == "prof") {
            $tab_id_creneaux = retourne_id_creneaux();
            $j = 0;
            $elapse_time = 0;
            while (isset($tab_id_creneaux[$j])) {
                $req_creneau = LessonsFromDayTeacherSlotPeriod($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux[$j], $period);
                $rep_creneau = mysqli_fetch_array($req_creneau);
                $nb_rows = mysqli_num_rows($req_creneau);
                // ========================================== créneau vide
                if ($nb_rows == 0) {
                    $heuredeb_dec = 0;
                    if ($elapse_time % 2 != 0) {
                        $heuredeb_dec = 1;
                    }
                    $delay = 2 - $elapse_time % 2;
                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $delay, "cadre", "");
                    $elapse_time += $delay;
                } else {
                    if ($nb_rows == 1) {
                        $current_edt_id_cours = "";
                        if (isset($rep_creneau['id_cours'])) {
                            $current_edt_id_cours = $rep_creneau['id_cours'];
                        }
                        if ($rep_creneau['id_semaine'] != '0') {
                            $duree_max = $rep_creneau['duree'];
                            $heuredeb_dec = $rep_creneau['heuredeb_dec'];
                            // ========= études des cas n°2 , 6 et 7
                            if ($duree_max == 1) {
                                // ||(($duree_max == 2) AND ($rep_creneau['heuredeb_dec'] == 0))
                                if ($heuredeb_dec == 0 and $elapse_time % 2 != 0) {
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                    $elapse_time++;
                                } else {
                                    $cell_height = 2;
                                    if ($duree_max == 1 and $rep_creneau['heuredeb_dec'] != 0 and $elapse_time % 2 != 0) {
                                        $cell_height = 1;
                                    }
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $cell_height, "", "");
                                    if ($duree_max == 1 and $rep_creneau['heuredeb_dec'] != 0 and $elapse_time % 2 == 0) {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                        $elapse_time++;
                                    }
                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], $rep_creneau['id_semaine'], $period);
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $duree_max, GetColor($rep_creneau['id_groupe']), $contenu);
                                    $elapse_time += $duree_max;
                                    if ($duree_max == 1 and $rep_creneau['heuredeb_dec'] == 0) {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                        $elapse_time++;
                                    }
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $cell_height, "", "");
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $cell_height, "cadre", "");
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                }
                            } else {
                                $duree_max1 = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 2, $period);
                                $duree_max2 = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, 1, $period);
                                if ($duree_max1 >= $duree_max2) {
                                    $duree_max = $duree_max1;
                                } else {
                                    $duree_max = $duree_max2;
                                }
                                mysqli_data_seek($req_creneau, 0);
                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $rep_creneau['id_semaine'], $tab_data, $index_box, $period);
                                $elapse_time += $duree_max;
                            }
                        } else {
                            // ======== étude du cas n°5
                            if ($rep_creneau['heuredeb_dec'] != 0 and $elapse_time % 2 == 0) {
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                $elapse_time++;
                            }
                            // ======== étude du cas n°3
                            if ($rep_creneau['heuredeb_dec'] == 0 and $elapse_time % 2 == 1 and $rep_creneau['duree'] == 1) {
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                $elapse_time++;
                            } else {
                                $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                $elapse_time += (int) $rep_creneau['duree'];
                            }
                        }
                    } else {
                        if ($nb_rows == 2) {
                            mysqli_data_seek($req_creneau, 0);
                            $rep_creneau = mysqli_fetch_array($req_creneau);
                            $duree1 = $rep_creneau['duree'];
                            $heuredeb_dec1 = $rep_creneau['heuredeb_dec'];
                            $id_semaine1 = $rep_creneau['id_semaine'];
                            $rep_creneau = mysqli_fetch_array($req_creneau);
                            $duree2 = $rep_creneau['duree'];
                            $heuredeb_dec2 = $rep_creneau['heuredeb_dec'];
                            $id_semaine2 = $rep_creneau['id_semaine'];
                            mysqli_data_seek($req_creneau, 0);
                            $rep_creneau = mysqli_fetch_array($req_creneau);
                            $current_edt_id_cours = "";
                            if (isset($rep_creneau['id_cours'])) {
                                $current_edt_id_cours = $rep_creneau['id_cours'];
                            }
                            // ========= étude du cas PapaTango 1 (Problème de Transition de edt version 1 vers edt version 2)
                            if ($id_semaine1 == '0' || $id_semaine2 == '0') {
                                if ($heuredeb_dec1 == 0 and $heuredeb_dec2 == 0) {
                                    $PapaTango = 1;
                                } else {
                                    if ($heuredeb_dec1 == 0.5 and $heuredeb_dec2 == 0.5) {
                                        $PapaTango = 1;
                                    } else {
                                        $PapaTango = 0;
                                    }
                                }
                            }
                            // ========= étude des cas n°11, 12 et 13
                            if ($id_semaine1 == '0' || $id_semaine2 == '0' and $PapaTango == 0) {
                                if ($heuredeb_dec1 == 0) {
                                    if ($id_semaine1 != '0') {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                    }
                                    mysqli_data_seek($req_creneau, 0);
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                    if ($id_semaine1 != '0') {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                    }
                                    $elapse_time++;
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    // ====================== étude du cas 12'
                                    if ($id_semaine2 != '0') {
                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, 3, $period);
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    } else {
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                        $elapse_time += (int) $rep_creneau['duree'];
                                    }
                                } else {
                                    if ($id_semaine2 != '0') {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                    }
                                    mysqli_data_seek($req_creneau, 0);
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                    if ($id_semaine2 != '0') {
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                    }
                                    $elapse_time++;
                                    mysqli_data_seek($req_creneau, 0);
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    // ====================== étude du cas n°12'
                                    if ($id_semaine1 != '0') {
                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 3, $period);
                                        mysqli_data_seek($req_creneau, 0);
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    } else {
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                        $elapse_time += (int) $rep_creneau['duree'];
                                    }
                                }
                            } else {
                                mysqli_data_seek($req_creneau, 0);
                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                $id_semaine1 = $rep_creneau['id_semaine'];
                                $heuredeb_dec1 = $rep_creneau['heuredeb_dec'];
                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                $id_semaine2 = $rep_creneau['id_semaine'];
                                $heuredeb_dec2 = $rep_creneau['heuredeb_dec'];
                                $current_edt_id_cours = "";
                                if (isset($rep_creneau['id_cours'])) {
                                    $current_edt_id_cours = $rep_creneau['id_cours'];
                                }
                                if ($id_semaine1 != $id_semaine2) {
                                    // ========= étude des cas n°8 et n°9 et n°14 et n°15 et n°16 et 10
                                    $duree_max1 = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 2, $period);
                                    $duree_max2 = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, 1, $period);
                                    if ($duree_max1 >= $duree_max2) {
                                        $duree_max = $duree_max1;
                                    } else {
                                        $duree_max = $duree_max2;
                                    }
                                    mysqli_data_seek($req_creneau, 0);
                                    ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                    ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $rep_creneau['id_semaine'], $tab_data, $index_box, $period);
                                    $elapse_time += $duree_max;
                                } else {
                                    // ========= étude du cas rebelle 15''
                                    if ($heuredeb_dec1 == 0) {
                                        if ($id_semaine1 != '0') {
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                        }
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                        if ($id_semaine1 != '0') {
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        }
                                        $elapse_time++;
                                        $j = (int) ($elapse_time / 2);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        // ======================
                                        if ($id_semaine2 != '0') {
                                            $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 3, $period);
                                            mysqli_data_seek($req_creneau, 0);
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                            $id_semaine_to_use = $rep_creneau['id_semaine'];
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                            $elapse_time += $duree_max;
                                        } else {
                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                            $elapse_time += (int) $rep_creneau['duree'];
                                        }
                                    } else {
                                        if ($id_semaine2 != '0') {
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                        }
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                        if ($id_semaine2 != '0') {
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        }
                                        $elapse_time++;
                                        $j = (int) ($elapse_time / 2);
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        // ======================
                                        if ($id_semaine1 != '0') {
                                            $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 3, $period);
                                            mysqli_data_seek($req_creneau, 0);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                            $id_semaine_to_use = $rep_creneau['id_semaine'];
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                            $elapse_time += $duree_max;
                                        } else {
                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                            $elapse_time += (int) $rep_creneau['duree'];
                                        }
                                    }
                                }
                            }
                        } else {
                            if ($nb_rows == 3) {
                                mysqli_data_seek($req_creneau, 0);
                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                $duree1 = $rep_creneau['duree'];
                                $heuredeb_dec1 = $rep_creneau['heuredeb_dec'];
                                $id_semaine1 = $rep_creneau['id_semaine'];
                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                $duree2 = $rep_creneau['duree'];
                                $heuredeb_dec2 = $rep_creneau['heuredeb_dec'];
                                $id_semaine2 = $rep_creneau['id_semaine'];
                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                $duree3 = $rep_creneau['duree'];
                                $heuredeb_dec3 = $rep_creneau['heuredeb_dec'];
                                $id_semaine3 = $rep_creneau['id_semaine'];
                                $current_edt_id_cours = "";
                                if (isset($rep_creneau['id_cours'])) {
                                    $current_edt_id_cours = $rep_creneau['id_cours'];
                                }
                                if ($id_semaine1 == '0' || $id_semaine2 == '0' || $id_semaine3 == '0') {
                                    // ======= étude du cas 17
                                    if ($heuredeb_dec1 == 0 and $id_semaine1 == '0') {
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                        $elapse_time += (int) $rep_creneau['duree'];
                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, 3, $period);
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    } else {
                                        if ($heuredeb_dec2 == 0 and $id_semaine2 == '0') {
                                            mysqli_data_seek($req_creneau, 0);
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                            $elapse_time += (int) $rep_creneau['duree'];
                                            $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 3, $period);
                                            mysqli_data_seek($req_creneau, 0);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                            $id_semaine_to_use = $rep_creneau['id_semaine'];
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                            $elapse_time += $duree_max;
                                        } else {
                                            if ($heuredeb_dec3 == 0 and $id_semaine3 == '0') {
                                                mysqli_data_seek($req_creneau, 0);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                                $elapse_time += (int) $rep_creneau['duree'];
                                                $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 2, $period);
                                                mysqli_data_seek($req_creneau, 0);
                                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                                $id_semaine_to_use = $rep_creneau['id_semaine'];
                                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                                $elapse_time += $duree_max;
                                            } else {
                                                if ($heuredeb_dec1 == 0 and $heuredeb_dec2 == 0) {
                                                    mysqli_data_seek($req_creneau, 0);
                                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                    $elapse_time += (int) $rep_creneau['duree'];
                                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                                    $elapse_time += (int) $rep_creneau['duree'];
                                                } else {
                                                    if ($heuredeb_dec1 == 0 and $heuredeb_dec3 == 0) {
                                                        mysqli_data_seek($req_creneau, 0);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                        $elapse_time += (int) $rep_creneau['duree'];
                                                        mysqli_data_seek($req_creneau, 0);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                                        $elapse_time += (int) $rep_creneau['duree'];
                                                    } else {
                                                        if ($heuredeb_dec2 == 0 and $heuredeb_dec3 == 0) {
                                                            mysqli_data_seek($req_creneau, 0);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $rep_creneau['duree'], "", "");
                                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule1", GetColor($rep_creneau['id_groupe']), $contenu);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                                            $elapse_time += (int) $rep_creneau['duree'];
                                                            mysqli_data_seek($req_creneau, 0);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $rep_creneau['id_groupe'], $rep_creneau['id_aid'], "", $period);
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], $rep_creneau['id_groupe'], $rep_creneau['id_cours'], "cellule" . $rep_creneau['duree'], GetColor($rep_creneau['id_groupe']), $contenu);
                                                            $elapse_time += (int) $rep_creneau['duree'];
                                                        } else {
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "erreur", $tab_id_creneaux[$j], "none", "none", "cellule2", "cadreRouge", "C02");
                                                            $elapse_time += 2;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($heuredeb_dec1 == 0 and $heuredeb_dec2 == 0) {
                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 2, $period);
                                        mysqli_data_seek($req_creneau, 0);
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                        mysqli_data_seek($req_creneau, 0);
                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    } else {
                                        if ($heuredeb_dec1 == 0 and $heuredeb_dec3 == 0) {
                                            $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, 3, $period);
                                            mysqli_data_seek($req_creneau, 0);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                            mysqli_data_seek($req_creneau, 0);
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            $id_semaine_to_use = $rep_creneau['id_semaine'];
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                            $elapse_time += $duree_max;
                                        } else {
                                            if ($heuredeb_dec2 == 0 and $heuredeb_dec3 == 0) {
                                                $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, 3, $period);
                                                mysqli_data_seek($req_creneau, 0);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                                mysqli_data_seek($req_creneau, 0);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                $id_semaine_to_use = $rep_creneau['id_semaine'];
                                                ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                                $elapse_time += $duree_max;
                                            } else {
                                                if ($heuredeb_dec1 == 0) {
                                                    if ($id_semaine1 == $id_semaine2) {
                                                        $rang = 3;
                                                    } else {
                                                        $rang = 2;
                                                    }
                                                    $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 1, $rang, $period);
                                                    mysqli_data_seek($req_creneau, 0);
                                                    ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                                    $id_semaine_to_use = $rep_creneau['id_semaine'];
                                                    if ($rang == 3) {
                                                        mysqli_data_seek($req_creneau, 0);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                    } else {
                                                        mysqli_data_seek($req_creneau, 0);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                    }
                                                    ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                                    $elapse_time += $duree_max;
                                                } else {
                                                    if ($heuredeb_dec2 == 0) {
                                                        if ($id_semaine2 == $id_semaine1) {
                                                            $rang = 3;
                                                        } else {
                                                            $rang = 1;
                                                        }
                                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 2, $rang, $period);
                                                        mysqli_data_seek($req_creneau, 0);
                                                        $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                                        if ($rang == 1) {
                                                            mysqli_data_seek($req_creneau, 0);
                                                        } else {
                                                            mysqli_data_seek($req_creneau, 0);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                        }
                                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                                        $elapse_time += $duree_max;
                                                    } else {
                                                        if ($heuredeb_dec3 == 0) {
                                                            if ($id_semaine3 == $id_semaine1) {
                                                                $rang = 2;
                                                            } else {
                                                                $rang = 1;
                                                            }
                                                            $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, 3, $rang, $period);
                                                            mysqli_data_seek($req_creneau, 0);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                                            $id_semaine_to_use = $rep_creneau['id_semaine'];
                                                            if ($rang == 1) {
                                                                mysqli_data_seek($req_creneau, 0);
                                                            } else {
                                                                mysqli_data_seek($req_creneau, 0);
                                                                $rep_creneau = mysqli_fetch_array($req_creneau);
                                                            }
                                                            ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                                            $elapse_time += $duree_max;
                                                        } else {
                                                            // ============== 3 enseignements sur le même créneau
                                                            // ============== situation non envisagée
                                                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "erreur", $tab_id_creneaux[$j], "none", "none", "cellule2", "cadreRouge", "C03");
                                                            $elapse_time += 2;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            } else {
                                if ($nb_rows == 4) {
                                    // ============= damned !! 4 cours sur le même créneau...
                                    $rang1 = 0;
                                    $rang2 = 0;
                                    mysqli_data_seek($req_creneau, 0);
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    if ($rep_creneau['heuredeb_dec'] == 0) {
                                        $rang1 = 1;
                                    }
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    if ($rep_creneau['heuredeb_dec'] == 0) {
                                        if ($rang1 == 0) {
                                            $rang1 = 2;
                                        } else {
                                            $rang2 = 2;
                                        }
                                    }
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    if ($rep_creneau['heuredeb_dec'] == 0) {
                                        if ($rang1 == 0) {
                                            $rang1 = 3;
                                        } else {
                                            $rang2 = 3;
                                        }
                                    }
                                    $rep_creneau = mysqli_fetch_array($req_creneau);
                                    if ($rep_creneau['heuredeb_dec'] == 0) {
                                        if ($rang1 == 0) {
                                            $rang1 = 4;
                                        } else {
                                            $rang2 = 4;
                                        }
                                    }
                                    if ($rang1 == 0 or $rang2 == 0) {
                                        // ============= trois enseignements de front sur les 4
                                        // ============= situation non envisagée
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "erreur", $tab_id_creneaux[$j], "none", "none", "cellule2", "cadreRouge", "C04");
                                        $elapse_time += 2;
                                    } else {
                                        $duree_max = DureeMax2Colonnes($jour_sem_tab[$jour], $login_edt, $tab_id_creneaux, $elapse_time, $req_creneau, $j, $rang1, $rang2, $period);
                                        $l = 1;
                                        mysqli_data_seek($req_creneau, 0);
                                        while ($l < $rang1) {
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            $l++;
                                        }
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, '0', $tab_data, $index_box, $period);
                                        $id_semaine_to_use = $rep_creneau['id_semaine'];
                                        $l = 1;
                                        mysqli_data_seek($req_creneau, 0);
                                        while ($l < $rang2) {
                                            $rep_creneau = mysqli_fetch_array($req_creneau);
                                            $l++;
                                        }
                                        ConstruireColonne($elapse_time, $req_creneau, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_edt, $id_semaine_to_use, $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    }
                                } else {
                                    // ============= gloups ! 5 enseignements ou plus sur le même créneau
                                    //               il y a une erreur dans la table edt_cours ou c'est une situation non envisagée
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "erreur", $tab_id_creneaux[$j], "none", "none", "cellule2", "cadreRouge", "C05");
                                    $elapse_time += 2;
                                }
                            }
                        }
                    }
                }
                $j = (int) ($elapse_time / 2);
            }
        }
        $jour++;
        $index_box = 0;
    }
    // ***************************************    Remplissage des créneaux
    $reglages_creneaux = GetSettingEdt("edt_aff_creneaux");
    //Cas où le nom des créneaux sont inscrits à gauche
    if ($reglages_creneaux == "noms") {
        $tab_creneaux = retourne_creneaux();
        $i = 0;
        while ($i < count($tab_creneaux)) {
            $tab_id_creneaux = retourne_id_creneaux();
            $c = 0;
            while ($c < count($tab_id_creneaux)) {
                //echo("                <div class=\"horaires\"><div class=\"cadre\"><strong>".$tab_creneaux[$i]."</strong></div></div>\n");
                $tab_data['creneaux'][$jour] = $tab_creneaux[$jour];
                $i++;
                $c++;
            }
        }
    } elseif ($reglages_creneaux == "heures") {
        $tab_horaire = retourne_horaire();
        for ($i = 0; $i < count($tab_horaire);) {
            $tab_id_creneaux = retourne_id_creneaux();
            $c = 0;
            while ($c < count($tab_id_creneaux)) {
                //echo("                <div class=\"horaires\"><div class=\"cadre\"><strong>".$tab_horaire[$i]["heure_debut"]."<br />".$tab_horaire[$i]["heure_fin"]."</strong></div></div>\n");
                $tab_data['creneaux'][$i] = $tab_horaire[$i]["heure_debut"] . "<br />" . $tab_horaire[$i]["heure_fin"];
                $i++;
                $c++;
            }
        }
    }
    return $tab_data;
}
예제 #6
0
function list_table()
{
    $MyPage = CurrentPageName();
    $page = 1;
    $tpl = new templates();
    $q = new mysql();
    if (!$q->TABLE_EXISTS("smtp_logs", "artica_events")) {
        $q->BuildTables();
    }
    $table = "smtp_logs";
    $t = $_GET["t"];
    $database = "artica_events";
    $FORCE_FILTER = 1;
    if (!$q->TABLE_EXISTS("smtp_logs", "artica_events")) {
        json_error_show("!Error: artica_events No such table");
    }
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show("No item");
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}");
        }
        $total = $ligne["TCOUNT"];
        if ($total == 0) {
            json_error_show("No rows for {$searchstring}");
        }
    } else {
        $total = $q->COUNT_ROWS($table, $database);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}<hr>{$sql}<hr>");
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show("No data...", 1);
    }
    $today = date('Y-m-d');
    $style = "font-size:14px;";
    $ini = GetColor();
    $unknown = $tpl->_ENGINE_parse_body("{unknown}");
    while ($line = mysql_fetch_assoc($results)) {
        $Country = $line["Country"];
        $country_img = GetFlags($Country);
        $Region = $line["Region"];
        $smtp_sender = $line["smtp_sender"];
        $SPAM = $line["SPAM"];
        $rcpt = $line["delivery_user"];
        $mailfrom = $line["sender_user"];
        $bounce_error = trim($line["bounce_error"]);
        $time = $line["time_connect"];
        $time = str_replace($today, "", $time);
        $spammy = $line["spammy"];
        $bg_color = null;
        if ($spammy == 1) {
            $bounce_error = "SPAMMY";
        }
        if ($SPAM == 1) {
            $bounce_error = "SPAM";
        }
        $bounce_error_key = str_replace(" ", "_", $bounce_error);
        if (isset($ini[$bounce_error_key])) {
            $bg_color = "background-color:{$ini[$bounce_error_key]["row_color"]};color:{$ini[$bounce_error_key]["text_color"]};margin:-5px;padding:5px;font-weight:bold";
        }
        if ($mailfrom == null) {
            $mailfrom = "{$unknown}";
        }
        if ($rcpt == null) {
            $rcpt = "{$unknown}";
        }
        if ($bounce_error == "Sended") {
            $bounce_error = $tpl->javascript_parse_text("{sended}");
        }
        $js = "Loadjs('{$MyPage}?zoom-js=yes&id={$line["id"]}&hostname={$_GET["hostname"]}&ou={$_GET["ou"]}')";
        $md = md5(serialize($ligne));
        $cells = array();
        $cells[] = "<img src='img/{$country_img}'>";
        $cells[] = "<span style='font-size:14px;'>{$time}</span>";
        $cells[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline'>{$mailfrom}</a>";
        $cells[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline'>{$rcpt}</a>";
        $cells[] = "<span style='font-size:11px;'><div style='{$bg_color};text-transform:capitalize;font-size:14px;'>{$bounce_error}</div></span>";
        $data['rows'][] = array('id' => $line["id"], 'cell' => $cells);
    }
    echo json_encode($data);
}
예제 #7
0
$height = $fontHeight + $rowMargin * 2;
foreach ($tests as &$test) {
    $rowheight = (int) ($thumbSize * (4.0 / 3.0));
    if ($test['video']['width'] && $test['video']['height']) {
        $rowheight = (int) ((double) $thumbSize / (double) $test['video']['width'] * (double) $test['video']['height']);
    }
    $test['thumbHeight'] = $rowheight;
    $height += $rowheight + $rowMargin * 2;
}
// create the blank image
$im = imagecreatetruecolor($width, $height);
// define some colors
$black = GetColor($im, 0, 0, 0);
$white = GetColor($im, 255, 255, 255);
$textColor = GetColor($im, 255, 255, 255);
$colChanged = GetColor($im, 254, 179, 1);
imagefilledrectangle($im, 0, 0, $width, $height, $black);
// put the time markers across the top
$left = $thumbLeft;
$top = $thumbTop - $fontHeight;
$skipped = $interval;
$last = $end + $interval - 1;
for ($frame = 0; $frame <= $last; $frame++) {
    $skipped++;
    if ($skipped >= $interval) {
        $left += $colMargin;
        $skipped = 0;
        $val = number_format((double) $frame / 10.0, 1) . 's';
        $x = $left + (int) ($thumbSize / 2.0) - (int) ((double) $fontWidth * ((double) strlen($val) / 2.0));
        imagestring($im, $font, $x, $top, $val, $textColor);
        $left += $thumbSize + $colMargin;
예제 #8
0
    $actionSizeY = $css[".action"]["height"];
    $actionGap = $css[".actiongap"]["height"];
    $icon = @imagecreatefrompng("{$action}.png") or die("cannot create png image - {$action}.png");
    $image = @imagecreatetruecolor($actionSizeX, $actionSizeY) or die("cannot create image");
    $colorfg = $css[".{$action}"]["color"];
    $colorbg = $css[".{$action}"]["background"];
    $fillX = $actionSizeX;
    $fillY = $actionSizeY - $actionGap;
    imagefilledrectangle($image, 0, 0, $actionSizeX, $actionSizeY, GetColor($image, "white"));
    imagefilledrectangle($image, 0, 0, $fillX - 1, $fillY - 1, GetColor($image, $colorbg));
    for ($x1 = 0, $y1 = 0, $x2 = $fillX - 1, $y2 = $fillY - 1; $x1 < $actionGap; $x1++, $y1++, $x2--, $y2--) {
        imagefilledrectangle($image, $x1, $y2, $x2, $y2, GetColor($image, $colorbg, "black"));
        imagefilledrectangle($image, $x2, $y1, $x2, $y2, GetColor($image, $colorbg, "black"));
        imagefilledrectangle($image, $x1, $y1, $x2, $y1, GetColor($image, $colorbg, "white"));
        imagefilledrectangle($image, $x1, $y1, $x1, $y2, GetColor($image, $colorbg, "white"));
    }
    imagettftext($image, $fillY * 0.6, 0, $fillY + $actionBorder, $fillY * 0.8, GetColor($image, $colorfg), "arial.ttf", $captionimg);
    imagecopyresized($image, $icon, $actionBorder, $actionBorder, 0, 0, imagesx($icon), imagesy($icon), imagesx($icon), imagesy($icon));
    header("Content-type: image/png");
    imagepng($image);
    imagedestroy($image);
    imagedestroy($icon);
} else {
    $config = JFactory::getConfig();
    $step2Url = $config->get('live_site') . "/" . ModerationConfig::Step2DirectUrl;
    $moderationconfig = new ReflectionClass("ModerationConfig");
    $data = array("action" => $action, "ctcid" => $ctcid, "msgid" => $msgid, "modid" => $modid, "ctcaction" => $ctcaction, "subject" => $subject, "body" => $body, "list" => $list, "lists" => $action == "edit" ? SqlResultArray($con, "select listid, listname from ctcweb9_ctc.mailchimp_lists") : null, "listid" => $listid, "listname" => $listname, "captionweb" => $captionweb, "formaction" => $step2Url, "livesite" => $config->get('live_site'), "editedhtml" => @file_get_contents("{$moderated}/cur/{$msgid}.edited.html"), "config" => $moderationconfig->getConstants(), "raw" => $raw);
    echo str_replace('$data', json_encode($data), file_get_contents("moderationStep2.html"));
}
?>