mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-15 14:01:22 +01:00
New: Add button collapse/expand for menu, category and user views.
This commit is contained in:
20
ChangeLog
20
ChangeLog
@@ -6,15 +6,27 @@ English Dolibarr ChangeLog
|
||||
For users:
|
||||
- New: Some performance enhancements.
|
||||
- New: Can attach files onto trip and expenses modules.
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR
|
||||
- New: Can define a hierarchical responsible on user
|
||||
- New: Merge tab customer and prospect
|
||||
- New: Add ES formated address country rule
|
||||
- New: Add option MAIN_PDF_TITLE_BACKGROUND_COLOR.
|
||||
- New: Merge tab customer and prospect.
|
||||
- New: Add ES formated address country rule.
|
||||
- New: Can define a hierarchical responsible on user.
|
||||
- New: Add a hierarchical view for users.
|
||||
- New: Can expand/collapse menus, categories and users list.
|
||||
- New: extra parameters are supported into ODT templates.
|
||||
- New: total per vat rate are available as tags for ODT templates.
|
||||
- New: Add more types for extra parameters (lists, phone, emails, checkbox, prices)
|
||||
- New: Some part of interface use more CSS3 (ie: agenda)
|
||||
|
||||
For developers:
|
||||
- System of menu managers has been rewritten to reduce code to do same things.
|
||||
- An external module can force its theme.
|
||||
- Add function dol_set_focus('#xxx').
|
||||
- A mymodule can bring its own core/modules/mymodule/modules_mymodule.php file.
|
||||
- Removed not used libraries.
|
||||
- More web services.
|
||||
- Renamed some french fields into english.
|
||||
- First change to manage margins on contracts.
|
||||
- Add hook getFormMail.
|
||||
|
||||
For translators:
|
||||
- Update language files.
|
||||
|
||||
@@ -209,8 +209,8 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes')
|
||||
$form=new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js?lang='.$langs->defaultlang);
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css?lang='.$langs->defaultlang);
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
|
||||
llxHeader('',$langs->trans("Menus"),'','',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
|
||||
@@ -52,7 +52,11 @@ elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea");
|
||||
elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea");
|
||||
else $title=$langs->trans("CategoriesArea");
|
||||
|
||||
llxHeader("","",$title);
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
|
||||
llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
|
||||
print_fiche_titre($title);
|
||||
|
||||
@@ -128,187 +132,56 @@ $cate_arbo = $categstatic->get_full_arbo($type);
|
||||
// Define fulltree array
|
||||
$fulltree=$cate_arbo;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td colspan="3">'.$langs->trans("Description").'</td></tr>';
|
||||
|
||||
|
||||
// ----- This section will show a tree from a fulltree array -----
|
||||
// $section must also be defined
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
// Root title line
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
|
||||
print '<td align="left" width="24">';
|
||||
print img_picto_common('','treemenu/base.gif');
|
||||
print '</td><td align="left">'.$langs->trans("AllCats");
|
||||
print '</td>';
|
||||
print '</tr></table></td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
//print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
// Define fullpathselected ( _x_y_z ) of $section parameter
|
||||
$fullpathselected='';
|
||||
if (! empty($section))
|
||||
{
|
||||
// Define data (format for treeview)
|
||||
$data=array();
|
||||
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
|
||||
foreach($fulltree as $key => $val)
|
||||
{
|
||||
//print $val['id']."-".$section."<br>";
|
||||
if ($val['id'] == $section)
|
||||
{
|
||||
$fullpathselected=$val['fullpath'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//print "fullpathselected=".$fullpathselected."<br>";
|
||||
|
||||
// Update expandedsectionarray in session
|
||||
$expandedsectionarray=array();
|
||||
if (isset($_SESSION['dol_catexpandedsectionarray'.$type])) $expandedsectionarray=explode(',',$_SESSION['dol_catexpandedsectionarray'.$type]);
|
||||
|
||||
if (! empty($section) && $_GET['sectionexpand'] == 'true')
|
||||
{
|
||||
// We add all sections that are parent of opened section
|
||||
$pathtosection=explode('_',$fullpathselected);
|
||||
foreach($pathtosection as $idcursor)
|
||||
{
|
||||
if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array
|
||||
{
|
||||
$expandedsectionarray[]=$idcursor;
|
||||
}
|
||||
}
|
||||
$_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray);
|
||||
}
|
||||
if (! empty($section) && $_GET['sectionexpand'] == 'false')
|
||||
{
|
||||
// We removed all expanded sections that are child of the closed section
|
||||
$oldexpandedsectionarray=$expandedsectionarray;
|
||||
$expandedsectionarray=array();
|
||||
foreach($oldexpandedsectionarray as $sectioncursor)
|
||||
{
|
||||
// is_in_subtree(fulltree,sectionparent,sectionchild)
|
||||
if ($sectioncursor && ! is_in_subtree($fulltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor;
|
||||
}
|
||||
$_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray);
|
||||
}
|
||||
//print $_SESSION['dol_catexpandedsectionarray'.$type].'<br>';
|
||||
|
||||
$nbofentries=0;
|
||||
$oldvallevel=0;
|
||||
$var=true;
|
||||
foreach($fulltree as $key => $val)
|
||||
{
|
||||
//$fullpathparent=preg_replace('/_[^_]+$/i','',$val['fullpath']);
|
||||
|
||||
// Define showline
|
||||
$showline=0;
|
||||
|
||||
//var_dump($expandedsectionarray);
|
||||
|
||||
// If directory is son of expanded directory, we show line
|
||||
if (isset($val['fk_parent']) && in_array($val['fk_parent'],$expandedsectionarray)) $showline=4;
|
||||
// If directory is parent of selected directory or is selected directory, we show line
|
||||
elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2;
|
||||
// If we are level one we show line
|
||||
elseif ($val['level'] < 2) $showline=1;
|
||||
//print 'xxx '.$val['level'].' - '.$fullpathselected.' - '.$val['fullpath'].' - '.$val['fk_parent'].' showline='.$showline.'<br>'."\n";
|
||||
|
||||
if ($showline)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
|
||||
else $option='indexnotexpanded';
|
||||
//print $option;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show tree graph pictos
|
||||
print '<td align="left">';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
|
||||
$resarray=tree_showpad($fulltree,$key);
|
||||
$a=$resarray[0];
|
||||
$nbofsubdir=$resarray[1];
|
||||
$nboffilesinsubdir=$resarray[2];
|
||||
print '</td>';
|
||||
|
||||
// Show picto
|
||||
print '<td valign="top">';
|
||||
//print $val['fullpath']."(".$showline.")";
|
||||
$n='2';
|
||||
if (! in_array($val['id'],$expandedsectionarray)) $n='3';
|
||||
if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1);
|
||||
else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1);
|
||||
if ($option == 'indexexpanded') $lien = '<a href="'.$_SERVER["PHP_SELF"].'?section='.$val['id'].'&type='.$type.'&sectionexpand=false">';
|
||||
if ($option == 'indexnotexpanded') $lien = '<a href="'.$_SERVER["PHP_SELF"].'?section='.$val['id'].'&type='.$type.'&sectionexpand=true">';
|
||||
$newref=str_replace('_',' ',$ref);
|
||||
$lienfin='</a>';
|
||||
print $lien.$newref.$lienfin;
|
||||
if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category');
|
||||
else print img_picto('','object_category-expanded');
|
||||
print '</td>';
|
||||
// Show link
|
||||
print '<td valign="middle">';
|
||||
//if ($section == $val['id']) print ' <u>';
|
||||
// We don't want a link ... why ?
|
||||
$categstatic->id=$val['id'];
|
||||
$categstatic->ref=$val['label'];
|
||||
$categstatic->type=$type;
|
||||
print ' '.$categstatic->getNomUrl(0,'',60);
|
||||
$li=$categstatic->getNomUrl(1,'',60);
|
||||
|
||||
//print ' '.dol_trunc($val['label'],28);
|
||||
//if ($section == $val['id']) print '</u>';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print "</td>\n";
|
||||
|
||||
// Description
|
||||
print '<td>';
|
||||
print dol_trunc($val['description'],48);
|
||||
print '</td>';
|
||||
|
||||
// Link to category card
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td align="right"> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$oldvallevel=$val['level'];
|
||||
$nbofentries++;
|
||||
$data[] = array(
|
||||
'rowid'=>$val['rowid'],
|
||||
'fk_menu'=>$val['fk_parent'],
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.
|
||||
'</td><td width="50%">'.
|
||||
' '.$val['description'].'</td>'.
|
||||
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
||||
'</tr></table>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// If nothing to show
|
||||
if ($nbofentries == 0)
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td>'.$langs->trans("Description").'</td><td align="right"><div id="iddivjstreecontrol"><a href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a>';
|
||||
print ' | <a href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div></td></tr>';
|
||||
|
||||
$nbofentries=(count($data) - 1);
|
||||
|
||||
if ($nbofentries > 0)
|
||||
{
|
||||
print '<tr><td colspan="3">';
|
||||
tree_recur($data,$data[0],0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="left"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
|
||||
print '<td>'.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).'</td>';
|
||||
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
|
||||
print '<td valign="middle">';
|
||||
print $langs->trans("NoCategoryYet");
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</table></td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// ----- End of section -----
|
||||
// --------------------------
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@@ -23,55 +23,7 @@
|
||||
*/
|
||||
|
||||
|
||||
// ------------------------------- Used by category tree view -----------------
|
||||
|
||||
/**
|
||||
* Return if a child id is in descendance of parentid
|
||||
*
|
||||
* @param array $fulltree Full tree. Tree must be an array of records that looks like:
|
||||
* id = id record
|
||||
* id_mere = id record mother
|
||||
* id_children = array of direct child id
|
||||
* label = record label
|
||||
* fullpath = Full path of id
|
||||
* level = Level of record
|
||||
* @param int $parentid Parent id
|
||||
* @param int $childid Child id
|
||||
* @return int 1=Yes, 0=No
|
||||
*/
|
||||
function is_in_subtree($fulltree,$parentid,$childid)
|
||||
{
|
||||
if ($parentid == $childid) return 1;
|
||||
|
||||
// Get fullpath of parent
|
||||
$fullpathparent='';
|
||||
foreach($fulltree as $key => $val)
|
||||
{
|
||||
//print $val['id']."-".$section."<br>";
|
||||
if ($val['id'] == $parentid)
|
||||
{
|
||||
$fullpathparent=$val['fullpath'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
//print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'<br>';
|
||||
|
||||
foreach($fulltree as $record)
|
||||
{
|
||||
if ($record['id'] == $childid)
|
||||
{
|
||||
//print $record['fullpath'].'_'.' - '.$fullpathparent.'_';
|
||||
if (preg_match('/'.$fullpathparent.'_/i',$record['fullpath'].'_'))
|
||||
{
|
||||
//print 'DEL='.$childid;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ------------------------------- Used by ajax tree view -----------------
|
||||
|
||||
/**
|
||||
* Show indent and picto of a tree line. Return array with information of line.
|
||||
@@ -145,11 +97,16 @@ function tree_showpad(&$fulltree,$key,$silent=0)
|
||||
// ------------------------------- Used by menu editor -----------------
|
||||
|
||||
/**
|
||||
* Recursive function to output menu tree. <ul><li>...</li></ul>
|
||||
* Recursive function to output menu tree. <ul id="iddivjstree"><li>...</li></ul>
|
||||
* Note: To have this function working, check you have loaded the js and css for treeview.
|
||||
* $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js',
|
||||
* '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
* $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
*
|
||||
* @param array $tab Array of all elements
|
||||
* @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>)
|
||||
* @param int $rang Level of element
|
||||
* @param string $iddivjstree Id to use for parent ul element
|
||||
* @return void
|
||||
*/
|
||||
function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
|
||||
@@ -162,13 +119,16 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree')
|
||||
$("#'.$iddivjstree.'").treeview({
|
||||
collapsed: true,
|
||||
animated: "fast",
|
||||
persist: "location",
|
||||
control: "#'.$iddivjstree.'control"
|
||||
persist: "cookie",
|
||||
control: "#'.$iddivjstree.'control",
|
||||
toggle: function() {
|
||||
/* window.console && console.log("%o was toggled", this); */
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>';
|
||||
|
||||
print '<ul id="'.$iddivjstree.'" style="min-height:300px;">';
|
||||
print '<ul id="'.$iddivjstree.'">';
|
||||
}
|
||||
|
||||
if ($rang > 10) return; // Protection contre boucle infinie
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Cookie plugin
|
||||
*
|
||||
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a cookie with the given name and value and other optional parameters.
|
||||
*
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Set the value of a cookie.
|
||||
* @example $.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});
|
||||
* @desc Create a cookie with all available options.
|
||||
* @example $.cookie('the_cookie', 'the_value');
|
||||
* @desc Create a session cookie.
|
||||
* @example $.cookie('the_cookie', null);
|
||||
* @desc Delete a cookie by passing null as value.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @param String value The value of the cookie.
|
||||
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
||||
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
||||
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
||||
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
||||
* when the the browser exits.
|
||||
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
||||
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
||||
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
||||
* require a secure protocol (like HTTPS).
|
||||
* @type undefined
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of a cookie with the given name.
|
||||
*
|
||||
* @example $.cookie('the_cookie');
|
||||
* @desc Get the value of a cookie.
|
||||
*
|
||||
* @param String name The name of the cookie.
|
||||
* @return The value of the cookie.
|
||||
* @type String
|
||||
*
|
||||
* @name $.cookie
|
||||
* @cat Plugins/Cookie
|
||||
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
||||
*/
|
||||
jQuery.cookie = function(name, value, options) {
|
||||
if (typeof value != 'undefined') { // name and value given, set cookie
|
||||
options = options || {};
|
||||
if (value === null) {
|
||||
value = '';
|
||||
options.expires = -1;
|
||||
}
|
||||
var expires = '';
|
||||
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
|
||||
var date;
|
||||
if (typeof options.expires == 'number') {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
|
||||
} else {
|
||||
date = options.expires;
|
||||
}
|
||||
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
|
||||
}
|
||||
var path = options.path ? '; path=' + options.path : '';
|
||||
var domain = options.domain ? '; domain=' + options.domain : '';
|
||||
var secure = options.secure ? '; secure' : '';
|
||||
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
|
||||
} else { // only name given, get cookie
|
||||
var cookieValue = null;
|
||||
if (document.cookie && document.cookie != '') {
|
||||
var cookies = document.cookie.split(';');
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
var cookie = jQuery.trim(cookies[i]);
|
||||
// Does this cookie string begin with the name we want?
|
||||
if (cookie.substring(0, name.length + 1) == (name + '=')) {
|
||||
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
};
|
||||
@@ -44,4 +44,4 @@ alter table llx_extrafields add column param text after pos;
|
||||
alter table llx_propal CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer;
|
||||
alter table llx_commande CHANGE COLUMN fk_adresse_livraison fk_delivery_address integer;
|
||||
alter table llx_don CHANGE COLUMN adresse address text;
|
||||
|
||||
alter table llx_adherent CHANGE COLUMN adresse address text;
|
||||
|
||||
@@ -1785,7 +1785,7 @@ class User extends CommonObject
|
||||
/**
|
||||
* Retourne le libelle du statut d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
@@ -2191,7 +2191,7 @@ class User extends CommonObject
|
||||
$this->load_parentof();
|
||||
|
||||
// Init $this->users array
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.name, u.fk_user"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql = "SELECT DISTINCT u.rowid, u.firstname, u.name, u.fk_user, u.login, u.statut"; // Distinct reduce pb with old tables with duplicates
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
|
||||
|
||||
@@ -2204,9 +2204,11 @@ class User extends CommonObject
|
||||
{
|
||||
$this->users[$obj->rowid]['rowid'] = $obj->rowid;
|
||||
$this->users[$obj->rowid]['id'] = $obj->rowid;
|
||||
$this->users[$obj->rowid]['fk_user'] = $obj->fk_parent;
|
||||
$this->users[$obj->rowid]['fk_user'] = $obj->fk_user;
|
||||
$this->users[$obj->rowid]['firstname'] = $obj->firstname;
|
||||
$this->users[$obj->rowid]['name'] = $obj->name;
|
||||
$this->users[$obj->rowid]['login'] = $obj->login;
|
||||
$this->users[$obj->rowid]['statut'] = $obj->statut;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -2297,7 +2299,7 @@ class User extends CommonObject
|
||||
{
|
||||
print 'id: '.$this->users[$key]['id'];
|
||||
print ' name: '.$this->users[$key]['name'];
|
||||
print ' parent: '.$this->users[$key]['fk_parent'];
|
||||
print ' parent: '.$this->users[$key]['fk_user'];
|
||||
print ' fullpath: '.$this->users[$key]['fullpath'];
|
||||
print ' fullname: '.$this->users[$key]['fullname'];
|
||||
print "<br>\n";
|
||||
|
||||
@@ -53,9 +53,12 @@ $companystatic = new Societe($db);
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '<form action="'.DOL_URL_ROOT.'/user/index.php" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("List")).'"></form>');
|
||||
llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss);
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '<form action="'.DOL_URL_ROOT.'/user/index.php" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("ViewList")).'"></form>');
|
||||
|
||||
|
||||
|
||||
@@ -65,186 +68,54 @@ $user_arbo = $userstatic->get_full_tree();
|
||||
// Define fulltree array
|
||||
$fulltree=$user_arbo;
|
||||
|
||||
print '<table class="liste" width="100%">';
|
||||
|
||||
|
||||
// ----- This section will show a tree from a fulltree array -----
|
||||
// $section must also be defined
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
// Root title line
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
|
||||
print '<td align="left" width="24">';
|
||||
print img_picto_common('','treemenu/base.gif');
|
||||
print '</td><td align="left">'.$langs->trans("All");
|
||||
print '</td>';
|
||||
print '</tr></table></td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
//print '<td align="right"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
|
||||
// Define fullpathselected ( _x_y_z ) of $section parameter
|
||||
$fullpathselected='';
|
||||
if (! empty($section))
|
||||
{
|
||||
// Define data (format for treeview)
|
||||
$data=array();
|
||||
$data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>'');
|
||||
foreach($fulltree as $key => $val)
|
||||
{
|
||||
//print $val['id']."-".$section."<br>";
|
||||
if ($val['id'] == $section)
|
||||
{
|
||||
$fullpathselected=$val['fullpath'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//print "fullpathselected=".$fullpathselected."<br>";
|
||||
|
||||
// Update expandedsectionarray in session
|
||||
$expandedsectionarray=array();
|
||||
if (isset($_SESSION['dol_catexpandedsectionarray'.$type])) $expandedsectionarray=explode(',',$_SESSION['dol_catexpandedsectionarray'.$type]);
|
||||
|
||||
if (! empty($section) && $_GET['sectionexpand'] == 'true')
|
||||
{
|
||||
// We add all sections that are parent of opened section
|
||||
$pathtosection=explode('_',$fullpathselected);
|
||||
foreach($pathtosection as $idcursor)
|
||||
{
|
||||
if ($idcursor && ! in_array($idcursor,$expandedsectionarray)) // Not already in array
|
||||
{
|
||||
$expandedsectionarray[]=$idcursor;
|
||||
}
|
||||
}
|
||||
$_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray);
|
||||
}
|
||||
if (! empty($section) && $_GET['sectionexpand'] == 'false')
|
||||
{
|
||||
// We removed all expanded sections that are child of the closed section
|
||||
$oldexpandedsectionarray=$expandedsectionarray;
|
||||
$expandedsectionarray=array();
|
||||
foreach($oldexpandedsectionarray as $sectioncursor)
|
||||
{
|
||||
// is_in_subtree(fulltree,sectionparent,sectionchild)
|
||||
if ($sectioncursor && ! is_in_subtree($fulltree,$section,$sectioncursor)) $expandedsectionarray[]=$sectioncursor;
|
||||
}
|
||||
$_SESSION['dol_catexpandedsectionarray'.$type]=join(',',$expandedsectionarray);
|
||||
}
|
||||
//print $_SESSION['dol_catexpandedsectionarray'.$type].'<br>';
|
||||
|
||||
$nbofentries=0;
|
||||
$oldvallevel=0;
|
||||
$var=true;
|
||||
foreach($fulltree as $key => $val)
|
||||
{
|
||||
//$fullpathparent=preg_replace('/_[^_]+$/i','',$val['fullpath']);
|
||||
|
||||
// Define showline
|
||||
$showline=0;
|
||||
|
||||
//var_dump($expandedsectionarray);
|
||||
|
||||
// If directory is son of expanded directory, we show line
|
||||
if (isset($val['fk_parent']) && in_array($val['fk_parent'],$expandedsectionarray)) $showline=4;
|
||||
// If directory is parent of selected directory or is selected directory, we show line
|
||||
elseif (preg_match('/'.$val['fullpath'].'_/i',$fullpathselected.'_')) $showline=2;
|
||||
// If we are level one we show line
|
||||
elseif ($val['level'] < 2) $showline=1;
|
||||
//print 'xxx '.$val['level'].' - '.$fullpathselected.' - '.$val['fullpath'].' - '.$val['fk_parent'].' showline='.$showline.'<br>'."\n";
|
||||
|
||||
if ($showline)
|
||||
{
|
||||
$var=!$var;
|
||||
|
||||
if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
|
||||
else $option='indexnotexpanded';
|
||||
//print $option;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show tree graph pictos
|
||||
print '<td align="left">';
|
||||
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
|
||||
$resarray=tree_showpad($fulltree,$key);
|
||||
$a=$resarray[0];
|
||||
$nbofsubdir=$resarray[1];
|
||||
$nboffilesinsubdir=$resarray[2];
|
||||
print '</td>';
|
||||
|
||||
// Show picto
|
||||
print '<td valign="top">';
|
||||
//print $val['fullpath']."(".$showline.")";
|
||||
$n='2';
|
||||
if (! in_array($val['id'],$expandedsectionarray)) $n='3';
|
||||
if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1);
|
||||
else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1);
|
||||
if ($option == 'indexexpanded') $lien = '<a href="'.$_SERVER["PHP_SELF"].'?section='.$val['id'].'&type='.$type.'&sectionexpand=false">';
|
||||
if ($option == 'indexnotexpanded') $lien = '<a href="'.$_SERVER["PHP_SELF"].'?section='.$val['id'].'&type='.$type.'&sectionexpand=true">';
|
||||
$newref=str_replace('_',' ',$ref);
|
||||
$lienfin='</a>';
|
||||
print $lien.$newref.$lienfin;
|
||||
if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category');
|
||||
else print img_picto('','object_category-expanded');
|
||||
print '</td>';
|
||||
// Show link
|
||||
print '<td valign="middle">';
|
||||
//if ($section == $val['id']) print ' <u>';
|
||||
// We don't want a link ... why ?
|
||||
$userstatic->id=$val['id'];
|
||||
$userstatic->ref=$val['label'];
|
||||
$userstatic->type=$type;
|
||||
print ' '.$userstatic->getNomUrl(0,'',60);
|
||||
$userstatic->firstname=$val['firstname'];
|
||||
$userstatic->lastname=$val['name'];
|
||||
$userstatic->statut=$val['statut'];
|
||||
$li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')';
|
||||
|
||||
//print ' '.dol_trunc($val['label'],28);
|
||||
//if ($section == $val['id']) print '</u>';
|
||||
print '</td>';
|
||||
print '</tr></table>';
|
||||
print "</td>\n";
|
||||
|
||||
// Description
|
||||
print '<td>';
|
||||
print dol_trunc($val['description'],48);
|
||||
print '</td>';
|
||||
|
||||
// Link to category card
|
||||
print '<td align="right"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>';
|
||||
|
||||
// Add link
|
||||
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
|
||||
//print '<td align="right"> </td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$oldvallevel=$val['level'];
|
||||
$nbofentries++;
|
||||
$data[] = array(
|
||||
'rowid'=>$val['rowid'],
|
||||
'fk_menu'=>$val['fk_user'],
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.$li.'</td><td align="right">'.$userstatic->getLibStatut(5).'</td></tr></table>'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// If nothing to show
|
||||
if ($nbofentries == 0)
|
||||
print '<table class="liste" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("HierarchicView").'</td><td></td><td align="right"><div id="iddivjstreecontrol"><a href="#">'.img_picto('','object_category').' '.$langs->trans("UndoExpandAll").'</a>';
|
||||
print ' | <a href="#">'.img_picto('','object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div></td></tr>';
|
||||
|
||||
$nbofentries=(count($data) - 1);
|
||||
|
||||
if ($nbofentries > 0)
|
||||
{
|
||||
print '<tr><td colspan="3">';
|
||||
tree_recur($data,$data[0],0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="left"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
|
||||
print '<td>'.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).'</td>';
|
||||
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
|
||||
print '<td valign="middle">';
|
||||
print $langs->trans("NoCategoryYet");
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '</table></td>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// ----- End of section -----
|
||||
// --------------------------
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user