ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
AdminConfirmedObjective.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\Setup;
8 
13 {
17  protected $message;
18 
19  public function __construct(string $message)
20  {
21  $this->message = $message;
22  }
23 
27  public function getHash() : string
28  {
29  return hash(
30  "sha256",
31  get_class($this) . "::" . $this->message
32  );
33  }
34 
38  public function getLabel() : string
39  {
40  return "Get a confirmation from admin.";
41  }
42 
46  public function isNotable() : bool
47  {
48  return false;
49  }
50 
54  public function getPreconditions(Setup\Environment $environment) : array
55  {
56  return [];
57  }
58 
62  public function achieve(Setup\Environment $environment) : Setup\Environment
63  {
64  $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
65 
66  if (!$admin_interaction->confirmOrDeny($this->message)) {
68  $this->message
69  );
70  }
71 
72  return $environment;
73  }
74 
78  public function isApplicable(Setup\Environment $environment) : bool
79  {
80  return true;
81  }
82 }
An objective is a desired state of the system that is supposed to be created by the setup...
Definition: Objective.php:14
isNotable()
Get to know if this is an interesting objective for a human.
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
getLabel()
Get a label that describes this objective.
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.
Definition: Environment.php:11
An admin needs to confirm something to achieve this objective.
Signals that a necessary confirmation from the admin is missing.