Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editframe.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  * Generate Layout to edit frame (fieldset)
9  *
10  * @author Anakeen 2000
11  * @version $Id: editframe.php,v 1.27 2008/08/14 09:59:14 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.Doc.php");
20 include_once ("FDL/Class.DocAttr.php");
21 
22 include_once ("FDL/freedom_util.php");
23 include_once ("FDL/editutil.php");
24 // Compute value to be inserted in a specific layout
25 // -----------------------------------
27 {
28  // -----------------------------------
29  // GetAllParameters
30  $docid = GetHttpVars("id", 0);
31  $classid = GetHttpVars("classid");
32  $frameid = strtolower(GetHttpVars("frameid"));
33  $vid = GetHttpVars("vid"); // special controlled view
34  // Set the globals elements
35  $dbaccess = $action->GetParam("FREEDOM_DB");
36 
37  if ($docid == 0) {
38  $doc = createDoc($dbaccess, $classid);
39  if (fdl_setHttpVars($doc)) $doc->refresh();
40  } else $doc = new_Doc($dbaccess, $docid);
41 
42  if (($vid != "") && ($doc->cvid > 0)) {
43  // special controlled view
44  $cvdoc = new_Doc($dbaccess, $doc->cvid);
45  $tview = $cvdoc->getView($vid);
46  if ($tview) $doc->setMask($tview["CV_MSKID"]);
47  }
48 
49  $listattr = $doc->GetNormalAttributes();
50 
51  if (GetHttpVars("viewconstraint") == "Y") { // from modcard function if constraint error
52  include_once ("FDL/modcard.php");
53  setPostVars($doc); // HTTP VARS comes from previous edition
54 
55  }
56 
57  $thval = array();
58  $tval = array();
59  $foa = $doc->getAttribute($frameid);
60  if (!$foa) $action->exitError(sprintf("attribute %s not found") , $frameid);
61  if ($foa->getOption("vlabel") == "none") $action->lay->set("flabel", '');
62  else $action->lay->set("flabel", mb_ucfirst($foa->getLabel()));
63  $action->lay->set("frameid", $foa->id);
64  while (list($k, $v) = each($listattr)) {
65 
66  if (($v->fieldSet->id != $frameid)) continue;
67  if ($v->inArray()) continue;
68  if ($v->mvisibility == "I") continue; // not editable
69  //------------------------------
70  // Set the table value elements
71  $value = chop($doc->GetValue($v->id));
72  if ($docid == 0) {
73  $value = $doc->GetValueMethod($value); // execute method for default values
74 
75  }
76  if (($v->mvisibility == "H") || ($v->mvisibility == "R")) {
77 
78  $thval[$k]["avalue"] = getHtmlInput($doc, $v, $value);
79  // special case for hidden values
80 
81  } else {
82  $tval[$k]["alabel"] = $v->getLabel();
83  if ($v->needed) $tval[$k]["labelclass"] = "FREEDOMLabelNeeded";
84  else $tval[$k]["labelclass"] = "FREEDOMLabel";
85  $tval[$k]["avalue"] = getHtmlInput($doc, $v, $value);
86 
87  $vlabel = $v->getOption("vlabel");
88  $tval[$k]["winput"] = ($v->type == "array") ? "1%" : "30%"; // width
89  $tval[$k]["TESTARRAY"] = (($v->type == "array") || (($v->type == "htmltext") && ($vlabel != 'left')) || ($vlabel == 'up') || ($vlabel == 'none'));
90  $tval[$k]["viewlabel"] = (($v->type != "array") && ($vlabel != 'none'));
91  }
92  }
93  $action->lay->setBlockData("FVALUES", $tval);
94  $action->lay->setBlockData("FHIDDENS", $thval);
95  if ((count($tval) + count($thval)) > 0) {
96 
97  $action->lay->setBlockData("FRAME", array(
98  array(
99  "bou"
100  )
101  ));
102  }
103 }
104 ?>
← centre documentaire © anakeen - published under CC License - Dynacase