예제 #1
0
 /**
  * This returns the list of available products for template output in a more useful way for templates.  
  * It is a simple list with each element being an associative array containing three keys: name status, and parent
  * 
  * @FIXME:  If a product has NO defined versions it should be REMOVED from this list.
  *
  * @return array  array of product arrays, keyed by shortname
  */
 public function getProductsForTemplate()
 {
     $product = PonyDocsProduct::GetProducts();
     $productAry = array();
     foreach ($product as $p) {
         // Only add product to list if it has versions visible to this user
         $valid = FALSE;
         $versions = PonyDocsProductVersion::LoadVersionsForProduct($p->getShortName());
         if (!empty($versions)) {
             $valid = TRUE;
         } elseif (empty($versions)) {
             // Check for children with visibile versions
             foreach (PonyDocsProduct::getChildProducts($p->getShortName()) as $childProductName) {
                 $childVersions = PonyDocsProductVersion::LoadVersionsForProduct($childProductName);
                 if (!empty($childVersions)) {
                     $valid = TRUE;
                     break;
                 }
             }
         }
         if ($valid) {
             $productAry[$p->getShortname()] = array('name' => $p->getShortName(), 'label' => $p->getLongName(), 'description' => $p->getDescription(), 'parent' => $p->getParent(), 'categories' => $p->getCategories());
         }
     }
     return $productAry;
 }