34 $this->categories = array();
49 return count($this->categories);
64 if (array_key_exists($position, $this->categories)) {
65 $head = array_slice($this->categories, 0, $position);
66 $tail = array_slice($this->categories, $position);
67 $this->categories = array_merge($head, array(
new ilSurveyCategory($categoryname, $other, $neutral, $label)), $tail);
69 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label));
76 $temp = $this->categories[
$index - 1];
77 $this->categories[
$index - 1] = $this->categories[
$index];
78 $this->categories[
$index] = $temp;
84 if (
$index < (count($this->categories) - 1)) {
85 $temp = $this->categories[
$index + 1];
86 $this->categories[
$index + 1] = $this->categories[
$index];
87 $this->categories[
$index] = $temp;
100 public function addCategory($categoryname, $other = 0, $neutral = 0, $label = null, $scale = null)
102 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label, $scale));
116 $this->categories = array_merge($this->categories,
$categories);
130 unset($this->categories[
$index]);
131 $this->categories = array_values($this->categories);
145 foreach ($array as
$index) {
146 unset($this->categories[$index]);
148 $this->categories = array_values($this->categories);
162 foreach ($this->categories as
$index => $category) {
163 if (strcmp($category->title,
$name) == 0) {
182 if (array_key_exists(
$index, $this->categories)) {
183 return $this->categories[
$index];
197 foreach ($this->categories as $cat) {
198 if ($cat->scale == $scale) {
214 foreach ($this->categories as
$index => $category) {
215 if (strcmp($category->title,
$name) == 0) {
231 foreach ($this->categories as
$index => $cat) {
232 if ($cat == $category) {
242 foreach ($this->categories as
$index => $category) {
243 if (is_object($category) && $category->scale > 0) {
244 if ($category->scale > $max) {
245 $max = $category->scale;
254 $obj = $this->categories[
$index];
255 if (is_object($obj) && $obj->scale > 0) {
256 $this->log->debug(
"getScale has scale =" . $obj->scale);
260 $this->log->debug(
"getScale needed new scale, scale =" . $obj->scale);
275 $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.
static getLogger($a_component_id)
Get component logger.
__construct()
Constructor public.