Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editbarmenu.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  * Specific menu for family
9  *
10  * @author Anakeen 2000
11  * @version $Id: editbarmenu.php,v 1.6 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/popupdocdetail.php");
20 include_once ("FDL/popupfamdetail.php");
21 
22 function editbarmenu(&$action)
23 {
24  $docid = GetHttpVars("id");
25  $zonebodycard = GetHttpVars("zone"); // define view action
26  $rzone = GetHttpVars("rzone"); // special zone when finish edition
27  $rvid = GetHttpVars("rvid"); // special zone when finish edition
28  $usefor = GetHttpVars("usefor"); // default values for a document
29  $rtarget = GetHttpVars("rtarget", "_self"); // special zone when finish edition return target
30  $classid = GetHttpVars("classid", getDefFam($action)); // use when new doc or change class
31  $action->lay->Set("SELFTARGET", ($rtarget == "_self"));
32  $dbaccess = $action->GetParam("FREEDOM_DB");
33 
34  $action->lay->Set("id", $docid);
35  if (($docid === 0) || ($docid === "") || ($docid === "0")) {
36  $action->lay->Set("editaction", _("Create"));
37  if ($usefor == "D") $action->lay->Set("editaction", _("Save default values"));
38  if ($usefor == "Q") $action->lay->Set("editaction", _("Save parameters"));
39  $doc = createDoc($dbaccess, $classid);
40  } else {
42  $action->lay->Set("editaction", _("Save"));
43  $action->lay->Set("id", $doc->id);
44  }
45 
46  if ($zonebodycard == "") {
47  if ((!$docid) && $doc->defaultcreate != "") $zonebodycard = $doc->defaultcreate;
48  else $zonebodycard = $doc->defaultedit;
49  }
50 
51  $action->lay->Set("boverdisplay", "none");
52  $action->lay->Set("INPUTCONSTRAINT", false);
53  $action->lay->Set("rzone", $rzone);
54  $action->lay->Set("rvid", $rvid);
55  $action->lay->Set("admin", ($action->user->id == 1));
56  $action->lay->Set("NOSAVE", (preg_match("/[A-Z]+:[^:]+:V/", $zonebodycard, $reg)));
57  if (GetHttpVars("viewconstraint") == "Y") {
58  $action->lay->Set("bconsdisplay", "");
59  if ($action->user->id == 1) {
60  $action->lay->Set("INPUTCONSTRAINT", true);
61  $action->lay->Set("boverdisplay", ""); // only admin can do this
62 
63  }
64  } else {
65  // verify if at least on attribute constraint
66  $action->lay->Set("bconsdisplay", "none");
67  /*
68  $listattr = $doc->GetNormalAttributes();
69  foreach ($listattr as $k => $v) {
70  if ($v->phpconstraint != "") {
71  $action->lay->Set("bconsdisplay", "");
72  break;
73  }
74  }
75  */
76  }
77 
78  $taction = array();
79 
80  $listattr = $doc->GetActionAttributes();
81  foreach ($listattr as $k => $v) {
82  if (($v->mvisibility != "H") && ($v->mvisibility != "R")) {
83  $mvis = MENU_ACTIVE;
84  if ($v->precond != "") $mvis = $doc->ApplyMethod($v->precond, MENU_ACTIVE);
85  if ($mvis == MENU_ACTIVE) {
86  $taction[$k] = array(
87  "wadesc" => $v->getOption("llabel") ,
88  "walabel" => ucfirst($v->getLabel()) ,
89  "waction" => $v->waction,
90  "wtarget" => $v->id,
91  "wapplication" => $v->wapplication
92  );
93  }
94  }
95  }
96 
97  $action->lay->setBlockData("WACTION", $taction);
98 }
← centre documentaire © anakeen - published under CC License - Dynacase