ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
DomainService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Wiki\Wiki;
22 
27 
32 {
36 
37  public function __construct(
38  InternalDataService $data_service,
39  InternalRepoService $repo_service,
40  InternalDomainService $domain_service
41  ) {
42  $this->repo_service = $repo_service;
43  $this->data_service = $data_service;
44  $this->domain_service = $domain_service;
45  }
46 
47  public function checkRefId(int $ref_id): void
48  {
49  $obj_id = \ilObject::_lookupObjId($ref_id);
50  if (\ilObject::_lookupType($obj_id) !== "wiki") {
51  throw new \ilWikiException("Not a wiki ref id (" . $ref_id . ").");
52  }
53  }
54 
55  public function getObjId(int $ref_id): int
56  {
57  return \ilObject::_lookupObjId($ref_id);
58  }
59 
60  public function object(
61  int $ref_id
62  ): \ilObjWiki {
63  $this->checkRefId($ref_id);
64  return new \ilObjWiki($ref_id);
65  }
66 
67  public function translation(int $ref_id): Translations
68  {
69  return $this->object($ref_id)->getObjectProperties()->getPropertyTranslations();
70  }
71 
72  public function getStartingPageId(int $wiki_ref_id): ?int
73  {
74  $pm = $this->domain_service->page()->page($wiki_ref_id);
75  $wiki = $this->object($wiki_ref_id);
76  $start_page = $wiki->getStartPage();
77  if ($start_page === "") {
78  return null;
79  }
80  return $pm->getPageIdForTitle($start_page);
81  }
82 
83 }
Class handles translation mode for an object.
static _lookupObjId(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getStartingPageId(int $wiki_ref_id)
$ref_id
Definition: ltiauth.php:65
__construct(InternalDataService $data_service, InternalRepoService $repo_service, InternalDomainService $domain_service)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
InternalDomainService $domain_service
InternalRepoService $repo_service
static _lookupType(int $id, bool $reference=false)
InternalDataService $data_service
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...