mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-22 21:40:08 +00:00
Fix ordering in RoomList
This commit is contained in:
parent
6971d32b3c
commit
899152b8c6
@ -38,7 +38,7 @@ public function readData() {
|
|||||||
parent::readData();
|
parent::readData();
|
||||||
|
|
||||||
$this->objects = new \chat\data\room\RoomList();
|
$this->objects = new \chat\data\room\RoomList();
|
||||||
$this->objects->sqlOrder = 'position ASC';
|
$this->objects->sqlOrderBy = 'position ASC';
|
||||||
$this->objects->readObjects();
|
$this->objects->readObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +98,6 @@ public function validateUpdatePosition() {
|
|||||||
if (!isset($this->parameters['data']['structure'])) {
|
if (!isset($this->parameters['data']['structure'])) {
|
||||||
throw new \wcf\system\exception\UserInputException('structure');
|
throw new \wcf\system\exception\UserInputException('structure');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->parameters['data']['offset'])) $this->parameters['data']['offset'] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,14 +105,14 @@ public function validateUpdatePosition() {
|
|||||||
*/
|
*/
|
||||||
public function updatePosition() {
|
public function updatePosition() {
|
||||||
$roomList = new RoomList();
|
$roomList = new RoomList();
|
||||||
$roomList->sqlOrderBy = "room.position";
|
|
||||||
$roomList->readObjects();
|
$roomList->readObjects();
|
||||||
|
|
||||||
$i = $this->parameters['data']['offset'];
|
$i = 0;
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
foreach ($this->parameters['data']['structure'][0] as $roomID) {
|
foreach ($this->parameters['data']['structure'][0] as $roomID) {
|
||||||
$room = $roomList->search($roomID);
|
$room = $roomList->search($roomID);
|
||||||
if ($room === null) continue;
|
if ($room === null) continue;
|
||||||
|
|
||||||
$editor = new RoomEditor($room);
|
$editor = new RoomEditor($room);
|
||||||
$editor->update(array('position' => $i++));
|
$editor->update(array('position' => $i++));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user