ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStudyProgrammeAssessmentSettings Class Reference
+ Collaboration diagram for ilStudyProgrammeAssessmentSettings:

Public Member Functions

 __construct (int $points, int $status)
 
 getPoints ()
 
 withPoints (int $points)
 
 getStatus ()
 
 withStatus (int $status)
 
 toFormInput (Field\Factory $input, ilLanguage $lng, Refinery $refinery)
 

Data Fields

const STATUS_DRAFT = 10
 
const STATUS_ACTIVE = 20
 
const STATUS_OUTDATED = 30
 

Static Public Attributes

static array $STATUS
 

Protected Member Functions

 getStatusOptions (ilLanguage $lng)
 

Protected Attributes

int $points
 
int $status
 

Detailed Description

Definition at line 24 of file class.ilStudyProgrammeAssessmentSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilStudyProgrammeAssessmentSettings::__construct ( int  $points,
int  $status 
)

Definition at line 39 of file class.ilStudyProgrammeAssessmentSettings.php.

40 {
41 if (0 > $points) {
42 throw new InvalidArgumentException('Numbers less than 0 are not allowed');
43 }
44
45 if (!in_array($status, self::$STATUS)) {
46 throw new InvalidArgumentException("No valid status: '$status'");
47 }
48
49 $this->points = $points;
50 $this->status = $status;
51 }

References $points, and $status.

Member Function Documentation

◆ getPoints()

ilStudyProgrammeAssessmentSettings::getPoints ( )

Definition at line 53 of file class.ilStudyProgrammeAssessmentSettings.php.

53 : int
54 {
55 return $this->points;
56 }

References $points.

◆ getStatus()

ilStudyProgrammeAssessmentSettings::getStatus ( )

Definition at line 69 of file class.ilStudyProgrammeAssessmentSettings.php.

69 : int
70 {
71 return $this->status;
72 }

References $status.

◆ getStatusOptions()

ilStudyProgrammeAssessmentSettings::getStatusOptions ( ilLanguage  $lng)
protected

◆ toFormInput()

ilStudyProgrammeAssessmentSettings::toFormInput ( Field\Factory  $input,
ilLanguage  $lng,
Refinery  $refinery 
)

Definition at line 85 of file class.ilStudyProgrammeAssessmentSettings.php.

90 $num = $input
91 ->numeric($lng->txt('prg_points'), $lng->txt('prg_points_byline'))
92 ->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(0))
93 ->withAdditionalTransformation($refinery->int()->isLessThanOrEqual(2147483647))
94 ->withRequired(true)
95 ->withValue($this->getPoints())
96 ;
97 $select = $input
98 ->select(
99 $lng->txt('prg_status'),
100 $this->getStatusOptions($lng),
101 $lng->txt('prg_status_byline')
102 )
103 ->withValue($this->getStatus())
104 ->withRequired(true)
105 ;
106
107 return $input->section(
108 [
109 'points' => $num,
110 'status' => $select
111 ],
112 $lng->txt('prg_assessment')
113 )
114 ->withAdditionalTransformation($refinery->custom()->transformation(function ($vals) {
116 (int) $vals['points'],
117 (int) $vals['status']
118 );
119 }));
120 }
This describes inputs that can be used in forms.
Definition: FormInput.php:33
withAdditionalTransformation(Transformation $trafo)
Apply a transformation to the content of the input.

◆ withPoints()

ilStudyProgrammeAssessmentSettings::withPoints ( int  $points)

Definition at line 58 of file class.ilStudyProgrammeAssessmentSettings.php.

59 {
60 if (0 > $points) {
61 throw new InvalidArgumentException('Numbers less than 0 are not allowed');
62 }
63
64 $clone = clone $this;
65 $clone->points = $points;
66 return $clone;
67 }

References $points.

◆ withStatus()

ilStudyProgrammeAssessmentSettings::withStatus ( int  $status)

Definition at line 74 of file class.ilStudyProgrammeAssessmentSettings.php.

75 {
76 if (!in_array($status, self::$STATUS)) {
77 throw new InvalidArgumentException("No valid status: '$status'");
78 }
79
80 $clone = clone $this;
81 $clone->status = $status;
82 return $clone;
83 }

References $status.

Field Documentation

◆ $points

int ilStudyProgrammeAssessmentSettings::$points
protected

Definition at line 36 of file class.ilStudyProgrammeAssessmentSettings.php.

Referenced by __construct(), getPoints(), and withPoints().

◆ $STATUS

◆ $status

int ilStudyProgrammeAssessmentSettings::$status
protected

Definition at line 37 of file class.ilStudyProgrammeAssessmentSettings.php.

Referenced by __construct(), getStatus(), and withStatus().

◆ STATUS_ACTIVE

const ilStudyProgrammeAssessmentSettings::STATUS_ACTIVE = 20

◆ STATUS_DRAFT

◆ STATUS_OUTDATED

const ilStudyProgrammeAssessmentSettings::STATUS_OUTDATED = 30

Definition at line 28 of file class.ilStudyProgrammeAssessmentSettings.php.


The documentation for this class was generated from the following file: