19 declare(strict_types=1);
37 return "Update LP Settings of Course References";
42 return self::DEFAULT_AMOUNT_OF_STEPS;
55 $this->db = $environment->
getResource(Setup\Environment::RESOURCE_DATABASE);
63 $query =
"SELECT distinct od.obj_id AS objid " . PHP_EOL .
64 "FROM object_reference oref " . PHP_EOL .
65 "JOIN object_data od ON od.obj_id = oref.obj_id AND od.type = 'crsr'" . PHP_EOL .
66 "JOIN tree ON oref.ref_id = tree.child" . PHP_EOL .
67 "JOIN tree t2 ON t2.path > tree.path" . PHP_EOL .
68 "JOIN object_reference oref2 ON oref2.ref_id = t2.child" . PHP_EOL .
69 "JOIN object_data od2 ON od2.obj_id = oref2.obj_id AND od2.type = 'prg'" . PHP_EOL .
70 "WHERE od.obj_id NOT IN (" . PHP_EOL .
71 "SELECT obj_id FROM ut_lp_settings WHERE obj_type = 'crsr' AND u_mode = " 77 $row = $this->db->fetchAssoc(
$result);
78 $q =
'DELETE FROM ut_lp_settings WHERE obj_id = ' . (int) $row[
'objid'];
79 $this->db->manipulate($q);
81 $q =
'INSERT INTO ut_lp_settings (obj_id, obj_type, u_mode)' . PHP_EOL .
87 $this->db->manipulate($q);
92 $query =
"SELECT count(distinct od.obj_id) AS cnt " . PHP_EOL .
93 "FROM object_reference oref " . PHP_EOL .
94 "JOIN object_data od ON od.obj_id = oref.obj_id AND od.type = 'crsr'" . PHP_EOL .
95 "JOIN tree ON oref.ref_id = tree.child" . PHP_EOL .
96 "JOIN tree t2 ON t2.path > tree.path" . PHP_EOL .
97 "JOIN object_reference oref2 ON oref2.ref_id = t2.child" . PHP_EOL .
98 "JOIN object_data od2 ON od2.obj_id = oref2.obj_id AND od2.type = 'prg'" . PHP_EOL .
99 "WHERE od.obj_id NOT IN (" . PHP_EOL .
100 "SELECT obj_id FROM ut_lp_settings WHERE obj_type = 'crsr' AND u_mode = " 104 $row = $this->db->fetchAssoc(
$result);
106 return (
int) $row[
'cnt'];
const DEFAULT_AMOUNT_OF_STEPS
step(Environment $environment)
prepare(Environment $environment)
const LP_MODE_COURSE_REFERENCE
getRemainingAmountOfSteps()
getPreconditions(Environment $environment)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
getDefaultAmountOfStepsPerRun()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.