@@ -17,9 +17,13 @@ public function fetchAll($format = 'json') {
17
17
18
18
$ model = $ this ->loadModel ('bug ' );
19
19
20
- $ issues = $ model ->getByList ();
20
+ $ project_id = !empty ($ _GET ['project_id ' ]) ? (int ) $ _GET ['project_id ' ] : null ;
21
+ if ($ project_id > 0 ) {
22
+ $ issues = $ model ->getProjectBugs ($ project_id );
23
+ } else {
24
+ $ issues = $ model ->getByList ();
25
+ }
21
26
$ total_count = $ model ->dao ->count ();
22
- //var_dump($issues);
23
27
24
28
$ limit = !empty ($ _GET ['limit ' ]) ? (int )$ _GET ['limit ' ] : 0 ;
25
29
$ offset = !empty ($ _GET ['offset ' ]) ? (int )$ _GET ['offset ' ] : 0 ;
@@ -37,11 +41,11 @@ public function fetchAll($format = 'json') {
37
41
'id ' => (int )$ issue ->id ,
38
42
'subject ' => $ issue ->title ,
39
43
'project ' => array ('id ' => $ issue ->project , 'name ' => $ issue ->project .'111 ' ),
40
- 'tracker ' => array ('id ' => 1 , 'name ' => ' 11 ' ),
44
+ 'tracker ' => array ('id ' => 1 , 'name ' => $ issue -> type ),
41
45
'status ' => array ('id ' => 1 , 'name ' => 'issue ' ),
42
- 'priority ' => array ('id ' => 1 , 'name ' => '11 ' ),
43
- 'author ' => array ('id ' => 1 , 'name ' => ' admin ' ), //TODO
44
- 'assigned_to ' => array ('id ' => 1 , 'name ' => ' admin ' ), //TODO
46
+ 'priority ' => array ('id ' => $ issue -> pri , 'name ' => '11 ' ),
47
+ 'author ' => array ('id ' => 1 , 'name ' => $ issue -> openedBy ), //TODO
48
+ 'assigned_to ' => array ('id ' => 1 , 'name ' => $ issue -> assignedTo ), //TODO
45
49
'description ' => '' ,//$issue->steps
46
50
'start_date ' => date ('Y-m-d ' , strtotime ($ issue ->assignedDate )),
47
51
'due_date ' => date ('Y-m-d ' , strtotime ($ issue ->assignedDate ) + 1000000 ),
@@ -62,8 +66,6 @@ public function fetchAll($format = 'json') {
62
66
* @param string $format
63
67
*/
64
68
public function fetch ($ id , $ format = 'json ' ) {
65
- //echo '{"issue":{"id":1,"project":{"id":1,"name":"project1"},"tracker":{"id":1,"name":"track tag1"},"status":{"id":1,"name":"issue"},"priority":{"id":1,"name":"1"},"author":{"id":2,"name":"Redmine Admin"},"assigned_to":{"id":2,"name":"Redmine Admin"},"subject":"issue 144445555","description":"","start_date":"2015-11-15","due_date":"2015-11-17","done_ratio":0,"spent_hours":0.0,"created_on":"2015-11-15T06:36:35Z","updated_on":"2015-11-15T06:38:28Z","attachments":[],"journals":[{"id":1,"user":{"id":2,"name":"Redmine Admin"},"notes":"","created_on":"2015-11-15T06:38:02Z","details":[{"property":"attr","name":"subject","old_value":"issue 1","new_value":"issue 144445555"}]},{"id":2,"user":{"id":2,"name":"Redmine Admin"},"notes":"","created_on":"2015-11-15T06:38:28Z","details":[{"property":"attr","name":"due_date","new_value":"2015-11-17"},{"property":"attr","name":"assigned_to_id","new_value":"2"}]}],"watchers":[]}}';
66
- //exit;
67
69
$ model = $ this ->loadModel ('bug ' );
68
70
$ issue = $ model ->getById ($ id );
69
71
if (!$ issue ) {
@@ -76,9 +78,9 @@ public function fetch($id, $format = 'json') {
76
78
'subject ' => $ issue ->title ,
77
79
'tracker ' => array ('id ' => 1 , 'name ' => '11 ' ),//
78
80
'priority ' => array ('id ' => 1 , 'name ' => '11 ' ),
79
- 'author ' => array ('id ' => 1 , 'name ' => ' admin ' ),
80
- 'assigned_to ' => array ('id ' => 1 , 'name ' => ' admin ' ),
81
- 'description ' => 'yyy ' , //$issue->steps
81
+ 'author ' => array ('id ' => 1 , 'name ' => $ issue -> openedBy ),
82
+ 'assigned_to ' => array ('id ' => 1 , 'name ' => $ issue -> assignedTo ),
83
+ 'description ' => '' , //$issue->steps
82
84
'start_date ' => date ('Y-m-d ' , strtotime ($ issue ->assignedDate )),
83
85
'due_date ' => date ('Y-m-d ' , strtotime ($ issue ->assignedDate ) + 1000000 ),
84
86
'done_ratio ' => 0 ,
0 commit comments