ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilUnitConfigurationRepository.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once "./Modules/TestQuestionPool/classes/class.assFormulaQuestionUnit.php";
5include_once "./Modules/TestQuestionPool/classes/class.assFormulaQuestionUnitCategory.php";
6
11{
15 protected $consumer_id = 0;
16
20 protected $lng;
21
25 private $units = array();
26
30 private $categorizedUnits = array();
31
35 public function __construct($consumer_id)
36 {
40 global $DIC;
41 $lng = $DIC['lng'];
42
43 $this->consumer_id = $consumer_id;
44 $this->lng = $lng;
45 }
46
50 public function setConsumerId($consumer_id)
51 {
52 $this->consumer_id = $consumer_id;
53 }
54
58 public function getConsumerId()
59 {
60 return $this->consumer_id;
61 }
62
67 public function isCRUDAllowed($a_category_id)
68 {
72 global $DIC;
73 $ilDB = $DIC['ilDB'];
74
75 $res = $ilDB->queryF(
76 'SELECT * FROM il_qpl_qst_fq_ucat WHERE category_id = %s',
77 array('integer'),
78 array($a_category_id)
79 );
80 $row = $ilDB->fetchAssoc($res);
81 return isset($row['question_fi']) && $row['question_fi'] == $this->getConsumerId();
82 }
83
90 public function copyCategory($a_category_id, $a_question_fi, $a_category_name = null)
91 {
95 global $DIC;
96 $ilDB = $DIC['ilDB'];
97
98 $res = $ilDB->queryF(
99 'SELECT category FROM il_qpl_qst_fq_ucat WHERE category_id = %s',
100 array('integer'),
101 array($a_category_id)
102 );
103 $row = $ilDB->fetchAssoc($res);
104
105 if (null === $a_category_name) {
106 $a_category_name = $row['category'];
107 }
108
109 $next_id = $ilDB->nextId('il_qpl_qst_fq_ucat');
110 $ilDB->insert(
111 'il_qpl_qst_fq_ucat',
112 array(
113 'category_id' => array('integer', $next_id),
114 'category' => array('text', $a_category_name),
115 'question_fi' => array('integer', (int) $a_question_fi)
116 )
117 );
118 self::$result_buffer = null;
119 return $next_id;
120 }
121
127 public function copyUnitsByCategories($a_from_category_id, $a_to_category_id, $a_question_fi)
128 {
132 global $DIC;
133 $ilDB = $DIC['ilDB'];
134
135 $res = $ilDB->queryF(
136 'SELECT * FROM il_qpl_qst_fq_unit WHERE category_fi = %s',
137 array('integer'),
138 array($a_from_category_id)
139 );
140 $i = 0;
141 $units = array();
142 while ($row = $ilDB->fetchAssoc($res)) {
143 $next_id = $ilDB->nextId('il_qpl_qst_fq_unit');
144
145 $units[$i]['old_unit_id'] = $row['unit_id'];
146 $units[$i]['new_unit_id'] = $next_id;
147
148 $ilDB->insert(
149 'il_qpl_qst_fq_unit',
150 array(
151 'unit_id' => array('integer', $next_id),
152 'unit' => array('text', $row['unit']),
153 'factor' => array('float', $row['factor']),
154 'baseunit_fi' => array('integer', (int) $row['baseunit_fi']),
155 'category_fi' => array('integer', (int) $a_to_category_id),
156 'sequence' => array('integer', (int) $row['sequence']),
157 'question_fi' => array('integer', (int) $a_question_fi)
158 )
159 );
160 $i++;
161 }
162
163 foreach ($units as $unit) {
164 //update unit : baseunit_fi
165 $ilDB->update(
166 'il_qpl_qst_fq_unit',
167 array('baseunit_fi' => array('integer', (int) $unit['new_unit_id'])),
168 array(
169 'baseunit_fi' => array('integer', $unit['old_unit_id']),
170 'category_fi' => array('integer', $a_to_category_id)
171 )
172 );
173
174 //update var : unit_fi
175 $ilDB->update(
176 'il_qpl_qst_fq_var',
177 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
178 array(
179 'unit_fi' => array('integer', $unit['old_unit_id']),
180 'question_fi' => array('integer', $a_question_fi)
181 )
182 );
183
184 //update res : unit_fi
185 $ilDB->update(
186 'il_qpl_qst_fq_res',
187 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
188 array(
189 'unit_fi' => array('integer', $unit['old_unit_id']),
190 'question_fi' => array('integer', $a_question_fi)
191 )
192 );
193
194 //update res_unit : unit_fi
195 $ilDB->update(
196 'il_qpl_qst_fq_res_unit',
197 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
198 array(
199 'unit_fi' => array('integer', $unit['old_unit_id']),
200 'question_fi' => array('integer', $a_question_fi)
201 )
202 );
203 }
204 self::$result_buffer = null;
205 }
206
207 public function getCategoryUnitCount($id)
208 {
209 global $DIC;
210 $ilDB = $DIC['ilDB'];
211
212 $result = $ilDB->queryF(
213 "SELECT * FROM il_qpl_qst_fq_unit WHERE category_fi = %s",
214 array('integer'),
215 array($id)
216 );
217 return $result->numRows();
218 }
219
220 public function isUnitInUse($id)
221 {
222 global $DIC;
223 $ilDB = $DIC['ilDB'];
224
225 $result_1 = $ilDB->queryF(
226 "SELECT unit_fi FROM il_qpl_qst_fq_res_unit WHERE unit_fi = %s",
227 array('integer'),
228 array($id)
229 );
230
231 $result_2 = $ilDB->queryF(
232 "SELECT unit_fi FROM il_qpl_qst_fq_var WHERE unit_fi = %s",
233 array('integer'),
234 array($id)
235 );
236 $result_3 = $ilDB->queryF(
237 "SELECT unit_fi FROM il_qpl_qst_fq_res WHERE unit_fi = %s",
238 array('integer'),
239 array($id)
240 );
241
242 $cnt_1 = $ilDB->numRows($result_1);
243 $cnt_2 = $ilDB->numRows($result_2);
244 $cnt_3 = $ilDB->numRows($result_3);
245
246 if ($cnt_1 || $cnt_2 || $cnt_3) {
247 return true;
248 } else {
249 return false;
250 }
251 }
252
257 public function checkDeleteCategory($id)
258 {
262 global $DIC;
263 $ilDB = $DIC['ilDB'];
264
265 $res = $ilDB->queryF(
266 'SELECT unit_id FROM il_qpl_qst_fq_unit WHERE category_fi = %s',
267 array('integer'),
268 array($id)
269 );
270 if ($ilDB->numRows($res)) {
271 while ($row = $ilDB->fetchAssoc($res)) {
272 $unit_res = $this->checkDeleteUnit($row['unit_id'], $id);
273 if (!is_null($unit_res)) {
274 return $unit_res;
275 }
276 }
277 }
278 return null;
279 }
280
281 public function deleteUnit($id)
282 {
283 global $DIC;
284 $ilDB = $DIC['ilDB'];
285
286 $res = $this->checkDeleteUnit($id);
287 if (!is_null($res)) {
288 return $res;
289 }
290 $affectedRows = $ilDB->manipulateF(
291 "DELETE FROM il_qpl_qst_fq_unit WHERE unit_id = %s",
292 array('integer'),
293 array($id)
294 );
295 if ($affectedRows > 0) {
296 $this->clearUnits();
297 }
298 self::$result_buffer = null;
299 return null;
300 }
301
302 public static $result_buffer;
303
304 protected function loadUnits()
305 {
306 global $DIC;
307 $ilDB = $DIC['ilDB'];
308
309 if (self::$result_buffer == null) {
310 $result = $ilDB->query(
311 "
312 SELECT units.*, il_qpl_qst_fq_ucat.category, baseunits.unit baseunit_title
313 FROM il_qpl_qst_fq_unit units
314 INNER JOIN il_qpl_qst_fq_ucat ON il_qpl_qst_fq_ucat.category_id = units.category_fi
315 LEFT JOIN il_qpl_qst_fq_unit baseunits ON baseunits.unit_id = units.baseunit_fi
316 ORDER BY il_qpl_qst_fq_ucat.category, units.sequence"
317 );
318
319
320 if ($result->numRows()) {
321 while ($row = $ilDB->fetchAssoc($result)) {
322 $unit = new assFormulaQuestionUnit();
323 $unit->initFormArray($row);
324 $this->addUnit($unit);
325 }
326 }
327 self::$result_buffer = $this->units;
328 }
329 $this->units = self::$result_buffer;
330 }
331
332 public function getCategorizedUnits()
333 {
334 global $DIC;
335 $ilDB = $DIC['ilDB'];
336
337 if (count($this->categorizedUnits) == 0) {
338 $result = $ilDB->queryF(
339 "
340 SELECT units.*, il_qpl_qst_fq_ucat.category, il_qpl_qst_fq_ucat.question_fi, baseunits.unit baseunit_title
341 FROM il_qpl_qst_fq_unit units
342 INNER JOIN il_qpl_qst_fq_ucat ON il_qpl_qst_fq_ucat.category_id = units.category_fi
343 LEFT JOIN il_qpl_qst_fq_unit baseunits ON baseunits.unit_id = units.baseunit_fi
344 WHERE units.question_fi = %s
345 ORDER BY il_qpl_qst_fq_ucat.category, units.sequence",
346 array('integer'),
347 array($this->getConsumerId())
348 );
349
350 if ($result->numRows()) {
351 $category = '';
352 while ($row = $ilDB->fetchAssoc($result)) {
353 $unit = new assFormulaQuestionUnit();
354 $unit->initFormArray($row);
355 if (strcmp($category, $unit->getCategory()) != 0) {
357 $cat->initFormArray(array(
358 'category_id' => $row['category_fi'],
359 'category' => $row['category'],
360 'question_fi' => $row['question_fi'],
361 ));
362 array_push($this->categorizedUnits, $cat);
363 $category = $unit->getCategory();
364 }
365 array_push($this->categorizedUnits, $unit);
366 }
367 }
368 }
369
371 }
372
373 protected function clearUnits()
374 {
375 $this->units = array();
376 self::$result_buffer = null;
377 }
378
379 protected function addUnit($unit)
380 {
381 $this->units[$unit->getId()] = $unit;
382 }
383
384 public function getUnits()
385 {
386 if (count($this->units) == 0) {
387 $this->loadUnits();
388 }
389 return $this->units;
390 }
391
392 public function loadUnitsForCategory($category)
393 {
394 global $DIC;
395 $ilDB = $DIC['ilDB'];
396
397 $units = array();
398 $result = $ilDB->queryF(
399 "
400 SELECT units.*, baseunits.unit baseunit_title
401 FROM il_qpl_qst_fq_unit units
402 INNER JOIN il_qpl_qst_fq_ucat ON il_qpl_qst_fq_ucat.category_id = units.category_fi
403 LEFT JOIN il_qpl_qst_fq_unit baseunits ON baseunits.unit_id = units.baseunit_fi
404 WHERE il_qpl_qst_fq_ucat.category_id = %s
405 ORDER BY units.sequence",
406 array('integer'),
407 array($category)
408 );
409 if ($result->numRows()) {
410 while ($row = $ilDB->fetchAssoc($result)) {
411 $unit = new assFormulaQuestionUnit();
412 $unit->initFormArray($row);
413 array_push($units, $unit);
414 }
415 }
416 return $units;
417 }
418
423 public function getUnit($id)
424 {
425 if (count($this->units) == 0) {
426 $this->loadUnits();
427 }
428 if (array_key_exists($id, $this->units)) {
429 return $this->units[$id];
430 } else {
431 //maybee this is a new unit ...
432 // reload $this->units
433
434 $this->loadUnits();
435 if (array_key_exists($id, $this->units)) {
436 return $this->units[$id];
437 }
438 }
439 return null;
440 }
441
442
443 public function getUnitCategories()
444 {
445 global $DIC;
446 $ilDB = $DIC['ilDB'];
447
448 $categories = array();
449 $result = $ilDB->queryF(
450 "SELECT * FROM il_qpl_qst_fq_ucat WHERE question_fi > %s ORDER BY category",
451 array('integer'),
452 array(0)
453 );
454 if ($result->numRows()) {
455 while ($row = $ilDB->fetchAssoc($result)) {
456 $value = (strcmp("-qpl_qst_formulaquestion_" . $row["category"] . "-", $this->lng->txt($row["category"])) == 0) ? $row["category"] : $this->lng->txt($row["category"]);
457
458 if (strlen(trim($row["category"]))) {
459 $cat = array(
460 "value" => $row["category_id"],
461 "text" => $value,
462 "qst_id" => $row['question_fi']
463 );
464 $categories[$row["category_id"]] = $cat;
465 }
466 }
467 }
468 return $categories;
469 }
470
471 public function getAdminUnitCategories()
472 {
473 global $DIC;
474 $ilDB = $DIC['ilDB'];
475
476 $categories = array();
477 $result = $ilDB->queryF(
478 "SELECT * FROM il_qpl_qst_fq_ucat WHERE question_fi = %s ORDER BY category",
479 array('integer'),
480 array(0)
481 );
482 if ($result->numRows()) {
483 while ($row = $ilDB->fetchAssoc($result)) {
484 $value = (strcmp("-qpl_qst_formulaquestion_" . $row["category"] . "-", $this->lng->txt($row["category"])) == 0) ? $row["category"] : $this->lng->txt($row["category"]);
485
486 if (strlen(trim($row["category"]))) {
487 $cat = array(
488 "value" => $row["category_id"],
489 "text" => $value,
490 "qst_id" => $row['question_fi']
491 );
492 $categories[$row["category_id"]] = $cat;
493 }
494 }
495 }
496
497 return $categories;
498 }
499
504 public function saveUnitOrder($unit_id, $sequence)
505 {
509 global $DIC;
510 $ilDB = $DIC['ilDB'];
511
512 $ilDB->manipulateF(
513 '
514 UPDATE il_qpl_qst_fq_unit
515 SET sequence = %s
516 WHERE unit_id = %s AND question_fi = %s
517 ',
518 array('integer', 'integer', 'integer'),
519 array((int) $sequence, $unit_id, $this->getConsumerId())
520 );
521 self::$result_buffer = null;
522 }
523
524 public function checkDeleteUnit($id, $category_id = null)
525 {
526 global $DIC;
527 $ilDB = $DIC['ilDB'];
528
529 $result = $ilDB->queryF(
530 "SELECT * FROM il_qpl_qst_fq_var WHERE unit_fi = %s",
531 array('integer'),
532 array($id)
533 );
534 if ($result->numRows() > 0) {
535 return $this->lng->txt("err_unit_in_variables");
536 }
537 $result = $ilDB->queryF(
538 "SELECT * FROM il_qpl_qst_fq_res WHERE unit_fi = %s",
539 array('integer'),
540 array($id)
541 );
542 if ($result->numRows() > 0) {
543 return $this->lng->txt("err_unit_in_results");
544 }
545 if (!is_null($category_id)) {
546 $result = $ilDB->queryF(
547 "SELECT * FROM il_qpl_qst_fq_unit WHERE baseunit_fi = %s AND category_fi != %s",
548 array('integer', 'integer', 'integer'),
549 array($id, $id, $category_id)
550 );
551 } else {
552 $result = $ilDB->queryF(
553 "SELECT * FROM il_qpl_qst_fq_unit WHERE baseunit_fi = %s AND unit_id != %s",
554 array('integer', 'integer'),
555 array($id, $id)
556 );
557 }
558 if ($result->numRows() > 0) {
559 return $this->lng->txt("err_unit_is_baseunit");
560 }
561 return null;
562 }
563
569 public function getUnitCategoryById($id)
570 {
574 global $DIC;
575 $ilDB = $DIC['ilDB'];
576
577 $query = 'SELECT * FROM il_qpl_qst_fq_ucat WHERE category_id = ' . $ilDB->quote($id, 'integer');
578 $res = $ilDB->query($query);
579 if (!$ilDB->numRows($res)) {
580 throw new ilException('un_category_not_exist');
581 }
582
583 $row = $ilDB->fetchAssoc($res);
584 $category = new assFormulaQuestionUnitCategory();
585 $category->initFormArray($row);
586 return $category;
587 }
588
593 public function saveCategory(assFormulaQuestionUnitCategory $category)
594 {
598 global $DIC;
599 $ilDB = $DIC['ilDB'];
600
601 $res = $ilDB->queryF(
602 'SELECT * FROM il_qpl_qst_fq_ucat WHERE category = %s AND question_fi = %s AND category_id != %s',
603 array('text', 'integer', 'integer'),
604 array($category->getCategory(), $this->getConsumerId(), $category->getId())
605 );
606 if ($ilDB->numRows($res)) {
607 throw new ilException('err_wrong_categoryname');
608 }
609
610 $ilDB->manipulateF(
611 'UPDATE il_qpl_qst_fq_ucat SET category = %s WHERE question_fi = %s AND category_id = %s',
612 array('text', 'integer', 'integer'),
613 array($category->getCategory(), $this->getConsumerId(), $category->getId())
614 );
615 self::$result_buffer = null;
616 }
617
622 public function saveNewUnitCategory(assFormulaQuestionUnitCategory $category)
623 {
627 global $DIC;
628 $ilDB = $DIC['ilDB'];
629
630 $res = $ilDB->queryF(
631 'SELECT category FROM il_qpl_qst_fq_ucat WHERE category = %s AND question_fi = %s',
632 array('text', 'integer'),
633 array($category->getCategory(), $this->getConsumerId())
634 );
635 if ($ilDB->numRows($res)) {
636 throw new ilException('err_wrong_categoryname');
637 }
638
639 $next_id = $ilDB->nextId('il_qpl_qst_fq_ucat');
640 $ilDB->manipulateF(
641 "INSERT INTO il_qpl_qst_fq_ucat (category_id, category, question_fi) VALUES (%s, %s, %s)",
642 array('integer', 'text', 'integer'),
643 array(
644 $next_id,
645 $category->getCategory(),
646 (int) $this->getConsumerId()
647 )
648 );
649 $category->setId($next_id);
650 self::$result_buffer = null;
651 }
652
656 public function getAllUnitCategories()
657 {
661 global $DIC;
662 $ilDB = $DIC['ilDB'];
663
664 $categories = array();
665 $result = $ilDB->queryF(
666 "SELECT * FROM il_qpl_qst_fq_ucat WHERE question_fi = %s OR question_fi = %s ORDER BY category",
667 array('integer', 'integer'),
668 array($this->getConsumerId(), 0)
669 );
670 if ($result->numRows()) {
671 while ($row = $ilDB->fetchAssoc($result)) {
672 $category = new assFormulaQuestionUnitCategory();
673 $category->initFormArray($row);
674 $categories[] = $category;
675 }
676 }
677 return $categories;
678 }
679
684 public function deleteCategory($id)
685 {
689 global $DIC;
690 $ilDB = $DIC['ilDB'];
691
692 $res = $this->checkDeleteCategory($id);
693 if (!is_null($res)) {
694 return $this->lng->txt('err_category_in_use');
695 }
696
697 $res = $ilDB->queryF(
698 'SELECT * FROM il_qpl_qst_fq_unit WHERE category_fi = %s',
699 array('integer'),
700 array($id)
701 );
702 while ($row = $ilDB->fetchAssoc($res)) {
703 $this->deleteUnit($row['unit_id']);
704 }
705 $ar = $ilDB->manipulateF(
706 'DELETE FROM il_qpl_qst_fq_ucat WHERE category_id = %s',
707 array('integer'),
708 array($id)
709 );
710 if ($ar > 0) {
711 $this->clearUnits();
712 }
713 self::$result_buffer = null;
714 return null;
715 }
716
720 public function createNewUnit(assFormulaQuestionUnit $unit)
721 {
725 global $DIC;
726 $ilDB = $DIC['ilDB'];
727
728 $next_id = $ilDB->nextId('il_qpl_qst_fq_unit');
729 $ilDB->manipulateF(
730 'INSERT INTO il_qpl_qst_fq_unit (unit_id, unit, factor, baseunit_fi, category_fi, sequence, question_fi) VALUES (%s, %s, %s, %s, %s, %s, %s)',
731 array('integer', 'text', 'float', 'integer', 'integer', 'integer', 'integer'),
732 array(
733 $next_id,
734 $unit->getUnit(),
735 1,
736 0,
737 (int) $unit->getCategory(),
738 0,
739 (int) $this->getConsumerId()
740 )
741 );
742 $unit->setId($next_id);
743 $unit->setFactor(1);
744 $unit->setBaseUnit(0);
745 $unit->setSequence(0);
746
747 $this->clearUnits();
748 self::$result_buffer = null;
749 }
750
754 public function saveUnit(assFormulaQuestionUnit $unit)
755 {
759 global $DIC;
760 $ilDB = $DIC['ilDB'];
761
762 $res = $ilDB->queryF(
763 'SELECT unit_id FROM il_qpl_qst_fq_unit WHERE unit_id = %s',
764 array('integer'),
765 array($unit->getId())
766 );
767 if ($ilDB->fetchAssoc($res)) {
768 $row = $ilDB->fetchAssoc($res);
769 $sequence = $row['sequence'];
770 if (is_null($unit->getBaseUnit()) || !strlen($unit->getBaseUnit())) {
771 $unit->setFactor(1);
772 }
773 $ar = $ilDB->manipulateF(
774 'UPDATE il_qpl_qst_fq_unit SET unit = %s, factor = %s, baseunit_fi = %s, category_fi = %s, sequence = %s WHERE unit_id = %s AND question_fi = %s',
775 array('text', 'float', 'integer', 'integer', 'integer', 'integer', 'integer'),
776 array($unit->getUnit(), $unit->getFactor(), (int) $unit->getBaseUnit(), (int) $unit->getCategory(), (int) $unit->getSequence(), (int) $unit->getId(), (int) $this->getConsumerId())
777 );
778 if ($ar > 0) {
779 $this->clearUnits();
780 }
781 }
782 self::$result_buffer = null;
783 }
784
789 public function cloneUnits($a_from_consumer_id, $a_to_consumer_id)
790 {
794 global $DIC;
795 $ilDB = $DIC['ilDB'];
796
797 $category_mapping = array();
798
799 $res = $ilDB->queryF("SELECT * FROM il_qpl_qst_fq_ucat WHERE question_fi = %s", array('integer'), array($a_from_consumer_id));
800 while ($row = $ilDB->fetchAssoc($res)) {
801 $new_category_id = $this->copyCategory($row['category_id'], $a_to_consumer_id);
802 $category_mapping[$row['category_id']] = $new_category_id;
803 }
804
805 foreach ($category_mapping as $old_category_id => $new_category_id) {
806 $res = $ilDB->queryF(
807 'SELECT * FROM il_qpl_qst_fq_unit WHERE category_fi = %s',
808 array('integer'),
809 array($old_category_id)
810 );
811
812 $i = 0;
813 $units = array();
814 while ($row = $ilDB->fetchAssoc($res)) {
815 $next_id = $ilDB->nextId('il_qpl_qst_fq_unit');
816
817 $units[$i]['old_unit_id'] = $row['unit_id'];
818 $units[$i]['new_unit_id'] = $next_id;
819
820 $ilDB->insert(
821 'il_qpl_qst_fq_unit',
822 array(
823 'unit_id' => array('integer', $next_id),
824 'unit' => array('text', $row['unit']),
825 'factor' => array('float', $row['factor']),
826 'baseunit_fi' => array('integer', (int) $row['baseunit_fi']),
827 'category_fi' => array('integer', (int) $new_category_id),
828 'sequence' => array('integer', (int) $row['sequence']),
829 'question_fi' => array('integer', (int) $a_to_consumer_id)
830 )
831 );
832 $i++;
833 }
834
835 foreach ($units as $unit) {
836 //update unit : baseunit_fi
837 $ilDB->update(
838 'il_qpl_qst_fq_unit',
839 array('baseunit_fi' => array('integer', (int) $unit['new_unit_id'])),
840 array(
841 'baseunit_fi' => array('integer', (int) $unit['old_unit_id']),
842 'question_fi' => array('integer', (int) $a_to_consumer_id)
843 )
844 );
845
846 //update var : unit_fi
847 $ilDB->update(
848 'il_qpl_qst_fq_var',
849 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
850 array(
851 'unit_fi' => array('integer', (int) $unit['old_unit_id']),
852 'question_fi' => array('integer', (int) $a_to_consumer_id)
853 )
854 );
855
856 //update res : unit_fi
857 $ilDB->update(
858 'il_qpl_qst_fq_res',
859 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
860 array(
861 'unit_fi' => array('integer', (int) $unit['old_unit_id']),
862 'question_fi' => array('integer', (int) $a_to_consumer_id)
863 )
864 );
865
866 //update res_unit : unit_fi
867 $ilDB->update(
868 'il_qpl_qst_fq_res_unit',
869 array('unit_fi' => array('integer', (int) $unit['new_unit_id'])),
870 array(
871 'unit_fi' => array('integer', (int) $unit['old_unit_id']),
872 'question_fi' => array('integer', (int) $a_to_consumer_id)
873 )
874 );
875 }
876 }
877 self::$result_buffer = null;
878 }
879}
$result
An exception for terminatinating execution or to throw for unit testing.
Base class for ILIAS Exception handling.
Class ilUnitConfigurationRepository.
$i
Definition: disco.tpl.php:19
if(!array_key_exists('StateId', $_REQUEST)) $id
$row
$query
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
global $ilDB