b2evolution PHP Cross Reference Blogging Systems

Source: /inc/users/model/_userfieldgroup.class.php - 142 lines - 3768 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 evofactory-test

  28   * @author fplanque: Francois Planque.

  29   *

  30   * @version _userfieldgroup.class.php,v 1.5 2009/09/16 18:11:51 fplanque Exp

  31   */
  32  if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );
  33  
  34  load_class( '_core/model/dataobjects/_dataobject.class.php', 'DataObject' );
  35  
  36  /**

  37   * Userfield Class

  38   *

  39   * @package evocore

  40   */
  41  class UserfieldGroup extends DataObject
  42  {
  43      var $name = '';
  44      var $order = '';
  45  
  46      /**

  47       * Constructor

  48       *

  49       * @param object Database row

  50       */
  51  	function UserfieldGroup( $db_row = NULL )
  52      {
  53          // Call parent constructor:

  54          parent::DataObject( 'T_users__fieldgroups', 'ufgp_', 'ufgp_ID' );
  55  
  56          $this->delete_restrictions = array(
  57              array( 'table'=>'T_users__fielddefs', 'fk'=>'ufdf_ufgp_ID', 'msg'=>T_('%d user fields in this group') ),
  58          );
  59  
  60          $this->delete_cascades = array();
  61  
  62          if( $db_row != NULL )
  63          {
  64              $this->ID   = $db_row->ufgp_ID;
  65              $this->name = $db_row->ufgp_name;
  66              $this->order = $db_row->ufgp_order;
  67          }
  68          else
  69          {    // Create a new user field group:
  70          }
  71      }
  72  
  73      /**

  74       * Load data from Request form fields.

  75       *

  76       * @return boolean true if loaded data seems valid.

  77       */
  78  	function load_from_Request()
  79      {
  80          // Name

  81          param_string_not_empty( 'ufgp_name', T_('Please enter a group name.') );
  82          $this->set_from_Request( 'name' );
  83  
  84          // Order

  85          param_string_not_empty( 'ufgp_order', T_('Please enter an order number.') );
  86          $this->set_from_Request( 'order' );
  87  
  88          return ! param_errors_detected();
  89      }
  90  
  91  
  92      /**

  93       * Set param value

  94       *

  95       * By default, all values will be considered strings

  96       *

  97       * @param string parameter name

  98       * @param mixed parameter value

  99       */
 100  	function set( $parname, $parvalue )
 101      {
 102          $this->set_param( $parname, 'string', $parvalue );
 103      }
 104  
 105  
 106      /**

 107       * Get user field group name.

 108       *

 109       * @return string user field group name

 110       */
 111  	function get_name()
 112      {
 113          return $this->name;
 114      }
 115  
 116  
 117      /**

 118       * Check existence of specified user field group ID in ufgp_ID unique field.

 119       *

 120       * @todo dh> Two returns here!!

 121       * @return int ID if user field group exists otherwise NULL/false

 122       */
 123  	function dbexists()
 124      {
 125          global $DB;
 126  
 127          $sql = "SELECT $this->dbIDname
 128                            FROM $this->dbtablename
 129                         WHERE $this->dbIDname = $this->ID";
 130  
 131          return $DB->get_var( $sql );
 132  
 133          return parent::dbexists('ufgp_ID', $this->ID);
 134      }
 135  }
 136  
 137  
 138  /*

 139   * _userfieldgroup.class.php,v

 140   *

 141   */
 142  ?>

title

Description

title

Description

title

Description

title

title

Body