171 lines
7.8 KiB
PHP
Executable File
171 lines
7.8 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
$tabIdType =array();
|
|
$tabTagLib =array();
|
|
$tabOrdre=array();
|
|
$tabCode1= array();
|
|
$tabCode2 = array();
|
|
$prixHTTab = array();
|
|
$prixTTCTab = array();
|
|
$imageCATab = array();
|
|
$tabTvaTaux = array();
|
|
|
|
|
|
if (!empty($_SESSION['listeOptions'])) $listeOptions=$_SESSION['listeOptions'];
|
|
if (!empty($_SESSION['typeDeListe'])) $typeDeListe=$_SESSION['typeDeListe'];
|
|
if (!empty($_SESSION['order']) && isset($_SESSION['order'])) {$order=$_SESSION['order'];} else {$order=array();$order[0]=1;}
|
|
$o=0;
|
|
$trouveListesOptions=false;
|
|
|
|
// le probleme : on peut avoir des sous listes differentes selon le post
|
|
// les sous listes ne sont pas affichées par defaut. si on l'identifie on force son affichage
|
|
// donc l'ordre va varier
|
|
|
|
// ---------------------------------------------------
|
|
// Requetes select de chaque CA
|
|
// ---------------------------------------------------
|
|
if (isset($debug[1]) && $debug[1] == '1' && isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(1, ['$itemNumberPost' => $itemNumberPost ], 'formOptionsReqSelectOrder'); }
|
|
|
|
for($a=0; $a<23; $a++) {
|
|
$trouveTabOrder=false;
|
|
$trouveListefalse;
|
|
$tabItemNumber=array();
|
|
$idCaPers=$a+1;
|
|
$trouveListesOptions=false;
|
|
$typeDeListe[$a]='';
|
|
|
|
// ---------------------------------------------------
|
|
// Mise en tableau générique de chaque CA
|
|
// ---------------------------------------------------
|
|
include ("./admin/catalog/req/reqAllDyn" .$idCaPers. ".php");
|
|
include ("./admin/adminInclude/ressources/caracteristiquesToTab.php");
|
|
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['$libDynNom[' .$a. ']' => $libDynNom[$a], 'idTypeCherche-' => $idTypeCherche, 'idCaPers-' => $idCaPers ], 'formOptionsReqSelectOrder.php'); }
|
|
|
|
// ---------------------------------------------------
|
|
// Pour chaque table CA :
|
|
// Determiner si Menu, si oui --> determiner si include
|
|
// Determiner l'ordre des formulaires final
|
|
// ---------------------------------------------------
|
|
|
|
For ($y=0; $y<count($tabIdType); $y++) {
|
|
$tabItemNumber[$y]=$a. '' .$y;
|
|
|
|
// if (isset($debug[1]) && $debug[1] == '1' && $y<1 ) { $debugMsg .= monDebug(1, ['$tabIdType[' .$y. ']' => $tabIdType[$y], 'tabItemNumber-' => $tabItemNumber[$y] ], ''); }
|
|
|
|
// ---------------------------------------------------
|
|
// Menu avec sous liste : ou indep
|
|
// ---------------------------------------------------
|
|
if ($tabIdType[$y]==1 && $idTypeCherche==1 && ( $tabCode1[$y]==$libelleOption1[0] || $tabCode1[$y]==$libelleOption1[2] ) ) {
|
|
if (strtoupper($tabCode1[$y])==strtoupper($libelleOption1[0]) ) {
|
|
$typeDeListe[$a]='Menu';
|
|
}
|
|
|
|
if (strtoupper($tabCode1[$y])==strtoupper($libelleOption1[2]) ) {
|
|
$typeDeListe[$a]='Indep';
|
|
}
|
|
|
|
$order[$o]=trim( intval($tabOrdre[$y]) );
|
|
if (isset($debug[1]) && $debug[1] == '1' ) {
|
|
if ($o>0) $b=$o-1; else $b=0;
|
|
{ $debugMsg .= monDebug(1, ['$typeDeListe[' .$a. ']' => $typeDeListe[$a], 'order[' .$o. ']' => $order[$o] , 'tabOrdre[' .$y. ']' => $tabOrdre[$y] ], ''); }
|
|
}
|
|
$o++;
|
|
}
|
|
|
|
// ---------------------------------------------------
|
|
// Valeur unique
|
|
// ---------------------------------------------------
|
|
if ($tabIdType[$y]==$idTypeCherche && $typeDeListe[$a]=='' && $idTypeCherche>1) {
|
|
$typeDeListe[$a]='Indep';
|
|
$order[$o]=trim( intval($tabOrdre[1]) );
|
|
$o++;
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['Valeur unique -> LISTE = indep -> order[' .$o. ']' => $order[$o] ], ''); }
|
|
}
|
|
// else if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['pas Valeur unique -> LISTE' => $typeDeListe[$a] ], ''); }
|
|
|
|
|
|
// ---------------------------------------------------
|
|
// Définition des sous listes includées
|
|
// ---------------------------------------------------
|
|
if ($tabIdType[$y] > 1 && !empty($itemNumberPost) && $typeDeListe[$a]=='Menu') {
|
|
if ($tabCode1[$y]!='-' && $tabCode1[$y]!='' && $tabCode1[$y]!='aucun' && $itemNumberPost == $tabItemNumber[$y] ) {
|
|
$_SESSION['init']=1;
|
|
$listeOptions=explode(';',trim($tabCode1[$y]));
|
|
$trouveListesOptions=true;
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['Trouvée liste options' => '' ], ''); }
|
|
}
|
|
}
|
|
else {
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['pas de listes id' => $tabIdType, 'itemNumberPost' => $itemNumberPost ], ''); }
|
|
}
|
|
|
|
} // for y
|
|
|
|
$trouveListe=false;
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['$typeDeListe[$a]' => $typeDeListe[$a], 'trouveListesOptions' => $trouveListe, 'trouveListe' => $trouveListesOptions ], ''); }
|
|
} // for a
|
|
|
|
|
|
// ---------------------------------------------------
|
|
// Chercher les listes includée si elles sont marquées à afficher ($idTypeCherche==1)
|
|
// - necessite de reboucler car les listes sont dans in ordre aléatoire : donc une liste peut etre vavant son menu
|
|
// - que si type=menu
|
|
// ---------------------------------------------------
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) $debugMsg .= '<br><span style="color:black"> | $tabItemNumber[' .$y. '] = ' .$tabItemNumber[$y]. ' </span>';
|
|
// ---------------------------------------------------
|
|
if (!empty($typeDeListe) && !empty($listeOptions)) {
|
|
$nombreListeAff=count($typeDeListe);
|
|
foreach($typeDeListe as $c =>$item) {
|
|
if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug(1, ['$c' => $c, 'nombreListeAff' => $nombreListeAff, 'typeDeListe' => $typeDeListe[$c] ], ''); }
|
|
|
|
if ($typeDeListe[$c]=='Menu') {
|
|
for($b=0; $b<23; $b++) {
|
|
$idCaPers2=$b+1;
|
|
|
|
// ---------------------------------------------------
|
|
// Mise en tableau générique de chaque CA
|
|
// ---------------------------------------------------
|
|
include ("./admin/catalog/req/reqAllDyn" .$idCaPers2. ".php");
|
|
include ("./admin/adminInclude/ressources/caracteristiquesToTab_listeInclude.php");
|
|
|
|
if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug(1, ['Je rentre dans le test de liste includée' => $idCaPers2 ], ''); }
|
|
|
|
For ($w=0;$w<count($tabIdType); $w++) {
|
|
|
|
if ($tabCode1[$w]==$libelleOption1[1] && $idTypeCherche==1) {
|
|
|
|
if (isset($debug[1]) && $debug[1] == '1' && $w==1 ) { $debugMsg .= monDebug(1, ['Je rentre dans la fiche 1' => $tabCode1[$w], 'idTypeCherche' => $idTypeCherche, 'libDynNom[$b]' => $libDynNom[$b] ], ''); }
|
|
|
|
for($nbOptionsListe=0; $nbOptionsListe<count($listeOptions); $nbOptionsListe++) {
|
|
|
|
if (isset($debug[1]) && $debug[1] == '1' && $w==1 ) { $debugMsg .= monDebug(1, ['Je rentre dans l\'option' => $listeOptions[$nbOptionsListe], 'idTypeCherche' => $idTypeCherche, 'libDynNom[$b]' => $libDynNom[$b] ], ''); }
|
|
|
|
|
|
// Test si includée - vérifier si la liste a le nom libDynNom[$x] = a une des listeOptions
|
|
if (strtoupper(trim($listeOptions[$nbOptionsListe]))==strtoupper(trim($libDynNom[$b]))) {
|
|
$oulala=intval($nombreListeAff) +1 ;
|
|
$typeDeListe[$oulala]='Includée';
|
|
$order[$o]=trim(intval($tabOrdre[1]) ); //le order est toujours sur la fiche 1
|
|
if (isset($debug[15]) && $debug[15] == '1' ) { $debugMsg .= monDebug(1, ['$order[$o]' => $order[$o], '$libDynNom[$b]' => $libDynNom[$b], 'libDynNom[$b]' => $libDynNom[$b] ], ''); }
|
|
$o++;
|
|
}//libDyn
|
|
}//for nbOptionsListe
|
|
}
|
|
} //for w
|
|
} //for b
|
|
} //if menu
|
|
} //for c
|
|
}
|
|
|
|
|
|
// ---------------------------------------------------
|
|
// Mise en session
|
|
// ---------------------------------------------------
|
|
if (!empty($order)) sort($order);
|
|
$_SESSION['typeDeListe']=$typeDeListe;
|
|
$_SESSION['listeOptions']=$listeOptions;
|
|
$_SESSION['order']=$order;
|
|
//titi2026 allegement debug
|
|
// if (isset($debug[15]) && $debug[15] == '1' ) $debugMsg .= monDebug(4, $_SESSION['order'],'') ;
|
|
?>
|