Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
inputattribute.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  * Compose html code to insert input
9  *
10  * @author Anakeen 2006
11  * @version $Id: inputattribute.php,v 1.4 2008/09/15 16:29:24 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 include_once ("FDL/Class.Dir.php");
20 include_once ("FDL/editutil.php");
21 /**
22  * Compose html code to insert input
23  * @param Action &$action current action
24  * @global type Http var : attribute type
25  * @global id Http var : identificator of input generated
26  * @global label Http var : label of attribute (only for doclink type when no choice is possible)
27  * @global famid Http var : family identificator criteria (only for doclink type)
28  * @global value Http var : predefined value
29  * @global esize Http var : number of character visible (for text input)
30  */
32 {
33 
34  $attrid = GetHttpVars("id");
35  $type = stripslashes(GetHttpVars("type"));
36  $jsevent = stripslashes(GetHttpVars("jsevent"));
37  $label = GetHttpVars("label");
38  $esize = GetHttpVars("esize");
39  $value = GetHttpVars("value");
40  $phpfunc = GetHttpVars("phpfunc");
41  $phpfile = GetHttpVars("phpfile");
42  $eformat = GetHttpVars("eformat");
43  $options = GetHttpVars("options");
44  $dbaccess = $action->GetParam("FREEDOM_DB");
45  $doc = new doc($dbaccess);
46  $htmlinput = "";
47  if ($type == "doclink") {
48  $famid = GetHttpVars("famid");
49 
50  $index = "";
51  $jsevent = "";
52  $format = "";
53  $repeat = false;
54  $order = 0;
55  $link = "";
56  $visibility = "H";
57  $needed = "N";
58  $isInTitle = false;
59  $isInAbstract = false;
60  $fieldSet = $doc->attr["FIELD_HIDDENS"];
61 
62  if (!$phpfunc) $phpfunc = "::getTitle($id_$attrid):$attrid";
63  $elink = "";
64  $phpconstraint = "";
65  $usefor = "";
66  $eformat = "";
67  $options = "";
68  if (!isUTF8($label)) $label = utf8_encode($label);
69 
70  $oattr1 = new NormalAttribute("id_$attrid", $doc->id, "id $label", "docid", $format, $repeat, $order, $link, $visibility, $needed, $isInTitle, $isInAbstract, $fieldSet, $phpfile, $phpfunc, $elink, $phpconstraint, $usefor, $eformat, $options);
71 
72  $index = "";
73  $jsevent = "";
74  $format = "";
75  $repeat = false;
76  $order = 0;
77  $link = "";
78  $visibility = "W";
79  $needed = "N";
80  $isInTitle = false;
81  $isInAbstract = false;
82  $phpfile = "fdl.php";
83  $phpfunc = "lfamily(D,$famid,$attrid):id_$attrid,$attrid";
84  $fieldSet = $doc->attr["FIELD_HIDDENS"];
85  $elink = "";
86  $phpconstraint = "";
87  $usefor = "";
88  $eformat = "";
89  $options = "elabel=" . ($label);
90  if ($esize) $options.= "|esize=$esize";
91  $oattr = new NormalAttribute($attrid, $doc->id, $label, "text", $format, $repeat, $order, $link, $visibility, $needed, $isInTitle, $isInAbstract, $fieldSet, $phpfile, $phpfunc, $elink, $phpconstraint, $usefor, $eformat, $options);
92 
93  $doc->attr[$oattr1->id] = $oattr1;
94  $htmlinput = getHtmlInput($doc, $oattr1, $value, $index, $jsevent, true);
95  $doc->attr[$oattr->id] = $oattr;
96  } else {
97 
98  $format = "";
99  if (preg_match('/^(.*)\("([^"]*)"/', $type, $reg)) {
100  $type = trim($reg[1]);
101  $format = trim($reg[2]);
102  }
103 
104  $index = "";
105  $repeat = false;
106  $order = 0;
107  $link = "";
108  $visibility = "W";
109  $needed = "N";
110  $isInTitle = false;
111  $isInAbstract = false;
112  $fieldSet = $doc->attr["FIELD_HIDDENS"];
113 
114  $elink = "";
115  $phpconstraint = "";
116  $usefor = "";
117 
118  if (!$options) $options = "elabel=" . ($label);
119  if ($esize) $options.= "|esize=$esize";
120  $oattr = new NormalAttribute($attrid, $doc->id, $label, $type, $format, $repeat, $order, $link, $visibility, $needed, $isInTitle, $isInAbstract, $fieldSet, $phpfile, $phpfunc, $elink, $phpconstraint, $usefor, $eformat, $options);
121 
122  $doc->attr[$attrid] = $oattr;
123  }
124 
125  $htmlinput.= getHtmlInput($doc, $oattr, $value, $index, $jsevent, true);
126 
127  $action->lay->template = $htmlinput;
128 }
129 ?>
← centre documentaire © anakeen - published under CC License - Dynacase