20 declare(strict_types=1);
32 ?
string $parent_context = null
40 return hash(
'sha256', self::class .
'::' . $this->context_name);
45 return 'Add OrgUnit operation context (name=' . $this->context_name .
46 ';parent_context=' . $this->parent_context .
')';
63 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
70 $parent_context_id = 0;
71 if (isset($this->parent_context)) {
75 'Parent context ' . $this->context_name .
' does not exist, 76 this objective should not be applied!' 79 $parent_context_id =
$id;
82 $id = $db->nextId(
'il_orgu_op_contexts');
83 $db->insert(
'il_orgu_op_contexts', [
84 'id' => [
'integer',
$id],
85 'context' => [
'text', $this->context_name],
86 'parent_context_id' => [
'integer', $parent_context_id]
94 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
101 if (isset($this->parent_context)) {
105 'Cannot find parent context ' . $this->parent_context
127 $result = $db->
query(
'SELECT id FROM il_orgu_op_contexts 128 WHERE context = ' . $db->
quote($context,
'text'));
129 if (!($row = $result->fetchObject())) {
132 return (
int) $row->id;
getPreconditions(Environment $environment)
doesContextExist(ilDBInterface $db, string $context)
quote($value, string $type)
__construct(string $context_name, ?string $parent_context=null)
query(string $query)
Run a (read-only) Query on the database.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
getContextId(ilDBInterface $db, string $context)
Defaults to 0 if context is not found.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isApplicable(Environment $environment)
An environment holds resources to be used in the setup process.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
achieve(Environment $environment)