ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSystemFolderMetricsCollectedObjective.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2020 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 use ILIAS\Setup;
6 
7 class ilSystemFolderMetricsCollectedObjective extends Setup\Metrics\CollectedObjective
8 {
9  public function getTentativePreconditions(Setup\Environment $environment): array
10  {
11  return [
12  new \ilSettingsFactoryExistsObjective()
13  ];
14  }
15 
16  public function collectFrom(Setup\Environment $environment, Setup\Metrics\Storage $storage): void
17  {
18  $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
19  if (!$factory) {
20  return;
21  }
22  $settings = $factory->settingsFor("common");
23  $firstname = new Setup\Metrics\Metric(
24  Setup\Metrics\Metric::STABILITY_CONFIG,
25  Setup\Metrics\Metric::TYPE_TEXT,
26  $settings->get("admin_firstname", "")
27  );
28  $lastname = new Setup\Metrics\Metric(
29  Setup\Metrics\Metric::STABILITY_CONFIG,
30  Setup\Metrics\Metric::TYPE_TEXT,
31  $settings->get("admin_lastname", "")
32  );
33  $email = new Setup\Metrics\Metric(
34  Setup\Metrics\Metric::STABILITY_CONFIG,
35  Setup\Metrics\Metric::TYPE_TEXT,
36  $settings->get("admin_email", "")
37  );
38  $contact = new Setup\Metrics\Metric(
39  Setup\Metrics\Metric::STABILITY_CONFIG,
40  Setup\Metrics\Metric::TYPE_COLLECTION,
41  [
42  "firstname" => $firstname,
43  "lastname" => $lastname,
44  "email" => $email
45  ],
46  "Contact information for this installation."
47  );
48  $storage->store("contact", $contact);
49  }
50 }
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
collectFrom(Setup\Environment $environment, Setup\Metrics\Storage $storage)
if($orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:302
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:27
$factory
Definition: metadata.php:75