protected function _calcCntAndFilterEmpty(ResourceCategory $node, User $user) { $res = $node->self_cnt = count($node->getAllowedResources($user)); foreach ($node->getChildNodes() as $n) { $n->cnt = $this->_calcCntAndFilterEmpty($n, $user); if (!$n->cnt) { $node->removeChildNode($n); } $res += $n->cnt; } return $res; }
public function deleteResourceCategory($id) { $db = $this->db; $deleted = new ResourceCategory(); $deleted->delete($db, $id); }