24 include_once
"./Modules/Survey/classes/inc.SurveyConstants.php";
25 include_once
"./Modules/SurveyQuestionPool/classes/class.ilSurveyCategory.php";
54 $this->categories = array();
68 return count($this->categories);
83 if (array_key_exists($position, $this->categories))
85 $head = array_slice($this->categories, 0, $position);
86 $tail = array_slice($this->categories, $position);
87 $this->categories = array_merge($head, array(
new ilSurveyCategory($categoryname, $other, $neutral, $label)), $tail);
91 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label));
99 $temp = $this->categories[$index-1];
100 $this->categories[$index - 1] = $this->categories[$index];
101 $this->categories[$index] = $temp;
107 if ($index < (count($this->categories)-1))
109 $temp = $this->categories[$index+1];
110 $this->categories[$index + 1] = $this->categories[$index];
111 $this->categories[$index] = $temp;
124 function addCategory($categoryname, $other = 0, $neutral = 0, $label = null, $scale = null)
126 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label, $scale));
140 $this->categories = array_merge($this->categories,
$categories);
154 unset($this->categories[$index]);
155 $this->categories = array_values($this->categories);
169 foreach ($array as $index)
171 unset($this->categories[$index]);
173 $this->categories = array_values($this->categories);
187 foreach ($this->categories as $index => $category)
189 if (strcmp($category->title, $name) == 0)
209 if (array_key_exists($index, $this->categories))
211 return $this->categories[$index];
227 foreach ($this->categories as $cat)
229 if ($cat->scale == $scale)
return $cat;
243 foreach ($this->categories as $index => $category)
245 if (strcmp($category->title, $name) == 0)
262 foreach ($this->categories as $index => $cat)
264 if ($cat == $category)
275 foreach ($this->categories as $index => $category)
277 if (is_object($category) && $category->scale > 0)
279 if ($category->scale > $max) $max = $category->scale;
287 $obj = $this->categories[$index];
288 if (is_object($obj) && $obj->scale > 0)
309 $this->categories = array();