23 include_once
"Modules/SurveyQuestionPool/classes/class.ilSurveyCategory.php";
58 $this->categories =
array();
73 return count($this->categories);
88 if (array_key_exists($position, $this->categories))
90 $head = array_slice($this->categories, 0, $position);
91 $tail = array_slice($this->categories, $position);
92 $this->categories = array_merge($head,
array(
new ilSurveyCategory($categoryname, $other, $neutral, $label)), $tail);
96 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label));
104 $temp = $this->categories[$index-1];
105 $this->categories[$index - 1] = $this->categories[$index];
106 $this->categories[$index] = $temp;
112 if ($index < (count($this->categories)-1))
114 $temp = $this->categories[$index+1];
115 $this->categories[$index + 1] = $this->categories[$index];
116 $this->categories[$index] = $temp;
129 function addCategory($categoryname, $other = 0, $neutral = 0, $label = null, $scale = null)
131 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label, $scale));
145 $this->categories = array_merge($this->categories, $categories);
159 unset($this->categories[$index]);
160 $this->categories = array_values($this->categories);
174 foreach ($array as $index)
176 unset($this->categories[$index]);
178 $this->categories = array_values($this->categories);
192 foreach ($this->categories as $index => $category)
194 if (strcmp($category->title, $name) == 0)
214 if (array_key_exists($index, $this->categories))
216 return $this->categories[$index];
232 foreach ($this->categories as $cat)
234 if ($cat->scale == $scale)
return $cat;
248 foreach ($this->categories as $index => $category)
250 if (strcmp($category->title, $name) == 0)
267 foreach ($this->categories as $index => $cat)
269 if ($cat == $category)
280 foreach ($this->categories as $index => $category)
282 if (is_object($category) && $category->scale > 0)
284 if ($category->scale > $max) $max = $category->scale;
292 $obj = $this->categories[$index];
293 if (is_object($obj) && $obj->scale > 0)
295 $this->log->debug(
"getScale has scale =". $obj->scale);
301 $this->log->debug(
"getScale needed new scale, scale =". $obj->scale);
316 $this->categories =
array();
getCategory($index)
Returns the name of a category for a given index.
getCategoryIndex($name)
Returns the index of a category with a given name.
getCategoryCount()
Returns the number of categories.
getIndex($category)
Returns the index of a category.
removeCategory($index)
Removes a category from the list of categories.
getCategories()
Get categories.
getCategoryForScale($scale)
Returns the name of a category for a given index.
addCategoryArray($categories)
Adds a category array.
removeCategoryWithName($name)
Removes a category from the list of categories.
addCategory($categoryname, $other=0, $neutral=0, $label=null, $scale=null)
Adds a category.
flushCategories()
Empties the categories list.
removeCategories($array)
Removes many categories from the list of categories.
addCategoryAtPosition($categoryname, $position, $other=0, $neutral=0, $label=null)
Adds a category at a given position.
Create styles array
The data for the language used.
static getLogger($a_component_id)
Get component logger.
__construct()
Constructor public.