Skip to content

Commit 189d86d

Browse files
committed
Added feature to move questions to hidden from hidden for exam.
1 parent 071c95b commit 189d86d

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

Controller/AdminController.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

Menu/ExtensionMenu.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,18 @@ private function getAdmin(): ?ItemInterface
120120
'route' => 'paustianquickcheckmodule_admin_examineall'
121121
]);
122122

123-
$menu['Processing']->addChild('Move Hidden Questions to public', [
123+
$menu['Processing']->addChild('Move Hidden Exam Questions to public', [
124124
'route' => 'paustianquickcheckmodule_admin_hiddentopublic'
125125
]);
126126

127127
$menu['Processing']->addChild('Move Hidden Student Questions to public', [
128128
'route' => 'paustianquickcheckmodule_admin_hiddenstudenttopublic'
129129
]);
130130

131+
$menu['Processing']->addChild('Move Hidden Exam Questions to Hidden Student Questions', [
132+
'route' => 'paustianquickcheckmodule_admin_hiddentohiddenst'
133+
]);
134+
131135
$menu['Processing']->addChild('Import questions from XML file', [
132136
'route' => 'paustianquickcheckmodule_admin_importquiz'
133137
]);

Resources/views/Rmd/rmd_export.rmd.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Solution
1414
Answerlist
1515
----------
1616
{% for solution in solutions %}
17-
* {{ solution|raw }}
17+
*
1818
{% endfor %}
1919

2020
Meta-information

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "paustian/quickcheck-module",
3-
"version": "4.3.3",
3+
"version": "4.3.4",
44
"description": "Module for creating quizzes that you can attach to other modules",
55
"type": "zikula-module",
66
"license": "LGPL-3.0+",

0 commit comments

Comments
 (0)