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())
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,
72 "org_title" =>
$row->title
78 if ($ilUser->getId() ==
$row->owner_fi)
80 $phrases[
$row->phrase_id] = array(
81 "title" =>
$row->title,
82 "owner" =>
$row->owner_fi
101 $categories = array();
102 $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",
108 if ((
$row->defaultvalue == 1) and (
$row->owner_fi == 0))
110 $categories[
$row->category_id] = $lng->txt(
$row->title);
114 $categories[
$row->category_id] =
$row->title;
129 if ((is_array($phrase_array)) && (count($phrase_array)))
131 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_phrase WHERE " . $ilDB->in(
'phrase_id', $phrase_array,
false,
'integer'));
132 $affectedRows = $ilDB->manipulate(
"DELETE FROM svy_phrase_cat WHERE " . $ilDB->in(
'phrase_fi', $phrase_array,
false,
'integer'));
148 $affectedRows = $ilDB->manipulateF(
"UPDATE svy_phrase SET title = %s, tstamp = %s WHERE phrase_id = %s",
149 array(
'text',
'integer',
'integer'),
150 array($this->title, time(), $phrase_id)
153 $affectedRows = $ilDB->manipulateF(
"DELETE FROM svy_phrase_cat WHERE phrase_fi = %s",
159 for ($i = 0; $i < $this->categories->getCategoryCount(); $i++)
161 $cat = $this->categories->getCategory($i);
162 $next_id = $ilDB->nextId(
'svy_category');
163 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
164 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
165 array($next_id, $cat->title, 1, $ilUser->getId(), time(), $cat->neutral)
167 $category_id = $next_id;
168 $next_id = $ilDB->nextId(
'svy_phrase_cat');
169 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
170 array(
'integer',
'integer',
'integer',
'integer'),
171 array($next_id, $phrase_id, $category_id, $counter)
185 $next_id = $ilDB->nextId(
'svy_phrase');
186 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
187 array(
'integer',
'text',
'text',
'integer',
'integer'),
188 array($next_id, $this->title, 1, $ilUser->getId(), time())
190 $phrase_id = $next_id;
193 for ($i = 0; $i < $this->categories->getCategoryCount(); $i++)
195 $cat = $this->categories->getCategory($i);
196 $next_id = $ilDB->nextId(
'svy_category');
197 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
198 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
199 array($next_id, $cat->title, 1, $ilUser->getId(), time(), $cat->neutral)
201 $category_id = $next_id;
202 $next_id = $ilDB->nextId(
'svy_phrase_cat');
203 $affectedRows = $ilDB->manipulateF(
"INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
204 array(
'integer',
'integer',
'integer',
'integer'),
205 array($next_id, $phrase_id, $category_id, $counter)
219 if (array_key_exists($value, $this->arrData))
221 return $this->arrData[$value];
239 $this->arrData[$key] = $value;