265 lines
12 KiB
PHP
Executable File
265 lines
12 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
|
|
// -----------------------------------------------------
|
|
// Etre admin
|
|
// -----------------------------------------------------
|
|
if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin']=='O' ) {
|
|
|
|
echo '<script type="text/javascript" src="./catalog/articles/articleCreate.js" ></script>';
|
|
|
|
// pour les insert on prends toutes les langues, et si afficher=non on forcera un insert
|
|
if (empty($codeLangueTab) or $refresh=='Oui') {require_once($includePath. "/req/03-init.langueListAll.php");}
|
|
|
|
// $idPrd='';
|
|
$continuer=1;
|
|
$FIN='N';
|
|
$affOngImg='1';
|
|
$theImage ="./Catalogue/_parDefaut/prdDefaut.png";
|
|
$trouveLG=false;
|
|
|
|
// Pour avoir le idPrd par defaut dans les champs - sera pas utilisé dans le insert
|
|
if (empty($idPrd)) {
|
|
include ("./catalog/req/reqCountProduits.php");
|
|
$idPrd=$nbp+1;
|
|
}
|
|
|
|
$nomPrd ="Nom de l'article " .$idPrd. " " .$_SESSION['lgCouranteLibelle'];
|
|
$descCourt ="Description courte de l'article " .$idPrd. " " .$_SESSION['lgCouranteLibelle'];
|
|
$descLong ="Description longue de l'article " .$idPrd. " " .$_SESSION['lgCouranteLibelle'];
|
|
|
|
// -----------------------------------------------------
|
|
// Post
|
|
// -----------------------------------------------------
|
|
if (isset($_POST['idPrd'])) {$idPrd=$_POST['idPrd'];}
|
|
if (isset($_POST['nomPrd'])) {$nomPrd=$_POST['nomPrd'];}
|
|
if (isset($_POST['descCourt'])) {$descCourt=$_POST['descCourt'];}
|
|
if (isset($_POST['descLong'])) {$descLong=$_POST['descLong'];}
|
|
if (isset($_POST['idFam'])) {$idFam=$_POST['idFam'];}
|
|
if (isset($_POST['idCat'])) {$idCat=$_POST['idCat'];}
|
|
|
|
if (isset($_GET['theImage'])) {$theImage=$_GET['theImage']; }
|
|
if (isset($_POST['theImage'])) {$theImage=$_POST['theImage']; }
|
|
|
|
if (isset($_GET['affOngImg'])) {$affOngImg=$_GET['affOngImg']; }
|
|
if (isset($_POST['affOngImg'])) { $affOngImg=$_POST['affOngImg']; }
|
|
|
|
if (isset($_GET['src'])) { $src=$_GET['src']; }
|
|
|
|
|
|
// -----------------------------------------------------
|
|
if ($codeOpe=="faireInsert") {
|
|
|
|
// -----------------------------------------------------
|
|
// Cas de la premier fois : on charge l'image
|
|
// -----------------------------------------------------
|
|
if ($_SESSION['insertInitFait']!=1) {
|
|
|
|
// -----------------------------------------------------
|
|
// Upload
|
|
// -----------------------------------------------------
|
|
if (!empty($_FILES["fileToUpload"]["tmp_name"])) {
|
|
$target_dir = "../Catalogue/_images_produits/petites/";
|
|
$targetExtension =['jpeg', 'jpg', 'png', 'svg', 'bmp'];
|
|
$targetSize ='5242880'; //5 Mo
|
|
$largeurMax = 0;
|
|
$hauteurMax = 0;
|
|
$largeurMin = 0;
|
|
$hauteurMin = 0;
|
|
include ($includePathAdmin. "/_fonctions/uploadGenerique.php");
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Requete insert
|
|
// -----------------------------------------------------
|
|
include ("./catalog/req/reqCountProduits.php");
|
|
$idPrd=$nbp+1;
|
|
include ("./catalog/req/reqInsertPrd.php");
|
|
include ("./catalog/req/reqInsertLibellePrd.php");
|
|
$_SESSION['insertInitFait']=1;
|
|
}
|
|
else {
|
|
// -----------------------------------------------------
|
|
// Changement de langue pour les autres
|
|
// -----------------------------------------------------
|
|
include ("./catalog/req/reqInsertLibellePrd.php");
|
|
}
|
|
// changement de langue
|
|
include ($includePathAdmin. "/drapeaux/changementLg.php");
|
|
}
|
|
else if (isset($debug[1]) && $debug[1] == '1' ) { $debugMsg .= monDebug (1,['codeOpe vide ou different de faireInsert' => '' ], 'art.createProduit.modale.php'); }
|
|
|
|
// -----------------------------------------------------
|
|
// init insert false par defaut
|
|
// -----------------------------------------------------
|
|
if ($trouveLG==false) {
|
|
$_SESSION['insertInitFait']=0;
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Debug
|
|
// -----------------------------------------------------
|
|
if (isset($debug[1]) && $debug[1] == '1' ) {
|
|
$debugMsg .= monDebug (1,[
|
|
'theImage' => $theImage,
|
|
'idPrd' => $idPrd,
|
|
'nomPrd' => $nomPrd,
|
|
'descCourt' => $descCourt,
|
|
'descLong' => $descLong,
|
|
'SESSION[insertInitFait]' => $_SESSION['insertInitFait']
|
|
], 'art.createProduit.modale.php');
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Form
|
|
// -----------------------------------------------------
|
|
echo '<div id="zoneFormModales" >';
|
|
echo '<form name="createProduitF" id="createProduit" method="POST" enctype="multipart/form-data" style=" grid-column:2; grid-row: 4 / span 3;" >';
|
|
|
|
// -----------------------------------------------------
|
|
// Champs cachés
|
|
// -----------------------------------------------------
|
|
echo '<input type="hidden" value="' .$idPrd. '" name="idPrd" >';
|
|
echo '<input type="hidden" value="' .$codeOpe. '" name="codeOpe" id="codeOpe" >';
|
|
|
|
// -----------------------------------------------------
|
|
// Langue drapeaux
|
|
// -----------------------------------------------------
|
|
$niveau=0;
|
|
include ("./adminInclude/drapeaux/drapeauxAff.php");
|
|
|
|
// -----------------------------------------------------
|
|
// Champs du formulaire
|
|
// -----------------------------------------------------
|
|
if ($trouveLG==false && empty($codeOpe) ) {
|
|
|
|
// -----------------------------------------------------
|
|
// Image
|
|
// -----------------------------------------------------
|
|
echo '<span class="libChampsWebmaster" style="width:98%;" >';
|
|
echo '<br><input style="display:none;" type="file" name="fileToUpload" id="fileToUpload" >';
|
|
if (!empty($theImage) && file_exists ( "." .$theImage) ) {echo '<br> <img src=".' .$theImage. '" />';}
|
|
echo '</span>';
|
|
|
|
// -----------------------------------------------------
|
|
// Chemin
|
|
// -----------------------------------------------------
|
|
echo '<span class="libChampsWebmaster" style="width:98%;" >';
|
|
$title="L'image article";
|
|
echo '<span title="' .$title. '">Image article : </span>';
|
|
echo '<input style="width:95%;" type="text" value="' .$theImage. '" placeholder="Image pour l\'article ' .$idPrd. '" name="theImage" />';
|
|
echo '</span>';
|
|
|
|
// -----------------------------------------------------
|
|
// Btn parcourir
|
|
// -----------------------------------------------------
|
|
echo '<span class="libChampsWebmaster" style="width:98%;" >';
|
|
echo '<br><label for="fileToUpload" >';
|
|
echo '<span class="boutonsWebmaster" title="Cliquez ici pour parcourir les dossiers de votre ordinateur. Formats : png, jpg, bmp, gif autorisés. " >';
|
|
echo '<i class="fad fa-download"></i> ';
|
|
echo 'Parcourir... ';
|
|
echo '</span>';
|
|
echo '</label>';
|
|
echo '</span>';
|
|
|
|
// -----------------------------------------------------
|
|
// Catégories
|
|
// -----------------------------------------------------
|
|
echo '<span class="libChampsWebmaster" >';
|
|
include ("./catalog/req/reqAllCat.php");
|
|
// include ("./catalog/req/reqAllCatLib.php");
|
|
$title="catégorie";
|
|
echo '<span title="' .$title. '">Catégorie : </span>';
|
|
echo '<select class="selectWbm" name="idFam" id="idFam" style="width:250px;" onChange="upCategorieListeFromFamille();" >';
|
|
for($j=0; $j<count($tabIdFam) ; $j++) {
|
|
if ($tabIdFam[$j]==$idFam)
|
|
{echo '<option value=' .$tabIdFam[$j]. ' selected>' .$tabNomFam[$j]. '</option>';}
|
|
else
|
|
{echo '<option value=' .$tabIdFam[$j]. ' >' .$tabNomFam[$j]. '</option>';}
|
|
}
|
|
echo '</select>';
|
|
echo '</span>';
|
|
|
|
// -----------------------------------------------------
|
|
// Catégories
|
|
// -----------------------------------------------------
|
|
if ($_SESSION['afficherSousCat']==1) {
|
|
include ("./catalog/req/reqSelectLibellesSousCatFrom.php");
|
|
echo '<span class="libChampsWebmaster" >';
|
|
$title="Sous-catégorie";
|
|
echo '<span title="' .$title. '">Sous-catégorie : </span>';
|
|
echo '<select class="selectWbm" name="idCat" id="idCat" style="width:250px;" >';
|
|
for($j=0; $j<count($tabIdSousCat) ; $j++) {
|
|
if ($tabIdSousCat[$j]==$idCat)
|
|
{echo '<option value=' .$tabIdSousCat[$j]. ' selected>' .$tabLibSousCat[$j]. '</option>';}
|
|
else
|
|
{echo '<option value=' .$tabIdSousCat[$j]. ' >' .$tabLibSousCat[$j]. '</option>';}
|
|
}
|
|
echo '</select>';
|
|
echo '</span>';
|
|
}
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Champs propre a chaque les langues => traduction libelle
|
|
// -----------------------------------------------------
|
|
if ($FIN!=='OUI') {
|
|
echo '<span class="libChampsWebmaster">Nom ' .$_SESSION['lgCouranteLibelle']. ' : ';
|
|
$nomPrd=stripslashes($nomPrd);
|
|
$nomPrd= gTranslate($nomPrd, strtolower( substr ($_SESSION['lgCouranteCode'], 0, -1) ) ) ;
|
|
echo '<input class="inputWebmaster" type="text" style="width:300px;" value="' .$nomPrd.'" placeholder="Produit ' .$idPrd. ' de la langue ' .$_SESSION['lgCouranteLibelle']. '" name="nomPrd" />';
|
|
echo '</span>';
|
|
|
|
echo '<span class="libChampsWebmaster" >';
|
|
$title="Description rapide de l'article : apparaît dans la liste des articles";
|
|
echo '<span title="' .$title. '">Description courte ' .$_SESSION['lgCouranteLibelle']. ' : </span>';
|
|
$descCourt=stripslashes($descCourt);
|
|
$descCourt= gTranslate($descCourt, strtolower( substr ($_SESSION['lgCouranteCode'], 0, -1) ) ) ;
|
|
echo '<input class="inputWebmaster" style="width:270px;" type="text" value="' .$descCourt. '" placeholder="Description courte pour l\'article ' .$idPrd. '" name="descCourt" />';
|
|
echo '</span>';
|
|
|
|
echo '<span class="libChampsWebmaster" >';
|
|
$title="Description longue : apparaît dans le détail des articles";
|
|
echo '<span title="' .$title. '">Description longue ' .$_SESSION['lgCouranteLibelle']. ' : </span>';
|
|
$descLong=stripslashes($descLong);
|
|
$descLong= gTranslate($descLong, strtolower( substr ($_SESSION['lgCouranteCode'], 0, -1) ) );
|
|
echo '<textarea cols="52" rows="3" class="textAreaWbm" type="text" name="descLong" placeholder="' .$descLong. '" >' .$descLong. '</textarea>';
|
|
echo '</span>';
|
|
}
|
|
echo '<div id="zoneValidateModales" >';
|
|
if ($trouveLG==false && !empty($codeOpe)) {
|
|
|
|
// -----------------------------------------------------
|
|
// On a fini : toutes langues faites : retour
|
|
// -----------------------------------------------------
|
|
echo '<span type="button" class="boutonsWebmaster" onClick="window.self.location=\'./frmAdmin.php?affAdmin=8&ongletCatalog=4&lg=FRA&idPrd=' .$idPrd. '\';" >';
|
|
echo '<i class="fad fa-chevron-circle-left"></i> ';
|
|
echo 'Retour';
|
|
echo '</span>';
|
|
|
|
// -----------------------------------------------------
|
|
// On a fini : ajouter un autre produit ?
|
|
// -----------------------------------------------------
|
|
echo ' <span title="Cliquez ici pour ajouter un article" class="boutonsWebmaster" onClick="window.self.location=\'./frmModale.php?affModale=84-1\';" >';
|
|
echo '<i class="fad fa-plus"></i>  ';
|
|
echo 'Ajouter un autre article';
|
|
echo '</span></p>';
|
|
}
|
|
else {
|
|
// -----------------------------------------------------
|
|
// Langues a faire : valider
|
|
// -----------------------------------------------------
|
|
echo '<span class="boutonsWebmaster tooltip-top" data-tooltip="Cliquez sur ce bouton pour passer à l\'étape suivante" onClick="upCreateArt();" >';
|
|
echo '<i class="fad fa-check-circle"></i> ';
|
|
echo 'Valider pour ' .$_SESSION['lgCouranteLibelle'] .'<br><br><br>';
|
|
echo '</span>';
|
|
}
|
|
echo '</div>';
|
|
echo '</form>';
|
|
echo '</div>'; // zoneFormModales
|
|
}
|
|
else {
|
|
$confPath="../_conf";
|
|
include ("./adminInclude/redirectionAdmin.php");
|
|
}
|
|
?>
|