-
Notifications
You must be signed in to change notification settings - Fork 0
/
sousitemtagimgaff.php
117 lines (105 loc) · 3.16 KB
/
sousitemtagimgaff.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
require_once("./stpiadmin/includes/includes.php");
require_once("./stpiadmin/includes/classes/item/clsitem.php");
$objBdd = clsbdd::singleton();
$objItem = new clsitem();
$objSousItem =& $objItem->stpi_getObjSousItem();
$objAttribut =& $objItem->stpi_getObjSousItem()->stpi_getObjAttribut();
if (!$objItem->stpi_chkNbID($_POST["nbItemID"]))
{
exit;
}
$i = 0;
$arrAttributID = array();
while(true)
{
if (!isset($_POST["nbAttributID" . $i]))
{
break;
}
if (!$objAttribut->stpi_chkNbID($_POST["nbAttributID" . $i]))
{
exit;
}
$arrAttributID[] = $_POST["nbAttributID" . $i];
$i++;
}
$ok = false;
if ($arrAttributID != array())
{
$SQL = "SELECT stpi_item_SousItem.nbSousItemID, COUNT(*) AS nbMatch";
$SQL .= " FROM stpi_item_SousItem, stpi_item_SousItem_Attribut";
$SQL .= " WHERE stpi_item_SousItem.nbItemID = '" . $objBdd->stpi_trsInputToBdd($_POST["nbItemID"]) . "'";
$SQL .= " AND stpi_item_SousItem.nbSousItemID = stpi_item_SousItem_Attribut.nbSousItemID";
$SQL .= " AND stpi_item_SousItem.nbQte > 0";
$SQL .= " AND (";
foreach ($arrAttributID as $k => $nbAttributID)
{
if ($k != 0)
{
$SQL .= " OR stpi_item_SousItem_Attribut.nbAttributID = '" . $objBdd->stpi_trsInputToBdd($nbAttributID) . "'";
}
else
{
$SQL .= " stpi_item_SousItem_Attribut.nbAttributID = '" . $objBdd->stpi_trsInputToBdd($nbAttributID) . "'";
}
}
$SQL .= " )";
$SQL .= " GROUP BY stpi_item_SousItem.nbSousItemID";
$SQL .= " HAVING nbMatch = '" . $objBdd->stpi_trsInputToBdd(count($arrAttributID)) . "'";
$ok = true;
if ($result = $objBdd->stpi_select($SQL))
{
if ($row = mysql_fetch_assoc($result))
{
if ($objSousItem->stpi_setNbID($row["nbSousItemID"]))
{
if ($objItem->stpi_setNbID($objSousItem->stpi_getNbItemID()))
{
$objItem->stpi_setObjItemLgFromBdd();
if ($arrAttributID = $objSousItem->stpi_selNbAttributID())
if (!$arrNbImageID = $objSousItem->stpi_selNbImageID())
{
$arrNbImageID = array();
}
if (isset($arrNbImageID[1]))
{
print("<img style=\"cursor: pointer;\" onclick=\"window.open ('sousitemimgaff.php?l=" . LG . "&nbImageID=" . $objBdd->stpi_trsBddToHTML($arrNbImageID[2]) . "', '', config='height=550, width=550, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')\" alt=\"" . $objBdd->stpi_trsBddToHTML($objItem->stpi_getObjItemLg()->stpi_getStrName()) . "\" src=\"./sousitemimgaff.php?nbImageID=" . $objBdd->stpi_trsBddToHTML($arrNbImageID[1]) . "\" />\n");
}
else
{
$ok = false;
}
}
else
{
$ok = false;
}
}
else
{
$ok = false;
}
}
else
{
$ok = false;
}
}
else
{
$ok = false;
}
}
if (!$ok)
{
if ($objItem->stpi_setNbID($_POST["nbItemID"]))
{
$objItem->stpi_setObjItemLgFromBdd();
if ($objItem->stpi_getNbImageID() != 0)
{
print("<img alt=\"" . $objBdd->stpi_trsBddToHTML($objItem->stpi_getObjItemLg()->stpi_getStrName()) . "\" src=\"./itemimgaff.php?nbImageID=" . $objBdd->stpi_trsBddToHTML($objItem->stpi_getNbImageID()) . "\" />\n");
}
}
}
?>