ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjectCustomIconFactory.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8{
12 protected $webDirectory;
13
17 protected $uploadService;
18
22 protected $objectCache;
23
24
30 public function __construct(
32 \ILIAS\FileUpload\FileUpload $uploadService,
34 ) {
35 $this->webDirectory = $webDirectory;
36 $this->uploadService = $uploadService;
37 $this->objectCache = $objectCache;
38 }
39
45 {
46 switch ($type) {
47 case 'grp':
48 case 'root':
49 case 'cat':
50 case 'fold':
51 case 'crs':
52 case 'prg':
53 require_once 'Services/Object/Icon/classes/class.ilContainerCustomIconConfiguration.php';
54 $configuration = new \ilContainerCustomIconConfiguration();
55 break;
56
57 default:
58 require_once 'Services/Object/Icon/classes/class.ilObjectCustomIconConfiguration.php';
59 $configuration = new \ilObjectCustomIconConfiguration();
60 break;
61 }
62
63 return $configuration;
64 }
65
71 public function getByObjId(int $objId, string $objType = '') : \ilObjectCustomIcon
72 {
73 if (0 === strlen($objType)) {
74 $objType = (string) $this->objectCache->lookupType($objId);
75 }
76
77 require_once 'Services/Object/Icon/classes/class.ilObjectCustomIconImpl.php';
78 return new \ilObjectCustomIconImpl(
79 $this->webDirectory,
80 $this->uploadService,
81 $this->getConfigurationByType($objType),
82 $objId
83 );
84 }
85
94 public function getPresenterByObjId(int $objId, string $objType) : \ilObjectCustomIconPresenter
95 {
96 if (0 === strlen($objType)) {
97 $objType = $this->objectCache->lookupType($objId);
98 }
99
100 $presenter = null;
101 switch ($objType) {
102 case 'catr':
103 case 'grpr':
104 case 'crsr':
105 $presenter = new \ilObjectReferenceCustomIconPresenter($objId, $this);
106 $presenter->init();
107 break;
108
109 default:
110 $presenter = new \ilObjectCustomIconPresenterImpl($this->getByObjId((int) $objId, (string) $objType));
111 break;
112
113 }
114 return $presenter;
115 }
116}
An exception for terminatinating execution or to throw for unit testing.
Class ilObjectCustomIconFactory.
__construct(\ILIAS\Filesystem\Filesystem $webDirectory, \ILIAS\FileUpload\FileUpload $uploadService, \ilObjectDataCache $objectCache)
ilObjectCustomIconFactory constructor.
getPresenterByObjId(int $objId, string $objType)
Get custom icon presenter.
getByObjId(int $objId, string $objType='')
class ilObjectDataCache
Interface ilObjectCustomIcon.
Class FlySystemFileAccessTest.
Class BaseForm.
$type