* finish the task #547.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-10-17 01:45:01 +00:00
parent a5fe7d91d0
commit b9f4ea623e
6 changed files with 23 additions and 5 deletions

View File

@@ -258,7 +258,7 @@ class actionModel extends model
* @access public
* @return array
*/
public function getDynamic($account = 'all', $period = 'all', $orderBy = 'date_desc', $pager = null, $projectID = 0)
public function getDynamic($account = 'all', $period = 'all', $orderBy = 'date_desc', $pager = null, $productID = 'all', $projectID = 'all')
{
$period = $this->computeBeginAndEnd($period);
extract($period);
@@ -267,7 +267,8 @@ class actionModel extends model
->where('date')->gt($begin)
->andWhere('date')->lt($end)
->beginIF($account != 'all')->andWhere('actor')->eq($account)->fi()
->beginIF($projectID != 0)->andWhere('project')->eq($projectID)->fi()
->beginIF($productID != 'all')->andWhere('product')->eq($productID)->fi()
->beginIF($projectID != 'all')->andWhere('project')->eq($projectID)->fi()
->orderBy($orderBy)->page($pager)->fetchAll();
if(!$actions) return array();

View File

@@ -173,14 +173,21 @@ class company extends control
/* Set the user and type. */
$account = $type == 'account' ? $param : 'all';
$product = $type == 'product' ? $param : 'all';
$project = $type == 'project' ? $param : 'all';
$period = ($type == 'account' or $type == 'project') ? 'all' : $type;
$period = ($type == 'account' or $type == 'product' or $type == 'project') ? 'all' : $type;
/* Get products' list.*/
$products = $this->loadModel('product')->getPairs();
$products[0] = $this->lang->product->select;
ksort($products);
/* Get projects' list.*/
$projects = $this->loadModel('project')->getPairs();
$projects = $this->loadModel('project')->getPairs();
$projects[0] = $this->lang->project->select;
ksort($projects);
/* Get users.*/
$users = $this->loadModel('user')->getPairs('nodeleted|noletter');
$users[''] = $this->lang->user->select;
@@ -191,10 +198,12 @@ class company extends control
/* Assign. */
$this->view->type = $type;
$this->view->users = $users;
$this->view->products = $products;
$this->view->projects = $projects;
$this->view->account = $account;
$this->view->product = $product;
$this->view->project = $project;
$this->view->actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, $project);
$this->view->actions = $this->loadModel('action')->getDynamic($account, $period, $orderBy, $pager, $product, $project);
$this->display();
}

View File

@@ -8,3 +8,8 @@ function changeProject(project)
link = createLink('company', 'dynamic', 'type=project&param=' + project);
location.href = link;
}
function changeProduct(product)
{
link = createLink('company', 'dynamic', 'type=product&param=' + product);
location.href = link;
}

View File

@@ -23,6 +23,7 @@
echo '<span id="lastmonth">' . html::a(inlink('dynamic', "type=lastmonth"), $lang->action->dynamic->lastMonth) . '</span>';
echo '<span id="all">' . html::a(inlink('dynamic', "type=all"), $lang->action->dynamic->all) . '</span>';
echo "<span id='account'>" . html::select('account', $users, $account, 'onchange=changeUser(this.value)') . '</span>';
echo "<span id='product'>" . html::select('product', $products, $product, 'onchange=changeProduct(this.value)') . '</span>';
echo "<span id='project'>" . html::select('project', $projects, $project, 'onchange=changeProject(this.value)') . '</span>';
?>
</div>

View File

@@ -17,6 +17,7 @@ $lang->product->edit = "Edit";
$lang->product->create = "Create";
$lang->product->read = "Info";
$lang->product->delete = "Delete";
$lang->product->select = '--select product--';
$lang->product->plans = 'Plans';
$lang->product->releases = 'Releases';

View File

@@ -17,6 +17,7 @@ $lang->product->edit = "编辑产品";
$lang->product->create = "新增产品";
$lang->product->read = "产品详情";
$lang->product->delete = "删除产品";
$lang->product->select = '--请选择产品--';
$lang->product->plans = '计划数';
$lang->product->releases = '发布数';