Core  3.2
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  * @package FDL
5 */
6 /**
7  * Specific menu for family
8  *
9  * @author Anakeen
10  * @version $Id: editbarmenu.php,v 1.6 2008/08/14 09:59:14 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/popupdocdetail.php");
18 include_once ("FDL/popupfamdetail.php");
19 
21 {
22  $docid = GetHttpVars("id");
23  $zonebodycard = GetHttpVars("zone"); // define view action
24  $rzone = GetHttpVars("rzone"); // special zone when finish edition
25  $rvid = GetHttpVars("rvid"); // special zone when finish edition
26  $usefor = GetHttpVars("usefor"); // default values for a document
27  $rtarget = GetHttpVars("rtarget", "_self"); // special zone when finish edition return target
28  $classid = GetHttpVars("classid", getDefFam($action)); // use when new doc or change class
29  $action->lay->Set("SELFTARGET", ($rtarget == "_self"));
30  $dbaccess = $action->dbaccess;
31 
32  $action->lay->eSet("id", $docid);
33  if (($docid === 0) || ($docid === "") || ($docid === "0")) {
34  $action->lay->Set("editaction", _("Create"));
35  if ($usefor == "D") $action->lay->eSet("editaction", _("Save default values"));
36  if ($usefor == "Q") $action->lay->eSet("editaction", _("Save parameters"));
37  $doc = createDoc($dbaccess, $classid);
38  } else {
40  $action->lay->eSet("editaction", _("Save"));
41  $action->lay->Set("id", $doc->id);
42  }
43 
44  if ($zonebodycard == "") {
45  if ((!$docid) && $doc->defaultcreate != "") $zonebodycard = $doc->defaultcreate;
46  else $zonebodycard = $doc->defaultedit;
47  }
48 
49  if ((!$docid) && (($usefor == "Q") || ($usefor == "D"))) $action->lay->eset("id", $classid);
50  $action->lay->Set("boverdisplay", "none");
51  $action->lay->Set("INPUTCONSTRAINT", false);
52  $action->lay->eSet("rzone", $rzone);
53  $action->lay->eSet("rvid", $rvid);
54  $action->lay->Set("admin", ($action->user->id == 1));
55  $action->lay->Set("NOSAVE", (preg_match("/[A-Z]+:[^:]+:V/", $zonebodycard, $reg)));
56  if (GetHttpVars("viewconstraint") == "Y") {
57  $action->lay->Set("bconsdisplay", "");
58  if ($action->user->id == 1) {
59  $action->lay->Set("INPUTCONSTRAINT", true);
60  $action->lay->Set("boverdisplay", ""); // only admin can do this
61 
62  }
63  } else {
64  // verify if at least on attribute constraint
65  $action->lay->Set("bconsdisplay", "none");
66  /*
67  $listattr = $doc->GetNormalAttributes();
68  foreach ($listattr as $k => $v) {
69  if ($v->phpconstraint != "") {
70  $action->lay->Set("bconsdisplay", "");
71  break;
72  }
73  }
74  */
75  }
76 
77  $taction = array();
78 
79  $listattr = $doc->GetActionAttributes();
80  foreach ($listattr as $k => $v) {
81  if (($v->mvisibility != "H") && ($v->mvisibility != "R")) {
82  $mvis = MENU_ACTIVE;
83  if ($v->precond != "") $mvis = $doc->ApplyMethod($v->precond, MENU_ACTIVE);
84  if ($mvis == MENU_ACTIVE) {
85  $taction[$k] = array(
86  "wadesc" => htmlspecialchars($v->getOption("llabel") , ENT_QUOTES) ,
87  "walabel" => htmlspecialchars(ucfirst($v->getLabel()) , ENT_QUOTES) ,
88  "waction" => htmlspecialchars($v->waction, ENT_QUOTES) ,
89  "wtarget" => htmlspecialchars($v->id, ENT_QUOTES) ,
90  "wapplication" => htmlspecialchars($v->wapplication, ENT_QUOTES)
91  );
92  }
93  }
94  }
95 
96  $action->lay->setBlockData("WACTION", $taction);
97 }
global $action
editbarmenu(Action &$action)
Definition: editbarmenu.php:20
getDefFam(Action &$action)
Set($name, &$parent)
const MENU_ACTIVE
Definition: Class.Doc.php:36
$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