I have a table Icons which has three fields, Category, Value and icon
there are 12 categories, water, light, edible etc...
I then have a filter on another table that offers the user to filter the table on any of these category-values.
what I want to do is to use the category field on the icon table to limit the choice of options with the filter to those within a category.
The code below works, but has to use the value field on the icon table for the test instead of the category field. This means that I have to have the category text within the value field. It works but not nice, also, as this is going to be in three languages it's really not a good way to do it. So, I need to get hold of the value in the category field during the buildoptions function in COMBO.PHP. I know this should be easy, but its driving me a bit crazy.
any hint would be very welcome. Thanks
Also, is this the correct place to be doing this or would there be a more efficient alternative method?
function buildOptions()
{
$html = '';
$poscat = "";
if(strpos(JText::_($this->nullLabel),"Light")) {
$poscat = 1;
}
elseif (strpos(JText::_($this->nullLabel),"Water")) {
$poscat = 2;
}
elseif (strpos(JText::_($this->nullLabel),"Structure")) {
$poscat = 3;
}
elseif (strpos(JText::_($this->nullLabel),"Type")) {
$poscat = 4;
}
elseif (strpos(JText::_($this->nullLabel),"Bloom")) {
$poscat = 5;
}
elseif (strpos(JText::_($this->nullLabel),"Fruit")) {
$poscat = 6;
}
elseif (strpos(JText::_($this->nullLabel),"Fragrant")) {
$poscat = 7;
}
elseif (strpos(JText::_($this->nullLabel),"Spikey")) {
$poscat = 8;
}
elseif (strpos(JText::_($this->nullLabel),"evergreen")) {
$poscat = 9;
}
elseif (strpos(JText::_($this->nullLabel),"Propagation")) {
$poscat = 10;
}
elseif (strpos(JText::_($this->nullLabel),"eatable")) {
$poscat = 11;
}
elseif (strpos(JText::_($this->nullLabel),"use")) {
$poscat = 12;
}
if ($this->list)
foreach($this->list as $item)
{
if($poscat == "") {
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
elseif($poscat==1)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"licht");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==2)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"wasser");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==3)
{
echo $this->dataValue;
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"planzenstruktur");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==4)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"typ");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==5)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"blutezeit");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==6)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"fruchtzeit");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==7)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"duftplanze");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==8)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"dornen");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==9)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"blattabwurf");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==10)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"vermehrung");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==11)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"essbar");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
elseif($poscat==12)
{
$pos = strpos($this->buildOption($item, $this->listKey, $this->labelKey),"sonstige");
if($pos === false) {
}
else
{
$html .= $this->buildOption($item, $this->listKey, $this->labelKey);
}
}
}
return $html;