Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
viewbarmenu.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: viewbarmenu.php,v 1.10 2008/10/09 08:00:37 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  $dbaccess = $action->dbaccess;
25  if ($docid == "") $action->exitError(_("No identificator"));
26  $popup = '';
27  if ($doc->doctype == 'C') $popup = getpopupfamdetail($action, $docid);
28  else {
29  if ($doc->specialmenu) {
30  if (preg_match("/(.*):(.*)/", $doc->specialmenu, $reg)) {
31  $action->parent->setVolatileParam("getmenulink", 1);
32 
33  $dir = $reg[1];
34  $function = strtolower($reg[2]);
35  $file = $function . ".php";
36  if (include_once ("$dir/$file")) {
37  $function($action);
38  $popup = $action->GetParam("menulink");;
39  } else {
40  AddwarningMsg(sprintf(_("Incorrect specification of special menu : %s") , $doc->specialmenu));
41  }
42  $action->parent->setVolatileParam("getmenulink", null);
43  } else {
44  AddwarningMsg(sprintf(_("Incorrect specification of special menu : %s") , $doc->specialmenu));
45  }
46  }
47  }
48  if (!$popup) $popup = getpopupdocdetail($action, $docid);
49  $other = false;
50  $menuIndex = array(
51  "visibility",
52  "jsfunction",
53  "isjs",
54  "submenu",
55  "mwidth",
56  "mheight",
57  "title",
58  "url",
59  "target",
60  "confirm",
61  "tconfirm"
62  );
63  foreach ($popup as $k => $v) {
64  foreach ($menuIndex as $aItemMenu) if (!isset($v[$aItemMenu])) $popup[$k][$aItemMenu] = $v[$aItemMenu] = ''; // set undefined options
65  $vis = $v["visibility"];
66  if ($vis == POPUP_CTRLACTIVE || $vis == POPUP_CTRLINACTIVE) $other = true;
67  if (($vis != POPUP_ACTIVE && (!$v["submenu"])) || ($vis == POPUP_INVISIBLE || $vis == POPUP_CTRLACTIVE || $vis == POPUP_CTRLINACTIVE)) unset($popup[$k]);
68  else if (($v["url"] == "") && ($v["jsfunction"] == "")) unset($popup[$k]);
69  else {
70  $popup[$k]["menu"] = ($v["submenu"] != "");
71  $popup[$k]["self"] = (($v["target"] == "_self") && ($v["jsfunction"] == "")) ? 'true' : 'false';
72  if ($popup[$k]["menu"]) {
73  $idxmenu = $v["submenu"];
74  if (!isset($mpopup[$idxmenu])) {
75  $mpopup[$idxmenu] = true;
76  $popup[$k] = array(
77  "idlink" => $idxmenu,
78  "descr" => _($v["submenu"]) ,
79  "visibility" => false,
80  "confirm" => "false",
81  "jsfunction" => "false",
82  "isjs" => "false",
83  "title" => _("Click to view menu") ,
84  "barmenu" => false,
85  "m" => "",
86  "url" => "",
87  "target" => "",
88  "mwidth" => "",
89  "mheight" => "",
90  "smid" => "",
91  "menu" => true,
92  "tconfirm" => "",
93  "issubmenu" => false
94  );
95  } else {
96  unset($popup[$k]);
97  }
98  } else {
99  $popup[$k]["idlink"] = $k;
100  if ($v["mwidth"] == "") $popup[$k]["mwidth"] = $action->getParam("FDL_HD2SIZE");
101  if ($v["mheight"] == "") $popup[$k]["mheight"] = $action->getParam("FDL_VD2SIZE");
102  if ($v["target"] == "") $popup[$k]["target"] = "$k$docid";
103  $popup[$k]["descr"] = $v["descr"];
104  $popup[$k]["title"] = ucfirst($v["title"]);
105  $popup[$k]["m"] = ($v["barmenu"] == "true") ? "m" : "";
106  $popup[$k]["isjs"] = ($v["jsfunction"] != "") ? 'true' : 'false';
107  $popup[$k]["confirm"] = ($v["confirm"] == "true") ? 'true' : 'false';
108  $popup[$k]["tconfirm"] = str_replace(array(
109  '"',
110  "'"
111  ) , array(
112  '-',
113  "&rsquo;"
114  ) , $v["tconfirm"]);
115  }
116  }
117  }
118  foreach ($popup as & $elmt) {
119  foreach ($elmt as $k => & $value) {
120  if (is_string($value)) {
121  $value = str_replace("[", "&#091;", htmlspecialchars($value, ENT_QUOTES));
122  }
123  }
124  unset($value);
125  }
126  unset($elmt);
127  $action->lay->set("other", $other);
128  $action->lay->setBlockData("LINKS", $popup);
129  $action->lay->set("id", $doc->id);
130 }
global $action
const POPUP_CTRLINACTIVE
Definition: Class.Doc.php:43
const POPUP_INVISIBLE
Definition: Class.Doc.php:44
viewbarmenu(Action &$action)
Definition: viewbarmenu.php:20
$file
const POPUP_CTRLACTIVE
Definition: Class.Doc.php:42
getpopupdocdetail(Action &$action, $docid)
getpopupfamdetail(Action &$action, $docid)
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
const POPUP_ACTIVE
Definition: Class.Doc.php:41
new_Doc($dbaccess, $id= '', $latest=false)
$dir
Definition: resizeimg.php:144
getParam($name, $def="")
$dbaccess
Definition: checkVault.php:17
$value
← centre documentaire © anakeen