doxygen menubase class

This commit is contained in:
Frédéric FRANCE 2019-11-14 21:25:12 +01:00
parent 8ef9728470
commit 7100328116
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* 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
@ -45,17 +45,32 @@ class Menubase
public $errors = array(); public $errors = array();
/** /**
* @var int ID * @var int ID
*/ */
public $id; public $id;
/**
* @var string Menu handler
*/
public $menu_handler; public $menu_handler;
/**
* @var string Module name if record is added by a module
*/
public $module; public $module;
/**
* @var string Menu top or left
*/
public $type; public $type;
/**
* @var string Name family/module for top menu (home, companies, ...)
*/
public $mainmenu; public $mainmenu;
/** /**
* @var int ID * @var int 0 or Id of mother menu line, or -1 if we use fk_mainmenu and fk_leftmenu
*/ */
public $fk_menu; public $fk_menu;
@ -70,23 +85,71 @@ class Menubase
public $fk_leftmenu; public $fk_leftmenu;
/** /**
* @var int position * @var int Sort order of entry
*/ */
public $position; public $position;
/**
* @var string Relative (or absolute) url to go
*/
public $url; public $url;
/**
* @var string Target of Url link
*/
public $target; public $target;
/**
* @var string Key for menu translation
* @deprecated
* @see title
*/
public $titre; public $titre;
/**
* @var string Key for menu translation
*/
public $title;
/**
* @var string Lang file to load for translation
*/
public $langs; public $langs;
/**
* @var string Not used
* @deprecated
*/
public $level; public $level;
public $leftmenu; //<! Not used
/**
* @var string Name family/module for left menu (setup, info, ...)
*/
public $leftmenu;
/**
* @var string Condition to show enabled or disabled
*/
public $perms; public $perms;
/**
* @var string Condition to show or hide
*/
public $enabled; public $enabled;
/**
* @var int 0 if menu for all users, 1 for external only, 2 for internal only
*/
public $user; public $user;
/**
* @var int timestamp
*/
public $tms; public $tms;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $menu_handler Menu handler * @param string $menu_handler Menu handler
@ -100,10 +163,10 @@ class Menubase
/** /**
* Create menu entry into database * Create menu entry into database
* *
* @param User $user User that create * @param User $user User that create
* @return int <0 if KO, Id of record if OK * @return int <0 if KO, Id of record if OK
*/ */
public function create($user = null) public function create($user = null)
{ {
@ -125,7 +188,7 @@ class Menubase
$this->langs=trim($this->langs); $this->langs=trim($this->langs);
$this->perms=trim($this->perms); $this->perms=trim($this->perms);
$this->enabled=trim($this->enabled); $this->enabled=trim($this->enabled);
$this->user=trim($this->user); $this->user = (int) $this->user;
if (empty($this->position)) $this->position=0; if (empty($this->position)) $this->position=0;
if (! $this->level) $this->level=0; if (! $this->level) $this->level=0;
@ -246,7 +309,7 @@ class Menubase
*/ */
public function update($user = null, $notrigger = 0) public function update($user = null, $notrigger = 0)
{ {
global $conf, $langs; //global $conf, $langs;
// Clean parameters // Clean parameters
$this->rowid=trim($this->rowid); $this->rowid=trim($this->rowid);
@ -265,7 +328,7 @@ class Menubase
$this->langs=trim($this->langs); $this->langs=trim($this->langs);
$this->perms=trim($this->perms); $this->perms=trim($this->perms);
$this->enabled=trim($this->enabled); $this->enabled=trim($this->enabled);
$this->user=trim($this->user); $this->user = (int) $this->user;
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -311,7 +374,7 @@ class Menubase
*/ */
public function fetch($id, $user = null) public function fetch($id, $user = null)
{ {
global $langs; //global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
@ -385,7 +448,7 @@ class Menubase
*/ */
public function delete($user) public function delete($user)
{ {
global $conf, $langs; //global $conf, $langs;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;