19 declare(strict_types=1);
32 public function __construct(
string $orig_class,
string $class,
string $type,
string $tag,
int $hide = 0)
35 $this->
class = $class;
43 return hash(
"sha256", self::class);
48 return "Copy style class";
65 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
68 "SELECT obj_id" . PHP_EOL
69 .
"FROM object_data" . PHP_EOL
70 .
"WHERE type = 'sty'" . PHP_EOL
73 $result = $db->query($sql);
75 while ($row = $db->fetchAssoc($result)) {
77 "SELECT style_id, type, characteristic, hide" . PHP_EOL
78 .
"FROM style_char" . PHP_EOL
79 .
"WHERE style_id = " . $db->quote($row[
"obj_id"],
"integer") . PHP_EOL
80 .
"AND characteristic = " . $db->quote($this->
class,
"text") . PHP_EOL
81 .
"AND type = " . $db->quote($this->type,
"text") . PHP_EOL
83 $res = $db->query($sql);
85 if (!$db->fetchAssoc(
$res)) {
87 "style_id" => [
"integer", $row[
"obj_id"]],
92 $db->insert(
"style_char", $values);
95 "SELECT id, style_id, tag, class, parameter, value, type, mq_id, custom" . PHP_EOL
96 .
"FROM style_parameter" . PHP_EOL
97 .
"WHERE style_id = " . $db->quote($row[
"obj_id"],
"integer") . PHP_EOL
98 .
"AND type = " . $db->quote($this->type,
"text") . PHP_EOL
99 .
"AND class = " . $db->quote($this->orig_class,
"text") . PHP_EOL
100 .
"AND tag = " . $db->quote($this->tag,
"text") . PHP_EOL
103 $res = $db->query($sql);
105 while ($row_2 = $db->fetchAssoc(
$res)) {
106 $spid = $db->nextId(
"style_parameter");
108 "id" => [
"integer", $spid],
109 "style_id" => [
"integer", $row[
"obj_id"]],
112 "parameter" => [
"text", $row_2[
"parameter"]],
113 "value" => [
"text", $row_2[
"value"]],
114 "type" => [
"text", $row_2[
"type"]]
116 $db->insert(
"style_parameter", $values);
126 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
129 "SELECT obj_id" . PHP_EOL
130 .
"FROM object_data" . PHP_EOL
131 .
"WHERE type = 'sty'" . PHP_EOL
133 $result = $db->query($sql);
135 if ($db->numRows($result) == 0) {
139 while ($row = $db->fetchAssoc($result)) {
141 "SELECT style_id, type, characteristic, hide" . PHP_EOL
142 .
"FROM style_char" . PHP_EOL
143 .
"WHERE style_id = " . $db->quote($row[
"obj_id"],
"integer") . PHP_EOL
144 .
"AND characteristic = " . $db->quote($this->
class,
"text") . PHP_EOL
145 .
"AND type = " . $db->quote($this->type,
"text") . PHP_EOL
148 $res = $db->query($sql);
150 if ($db->numRows(
$res)) {
__construct(string $orig_class, string $class, string $type, string $tag, int $hide=0)
achieve(Environment $environment)
isApplicable(Environment $environment)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
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.
getPreconditions(Environment $environment)