ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
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\Wiki\Settings;
22 
26 
28 {
29  public function __construct(
30  protected InternalDataService $data,
31  protected InternalRepoService $repo,
32  protected InternalDomainService $domain
33  ) {
34  }
35 
36  public function create(Settings $settings): void
37  {
38  $this->repo->settings()->create($settings);
39  }
40 
41  public function update(Settings $settings): void
42  {
43  $this->repo->settings()->update($settings);
44  }
45 
46  public function getById(int $id): ?Settings
47  {
48  return $this->repo->settings()->getById($id);
49  }
50 
51  public function getStartPageOptions(int $ref_id): array
52  {
53  $pm = $this->domain->page()->page($ref_id);
54  $options = [];
55  foreach ($pm->getWikiPages() as $page) {
56  $options[(string) $page->getId()] = \ilStr::shortenTextExtended($page->getTitle(), 60, true);
57  }
58  return $options;
59  }
60 
61  public function getStartPageId(Settings $settings): ?int
62  {
63  return \ilWikiPage::_getPageIdForWikiTitle(
64  $settings->getId(),
65  $settings->getStartPage()
66  );
67  }
68 }
$ref_id
Definition: ltiauth.php:65
__construct(protected InternalDataService $data, protected InternalRepoService $repo, protected InternalDomainService $domain)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)