Esempio n. 1
0
 public function getRoute()
 {
     $rt = '';
     $parents = Categories::getHierarchy($this->id);
     foreach ($parents as $p) {
         $rt = ($p->alias !== '0' ? $p->alias . '/' : '') . $rt;
     }
     return $rt;
 }
Esempio n. 2
0
 private function getCategoryPath($id)
 {
     $parents = Categories::getHierarchy($id);
     if (!count($parents)) {
         $path = '#wct-' . $id;
     }
     $path = '';
     foreach ($parents as $p) {
         $path = $p->alias . '/' . $path;
     }
     return $path;
 }
Esempio n. 3
0
 private function createHierarchyPath()
 {
     $o = $this->owner;
     if ($o instanceof Resources) {
         $path = $o->alias;
         $cat_id = $o->category_id;
     } elseif ($o instanceof Categories) {
         $path = '';
         $cat_id = $o->id;
     } else {
         throw new InvalidCallException("Неправильный тип объекта");
     }
     $parents = Categories::getHierarchy($cat_id);
     foreach ($parents as $p) {
         $path = $p->alias . '/' . $path;
     }
     return $path;
 }