PDA

View Full Version : Department List



mqcarpenter
04-27-2006, 03:07 PM
When someone initiates a chat, the department list is not alphabetical. How can I fix that? Also, can I have a custom listing of departments?

mqcarpenter
05-01-2006, 07:30 AM
Do you need an example of this occurence? TIA

TurnkeyAdmin
05-01-2006, 01:03 PM
Actually they are in alphabetical order. If you need to change the direction though you can do it in the include/class.dispatcher.client.php on line 290.

mqcarpenter
05-02-2006, 02:04 PM
If you take a look at mine, you see that it is not alpha. Any ideas why? http://www.sarma.com

I looked at the code and can not tell what would make it one direction or the other:


if ($_GET['dep'] != "") {
$dep = get('departments', $_GET['dep'], 'id');
$hide[] = "Dep List";
$dept_name = $dep[name];
$template = 'chat_start.html';
} else {
$deps = $DB_site->query("SELECT * FROM ".$dbprefix2."departments order by name desc");
while($dep=$DB_site->fetch_assoc($deps)) {
$reps = $DB_site->query("SELECT adminid from ".$dbprefix2."admin_sessions,".$dbprefix2."admin_accounts where ".$dbprefix2."admin_sessions.available='1' AND ".$dbprefix2."admin_accounts.userid=".$dbprefix2."admin_sessions.adminid AND (".$dbprefix2."admin_accounts.departments='$dep[id]' OR ".$dbprefix2."admin_accounts.departments like '$dep[id]::%' OR ".$dbprefix2."admin_accounts.departments like '%::$dep[id]' OR ".$dbprefix2."admin_accounts.departments like '%::$dep[id]::%')");
$online = $DB_site->num_rows($reps);
$dep_list .= "<option value=\"".stripslashes($dep[id])."\">".stripslashes($dep[name])." (".(($online>0)?$lang_client[online]:$lang_client[offline]).")";
}
$hide[] = "Department";
$template = 'chat_start.html';
}

TurnkeyAdmin
05-02-2006, 02:53 PM
It's here on this line that you can change how it is displayed:

$deps = $DB_site->query("SELECT * FROM ".$dbprefix2."departments order by name desc");

returns the departments in a descending order. So change it to "asc" so that it will be returned in a ascending order.

Or if you have someone that is proficient in MySQL, they can adjust the MySQL query to display the departments anyway you'd like.

mqcarpenter
05-03-2006, 10:08 AM
That was it. Thank you!

TurnkeyAdmin
05-03-2006, 12:29 PM
No prob. :D