function getHTMLTree($selecteddir, $linkmenu, $docGroupId = 0) {
global $g; // the master group of all the groups .... anyway. Needed to support projects-hierarchy plugin
$dg = new DocumentGroup($this->Group);
- switch ($linkmenu) {
- case 'listtrashfile': {
- $stateId = 2;
- $doc_group_stateid = array(2);
- break;
- }
- default: {
- $stateId = 1;
- $doc_group_stateid = array(1);
- if (forge_check_perm('docman', $this->Group->getID(), 'approve')) {
- $doc_group_stateid = array(1, 3, 4, 5);
- }
- break;
+ if ($linkmenu == 'listtrashfile') {
+ $stateId = 2;
+ $doc_group_stateid = array(2);
+ } else {
+ $stateId = 1;
+ $doc_group_stateid = array(1);
+ if (forge_check_perm('docman', $this->Group->getID(), 'approve')) {
+ $doc_group_stateid = array(1, 3, 4, 5);
}
}
$subGroupIdArr = $dg->getSubgroup($docGroupId, $doc_group_stateid);
} else {
$stateQuery = db_query_params('select * from doc_states order by stateid', array());
}
- switch ($format) {
- case 'json': {
- $returnString = '{';
- while ($stateArr = db_fetch_array($stateQuery)) {
- $returnString .= util_html_secure($stateArr['name']).': \''.$stateArr['stateid'].'\',';
- }
- return $returnString.'}';
- }
- default: {
- return $stateQuery;
+ if ($format == 'json') {
+ $returnString = '{';
+ while ($stateArr = db_fetch_array($stateQuery)) {
+ $returnString .= util_html_secure($stateArr['name']).': \''.$stateArr['stateid'].'\',';
}
+ return $returnString.'}';
}
+ return $stateQuery;
}
/**
$text_array = array();
$this->buildArrays($nested_groups, $id_array, $text_array, array());
$rows = count($id_array);
- switch ($format) {
- case 'json': {
- $returnString = '[';
- for ($i = 0; $i < $rows; $i++) {
- $returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
- }
- $returnString .= ']';
- break;
+ if ($format == 'json') {
+ $returnString = '[';
+ for ($i = 0; $i < $rows; $i++) {
+ $returnString .= '['.$id_array[$i].',\''.util_html_secure(addslashes($text_array[$i])).'\'],';
}
+ $returnString .= ']';
}
return $returnString;
}