* limitations under the License. */ $module = App::Get()->loadModule(); require_once $module->modulePath . "/classes/CasBrowser.class.php"; require_once $module->modulePath . "/scripts/widgets/FilterWidget.php"; require_once $module->modulePath . "/scripts/widgets/ProductPageWidget.php"; // Get a CAS-Browser XML/RPC client $browser = new CasBrowser(); $client = $browser->getClient(); // Get a Product Type object $productType = $client->getProductTypeById(App::Get()->request->segments[0]); $ptID = $productType->getId(); $ptName = $productType->getName(); $typeInfo = $productType->toAssocArray(); // Determine the visibility level based on the current user $ptVisibilityLevel = $browser->getProductTypeVisibilityLevel($ptID); // Redirect the user if they are not authorized if ($ptVisibilityLevel == CasBrowser::VIS_NONE) { App::Get()->redirect(SITE_ROOT . '/errors/403'); } // Store any filter parameters passed in via URL $filterParams = array(); $segments = App::Get()->request->segments; for ($index = 1; isset($segments[$index]) && $segments[$index] != ""; $index = $index + 2) { array_push($filterParams, array($segments[$index], $segments[$index + 1])); } if (count($filterParams) > 0) { $filterButtonValue = "Hide Filters"; } else { $filterButtonValue = "Show Filters"; }
$module = App::Get()->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.<br>", 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"); ?>