Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generate Layout to edit array (table)
9  *
10  * @author Anakeen 2005
11  * @version $Id: editarray.php,v 1.3 2008/06/05 12:53:30 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 // -----------------------------------
26 function editarray(&$action)
27 {
28  // -----------------------------------
29  // GetAllParameters
30  $docid = GetHttpVars("id", 0);
31  $classid = GetHttpVars("classid");
32  $row = GetHttpVars("row", -1);
33  $arrayid = strtolower(GetHttpVars("arrayid"));
34  $vid = GetHttpVars("vid"); // special controlled view
35  // Set the globals elements
36  $dbaccess = $action->GetParam("FREEDOM_DB");
37 
38  if ($docid == 0) {
39  $doc = createDoc($dbaccess, $classid);
40  if (fdl_setHttpVars($doc)) $doc->refresh();
41  } else $doc = new_Doc($dbaccess, $docid);
42 
43  if (($vid != "") && ($doc->cvid > 0)) {
44  // special controlled view
45  $cvdoc = new_Doc($dbaccess, $doc->cvid);
46  $tview = $cvdoc->getView($vid);
47  if ($tview) $doc->setMask($tview["CV_MSKID"]);
48  }
49 
50  $oattr = $doc->getAttribute($arrayid);
51  if (!$oattr) $action->lay->template = sprintf(_("attribute %s not found") , $arrayid);
52  else {
53  if ($oattr->type != "array") $action->lay->template = sprintf(_("attribute %s not an array") , $arrayid);
54  else getLayArray($action->lay, $doc, $oattr, $row);
55  }
56 }
57 ?>
← centre documentaire © anakeen - published under CC License - Dynacase