china_156_1.cif 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Implements hook_install() using the name of the country as the base of
  4. * the function name.
  5. */
  6. function china_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' => 156,
  12. 'country_name' => 'China',
  13. 'country_iso_code_2' => 'CN',
  14. 'country_iso_code_3' => 'CHN',
  15. 'version' => 1,
  16. ))
  17. ->execute();
  18. // Make the entries in the zones table. Use %d for the zone_id and the
  19. // function uc_get_zone_ids($num) as the second argument for db_query() where
  20. // $num is the number of zones in the INSERT query.
  21. // VALUES = %d for ID, Parent Country ID, Zone Abbreviation, Zone Name
  22. $zones = array(
  23. array(156, '京', '北京'),
  24. array(156, '沪', '上海'),
  25. array(156, '津', '天津'),
  26. array(156, '渝', '重庆'),
  27. array(156, '冀', '河北'),
  28. array(156, '豫', '河南'),
  29. array(156, '鄂', '湖北'),
  30. array(156, '湘', '湖南'),
  31. array(156, '苏', '江苏'),
  32. array(156, '赣', '江西'),
  33. array(156, '辽', '辽宁'),
  34. array(156, '吉', '吉林'),
  35. array(156, '黑', '黑龙江'),
  36. array(156, '陕', '陕西'),
  37. array(156, '鲁', '山东'),
  38. array(156, '晋', '山西'),
  39. array(156, '川', '四川'),
  40. array(156, '青', '青海'),
  41. array(156, '皖', '安徽'),
  42. array(156, '琼', '海南'),
  43. array(156, '粤', '广东'),
  44. array(156, '桂', '广西'),
  45. array(156, '贵', '贵州'),
  46. array(156, '浙', '浙江'),
  47. array(156, '闽', '福建'),
  48. array(156, '甘', '甘肃'),
  49. array(156, '云', '云南'),
  50. array(156, '蒙', '内蒙古'),
  51. array(156, '宁', '宁夏'),
  52. array(156, '新', '新疆'),
  53. array(156, '藏', '西藏'),
  54. array(156, '港', '香港'),
  55. array(156, '澳', '澳门'),
  56. array(156, '台', '台湾'),
  57. );
  58. $query = db_insert('uc_zones')->fields(array('zone_country_id', 'zone_code', 'zone_name'));
  59. foreach ($zones as $zone) {
  60. $query->values($zone);
  61. }
  62. $query->execute();
  63. // Set address format
  64. uc_set_address_format(
  65. 156,
  66. "!company\r\n".
  67. "!last_name !first_name\r\n".
  68. "!street1\r\n".
  69. "!street2\r\n".
  70. "!city, !zone_name !postal_code\r\n".
  71. "!country_name_if"
  72. );
  73. }