home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (belgium_56_3.cif)

This example Drupal source code file (belgium_56_3.cif) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

56, and, array, database, db_query, function, set, sql, uc_zones, update, where, zone_code, zone_country_id, zone_name

The belgium_56_3.cif Drupal example source code

<?php
// $Id: belgium_56_3.cif,v 1.1.2.5 2010/04/14 05:18:19 tr Exp $

function belgium_install() {
  db_query("INSERT INTO {uc_countries} (country_id, country_name, country_iso_code_2, country_iso_code_3, version) VALUES (56, 'Belgium', 'BE', 'BEL', 3)");

  // Make the entries in the zones table.
  $zones = array(
    array(56, 'VWV', 'West-Vlaanderen'),
    array(56, 'VOV', 'Oost-Vlaanderen'),
    array(56, 'VAN', 'Antwerpen'),
    array(56, 'VLI', 'Limburg'),
    array(56, 'VBR', 'Vlaams-Brabant'),
    array(56, 'BRU', 'Brussel/Bruxelles'),
    array(56, 'WBW', 'Brabant-Wallon'),
    array(56, 'WLG', 'Liège'),
    array(56, 'WHT', 'Hainaut'),
    array(56, 'WNA', 'Namur'),
    array(56, 'WLX', 'Luxembourg'),
  );

  foreach ($zones as $zone) {
    db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (%d, '%s', '%s')", $zone);
  }

  uc_set_address_format(56, "!company\n!first_name !last_name\n!street1\n!street2\n!postal_code !city\n!country_name_if");
}

function belgium_update($version) {
  switch ($version) {
    case '2':
      // Update existing zone codes and names.
      db_query("UPDATE {uc_zones} SET zone_code = 'VWV' WHERE zone_code = 'WV' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_code = 'VOV' WHERE zone_code = 'OV' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_code = 'VAN' WHERE zone_code = 'AN' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_code = 'VLI' WHERE zone_code = 'LG' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_code = 'VBR' WHERE zone_code = 'VB' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_name = 'Brabant-Wallon', zone_code = 'WBR' WHERE zone_code = 'BW' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_name = 'Liège', zone_code = 'WLG' WHERE zone_code = 'LB' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_name = 'Hainaut', zone_code = 'WHT' WHERE zone_code = 'HT' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_name = 'Namur', zone_code = 'WNA' WHERE zone_code = 'NM' AND zone_country_id = 56");
      db_query("UPDATE {uc_zones} SET zone_name = 'Luxembourg', zone_code = 'WLX' WHERE zone_code = 'LU' AND zone_country_id = 56");

      // Insert Brussels.
      db_query("INSERT INTO {uc_zones} (zone_country_id, zone_code, zone_name) VALUES (056, 'BRU', 'Brussel/Bruxelles')");

      break;
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal belgium_56_3.cif source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.