load(); if ($course && $course->getType() == 'course') { if ($action && $ids && $case) { $response = false; switch($case) { case "coursegroups": if ($action == 'delete') { $response = $course->bulkDeleteGroups($ids); } break; case "participants": if ($action == "accept") { $response = $course->bulkActivateLearners($ids); } else if ($action == "remove") { $response = $course->bulkRemoveLearners($ids); } break; case "learningoutcomes": if ($action == "delete") { $response = $course->bulkDeleteLearningOutcomes($ids); } break; case "resources": if ($action == "delete") { $response = $course->bulkDeleteResources($ids); } break; case "assignments": if ($action == "delete") { $response = $course->bulkDeleteAssignments($ids); } break; case "categories": if ($action == "delete") { $response = $course->bulkDeleteCategories($ids); } break; } if ($response) { if ((int)$response->success[0][0] == (int)$response->count[0][0] && (int)$response->success[0][0] > 0) { $Dippler->add_system_message(sprintf(_("Action success on all %s objects."), $response->success[0][0]), 'success'); } else if ((int)$response->failure[0][0] == (int)$response->count[0][0] && (int)$response->failure[0][0] > 0) { $Dippler->add_system_message(sprintf(_("Action failed on all %s objects."), $response->failure[0][0]), 'error'); } else if ((int)$response->count[0][0] > 0){ $Dippler->add_system_message(sprintf(_("Action failed on %s objects."), $response->failure[0][0]), 'error'); $Dippler->add_system_message(sprintf(_("Action success on %s objects."), $response->success[0][0]), 'success'); } exit; } else { $Dippler->add_system_message(_("Bulk action failed."), 'error'); } } else { $Dippler->add_system_message(_("At least one of the parameters is empty."), 'error'); } } else { $Dippler->add_system_message(_("Course could not be loaded."), 'error'); } } header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); exit;