* code for task#2171.

This commit is contained in:
xia0ta0
2014-12-10 17:36:45 +08:00
parent 08359a0bfd
commit 571770ea9b
3 changed files with 35 additions and 18 deletions
+10 -2
View File
@@ -37,18 +37,26 @@ class project extends control
* @access public
* @return void
*/
public function index($locate = 'yes', $status = 'undone', $projectID = 0)
public function index($locate = 'yes', $status = 'undone', $projectID = 0, $orderBy = 'code_asc', $recTotal = 0, $recPerPage = 10, $pageID = 1)
{
if($locate == 'yes') $this->locate($this->createLink('project', 'task'));
if($this->projects) $this->commonAction($projectID);
$this->session->set('projectList', $this->app->getURI(true));
/* Load pager and get tasks. */
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$this->app->loadLang('my');
$this->view->title = $this->lang->project->allProject;
$this->view->position[] = $this->lang->project->allProject;
$this->view->projectStats = $this->project->getProjectStats($status);
$this->view->projectStats = $this->project->getProjectStats($status, 0, 30, $orderBy, $pager);
$this->view->projectID = $projectID;
$this->view->pager = $pager;
$this->view->recTotal = $pager->recTotal;
$this->view->recPerPage = $pager->recPerPage;
$this->view->orderBy = $orderBy;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->status = $status;
+16 -8
View File
@@ -610,13 +610,27 @@ class projectModel extends model
* Get project stats.
*
* @param string $status
* @param int $productID
* @param int $itemCounts
* @param string $orderBy
* @param int $pager
* @access public
* @return array
* @return void
*/
public function getProjectStats($status = 'undone', $productID = 0, $itemCounts = 30)
public function getProjectStats($status = 'undone', $productID = 0, $itemCounts = 30, $orderBy = 'code', $pager = null)
{
/* Init vars. */
$projects = $this->getList($status, 0, $productID);
foreach($projects as $projectID => $project)
{
if(!$this->checkPriv($project)) unset($projects[$projectID]);
}
$projects = $this->dao->select('*')->from(TABLE_PROJECT)
->where('id')->in(array_keys($projects))
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
$projectKeys = array_keys($projects);
$stats = array();
$hours = array();
@@ -681,12 +695,6 @@ class projectModel extends model
/* Process projects. */
foreach($projects as $key => $project)
{
if(!$this->checkPriv($project))
{
unset($projects[$key]);
continue;
}
// Process the end time.
$project->end = date("Y-m-d", strtotime($project->end));
+9 -8
View File
@@ -11,7 +11,6 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/sparkline.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<div id='featurebar'>
<div class='actions'>
<?php echo html::a($this->createLink('project', 'create'), "<i class='icon-plus'></i> " . $lang->project->create,'', "class='btn'") ?>
@@ -26,15 +25,16 @@
</ul>
</div>
<form class='form-condensed' method='post' action='<?php echo inLink('batchEdit', "projectID=$projectID");?>'>
<table class='table table-fixed'>
<table class='table table-fixed tablesorter'>
<?php $vars = "locate=no&status=$status&projectID=$projectID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
<thead>
<tr>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th class='w-150px'><?php echo $lang->project->name;?></th>
<th><?php echo $lang->project->code;?></th>
<th><?php echo $lang->project->PM;?></th>
<th><?php echo $lang->project->end;?></th>
<th><?php echo $lang->project->status;?></th>
<th class='w-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-200px'><?php common::printOrderLink('name', $orderBy, $vars, $lang->project->name);?></th>
<th><?php common::printOrderLink('code', $orderBy, $vars, $lang->project->code);?></th>
<th><?php common::printOrderLink('PM', $orderBy, $vars, $lang->project->PM);?></th>
<th><?php common::printOrderLink('end', $orderBy, $vars, $lang->project->end);?></th>
<th><?php common::printOrderLink('status', $orderBy, $vars, $lang->project->status);?></th>
<th><?php echo $lang->project->totalEstimate;?></th>
<th><?php echo $lang->project->totalConsumed;?></th>
<th><?php echo $lang->project->totalLeft;?></th>
@@ -74,6 +74,7 @@
<?php echo "<div class='btn-group'>" . html::selectButton() . '</div>';?>
<?php echo html::submitButton($lang->project->batchEdit);?>
</div>
<div class='text-right'><?php $pager->show();?></div>
</td>
</tr>
</tfoot>