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