ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilInstallationInformationStoredObjective Class Reference

Store information about the installation, like title, description and contact information in the according fields in the ini or database. More...

+ Inheritance diagram for ilInstallationInformationStoredObjective:
+ Collaboration diagram for ilInstallationInformationStoredObjective:

Public Member Functions

 __construct (\ilSystemFolderSetupConfig $config)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 

Protected Attributes

 $config
 

Detailed Description

Store information about the installation, like title, description and contact information in the according fields in the ini or database.

Definition at line 11 of file class.ilInstallationInformationStoredObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilInstallationInformationStoredObjective::__construct ( \ilSystemFolderSetupConfig  $config)

Member Function Documentation

◆ achieve()

ilInstallationInformationStoredObjective::achieve ( Setup\Environment  $environment)

Definition at line 47 of file class.ilInstallationInformationStoredObjective.php.

References $factory, $ini, and ILIAS\LTI\ToolProvider\$settings.

47  : Setup\Environment
48  {
49  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
50  $common_config = $environment->getConfigFor("common");
51 
52  $settings = $factory->settingsFor("common");
53  $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
54 
55  $settings->set("inst_name", (string) $this->config->getClientName());
56  $ini->setVariable("client", "name", $this->config->getClientName() ?? (string) $common_config->getClientId());
57  $ini->setVariable("client", "description", (string) $this->config->getClientDescription());
58  $settings->set("inst_institution", (string) $this->config->getClientInstitution());
59  $settings->set("admin_firstname", (string) $this->config->getContactFirstname());
60  $settings->set("admin_lastname", (string) $this->config->getContactLastname());
61  $settings->set("admin_title", (string) $this->config->getContactTitle());
62  $settings->set("admin_position", (string) $this->config->getContactPosition());
63  $settings->set("admin_institution", (string) $this->config->getContactInstitution());
64  $settings->set("admin_street", (string) $this->config->getContactStreet());
65  $settings->set("admin_zipcode", (string) $this->config->getContactZipcode());
66  $settings->set("admin_city", (string) $this->config->getContactCity());
67  $settings->set("admin_country", (string) $this->config->getContactCountry());
68  $settings->set("admin_phone", (string) $this->config->getContactPhone());
69  $settings->set("admin_email", (string) $this->config->getContactEMail());
70 
71  if (!$ini->write()) {
72  throw new Setup\UnachievableException("Could not write client.ini.php");
73  }
74 
75  return $environment;
76  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$factory
Definition: metadata.php:75
$ini
Definition: raiseError.php:4

◆ getHash()

ilInstallationInformationStoredObjective::getHash ( )

Definition at line 24 of file class.ilInstallationInformationStoredObjective.php.

24  : string
25  {
26  return hash("sha256", self::class);
27  }

◆ getLabel()

ilInstallationInformationStoredObjective::getLabel ( )

Definition at line 29 of file class.ilInstallationInformationStoredObjective.php.

29  : string
30  {
31  return "Store information about installation and contact in the settings";
32  }

◆ getPreconditions()

ilInstallationInformationStoredObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 39 of file class.ilInstallationInformationStoredObjective.php.

39  : array
40  {
41  return [
42  new \ilIniFilesLoadedObjective(),
43  new \ilSettingsFactoryExistsObjective()
44  ];
45  }

◆ isApplicable()

ilInstallationInformationStoredObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 81 of file class.ilInstallationInformationStoredObjective.php.

References $factory, $ini, and ILIAS\LTI\ToolProvider\$settings.

81  : bool
82  {
83  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
84  $common_config = $environment->getConfigFor("common");
85 
86  $settings = $factory->settingsFor("common");
87  $ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
88 
89  $client_name = $this->config->getClientName() ?? (string) $common_config->getClientId();
90 
91  return
92  $settings->get("inst_name") !== $this->config->getClientName() ||
93  $ini->readVariable("client", "name") !== $client_name ||
94  $ini->readVariable("client", "description") !== $this->config->getClientDescription() ||
95  $settings->get("inst_institution") !== $this->config->getClientInstitution() ||
96  $settings->get("admin_firstname") !== $this->config->getContactFirstname() ||
97  $settings->get("admin_lastname") !== $this->config->getContactLastname() ||
98  $settings->get("admin_title") !== $this->config->getContactTitle() ||
99  $settings->get("admin_position") !== $this->config->getContactPosition() ||
100  $settings->get("admin_institution") !== $this->config->getContactInstitution() ||
101  $settings->get("admin_street") !== $this->config->getContactStreet() ||
102  $settings->get("admin_zipcode") !== $this->config->getContactZipcode() ||
103  $settings->get("admin_city") !== $this->config->getContactCity() ||
104  $settings->get("admin_country") !== $this->config->getContactCountry() ||
105  $settings->get("admin_phone") !== $this->config->getContactPhone() ||
106  $settings->get("admin_email") !== $this->config->getContactEMail()
107  ;
108  }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
$factory
Definition: metadata.php:75
$ini
Definition: raiseError.php:4

◆ isNotable()

ilInstallationInformationStoredObjective::isNotable ( )

Definition at line 34 of file class.ilInstallationInformationStoredObjective.php.

34  : bool
35  {
36  return true;
37  }

Field Documentation

◆ $config

ilInstallationInformationStoredObjective::$config
protected

Definition at line 16 of file class.ilInstallationInformationStoredObjective.php.

Referenced by __construct().


The documentation for this class was generated from the following file: