* Fix bugs

This commit is contained in:
zenggang
2022-05-12 09:06:35 +00:00
parent 3e677efa79
commit e41dc21372
7 changed files with 31 additions and 19 deletions
+11 -1
View File
@@ -47,7 +47,7 @@ class program extends control
if(strtolower($status) == 'bysearch')
{
$queryID = (int)$param;
$programs = $this->program->getListBySearch($orderBy, $pager, $queryID);
$programs = $this->program->getListBySearch($orderBy, $queryID);
}
else
{
@@ -55,6 +55,15 @@ class program extends control
$programIds = array();
foreach($topPrograms as $programID => $program) $programIds[] = $programID;
$programs = $this->program->getList($status, $orderBy, null, 'child', $programIds);
/* Get summary. */
$topCount = $indCount = 0;
foreach($programs as $program)
{
if($program->type == 'program' and $program->parent == 0) $topCount ++;
if($program->type == 'project' and $program->parent == 0) $indCount ++;
}
$summary = sprintf($this->lang->program->summary, $topCount, $indCount);
}
}
@@ -78,6 +87,7 @@ class program extends control
$this->view->programs = $programs;
$this->view->status = $status;
$this->view->orderBy = $orderBy;
$this->view->summary = isset($summary) ? $summary : '';
$this->view->pager = $pager;
$this->view->users = $this->user->getPairs('noletter');
$this->view->userIdPairs = $this->user->getPairs('noletter|showid');
+5 -10
View File
@@ -43,13 +43,6 @@ $(function()
$('#programForm').removeClass('has-row-checked');
}
});
var myPager = $('.pager').data('zui.pager');
if(status != 'bySearch' && myPager)
{
myPager.lang.pageSize = pageSize;
myPager.set();
}
});
function showEditCheckbox(show)
@@ -76,13 +69,15 @@ function showEditCheckbox(show)
});
if(show)
{
var tableFooter = "<div class='table-footer'><div class='checkbox-primary check-all'><input type='checkbox' id='checkAll' /><label>" + selectAll + "</label></div><div class='table-actions btn-toolbar'><button type='submit' class='btn'>" + edit + "</button></div></div>";
$('#programForm').attr('action', createLink('project', 'batchEdit', 'from=program')).append(tableFooter);
var tableFooter = "<div class='editCheckbox'><div class='checkbox-primary check-all'><input type='checkbox' id='checkAll' /><label>" + selectAll + "</label></div><div class='table-actions btn-toolbar'><button type='submit' class='btn'>" + edit + "</button></div></div>";
$('#programForm').attr('action', createLink('project', 'batchEdit', 'from=program'));
$('.table-footer').prepend(tableFooter).show();
$('body').scroll();
}
else
{
$('#programForm').find('.table-footer').remove();
$('#programForm').find('.editCheckbox').remove();
if($('#programForm .pager').length == 0) $('.table-footer').hide();
$('#programForm').removeAttr('action');
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ $lang->program->moreProgram = 'More program';
$lang->program->stakeholderType = 'Stakeholder type';
$lang->program->parentBudget = 'Parent program surplus budget:';
$lang->program->isStakeholderKey = 'Key stakeholder';
$lang->program->pageSize = '<strong>{recPerPage}</strong> Top Programs per page';
$lang->program->summary = 'This page contains %d top programs and %d independent projects.';
$lang->program->stakeholderTypeList['inside'] = 'Inside';
$lang->program->stakeholderTypeList['outside'] = 'Outside';
+1 -1
View File
@@ -74,7 +74,7 @@ $lang->program->moreProgram = '更多项目集';
$lang->program->stakeholderType = '干系人类型';
$lang->program->parentBudget = '所属项目集剩余预算:';
$lang->program->isStakeholderKey = '关键干系人';
$lang->program->pageSize = '每页 <strong>{recPerPage}</strong> 项顶级项目集';
$lang->program->summary = '本页共 %d 个顶级项目集,%d 个独立项目。';
$lang->program->stakeholderTypeList['inside'] = '内部';
$lang->program->stakeholderTypeList['outside'] = '外部';
+9 -4
View File
@@ -168,12 +168,11 @@ class programModel extends model
* Get program list by search.
*
* @param string $orderBy
* @param object $pager
* @param int $queryID
* @access public
* @return void
*/
public function getListBySearch($orderBy = 'id_asc', $pager = NULL, $queryID = 0)
public function getListBySearch($orderBy = 'id_asc', $queryID = 0)
{
if($queryID)
{
@@ -194,7 +193,7 @@ class programModel extends model
}
$query = $this->session->programQuery;
return $this->dao->select('*')->from(TABLE_PROGRAM)
$programs = $this->dao->select('*')->from(TABLE_PROGRAM)
->where('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->andWhere('((type')->eq('program')
@@ -206,8 +205,14 @@ class programModel extends model
->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi()
->beginIF($query)->andWhere($query)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
/* Do not display project separately. */
foreach($programs as $id => $program)
{
if($program->type == 'project' and !isset($programs[$program->parent])) unset($programs[$id]);
}
return $programs;
}
/**
-1
View File
@@ -15,7 +15,6 @@
<?php js::set('orderBy', $orderBy);?>
<?php js::set('edit', $lang->edit);?>
<?php js::set('selectAll', $lang->selectAll);?>
<?php js::set('pageSize', $lang->program->pageSize);?>
<?php if($programType == 'bygrid'):?>
<style> #mainMenu{padding-left: 10px; padding-right: 10px;} </style>
<?php endif;?>
+4 -1
View File
@@ -138,7 +138,10 @@
<?php endforeach;?>
</tbody>
</table>
<div class='table-footer'><?php $pager->show('right', 'pagerjs');?></div>
<div class='table-footer <?php if($status == 'bySearch') echo 'hide';?>'>
<div class="table-statistic"><?php echo $summary;?></div>
<?php if($status != 'bySearch') $pager->show('right', 'pagerjs');?>
</div>
</form>
<style>
#programTableList.sortable-sorting > tr {opacity: 0.7}