ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
SettingsManager.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Blog\Settings;
22 
26 
28 {
29  public function __construct(
30  protected InternalDataService $data,
31  protected InternalRepoService $repo,
32  protected InternalDomainService $domain
33  ) {
34  }
35 
36 
37  public function create(Settings $settings): void
38  {
39  $this->repo->settings()->create($settings);
40  }
41 
42  public function update(Settings $settings): void
43  {
44  $this->repo->settings()->update($settings);
45  }
46 
47  public function getByObjId(int $id): ?Settings
48  {
49  return $this->repo->settings()->getByObjId($id);
50  }
51 
52  public function clone($from_id, $to_id): void
53  {
54  $settings = $this->repo->settings()->getByObjId($from_id);
55  $settings = $settings->withId($to_id);
56  $this->update($settings);
57  }
58 
59  public function saveOrder(int $id, array $order): void
60  {
61  $this->repo->settings()->saveOrder($id, $order);
62  }
63 
64  public function getOrderingOptions(
65  Settings $settings,
66  bool $in_repository
67  ): array {
68  $lng = $this->domain->lng();
69  $order_options = [];
70  foreach ($settings->getOrder() as $item) {
71  $order_options[$item] = $lng->txt("blog_" . $item);
72  }
73 
74  $type = "navigation";
75  if (!isset($order_options[$type])) {
76  $order_options[$type] = $lng->txt("blog_" . $type);
77  }
78 
79  if ($in_repository) {
80  $type = "authors";
81  if (!isset($order_options[$type])) {
82  $order_options[$type] = $lng->txt("blog_" . $type);
83  }
84  }
85 
86  $type = "keywords";
87  if (!isset($order_options[$type])) {
88  $order_options[$type] = $lng->txt("blog_" . $type);
89  }
90 
91  return $order_options;
92  }
93 }
__construct(protected InternalDataService $data, protected InternalRepoService $repo, protected InternalDomainService $domain)
getOrderingOptions(Settings $settings, bool $in_repository)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31