Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2016-03-03 15:42:19 +08:00
5 changed files with 124 additions and 65 deletions
+1 -5
View File
@@ -281,7 +281,7 @@
<table class='table table-data table-condensed table-borderless table-fixed'>
<tr>
<th class='w-60px'><?php echo $lang->bug->fromCase;?></th>
<td><?php if($bug->case) echo html::a($this->createLink('testcase', 'view', "caseID=$bug->case"), $bug->caseTitle);?></td>
<td><?php if($bug->case) echo html::a($this->createLink('testcase', 'view', "caseID=$bug->case"), "#$bug->case $bug->caseTitle", '_blank');?></td>
</tr>
<tr>
<th><?php echo $lang->bug->toCase;?></th>
@@ -308,10 +308,6 @@
?>
</td>
</tr>
<tr>
<th><?php echo $lang->bug->case;?></th>
<td><?php if(isset($bug->caseTitle)) echo html::a($this->createLink('testcase', 'view', "caseID=$bug->case"), "#$bug->case $bug->caseTitle", '_blank');?></td>
</tr>
<tr>
<th><?php echo $lang->bug->toStory;?></th>
<td><?php if($bug->toStory != 0) echo html::a($this->createLink('story', 'view', "storyID=$bug->toStory"), "#$bug->toStory $bug->toStoryTitle", '_blank');?></td>
+4 -57
View File
@@ -160,65 +160,12 @@ class project extends control
if($this->app->getViewType() == 'mhtml') $recPerPage = 10;
$pager = new pager($recTotal, $recPerPage, $pageID);
$tasks = array();
if($status == 'byProduct')
{
$modules = $this->tree->getProjectModule($projectID, $productID);
$tasks = $this->task->getTasksByModule($projectID, $modules, $sort, $pager);
}
elseif($status == 'byModule')
{
$tasks = $this->task->getTasksByModule($projectID, $this->tree->getAllChildID($moduleID), $sort, $pager);
}
elseif($browseType != "bysearch")
{
$qureyStatus = $status == 'byProject' ? 'all' : $status;
if($qureyStatus == 'unclosed')
{
$qureyStatus = $this->lang->task->statusList;
unset($qureyStatus['closed']);
$qureyStatus = array_keys($qureyStatus);
}
$tasks = $this->task->getProjectTasks($projectID, $qureyStatus, $sort, $pager);
}
else
{
if($queryID)
{
$query = $this->search->getQuery($queryID);
if($query)
{
$this->session->set('taskQuery', $query->sql);
$this->session->set('taskForm', $query->form);
}
else
{
$this->session->set('taskQuery', ' 1 = 1');
}
}
else
{
if($this->session->taskQuery == false) $this->session->set('taskQuery', ' 1 = 1');
}
/* Limit current project when no project. */
if(strpos($this->session->taskQuery, "`project` =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND `project` = $projectID");
if(strpos($this->session->taskQuery, "deleted =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND deleted = '0'");
$projectQuery = "`project`" . helper::dbIN(array_keys($this->projects));
$taskQuery = str_replace("`project` = 'all'", $projectQuery, $this->session->taskQuery); // Search all project.
$this->session->set('taskQueryCondition', $taskQuery);
$this->session->set('taskOnlyCondition', true);
$this->session->set('taskOrderBy', $sort);
$tasks = $this->project->getSearchTasks($taskQuery, $pager, $sort);
}
/* Get tasks. */
$tasks = $this->project->getTasks($productID, $projectID, $this->projects, $status, $browseType, $queryID, $moduleID, $sort, $pager);
/* Build the search form. */
$this->config->project->search['actionURL'] = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch&param=myQueryID");
$this->config->project->search['queryID'] = $queryID;
$this->config->project->search['params']['project']['values'] = array(''=>'', $projectID => $this->projects[$projectID], 'all' => $this->lang->project->allProject);
$this->config->project->search['params']['module']['values'] = $this->tree->getTaskOptionMenu($projectID, $startModuleID = 0);
$actionURL = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch&param=myQueryID");
$this->project->buildSearchForm($projectID, $this->projects, $queryID, $actionURL);
$this->search->setSearchParams($this->config->project->search);
/* team member pairs. */
+96
View File
@@ -726,6 +726,84 @@ class projectModel extends model
return $stats;
}
/**
* Get tasks.
*
* @param int $productID
* @param int $projectID
* @param array $projects
* @param string $status
* @param string $browseType
* @param int $queryID
* @param int $moduleID
* @param string $sort
* @param object $pager
* @access public
* @return array
*/
public function getTasks($productID, $projectID, $projects, $status, $browseType, $queryID, $moduleID, $sort, $pager)
{
$this->loadModel('task');
/* Get tasks. */
if($status == 'byProduct')
{
$modules = $this->loadModel('tree')->getProjectModule($projectID, $productID);
$tasks = $this->task->getTasksByModule($projectID, $modules, $sort, $pager);
}
elseif($status == 'byModule')
{
$tasks = $this->task->getTasksByModule($projectID, $this->loadModel('tree')->getAllChildID($moduleID), $sort, $pager);
}
elseif($browseType != "bysearch")
{
$qureyStatus = $status == 'byProject' ? 'all' : $status;
if($qureyStatus == 'unclosed')
{
$qureyStatus = $this->lang->task->statusList;
unset($qureyStatus['closed']);
$qureyStatus = array_keys($qureyStatus);
}
$tasks = $this->task->getProjectTasks($projectID, $qureyStatus, $sort, $pager);
}
else
{
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set('taskQuery', $query->sql);
$this->session->set('taskForm', $query->form);
}
else
{
$this->session->set('taskQuery', ' 1 = 1');
}
}
else
{
if($this->session->taskQuery == false) $this->session->set('taskQuery', ' 1 = 1');
}
/* Limit current project when no project. */
if(strpos($this->session->taskQuery, "`project` =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND `project` = $projectID");
if(strpos($this->session->taskQuery, "deleted =") === false) $this->session->set('taskQuery', $this->session->taskQuery . " AND deleted = '0'");
$projectQuery = "`project`" . helper::dbIN(array_keys($projects));
$taskQuery = str_replace("`project` = 'all'", $projectQuery, $this->session->taskQuery); // Search all project.
$this->session->set('taskQueryCondition', $taskQuery);
$this->session->set('taskOnlyCondition', true);
$this->session->set('taskOrderBy', $sort);
$tasks = $this->getSearchTasks($taskQuery, $pager, $sort);
}
if($tasks) return $tasks;
return array();
}
/**
* Get project by id.
*
@@ -1679,4 +1757,22 @@ class projectModel extends model
->where('project')->eq($projectID)
->fetchPairs();
}
/**
* Build search form.
*
* @param int $projectID
* @param array $projects
* @param int $queryID
* @param string $actionURL
* @access public
* @return void
*/
public function buildSearchForm($projectID, $projects, $queryID, $actionURL)
{
$this->config->project->search['actionURL'] = $actionURL;
$this->config->project->search['queryID'] = $queryID;
$this->config->project->search['params']['project']['values'] = array(''=>'', $projectID => $projects[$projectID], 'all' => $this->lang->project->allProject);
$this->config->project->search['params']['module']['values'] = $this->loadModel('tree')->getTaskOptionMenu($projectID, $startModuleID = 0);
}
}
+22 -2
View File
@@ -275,12 +275,23 @@
</div>
<div class='tab-pane' id='legendRelated'>
<table class='table table-data table-condensed table-borderless'>
<tr class='text-top'>
<th class='w-70px'><?php echo $lang->story->legendFromBug;?></th>
<td class='pd-0'>
<ul class='list-unstyled'>
<?php if(!empty($fromBug)) echo "<li title='#$fromBug->id $fromBug->title'>" . html::a($this->createLink('bug', 'view', "bugID=$fromBug->id"), "#$fromBug->id $fromBug->title") . '</li>';?>
</ul>
</td>
</tr>
<tr class='text-top'>
<th class='w-70px'><?php echo $lang->story->legendBugs;?></th>
<td class='pd-0'>
<ul class='list-unstyled'>
<?php
if(!empty($fromBug)) echo "<li title='#$fromBug->id $fromBug->title'>" . html::a($this->createLink('bug', 'view', "bugID=$fromBug->id"), "#$fromBug->id $fromBug->title") . " <span class='label label-warning'>{$lang->story->legendFromBug}</span></li>";
foreach($bugs as $bug)
{
echo "<li title='#$bug->id $bug->title'>" . html::a($this->createLink('bug', 'view', "bugID=$bug->id"), "#$bug->id $bug->title") . '</li>';
}
?>
</ul>
</td>
@@ -308,10 +319,19 @@
{
if(isset($story->extraStories[$linkStoryID])) echo '<li>' . html::a(inlink('view', "storyID=$linkStoryID"), "#$linkStoryID " . $story->extraStories[$linkStoryID]) . '</li>';
}
?>
</ul>
</td>
</tr>
<tr class='text-top'>
<th><?php echo $lang->story->legendChildStories;?></th>
<td class='pd-0'>
<ul class='list-unstyled'>
<?php
$childStories = explode(',', $story->childStories) ;
foreach($childStories as $childStoryID)
{
if(isset($story->extraStories[$childStoryID])) echo '<li>' . html::a(inlink('view', "storyID=$childStoryID"), "#$childStoryID " . $story->extraStories[$childStoryID]) . " <span class='label label-info'>{$lang->story->legendChildStories}</span></li>";
if(isset($story->extraStories[$childStoryID])) echo '<li>' . html::a(inlink('view', "storyID=$childStoryID"), "#$childStoryID " . $story->extraStories[$childStoryID]) . '</li>';
}
?>
</ul>
+1 -1
View File
@@ -225,7 +225,7 @@ class testcaseModel extends model
* @param int $queryID
* @param int $moduleID
* @param int $sort
* @param int $pager
* @param object $pager
* @access public
* @return array
*/