Assigned tasks on user pages
The list of tasks assigned to an user will now appear on the page of the assignee, minus the 'Assigned to' part because that'd be redundant.
This commit is contained in:
parent
634ed8f5ee
commit
f7bf8c469a
4 changed files with 21 additions and 6 deletions
|
@ -11,6 +11,7 @@ CREATE VIEW tasks_list
|
|||
u1.user_view_name AS added_by,
|
||||
ct.completed_task_time AS completed_at,
|
||||
u2.user_view_name AS assigned_to ,
|
||||
u2.user_id AS assigned_to_id ,
|
||||
u3.user_view_name AS completed_by ,
|
||||
t.task_priority AS priority ,
|
||||
bd.bad_deps AS missing_dependencies ,
|
||||
|
|
|
@ -62,6 +62,16 @@ class DAO_Tasks
|
|||
}
|
||||
|
||||
|
||||
public function getUserTasks( $user )
|
||||
{
|
||||
return $this->query(
|
||||
'SELECT * FROM tasks_list '
|
||||
. 'WHERE assigned_to_id = $1 '
|
||||
. 'ORDER BY priority DESC , missing_dependencies ASC NULLS FIRST , added_at DESC'
|
||||
)->execute( $user->user_id );
|
||||
}
|
||||
|
||||
|
||||
public function addTask( $item , $title , $priority , $description )
|
||||
{
|
||||
$result = $this->query( 'SELECT add_task( $1 , $2 , $3 , $4 , $5 ) AS error' )
|
||||
|
|
|
@ -95,8 +95,9 @@ class View_TasksList
|
|||
return;
|
||||
}
|
||||
|
||||
$item = Loader::DAO( 'items' )->get( $task->item );
|
||||
$lineage = $item->lineage;
|
||||
$itemsDao = Loader::DAO( 'items' );
|
||||
$item = $itemsDao->get( $task->item );
|
||||
$lineage = $itemsDao->getLineage( $item );
|
||||
array_push( $lineage , $item->id );
|
||||
|
||||
$contents = array( );
|
||||
|
|
|
@ -100,11 +100,14 @@ class Ctrl_UsersView
|
|||
return 'users';
|
||||
}
|
||||
|
||||
$page->setTitle( 'User ' . $user->user_view_name );
|
||||
$page->setTitle( $user->user_view_name );
|
||||
|
||||
return Loader::View( 'box' , 'User information' , Loader::View( 'users_view' , $user ) )
|
||||
->addButton( BoxButton::create( 'Edit user' , 'users/edit?id=' . $id )
|
||||
->setClass( 'icon edit' ) );
|
||||
return array(
|
||||
Loader::View( 'box' , 'User information' , Loader::View( 'users_view' , $user ) )
|
||||
->addButton( BoxButton::create( 'Edit user' , 'users/edit?id=' . $id )
|
||||
->setClass( 'icon edit' ) ) ,
|
||||
Loader::View( 'box' , 'Assigned tasks' , Loader::View( 'tasks_list' ,
|
||||
Loader::DAO( 'tasks' )->getUserTasks( $user ) , array( 'deps' , 'item' ) ) ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue