63 global
$conf, $user, $langs;
65 $badgeStatus0 =
'#cbd3d3';
66 $badgeStatus1 =
'#bc9526';
67 $badgeStatus1b =
'#bc9526';
68 $badgeStatus2 =
'#9c9c26';
69 $badgeStatus3 =
'#bca52b';
70 $badgeStatus4 =
'#25a580';
71 $badgeStatus4b =
'#25a580';
72 $badgeStatus5 =
'#cad2d2';
73 $badgeStatus6 =
'#cad2d2';
74 $badgeStatus7 =
'#baa32b';
75 $badgeStatus8 =
'#993013';
76 $badgeStatus9 =
'#e7f0f0';
77 if (file_exists(DOL_DOCUMENT_ROOT .
'/theme/' .
$conf->theme .
'/theme_vars.inc.php')) {
78 include DOL_DOCUMENT_ROOT .
'/theme/' .
$conf->theme .
'/theme_vars.inc.php';
82 require_once DOL_DOCUMENT_ROOT.
"/ticket/class/ticket.class.php";
84 $text = $langs->trans(
"BoxTicketSeverity", $max);
85 $this->info_box_head = array(
90 $listofopplabel = array();
91 $listofoppcode = array();
92 $colorseriesstat = array();
93 if ($user->hasRight(
'ticket',
'read')) {
94 $sql =
"SELECT cts.rowid, cts.label, cts.code";
95 $sql .=
" FROM " . MAIN_DB_PREFIX .
"c_ticket_severity as cts";
96 $sql .=
" WHERE cts.active = 1";
97 $sql .= $this->db->order(
'cts.rowid',
'ASC');
98 $resql = $this->db->query($sql);
101 $num = $this->db->num_rows($resql);
104 $objp = $this->db->fetch_object($resql);
105 $listofoppcode[$objp->rowid] = $objp->code;
106 $listofopplabel[$objp->rowid] = $objp->label;
107 switch ($objp->code) {
109 $colorseriesstat[$objp->rowid] = $badgeStatus4;
112 $colorseriesstat[$objp->rowid] = $badgeStatus2;
115 $colorseriesstat[$objp->rowid] = $badgeStatus1;
118 $colorseriesstat[$objp->rowid] = $badgeStatus8;
129 $dataseries = array();
131 $sql =
"SELECT t.severity_code, COUNT(t.severity_code) as nb";
132 $sql .=
" FROM " . MAIN_DB_PREFIX .
"ticket as t";
133 $sql .=
" WHERE t.fk_statut <> 8";
134 $sql .=
" GROUP BY t.severity_code";
135 $resql = $this->db->query($sql);
137 $num = $this->db->num_rows($resql);
140 $objp = $this->db->fetch_object($resql);
141 $data[$objp->severity_code] = $objp->nb;
144 foreach ($listofoppcode as $rowid => $code) {
145 $dataseries[] = array(
146 'label' => $langs->getLabelFromKey($this->db,
'TicketSeverityShort' . $code,
'c_ticket_severity',
'code',
'label', $code),
147 'data' => (empty($data[$code]) ? 0 : $data[$code])
154 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
155 if (!empty($dataseries) && count($dataseries) > 0) {
156 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
158 $mesg = $px1->isGraphKo();
164 foreach ($dataseries as $value) {
165 $data[] = array($value[
'label'], $value[
'data']);
166 $totalnb += $value[
'data'];
169 $px1->SetData($data);
170 $px1->setShowLegend(0);
171 $px1->SetType(array(
'bars'));
172 $px1->SetLegend($legend);
173 $px1->SetMaxValue($px1->GetCeilMaxValue());
176 $px1->SetHorizTickIncrement(1);
177 $px1->SetCssPrefix(
"cssboxes");
178 $px1->mode =
'depth';
180 $px1->draw(
'idgraphticketseverity');
181 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
183 $stringtoprint .=
'</div>';
184 $this->info_box_contents[][] = array(
185 'td' =>
'class="center"',
186 'text' => $stringtoprint
189 $this->info_box_contents[0][0] = array(
191 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxNoTicketSeverity").
'</span>'
195 $this->info_box_contents[0][0] = array(
197 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>',