$productId = App::Get()->request->segments[0]; $product = $client->getProductById($productId); $productName = $product->getName(); $productTypeName = $product->getType()->getName(); $productTypeId = $product->getType()->getId(); $productMetadata = $client->getMetadata($product); // Get metadata for product and productType as associative arrays $productTypeInfo = $product->getType()->toAssocArray(); $productInfo = $productMetadata->toAssocArray(); $productVisibilityLevel = $browser->getProductVisibilityLevel($productId); // Redirect the user if they are not authorized if ($productVisibilityLevel == CasBrowser::VIS_NONE) { App::Get()->redirect(SITE_ROOT . '/errors/403'); } // Create and load a MetadataDisplay widget wit the visible metadata $metadataWidget = new MetadataDisplayWidget(array()); $metadataWidget->loadMetadata($browser->getVisibleMetadataForProduct($productId)); // Record the product page to send the user back to, if provided $returnPage = isset(App::Get()->request->segments[1]) ? App::Get()->request->segments[1] : 1; // Create a ProductDownloadWidget $productDownloadWidget = new ProductDownloadWidget(array("dataDeliveryUrl" => App::Get()->settings['browser_datadeliv_url'])); $productDownloadWidget->setClient($client); $productDownloadWidget->load($product); // Add the cas-browser styles App::Get()->response->addStylesheet($module->moduleStatic . '/css/cas-browser.css'); // Prepare BreadcrumbWigdet $bcw = new BreadcrumbsWidget(); $bcw->add('Home', SITE_ROOT . '/'); $bcw->add('Browse By Type', $module->moduleRoot . '/'); $bcw->add($productTypeName, $module->moduleRoot . "/dataset/{$productTypeId}"); $bcw->add('Products', $module->moduleRoot . "/products/{$productTypeId}/page/{$returnPage}");
$productType = $client->getProductTypeById(App::Get()->request->segments[0]); $ptID = $productType->getId(); $ptName = $productType->getName(); // 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'); } // Load a MetadataDisplayWidget with the visible metadata for this product type $typeMetadataWidget = new MetadataDisplayWidget(array()); $typeMetadataWidget->loadMetadata($browser->getVisibleMetadataForProductType($ptID)); // Create a MetadataDisplayWidget to display system metadata (all except typeMetadata) $typeMetadata = $productType->toAssocArray(); unset($typeMetadata['typeMetadata']); $systemMetadataWidget = new MetadataDisplayWidget(array()); $systemMetadataWidget->loadMetadata($typeMetadata); // Prepare BreadcrumbWigdet $bcw = new BreadcrumbsWidget(); $bcw->add('Home', SITE_ROOT . '/'); $bcw->add("Browse By Type", $module->moduleRoot . '/'); $bcw->add($ptName); ?> <div class="container"> <hr class="space" /> <div id="cas_browser_container"> <h2><?php echo $sortedMetadata['DataSetName'][0];