timor_leste_626_1.cif 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function timor_leste_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' => 626,
  12. 'country_name' => 'Timor-Leste',
  13. 'country_iso_code_2' => 'TL',
  14. 'country_iso_code_3' => 'TLS',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table.
  19. $zones = array(
  20. array(626, 'TL-AL', 'Aileu'),
  21. array(626, 'TL-AN', 'Ainaro'),
  22. array(626, 'TL-BA', 'Baucau'),
  23. array(626, 'TL-BO', 'Bobonaro'),
  24. array(626, 'TL-CO', 'Cova Lima'),
  25. array(626, 'TL-DI', 'Dili'),
  26. array(626, 'TL-ER', 'Ermera'),
  27. array(626, 'TL-LA', 'Lautem'),
  28. array(626, 'TL-LI', 'Liquiça'),
  29. array(626, 'TL-MT', 'Manatuto'),
  30. array(626, 'TL-MF', 'Manufahi'),
  31. array(626, 'TL-OE', 'Oecussi'),
  32. array(626, 'TL-VI', 'Viqueque'),
  33. );
  34. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  35. foreach ($zones as $zone) {
  36. $query->values($zone);
  37. }
  38. $query->execute();
  39. // Set address format
  40. uc_set_address_format(
  41. 626,
  42. "!company\r\n" .
  43. "!first_name !last_name\r\n" .
  44. "!street1\r\n" .
  45. "!street2\r\n" .
  46. "!city, !zone_name !postal_code\r\n" .
  47. "!country_name_if"
  48. );
  49. }