Exemple #1
0
function renderCategoryPath($catPathArr, $route = '/socialmedia/')
{
    $nameShort = Site::getInstance()->getNameShort();
    echo "<a class='catPath' href='" . url() . "/socialmedia";
    if (Site::getCategoryDepth() < 3) {
        echo '/all';
    }
    echo "'>" . $nameShort . "</a> &raquo; ";
    if (count($catPathArr) > 0) {
        foreach ($catPathArr as $key => $obj) {
            if ($key > 0) {
                echo " &raquo; ";
            }
            echo "<a class='catPath' href='" . $route . $obj->slug . "'>" . $obj->display_name . "</a>";
        }
        echo "<br>";
    } else {
        echo "<br>";
    }
}
 /**
  * Determine if children of parents are to be retrieved
  * 
  * @param array $catPathArr
  * @param string $slug
  * @param object $catObj
  * @return boolean
  */
 private function getChildrenBool($catPathArr, $slug, $catObj)
 {
     $getChildren = false;
     if (Site::getCategoryDepth() == 2 && $slug != 'all') {
         // if it is just a collection of parents without children (and we're not getting 'all'),
         // treat parent as child and use child layout
         $getChildren = true;
     } else {
         // Check to see if we're getting children - members within single category
         // or parent - members within groups of categories
         // eg. parent = members within groups of categories = members of the NBA Pacific div and the teams they're
         // on eg. children = members within single category = members (Blake Griffin et al) of the category Clippers
         // Members in single category gets all members displayed unconcealed on page
         // Members in groups of categories get members concealed and navigable within categories on page
         foreach ($catPathArr as $obj) {
             if ($obj->child_id == $catObj->id && $obj->parent_id > 0) {
                 $getChildren = true;
                 break;
             }
         }
     }
     return $getChildren;
 }