gradebook.ajax.php 601 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Responses to AJAX calls
  5. */
  6. require_once __DIR__.'/../global.inc.php';
  7. api_protect_course_script(true);
  8. $action = $_REQUEST['a'];
  9. switch ($action) {
  10. case 'get_gradebook_weight':
  11. if (api_is_allowed_to_edit(null, true)) {
  12. $cat_id = $_GET['cat_id'];
  13. $cat = Category :: load($cat_id);
  14. if ($cat && isset($cat[0])) {
  15. echo $cat[0]->get_weight();
  16. } else {
  17. echo 0;
  18. }
  19. }
  20. break;
  21. default:
  22. echo '';
  23. break;
  24. }
  25. exit;