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 $text = $langs->trans(
"BoxNewTicketVSClose");
78 $this->info_box_head = array(
83 if ($user->hasRight(
'ticket',
'read')) {
86 $sql =
"SELECT COUNT(t.datec) as nb";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
88 $sql .=
" WHERE CAST(t.datec AS DATE) = CURRENT_DATE";
89 $sql .=
" AND t.fk_statut <> 8";
90 $sql .=
" GROUP BY CAST(t.datec AS DATE)";
91 $resql = $this->db->query($sql);
93 $num = $this->db->num_rows($resql);
95 $objp = $this->db->fetch_object($resql);
96 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), $objp->nb);
97 $totalnb += $objp->nb;
99 $data[] = array($langs->transnoentitiesnoconv(
'TicketCreatedToday'), 0);
104 $sql =
"SELECT COUNT(t.date_close) as nb";
105 $sql .=
" FROM ".MAIN_DB_PREFIX.
"ticket as t";
106 $sql .=
" WHERE CAST(t.date_close AS DATE) = CURRENT_DATE";
107 $sql .=
" AND t.fk_statut = 8";
108 $sql .=
" GROUP BY CAST(t.date_close AS DATE)";
109 $resql = $this->db->query($sql);
111 $num = $this->db->num_rows($resql);
113 $objp = $this->db->fetch_object($resql);
114 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), $objp->nb);
115 $totalnb += $objp->nb;
117 $data[] = array($langs->transnoentitiesnoconv(
'TicketClosedToday'), 0);
122 $colorseries = array();
123 $colorseries[] = $badgeStatus8;
124 $colorseries[] = $badgeStatus2;
126 $stringtoprint .=
'<div class="div-table-responsive-no-min ">';
127 if (!empty($data) && count($data) > 0) {
128 include_once DOL_DOCUMENT_ROOT.
'/core/class/dolgraph.class.php';
130 $mesg = $px1->isGraphKo();
132 $px1->SetDataColor($colorseries);
133 $px1->SetData($data);
134 $px1->setShowLegend(2);
135 if (!empty(
$conf->dol_optimize_smallscreen)) {
138 $px1->SetType(array(
'pie'));
139 $px1->SetMaxValue($px1->GetCeilMaxValue());
141 $px1->SetHorizTickIncrement(1);
142 $px1->SetCssPrefix(
"cssboxes");
143 $px1->mode =
'depth';
145 $px1->draw(
'idgraphticketnewvsclosetoday');
146 $stringtoprint .= $px1->show($totalnb ? 0 : 1);
148 $stringtoprint .=
'</div>';
149 $this->info_box_contents[][] = array(
150 'td' =>
'class="center"',
151 'text' => $stringtoprint
154 $this->info_box_contents[0][0] = array(
155 'td' =>
'class="center"',
156 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"BoxNoTicketSeverity").
'</span>'
160 $this->info_box_contents[0][0] = array(
161 'td' =>
'class="left"',
162 'text' =>
'<span class="opacitymedium">'.$langs->trans(
"ReadPermissionNotAllowed").
'</span>'