Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editarray.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Generate Layout to edit array (table)
8  *
9  * @author Anakeen
10  * @version $Id: editarray.php,v 1.3 2008/06/05 12:53:30 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("FDL/Class.DocAttr.php");
19 
20 include_once ("FDL/freedom_util.php");
21 include_once ("FDL/editutil.php");
22 // Compute value to be inserted in a specific layout
23 // -----------------------------------
24 function editarray(Action & $action)
25 {
26  // -----------------------------------
27  // GetAllParameters
28  $docid = GetHttpVars("id", 0);
29  $classid = GetHttpVars("classid");
30  $row = GetHttpVars("row", -1);
31  $arrayid = strtolower(GetHttpVars("arrayid"));
32  $vid = GetHttpVars("vid"); // special controlled view
33  // Set the globals elements
34  $dbaccess = $action->dbaccess;
35 
36  if ($docid == 0) {
37  $doc = createDoc($dbaccess, $classid);
38  if (fdl_setHttpVars($doc)) $doc->refresh();
39  } else $doc = new_Doc($dbaccess, $docid);
40 
41  if (($vid != "") && ($doc->cvid > 0)) {
42  /**
43  * special controlled view
44  * @var CVDoc $cvdoc
45  */
46  $cvdoc = new_Doc($dbaccess, $doc->cvid);
47  $tview = $cvdoc->getView($vid);
48  if ($tview) $doc->setMask($tview["CV_MSKID"]);
49  }
50 
51  $oattr = $doc->getAttribute($arrayid);
52  if (!$oattr) {
53  $action->lay->template = htmlspecialchars(sprintf(_("attribute %s not found") , $arrayid));
54  $action->lay->noparse = true;
55  } else {
56  if ($oattr->type != "array") {
57  $action->lay->template = htmlspecialchars(sprintf(_("attribute %s not an array") , $arrayid));
58  $action->lay->noparse = true;
59  } else {
60  $of = new DocFormFormat($doc);
61  $of->getLayArray($action->lay, $doc, $oattr, $row);
62  }
63  }
64 }
global $action
fdl_setHttpVars(&$doc)
Definition: editcard.php:381
$docid
Definition: cleanFamily.php:13
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen