Merge pull request #2166 from defrance69/patch-36

Update functions.lib.php
This commit is contained in:
Juanjo Menent 2014-12-24 15:38:48 +01:00
commit 65eef3587a

View File

@ -683,42 +683,86 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
if (count($keys)) $maxkey=max($keys); if (count($keys)) $maxkey=max($keys);
} }
// Show tabs // Show tabs
$bactive=false;
// if =0 we don't use the feature
$limittoshow=($conf->global->MAXTABS_IN_CARD?$conf->global->MAXTABS_IN_CARD:99);
$displaytab=0;
for ($i = 0 ; $i <= $maxkey ; $i++) for ($i = 0 ; $i <= $maxkey ; $i++)
{ {
$isactive=(is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2]);
$out.='<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((! $isactive && ! empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT))?' hideonprint':'').'">'; if ((is_numeric($active) && $i == $active) || (! is_numeric($active) && $active == $links[$i][2]))
if (isset($links[$i][2]) && $links[$i][2] == 'image')
{ {
if (!empty($links[$i][0])) $isactive=true;
{ $bactive=true;
$out.='<a data-role="button" class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; if ($i <=$limittoshow)
} $limittoshow++;
else
{
$out.='<span data-role="button" class="tabspan">'.$links[$i][1].'</span>'."\n";
}
} }
else if (! empty($links[$i][1])) else
$isactive=false;
if ($i <=$limittoshow || $isactive )
{ {
//print "x $i $active ".$links[$i][2]." z"; $out.='<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((! $isactive && ! empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT))?' hideonprint':'').'">';
if ($isactive) if (isset($links[$i][2]) && $links[$i][2] == 'image')
{ {
$out.='<a data-role="button"'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabactive tab inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; if (!empty($links[$i][0]))
{
$out.='<a data-role="button" class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
}
else
{
$out.='<span data-role="button" class="tabspan">'.$links[$i][1].'</span>'."\n";
}
} }
else else if (! empty($links[$i][1]))
{ {
$out.='<a data-role="button"'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tab inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; //print "x $i $active ".$links[$i][2]." z";
if ($isactive)
{
$out.='<a data-role="button"'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tabactive tab inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
}
else
{
$out.='<a data-role="button"'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="tab inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
}
} }
$out.='</div>';
} }
$out.='</div>'; else
{
$outmore.='<div class="" style="display:inherit; background-color:#f9f9f9; padding-top:5px; padding-right:15px; padding-left:12px;">';
if (isset($links[$i][2]) && $links[$i][2] == 'image')
{
if (!empty($links[$i][0]))
$outmore.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
else
$outmore.='<span class="tabspan">'.$links[$i][1].'</span>'."\n";
}
else if (! empty($links[$i][1]))
$outmore.='<a "'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$outmore.='</div>';
}
$displaytab=$i;
} }
$out.="</div>\n"; if ($displaytab > $limittoshow)
{
$out.='<div id=moretabs class="inline-block tabsElem"><a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">Plus</a>';
$out.='<div id=moretabsList style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div></div>';
$out.="</div>\n";
$out.="<script>";
$out.="$('#moretabs').mouseenter( function() { $('#moretabsList').css('left','auto');});";
$out.="$('#moretabs').mouseleave( function() { $('#moretabsList').css('left','-999em');});";
$out.="</script>";
}
if (! $notab) $out.="\n".'<div class="tabBar">'."\n"; if (! $notab) $out.="\n".'<div class="tabBar">'."\n";
return $out; return $out;
} }