mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Merge pull request #3273 from SimSync/fix_3271
Fixes #3271 Updated class construtor to __construct()
This commit is contained in:
@@ -22,23 +22,32 @@ class downloadCategory
|
|||||||
var $cat_count; // Count visible subcats and subsubcats
|
var $cat_count; // Count visible subcats and subsubcats
|
||||||
var $down_count; // Counts total downloads
|
var $down_count; // Counts total downloads
|
||||||
|
|
||||||
function downloadCategory($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
|
|
||||||
{ // Constructor - make a copy of the tree for re-use
|
/**
|
||||||
// $nest_level = 0 merges subsubcats with subcats. >0 creates full tree.
|
* downloadCategory constructor.
|
||||||
// If load-class non-null, assumed to be a 'class set' such as USERCLASS_LIST
|
*
|
||||||
// If $accum is TRUE, include file counts and sizes in superior categories
|
* @param int $nest_level If 0, merges subsubcats with subcats. >0 creates full tree.
|
||||||
|
* @param string $load_class If non-null, assumed to be a 'class set' such as USERCLASS_LIST
|
||||||
|
* @param string $main_cat_load
|
||||||
|
* @param bool $accum If TRUE, include file counts and sizes in superior categories
|
||||||
|
*/
|
||||||
|
function __construct($nest_level = 1, $load_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
|
||||||
|
{
|
||||||
define("SUB_PREFIX","-->"); // Added in front of sub categories
|
define("SUB_PREFIX","-->"); // Added in front of sub categories
|
||||||
define("SUBSUB_PREFIX","---->"); // Added in front of sub-sub categories
|
define("SUBSUB_PREFIX","---->"); // Added in front of sub-sub categories
|
||||||
$this->cat_tree = $this->down_cat_tree($nest_level,$load_class, $main_cat_load, $accum);
|
$this->cat_tree = $this->down_cat_tree($nest_level, $load_class, $main_cat_load, $accum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Function returns a 'tree' of download categories, subcategories, and sub-sub-categories.
|
/**
|
||||||
// Returns empty array if nothing defined
|
* Function returns a 'tree' of download categories, subcategories, and sub-sub-categories.
|
||||||
// Within the 'main category' level of the nesting, array 'subcats' has the next level's info
|
*
|
||||||
// Within the 'sub-category' level of the nesting, array 'subsubcats' has the next level's info
|
* @param int $nest_level If 0, merges subsubcats with subcats. >0 creates full tree.
|
||||||
// If $main_cat_load is numeric, and the value of a 'main' category, only that main category is displayed.
|
* @param string $load_cat_class If non-null, assumed to be a 'class set' such as USERCLASS_LIST
|
||||||
// (Unpredictable if $main_cat_load is some other category)
|
* @param string $main_cat_load If $main_cat_load is numeric, and the value of a 'main' category, only that main category is displayed. (Unpredictable if $main_cat_load is some other category)
|
||||||
|
* @param bool $accum If TRUE, include file counts and sizes in superior categories
|
||||||
|
* @return array Returns empty array if nothing defined
|
||||||
|
*/
|
||||||
function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
|
function down_cat_tree($nest_level = 1, $load_cat_class = USERCLASS_LIST, $main_cat_load = '', $accum = FALSE)
|
||||||
{
|
{
|
||||||
global $sql2;
|
global $sql2;
|
||||||
@@ -69,9 +78,9 @@ class downloadCategory
|
|||||||
GROUP by dc.download_category_id
|
GROUP by dc.download_category_id
|
||||||
ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats
|
ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats
|
||||||
|
|
||||||
if (!$sql2->db_Select_gen($qry)) return $catlist;
|
if (!$sql2->gen($qry)) return $catlist;
|
||||||
|
|
||||||
while ($row = $sql2->db_Fetch())
|
while ($row = $sql2->fetch())
|
||||||
{
|
{
|
||||||
$tmp = $row['download_category_parent'];
|
$tmp = $row['download_category_parent'];
|
||||||
if ($tmp == '0')
|
if ($tmp == '0')
|
||||||
@@ -158,4 +167,3 @@ class downloadCategory
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
Reference in New Issue
Block a user