Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
popupfam.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: popupfam.php,v 1.22 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 // -----------------------------------
21 function popupfam(&$action, &$tsubmenu)
22 {
23  // -----------------------------------
24  // ------------------------------
25  // define accessibility
26  $docid = GetHttpVars("id");
27  $abstract = (GetHttpVars("abstract", 'N') == "Y");
28 
29  $action->lay->Set("SEP", false);
30  $dbaccess = $action->GetParam("FREEDOM_DB");
32  // if ($doc->doctype=="C") return; // not for familly
33  $kdiv = 1; // only one division
34  $action->lay->Set("id", $docid);
35 
36  include_once ("FDL/popup_util.php");
37  // -------------------- Menu menu ------------------
38  $lmenu = $doc->GetMenuAttributes();
39  $tmenu = array();
40  $km = 0;
41 
42  foreach ($lmenu as $k => $v) {
43 
44  $confirm = false;
45  $control = false;
46  if (($v->getOption("onlyglobal") == "yes") && ($doc->doctype != "C")) continue;
47  if (($v->getOption("global") != "yes") && ($doc->doctype == "C")) continue;
48  if ($v->link[0] == '?') {
49  $v->link = substr($v->link, 1);
50  $confirm = true;
51  }
52  if ($v->getOption("lconfirm") == "yes") $confirm = true;
53  if ($v->link[0] == 'C') {
54  $v->link = substr($v->link, 1);
55  $control = true;
56  }
57  if ($v->getOption("lcontrol") == "yes") $control = true;
58  if (preg_match('/\[(.*)\](.*)/', $v->link, $reg)) {
59  $v->link = $reg[2];
60  $tlink[$k]["target"] = $reg[1];
61  } else {
62  $tlink[$k]["target"] = $v->id;
63  }
64  if ($v->getOption("ltarget") != "") $tlink[$k]["target"] = $v->getOption("ltarget");
65  $tlink[$k]["idlink"] = $v->id;
66  $tlink[$k]["descr"] = $v->getLabel();
67  $tlink[$k]["url"] = addslashes($doc->urlWhatEncode($v->link));
68  $tlink[$k]["confirm"] = $confirm ? "true" : "false";
69  $tlink[$k]["control"] = $control;
70  $tlink[$k]["tconfirm"] = sprintf(_("Sure %s ?") , addslashes($v->getLabel()));
71  $tlink[$k]["visibility"] = MENU_ACTIVE;
72  $tlink[$k]["barmenu"] = ($v->getOption("barmenu") == "yes") ? "true" : "false";
73  if ($v->precond != "") $tlink[$k]["visibility"] = $doc->ApplyMethod($v->precond, MENU_ACTIVE);
74 
75  $tmenu[$km++] = $v->id;
76  popupAddItem('popupcard', $v->id);
77  }
78  // -------------------- Menu action ------------------
79  $lactions = $doc->GetActionAttributes();
80  foreach ($lactions as $k => $v) {
81  if ($v->getOption("submenu") != "") {
82  $confirm = false;
83  $control = false;
84  $v->link = $v->getLink($doc->id);
85  if ($v->getOption("lconfirm") == "yes") $confirm = true;
86  if ($v->getOption("lcontrol") == "yes") $control = true;
87 
88  if (preg_match('/\[(.*)\](.*)/', $v->link, $reg)) {
89  $v->link = $reg[2];
90  $tlink[$k]["target"] = $reg[1];
91  } else {
92  $tlink[$k]["target"] = $v->id;
93  }
94  $tlink[$k]["barmenu"] = ($v->getOption("barmenu") == "yes") ? "true" : "false";
95  $tlink[$k]["idlink"] = $v->id;
96  $tlink[$k]["descr"] = $v->getLabel();
97  $tlink[$k]["url"] = addslashes($doc->urlWhatEncode($v->link));
98  $tlink[$k]["confirm"] = $confirm ? "true" : "false";
99  $tlink[$k]["control"] = $control;
100  $tlink[$k]["tconfirm"] = sprintf(_("Sure %s ?") , addslashes($v->getLabel()));
101  $tlink[$k]["visibility"] = MENU_ACTIVE;
102  if ($v->precond != "") $tlink[$k]["visibility"] = $doc->ApplyMethod($v->precond, MENU_ACTIVE);
103 
104  $tmenu[$km++] = $v->id;
105  popupAddItem('popupcard', $v->id);
106  }
107  }
108 
109  if (count($tmenu) == 0) return;
110  // ---------------------------
111  // definition of popup menu
112  // ---------------------------
113  // definition of sub popup menu);
114  $lmenu = array_merge($lmenu, $lactions);
115 
116  foreach ($lmenu as $k => $v) {
117  $sm = $v->getOption("submenu");
118  if ($sm != "") {
119  $smid = base64_encode($sm);
120  $tsubmenu[$smid] = array(
121  "idmenu" => $smid,
122  "labelmenu" => $sm
123  );
124  popupSubMenu('popupcard', $v->id, $smid);
125  }
126  }
127 
128  while (list($k, $v) = each($tmenu)) {
129  if ($tlink[$v]["visibility"] == MENU_INVISIBLE) {
130  Popupinvisible('popupcard', $kdiv, $v);
131  } else {
132  if ($tlink[$v]["url"] != "") {
133  if ($tlink[$v]["visibility"] == MENU_INACTIVE) {
134  if ($tlink[$v]["control"]) PopupCtrlInactive('popupcard', $kdiv, $v);
135  else PopupInactive('popupcard', $kdiv, $v);
136  } else {
137  if ($tlink[$v]["control"]) PopupCtrlActive('popupcard', $kdiv, $v);
138  else Popupactive('popupcard', $kdiv, $v);
139  }
140  } else PopupInactive('popupcard', $kdiv, $v);
141  }
142  }
143 
144  $noctrlkey = ($action->getParam("FDL_CTRLKEY", "yes") == "no");
145  if ($noctrlkey) popupNoCtrlKey();
146 
147  $action->lay->SetBlockData("ADDLINK", $tlink);
148  $action->lay->Set("SEP", true); // to see separator
149 
150 }
151 ?>
← centre documentaire © anakeen - published under CC License - Dynacase