I have created the following PHP Code for my Menu Item - Modify:
if($menuItem->getLinkType() == 'Internal')
{
global $tables_data;
$table=$menuItem->getTable();
include_once(getabspath("include/".GetTableURL($table)."_settings.php"));
$table=GetOriginalTableName($table);
if (($table)==("container"))
{
$rs=CustomQuery("select count() as c1 from container where status='Active'" );
$data = db_fetch_array($rs);
$menuItem->setTitle($menuItem->getTitle() . " (". $data["c1"] . ")");
}
else
{
$rs=CustomQuery("select count() as c1 from " . AddTableWrappers($table));
$data = db_fetch_array($rs);
$menuItem->setTitle($menuItem->getTitle() . " (". $data["c1"] . ")");
}
}
return true;
The result shows:
Main Menu
Login (4)
Company (107)
Chassis (11)
Steamship (25)
Container (44)
Active Containers (44)
Closed Containers (44)
Container Report (44)
It works flawlessly, but i have a problem, i want to show the total of some custom views i created, these are "Active Containers" and "Closed Containers" which are custom views of my table "container". If any container has it (status = active) has to be count in the "Active Containers View" and if is (status = closed) will be count in the "Closed Containers View". The problem is that i cant call my custom view so i can run my conditional sentence IF. For Example:
if (($table)==("Active Containers"))
{
$rs=CustomQuery("select count() as c1 from . AddTableWrappers($table) );
$data = db_fetch_array($rs);
$menuItem->setTitle($menuItem->getTitle() . " (". $data["c1"] . ")");
}
elseif (($table)==("Closed Containers"))
{
$rs=CustomQuery("select count() as c1 from . AddTableWrappers($table) );
$data = db_fetch_array($rs);
$menuItem->setTitle($menuItem->getTitle() . " (". $data["c1"] . ")");
}
I need help, thanks!!!