55 $this->db = $DIC->database();
56 $this->
user = $DIC->user();
57 $this->arrData =
array();
73 $ilDB = $DIC->database();
76 $lng = $DIC->language();
80 "SELECT * FROM svy_phrase WHERE defaultvalue = %s OR owner_fi = %s ORDER BY title",
81 array(
'text',
'integer'),
85 if ((
$row->defaultvalue == 1) and (
$row->owner_fi == 0)) {
89 "owner" =>
$row->owner_fi,
90 "org_title" =>
$row->title
96 "title" =>
$row->title,
97 "owner" =>
$row->owner_fi
115 $ilDB = $DIC->database();
118 $lng = $DIC->language();
120 $categories =
array();
122 "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",
127 if ((
$row->defaultvalue == 1) and (
$row->owner_fi == 0)) {
128 $categories[
$row->category_id] =
$lng->txt(
$row->title);
130 $categories[
$row->category_id] =
$row->title;
145 if ((is_array($phrase_array)) && (count($phrase_array))) {
146 $affectedRows =
$ilDB->manipulate(
"DELETE FROM svy_phrase WHERE " .
$ilDB->in(
'phrase_id', $phrase_array,
false,
'integer'));
147 $affectedRows =
$ilDB->manipulate(
"DELETE FROM svy_phrase_cat WHERE " .
$ilDB->in(
'phrase_fi', $phrase_array,
false,
'integer'));
163 $affectedRows =
$ilDB->manipulateF(
164 "UPDATE svy_phrase SET title = %s, tstamp = %s WHERE phrase_id = %s",
165 array(
'text',
'integer',
'integer'),
169 $affectedRows =
$ilDB->manipulateF(
170 "DELETE FROM svy_phrase_cat WHERE phrase_fi = %s",
176 for (
$i = 0;
$i < $this->categories->getCategoryCount();
$i++) {
177 $cat = $this->categories->getCategory(
$i);
178 $next_id =
$ilDB->nextId(
'svy_category');
179 $affectedRows =
$ilDB->manipulateF(
180 "INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
181 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
184 $category_id = $next_id;
185 $next_id =
$ilDB->nextId(
'svy_phrase_cat');
186 $affectedRows =
$ilDB->manipulateF(
187 "INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
188 array(
'integer',
'integer',
'integer',
'integer'),
203 $next_id =
$ilDB->nextId(
'svy_phrase');
204 $affectedRows =
$ilDB->manipulateF(
205 "INSERT INTO svy_phrase (phrase_id, title, defaultvalue, owner_fi, tstamp) VALUES (%s, %s, %s, %s, %s)",
206 array(
'integer',
'text',
'text',
'integer',
'integer'),
209 $phrase_id = $next_id;
212 for (
$i = 0;
$i < $this->categories->getCategoryCount();
$i++) {
213 $cat = $this->categories->getCategory(
$i);
214 $next_id =
$ilDB->nextId(
'svy_category');
215 $affectedRows =
$ilDB->manipulateF(
216 "INSERT INTO svy_category (category_id, title, defaultvalue, owner_fi, tstamp, neutral) VALUES (%s, %s, %s, %s, %s, %s)",
217 array(
'integer',
'text',
'text',
'integer',
'integer',
'text'),
220 $category_id = $next_id;
221 $next_id =
$ilDB->nextId(
'svy_phrase_cat');
222 $affectedRows =
$ilDB->manipulateF(
223 "INSERT INTO svy_phrase_cat (phrase_category_id, phrase_fi, category_fi, sequence) VALUES (%s, %s, %s, %s)",
224 array(
'integer',
'integer',
'integer',
'integer'),
238 if (array_key_exists($value, $this->arrData)) {
239 return $this->arrData[$value];
254 $this->arrData[
$key] = $value;
static _getCategoriesForPhrase($phrase_id)
Gets the available categories for a given phrase.
deletePhrases($phrase_array)
Delete phrases from the database.
updatePhrase($phrase_id)
Saves a set of categories to a default phrase.
__set($key, $value)
Object setter.
__get($value)
Object getter.
Create styles array
The data for the language used.
savePhrase()
Saves a set of categories to a default phrase.
static _getAvailablePhrases($useronly=0)
Gets the available phrases from the database.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
__construct()
ilSurveyPhrases constructor