ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLuceneAdvancedSearchSettings.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
27 {
29  private array $fields = [];
30 
31  protected ilSetting $storage;
32 
36  private function __construct()
37  {
38  $this->storage = new ilSetting('lucene_adv_search');
39  $this->read();
40  }
41 
42  public static function getInstance(): ilLuceneAdvancedSearchSettings
43  {
44  if (self::$instance instanceof ilLuceneAdvancedSearchSettings) {
45  return self::$instance;
46  }
47  return self::$instance = new ilLuceneAdvancedSearchSettings();
48  }
49 
53  public function isActive(string $a_field): bool
54  {
55  return $this->fields[$a_field] ?: false;
56  }
57 
58  public function setActive(string $a_field, bool $a_status): void
59  {
60  $this->fields[$a_field] = $a_status;
61  }
62 
63  public function save(): void
64  {
65  foreach ($this->fields as $name => $status) {
66  $this->storage->set($name, $status ? "1" : "0");
67  }
68  }
69 
70  private function read(): void
71  {
72  foreach (ilLuceneAdvancedSearchFields::getFields() as $name => $translation) {
73  $this->fields[$name] = (bool) $this->storage->get($name, 'true');
74  }
75  }
76 }
En/disable single lom/advanced meta data fields.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
isActive(string $a_field)
check if field is active
static ilLuceneAdvancedSearchSettings $instance
static getFields()
Return an array of all meta data fields.