Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ADoc.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  * Attribute Document Object Definition
9  *
10  * @author Anakeen 2002
11  * @version $Id: Class.ADoc.php,v 1.13 2006/04/03 14:56:26 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 include_once ("FDL/Class.DocAttribute.php");
19 /**
20  * Attribute Document Class
21  *
22  */
23 class ADoc
24 {
25 
26  function __construct()
27  {
28  $this->attr["FIELD_HIDDENS"] = new FieldSetAttribute("FIELD_HIDDENS", 0, "hiddens");
29  }
30 
31  function getAttr($id)
32  {
33  if (isset($this->attr[$id])) return $this->attr[$id];
34  if (isset($this->attr[strtolower($id) ])) return $this->attr[$id];
35 
36  return false;
37  }
38  /**
39  * get attributes ids
40  */
41  function getAttrIds($id)
42  {
43  return array_keys($this->attr);
44  }
45  function GetNormalAttributes($onlyopt = false)
46  {
47  $tsa = array();
48  if (isset($this->attr)) {
49  foreach ($this->attr as $k => $v) {
50  if ((get_class($v) == "NormalAttribute") && ((($v->usefor != "Q") && (!$onlyopt)) || (($v->usefor == "O") && ($onlyopt)))) $tsa[$v->id] = $v;
51  }
52  }
53  return $tsa;
54  }
55 
56  public function GetActionAttributes()
57  {
58  $tsa = array();
59 
60  foreach ($this->attr as $k => $v) {
61  if (get_class($v) == "ActionAttribute") $tsa[$v->id] = $v;
62  }
63  return $tsa;
64  }
65 
66  function getParamAttributes()
67  {
68  $tsa = array();
69  if (isset($this->attr)) {
70  reset($this->attr);
71  while (list($k, $v) = each($this->attr)) {
72  if ((get_class($v) == "NormalAttribute") && ($v->usefor == "Q")) $tsa[$v->id] = $v;
73  }
74  }
75  return $tsa;
76  }
77 
79  {
80  $a = $this->getAttr($id);
81  if ($a && ($a->type == "array")) {
82  if ($a->usefor != "Q") {
83  $tsa = $this->GetNormalAttributes();
84  } else {
85  $tsa = $this->getParamAttributes();
86  }
87  $ta = array();
88  foreach ($tsa as $k => $v) {
89  if ($v->fieldSet->id == $id) $ta[$v->id] = $v;
90  }
91  return $ta;
92  }
93  return false;
94  }
95 }
96 ?>
← centre documentaire © anakeen - published under CC License - Dynacase