$values['opensatisfaction'] = Stat::constructEntryValues($_GET['itemtype'], "inter_opensatisfaction", $_GET["date1"], $_GET["date2"]); $values['answersatisfaction'] = Stat::constructEntryValues($_GET['itemtype'], "inter_answersatisfaction", $_GET["date1"], $_GET["date2"]); $available = array('opensatisfaction' => _nx('survey', 'Opened', 'Opened', 2), 'answersatisfaction' => _nx('survey', 'Answered', 'Answered', 2)); echo "<div class='center'>"; foreach ($available as $key => $name) { echo "<input type='checkbox' onchange='submit()' name='graph[{$key}]' " . ($show_all || isset($_GET['graph'][$key]) ? "checked" : "") . "> " . $name . " "; } echo "</div>"; $toprint = array(); foreach ($available as $key => $name) { if ($show_all || isset($_GET['graph'][$key])) { $toprint[$name] = $values[$key]; } } Stat::showGraph($toprint, array('title' => __('Satisfaction survey'), 'showtotal' => 1, 'unit' => __('Tickets'))); $values['avgsatisfaction'] = Stat::constructEntryValues($_GET['itemtype'], "inter_avgsatisfaction", $_GET["date1"], $_GET["date2"]); $available = array('avgsatisfaction' => __('Satisfaction')); echo "<div class='center'>"; foreach ($available as $key => $name) { echo "<input type='checkbox' onchange='submit()' name='graph[{$key}]' " . ($show_all || isset($_GET['graph'][$key]) ? "checked" : "") . "> " . $name . " "; } echo "</div>"; $toprint = array(); foreach ($available as $key => $name) { if ($show_all || isset($_GET['graph'][$key])) { $toprint[$name] = $values[$key]; } } Stat::showGraph($toprint, array('title' => __('Satisfaction'))); } // form using GET method : CRSF not needed
function show($itemtype, $type, $date1, $date2, $start, array $value, $value2 = "") { global $LANG, $CFG_GLPI; // Set display type for export if define $output_type = Search::HTML_OUTPUT; if (isset($_GET["display_type"])) { $output_type = $_GET["display_type"]; } //printCleanArray($value); if (is_array($value)) { $end_display = $start + $_SESSION['plugin_mobile']['rows_limit']; $numrows = count($value); if (isset($_GET['export_all'])) { $start = 0; $end_display = $numrows; } $nbcols = 8; if ($output_type != Search::HTML_OUTPUT) { // not HTML display $nbcols--; } echo PluginMobileSearch::showHeader($output_type, $end_display - $start + 1, $nbcols); Search::showNewLine($output_type); $header_num = 1; if ($output_type == Search::HTML_OUTPUT) { // HTML display - massive modif $search_config = ""; echo PluginMobileSearch::showHeaderItem($output_type, $search_config, $header_num, "", 0, array()); } echo "<div data-type='horizontal' data-role='controlgroup' class='mobile_list_header'>"; $header_num = 1; echo PluginMobileSearch::showHeaderItem($output_type, " ", $header_num, '#', 0, '', 3); /*if ($output_type==Search::HTML_OUTPUT) { // HTML display echo PluginMobileSearch::showHeaderItem($output_type," ",$header_num, '#', 0, '', 7); }*/ //stevenes echo PluginMobileSearch::showHeaderItem($output_type, $LANG['stats'][13], $header_num, '#', 0, '', 3); echo PluginMobileSearch::showHeaderItem($output_type, $LANG['stats'][11], $header_num, '#', 0, '', 3); // echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][11],$header_num, '#', 0, '', 7); /* echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][15],$header_num, '#', 0, '', 7); echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][25],$header_num, '#', 0, '', 7); echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][27],$header_num, '#', 0, '', 7); echo PluginMobileSearch::showHeaderItem($output_type,$LANG['stats'][30],$header_num, '#', 0, '', 7); */ echo "</div>"; // End Line for column headers echo PluginMobileSearch::showEndLine($output_type); $itemtype = "Ticket"; //echo $start; //echo $value[0]['id']; //echo $value[0]['link']; $row_num = 1; for ($i = $start; $i < $numrows && $i < $end_display; $i++) { $value[$i]['link'] = preg_replace('#<a.*>(.*)</a>#isU', '$1', $value[$i]['link']); $value[$i]['link'] = "<a href='stat.graph.php?id=" . $value[$i + 1]['id'] . "&date1={$date1}&date2=" . "{$date2}&type={$type}" . (!empty($value2) ? "&champ={$value2}" : "") . "'>" . $value[$i]['link'] . "</a>"; $row_num++; $item_num = 1; echo PluginMobileSearch::showNewLine($output_type, $i % 2); echo PluginMobileSearch::showItem($output_type, $value[$i]['link'], $item_num, $row_num, '', 3); //echo PluginMobileSearch::showItem($output_type,$link,$item_num,$row_num, '', 7); /*if ($output_type==Search::HTML_OUTPUT) { // HTML display $link=""; if ($value[$i]['id']>0) { $link="<a href='stat.graph.php?id=".$value[$i]['id']."&date1=$date1&date2=". "$date2&type=$type".(!empty($value2)?"&champ=$value2":"")."'>". "<img src=\"".$CFG_GLPI["root_doc"]."/pics/stats_item.png\" alt='' title=''>". "</a>"; } echo PluginMobileSearch::showItem($output_type,$link,$item_num,$row_num, '', 7); }*/ //le nombre d'intervention - the number of intervention $opened = Stat::constructEntryValues($itemtype, "inter_total", $date1, $date2, $type, $value[$i]["id"], $value2); $nb_opened = array_sum($opened); echo PluginMobileSearch::showItem($output_type, $nb_opened, $item_num, $row_num, '', 3); $export_data['opened'][$value[$i]['link']] = $nb_opened; //le nombre d'intervention resolues - the number of resolved intervention $solved = Stat::constructEntryValues($itemtype, "inter_solved", $date1, $date2, $type, $value[$i]["id"], $value2); $nb_solved = array_sum($solved); echo PluginMobileSearch::showItem($output_type, $nb_solved, $item_num, $row_num, '', 3); $export_data['solved'][$value[$i]['link']] = $nb_solved; //dados chamados //Le temps moyen de resolution - The average time to resolv /* $data=Stat::constructEntryValues($itemtype,"inter_avgsolvedtime",$date1,$date2,$type,$value[$i]["id"],$value2); foreach ($data as $key2 => $val2) { $data[$key2]*=$solved[$key2]; } if ($nb_solved>0) { $nb=array_sum($data)/$nb_solved; } else { $nb=0; } $timedisplay = $nb*HOUR_TIMESTAMP; if ($output_type==Search::HTML_OUTPUT || $output_type==Search::PDF_OUTPUT_LANDSCAPE || $output_type==Search::PDF_OUTPUT_PORTRAIT) { $timedisplay=mobileTimestampToString($timedisplay,0); } echo PluginMobileSearch::showItem($output_type,$timedisplay,$item_num,$row_num, '', 7); //Le temps moyen de l'intervention reelle - The average realtime to resolv $data=Stat::constructEntryValues($itemtype,"inter_avgrealtime",$date1,$date2,$type,$value[$i]["id"],$value2); foreach ($data as $key2 => $val2) { if (isset($solved[$key2])) { $data[$key2]*=$solved[$key2]; } else { $data[$key2]*=0; } } $total_realtime=array_sum($data); if ($nb_solved>0) { $nb=$total_realtime/$nb_solved; } else { $nb=0; } $timedisplay=$nb*MINUTE_TIMESTAMP; if ($output_type==Search::HTML_OUTPUT || $output_type==Search::PDF_OUTPUT_LANDSCAPE || $output_type==Search::PDF_OUTPUT_PORTRAIT) { $timedisplay=mobileTimestampToString($timedisplay,0); } echo PluginMobileSearch::showItem($output_type,$timedisplay,$item_num,$row_num, '', 7); //Le temps total de l'intervention reelle - The total realtime to resolv $timedisplay=$total_realtime*MINUTE_TIMESTAMP; if ($output_type==Search::HTML_OUTPUT || $output_type==Search::PDF_OUTPUT_LANDSCAPE || $output_type==Search::PDF_OUTPUT_PORTRAIT) { $timedisplay=mobileTimestampToString($timedisplay,0); } echo PluginMobileSearch::showItem($output_type,$timedisplay,$item_num,$row_num, '', 7); //Le temps moyen de prise en compte du ticket - The average time to take a ticket into account $data=Stat::constructEntryValues($itemtype,"inter_avgtakeaccount",$date1,$date2,$type,$value[$i]["id"], $value2); foreach ($data as $key2 => $val2) { $data[$key2]*=$solved[$key2]; } if ($nb_solved>0) { $nb=array_sum($data)/$nb_solved; } else { $nb=0; } $timedisplay=$nb*HOUR_TIMESTAMP; if ($output_type==Search::HTML_OUTPUT || $output_type==Search::PDF_OUTPUT_LANDSCAPE || $output_type==Search::PDF_OUTPUT_PORTRAIT) { $timedisplay=mobileTimestampToString($timedisplay,0); } echo PluginMobileSearch::showItem($output_type,$timedisplay,$item_num,$row_num, '', 7); echo PluginMobileSearch::showEndLine($output_type); } */ echo PluginMobileSearch::showEndLine($output_type); } // Display footer echo PluginMobileSearch::showFooter($output_type); } else { echo $LANG['stats'][23]; } }
$values['opensatisfaction'] = Stat::constructEntryValues("inter_opensatisfaction", $_REQUEST["date1"], $_REQUEST["date2"]); $values['answersatisfaction'] = Stat::constructEntryValues("inter_answersatisfaction", $_REQUEST["date1"], $_REQUEST["date2"]); $available = array('opensatisfaction' => $LANG['satisfaction'][13], 'answersatisfaction' => $LANG['satisfaction'][14]); echo "<div class='center'>"; foreach ($available as $key => $name) { echo "<input type='checkbox' onchange='submit()' name='graph[{$key}]' " . ($show_all || isset($_REQUEST['graph'][$key]) ? "checked" : "") . "> " . $name . " "; } echo "</div>"; $toprint = array(); foreach ($available as $key => $name) { if ($show_all || isset($_REQUEST['graph'][$key])) { $toprint[$name] = $values[$key]; } } Stat::showGraph($toprint, array('title' => $LANG['satisfaction'][3], 'showtotal' => 1, 'unit' => $LANG['stats'][35])); $values['avgsatisfaction'] = Stat::constructEntryValues("inter_avgsatisfaction", $_REQUEST["date1"], $_REQUEST["date2"]); $available = array('avgsatisfaction' => $LANG['satisfaction'][7]); echo "<div class='center'>"; foreach ($available as $key => $name) { echo "<input type='checkbox' onchange='submit()' name='graph[{$key}]' " . ($show_all || isset($_REQUEST['graph'][$key]) ? "checked" : "") . "> " . $name . " "; } echo "</div>"; $toprint = array(); foreach ($available as $key => $name) { if ($show_all || isset($_REQUEST['graph'][$key])) { $toprint[$name] = $values[$key]; } } Stat::showGraph($toprint, array('title' => $LANG['satisfaction'][7])); echo "</form>"; commonFooter();
} } if (!empty($_POST["date1"]) && !empty($_POST["date2"]) && strcmp($_POST["date2"], $_POST["date1"]) < 0) { $tmp = $_POST["date1"]; $_POST["date1"] = $_POST["date2"]; $_POST["date2"] = $tmp; } $itemtype = "Ticket"; PluginMobileStat::getVal($val1, $val2, $next, $prev, $title); echo "<div data-role='content'>"; $target = preg_replace("/&/", "&", $_SERVER["REQUEST_URI"]); PluginMobileStat::showDateSelector($target); ///////// Stats nombre intervention // Total des interventions $entrees_total = PluginMobileStat::constructEntryValues($itemtype, "inter_total", $_POST["date1"], $_POST["date2"], $_GET["type"], $val1, $val2); PluginMobileStat::showGraph(array($LANG['stats'][5] => $entrees_total), array('title' => $LANG['stats'][5], 'showtotal' => 1, 'unit' => $LANG['stats'][35])); // Total des interventions resolues $entrees_solved = Stat::constructEntryValues($itemtype, "inter_solved", $_POST["date1"], $_POST["date2"], $_GET["type"], $val1, $val2); PluginMobileStat::showGraph(array($LANG['stats'][11] => $entrees_solved), array('title' => $LANG['stats'][11], 'showtotal' => 1, 'unit' => $LANG['stats'][35])); //Temps moyen de resolution d'intervention $entrees_avgsolvedtime = Stat::constructEntryValues($itemtype, "inter_avgsolvedtime", $_POST["date1"], $_POST["date2"], $_GET["type"], $val1, $val2); PluginMobileStat::showGraph(array($LANG['stats'][6] => $entrees_avgsolvedtime), array('title' => $LANG['stats'][6], 'unit' => $LANG['job'][21])); //Temps moyen d'intervention reel $entrees_avgrealtime = Stat::constructEntryValues($itemtype, "inter_avgrealtime", $_POST["date1"], $_POST["date2"], $_GET["type"], $val1, $val2); PluginMobileStat::showGraph(array($LANG['stats'][25] => $entrees_avgrealtime), array('title' => $LANG['stats'][25], 'unit' => $LANG['job'][21])); //Temps moyen de prise en compte de l'intervention $entrees_avgtaketime = Stat::constructEntryValues($itemtype, "inter_avgtakeaccount", $_POST["date1"], $_POST["date2"], $_GET["type"], $val1, $val2); PluginMobileStat::showGraph(array($LANG['stats'][30] => $entrees_avgtaketime), array('title' => $LANG['stats'][30], 'unit' => $LANG['job'][21])); PluginMobileStat::displayFooterNavBar2($val1, $val2, $next, $prev, $title); echo "</div>"; $common->displayFooter();