Core  3.2
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  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: Class.DocAttr.php,v 1.24 2007/02/27 10:05:17 eric Exp $
11  * @package FDL
12  */
13 /**
14  */
15 include_once ('Class.DbObj.php');
16 include_once ('Class.QueryDb.php');
17 include_once ('Class.Log.php');
18 /**
19  * Database Attribute document
20  * @package FDL
21  *
22  */
23 class DocAttr extends DbObj
24 {
25  var $fields = array(
26  "id",
27  "docid",
28  "frameid",
29  "labeltext",
30  "title",
31  "abstract",
32  "type",
33  "ordered",
34  "visibility", // W, R, H, O, M, C
35  "needed",
36  "link",
37  "phpfile",
38  "phpfunc",
39  "elink",
40  "phpconstraint",
41  "usefor",
42  "options"
43  );
44 
45  var $id_fields = array(
46  "docid",
47  "id"
48  );
49 
50  var $dbtable = "docattr";
51 
52  var $order_by = "ordered";
53 
54  var $fulltextfields = array(
55  "labeltext"
56  );
57 
58  public $id;
59  public $docid;
60  public $frameid;
61  public $labeltext;
62  public $title;
63  public $abstract;
64  public $type;
65  public $ordered;
66  public $visibility; // W, R, H, O, M, C
67  public $needed;
68  public $link;
69  public $phpfile;
70  public $phpfunc;
71  public $elink;
73  public $usefor;
74  public $options;
75 
76  var $sqlcreate = "
77 create table docattr ( id name,
78  docid int not null,
79  frameid name,
80  labeltext text,
81  title char,
82  abstract char,
83  type text,
84  ordered int,
85  visibility char,
86  needed char,
87  link text,
88  phpfile text,
89  phpfunc text,
90  elink text,
91  phpconstraint text,
92  usefor char DEFAULT 'N',
93  options text
94  );
95 create sequence seq_id_docattr start 1000;
96 create unique index idx_iddocid on docattr(id, docid);";
97  // possible type of attributes
98  var $deftype = array(
99  "text",
100  "longtext",
101  "image",
102  "file",
103  "frame",
104  "enum",
105  "date",
106  "integer",
107  "double",
108  "money",
109  "password"
110  );
111 
112  function PreInsert()
113  {
114  // compute new id
115  if ($this->id == "") {
116  $res = pg_query($this->dbid, "select nextval ('seq_id_docattr')");
117  $arr = pg_fetch_array($res, 0);
118  $this->id = "auto_" . $arr[0]; // not a number must be alphanumeric begin with letter
119 
120  }
121  $this->id = strtolower($this->id);
122  if ($this->id[0] != ':') {
123  if ($this->type == "") $this->type = "text";
124  if ($this->abstract == "") $this->abstract = 'N';
125  if ($this->title == "") $this->title = 'N';
126  if ($this->usefor == "") $this->usefor = 'N';
127  if ($this->visibility == "") $this->visibility = 'W';
128  }
129  }
130 
131  public function getRawType($type = '')
132  {
133  if (!$type) $type = $this->type;
134  return strtok($type, '(');
135  }
136  public function isStructure()
137  {
138  $rtype = $this->getRawType();
139  return ($rtype == "frame" || $rtype == "tab");
140  }
141  public function isAbstract()
142  {
143  return (strtolower($this->abstract) == "y");
144  }
145  public function isTitle()
146  {
147  return (strtolower($this->title) == "y");
148  }
149  public function isNeeded()
150  {
151  return (strtolower($this->needed) == "y");
152  }
153 }
154 ?>
$s type
Definition: dav.php:73
getRawType($type= '')
← centre documentaire © anakeen