Skip to content

Commit

Permalink
Added feature to move questions to hidden from hidden for exam.
Browse files Browse the repository at this point in the history
  • Loading branch information
paustian committed Jul 6, 2023
1 parent 071c95b commit 189d86d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
29 changes: 27 additions & 2 deletions Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class AdminController extends AbstractController {
const _STATUS_VIEWABLE = 0;
const _STATUS_MODERATE = 1;
const _STATUS_FOREXAM = 2;
const _STATUS_HIDDENST = 3;

/**
* @var ManagerRegistry
Expand Down Expand Up @@ -1451,7 +1452,7 @@ public function examineall(Request $request) :Response {
* _findHidden
* @return array
*/
public function _findHidden($inStatus = 2) : array {
public function _findHidden($inStatus = self::_STATUS_FOREXAM) : array {
//get them all
$qb = $this->entityManager->createQueryBuilder();
// add select and from params
Expand Down Expand Up @@ -1489,6 +1490,30 @@ public function hiddentopublic(Request $request) : RedirectResponse{
return $this->redirect($this->generateUrl('paustianquickcheckmodule_admin_index'));
}

/**
* @Route("/hiddentohiddenst")
* @Theme("admin")
* @param Request $request
* @return RedirectResponse
* @throws AccessDeniedException
*/

public function hiddentohiddenst(Request $request) : RedirectResponse{
// Security check - important to do this as early as possible to avoid
// potential security holes or just too much wasted processing
if (!$this->hasPermission($this->name . '::', '::', ACCESS_ADMIN)) {
throw new AccessDeniedException();
}
$questions = $this->_findHidden();

foreach ($questions as $question){
$question->setStatus(AdminController::_STATUS_HIDDENST);
$this->entityManager->merge($question);
}
$this->entityManager->flush();
$this->addFlash('status', $this->trans('Hidden student questions for exam moved to hidden from students.'));
return $this->redirect($this->generateUrl('paustianquickcheckmodule_admin_index'));
}
/**
* @Route("/hiddenstudenttopublic")
* @Theme("admin")
Expand All @@ -1503,7 +1528,7 @@ public function hiddenstudenttopublic(Request $request) : RedirectResponse{
if (!$this->hasPermission($this->name . '::', '::', ACCESS_ADMIN)) {
throw new AccessDeniedException();
}
$questions = $this->_findHidden(3);
$questions = $this->_findHidden(self::_STATUS_HIDDENST);

foreach ($questions as $question){
$question->setStatus(AdminController::_STATUS_VIEWABLE);
Expand Down
6 changes: 5 additions & 1 deletion Menu/ExtensionMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ private function getAdmin(): ?ItemInterface
'route' => 'paustianquickcheckmodule_admin_examineall'
]);

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

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

$menu['Processing']->addChild('Move Hidden Exam Questions to Hidden Student Questions', [
'route' => 'paustianquickcheckmodule_admin_hiddentohiddenst'
]);

$menu['Processing']->addChild('Import questions from XML file', [
'route' => 'paustianquickcheckmodule_admin_importquiz'
]);
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Rmd/rmd_export.rmd.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Solution
Answerlist
----------
{% for solution in solutions %}
* {{ solution|raw }}
*
{% endfor %}

Meta-information
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paustian/quickcheck-module",
"version": "4.3.3",
"version": "4.3.4",
"description": "Module for creating quizzes that you can attach to other modules",
"type": "zikula-module",
"license": "LGPL-3.0+",
Expand Down

0 comments on commit 189d86d

Please sign in to comment.