Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ParamDef.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: Class.ParamDef.php,v 1.4 2005/10/31 11:52:17 eric Exp $
11  * @package FDL
12  * @subpackage CORE
13  */
14 /**
15  */
16 // ---------------------------------------------------------------------------
17 // Param
18 // ---------------------------------------------------------------------------
19 // Anakeen 2000 - yannick.lebriquer@anakeen.com
20 // ---------------------------------------------------------------------------
21 // This program is free software; you can redistribute it and/or modify
22 // it under the terms of the GNU General Public License as published by
23 // the Free Software Foundation; either version 2 of the License, or (at
24 // your option) any later version.
25 //
26 // This program is distributed in the hope that it will be useful, but
27 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
28 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 // for more details.
30 //
31 // You should have received a copy of the GNU General Public License along
32 // with this program; if not, write to the Free Software Foundation, Inc.,
33 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 // ---------------------------------------------------------------------------
35 // $Id: Class.ParamDef.php,v 1.4 2005/10/31 11:52:17 eric Exp $
36 //
37 include_once ('Class.Log.php');
38 include_once ('Class.DbObj.php');
39 
40 $CLASS_PARAMDEF_PHP = '$Id: Class.ParamDef.php,v 1.4 2005/10/31 11:52:17 eric Exp $';
41 
42 class ParamDef extends DbObj
43 {
44  var $fields = array(
45  "name",
46  "isuser",
47  "isstyle",
48  "isglob",
49  "appid",
50  "descr",
51  "kind"
52  );
53  public $name;
54  public $isuser;
55  public $isstyle;
56  public $isglob;
57  public $appid;
58  public $descr;
59  public $kind;
60 
61  var $id_fields = array(
62  "name",
63  "appid"
64  );
65 
66  var $dbtable = "paramdef";
67 
68  var $sqlcreate = '
69  create table paramdef (
70  name text,
71  isuser varchar(1),
72  isstyle varchar(1),
73  isglob varchar(1),
74  appid int4,
75  descr text,
76  kind text);
77  create unique index paramdef_idxna on paramdef(name, appid);
78  ';
79  /**
80  * get Param def object from name
81  * @param string $name parameter name
82  * @param int $appid application id
83  * @return ParamDef
84  */
85  public static function getParamDef($name, $appid = null)
86  {
87  $d = null;
88  if ($appid == null) {
89  simpleQuery('', sprintf("select * from paramdef where name='%s'", pg_escape_string($name)) , $paramDefValues, false, true);
90  } else {
91  $sql = <<< 'SQL'
92  SELECT * from paramdef
93  where name='%s'
94  and (isglob='Y' or appid=%d or appid=1 or appid=(select id from application where name=(select childof from application where id=%d)));
95 SQL;
96  $sqlp = sprintf($sql, pg_escape_string($name) , $appid, $appid);
97  simpleQuery('', $sqlp, $paramDefValues, false, true);
98  }
99  if (!empty($paramDefValues)) {
100  $d = new ParamDef();
101  $d->Affect($paramDefValues);
102  }
103  return $d;
104  }
105 }
106 ?>
$CLASS_PARAMDEF_PHP
print $fam getTitle() $fam name
static getParamDef($name, $appid=null)
$d
Definition: dav.php:77
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
Definition: Lib.Common.php:484
← centre documentaire © anakeen