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)) {
89 $head = array_slice($this->categories, 0, $position);
90 $tail = array_slice($this->categories, $position);
91 $this->categories = array_merge($head,
array(
new ilSurveyCategory($categoryname, $other, $neutral, $label)), $tail);
93 array_push($this->categories,
new ilSurveyCategory($categoryname, $other, $neutral, $label));
100 $temp = $this->categories[
$index-1];
101 $this->categories[
$index - 1] = $this->categories[
$index];
102 $this->categories[
$index] = $temp;
108 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 public 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) {
170 unset($this->categories[$index]);
172 $this->categories = array_values($this->categories);
186 foreach ($this->categories as
$index => $category) {
187 if (strcmp($category->title,
$name) == 0) {
206 if (array_key_exists(
$index, $this->categories)) {
207 return $this->categories[
$index];
221 foreach ($this->categories as $cat) {
222 if ($cat->scale == $scale) {
238 foreach ($this->categories as
$index => $category) {
239 if (strcmp($category->title,
$name) == 0) {
255 foreach ($this->categories as
$index => $cat) {
256 if ($cat == $category) {
266 foreach ($this->categories as
$index => $category) {
267 if (is_object($category) && $category->scale > 0) {
268 if ($category->scale > $max) {
269 $max = $category->scale;
278 $obj = $this->categories[
$index];
279 if (is_object($obj) && $obj->scale > 0) {
280 $this->log->debug(
"getScale has scale =" . $obj->scale);
284 $this->log->debug(
"getScale needed new scale, scale =" . $obj->scale);
299 $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.