@@ -72,6 +72,7 @@ class AdminController extends AbstractController {
7272 const _STATUS_VIEWABLE = 0 ;
7373 const _STATUS_MODERATE = 1 ;
7474 const _STATUS_FOREXAM = 2 ;
75+ const _STATUS_HIDDENST = 3 ;
7576
7677 /**
7778 * @var ManagerRegistry
@@ -1451,7 +1452,7 @@ public function examineall(Request $request) :Response {
14511452 * _findHidden
14521453 * @return array
14531454 */
1454- public function _findHidden ($ inStatus = 2 ) : array {
1455+ public function _findHidden ($ inStatus = self :: _STATUS_FOREXAM ) : array {
14551456 //get them all
14561457 $ qb = $ this ->entityManager ->createQueryBuilder ();
14571458 // add select and from params
@@ -1489,6 +1490,30 @@ public function hiddentopublic(Request $request) : RedirectResponse{
14891490 return $ this ->redirect ($ this ->generateUrl ('paustianquickcheckmodule_admin_index ' ));
14901491 }
14911492
1493+ /**
1494+ * @Route("/hiddentohiddenst")
1495+ * @Theme("admin")
1496+ * @param Request $request
1497+ * @return RedirectResponse
1498+ * @throws AccessDeniedException
1499+ */
1500+
1501+ public function hiddentohiddenst (Request $ request ) : RedirectResponse {
1502+ // Security check - important to do this as early as possible to avoid
1503+ // potential security holes or just too much wasted processing
1504+ if (!$ this ->hasPermission ($ this ->name . ':: ' , ':: ' , ACCESS_ADMIN )) {
1505+ throw new AccessDeniedException ();
1506+ }
1507+ $ questions = $ this ->_findHidden ();
1508+
1509+ foreach ($ questions as $ question ){
1510+ $ question ->setStatus (AdminController::_STATUS_HIDDENST );
1511+ $ this ->entityManager ->merge ($ question );
1512+ }
1513+ $ this ->entityManager ->flush ();
1514+ $ this ->addFlash ('status ' , $ this ->trans ('Hidden student questions for exam moved to hidden from students. ' ));
1515+ return $ this ->redirect ($ this ->generateUrl ('paustianquickcheckmodule_admin_index ' ));
1516+ }
14921517 /**
14931518 * @Route("/hiddenstudenttopublic")
14941519 * @Theme("admin")
@@ -1503,7 +1528,7 @@ public function hiddenstudenttopublic(Request $request) : RedirectResponse{
15031528 if (!$ this ->hasPermission ($ this ->name . ':: ' , ':: ' , ACCESS_ADMIN )) {
15041529 throw new AccessDeniedException ();
15051530 }
1506- $ questions = $ this ->_findHidden (3 );
1531+ $ questions = $ this ->_findHidden (self :: _STATUS_HIDDENST );
15071532
15081533 foreach ($ questions as $ question ){
15091534 $ question ->setStatus (AdminController::_STATUS_VIEWABLE );
0 commit comments