ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
DomainService.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Wiki\Wiki;
22 
26 
31 {
35 
36  public function __construct(
37  InternalDataService $data_service,
38  InternalRepoService $repo_service,
39  InternalDomainService $domain_service
40  ) {
41  $this->repo_service = $repo_service;
42  $this->data_service = $data_service;
43  $this->domain_service = $domain_service;
44  }
45 
46  public function checkRefId(int $ref_id): void
47  {
48  $obj_id = \ilObject::_lookupObjId($ref_id);
49  if (\ilObject::_lookupType($obj_id) !== "wiki") {
50  throw new \ilWikiException("Not a wiki ref id (" . $ref_id . ").");
51  }
52  }
53 
54  public function getObjId(int $ref_id): int
55  {
56  return \ilObject::_lookupObjId($ref_id);
57  }
58 
59  public function object(
60  int $ref_id
61  ): \ilObjWiki {
62  $this->checkRefId($ref_id);
63  return new \ilObjWiki($ref_id);
64  }
65 
66  public function translation(int $obj_id): \ilObjectTranslation
67  {
68  return \ilObjectTranslation::getInstance($obj_id);
69  }
70 
71  public function getStartingPageId(int $wiki_ref_id): ?int
72  {
73  $pm = $this->domain_service->page()->page($wiki_ref_id);
74  $wiki = $this->object($wiki_ref_id);
75  $start_page = $wiki->getStartPage();
76  if ($start_page === "") {
77  return null;
78  }
79  return $pm->getPageIdForTitle($start_page);
80  }
81 
82 }
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