ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 122 of file class.ilStudyProgrammeAssessmentSettings.php.

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

Referenced by toFormInput().

122  : array
123  {
124  return [
125  ilStudyProgrammeSettings::STATUS_DRAFT => $lng->txt("prg_status_draft"),
126  ilStudyProgrammeSettings::STATUS_ACTIVE => $lng->txt("prg_status_active"),
127  ilStudyProgrammeSettings::STATUS_OUTDATED => $lng->txt("prg_status_outdated")
128  ];
129  }
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().

89  : \ILIAS\UI\Component\Input\Container\Form\FormInput {
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  }
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:61
+ 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.

Referenced by ilStudyProgrammeUserTableRow\withNodeLifecycleStatus().

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