2
0
forked from Wavyzz/dolibarr

Work on feature to assign several users to an event.

This commit is contained in:
Laurent Destailleur
2014-09-09 14:38:10 +02:00
parent 9f2b0b4f29
commit f19e469b5f
2 changed files with 80 additions and 19 deletions

View File

@@ -1273,6 +1273,49 @@ class Form
}
/**
* Return select list of users. Selected users are stored into session.
*
* @param string $htmlname Field name in form
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param array $exclude Array list of users id to exclude
* @param int $disabled If select list must be disabled
* @param array $include Array list of users id to include or 'hierarchy' to have only supervised users
* @param array $enableonly Array list of users id to be enabled. All other must be disabled
* @param int $force_entity 0 or Id of environment to force
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request
* @return string HTML select string
* @see select_dolgroups
*/
function select_dolusers_forevent($htmlname='userid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='')
{
global $conf,$user,$langs;
$userstatic=new User($this->db);
// Method with no ajax
//$out.='<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
$out.='<input type="submit" class="button" name="addassignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
$assignedtouser=array();
if (!empty($_SESSION['assignedtouser'])) $assignedtouser=dol_json_decode($_SESSION['assignedtouser'], true);
if (count($assignedtouser)) $out.='<br>';
foreach($assignedtouser as $key => $value)
{
$userstatic->fetch($key);
$out.=$userstatic->getNomUrl(1);
//$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional"));
//$out.=' '.($value['transparency']?$langs->trans("Busy"):$langs->trans("NotBusy"));
$out.='<br>';
}
//$out.='</form>';
return $out;
}
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*