extra_field_geo.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. exit;
  4. /**
  5. * @package chamilo.admin
  6. */
  7. $cidReset = true;
  8. require_once '../inc/global.inc.php';
  9. $this_section = SECTION_PLATFORM_ADMIN;
  10. $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
  11. api_protect_admin_script();
  12. //Add the JS needed to use the jqgrid
  13. $htmlHeadXtra[] = api_get_jqgrid_js();
  14. // setting breadcrumbs
  15. $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
  16. $tool_name = null;
  17. $action = isset($_GET['action']) ? $_GET['action'] : null;
  18. $field_id = isset($_GET['field_id']) ? $_GET['field_id'] : null;
  19. if (empty($field_id)) {
  20. api_not_allowed(true);
  21. }
  22. if (!in_array($type, ExtraField::getValidExtraFieldTypes())) {
  23. api_not_allowed(true);
  24. }
  25. $extra_field = new ExtraField($type);
  26. $extra_field_info = $extra_field->get($field_id);
  27. $extraFieldValue = new ExtraFieldValue($type);
  28. $values = $extraFieldValue->get_values_by_handler_and_field_id(
  29. $extra_field_info['id'],
  30. $field_id
  31. );
  32. $check = Security::check_token('request');
  33. $token = Security::get_token();
  34. $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
  35. $interbreadcrumb[]=array(
  36. 'url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
  37. 'name' => $extra_field_info['display_text']
  38. );
  39. $interbreadcrumb[]=array('url' => '#','name' => get_lang('Geolocalization'));
  40. //jqgrid will use this URL to do the selects
  41. $params = 'field_id='.$field_id.'&type='.$extra_field->type;
  42. $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_extra_field_options&'.$params;
  43. $htmlHeadXtra[]='<script>
  44. $(function() {
  45. // grid definition see the $obj->display() function
  46. '.Display::grid_js(
  47. 'extra_field_options',
  48. $url,
  49. $columns,
  50. $column_model,
  51. $extra_params,
  52. array(),
  53. $action_links,
  54. true
  55. ).'
  56. });
  57. </script>';
  58. // The header.
  59. Display::display_header($tool_name);
  60. echo Display::page_header($extra_field_info['display_text']);
  61. Display :: display_footer();