$value) {
if ($category[$key]['level'] == 0) {
$categorytree .= showcategoryrow($key, 0);
}
}
}
include_once template("portal/portalcp_index");
function showcategoryrow($key, $level = 0, $last = '') {
global $category, $permissioncategory, $permission;
$value = $category[$key];
$return = '';
$op = $addarticle = $artilcemanage = '';
$value['articles'] = category_get_num('portal', $key);
if (checkperm('allowmanagearticle') || checkperm('allowmanage') || $permission[$key]['allowmanage']) {
$addarticle .= ''.lang('portalcp', 'article_manage').'';
}
if ((checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $permission[$key]['allowmanage'] || $permission[$key]['allowpublish']) && empty($value['disallowpublish'])) {
$artilcemanage .= ''.lang('portalcp', 'article_publish').'';
}
if($addarticle && $artilcemanage) {
$op = $addarticle.'|'.$artilcemanage;
} else {
$op = $addarticle ? $addarticle : $artilcemanage;
}
if($level == 2) {
$class = $last ? 'lastchildcat' : 'childcat';
$return = '
| '.$value['articles'].' | '.$op.' |
';
} elseif($level == 1) {
$return = ' | '.$value['articles'].' | '.$op.' |
';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$i = 1;
$l = count($children);
foreach($children as $v){
$return .= showcategoryrow($v, 2 ,$i++ == $l);
}
} else {
$return = ' | '.$value['articles'].' | '.$op.' |
';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
foreach($children as $v){
$return .= showcategoryrow($v, 1);
}
}
return $return;
}
function showcategoryrowpush($key, $level = 0, $last = '') {
global $_G, $category, $permissioncategory, $permission;
$value = $category[$key];
$return = '';
$op = '';
if (checkperm('allowmanagearticle') || checkperm('allowpostarticle') || $permission[$key]['allowpublish'] || $permission[$key]['allowmanage']) {
if(empty($value['disallowpublish'])){
$value['pushurl'] = ''.$value['catname'].'';
} else {
$value['pushurl'] = $value['catname'];
}
}
if($level == 2) {
$class = $last ? 'lastchildcat' : 'childcat';
$return = ' | '.$value['pushurl'].' |
';
} elseif($level == 1) {
$return = ' | '.$value['pushurl'].' |
';
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$i = 1;
$l = count($children);
foreach($children as $v) {
$return .= showcategoryrowpush($v, 2, $i++ == $l);
}
} else {
$children = checkperm('allowmanagearticle') ? $category[$key]['children'] : $permissioncategory[$key]['permissionchildren'];
$childrennum = count($children);
$toggle = $childrennum > 25 ? ' style="display:none"' : '';
$return = ''.($toggle ? '[+]' : '[-]').' | '
.''.$value['pushurl'].' |
';
foreach($children as $v) {
$return .= showcategoryrowpush($v, 1, '');
}
$return .= '';
}
return $return;
}
?>