function getProperty($p_id, $lang_id = 1, $isArray = false) { global $db; static $attrs = array(), $oid = array(); $property = array(); $p = $db->Execute('SELECT options_id, options_values_id FROM ' . TABLE_PRODUCTS_ATTRIBUTES . ' WHERE products_id=' . $p_id); while (!$p->EOF) { $o = getOption($p->fields['options_id'], $lang_id); if (!isset($oid[$o['name']])) { $oid[$o['name']] = $o['type']; } $property[$o['name']][] = getOptionValue($p->fields['options_values_id'], $lang_id); $p->MoveNext(); } if ($isArray) { return $property; } $py = ''; foreach ($property as $k => $v) { $py .= "{$k}-{$oid[$k]}:" . implode('|', $v) . ';'; } return $py; }
} else { $ansStr .= "<option value='" . update($cat, $cROOT, "root", $i) . "_" . update($cat, $cCATEGORY, "category", $i) . "_" . update($cat, $cGENDER, "gender", $i) . "_" . update($cat, $cFORM, "form", $i) . "_" . update($cat, $cPERSON, "person", $i) . "_" . update($cat, $cTENSE, "tense", $i) . "_" . update($cat, $cREFERENCE, "reference", $i) . "_" . $lang . "_" . $scr . "_" . $i . "'>" . $i . "</option>"; } } $ansStr .= "</select>"; return $ansStr; } $lang = $_GET['lang']; $scr = $_GET['scr']; $listROOT = getOptionValueRestrict(1, $lang, $scr); $listCATEGORY = getOptionValue(2); $listGENDER = getOptionValue(3); $listFORM = getOptionValue(4); $listPERSON = getOptionValue(6); $listTENSE = getOptionValue(9); $listREFERENCE = getOptionValue(5); $cROOT; if ($_GET['root'] == "%") { $cROOT = $listROOT[rand(0, sizeof($listROOT) - 1)]; } else { $cROOT = $_GET['root']; } $cCATEGORY; if ($_GET['category'] == "%") { $cCATEGORY = $listCATEGORY[rand(0, sizeof($listCATEGORY) - 1)]; } else { $cCATEGORY = $_GET['category']; } $cGENDER; if ($_GET['gender'] == "%") { $cGENDER = $listGENDER[rand(0, sizeof($listGENDER) - 1)];