b2evolution PHP Cross Reference Blogging Systems

Source: /inc/users/views/_userfield.form.php - 114 lines - 4851 bytes - 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 fplanque: Francois PLANQUE.
  28   *
  29   * @version $Id: _userfield.form.php 6136 2014-03-08 07:59:48Z manuel $
  30   */
  31  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  32  
  33  load_class( 'users/model/_userfield.class.php', 'Userfield' );
  34  
  35  /**
  36   * @var Userfield
  37   */
  38  global $edited_Userfield;
  39  
  40  // Determine if we are creating or updating...
  41  global $action;
  42  
  43  $creating = is_create_action( $action );
  44  
  45  $Form = new Form( NULL, 'userfield_checkchanges', 'post', 'compact' );
  46  
  47  $Form->global_icon( T_('Delete this userfield!'), 'delete', regenerate_url( 'action', 'action=delete&amp;'.url_crumb('userfield') ) );
  48  $Form->global_icon( T_('Cancel editing!'), 'close', regenerate_url( 'action' ) );
  49  
  50  $Form->begin_form( 'fform', $creating ?  T_('New user field') : T_('User field') );
  51  
  52      $Form->add_crumb( 'userfield' );
  53  
  54      $Form->hiddens_by_key( get_memorized( 'action' ) ); // (this allows to come back to the right list order & page)
  55  
  56      $Form->select_input_array( 'ufdf_ufgp_ID', $edited_Userfield->group_ID, $edited_Userfield->get_groups(),
  57          T_('Group'), '', array( 'required' => true, 'force_keys_as_values' => true ) );
  58  
  59      $Form->text_input( 'ufdf_name', $edited_Userfield->name, 50, T_('Field name'), '', array( 'maxlength'=> 255, 'required'=>true ) );
  60  
  61      $Form->select_input_array( 'ufdf_type', $edited_Userfield->type, $edited_Userfield->get_types(),
  62          T_('Field type'), '', array( 'required' => true ) );
  63  
  64      // Show this textarea only for field type with "Option list"
  65      echo '<div id="div_ufdf_options"'. ( $edited_Userfield->type != 'list' ? ' style="display:none"' : '' ) .'>';
  66      $Form->textarea_input( 'ufdf_options', $edited_Userfield->options, 10, T_('Options'), array( 'required' => true, 'note' => T_('Enter one option per line') ) );
  67      echo '</div>';
  68  
  69      // Suggest values only for field type with "Single word"
  70      echo '<div id="div_ufdf_suggest"'. ( $edited_Userfield->type != 'word' ? ' style="display:none"' : '' ) .'>';
  71      $Form->checkbox_input( 'ufdf_suggest', $edited_Userfield->suggest, T_('Suggest values') );
  72      echo '</div>';
  73  
  74      $Form->radio_input( 'ufdf_duplicated', $edited_Userfield->duplicated, $edited_Userfield->get_duplicateds(), T_('Multiple values'), array( 'required'=>true, 'lines'=>true ) );
  75  
  76      $Form->radio_input( 'ufdf_required', $edited_Userfield->required, $edited_Userfield->get_requireds(), T_('Required?'), array( 'required'=>true ) );
  77  
  78      $Form->textarea_input( 'ufdf_bubbletip', $edited_Userfield->bubbletip, 5, T_('Bubbletip text') );
  79  
  80  if( $creating )
  81  {
  82      $Form->end_form( array( array( 'submit', 'actionArray[create]', T_('Record'), 'SaveButton' ),
  83                                                      array( 'submit', 'actionArray[create_new]', T_('Record, then Create New'), 'SaveButton' ),
  84                                                      array( 'submit', 'actionArray[create_copy]', T_('Record, then Create Similar'), 'SaveButton' ),
  85                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
  86  }
  87  else
  88  {
  89      $Form->end_form( array( array( 'submit', 'actionArray[update]', T_('Update'), 'SaveButton' ),
  90                                                      array( 'reset', '', T_('Reset'), 'ResetButton' ) ) );
  91  }
  92  ?>
  93  <script type="text/javascript">
  94      jQuery( '#ufdf_type' ).change( function()
  95      {    // Show textarea input only for field type with "Option list"
  96          if( jQuery( this ).val() == 'list' )
  97          {
  98              jQuery( '#div_ufdf_options' ).show();
  99          }
 100          else
 101          {
 102              jQuery( '#div_ufdf_options' ).hide();
 103          }
 104          // Suggest values only for field type with "Single word"
 105          if( jQuery( this ).val() == 'word' )
 106          {
 107              jQuery( '#div_ufdf_suggest' ).show();
 108          }
 109          else
 110          {
 111              jQuery( '#div_ufdf_suggest' ).hide();
 112          }
 113      } );
 114  </script>

title

Description

title

Description

title

Description

title

title

Body