* Adjust code.

This commit is contained in:
Yagami
2020-11-19 08:53:47 +08:00
parent 540728e3fa
commit 7eaf1d34e1
5 changed files with 14 additions and 17 deletions
+7 -12
View File
@@ -932,7 +932,7 @@ class programModel extends model
}
/**
* Get the program to which the project belongs.
* Get the top program which the project belongs to.
*
* @param int $projectID
* @access public
@@ -941,19 +941,14 @@ class programModel extends model
public function getTopProgramID($projectID)
{
if(empty($projectID)) return 0;
$program = $this->getPGMByID($projectID);
$project = $this->getPRJByID($projectID);
if($project->parent == 0) return 0;
$programID = 0;
if($program->parent > 0)
{
$path = explode(',', $program->path);
$path = array_filter($path);
$programID = current($path);
}
elseif($program->parent == 0)
{
$programID = $program->id;
}
$path = explode(',', $project->path);
$path = array_filter($path);
$programID = current($path);
return $programID;
}
-1
View File
@@ -21,7 +21,6 @@
<?php foreach($lang->program->PGMFeatureBar as $key => $label):?>
<?php $active = $status == $key ? 'btn-active-text' : '';?>
<?php $label = "<span class='text'>$label</span>";?>
<?php if($status == $key) $label .= " <span class='label label-light label-badge'>{$pager->recTotal}</span>";?>
<?php echo html::a(inlink('pgmbrowse', "status=$key&orderBy=$orderBy"), $label, '', "class='btn btn-link $active'");?>
<?php endforeach;?>
<?php echo html::checkbox('showClosed', array('1' => $lang->program->PGMShowClosed), '', $this->cookie->showClosed ? 'checked=checked' : '');?>
+2 -3
View File
@@ -1,7 +1,7 @@
<?php $canOrder = (common::hasPriv('program', 'updateOrder') and strpos($orderBy, 'order') !== false)?>
<form class='main-table' id='programForm' method='post' data-ride='table' data-nested='true' data-expand-nest-child='false' data-checkable='false'>
<table class='table has-sort-head table-fixed table-nested' id='programList'>
<?php $vars = "status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<?php $vars = "status=$status&orderBy=%s";?>
<thead>
<tr>
<th class='table-nest-title'>
@@ -25,8 +25,7 @@
if($program->type == 'program')
{
$trAttrs .= " data-nested='true'";
if($program->parent == '0') $trClass .= ' is-top-level table-nest-child-hide';
else $trClass .= ' table-nest-hide';
$trClass .= $program->parent == '0' ? ' is-top-level table-nest-child-hide' : ' table-nest-hide';
}
if($program->parent and isset($programs[$program->parent]))