17 include_once
"GENERIC/family_defaultmenu.php";
23 $action->parent->addJsRef(
'lib/jquery/jquery.js');
24 $action->parent->addJsRef(
'GENERIC:generic_list.js');
26 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.core.js',
false,
$packName);
27 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.widget.js',
false,
$packName);
28 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.position.js',
false,
$packName);
29 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.button.js',
false,
$packName);
30 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.menu.js',
false,
$packName);
31 $action->parent->addJsRef(
'lib/jquery-ui/devel-src/ui/jquery.ui.menubar.js',
false,
$packName);
33 $action->parent->addCssRef(
'lib/jquery-ui/devel-src/themes/base/jquery.ui.all.css');
37 $action->lay->set(
"famid", $action->
getArgument(
"famid"));
45 $sql = sprintf(
"SELECT val from paramv where name = 'ONEFAM_MENU' and appid = (select id from application where name='%s')", pg_escape_string($onefam));
50 $confOnefam = json_decode($onefamMenu,
true);
52 if (!isset($confOnefam[
"families"][$famName])) {
55 $specMenu = $confOnefam[
"families"][$famName];
56 if (!$specMenu)
return $defaultMenu;
57 $standardMenu = $specMenu[
"standardMenu"];
60 foreach ($standardMenu as $idMenu => $aMenu) {
61 if ($defaultMenu[$idMenu]) {
62 if ($aMenu[
"deleted"] ==
"all") {
63 $defaultMenu[$idMenu][
"items"] = array();
65 if (is_array($aMenu[
"deleted"])) {
66 foreach ($aMenu[
"deleted"] as $kMenu) {
67 unset($defaultMenu[$idMenu][
"items"][$kMenu]);
70 if (isset($aMenu[
"custom"]) && is_array($aMenu[
"custom"])) {
71 $defaultMenu[$idMenu][
"items"] = array_merge($defaultMenu[$idMenu][
"items"], $aMenu[
"custom"]);
73 if (count($defaultMenu[$idMenu][
"items"]) == 0) {
74 $defaultMenu[$idMenu] = array();
77 addWarningMsg(sprintf(
"custom menu : standard menu '%s' not exists", $idMenu));
81 $customMenu = (isset($specMenu[
"customMenu"]) ? $specMenu[
"customMenu"] : null);
82 if (is_array($customMenu)) {
83 foreach ($customMenu as $kc => $cMenu) {
84 if (!empty($cMenu[
"before"])) {
86 foreach ($defaultMenu as $kd => $dMenu) {
87 if ($kd == $cMenu[
"before"]) {
88 $tmpMenu[$kc] = $cMenu;
90 $tmpMenu[$kd] = $dMenu;
92 $defaultMenu = $tmpMenu;
94 $defaultMenu[$kc] = $cMenu;
97 $defaultMenu = array_merge($defaultMenu, $customMenu);
114 $htmlReturn =
'<ul>';
116 foreach ($menulist as $k => $aMenu) {
117 if (!empty($aMenu[
"items"])) {
119 foreach ($aMenu as $ki => $item) {
120 if ($ki !=
"items" && $ki !=
"label") {
121 $attrs.= sprintf(
' %s="%s" ', $ki, $item);
124 $label = !empty($aMenu[
"label"]) ? _($aMenu[
"label"]) :
"";
125 $htmlReturn.= sprintf(
'<li><a href="#%s"%s>%s</a>', $k, $attrs,
mb_ucfirst($label));
129 $noanchor = (empty($aMenu[
"url"])) && (empty($aMenu[
"href"]));
130 $htmlReturn.=
"\n<li";
132 $htmlReturn.=
" level=\"$level\" ";
135 if (!empty($aMenu[
"url"])) {
136 $aMenu[
"href"] = $aMenu[
"url"];
138 $htmlReturn.=
'><div role="button" class="div-button ui-button-text-only ui-button ui-widget ui-button-text-only ui-menubar-link" ';
142 $htmlReturn.=
"><a class='ui-button-text' ";
147 foreach ($aMenu as $ki => $item) {
148 if ($ki !=
"label") {
149 $htmlReturn.= sprintf(
' %s="%s" ', $ki, $item);
153 if (!empty($aMenu[
"label"])) {
158 $htmlReturn.=
"</a> ";
161 $htmlReturn.=
'</div>';
164 $htmlReturn.=
"</li>\n";
167 $htmlReturn.=
"</ul>\n";
getNameFromId($dbaccess, $id)
static getArgument($k, $def= '')
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if(!isset($query[$parms['q']])) if($parms['desc']!= 'desc'&&$parms['desc']!= 'asc') $menu