. /** * A class containing the data to filter the list of users with attempts by. * * @copyright 2022 onwards Vitaly Potenko * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace mod_adaptivequiz\local\report\users_attempts\filter; use mod_adaptivequiz\local\report\users_attempts\user_preferences\filter_user_preferences; final class filter { /** * @var int $adaptivequizid */ public $adaptivequizid; /** * @var int $groupid */ public $groupid; /** * @var int $users */ public $users; /** * @var int $includeinactiveenrolments Represents a bool value, as bool values normally come as int (0 or 1) * from a request. */ public $includeinactiveenrolments; public function fill_from_array(array $request): void { foreach ($request as $propertyname => $propertyvalue) { if (property_exists($this, $propertyname)) { $this->$propertyname = $propertyvalue; } } } public function fill_from_preference(filter_user_preferences $filter): void { $this->users = $filter->users(); $this->includeinactiveenrolments = $filter->include_inactive_enrolments(); } public static function from_vars(int $adaptivequizid, int $groupid): self { $return = new self(); $return->adaptivequizid = $adaptivequizid; $return->groupid = $groupid; return $return; } }