3 declare(strict_types=1);
18 public function __construct(
string $class,
string $type,
string $tag, array $parameters = [],
int $hide = 0)
20 $this->
class = $class;
29 return hash(
"sha256", self::class);
34 return "Add style class";
51 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
54 "SELECT obj_id" . PHP_EOL
55 .
"FROM object_data" . PHP_EOL
56 .
"WHERE type = 'sty'" . PHP_EOL
58 $result = $db->query($sql);
60 while ($row = $db->fetchAssoc($result)) {
62 "SELECT style_id, type, characteristic, hide" . PHP_EOL
63 .
"FROM style_char" . PHP_EOL
64 .
"WHERE style_id = " . $db->quote($row[
"obj_id"],
"integer") . PHP_EOL
65 .
"AND characteristic = " . $db->quote($this->
class,
"text") . PHP_EOL
66 .
"AND type = " . $db->quote($this->type,
"text") . PHP_EOL
68 $res = $db->query($sql);
70 if (!$db->fetchAssoc(
$res)) {
72 "style_id" => [
"integer", $row[
"obj_id"]],
77 $db->insert(
"style_char", $values);
79 foreach ($this->parameters as $k => $v) {
80 $spid = $db->nextId(
"style_parameter");
82 "id" => [
"integer", $spid],
83 "style_id" => [
"integer", $row[
"obj_id"]],
86 "parameter" => [
"text", $k],
87 "value" => [
"text", $v],
90 $db->insert(
"style_parameter", $values);
100 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
103 "SELECT obj_id" . PHP_EOL
104 .
"FROM object_data" . PHP_EOL
105 .
"WHERE type = 'sty'" . PHP_EOL
108 $result = $db->query($sql);
110 while ($row = $db->fetchAssoc($result)) {
112 "SELECT style_id, type, characteristic, hide" . PHP_EOL
113 .
"FROM style_char" . PHP_EOL
114 .
"WHERE style_id = " . $db->quote($row[
"obj_id"],
"integer") . PHP_EOL
115 .
"AND characteristic = " . $db->quote($this->
class,
"text") . PHP_EOL
116 .
"AND type = " . $db->quote($this->type,
"text") . PHP_EOL;
117 $res = $db->query($sql);
120 if ($db->numRows(
$res) == 0) {
isApplicable(Environment $environment)
achieve(Environment $environment)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
getPreconditions(Environment $environment)
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.
__construct(string $class, string $type, string $tag, array $parameters=[], int $hide=0)