malawi_454_1.cif 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function malawi_install() {
  7. // Make the entry in the country table.
  8. // VALUES = Country ID, Country Name, 2-digit Code, 3-digit Code, File Version
  9. db_insert('uc_countries')
  10. ->fields(array(
  11. 'country_id' => 454,
  12. 'country_name' => 'Malawi',
  13. 'country_iso_code_2' => 'MW',
  14. 'country_iso_code_3' => 'MWI',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(454, 'MW-BA', 'Balaka'),
  21. array(454, 'MW-BL', 'Blantyre'),
  22. array(454, 'MW-CK', 'Chikwawa'),
  23. array(454, 'MW-CR', 'Chiradzulu'),
  24. array(454, 'MW-CT', 'Chitipa'),
  25. array(454, 'MW-DE', 'Dedza'),
  26. array(454, 'MW-DO', 'Dowa'),
  27. array(454, 'MW-KR', 'Karonga'),
  28. array(454, 'MW-KS', 'Kasungu'),
  29. array(454, 'MW-LK', 'Likoma'),
  30. array(454, 'MW-LI', 'Lilongwe'),
  31. array(454, 'MW-MH', 'Machinga'),
  32. array(454, 'MW-MG', 'Mangochi'),
  33. array(454, 'MW-MC', 'Mchinji'),
  34. array(454, 'MW-MU', 'Mulanje'),
  35. array(454, 'MW-MW', 'Mwanza'),
  36. array(454, 'MW-MZ', 'Mzimba'),
  37. array(454, 'MW-NE', 'Neno'),
  38. array(454, 'MW-NB', 'Nkhata Bay'),
  39. array(454, 'MW-NK', 'Nkhotakota'),
  40. array(454, 'MW-NS', 'Nsanje'),
  41. array(454, 'MW-NU', 'Ntcheu'),
  42. array(454, 'MW-NI', 'Ntchisi'),
  43. array(454, 'MW-PH', 'Phalombe'),
  44. array(454, 'MW-RU', 'Rumphi'),
  45. array(454, 'MW-SA', 'Salima'),
  46. array(454, 'MW-TH', 'Thyolo'),
  47. array(454, 'MW-ZO', 'Zomba'),
  48. );
  49. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  50. foreach ($zones as $zone) {
  51. $query->values($zone);
  52. }
  53. $query->execute();
  54. // Set address format
  55. uc_set_address_format(
  56. 454,
  57. "!company\r\n" .
  58. "!first_name !last_name\r\n" .
  59. "!street1\r\n" .
  60. "!street2\r\n" .
  61. "!city, !zone_name !postal_code\r\n" .
  62. "!country_name_if"
  63. );
  64. }