ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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  protected \ILIAS\Notes\Service $notes;
30 
31  public function __construct(
32  protected InternalDataService $data,
33  protected InternalRepoService $repo,
34  protected InternalDomainService $domain
35  ) {
36  global $DIC;
37  $this->notes = $DIC->notes();
38  }
39 
40  public function create(Settings $settings): void
41  {
42  $this->repo->settings()->create($settings);
43  }
44 
45  public function update(Settings $settings): void
46  {
47  $this->repo->settings()->update($settings);
48  $this->notes->domain()->activateComments($settings->getId(), $settings->getPublicNotes());
49  }
50 
51  public function getById(int $id): ?Settings
52  {
53  return $this->repo->settings()->getById($id);
54  }
55 
56  public function getStartPageOptions(int $ref_id): array
57  {
58  $pm = $this->domain->page()->page($ref_id);
59  $options = [];
60  foreach ($pm->getWikiPages() as $page) {
61  $options[(string) $page->getId()] = \ilStr::shortenTextExtended($page->getTitle(), 60, true);
62  }
63  return $options;
64  }
65 
66  public function getStartPageId(Settings $settings): ?int
67  {
68  return \ilWikiPage::_getPageIdForWikiTitle(
69  $settings->getId(),
70  $settings->getStartPage()
71  );
72  }
73 }
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
__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)