18 require
'../main.inc.php';
19 require DOL_DOCUMENT_ROOT.
'/variants/class/ProductAttribute.class.php';
21 $action =
GETPOST(
'action',
'aZ09');
30 if ($action ==
'up') {
31 $object->fetch($rowid);
34 header(
'Location: '.
$_SERVER[
'PHP_SELF']);
36 } elseif ($action ==
'down') {
37 $object->fetch($rowid);
40 header(
'Location: '.
$_SERVER[
'PHP_SELF']);
50 $langs->load(
'products');
52 $title = $langs->trans($langs->trans(
'ProductAttributes'));
54 $variants = $object->fetchAll();
59 if ($user->rights->produit->creer)
61 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'Create'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/variants/create.php');
66 $forcereloadpage = empty($conf->global->MAIN_FORCE_RELOAD_PAGE) ? 0 : 1;
69 $(document).ready(
function(){
70 $(
".imgupforline, .imgdownforline").hide();
71 $(
".lineupdown").removeAttr(
'href');
73 .css(
"background-image",
'url(<?php echo DOL_URL_ROOT.'/theme/
'.$conf->theme.'/img/grip.png
'; ?>)')
74 .css(
"background-repeat",
"no-repeat")
75 .css(
"background-position",
"center center")
78 $(
this).addClass(
'showDragHandle');
80 $(
this).removeClass(
'showDragHandle');
84 $(
"#tablelines").tableDnD({
85 onDrop:
function(table, row) {
87 var reloadpage =
"<?php echo $forcereloadpage; ?>";
88 var roworder = cleanSerialize(decodeURI($(
"#tablelines").tableDnDSerialize()));
89 $.post(
"<?php echo DOL_URL_ROOT; ?>/variants/ajax/orderAttribute.php",
94 if (reloadpage == 1) {
95 location.href =
'<?php echo dol_escape_htmltag($_SERVER['PHP_SELF
']).'?
'.dol_escape_htmltag($_SERVER['QUERY_STRING
']); ?>';
97 $(
"#tablelines .drag").each(
98 function( intIndex ) {
99 $(
this).removeClass(
"pair impair");
100 if (intIndex % 2 == 0) $(
this).addClass(
'impair');
101 if (intIndex % 2 == 1) $(
this).addClass(
'pair');
106 onDragClass:
"dragClass",
107 dragHandle:
"td.tdlineupdown"
112 <table
class=
"liste nobottom" id=
"tablelines">
113 <tr
class=
"liste_titre nodrag nodrop">
114 <th
class=
"liste_titre"><?php
print $langs->trans(
'Ref') ?></th>
115 <th
class=
"liste_titre"><?php
print $langs->trans(
'Label') ?></th>
116 <th
class=
"liste_titre right"><?php
print $langs->trans(
'NbOfDifferentValues') ?></th>
117 <th
class=
"liste_titre right"><?php
print $langs->trans(
'NbProducts') ?></th>
118 <th
class=
"liste_titre" colspan=
"2"></th>
121 foreach ($variants as $key => $attribute) {
122 print '<tr id="row-'.$attribute->id.
'" class="drag drop oddeven">';
124 print '<td><a href="card.php?id='.$attribute->id.
'">'.
dol_htmlentities($attribute->label).
'</a></td>';
125 print '<td class="right">'.$attribute->countChildValues().
'</td>';
126 print '<td class="right">'.$attribute->countChildProducts().
'</td>';
127 print '<td class="right">';
128 print '<a class="editfielda marginrightonly paddingleftonly" href="card.php?id='.$attribute->id.
'&action=edit">'.
img_edit().
'</a>';
129 print '<a class="marginrightonly paddingleftonlyhref="card.php?id='.$attribute->id.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a>';
131 print '<td class="center linecolmove tdlineupdown">';
133 print '<a class="lineupdown" href="'.$_SERVER[
'PHP_SELF'].
'?action=up&rowid='.$attribute->id.
'">'.
img_up(
'default', 0,
'imgupforline').
'</a>';
135 if ($key < count($variants) - 1) {
136 print '<a class="lineupdown" href="'.$_SERVER[
'PHP_SELF'].
'?action=down&rowid='.$attribute->id.
'">'.
img_down(
'default', 0,
'imgdownforline').
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_htmlentities($string, $flags=null, $encoding= 'UTF-8', $double_encode=false)
Replace htmlentities functions.
Class ProductAttribute Used to represent a product attribute.
img_down($titlealt= 'default', $selected=0, $moreclass= '')
Show down arrow logo.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_up($titlealt= 'default', $selected=0, $moreclass= '')
Show top arrow logo.
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
img_delete($titlealt= 'default', $other= 'class="pictodelete"', $morecss= '')
Show delete logo.