Modules can add menu entries on left menu.
This commit is contained in:
parent
98ebbf7571
commit
debb9cee8a
@ -318,7 +318,14 @@ if (isset($_GET["action"]) && $_GET["action"] == 'create')
|
|||||||
|
|
||||||
// MenuId Parent
|
// MenuId Parent
|
||||||
print '<tr><td><b>'.$langs->trans('MenuIdParent').'</b></td>';
|
print '<tr><td><b>'.$langs->trans('MenuIdParent').'</b></td>';
|
||||||
print '<td><input type="text" size="10" name="menuId" value="'.$parent_rowid.'"></td>';
|
if ($parent_rowid)
|
||||||
|
{
|
||||||
|
print '<td>'.$parent_rowid.'<input type="hidden" size="10" name="menuId" value="'.$parent_rowid.'"></td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<td><input type="text" size="10" name="menuId" value="'.$parent_rowid.'"></td>';
|
||||||
|
}
|
||||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
||||||
|
|
||||||
// Handler
|
// Handler
|
||||||
@ -339,11 +346,19 @@ if (isset($_GET["action"]) && $_GET["action"] == 'create')
|
|||||||
|
|
||||||
// Type
|
// Type
|
||||||
print '<tr><td><b>'.$langs->trans('Type').'</b></td><td>';
|
print '<tr><td><b>'.$langs->trans('Type').'</b></td><td>';
|
||||||
print '<select name="type" class="flat">';
|
if ($parent_rowid)
|
||||||
print '<option value=""> </option>';
|
{
|
||||||
print '<option value="top"'.($_POST["type"] && $_POST["type"]=='top'?' selected="true"':'').'>Top</option>';
|
print 'Left';
|
||||||
print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected="true"':'').'>Left</option>';
|
print '<input type="hidden" name="type" value="left">';
|
||||||
print '</select>';
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<select name="type" class="flat">';
|
||||||
|
print '<option value=""> </option>';
|
||||||
|
print '<option value="top"'.($_POST["type"] && $_POST["type"]=='top'?' selected="true"':'').'>Top</option>';
|
||||||
|
print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected="true"':'').'>Left</option>';
|
||||||
|
print '</select>';
|
||||||
|
}
|
||||||
// print '<input type="text" size="50" name="type" value="'.$type.'">';
|
// print '<input type="text" size="50" name="type" value="'.$type.'">';
|
||||||
print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
|
print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -332,9 +332,10 @@ class Menubase
|
|||||||
* @param unknown_type $mainmenu Value for mainmenu that defined top menu
|
* @param unknown_type $mainmenu Value for mainmenu that defined top menu
|
||||||
* @param unknown_type $leftmenu Value for left that defined leftmenu
|
* @param unknown_type $leftmenu Value for left that defined leftmenu
|
||||||
* @param unknown_type $type_user 0=Internal,1=External,2=All
|
* @param unknown_type $type_user 0=Internal,1=External,2=All
|
||||||
|
* @param menu_handler Name of menu_handler used (auguria, eldy...)
|
||||||
* @return array Menu array completed
|
* @return array Menu array completed
|
||||||
*/
|
*/
|
||||||
function menuLeftCharger($newmenu, $mainmenu, $leftmenu, $type_user)
|
function menuLeftCharger($newmenu, $mainmenu, $leftmenu, $type_user, $menu_handler)
|
||||||
{
|
{
|
||||||
global $langs, $user, $conf;
|
global $langs, $user, $conf;
|
||||||
global $rights; // To export to dol_eval function
|
global $rights; // To export to dol_eval function
|
||||||
@ -349,7 +350,7 @@ class Menubase
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."menu_const as mc ON m.rowid = mc.fk_menu";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."menu_const as mc ON m.rowid = mc.fk_menu";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."menu_constraint as mo ON mc.fk_constraint = mo.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."menu_constraint as mo ON mc.fk_constraint = mo.rowid";
|
||||||
$sql.= " WHERE m.menu_handler in('".$this->menu_handler."','all')";
|
$sql.= " WHERE m.menu_handler in('".$menu_handler."','all')";
|
||||||
if ($type_user == 0) $sql.= " AND m.user in (0,2)";
|
if ($type_user == 0) $sql.= " AND m.user in (0,2)";
|
||||||
if ($type_user == 1) $sql.= " AND m.user in (1,2)";
|
if ($type_user == 1) $sql.= " AND m.user in (1,2)";
|
||||||
// If type_user == 2, no test requires
|
// If type_user == 2, no test requires
|
||||||
@ -372,15 +373,12 @@ class Menubase
|
|||||||
// Define $chaine
|
// Define $chaine
|
||||||
$chaine="";
|
$chaine="";
|
||||||
$title = $langs->trans($menu['titre']);
|
$title = $langs->trans($menu['titre']);
|
||||||
if (! eregi('\(dotnoloadlang\)$',$title))
|
if ($title == $menu['titre'] && ! empty($menu['langs']))
|
||||||
{
|
{
|
||||||
if (! empty($menu['langs'])) $langs->load($menu['langs']);
|
$title = $langs->trans($menu['titre']);
|
||||||
|
$langs->load($menu['langs']);
|
||||||
}
|
}
|
||||||
else
|
if (eregi("/",$title))
|
||||||
{
|
|
||||||
$title=eregi_replace('\(dotnoloadlang\)$','',$title);
|
|
||||||
}
|
|
||||||
if (eregi("/",$title))
|
|
||||||
{
|
{
|
||||||
$tab_titre = explode("/",$title);
|
$tab_titre = explode("/",$title);
|
||||||
$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
|
$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
|
||||||
@ -412,7 +410,6 @@ class Menubase
|
|||||||
$tabMenu[$b][1] = $menu['fk_menu'];
|
$tabMenu[$b][1] = $menu['fk_menu'];
|
||||||
$tabMenu[$b][2] = $menu['url'];
|
$tabMenu[$b][2] = $menu['url'];
|
||||||
$tabMenu[$b][3] = $chaine;
|
$tabMenu[$b][3] = $chaine;
|
||||||
// $tabMenu[$b][4] = $perms;
|
|
||||||
$tabMenu[$b][5] = $menu['target'];
|
$tabMenu[$b][5] = $menu['target'];
|
||||||
$tabMenu[$b][6] = $menu['leftmenu'];
|
$tabMenu[$b][6] = $menu['leftmenu'];
|
||||||
if (! isset($tabMenu[$b][4])) $tabMenu[$b][4] = $perms;
|
if (! isset($tabMenu[$b][4])) $tabMenu[$b][4] = $perms;
|
||||||
@ -429,24 +426,23 @@ class Menubase
|
|||||||
dolibarr_print_error($this->db);
|
dolibarr_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get menutopid
|
// Get menutopid
|
||||||
$sql = "SELECT m.rowid, m.titre, m.type";
|
$sql = "SELECT m.rowid, m.titre, m.type";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
||||||
$sql.= " WHERE m.mainmenu = '".$mainmenu."'";
|
$sql.= " WHERE m.mainmenu = '".$mainmenu."'";
|
||||||
$sql.= " AND m.menu_handler= '".$this->menu_handler."'";
|
$sql.= " AND m.menu_handler in('".$menu_handler."','all')";
|
||||||
$sql.= " AND type = 'top'";
|
$sql.= " AND type = 'top'";
|
||||||
// It should have only one response
|
// It should have only one response
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
$menutop = $this->db->fetch_object($resql);
|
$menutop = $this->db->fetch_object($resql);
|
||||||
$menutopid=$menutop->rowid;
|
$menutopid=$menutop->rowid;
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
//print "menutopid=".$menutopid." sql=".$sql;
|
||||||
|
|
||||||
// Now edit this->newmenu to add entries in data that are in parent sons
|
// Now edit this->newmenu to add entries in tabMenu that are in parent sons
|
||||||
$this->recur($tabMenu, $menutopid, 1);
|
$this->recur($tabMenu, $menutopid, 1);
|
||||||
|
|
||||||
return $this->newmenu;
|
return $this->newmenu;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -470,7 +466,6 @@ class Menubase
|
|||||||
{
|
{
|
||||||
if ($tab[$x][7])
|
if ($tab[$x][7])
|
||||||
{
|
{
|
||||||
|
|
||||||
$leftmenuConstraint = true;
|
$leftmenuConstraint = true;
|
||||||
if ($tab[$x][6])
|
if ($tab[$x][6])
|
||||||
{
|
{
|
||||||
@ -479,6 +474,8 @@ class Menubase
|
|||||||
|
|
||||||
if ($leftmenuConstraint)
|
if ($leftmenuConstraint)
|
||||||
{
|
{
|
||||||
|
// print "x".$pere." ".$tab[$x][6];
|
||||||
|
|
||||||
$this->newmenu->add_submenu(DOL_URL_ROOT . $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]);
|
$this->newmenu->add_submenu(DOL_URL_ROOT . $tab[$x][2], $tab[$x][3], $rang -1, $tab[$x][4], $tab[$x][5]);
|
||||||
$this->recur($tab, $tab[$x][0], $rang +1);
|
$this->recur($tab, $tab[$x][0], $rang +1);
|
||||||
}
|
}
|
||||||
@ -487,53 +484,14 @@ class Menubase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if constraint defined by rowid is ok or not
|
* Verify if condition in string is ok or not
|
||||||
* \TODO Avoid call for each
|
|
||||||
*
|
*
|
||||||
* @param unknown_type $rowid
|
* @param string $strRights
|
||||||
* @param unknown_type $mainmenu
|
* @return boolean true or false
|
||||||
* @param unknown_type $leftmenu
|
|
||||||
* @return unknown
|
|
||||||
*/
|
*/
|
||||||
function verifConstraint($rowid, $mainmenu = "", $leftmenu = "")
|
function verifCond($strRights)
|
||||||
{
|
{
|
||||||
global $user, $conf, $lang;
|
|
||||||
global $constraint; // To export to dol_eval function
|
|
||||||
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/admin.lib.php'); // Because later some eval try to run dynamic call to dolibarr_get_const
|
|
||||||
$constraint = true;
|
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.action";
|
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "menu_constraint as c, " . MAIN_DB_PREFIX . "menu_const as mc";
|
|
||||||
$sql.= " WHERE mc.fk_constraint = c.rowid AND mc.fk_menu = '" . $rowid . "'";
|
|
||||||
|
|
||||||
dolibarr_syslog("Menubase::verifConstraint sql=".$sql);
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
//echo $sql;
|
|
||||||
$num = $this->db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
while (($i < $num) && $constraint == true)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($result);
|
|
||||||
$strconstraint = 'if(!(' . $obj->action . ')) { $constraint = false; }';
|
|
||||||
dol_eval($strconstraint);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $constraint;
|
|
||||||
}
|
|
||||||
|
|
||||||
function verifCond($strRights) {
|
|
||||||
|
|
||||||
global $user,$conf,$lang;
|
global $user,$conf,$lang;
|
||||||
global $rights; // To export to dol_eval function
|
global $rights; // To export to dol_eval function
|
||||||
|
|
||||||
@ -560,7 +518,7 @@ class Menubase
|
|||||||
{
|
{
|
||||||
$sql = "SELECT DISTINCT m.mainmenu";
|
$sql = "SELECT DISTINCT m.mainmenu";
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
$sql.= " FROM " . MAIN_DB_PREFIX . "menu as m";
|
||||||
$sql.= " WHERE m.menu_handler= '".$this->menu_handler."'";
|
$sql.= " WHERE m.menu_handler in ('".$this->menu_handler."','all')";
|
||||||
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res) {
|
if ($res) {
|
||||||
@ -619,14 +577,11 @@ class Menubase
|
|||||||
|
|
||||||
// Define $chaine
|
// Define $chaine
|
||||||
$chaine="";
|
$chaine="";
|
||||||
$title=$objm->titre;
|
$title=$langs->trans($objm->titre);
|
||||||
if (! eregi('\(dotnoloadlang\)$',$title))
|
if ($title == $objm->titre && ! empty($menu['langs']))
|
||||||
{
|
{
|
||||||
if (! empty($objm->langs)) $langs->load($objm->langs);
|
$langs->load($menu['langs']);
|
||||||
}
|
$title=$langs->trans($objm->titre);
|
||||||
else
|
|
||||||
{
|
|
||||||
$title=eregi_replace('\(dotnoloadlang\)$','',$title);
|
|
||||||
}
|
}
|
||||||
if (eregi("/",$title))
|
if (eregi("/",$title))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,7 +61,6 @@ class MenuLeft {
|
|||||||
|
|
||||||
$this->menuArbo = new Menubase($this->db,'auguria','left');
|
$this->menuArbo = new Menubase($this->db,'auguria','left');
|
||||||
$this->overwritemenufor = $this->menuArbo->listeMainmenu();
|
$this->overwritemenufor = $this->menuArbo->listeMainmenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,24 +104,24 @@ class MenuLeft {
|
|||||||
$this->leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:'';
|
$this->leftmenu=isset($_SESSION["leftmenu"])?$_SESSION["leftmenu"]:'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//this->menu_array contains menu in pre.inc.php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On definit newmenu en fonction de mainmenu et leftmenu
|
* On definit newmenu en fonction de mainmenu et leftmenu
|
||||||
* ------------------------------------------------------
|
* ------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
if ($mainmenu)
|
if ($mainmenu)
|
||||||
{
|
{
|
||||||
|
$this->newmenu = $this->menuArbo->menuLeftCharger($this->newmenu,$mainmenu,$this->leftmenu,0,'auguria');
|
||||||
|
|
||||||
$this->newmenu = $this->menuArbo->menuLeftCharger($this->newmenu,$mainmenu,$this->leftmenu,0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menu AUTRES (Pour les menus du haut qui ne serait pas gérés)
|
* Menu AUTRES (Pour les menus du haut qui ne serait pas gérés)
|
||||||
*/
|
*/
|
||||||
|
if ($mainmenu && ! in_array($mainmenu,$this->overwritemenufor)) { $mainmenu=""; }
|
||||||
if ($mainmenu && ! in_array($mainmenu,$this->overwritemenufor)) { $mainmenu=""; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//var_dump($this->newmenu->liste);
|
||||||
|
//var_dump($this->menu_array);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -134,7 +133,6 @@ class MenuLeft {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Affichage du menu
|
// Affichage du menu
|
||||||
$alt=0;
|
$alt=0;
|
||||||
if (! sizeof($this->menu_array))
|
if (! sizeof($this->menu_array))
|
||||||
|
|||||||
@ -23,11 +23,11 @@
|
|||||||
\version $Id$
|
\version $Id$
|
||||||
|
|
||||||
\remarks La construction d'un gestionnaire pour le menu de gauche est simple:
|
\remarks La construction d'un gestionnaire pour le menu de gauche est simple:
|
||||||
\remarks A l'aide d'un objet $newmenu=new Menu() et des m<EFBFBD>thode add et add_submenu,
|
\remarks A l'aide d'un objet $newmenu=new Menu() et des méthode add et add_submenu,
|
||||||
\remarks d<EFBFBD>finir la liste des entr<EFBFBD>es menu <EFBFBD> faire apparaitre.
|
\remarks définir la liste des entrées menu à faire apparaitre.
|
||||||
\remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
|
\remarks En fin de code, mettre la ligne $menu=$newmenu->liste.
|
||||||
\remarks Ce qui est d<EFBFBD>fini dans un tel gestionnaire sera alors prioritaire sur
|
\remarks Ce qui est défini dans un tel gestionnaire sera alors prioritaire sur
|
||||||
\remarks les d<EFBFBD>finitions de menu des fichiers pre.inc.php
|
\remarks les définitions de menu des fichiers pre.inc.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
class MenuLeft {
|
class MenuLeft {
|
||||||
|
|
||||||
var $require_top=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier
|
var $require_top=array("auguria_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu du haut particulier
|
||||||
var $newmenu;
|
var $newmenu;
|
||||||
var $menuArbo;
|
var $menuArbo;
|
||||||
|
|
||||||
@ -111,15 +111,12 @@ class MenuLeft {
|
|||||||
*/
|
*/
|
||||||
if ($mainmenu)
|
if ($mainmenu)
|
||||||
{
|
{
|
||||||
|
$this->newmenu = $this->menuArbo->menuLeftCharger($this->newmenu,$mainmenu,$this->leftmenu,1,'auguria');
|
||||||
$this->newmenu = $this->menuArbo->menuLeftCharger($this->newmenu,$mainmenu,$this->leftmenu,1);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menu AUTRES (Pour les menus du haut qui ne serait pas g<EFBFBD>r<EFBFBD>s)
|
* Menu AUTRES (Pour les menus du haut qui ne serait pas g<EFBFBD>r<EFBFBD>s)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($mainmenu && ! in_array($mainmenu,$this->overwritemenufor)) { $mainmenu=""; }
|
if ($mainmenu && ! in_array($mainmenu,$this->overwritemenufor)) { $mainmenu=""; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -207,88 +204,8 @@ class MenuLeft {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if ($contenu == 1) print '<div class="menu_fin"></div>';
|
if ($contenu == 1) print '<div class="menu_fin"></div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function recur($tab,$pere,$rang)
|
|
||||||
{
|
|
||||||
$leftmenu = $this->leftmenu;
|
|
||||||
//ballayage du tableau
|
|
||||||
for ($x=0;$x<count($tab);$x++) {
|
|
||||||
|
|
||||||
//si un <20>l<EFBFBD>ment a pour p<>re : $pere
|
|
||||||
if ($tab[$x][1]==$pere) {
|
|
||||||
|
|
||||||
//on affiche le menu
|
|
||||||
|
|
||||||
if ($this->verifConstraint($tab[$x][0],$tab[$x][6],$tab[$x][7]) != 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if ($tab[$x][6])
|
|
||||||
{
|
|
||||||
|
|
||||||
$leftmenuConstraint = false;
|
|
||||||
$str = "if(".$tab[$x][6].") \$leftmenuConstraint = true;";
|
|
||||||
|
|
||||||
|
|
||||||
eval($str);
|
|
||||||
if ($leftmenuConstraint == true)
|
|
||||||
{
|
|
||||||
//echo $tab[$x][0].'-'.$tab[$x][6].'-'.$leftmenu.'<br>';
|
|
||||||
$this->newmenu->add_submenu(DOL_URL_ROOT.$tab[$x][2], $tab[$x][3],$rang-1,$tab[$x][4],$tab[$x][5]);
|
|
||||||
$this->recur($tab,$tab[$x][0],$rang+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//echo $tab[$x][0].'-'.$tab[$x][3].'-'.$leftmenu.'<br>';
|
|
||||||
$this->newmenu->add_submenu(DOL_URL_ROOT.$tab[$x][2], $tab[$x][3],$rang-1,$tab[$x][4],$tab[$x][5]);
|
|
||||||
$this->recur($tab,$tab[$x][0],$rang+1);
|
|
||||||
}
|
|
||||||
|
|
||||||
//$this->newmenu->add(DOL_URL_ROOT.$tab[$x][2], $tab[$x][3],$rang-1,$tab[$x][4],$tab[$x][5]);
|
|
||||||
|
|
||||||
/*et on recherche ses fils
|
|
||||||
en rappelant la fonction recur()
|
|
||||||
(+ incr<EFBFBD>mentation du d<EFBFBD>callage)*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function verifConstraint($rowid,$mainmenu,$leftmenu)
|
|
||||||
{
|
|
||||||
global $user,$conf,$user;
|
|
||||||
|
|
||||||
$constraint = true;
|
|
||||||
|
|
||||||
$sql = "SELECT c.rowid, c.action, mc.user FROM ".MAIN_DB_PREFIX."menu_constraint as c, ".MAIN_DB_PREFIX."menu_const as mc WHERE mc.fk_constraint = c.rowid AND (mc.user = 0 OR mc.user = 2 ) AND mc.fk_menu = '".$rowid."'";
|
|
||||||
$result = $this->db->query($sql);
|
|
||||||
|
|
||||||
if ($result)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($result);
|
|
||||||
$i = 0;
|
|
||||||
while (($i < $num) && $constraint == true)
|
|
||||||
{
|
|
||||||
|
|
||||||
$obj = $this->db->fetch_object($result);
|
|
||||||
$strconstraint = "if(!(".$obj->action.")) { \$constraint = false;}";
|
|
||||||
|
|
||||||
eval($strconstraint);
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $constraint;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class MenuLeft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$newmenu = new Menu();
|
$newmenu = new Menu();
|
||||||
$overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools');
|
$overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools','ecm');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On definit newmenu en fonction de mainmenu et leftmenu
|
* On definit newmenu en fonction de mainmenu et leftmenu
|
||||||
@ -866,6 +866,13 @@ class MenuLeft {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Affichage des menus personnalises
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/core/menubase.class.php");
|
||||||
|
|
||||||
|
$menuArbo = new Menubase($this->db,'eldy','left');
|
||||||
|
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,0,'eldy');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menu AUTRES (Pour les menus du haut qui ne serait pas gérés)
|
* Menu AUTRES (Pour les menus du haut qui ne serait pas gérés)
|
||||||
*/
|
*/
|
||||||
@ -874,7 +881,6 @@ class MenuLeft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Si on est sur un cas géré de surcharge du menu, on ecrase celui par defaut
|
* Si on est sur un cas géré de surcharge du menu, on ecrase celui par defaut
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -99,7 +99,7 @@ class MenuLeft {
|
|||||||
|
|
||||||
|
|
||||||
$newmenu = new Menu();
|
$newmenu = new Menu();
|
||||||
$overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools');
|
$overwritemenufor=array('home','companies','members','products','suppliers','commercial','accountancy','agenda','project','tools','ecm');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On definit newmenu en fonction de mainmenu et leftmenu
|
* On definit newmenu en fonction de mainmenu et leftmenu
|
||||||
|
|||||||
@ -14,14 +14,12 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/menus/barre_left/empty.php
|
\file htdocs/includes/menus/barre_left/empty.php
|
||||||
\brief This is an example of an empty left menu handler
|
\brief This is an example of an empty left menu handler
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -739,9 +739,14 @@ class DolibarrModules
|
|||||||
$menu = new Menubase($this->db);
|
$menu = new Menubase($this->db);
|
||||||
$menu->menu_handler='all';
|
$menu->menu_handler='all';
|
||||||
$menu->module=$this->rights_class;
|
$menu->module=$this->rights_class;
|
||||||
if ($this->menu[$key]['fk_menu'])
|
if (! $this->menu[$key]['fk_menu'])
|
||||||
|
{
|
||||||
|
$menu->fk_menu=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$numparent=$this->menu[$key]['fk_menu'];
|
$numparent=$this->menu[$key]['fk_menu'];
|
||||||
|
$numparent=eregi_replace('r=','',$numparent);
|
||||||
if (isset($this->menu[$numparent]['rowid']))
|
if (isset($this->menu[$numparent]['rowid']))
|
||||||
{
|
{
|
||||||
$menu->fk_menu=$this->menu[$numparent]['rowid'];
|
$menu->fk_menu=$this->menu[$numparent]['rowid'];
|
||||||
@ -752,10 +757,6 @@ class DolibarrModules
|
|||||||
$err++;
|
$err++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$menu->fk_menu=0;
|
|
||||||
}
|
|
||||||
$menu->type=$this->menu[$key]['type'];
|
$menu->type=$this->menu[$key]['type'];
|
||||||
$menu->mainmenu=$this->menu[$key]['mainmenu'];
|
$menu->mainmenu=$this->menu[$key]['mainmenu'];
|
||||||
$menu->titre=$this->menu[$key]['titre'];
|
$menu->titre=$this->menu[$key]['titre'];
|
||||||
|
|||||||
@ -123,7 +123,7 @@ class modECM extends DolibarrModules
|
|||||||
|
|
||||||
$this->menu[$r]=array('fk_menu'=>0,
|
$this->menu[$r]=array('fk_menu'=>0,
|
||||||
'type'=>'top',
|
'type'=>'top',
|
||||||
'titre'=>'MenuECM(dotnoloadlang)',
|
'titre'=>'MenuECM',
|
||||||
'mainmenu'=>'ecm',
|
'mainmenu'=>'ecm',
|
||||||
'leftmenu'=>'',
|
'leftmenu'=>'',
|
||||||
'url'=>'/ecm/index.php',
|
'url'=>'/ecm/index.php',
|
||||||
@ -134,6 +134,45 @@ class modECM extends DolibarrModules
|
|||||||
'user'=>0);
|
'user'=>0);
|
||||||
$r++;
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r]=array('fk_menu'=>'r=0',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'MenuECM',
|
||||||
|
'mainmenu'=>'ecm',
|
||||||
|
'leftmenu'=>'',
|
||||||
|
'url'=>'/ecm/index.php',
|
||||||
|
'langs'=>'ecm',
|
||||||
|
'position'=>100,
|
||||||
|
'perms'=>'$user->rights->ecm->read',
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>0);
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r]=array('fk_menu'=>'r=1',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'List',
|
||||||
|
'mainmenu'=>'ecm',
|
||||||
|
'leftmenu'=>'',
|
||||||
|
'url'=>'/ecm/index.php',
|
||||||
|
'langs'=>'ecm',
|
||||||
|
'position'=>100,
|
||||||
|
'perms'=>'$user->rights->ecm->read',
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>0);
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r]=array('fk_menu'=>'r=1',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'ECMNewSection',
|
||||||
|
'mainmenu'=>'ecm',
|
||||||
|
'leftmenu'=>'',
|
||||||
|
'url'=>'/ecm/docdir.php?action=create',
|
||||||
|
'langs'=>'ecm',
|
||||||
|
'position'=>100,
|
||||||
|
'perms'=>'$user->rights->ecm->setup',
|
||||||
|
'target'=>'',
|
||||||
|
'user'=>0);
|
||||||
|
$r++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -419,7 +419,9 @@ TotalMan=Total
|
|||||||
YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary
|
YouCanChangeValuesForThisListFromDictionnarySetup=You can change values for this list from menu setup - dictionnary
|
||||||
Color=Color
|
Color=Color
|
||||||
MenuECM=Documents
|
MenuECM=Documents
|
||||||
|
MenuAWStats=AWStats
|
||||||
MenuMembers=Members
|
MenuMembers=Members
|
||||||
|
MenuAgendaGoogle=Google agenda
|
||||||
# Week day
|
# Week day
|
||||||
Monday=Monday
|
Monday=Monday
|
||||||
Tuesday=Tuesday
|
Tuesday=Tuesday
|
||||||
|
|||||||
@ -418,6 +418,8 @@ TotalMan=Total
|
|||||||
YouCanChangeValuesForThisListFromDictionnarySetup=Puede cambiar estos valores en el menú configuración->diccionarios
|
YouCanChangeValuesForThisListFromDictionnarySetup=Puede cambiar estos valores en el menú configuración->diccionarios
|
||||||
Color=Color
|
Color=Color
|
||||||
MenuECM=Documentos
|
MenuECM=Documentos
|
||||||
|
MenuAWStats=AWStats
|
||||||
|
MenuMembers=Members
|
||||||
# Week day
|
# Week day
|
||||||
Monday=Lunes
|
Monday=Lunes
|
||||||
Tuesday=Martes
|
Tuesday=Martes
|
||||||
|
|||||||
@ -421,7 +421,9 @@ TotalMan=Total
|
|||||||
YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires
|
YouCanChangeValuesForThisListFromDictionnarySetup=Vous pouvez changer ces valeurs depuis le menu configuration - dictionnaires
|
||||||
Color=Couleur
|
Color=Couleur
|
||||||
MenuECM=Documents
|
MenuECM=Documents
|
||||||
|
MenuAWStats=AWStats
|
||||||
MenuMembers=Adhérents
|
MenuMembers=Adhérents
|
||||||
|
MenuAgendaGoogle=Agenda Google
|
||||||
# Week day
|
# Week day
|
||||||
Monday=Lundi
|
Monday=Lundi
|
||||||
Tuesday=Mardi
|
Tuesday=Mardi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user