ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
assFormulaQuestionUnit Class Reference

Formula Question Unit. More...

+ Collaboration diagram for assFormulaQuestionUnit:

Public Member Functions

 initFormArray (array $data)
 
 setId (int $id)
 
 getId ()
 
 setUnit (string $unit)
 
 getUnit ()
 
 getSanitizedUnit ()
 
 setSequence (int $sequence)
 
 getSequence ()
 
 setFactor (float $factor)
 
 getFactor ()
 
 setBaseUnit (int $baseunit)
 
 getBaseUnit ()
 
 setBaseunitTitle (?string $baseunit_title)
 
 getBaseunitTitle ()
 
 getSanitizedBaseunitTitle ()
 
 setCategory (int $category)
 
 getCategory ()
 
 getDisplayString ()
 

Static Public Member Functions

static lookupUnitFactor (int $a_unit_id)
 

Private Member Functions

 sanitizeString (string $string)
 

Private Attributes

int $id = 0
 
string $unit = ''
 
float $factor = 0.0
 
int $category = 0
 
int $sequence = 0
 
int $baseunit = 0
 
string $baseunit_title = null
 

Detailed Description

Formula Question Unit.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m \

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

Member Function Documentation

◆ getBaseUnit()

assFormulaQuestionUnit::getBaseUnit ( )

Definition at line 97 of file class.assFormulaQuestionUnit.php.

97 : int
98 {
99 if ($this->baseunit > 0) {
100 return $this->baseunit;
101 }
102
103 return $this->id;
104 }

References $baseunit, and $id.

Referenced by ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ getBaseunitTitle()

assFormulaQuestionUnit::getBaseunitTitle ( )

Definition at line 111 of file class.assFormulaQuestionUnit.php.

111 : ?string
112 {
114 }

References $baseunit_title.

Referenced by getSanitizedBaseunitTitle().

+ Here is the caller graph for this function:

◆ getCategory()

assFormulaQuestionUnit::getCategory ( )

Definition at line 126 of file class.assFormulaQuestionUnit.php.

126 : int
127 {
128 return $this->category;
129 }

References $category.

Referenced by ilUnitConfigurationRepository\createNewUnit(), and ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ getDisplayString()

assFormulaQuestionUnit::getDisplayString ( )

Definition at line 131 of file class.assFormulaQuestionUnit.php.

131 : string
132 {
133 global $DIC;
134
135 $unit = $this->getUnit();
136 $txt = $DIC->language()->txt("qpl_qst_formulaquestion_{$unit}");
137 return strcmp("-qpl_qst_formulaquestion_{$unit}-", $txt) !== 0
138 ? $this->sanitizeString($txt)
139 : $this->getSanitizedUnit();
140 }
global $DIC
Definition: shib_login.php:26

References $DIC, $unit, getSanitizedUnit(), getUnit(), and sanitizeString().

+ Here is the call graph for this function:

◆ getFactor()

assFormulaQuestionUnit::getFactor ( )

Definition at line 87 of file class.assFormulaQuestionUnit.php.

87 : float
88 {
89 return $this->factor;
90 }

References $factor.

Referenced by ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ getId()

assFormulaQuestionUnit::getId ( )

Definition at line 52 of file class.assFormulaQuestionUnit.php.

52 : int
53 {
54 return $this->id;
55 }

References $id.

Referenced by ilUnitConfigurationRepository\addUnit(), and ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ getSanitizedBaseunitTitle()

assFormulaQuestionUnit::getSanitizedBaseunitTitle ( )

Definition at line 116 of file class.assFormulaQuestionUnit.php.

116 : ?string
117 {
118 return $this->sanitizeString($this->getBaseunitTitle() ?? '');
119 }

References getBaseunitTitle(), and sanitizeString().

+ Here is the call graph for this function:

◆ getSanitizedUnit()

assFormulaQuestionUnit::getSanitizedUnit ( )

Definition at line 67 of file class.assFormulaQuestionUnit.php.

67 : string
68 {
69 return htmlspecialchars($this->getUnit(), ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
70 }

References getUnit().

Referenced by getDisplayString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSequence()

assFormulaQuestionUnit::getSequence ( )

Definition at line 77 of file class.assFormulaQuestionUnit.php.

77 : int
78 {
79 return $this->sequence;
80 }

References $sequence.

Referenced by ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ getUnit()

assFormulaQuestionUnit::getUnit ( )

Definition at line 62 of file class.assFormulaQuestionUnit.php.

62 : string
63 {
64 return $this->unit;
65 }

References $unit.

Referenced by ilUnitConfigurationRepository\createNewUnit(), getDisplayString(), getSanitizedUnit(), and ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ initFormArray()

assFormulaQuestionUnit::initFormArray ( array  $data)

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

36 : void
37 {
38 $this->id = (int) $data['unit_id'];
39 $this->unit = $data['unit'];
40 $this->factor = (float) $data['factor'];
41 $this->baseunit = (int) $data['baseunit_fi'];
42 $this->baseunit_title = $data['baseunit_title'] ?? null;
43 $this->category = (int) $data['category_fi'];
44 $this->sequence = (int) $data['sequence'];
45 }

References $data, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ lookupUnitFactor()

static assFormulaQuestionUnit::lookupUnitFactor ( int  $a_unit_id)
static

Definition at line 142 of file class.assFormulaQuestionUnit.php.

142 : float
143 {
144 global $DIC;
145 $ilDB = $DIC['ilDB'];
146
147 $res = $ilDB->queryF(
148 'SELECT factor FROM il_qpl_qst_fq_unit WHERE unit_id = %s',
149 ['integer'],
150 [$a_unit_id]
151 );
152
153 $row = $ilDB->fetchAssoc($res);
154
155 return (float) $row['factor'];
156 }
$res
Definition: ltiservices.php:69

References $DIC, $ilDB, and $res.

Referenced by assFormulaQuestion\getBestSolution().

+ Here is the caller graph for this function:

◆ sanitizeString()

assFormulaQuestionUnit::sanitizeString ( string  $string)
private

Definition at line 158 of file class.assFormulaQuestionUnit.php.

158 : string
159 {
160 return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
161 }

Referenced by getDisplayString(), and getSanitizedBaseunitTitle().

+ Here is the caller graph for this function:

◆ setBaseUnit()

assFormulaQuestionUnit::setBaseUnit ( int  $baseunit)

Definition at line 92 of file class.assFormulaQuestionUnit.php.

92 : void
93 {
94 $this->baseunit = $baseunit;
95 }

References $baseunit.

Referenced by ilUnitConfigurationRepository\createNewUnit().

+ Here is the caller graph for this function:

◆ setBaseunitTitle()

assFormulaQuestionUnit::setBaseunitTitle ( ?string  $baseunit_title)

Definition at line 106 of file class.assFormulaQuestionUnit.php.

106 : void
107 {
108 $this->baseunit_title = $baseunit_title;
109 }

References $baseunit_title.

◆ setCategory()

assFormulaQuestionUnit::setCategory ( int  $category)

Definition at line 121 of file class.assFormulaQuestionUnit.php.

121 : void
122 {
123 $this->category = $category;
124 }

References $category.

◆ setFactor()

assFormulaQuestionUnit::setFactor ( float  $factor)

Definition at line 82 of file class.assFormulaQuestionUnit.php.

82 : void
83 {
84 $this->factor = $factor;
85 }

References $factor.

Referenced by ilUnitConfigurationRepository\createNewUnit(), and ilUnitConfigurationRepository\saveUnit().

+ Here is the caller graph for this function:

◆ setId()

assFormulaQuestionUnit::setId ( int  $id)

Definition at line 47 of file class.assFormulaQuestionUnit.php.

47 : void
48 {
49 $this->id = $id;
50 }

References $id.

Referenced by ilUnitConfigurationRepository\createNewUnit().

+ Here is the caller graph for this function:

◆ setSequence()

assFormulaQuestionUnit::setSequence ( int  $sequence)

Definition at line 72 of file class.assFormulaQuestionUnit.php.

72 : void
73 {
74 $this->sequence = $sequence;
75 }

References $sequence.

Referenced by ilUnitConfigurationRepository\createNewUnit().

+ Here is the caller graph for this function:

◆ setUnit()

assFormulaQuestionUnit::setUnit ( string  $unit)

Definition at line 57 of file class.assFormulaQuestionUnit.php.

57 : void
58 {
59 $this->unit = $unit;
60 }

References $unit.

Field Documentation

◆ $baseunit

int assFormulaQuestionUnit::$baseunit = 0
private

Definition at line 33 of file class.assFormulaQuestionUnit.php.

Referenced by getBaseUnit(), and setBaseUnit().

◆ $baseunit_title

string assFormulaQuestionUnit::$baseunit_title = null
private

Definition at line 34 of file class.assFormulaQuestionUnit.php.

Referenced by getBaseunitTitle(), and setBaseunitTitle().

◆ $category

int assFormulaQuestionUnit::$category = 0
private

Definition at line 31 of file class.assFormulaQuestionUnit.php.

Referenced by getCategory(), and setCategory().

◆ $factor

float assFormulaQuestionUnit::$factor = 0.0
private

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

Referenced by getFactor(), and setFactor().

◆ $id

int assFormulaQuestionUnit::$id = 0
private

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

Referenced by getBaseUnit(), getId(), and setId().

◆ $sequence

int assFormulaQuestionUnit::$sequence = 0
private

Definition at line 32 of file class.assFormulaQuestionUnit.php.

Referenced by getSequence(), and setSequence().

◆ $unit

string assFormulaQuestionUnit::$unit = ''
private

Definition at line 29 of file class.assFormulaQuestionUnit.php.

Referenced by getDisplayString(), getUnit(), and setUnit().


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