diff --git a/CHANGELOG b/CHANGELOG index 862228a5c..67ea1efaf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ -------------------------------------------------------------------------------- Changes in version 5.1.37 -------------------------------------------------------------------------------- +- do not show chart by category if there are no categories -------------------------------------------------------------------------------- Changes in version 5.1.36 diff --git a/views/bootstrap/class.Charts.php b/views/bootstrap/class.Charts.php index 7cc076860..e9f7f6749 100644 --- a/views/bootstrap/class.Charts.php +++ b/views/bootstrap/class.Charts.php @@ -13,11 +13,6 @@ * @version Release: @package_version@ */ -/** - * Include parent class - */ -//require_once("class.Bootstrap.php"); - /** * Class which outputs the html page for Charts view * @@ -229,8 +224,28 @@ $(document).ready( function() { } } /* }}} */ - function show() { /* {{{ */ - $this->dms = $this->params['dms']; + /** + * Check if it makes sense to show the chart + * + * e.g. it doesn't make sense to show the documents by category if + * there are no categories. + * + * @param string $type + * @return boolean + */ + private function showChart($type) { /* {{{ */ + $dms = $this->params['dms']; + if($type == 'docspercategory') { + if($cats = $dms->getDocumentCategories()) + return true; + else + return false; + } + return true; + } /* }}} */ + + public function show() { /* {{{ */ + $dms = $this->params['dms']; $user = $this->params['user']; $data = $this->params['data']; $type = $this->params['type']; @@ -251,7 +266,8 @@ $(document).ready( function() { $this->contentHeading(getMLText("chart_selection")); $this->contentContainerStart(); foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) { - echo "
".getMLText('chart_'.$atype.'_title')."
\n"; + if($this->showChart($atype)) + echo "
".getMLText('chart_'.$atype.'_title')."
\n"; } $this->contentContainerEnd(); $this->columnEnd();