-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed 0040804: Minimal margin size is not set to minimum (5mm) but to 4
- Loading branch information
Showing
6 changed files
with
100 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace ILIAS\Plugin\LongEssayAssessment\Data\Constraints; | ||
|
||
use ILIAS\Refinery\Constraint; | ||
use ILIAS\Data; | ||
use ILIAS\Refinery\Custom\Constraint as CustomConstraint; | ||
|
||
class MinimumInteger extends CustomConstraint implements Constraint | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
protected $min; | ||
|
||
public function __construct(int $min, Data\Factory $data_factory, \ilLanguage $lng) | ||
{ | ||
$this->min = $min; | ||
parent::__construct( | ||
function ($value) { | ||
return $value >= $this->min; | ||
}, | ||
function ($txt, $value) { | ||
return $txt("rep_robj_xlas_constraint_error_not_minimum", $value, $this->min); | ||
}, | ||
$data_factory, | ||
$lng | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace ILIAS\Plugin\LongEssayAssessment\Data; | ||
|
||
use ILIAS\Data\Factory; | ||
use ILIAS\Plugin\LongEssayAssessment\Data\Constraints\MinimumInteger; | ||
|
||
class DataConstraints | ||
{ | ||
/** | ||
* @var Factory | ||
*/ | ||
private $dataFactory; | ||
|
||
/** | ||
* @var \ilLanguage | ||
*/ | ||
private $language; | ||
|
||
public function __construct(Factory $dataFactory, \ilLanguage $language) | ||
{ | ||
$this->dataFactory = $dataFactory; | ||
$this->language = $language; | ||
} | ||
|
||
/** | ||
* Creates a constraint that can be used to check if an integer value is | ||
* greater or equal than the defined lower limit. | ||
* | ||
* @param int $minimum - lower limit for the new constraint | ||
* @return MinimumInteger | ||
*/ | ||
public function minimumInteger(int $minimum) : MinimumInteger | ||
{ | ||
return new MinimumInteger($minimum, $this->dataFactory, $this->language); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
use ILIAS\Plugin\LongEssayAssessment\Task\LoggingService; | ||
use ILIAS\Plugin\LongEssayAssessment\CorrectorAdmin\CorrectorAssignmentsService; | ||
use ILIAS\Plugin\LongEssayAssessment\ServiceLayer\ServicesFactory; | ||
use ILIAS\Plugin\LongEssayAssessment\Data\DataConstraints; | ||
|
||
/** | ||
* @author Fabian Wolf <[email protected]> | ||
|
@@ -52,6 +53,13 @@ public function init(\ilLongEssayAssessmentPlugin $plugin) | |
|
||
$dic["xlas.plugin"] = $plugin; | ||
|
||
$dic["xlas.data_constraints"] = function() use ($dic) { | ||
return new DataConstraints( | ||
new \ILIAS\Data\Factory(), | ||
$dic->language() | ||
); | ||
}; | ||
|
||
$dic["xlas.custom_template_factory"] = function () use ($dic) { | ||
return new PluginTemplateFactory($dic["ui.template_factory"], $dic["xlas.plugin"], $dic["tpl"]); | ||
}; | ||
|
@@ -153,6 +161,17 @@ public static function getInstance(): LongEssayAssessmentDI | |
return self::$instance; | ||
} | ||
|
||
public function constraints() : DataConstraints | ||
{ | ||
return $this->container["xlas.data_constraints"]; | ||
} | ||
|
||
public function services() : ServicesFactory | ||
{ | ||
return $this->container["xlas.services_factory"]; | ||
} | ||
|
||
|
||
public function getSystemRepo(): SystemRepository | ||
{ | ||
return $this->container["xlas.system_repository"]; | ||
|
@@ -183,10 +202,6 @@ public function getCorrectorRepo(): CorrectorRepository | |
return $this->container["xlas.corrector_repository"]; | ||
} | ||
|
||
public function services() : ServicesFactory | ||
{ | ||
return $this->container["xlas.services_factory"]; | ||
} | ||
|
||
// /** | ||
// * @return ComponentRenderer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters