load(); if ($course && $course->getType() == 'course' && $course->canEdit()) { if ($type && $ids) { $response = false; switch($type) { case "folder": $response = $course->reorderResourceFolders($ids); break; case "resource": $response = $course->reorderLearningResources($ids); break; } if ($response) { // TODO Consider showing some message if there are failed repositions // Using bulk logic responder on WS side thus 'count', 'success' and 'failure' are available exit; } else { header("HTTP/1.1 404 Error occured"); header("Status: 404 Erro occured"); exit; } } else { header("HTTP/1.1 404 Parameters missing"); header("Status: 404 Parameters missing"); exit; } } else { header("HTTP/1.1 404 No Course or permission problem"); header("Status: 404 No Course or permission problem"); exit; } } header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); exit;