loadModule();
require_once( $module->modulePath . "/classes/CasBrowser.class.php");
require_once( $module->modulePath . "/scripts/widgets/ProductTypeListWidget.php");
// Get a CAS-Browser XML/RPC client
$browser = new CasBrowser();
$client = $browser->getClient();
$isAlive = $client->isAlive();
if ( !$isAlive ) {
App::Get()->SetMessage("Filemgr at ". $client->serverURL. " is down. Please start it.
",CAS_MSG_ERROR);
} else{
// Get a list of the product types managed by this server
$response = $client->getProductTypes();
$productTypes = array();
foreach ($response as $pt) {
$ptArray = $pt->toAssocArray();
$ptVisibility = $browser->getProductTypeVisibilityLevel($pt->getId());
if ($ptVisibility == CasBrowser::VIS_NONE) { continue; }
$merged = array(
"name" => array(
$ptArray[App::Get()->settings['browser_pt_name_key']],
$client->getNumProducts($pt)),
"description" => array($ptArray[App::Get()->settings['browser_pt_desc_key']]),
"id" => array($ptArray[App::Get()->settings['browser_pt_id_key']]));
$merged += $ptArray['typeMetadata'];
$productTypes[$ptArray[App::Get()->settings['browser_pt_id_key']]] = $merged;
}
$productTypeListWidget = new ProductTypeListWidget(array("productTypes" => $productTypes));
$productTypeListWidget->setUrlBase($module->moduleRoot);
}
// Prepare BreadcrumbWigdet
$bcw = new BreadcrumbsWidget();
$bcw->add('Home',SITE_ROOT . '/');
$bcw->add("Browse By Type");
?>