Method colorStringToArray can accept the #

Method monthArray can return short label of month
This commit is contained in:
Laurent Destailleur 2015-03-22 18:17:25 +01:00
parent 809690fad7
commit 49824a0e56
6 changed files with 33 additions and 15 deletions

View File

@ -782,7 +782,7 @@ class FormOther
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$montharray = monthArray($langs); // Get array
$montharray = monthArray($langs, 1); // Get array
$select_month = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($useempty)

View File

@ -813,11 +813,12 @@ function num_open_day($timestampStart, $timestampEnd, $inhour=0, $lastday=0, $ha
* This replace old function monthArrayOrSelected.
*
* @param Translate $outputlangs Object langs
* @param int $short 1=Return short label
* @return array Month string or array if selected < 0
*/
function monthArray($outputlangs)
function monthArray($outputlangs,$short=0)
{
$montharray = array (
$montharray = array (
1 => $outputlangs->trans("January"),
2 => $outputlangs->trans("February"),
3 => $outputlangs->trans("March"),
@ -832,6 +833,24 @@ function monthArray($outputlangs)
12 => $outputlangs->trans("December")
);
return $montharray;
if (! empty($short))
{
$montharray = array (
1 => $outputlangs->trans("Jan"),
2 => $outputlangs->trans("Feb"),
3 => $outputlangs->trans("Mar"),
4 => $outputlangs->trans("Apr"),
5 => $outputlangs->trans("May"),
6 => $outputlangs->trans("Jun"),
7 => $outputlangs->trans("Jul"),
8 => $outputlangs->trans("Aug"),
9 => $outputlangs->trans("Sep"),
10 => $outputlangs->trans("Oct"),
11 => $outputlangs->trans("Nov"),
12 => $outputlangs->trans("Dec")
);
}
return $montharray;
}

View File

@ -1885,7 +1885,7 @@ function colorArrayToHex($arraycolor,$colorifnotfound='888888')
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
{
if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is
$tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
$tmp=preg_match('/^#?([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
if (! $tmp)
{
$tmp=explode(',',$stringcolor);

View File

@ -1505,7 +1505,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$hookmanager->initHooks(array('searchform','leftblock'));
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'<!-- Begin left layout -->'."\n".'<div class="ui-layout-west">'."\n";
else print "\n".'<!-- Begin id-left -->'."\n".'<div id="id-left">'."\n";
else print "\n".'<!-- Begin id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
print "\n";
@ -1691,7 +1691,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print $hookmanager->resPrint;
if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print '</div> <!-- End left layout -->'."\n";
else print '</div> <!-- end id-left -->'; // End div id="id-left"
else print '</div></div> <!-- end id-left -->'; // End div id="id-left"
}
print "\n";

View File

@ -313,7 +313,7 @@ print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
print '</td>';
print '<td class="liste_titre">'; // date
print '<td class="liste_titre nowrap">'; // date
print $formother->select_month($month?$month:-1,'month',1);
$formother->select_year($year?$year:-1,'year',1, 20, 1);
print '</td>';

View File

@ -1793,13 +1793,13 @@ class User extends CommonObject
$label = '<u>' . $langs->trans("User") . '</u>';
$label.= '<div width="100%">';
$label .= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
if (! empty($this->login))
$label .= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
$label.= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
if (! empty($this->email))
$label .= '<br><b>' . $langs->trans("EMail").':</b> '.$this->email;
$label.= '<br><b>' . $langs->trans("EMail").':</b> '.$this->email;
if (! empty($this->admin))
$label .= '<br><b>' . $langs->trans("Administrator").'</b>: '.yn($this->admin);
$label.= '<br><b>' . $langs->trans("Administrator").'</b>: '.yn($this->admin);
if (! empty($this->societe_id)) {
$thirdpartystatic = new Societe($db);
$thirdpartystatic->fetch($this->societe_id);
@ -1807,11 +1807,10 @@ class User extends CommonObject
$company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')';
}
$type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal"));
$label .= '<br><b>' . $langs->trans("Type") . ':</b> ' . $type;
$label.= '<br><b>' . $langs->trans("Type") . ':</b> ' . $type;
if (! empty($this->photo))
{
$label.= '</div><div style="padding: 10px">';
//if (! is_object($form)) $form = new Form($db);
$label.= '</div><div class="photointooltip" style="padding-top: 6px">';
$label.= Form::showphoto('userphoto', $this, 80);
}
$label.= '</div>';