install.ajax.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /* For licensing terms, see /chamilo_license.txt */
  3. /**
  4. * Responses to AJAX calls for install
  5. */
  6. //require_once '../global.inc.php';
  7. $action = $_GET['a'];
  8. switch ($action) {
  9. case 'send_contact_information':
  10. if (!empty($_POST)) {
  11. // get params from contact form
  12. $person_name = $_POST['person_name'];
  13. $person_email = $_POST['person_email'];
  14. $person_role = $_POST['person_role'];
  15. $financial_decision = $_POST['financial_decision'];
  16. $contact_language = $_POST['language'];
  17. $company_name = $_POST['company_name'];
  18. $company_activity = $_POST['company_activity'];
  19. $company_country = $_POST['company_country'];
  20. $company_city = $_POST['company_city'];
  21. // validating required fields
  22. $a_required_fields = array($person_name, $person_role, $company_name, $company_activity, $company_country);
  23. $required_field_error = false;
  24. foreach ($a_required_fields as $required_file) {
  25. if (trim($required_file) === '') {
  26. $required_field_error = true;
  27. break;
  28. }
  29. }
  30. if ($required_field_error) {
  31. echo 'required_field_error';
  32. } else {
  33. // save contact information with web service
  34. require_once '../lib/nusoap/nusoap.php';
  35. // create a client
  36. $client = new nusoap_client('http://version.chamilo.org/contact.php?wsdl', true);
  37. // call method ws_add_contact_information
  38. $contact_params = array(
  39. 'person_name' => $person_name,
  40. 'person_email' => $person_email,
  41. 'person_role' => $person_role,
  42. 'financial_decision' => $financial_decision,
  43. 'contact_language' => $contact_language,
  44. 'company_name' => $company_name,
  45. 'company_activity' => $company_activity,
  46. 'company_country' => $company_country,
  47. 'company_city' => $company_city
  48. );
  49. $result = $client->call('ws_add_contact_information', array('contact_params' => $contact_params));
  50. echo $result;
  51. }
  52. }
  53. break;
  54. default:
  55. echo '';
  56. }
  57. exit;