/** * A controller action that handles the reordering of the panels * * @param SS_HTTPRequest The current request * @return SS_HTTPResponse */ public function sort(SS_HTTPRequest $r) { if ($sort = $r->requestVar('dashboard-panel')) { foreach ($sort as $index => $id) { if ($panel = DashboardPanel::get()->byID((int) $id)) { if ($panel->MemberID == Member::currentUserID()) { $panel->SortOrder = $index; $panel->write(); } } } } }