19declare(strict_types=1);
39 return hash(
'sha256', self::class .
'::' . $this->context_name);
44 return 'Add OrgUnit operation context (name=' . $this->context_name .
45 ';parent_context=' . $this->parent_context .
')';
62 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
69 $parent_context_id = 0;
70 if (isset($this->parent_context)) {
74 'Parent context ' . $this->context_name .
' does not exist,
75 this objective should not be applied!'
78 $parent_context_id =
$id;
81 $id = $db->nextId(
'il_orgu_op_contexts');
82 $db->insert(
'il_orgu_op_contexts', [
83 'id' => [
'integer',
$id],
84 'context' => [
'text', $this->context_name],
85 'parent_context_id' => [
'integer', $parent_context_id]
93 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
100 if (isset($this->parent_context)) {
104 'Cannot find parent context ' . $this->parent_context
126 $result = $db->query(
'SELECT id FROM il_orgu_op_contexts
127 WHERE context = ' . $db->quote(
$context,
'text'));
128 if (!($row = $result->fetchObject())) {
131 return (
int) $row->id;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
isApplicable(Environment $environment)
getPreconditions(Environment $environment)
achieve(Environment $environment)
__construct(string $context_name, ?string $parent_context=null)
getContextId(ilDBInterface $db, string $context)
Defaults to 0 if context is not found.
doesContextExist(ilDBInterface $db, string $context)
return['delivery_method'=> 'php',]
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.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...