ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.assFormulaQuestionUnit.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 private $unit = '';
14 private $factor = 0.0;
15 private $baseunit = 0;
16 private $baseunit_title = '';
17 private $id = 0;
18 private $category = 0;
19 private $sequence = 0;
20
24 public function __construct()
25 {
26 }
27
31 public function initFormArray(array $data)
32 {
33 $this->id = $data['unit_id'];
34 $this->unit = $data['unit'];
35 $this->factor = $data['factor'];
36 $this->baseunit = $data['baseunit_fi'];
37 $this->baseunit_title = $data['baseunit_title'];
38 $this->category = $data['category'];
39 $this->sequence = $data['sequence'];
40 }
41
46 {
47 $this->baseunit_title = $baseunit_title;
48 }
49
53 public function getBaseunitTitle()
54 {
56 }
57
58 function setId($id)
59 {
60 $this->id = $id;
61 }
62
63 function getId()
64 {
65 return $this->id;
66 }
67
68 function setUnit($unit)
69 {
70 $this->unit = $unit;
71 }
72
73 function getUnit()
74 {
75 return $this->unit;
76 }
77
79 {
80 $this->sequence = $sequence;
81 }
82
83 function getSequence()
84 {
85 return $this->sequence;
86 }
87
89 {
90 $this->factor = $factor;
91 }
92
93 function getFactor()
94 {
95 return $this->factor;
96 }
97
99 {
100 if (is_numeric($baseunit) && $baseunit > 0)
101 {
102 $this->baseunit = $baseunit;
103 }
104 else
105 {
106 $this->baseunit = null;
107 }
108 }
109
110 function getBaseUnit()
111 {
112 if (is_numeric($this->baseunit) && $this->baseunit > 0)
113 {
114 return $this->baseunit;
115 }
116 else
117 {
118 return $this->id;
119 }
120 }
121
123 {
124 $this->category = $category;
125 }
126
127 function getCategory()
128 {
129 return $this->category;
130 }
131
132 function getDisplayString()
133 {
137 global $lng;
138
139 $unit = $this->getUnit();
140 if(strcmp('-qpl_qst_formulaquestion_' . $unit . '-', $lng->txt('qpl_qst_formulaquestion_' . $unit)) != 0)
141 {
142 $unit = $lng->txt('qpl_qst_formulaquestion_' . $unit);
143 }
144 return $unit;
145 }
146
151 public static function lookupUnitFactor($a_unit_id)
152 {
153 global $ilDB;
154
155 $res = $ilDB->queryF('SELECT factor FROM il_qpl_qst_fq_unit WHERE unit_id = %s',
156 array('integer'), array($a_unit_id));
157
158 $row = $ilDB->fetchAssoc($res);
159
160 return $row['factor'];
161 }
162}
$data
global $lng
Definition: privfeed.php:40
global $ilDB