66 global
$conf, $user, $langs;
68 $badgeStatus0 =
'#cbd3d3';
69 $badgeStatus1 =
'#bc9526';
70 $badgeStatus1b =
'#bc9526';
71 $badgeStatus2 =
'#9c9c26';
72 $badgeStatus3 =
'#bca52b';
73 $badgeStatus4 =
'#25a580';
74 $badgeStatus4b =
'#25a580';
75 $badgeStatus5 =
'#cad2d2';
76 $badgeStatus6 =
'#cad2d2';
77 $badgeStatus7 =
'#baa32b';
78 $badgeStatus8 =
'#993013';
79 $badgeStatus9 =
'#e7f0f0';
80 if (file_exists(DOL_DOCUMENT_ROOT .
'/theme/' .
$conf->theme .
'/theme_vars.inc.php')) {
81 include DOL_DOCUMENT_ROOT .
'/theme/' .
$conf->theme .
'/theme_vars.inc.php';
85 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
87 $text = $langs->trans(
"BoxTicketSeverity", $max);
88 $this->info_box_head = array(
93 $listofopplabel = array();
94 $listofoppcode = array();
95 $colorseriesstat = array();
96 if ($user->hasRight(
'ticket',
'read')) {
97 $sql =
"SELECT cts.rowid, cts.label, cts.code";
98 $sql .=
" FROM " . MAIN_DB_PREFIX .
"c_ticket_severity as cts";
99 $sql .=
" WHERE cts.active = 1";
100 $sql .= $this->db->order(
'cts.rowid',
'ASC');
101 $resql = $this->db->query($sql);
104 $num = $this->db->num_rows($resql);
107 $objp = $this->db->fetch_object($resql);
108 $listofoppcode[$objp->rowid] = $objp->code;
109 $listofopplabel[$objp->rowid] = $objp->label;
110 switch ($objp->code) {
112 $colorseriesstat[$objp->rowid] = $badgeStatus4;
115 $colorseriesstat[$objp->rowid] = $badgeStatus2;
118 $colorseriesstat[$objp->rowid] = $badgeStatus1;
121 $colorseriesstat[$objp->rowid] = $badgeStatus8;
132 $dataseries = array();
134 $sql =
"SELECT t.severity_code, COUNT(t.severity_code) as nb";
135 $sql .=
" FROM " . MAIN_DB_PREFIX .
"ticket as t";
136 $sql .=
" WHERE t.fk_statut <> 8";
137 $sql .=
" GROUP BY t.severity_code";
138 $resql = $this->db->query($sql);
140 $num = $this->db->num_rows($resql);
143 $objp = $this->db->fetch_object($resql);
144 $data[$objp->severity_code] = $objp->nb;
147 foreach ($listofoppcode as $rowid => $code) {
148 $dataseries[] = array(
149 'label' => $langs->getLabelFromKey($this->db,
'TicketSeverityShort' . $code,
'c_ticket_severity',
'code',
'label', $code),
150 'data' => (empty($data[$code]) ? 0 : $data[$code])
157 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
158 if (!empty($dataseries) && count($dataseries) > 0) {
159 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
161 $mesg = $px1->isGraphKo();
167 foreach ($dataseries as $value) {
168 $data[] = array($value[
'label'], $value[
'data']);
169 $totalnb += $value[
'data'];
172 $px1->SetData($data);
173 $px1->setShowLegend(0);
174 $px1->SetType(array(
'bars'));
175 $px1->SetLegend($legend);
176 $px1->SetMaxValue($px1->GetCeilMaxValue());
179 $px1->SetHorizTickIncrement(1);
180 $px1->SetCssPrefix(
"cssboxes");
181 $px1->mode =
'depth';
183 $px1->draw(
'idgraphticketseverity');
184 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
186 $stringtoprint .=
'</div>';
187 $this->info_box_contents[][] = array(
188 'td' =>
'class="center"',
189 'text' => $stringtoprint
192 $this->info_box_contents[0][0] = array(
194 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxNoTicketSeverity").
'</span>'
198 $this->info_box_contents[0][0] = array(
200 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',