diff --git a/ChangeLog b/ChangeLog
index bf58724de36..f1a44ef58e0 100644
--- a/ChangeLog
+++ b/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.
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index f0ba051450c..5a042a65679 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -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);
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index c9102fdaa17..520619580a9 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -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;
+// 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)
+{
+ $categstatic->id=$val['id'];
+ $categstatic->ref=$val['label'];
+ $categstatic->type=$type;
+ $li=$categstatic->getNomUrl(1,'',60);
+
+ $data[] = array(
+ 'rowid'=>$val['rowid'],
+ 'fk_menu'=>$val['fk_parent'],
+ 'entry'=>'
'
+ );
+}
+
+
print '';
-print '| '.$langs->trans("Categories").' | '.$langs->trans("Description").' |
';
+print '| '.$langs->trans("Categories").' | '.$langs->trans("Description").' | |
';
+$nbofentries=(count($data) - 1);
-// ----- This section will show a tree from a fulltree array -----
-// $section must also be defined
-// ---------------------------------------------------------------
-
-
-// Root title line
-print '';
-print '';
-print '| ';
-print img_picto_common('','treemenu/base.gif');
-print ' | '.$langs->trans("AllCats");
-print ' | ';
-print '
| ';
-print ' | ';
-print ' | ';
-//print ' | ';
-print '
';
-
-
-
-// Define fullpathselected ( _x_y_z ) of $section parameter
-$fullpathselected='';
-if (! empty($section))
+if ($nbofentries > 0)
{
- foreach($fulltree as $key => $val)
- {
- //print $val['id']."-".$section."
";
- if ($val['id'] == $section)
- {
- $fullpathselected=$val['fullpath'];
- break;
- }
- }
+ print '| ';
+ tree_recur($data,$data[0],0);
+ print ' |
';
}
-//print "fullpathselected=".$fullpathselected."
";
-
-// Update expandedsectionarray in session
-$expandedsectionarray=array();
-if (isset($_SESSION['dol_catexpandedsectionarray'.$type])) $expandedsectionarray=explode(',',$_SESSION['dol_catexpandedsectionarray'.$type]);
-
-if (! empty($section) && $_GET['sectionexpand'] == 'true')
+else
{
- // 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].'
';
-
-$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.'
'."\n";
-
- if ($showline)
- {
- $var=!$var;
-
- if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
- else $option='indexnotexpanded';
- //print $option;
-
- print "";
-
- // Show tree graph pictos
- print '';
- print '| ';
- $resarray=tree_showpad($fulltree,$key);
- $a=$resarray[0];
- $nbofsubdir=$resarray[1];
- $nboffilesinsubdir=$resarray[2];
- print ' | ';
-
- // Show picto
- print '';
- //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 = '';
- if ($option == 'indexnotexpanded') $lien = '';
- $newref=str_replace('_',' ',$ref);
- $lienfin='';
- print $lien.$newref.$lienfin;
- if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category');
- else print img_picto('','object_category-expanded');
- print ' | ';
- // Show link
- print '';
- //if ($section == $val['id']) print ' ';
- // We don't want a link ... why ?
- $categstatic->id=$val['id'];
- $categstatic->ref=$val['label'];
- $categstatic->type=$type;
- print ' '.$categstatic->getNomUrl(0,'',60);
-
- //print ' '.dol_trunc($val['label'],28);
- //if ($section == $val['id']) print '';
- print ' | ';
- print ' ';
- print " | \n";
-
- // Description
- print '';
- print dol_trunc($val['description'],48);
- print ' | ';
-
- // Link to category card
- print ''.img_view().' | ';
-
- // Add link
- //print ''.img_edit_add().' | ';
- //print ' | ';
-
- print "
\n";
- }
-
- $oldvallevel=$val['level'];
- $nbofentries++;
-}
-
-
-// If nothing to show
-if ($nbofentries == 0)
-{
- print '';
- print '| '.img_picto_common('','treemenu/branchbottom.gif').' | ';
- print ''.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).' | ';
- print '';
- print $langs->trans("NoCategoryYet");
- print ' | ';
- print ' | ';
- print '
| ';
- print ' | ';
- print '
';
-}
-
-// ----- End of section -----
-// --------------------------
+ print '';
+ print '| '.img_picto_common('','treemenu/branchbottom.gif').' | ';
+ print '';
+ print $langs->trans("NoCategoryYet");
+ print ' | ';
+ print ' | ';
+ print '
| ';
+ print '
';
+}
print "
";
llxFooter();
+
$db->close();
?>
diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php
index 65b2ca5d502..f565467575e 100644
--- a/htdocs/core/lib/treeview.lib.php
+++ b/htdocs/core/lib/treeview.lib.php
@@ -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."
";
- if ($val['id'] == $parentid)
- {
- $fullpathparent=$val['fullpath'];
- break;
- }
- }
- //print '> parent='.$parentid.' - child='.$childid.' - '.$fullpathparent.'
';
-
- 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.
+ * Recursive function to output menu tree.
+ * 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 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); */
+ }
});
})
';
- print '';
+ print '';
}
if ($rang > 10) return; // Protection contre boucle infinie
diff --git a/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js b/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js
new file mode 100644
index 00000000000..8e8e1d9e01f
--- /dev/null
+++ b/htdocs/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js
@@ -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;
+ }
+};
\ No newline at end of file
diff --git a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
index f7fe723b9b6..cad2ac40bb4 100755
--- a/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
+++ b/htdocs/install/mysql/migration/3.3.0-3.4.0.sql
@@ -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;
diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php
index 59641c1bbc1..5569f1b6784 100644
--- a/htdocs/user/class/user.class.php
+++ b/htdocs/user/class/user.class.php
@@ -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 "
\n";
diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php
index f95d877859b..ad5584483fc 100644
--- a/htdocs/user/hierarchy.php
+++ b/htdocs/user/hierarchy.php
@@ -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');
+
+llxHeader('',$langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')','','',0,0,$arrayofjs,$arrayofcss);
-print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '
');
+print_fiche_titre($langs->trans("ListOfUsers"). ' ('.$langs->trans("HierarchicView").')', '');
@@ -64,187 +67,55 @@ $user_arbo = $userstatic->get_full_tree();
// Define fulltree array
$fulltree=$user_arbo;
-
-print '';
-
-
-// ----- This section will show a tree from a fulltree array -----
-// $section must also be defined
-// ---------------------------------------------------------------
-
-
-// Root title line
-print '';
-print '';
-print '| ';
-print img_picto_common('','treemenu/base.gif');
-print ' | '.$langs->trans("All");
-print ' | ';
-print '
| ';
-print ' | ';
-print ' | ';
-//print ' | ';
-print '
';
-
-
-
-// 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)
{
- foreach($fulltree as $key => $val)
- {
- //print $val['id']."-".$section."
";
- if ($val['id'] == $section)
- {
- $fullpathselected=$val['fullpath'];
- break;
- }
- }
-}
-//print "fullpathselected=".$fullpathselected."
";
-
-// 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].'
';
-
-$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.'
'."\n";
-
- if ($showline)
- {
- $var=!$var;
-
- if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded';
- else $option='indexnotexpanded';
- //print $option;
-
- print "";
-
- // Show tree graph pictos
- print '';
- print '| ';
- $resarray=tree_showpad($fulltree,$key);
- $a=$resarray[0];
- $nbofsubdir=$resarray[1];
- $nboffilesinsubdir=$resarray[2];
- print ' | ';
-
- // Show picto
- print '';
- //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 = '';
- if ($option == 'indexnotexpanded') $lien = '';
- $newref=str_replace('_',' ',$ref);
- $lienfin='';
- print $lien.$newref.$lienfin;
- if (! in_array($val['id'],$expandedsectionarray)) print img_picto('','object_category');
- else print img_picto('','object_category-expanded');
- print ' | ';
- // Show link
- print '';
- //if ($section == $val['id']) print ' ';
- // We don't want a link ... why ?
- $userstatic->id=$val['id'];
- $userstatic->ref=$val['label'];
- $userstatic->type=$type;
- print ' '.$userstatic->getNomUrl(0,'',60);
-
- //print ' '.dol_trunc($val['label'],28);
- //if ($section == $val['id']) print '';
- print ' | ';
- print ' ';
- print " | \n";
-
- // Description
- print '';
- print dol_trunc($val['description'],48);
- print ' | ';
-
- // Link to category card
- print ''.img_view().' | ';
-
- // Add link
- //print ''.img_edit_add().' | ';
- //print ' | ';
-
- print "
\n";
- }
-
- $oldvallevel=$val['level'];
- $nbofentries++;
-}
-
-
-// If nothing to show
-if ($nbofentries == 0)
-{
- print '';
- print '| '.img_picto_common('','treemenu/branchbottom.gif').' | ';
- print ''.img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop3.gif','',1).' | ';
- print '';
- print $langs->trans("NoCategoryYet");
- print ' | ';
- print ' | ';
- print '
| ';
- print ' | ';
- print '
';
-}
-
-// ----- End of section -----
-// --------------------------
-
+ $userstatic->id=$val['id'];
+ $userstatic->ref=$val['label'];
+ $userstatic->firstname=$val['firstname'];
+ $userstatic->lastname=$val['name'];
+ $userstatic->statut=$val['statut'];
+ $li=$userstatic->getNomUrl(1,'').' ('.$val['login'].')';
+
+ $data[] = array(
+ 'rowid'=>$val['rowid'],
+ 'fk_menu'=>$val['fk_user'],
+ 'entry'=>'| '.$li.' | '.$userstatic->getLibStatut(5).' |
'
+ );
+}
+
+
+print '';
+print '| '.$langs->trans("HierarchicView").' | | |
';
+
+$nbofentries=(count($data) - 1);
+
+if ($nbofentries > 0)
+{
+ print '| ';
+ tree_recur($data,$data[0],0);
+ print ' |
';
+}
+else
+{
+ print '';
+ print '| '.img_picto_common('','treemenu/branchbottom.gif').' | ';
+ print '';
+ print $langs->trans("NoCategoryYet");
+ print ' | ';
+ print ' | ';
+ print '
| ';
+ print '
';
+}
+
print "
";
llxFooter();
+
$db->close();
?>