function getCategoryPath($withAllLink = true) { global $smartsection_category_handler; if (!isset($this->_category)) { $this->_category = $smartsection_category_handler->get($this->getVar('categoryid')); } return $this->_category->getCategoryPath($withAllLink); }
/** * retrieve categories from the database * * @param object $criteria {@link CriteriaElement} conditions to be met * @param bool $id_as_key use the categoryid as key for the array? * @return array array of {@link XoopsItem} objects */ function &getObjects($criteria = null, $id_as_key = false) { $ret = array(); $limit = $start = 0; $sql = 'SELECT * FROM ' . $this->db->prefix('smartsection_categories'); if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' ' . $criteria->renderWhere(); if ($criteria->getSort() != '') { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); } //echo "<br />" . $sql . "<br />"; $result = $this->db->query($sql, $limit, $start); if (!$result) { return $ret; } $theObjects = array(); while ($myrow = $this->db->fetchArray($result)) { $category = new SmartsectionCategory(); $category->assignVars($myrow); $theObjects[$myrow['categoryid']] =& $category; unset($category); } // since we need category permissions for all these items, let's fetch them only once ;-) global $smartsection_permission_handler; if (!$smartsection_permission_handler) { $smartsection_permission_handler = xoops_getmodulehandler('permission', 'smartsection'); } $itemsObj_array_keys = array_keys($theObjects); $smartsection_category_group = $smartsection_permission_handler->getGrantedGroupsForIds($itemsObj_array_keys); foreach ($theObjects as $theObject) { $theObject->_groups_read = isset($smartsection_category_group['category_read'][$theObject->categoryid()]) ? $smartsection_category_group['category_read'][$theObject->categoryid()] : array(); $theObject->_groups_submit = isset($smartsection_category_group['item_submit'][$theObject->categoryid()]) ? $smartsection_category_group['item_submit'][$theObject->categoryid()] : array(); if (!$id_as_key) { $ret[] =& $theObject; } else { $ret[$theObject->categoryid()] =& $theObject; } unset($theObject); } return $ret; }