thaGH05T
New Member
Hello All,
Basic Setup:
I have created a list and a from that list (list 1) and copied that to a new list (list 2) and removed most of the child elements of list 2 because it is used for a Google map visualization and the load time seems to be a bit faster this way. In list 2 i have an element called 'status' who's type is calc. I have PHP code that will return an image tag that is used by the Google map visualization in that status field. the child element is still linked to the parent and has the exact same code.
Problem:
When list 1 is displayed the PHP code for the status field work without issues, but when I display the Google map visualization the status field does not display the correct image tag. When I debugged the code and did a var dump of each variable I was surprised to find that they seem to be unset. The variables that I am using are defined from placeholders.
Calc Field (status):
Basically I am getting the ELSE value when the visualization loads. The visualization points to list 2 and uses the status filed as the marker image. Again, the same code from above works without a hitch in the list 1 list. I should also mention that I do not have this problem with my dev site, which is actually working. The dev site was backed up and replicated to the prod site and the prod site is the one having the issues at this point. I should also mention that this same code worked before without issues on the prod site before the migration.
Things I Have Done:
What I K now:
The placeholders are returning nothing at all when the child element from list 2 is chosen as the marker image. The placeholders return their values when the visualization is pointed to list 1's calc element and displays the correct markers.
What I Need Help With:
Basic Setup:
I have created a list and a from that list (list 1) and copied that to a new list (list 2) and removed most of the child elements of list 2 because it is used for a Google map visualization and the load time seems to be a bit faster this way. In list 2 i have an element called 'status' who's type is calc. I have PHP code that will return an image tag that is used by the Google map visualization in that status field. the child element is still linked to the parent and has the exact same code.
Problem:
When list 1 is displayed the PHP code for the status field work without issues, but when I display the Google map visualization the status field does not display the correct image tag. When I debugged the code and did a var dump of each variable I was surprised to find that they seem to be unset. The variables that I am using are defined from placeholders.
Calc Field (status):
Code:
$nodeType = '{Solarwinds___NodeType}';
$statusLED = '{Solarwinds___StatusLED}';
$siteCode = "{sp_NA___code}";
$db=JFactory::getDbo();
$query1=$db->getQuery(true);
$query1->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
->from('Solarwinds as s')
->where('site_Code = "' . $siteCode . '"')
->where('nodeType = "Internet"');
$db->setQuery($query1);
$array = $db->loadAssocList();
$results = array_shift($array);
$inet = $results['statusLED'];
//return $inet;
$query2=$db->getQuery(true);
$query2->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
->from('Solarwinds as s')
->where('site_Code = "' . $siteCode . '"')
->where('nodeType = "MPLS"');
$db->setQuery($query2);
$array = $db->loadAssocList();
$results = array_shift($array);
$mpls = $results['statusLED'];
//return $mpls;
$query3=$db->getQuery(true);
$query3->select('s.NodeType as nodeType, s.StatusLED as statusLED, s.Site_Code as site_Code')
->from('Solarwinds as s')
->where('site_Code = "' . $siteCode . '"')
->where('nodeType = "Routers"');
$db->setQuery($query3);
$array = $db->loadAssocList();
$results = array_shift($array);
$routers = $results['statusLED'];
//return $routers;
if ($mpls AND $inet) {
if ($mpls === "Up.gif" AND $inet === "Up.gif") {
$status = '<img src="/images/icons/up.gif" alt="" />';
} elseif ($mpls === "Down.gif" AND $inet === "Down.gif") {
$status = '<img src="/images/icons/bdown.gif" alt="" />';
} else {
$status = '<img src="/images/icons/fwarn.gif" alt="" />';
}
} elseif (!$mpls AND $inet) {
if ($inet === "Up.gif") {
$status = '<img src="/images/icons/up.gif" alt="" />';
} elseif ($inet === "Down.gif") {
$status = '<img src="/images/icons/bdown.gif" alt="" />';
} else {
$status = '<img src="/images/icons/fwarn.gif" alt="" />';
}
} elseif (!$inet AND $mpls) {
if ($mpls === "Up.gif") {
$status = '<img src="/images/icons/up.gif" alt="" />';
} elseif ($mpls === "Down.gif") {
$status = '<img src="/images/icons/bdown.gif" alt="" />';
} else {
$status = '<img src="/images/icons/fwarn.gif" alt="" />';
}
} elseif ($routers) {
if ($routers === "Up.gif") {
$status = '<img src="/images/icons/up.gif" alt="" />';
} elseif ($routers === "Down.gif") {
$status = '<img src="/images/icons/bdown.gif" alt="" />';
} else {
$status = '<img src="/images/icons/not.gif" alt="" />';
}
} else {
$status = '<img src="/images/icons/not.gif" alt="" />';
}
/*Debugging
var_dump($nodeType);
print "<-- Node Type ";
var_dump($statusLED);
print "<-- Status LED ";
var_dump($siteCode);
print "<-- Site Code ";
*/
return $status;
Basically I am getting the ELSE value when the visualization loads. The visualization points to list 2 and uses the status filed as the marker image. Again, the same code from above works without a hitch in the list 1 list. I should also mention that I do not have this problem with my dev site, which is actually working. The dev site was backed up and replicated to the prod site and the prod site is the one having the issues at this point. I should also mention that this same code worked before without issues on the prod site before the migration.
Things I Have Done:
- I have migrated the site 3 times just to be sure.
- I have unlinked the child elements from the parent elements.
- I have created a new Google Map visualization to test with.
- I have reinstalled the calc field plugin.
What I K now:
The placeholders are returning nothing at all when the child element from list 2 is chosen as the marker image. The placeholders return their values when the visualization is pointed to list 1's calc element and displays the correct markers.
What I Need Help With:
- Understanding why this is happening.
- Getting the child calc element to actually see the placeholders.
- Optimizing map load times. <--- Not relevant really.
- Develop better debugging skills with Fabrik.