b2evolution PHP Cross Reference Blogging Systems

Source: /inc/regional/views/_city.form.php - 116 lines - 4851 bytes - Summary - Text - Print

Description: This file is part of the evoCore framework - {@link http://evocore.net/} See also {@link http://sourceforge.net/projects/evocms/}.

   1  <?php
   2  /**

   3   * This file is part of the evoCore framework - {@link http://evocore.net/}

   4   * See also {@link http://sourceforge.net/projects/evocms/}.

   5   *

   6   * @copyright (c)2009-2014 by Francois PLANQUE - {@link http://fplanque.net/}

   7   * Parts of this file are copyright (c)2009 by The Evo Factory - {@link http://www.evofactory.com/}.

   8   *

   9   * {@internal License choice

  10   * - If you have received this file as part of a package, please find the license.txt file in

  11   *   the same folder or the closest folder above for complete license terms.

  12   * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)

  13   *   then you must choose one of the following licenses before using the file:

  14   *   - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php

  15   *   - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php

  16   * }}

  17   *

  18   * {@internal Open Source relicensing agreement:

  19   * The Evo Factory grants Francois PLANQUE the right to license

  20   * The Evo Factory's contributions to this file and the b2evolution project

  21   * under any OSI approved OSS license (http://www.opensource.org/licenses/).

  22   * }}

  23   *

  24   * @package evocore

  25   *

  26   * {@internal Below is a list of authors who have contributed to design/coding of this file: }}

  27   * @author efy-maxim: Evo Factory / Maxim.

  28   * @author fplanque: Francois Planque.

  29   *

  30   * @version $Id: _city.form.php 9 2011-10-24 22:32:00Z fplanque $

  31   */
  32  
  33  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  34  
  35  load_class( 'regional/model/_country.class.php', 'Country' );
  36  
  37  /**

  38   * @var City

  39   */
  40  global $edited_City;
  41  
  42  // Determine if we are creating or updating...

  43  global $action;
  44  $creating = is_create_action( $action );
  45  
  46  $Form = new Form( NULL, 'city_checkchanges', 'post', 'compact' );
  47  
  48  $Form->global_icon( T_('Delete this city!'), 'delete', regenerate_url( 'action', 'action=delete&amp;'.url_crumb('city') ) );
  49  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url( 'action' ) );
  50  
  51  $Form->begin_form( 'fform', $creating ?  T_('New city') : T_('City') );
  52  
  53      $Form->add_crumb( 'city' );
  54      $Form->hiddens_by_key( get_memorized( 'action'.( $creating ? ',city_ID' : '' ) ) ); // (this allows to come back to the right list order & page)

  55  
  56      $CountryCache = & get_CountryCache();
  57      $Form->select_country( 'city_ctry_ID', $edited_City->ctry_ID, $CountryCache, T_('Country'), array( 'allow_none' => true, 'required' => true ) );
  58  
  59      $Form->select_input_options( 'city_rgn_ID', get_regions_option_list( $edited_City->ctry_ID, $edited_City->rgn_ID, array( 'none_option_text' => T_('Unknown') ) ), T_('Region') );
  60  
  61      $Form->select_input_options( 'city_subrg_ID', get_subregions_option_list( $edited_City->rgn_ID, $edited_City->subrg_ID, array( 'none_option_text' => T_('Unknown') ) ), T_('Sub-region') );
  62  
  63      $Form->text_input( 'city_postcode', $edited_City->postcode, 12, T_('Post code'), '', array( 'maxlength'=> 12, 'required'=>true ) );
  64  
  65      $Form->text_input( 'city_name', $edited_City->name, 40, T_('Name'), '', array( 'maxlength'=> 40, 'required'=>true ) );
  66  
  67  if( $creating )
  68  {
  69      $Form->end_form( array( array( 'submit', 'actionArray[create]', T_('Record'), 'SaveButton' ),
  70                                                      array( 'submit', 'actionArray[create_new]', T_('Record, then Create New'), 'SaveButton' ),
  71                                                      array( 'submit', 'actionArray[create_copy]', T_('Record, then Create Similar'), 'SaveButton' ),
  72                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
  73  }
  74  else
  75  {
  76      $Form->end_form( array( array( 'submit', 'actionArray[update]', T_('Update'), 'SaveButton' ),
  77                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
  78  }
  79  
  80  ?>
  81  <script type="text/javascript">
  82  jQuery( '#city_ctry_ID' ).change( function ()
  83  {    // Load option list with regions for seleted country
  84      jQuery.ajax( {
  85      type: 'POST',
  86      url: '<?php echo get_samedomain_htsrv_url(); ?>anon_async.php',
  87      data: 'action=get_regions_option_list&page=edit&mode=load_subregions&ctry_id=' + jQuery( this ).val(),
  88      success: function( result )
  89          {
  90              result = ajax_debug_clear( result );
  91              var options = result.split( '-##-' );
  92  
  93              jQuery( '#city_rgn_ID' ).html( options[0] );
  94              jQuery( '#city_subrg_ID' ).html( options[1] );
  95          }
  96      } );
  97  } );
  98  
  99  jQuery( '#city_rgn_ID' ).change( function ()
 100  {    // Change option list with sub-regions
 101      load_subregions( jQuery( this ).val() );
 102  } );
 103  
 104  function load_subregions( region_ID )
 105  {    // Load option list with sub-regions for seleted region
 106      jQuery.ajax( {
 107      type: 'POST',
 108      url: '<?php echo get_samedomain_htsrv_url(); ?>anon_async.php',
 109      data: 'action=get_subregions_option_list&page=edit&rgn_id=' + region_ID,
 110      success: function( result )
 111          {
 112              jQuery( '#city_subrg_ID' ).html( ajax_debug_clear( result ) );
 113          }
 114      } );
 115  }
 116  </script>

title

Description

title

Description

title

Description

title

title

Body