tuvalu_798_1.cif 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function tuvalu_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' => 798,
  12. 'country_name' => 'Tuvalu',
  13. 'country_iso_code_2' => 'TV',
  14. 'country_iso_code_3' => 'TUV',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(798, 'TV-FUN', 'Funafuti'),
  21. array(798, 'TV-NMG', 'Nanumanga'),
  22. array(798, 'TV-NMA', 'Nanumea'),
  23. array(798, 'TV-NIT', 'Niutao'),
  24. array(798, 'TV-NUI', 'Nui'),
  25. array(798, 'TV-NKF', 'Nukufetau'),
  26. array(798, 'TV-NKL', 'Nukulaelae'),
  27. array(798, 'TV-VAI', 'Vaitupu'),
  28. );
  29. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  30. foreach ($zones as $zone) {
  31. $query->values($zone);
  32. }
  33. $query->execute();
  34. // Set address format
  35. uc_set_address_format(
  36. 798,
  37. "!company\r\n" .
  38. "!first_name !last_name\r\n" .
  39. "!street1\r\n" .
  40. "!street2\r\n" .
  41. "!city, !zone_name !postal_code\r\n" .
  42. "!country_name_if"
  43. );
  44. }