summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b82c2df)
raw | patch | inline | side by side (parent: b82c2df)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Aug 2010 07:55:55 +0000 (07:55 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Aug 2010 07:55:55 +0000 (07:55 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19411 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/generic/statistics/class_statistics.inc | patch | blob | history |
diff --git a/gosa-core/plugins/generic/statistics/class_statistics.inc b/gosa-core/plugins/generic/statistics/class_statistics.inc
index 433e33833440fb7cfb4c2de8ab73a272294c605e..ab415a01d8840947cf4d7cd9951ee3075037d640 100644 (file)
// Get list of unsubmitted files.
$this->unsbmittedFiles = $this->getUnsubmittedStatistics();
+
+ // Collect category translations
+ $this->catTranslations = array();
+ foreach($this->config->configRegistry->getListOfPlugins() as $plugin => $data){
+ if(isset($data['plCategory'])){
+ foreach($data['plCategory'] as $id => $name){
+ if(!is_numeric($id)){
+ $this->catTranslations[$id] = $name['description'];
+ }
+ }
+ }
+ }
}
/*! \brief Returns a list local stored statistic files
// --------
arsort($res['actionsPerCategory']);
+
$mostUsedCategories = array_slice($res['actionsPerCategory'],0,8);
// Dataset definition
$this->graphID_1 = preg_replace("/[^0-9]/","",microtime(TRUE));
$values = array_values($mostUsedCategories);
+
$keys = array_keys($mostUsedCategories);
+ foreach($keys as $id => $cat){
+ $keys[$id] = $this->getCategoryTranslation($cat);
+ }
$DataSet->AddPoint($values,"Serie1");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
- $Test = new pChart(400,200);
+ $Test = new pChart(500,200);
$Test->setFontProperties("./themes/default/fonts/LiberationSans-Regular.ttf",10);
// Add results to our data set.
$DataSet2->AddPoint($dataArray[$category], $category);
- $DataSet2->SetSerieName(_($category), $category);
+ $DataSet2->SetSerieName($this->getCategoryTranslation($category), $category);
$Test->setLabel($DataSet->GetData(),$DataSet->GetDataDescription(),"Serie1",0,"Daily incomes");
$DataSet2->AddSerie($category);
$seriesNumber++;
}
$DataSet2->AddPoint($errors, 'Errors');
- $DataSet2->SetSerieName('Errors', 'Errors');
+ $DataSet2->SetSerieName(_('Error'), 'Errors');
$DataSet2->AddSerie('Errors');
$seriesNumber ++;
return($smarty->fetch(get_template_path('statistics.tpl', TRUE)));
}
+
function check()
{
$messages = plugin::check();
return($messages);
}
+
function save_object()
{
plugin::save_object();
}
+
+
+ /*! \brief This method tries to translate category names.
+ * @param The category name to translate
+ * @return String The translated category names.
+ */
+ function getCategoryTranslation($name)
+ {
+ $ret ="";
+
+ // Extract category names from the given string.
+ $list = preg_split("/, /", $name);
+
+ // We do not have a category for systems directly, so we've to map all system types to 'System'.
+ // If we do not map to _(Systems) the graph legend will be half screen width.
+ if(count(array_intersect(array('server','terminal','workstation', 'opsi', 'component'), $list))){
+ return(_("Systems"));
+ }
+
+ // Walk through category names and try to find a translation.
+ foreach($list as $cat){
+ $cat = trim($cat);
+ if(isset($this->catTranslations[$cat])){
+ $ret .= _($this->catTranslations[$cat]).", ";
+ }else{
+ $ret .= $cat.", ";
+ }
+ }
+ return(rtrim($ret, ', '));
+ }
}
?>