@@ -66,6 +66,11 @@ public function index()
66
66
$ buildSettings = $ this ->settings ['phpci ' ]['build ' ];
67
67
}
68
68
69
+ $ latestBuildsSettings = array ();
70
+ if (isset ($ this ->settings ['phpci ' ]['latest_builds ' ])) {
71
+ $ latestBuildsSettings = $ this ->settings ['phpci ' ]['latest_builds ' ];
72
+ }
73
+
69
74
$ emailSettings = array ();
70
75
if (isset ($ this ->settings ['phpci ' ]['email_settings ' ])) {
71
76
$ emailSettings = $ this ->settings ['phpci ' ]['email_settings ' ];
@@ -78,6 +83,7 @@ public function index()
78
83
79
84
$ this ->view ->configFile = PHPCI_CONFIG_FILE ;
80
85
$ this ->view ->basicSettings = $ this ->getBasicForm ($ basicSettings );
86
+ $ this ->view ->latestBuildsSettings = $ this ->getLatestBuildsForm ($ latestBuildsSettings );
81
87
$ this ->view ->buildSettings = $ this ->getBuildForm ($ buildSettings );
82
88
$ this ->view ->github = $ this ->getGithubForm ();
83
89
$ this ->view ->emailSettings = $ this ->getEmailForm ($ emailSettings );
@@ -178,6 +184,26 @@ public function basic()
178
184
179
185
return $ response ;
180
186
}
187
+ /**
188
+ * Save basic settings.
189
+ */
190
+ public function latestBuilds ()
191
+ {
192
+ $ this ->requireAdmin ();
193
+
194
+ $ this ->settings ['phpci ' ]['latest_builds ' ] = $ this ->getParams ();
195
+ $ error = $ this ->storeSettings ();
196
+
197
+ $ response = new b8 \Http \Response \RedirectResponse ();
198
+
199
+ if ($ error ) {
200
+ $ response ->setHeader ('Location ' , PHPCI_URL . 'settings?saved=2 ' );
201
+ } else {
202
+ $ response ->setHeader ('Location ' , PHPCI_URL . 'settings?saved=1 ' );
203
+ }
204
+
205
+ return $ response ;
206
+ }
181
207
182
208
/**
183
209
* Handle authentication settings
@@ -427,6 +453,40 @@ protected function getBuildForm($values = array())
427
453
return $ form ;
428
454
}
429
455
456
+ /**
457
+ * Get the Build settings form.
458
+ * @param array $values
459
+ * @return Form
460
+ */
461
+ protected function getLatestBuildsForm ($ values = array ())
462
+ {
463
+ $ form = new Form ();
464
+ $ form ->setMethod ('POST ' );
465
+ $ form ->setAction (PHPCI_URL . 'settings/latestBuilds ' );
466
+
467
+ $ field = new Form \Element \Checkbox ('show_branch ' );
468
+ $ field ->setRequired (false );
469
+ $ field ->setLabel (Lang::get ('show_branch ' ));
470
+ $ field ->setContainerClass ('form-group ' );
471
+ $ field ->setClass ('ml20px ' );
472
+ $ field ->setCheckedValue (1 );
473
+
474
+ if (isset ($ values ['show_branch ' ])) {
475
+ $ field ->setValue ((int )$ values ['show_branch ' ]);
476
+ }
477
+
478
+ $ form ->addField ($ field );
479
+
480
+ $ field = new Form \Element \Submit ();
481
+ $ field ->setValue (Lang::get ('save ' ));
482
+ $ field ->setClass ('btn btn-success pull-right ' );
483
+ $ form ->addField ($ field );
484
+
485
+ $ form ->setValues ($ values );
486
+
487
+ return $ form ;
488
+ }
489
+
430
490
/**
431
491
* Get the Basic settings form.
432
492
* @param array $values
@@ -474,6 +534,7 @@ protected function getAuthenticationForm($values = array())
474
534
$ field = new Form \Element \Checkbox ('disable_authentication ' );
475
535
$ field ->setCheckedValue (1 );
476
536
$ field ->setRequired (false );
537
+ $ field ->setClass ('ml20px ' );
477
538
$ field ->setLabel ('Disable Authentication? ' );
478
539
$ field ->setContainerClass ('form-group ' );
479
540
$ field ->setValue (0 );
0 commit comments