Location: PHPKode > scripts > ZBase > zbase/objects/zb_user_support.inc
<?
/****************************************************************************
 * zb_user_support_support.inc : Support for the table of users
 ****************************************************************************
 * $Id: zb_user_support.inc,v 1.3 2000/08/17 09:52:40 massiot Exp $
 ****************************************************************************
 *  ZBase - a gateway between the database and the WWW
 *  Copyright (c) 1999 The ZBase team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ****************************************************************************/

if (!isset($GLOBALS[setzb_user_support])) {

srv_include("gate_pgsql");

class zb_user_support extends gate_pgsql {

  /* Standard Business Objects definitions. */
  var $TABLE = "zb_user",
      $FIELDS = array("login", "name", "passwd", "theme", "ac", "lang",
                      "disabled", "failure", "zb_group",
                      "comments"),
      $KEYS = array("login"),
      $SHOW_LIST = array("login", "name", "ac", "theme", "lang", "disabled",
                         "failure", "zb_group"),

      /* Captions and menus will be provided by the setup function. */
      $ATTR_login = array("size" => 30, "required" => TRUE,
                          "type" => "lowertext"),
      $ATTR_name = array("size"=> 60, "showsize" => 30, "required" => TRUE),
      $ATTR_passwd = array("type" => "password", "size" => 20,
                           "required" => TRUE, "default" => "*"),
      $ATTR_theme = array("type" => "menu"),
      $ATTR_ac = array("type" => "menu"),
      $ATTR_lang = array("type" => "menu"),
      $ATTR_disabled = array("type" => "boolean"),
      $ATTR_failure = array("type" => "int", "default" => 0),
      $ATTR_zb_group = array("type" => "menu", "default" => 1),
      $ATTR_comments = array("colspan" => 3, "showsize" => 50);


function zb_user_support($dont_setup = FALSE) {
  if (!$dont_setup)
    $this->zb_user_setup();

  gate_pgsql::gate_pgsql();
} //zb_user_support

function zb_user_setup() {
  /* Since we support multiple languages, load here the captions of the
   * fields. */
  $this->srv_loadcaptions("ac", "zb_user_captions");

  /* Load menus. */
  $this->ATTR_theme["menu"] = srv_loadvar("ac", "allowed_themes");
  $this->ATTR_theme["default"] = srv_loadvar("default", "theme");
  $this->ATTR_ac["menu"] = srv_loadvar("ac", "allowed_ac");
  $this->ATTR_ac["default"] = srv_loadvar("default", "ac");
  $this->ATTR_lang["menu"] = srv_loadvar("ac", "allowed_lang");
  $this->ATTR_lang["default"] = srv_loadvar("default", "lang");
  $this->ATTR_zb_group["menu"] = srv_loadvar("ac", "zb_group");

  /* Recompute the attributes cache. */
  zbase_support::zbase_support();
} //zb_user_setup

} //class zb_user_support

$GLOBALS[setzb_user_support] = TRUE;
} //setzb_user_support
?>
Return current item: ZBase