43 $this->arrData = array();
59 $result = $ilDB->queryF(
"SELECT * FROM svy_phrase WHERE defaultvalue = %s OR owner_fi = %s ORDER BY title",
60 array(
'text',
'integer'),
61 array(
'1', $ilUser->getId())
63 while (
$row = $ilDB->fetchObject($result))
65 if ((
$row->defaultvalue == 1) and (
$row->owner_fi == 0))
69 $phrases[
$row->phrase_id] = array(
70 "title" => $lng->txt(
$row->title),
71 "owner" =>
$row->owner_fi
77 if ($ilUser->getId() ==
$row->owner_fi)
79 $phrases[
$row->phrase_id] = array(
80 "title" =>
$row->title,
81 "owner" =>
$row->owner_fi
100 $categories = array();
101 $result = $ilDB->queryF(
"SELECT svy_category.* FROM svy_category, svy_phrase_cat WHERE svy_phrase_cat.category_fi = svy_category.category_id AND svy_phrase_cat.phrase_fi = %s ORDER BY svy_phrase_cat.sequence",
105 while (
$row = $ilDB->fetchObject($result))
107 if ((
$row->defaultvalue == 1) and (
$row->owner_fi == 0))
109 $categories[
$row->category_id] = $lng->txt(
$row->title);
113 $categories[
$row->category_id] =
$row->title;
128 if ((is_array($phrase_array)) && (count($phrase_array)))
130 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_phrase WHERE " . $ilDB->in(
'phrase_id', $phrase_array,
false,
'integer'));
131 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_phrase_cat WHERE " . $ilDB->in(
'phrase_fi', $phrase_array,
false,
'integer'));
147 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_phrase SET title = %s, tstamp = %s WHERE phrase_id = %s",
148 array(
'text',
'integer',
'integer'),
149 array($this->title, time(), $phrase_id)
152 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_phrase_cat WHERE phrase_fi = %s",
158 for ($i = 0; $i < $this->categories->getCategoryCount(); $i++)
160 $cat = $this->categories->getCategory($i);
161 $next_id = $ilDB->nextId(
'svy_category');
162 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
163 array(
'integer',
'text',
'text',
'integer',
'integer'),
164 array($next_id, $cat->title, 1, $ilUser->getId(), time())
166 $category_id = $next_id;
167 $next_id = $ilDB->nextId(
'svy_phrase_cat');
168 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
169 array(
'integer',
'integer',
'integer',
'integer'),
170 array($next_id, $phrase_id, $category_id, $counter)
184 $next_id = $ilDB->nextId(
'svy_phrase');
185 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
186 array(
'integer',
'text',
'text',
'integer',
'integer'),
187 array($next_id, $this->title, 1, $ilUser->getId(), time())
189 $phrase_id = $next_id;
192 for ($i = 0; $i < $this->categories->getCategoryCount(); $i++)
194 $cat = $this->categories->getCategory($i);
195 $next_id = $ilDB->nextId(
'svy_category');
196 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
197 array(
'integer',
'text',
'text',
'integer',
'integer'),
198 array($next_id, $cat->title, 1, $ilUser->getId(), time())
200 $category_id = $next_id;
201 $next_id = $ilDB->nextId(
'svy_phrase_cat');
202 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
203 array(
'integer',
'integer',
'integer',
'integer'),
204 array($next_id, $phrase_id, $category_id, $counter)
218 if (array_key_exists($value, $this->arrData))
220 return $this->arrData[$value];
238 $this->arrData[$key] = $value;