sort Character groups by XPs for listing and by name for managing (Issue #210)
This commit is contained in:
parent
ae1c9a509b
commit
495ab946d9
2 changed files with 16 additions and 3 deletions
|
|
@ -115,7 +115,7 @@
|
|||
$groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
|
||||
|
||||
// Get Character groups
|
||||
$groups = $this->Charactergroups->getGroupsForGroupsgroup($groupsgroup['id']);
|
||||
$groups = $this->Charactergroups->getGroupsForGroupsgroup($groupsgroup['id'], 'xps');
|
||||
|
||||
// Get Character groups-group Quests
|
||||
$quests = $this->Charactergroupsquests->getQuestsForCharactergroupsgroup($groupsgroup['id']);
|
||||
|
|
|
|||
|
|
@ -195,13 +195,26 @@
|
|||
* @param int $groupsgroupId ID of the Character groups-group
|
||||
* @return array Character groups
|
||||
*/
|
||||
public function getGroupsForGroupsgroup($groupsgroupId)
|
||||
public function getGroupsForGroupsgroup($groupsgroupId, $sortorder='name')
|
||||
{
|
||||
// Set sort order
|
||||
switch($sortorder)
|
||||
{
|
||||
case 'xps':
|
||||
$sortorder = 'xps DESC';
|
||||
break;
|
||||
case 'name':
|
||||
default:
|
||||
$sortorder = 'name ASC';
|
||||
break;
|
||||
}
|
||||
|
||||
// Get and return Character groups
|
||||
return $this->db->query(
|
||||
'SELECT id, name, url, xps, motto, seminaryupload_id '.
|
||||
'FROM v_charactergroups '.
|
||||
'WHERE charactergroupsgroup_id = ? '.
|
||||
'ORDER BY name',
|
||||
"ORDER BY $sortorder",
|
||||
'i',
|
||||
$groupsgroupId
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue