do not show chart by category if there are no categories

This commit is contained in:
Uwe Steinmann 2024-11-07 13:52:43 +01:00
parent 63693d73b0
commit 9573d473e9
2 changed files with 25 additions and 8 deletions

View File

@ -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

View File

@ -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 "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
if($this->showChart($atype))
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
}
$this->contentContainerEnd();
$this->columnEnd();