ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $points, and $status.

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  }

Member Function Documentation

◆ getPoints()

ilStudyProgrammeAssessmentSettings::getPoints ( )

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

References $points.

Referenced by toFormInput().

+ Here is the caller graph for this function:

◆ getStatus()

ilStudyProgrammeAssessmentSettings::getStatus ( )

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

References $status.

Referenced by toFormInput().

+ Here is the caller graph for this function:

◆ getStatusOptions()

ilStudyProgrammeAssessmentSettings::getStatusOptions ( ilLanguage  $lng)
protected

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

References ilStudyProgrammeSettings\STATUS_ACTIVE, ilStudyProgrammeSettings\STATUS_DRAFT, ilStudyProgrammeSettings\STATUS_OUTDATED, and ilLanguage\txt().

Referenced by toFormInput().

120  : array
121  {
122  return [
123  ilStudyProgrammeSettings::STATUS_DRAFT => $lng->txt("prg_status_draft"),
124  ilStudyProgrammeSettings::STATUS_ACTIVE => $lng->txt("prg_status_active"),
125  ilStudyProgrammeSettings::STATUS_OUTDATED => $lng->txt("prg_status_outdated")
126  ];
127  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toFormInput()

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

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

References getPoints(), getStatus(), getStatusOptions(), ilLanguage\txt(), ILIAS\UI\Implementation\Component\Input\ViewControl\withAdditionalTransformation(), and ILIAS\UI\Implementation\Component\Input\withValue().

90  $num = $input
91  ->numeric($lng->txt('prg_points'), $lng->txt('prg_points_byline'))
92  ->withValue($this->getPoints())
93  ->withAdditionalTransformation($refinery->int()->isGreaterThanOrEqual(0))
94  ;
95  $select = $input
96  ->select(
97  $lng->txt('prg_status'),
98  $this->getStatusOptions($lng),
99  $lng->txt('prg_status_byline')
100  )
101  ->withValue($this->getStatus())
102  ->withRequired(true)
103  ;
104 
105  return $input->section(
106  [
107  'points' => $num,
108  'status' => $select
109  ],
110  $lng->txt('prg_assessment')
111  )
112  ->withAdditionalTransformation($refinery->custom()->transformation(function ($vals) {
114  (int) $vals['points'],
115  (int) $vals['status']
116  );
117  }));
118  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
withValue($value)
Get an input like this with another value displayed on the client side.
Definition: Group.php:59
This describes inputs that can be used in forms.
Definition: FormInput.php:31
Refinery Factory $refinery
+ Here is the call graph for this function:

◆ withPoints()

ilStudyProgrammeAssessmentSettings::withPoints ( int  $points)

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

References $points.

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  }

◆ withStatus()

ilStudyProgrammeAssessmentSettings::withStatus ( int  $status)

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

References $status.

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  }

Field Documentation

◆ $points

int ilStudyProgrammeAssessmentSettings::$points
protected

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

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

◆ $STATUS

array ilStudyProgrammeAssessmentSettings::$STATUS
static
Initial value:
= [
self::STATUS_DRAFT,
self::STATUS_ACTIVE,
self::STATUS_OUTDATED
]

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

◆ $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

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

◆ STATUS_DRAFT

const ilStudyProgrammeAssessmentSettings::STATUS_DRAFT = 10

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

◆ 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: