gradebook.ajax.php 737 B

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