Example #1
0
 /**
  * Reads the ratings grouped by year and month and creates an array
  *
  * @return array
  * @static
  *
  */
 static function getTimedRatings($type = 'overall')
 {
     global $DB, $CFG_GLPI;
     $uid = PluginHelpdeskratingStatistic::getUserID();
     $sql = "select year(a.date) as year, month(a.date) as month, count(a.id) as anz, sum(a.rating_tech) as tech,\n                        sum(a.rating_solution) as solution, sum(a.rating_overall) as overall, sum(a.rating_time) as time\n                from glpi_plugin_helpdeskrating a, glpi_tickets b, glpi_tickets_users c\n                where a.tickets_id = b.id\n                and b.id = c.tickets_id\n                and c.type = 2\n                and c.users_id = " . $uid . "\n                and b.status = '" . CommonITILObject::CLOSED . "'\n                and a.type = 'user'\n                group by year(a.date), month(a.date)\n                order by 1, 2";
     $rating_data = array();
     if ($uid) {
         $result = $DB->query($sql);
         $year = 1979;
         while ($data = $DB->fetch_assoc($result)) {
             if ($year != $data['year']) {
                 $year = $data['year'];
                 for ($i = 1; $i <= 12; $i++) {
                     $rating_data[$data['year']][$i] = 0;
                 }
             }
             $rating_data[$data['year']][$data['month']] = $data[$type] / $data['anz'];
         }
     }
     return $rating_data;
 }
Example #2
0
 * Copyright (c) 2010-2013 Christian Deinert
 *
 * http://sourceforge.net/projects/helpdeskrating/
 *
 ************************************************************************************************
 *
 * LICENSE
 *
 *     This file is part of the GLPI Plugin Helpdeskrating.
 *
 *     The GLPI Plugin Helpdeskrating is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Lesser Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     The GLPI Plugin Helpdeskrating is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Lesser Public License for more details.
 *
 *     You should have received a copy of the GNU Lesser Public License
 *     along with the GLPI Plugin Helpdeskrating.  If not, see <http://www.gnu.org/licenses/>.
 *
 ************************************************************************************************/
define('GLPI_ROOT', '../../..');
include GLPI_ROOT . '/inc/includes.php';
include GLPI_ROOT . '/plugins/helpdeskrating/inc/statistic.class.php';
Html::header(Computer::GetTypeName(2), $_SERVER['PHP_SELF'], 'Plugin', 'helpdeskrating');
$PluginHelpdeskratingStatistic = new PluginHelpdeskratingStatistic();
$PluginHelpdeskratingStatistic->show();
Html::footer();