Skip to content

Commit

Permalink
add pdf filter to corrector administration
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred Neumann committed Dec 20, 2023
1 parent 3565a4c commit 91d7e50
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions classes/CorrectorAdmin/class.CorrectorAdminListGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ protected function filterInputs(): array

}

return ["corrector" => $this->uiFactory->input()->field()->multiselect($this->plugin->txt("correctors"), $correctors),
return [
"pdf_version" => $this->uiFactory->input()->field()->select($this->plugin->txt("filter_pdf_version"),
[self::FILTER_YES => $this->plugin->txt("yes"), self::FILTER_NO => $this->plugin->txt("no")]),
"corrector" => $this->uiFactory->input()->field()->multiselect($this->plugin->txt("correctors"), $correctors),
"corrected" => $this->uiFactory->input()->field()->select($this->plugin->txt("filter_corrected"),
[self::FILTER_YES => $this->plugin->txt("yes"), self::FILTER_NO => $this->plugin->txt("no")]),
"stitch" => $this->uiFactory->input()->field()->select($this->plugin->txt("filter_stitch"),
Expand All @@ -400,10 +403,11 @@ protected function filterInputs(): array

protected function filterInputActivation(): array
{
return [true, true, true, true];
return [true, true, true, true, true];
}
protected function filterItems(array $filter, Writer $writer): bool
{

if(!empty($filter["corrector"])){
$has = [];
foreach($this->getAssignmentsByWriter($writer) as $ass){
Expand All @@ -415,6 +419,12 @@ protected function filterItems(array $filter, Writer $writer): bool
}
$essay = $this->essays[$writer->getId()];

if(!empty($filter["pdf_version"]) && $filter["pdf_version"] == self::FILTER_YES){
if($essay === null || $essay->getPdfVersion() === null){
return false;
}
}

if(!empty($filter["corrected"]) && $filter["corrected"] == self::FILTER_YES){
if($essay === null || $essay->getCorrectionFinalized() === null){
return false;
Expand Down

0 comments on commit 91d7e50

Please sign in to comment.