début restructuration du code des catégories
This commit is contained in:
parent
d6454f3a07
commit
dfded28802
@ -46,7 +46,7 @@ $html = new Form($db);
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action création du produit
|
* Action création de la catégorie
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
@ -74,12 +74,16 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="submit" value="'.$langs->trans("modify").'" name="ok" />';
|
print '<input type="submit" value="'.$langs->trans("modify").'" name="ok" />';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
print $html->select_all_categories($nbcats);
|
||||||
|
print '<tr><td colspan="2">';
|
||||||
|
print '<input type="submit" value="'.$langs->trans("CreateThisCat").'" name="creation"/>';
|
||||||
|
print '</td></tr></form>';
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage page accueil
|
* Action confirmation de création de la catégorie
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_GET["action"] == 'confirmed' && $$user->rights->produit->creer)
|
if ($_GET["action"] == 'confirmed' && $$user->rights->produit->creer)
|
||||||
@ -125,9 +129,7 @@ if ($_GET["action"] == 'confirmed' && $$user->rights->produit->creer)
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
/*
|
/*
|
||||||
<td>
|
|
||||||
<input type="submit" value="<?php print $langs->trans ("modify"); ?>" name="ok" id="ok" />
|
|
||||||
</td>
|
|
||||||
<?php
|
<?php
|
||||||
$all_categories = $categorie->get_all_categories();//on récupère toutes les catégories et leurs attributs
|
$all_categories = $categorie->get_all_categories();//on récupère toutes les catégories et leurs attributs
|
||||||
|
|
||||||
|
|||||||
@ -915,6 +915,7 @@ class Form
|
|||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante de création en sous catégories possible
|
* \brief Retourne la liste déroulante de création en sous catégories possible
|
||||||
* \param selected nombre de sous catégorie pré-sélectionnée
|
* \param selected nombre de sous catégorie pré-sélectionnée
|
||||||
|
* \param htmlname nom du select
|
||||||
*/
|
*/
|
||||||
function select_nombre_sous_categorie($selected='',$htmlname)
|
function select_nombre_sous_categorie($selected='',$htmlname)
|
||||||
{
|
{
|
||||||
@ -943,6 +944,37 @@ class Form
|
|||||||
print '</select>';
|
print '</select>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Retourne la ou les listes déroulante des catégories en fonction du nombre choisi
|
||||||
|
* \param selected nombre de catégorie à créer
|
||||||
|
*/
|
||||||
|
function select_all_categories($nbcats='')
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("categorie");
|
||||||
|
|
||||||
|
$all_categories = $categorie->get_all_categories();//on récupère toutes les catégories et leurs attributs
|
||||||
|
|
||||||
|
for ($i = 0; $i < $nbcats ; $i++)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans ("Categorie").' '.($i+1).'</td><td><select name="catsMeres['.$i.']">'; //creation des categories meres
|
||||||
|
|
||||||
|
print '<option value="-1" id="choix">'.$langs->trans("Choose").'</option>\n';
|
||||||
|
|
||||||
|
foreach ($all_categories as $id => $cat)
|
||||||
|
{ //ajout des categories dans la liste
|
||||||
|
print '<option value="'.$id.'"';
|
||||||
|
|
||||||
|
if ($_REQUEST['catsMeres'][$i] == $id)
|
||||||
|
print ' selected="true"';
|
||||||
|
print '>'.$cat->label.'</option>\n';
|
||||||
|
}
|
||||||
|
print '</select></td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante des civilite actives
|
* \brief Retourne la liste déroulante des civilite actives
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user