albmgr.php changes so that the dropdown menu is sorted alphabetic albmgr.php changes so that the dropdown menu is sorted alphabetic
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

albmgr.php changes so that the dropdown menu is sorted alphabetic

Started by olafbecker, June 26, 2006, 10:19:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

olafbecker

This is the snip out of the albmgr.php what needs to be changed so that the data is sorted :


/**
* alb_get_subcat_data()
*
* @param integer $parent
* @param string $ident
**/

// modified by Olaf Becker for beeing sorted alphabetic.

function alb_get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST;

    if ($CONFIG['categories_alpha_sort'] == 1) {
      $sort_query = 'name';
    } else {
      $sort_query = 'pos';
    }


    $result = cpg_db_query("SELECT cid, name, description " . " FROM {$CONFIG['TABLE_CATEGORIES']} " . " WHERE parent = '$parent' " . " AND CID != 1  ORDER BY $sort_query ");

    if (mysql_num_rows($result) > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
            alb_get_subcat_data($subcat['cid'], $ident . '   ');
        }
    }
}


If you needing any more or other help email me directly at obecker@teranet.de because i modify and reprogramm the hole modules right now to get out more performance and more features out of this product.

Olaf Becker