70 $graphid = empty($options[
'graphid']) ?
'idgraphstatus' : $options[
'graphid'];
71 $height = isset($options[
'height']) ? $options[
'height'] : 200;
72 $showpercent = isset($options[
'showpercent']) ? $options[
'showpercent'] : 1;
74 $dataseries = array();
75 $colorseries = array();
78 foreach ($series as $slice) {
79 $dataseries[] = array($slice[
'label'], $slice[
'nb']);
80 if (isset($slice[
'color'])) {
81 $colorseries[] = $slice[
'color'];
88 $total = array_key_exists(
'total', $options) ? $options[
'total'] : $sum;
90 $out =
'<div class="div-table-responsive-no-min">';
91 $out .=
'<table class="noborder nohover centpercent">';
92 $out .=
'<tr class="liste_titre"><th colspan="2">'.$title.
'</th></tr>'.
"\n";
94 if (!empty(
$conf->use_javascript_ajax)) {
95 $out .=
'<tr><td class="center" colspan="2">';
97 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
99 $dolgraph->SetData($dataseries);
101 $dolgraph->SetDataColor($colorseries);
103 $dolgraph->setShowLegend(2);
104 $dolgraph->setShowPercent($showpercent);
105 $dolgraph->SetType(array(
'pie'));
106 $dolgraph->SetHeight($height);
107 if (!empty($options[
'width'])) {
108 $dolgraph->SetWidth($options[
'width']);
110 $dolgraph->draw($graphid);
111 $out .= $dolgraph->show($sum ? 0 : 1);
113 $out .=
'</td></tr>';
115 foreach ($series as $slice) {
116 $out .=
'<tr class="oddeven">';
117 $out .=
'<td>'.(isset($slice[
'labelnojs']) ? $slice[
'labelnojs'] :
dol_escape_htmltag($slice[
'label'])).
'</td>';
118 $out .=
'<td class="right">';
119 if (!empty($slice[
'url'])) {
120 $out .=
'<a href="'.dol_escape_htmltag($slice[
'url']).
'">'.$slice[
'nb'].
'</a>';
122 $out .= $slice[
'nb'];
125 $out .=
'</tr>'.
"\n";
129 if ($total !==
false) {
130 $out .=
'<tr class="liste_total"><td>'.(empty($options[
'totallabel']) ? $langs->trans(
"Total") : $options[
'totallabel']).
'</td><td class="right">'.$total.
'</td></tr>';
133 $out .=
'</table></div><br>';
getStatusPieChart($title, $series, $options=array())
Return the HTML table with a pie chart of values by status, as shown on the home page of a module.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)