Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.DocAttr.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: Class.DocAttr.php,v 1.24 2007/02/27 10:05:17 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  */
15 /**
16  */
17 // ---------------------------------------------------------------
18 // $Id: Class.DocAttr.php,v 1.24 2007/02/27 10:05:17 eric Exp $
19 // $Source: /home/cvsroot/anakeen/freedom/freedom/Class/Fdl/Class.DocAttr.php,v $
20 // ---------------------------------------------------------------
21 $CLASS_CONTACTATTR_PHP = '$Id: Class.DocAttr.php,v 1.24 2007/02/27 10:05:17 eric Exp $';
22 include_once ('Class.DbObj.php');
23 include_once ('Class.QueryDb.php');
24 include_once ('Class.Log.php');
25 /**
26  * Database Attribute document
27  * @package FDL
28  *
29  */
30 class DocAttr extends DbObj
31 {
32  var $fields = array(
33  "id",
34  "docid",
35  "frameid",
36  "labeltext",
37  "title",
38  "abstract",
39  "type",
40  "ordered",
41  "visibility", // W, R, H, O, M, C
42  "needed",
43  "link",
44  "phpfile",
45  "phpfunc",
46  "elink",
47  "phpconstraint",
48  "usefor",
49  "options"
50  );
51 
52  var $id_fields = array(
53  "docid",
54  "id"
55  );
56 
57  var $dbtable = "docattr";
58 
59  var $order_by = "ordered";
60 
61  var $fulltextfields = array(
62  "labeltext"
63  );
64 
65  var $sqlcreate = "
66 create table docattr ( id name,
67  docid int not null,
68  frameid name,
69  labeltext text,
70  title char,
71  abstract char,
72  type text,
73  ordered int,
74  visibility char,
75  needed char,
76  link text,
77  phpfile text,
78  phpfunc text,
79  elink text,
80  phpconstraint text,
81  usefor char DEFAULT 'N',
82  options text
83  );
84 create sequence seq_id_docattr start 1000;
85 create unique index idx_iddocid on docattr(id, docid)";
86  // possible type of attributes
87  var $deftype = array(
88  "text",
89  "longtext",
90  "image",
91  "file",
92  "frame",
93  "enum",
94  "date",
95  "integer",
96  "double",
97  "money",
98  "password"
99  );
100  var $isCacheble = false;
101 
102  function PreInsert()
103  {
104  // compute new id
105  if ($this->id == "") {
106  $res = pg_exec($this->dbid, "select nextval ('seq_id_docattr')");
107  $arr = pg_fetch_array($res, 0);
108  $this->id = "auto_" . $arr[0]; // not a number must be alphanumeric begin with letter
109 
110  }
111  $this->id = strtolower($this->id);
112  if ($this->id[0] != ':') {
113  if ($this->type == "") $this->type = "text";
114  if ($this->abstract == "") $this->abstract = 'N';
115  if ($this->title == "") $this->title = 'N';
116  if ($this->usefor == "") $this->usefor = 'N';
117  if ($this->visibility == "") $this->visibility = 'W';
118  }
119  }
120 
121  function CVisibility()
122  {
123 
124  if ((isset($this->fieldSet)) && ($this->fieldSet->visibility == "H")) return "H";
125  else if (($this->fieldSet->visibility == "R") && ($this->visibility != "H")) return "R";
126  return $this->visibility;
127  }
128 }
129 ?>
← centre documentaire © anakeen - published under CC License - Dynacase