ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.AdminManager.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
21 namespace ILIAS\Awareness;
22 
29 {
30  protected const MODE_INACTIVE = 0;
31  protected const MODE_ONLINE_ONLY = 1;
32  protected const MODE_INCL_OFFLINE = 2;
33 
34  protected \ilLanguage $lng;
37  protected \ilSetting $settings;
38  protected int $user_id;
39  protected int $ref_id = 0;
40 
41  public function __construct(
42  int $ref_id,
43  InternalDataService $data_service,
44  InternalDomainService $domain_service
45  ) {
46  $this->ref_id = $ref_id;
47  $this->settings = $domain_service->awarenessSettings();
48  $this->domain_service = $domain_service;
49  $this->lng = $domain_service->lng();
50  $this->data_service = $data_service;
51  }
52 
56  public function getAllUserProviders(): array
57  {
58  return $this->domain_service->userProvider()->getAllProviders();
59  }
60 
64  public function setActivationMode(string $provider_id, int $a_val): void
65  {
66  $this->settings->set("up_act_" . $provider_id, (string) $a_val);
67  }
68 
69  public function getActivationMode(string $provider_id): int
70  {
71  return (int) $this->settings->get("up_act_" . $provider_id);
72  }
73 
74  public function isProviderActivated(string $provider_id): bool
75  {
76  return ($this->getActivationMode($provider_id) != self::MODE_INACTIVE);
77  }
78 
79  public function includesProviderOfflineUsers(string $provider_id): bool
80  {
81  return ($this->getActivationMode($provider_id) == self::MODE_INCL_OFFLINE);
82  }
83 
87  public function getModeOptions(): array
88  {
89  $options = array(
90  self::MODE_INACTIVE => $this->lng->txt("awrn_inactive"),
91  self::MODE_ONLINE_ONLY => $this->lng->txt("awrn_online_only"),
92  self::MODE_INCL_OFFLINE => $this->lng->txt("awrn_incl_offline")
93  );
94 
95  return $options;
96  }
97 }
InternalDataService $data_service
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getActivationMode(string $provider_id)
__construct(int $ref_id, InternalDataService $data_service, InternalDomainService $domain_service)
setActivationMode(string $provider_id, int $a_val)
Activate provider.
InternalDomainService $domain_service
isProviderActivated(string $provider_id)
includesProviderOfflineUsers(string $provider_id)
Administrate awareness tool.