ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Help\GuidedTour\Tour\TourManager Class Reference
+ Collaboration diagram for ILIAS\Help\GuidedTour\Tour\TourManager:

Public Member Functions

 __construct (protected InternalDataService $data, protected InternalDomainService $domain)
 
 createTour (string $title, string $description)
 
 getAll ()
 
 anyActive ()
 
 getByObjId (int $obj_id)
 
 deleteTour (int $obj_id)
 

Protected Attributes

bool $any_active = null
 

Private Attributes

ILIAS Help GuidedTour Settings SettingsManager $sm
 

Detailed Description

Definition at line 29 of file TourManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Help\GuidedTour\Tour\TourManager::__construct ( protected InternalDataService  $data,
protected InternalDomainService  $domain 
)

Definition at line 34 of file TourManager.php.

37 {
38 $this->sm = $domain->tourSettings();
39 }

References ILIAS\Help\GuidedTour\InternalDomainService\tourSettings().

+ Here is the call graph for this function:

Member Function Documentation

◆ anyActive()

ILIAS\Help\GuidedTour\Tour\TourManager::anyActive ( )

Definition at line 69 of file TourManager.php.

69 : bool
70 {
71 if (!is_null($this->any_active)) {
72 return $this->any_active;
73 }
74 foreach ($this->getAll() as $tour) {
75 $settings = $this->sm->getByObjId($tour->getId());
76 if ($settings?->isActive()) {
77 $this->any_active = true;
78 return true;
79 }
80 }
81 $this->any_active = false;
82 return false;
83 }

◆ createTour()

ILIAS\Help\GuidedTour\Tour\TourManager::createTour ( string  $title,
string  $description 
)

Definition at line 41 of file TourManager.php.

44 : int {
45 $tour_obj = new ilObjGuidedTour();
46 $tour_obj->setTitle($title);
47 $tour_obj->setDescription($description);
48 $tour_obj->create();
49 $this->sm->save($this->data->settings(
50 $tour_obj->getId(),
51 false,
52 "",
53 PermissionType::None,
54 "de"
55 ));
56 return $tour_obj->getId();
57 }

◆ deleteTour()

ILIAS\Help\GuidedTour\Tour\TourManager::deleteTour ( int  $obj_id)

Definition at line 90 of file TourManager.php.

92 : void {
93 $tour_obj = new ilObjGuidedTour($obj_id);
94 $tour_obj->delete();
95 }

◆ getAll()

ILIAS\Help\GuidedTour\Tour\TourManager::getAll ( )
Returns
\Generator<ilObjGuidedTour>

Definition at line 62 of file TourManager.php.

62 : \Generator
63 {
64 foreach (\ilObject::_getObjectsByType("gdtr") as $tour) {
65 yield \ilObjectFactory::getInstanceByObjId($tour["obj_id"]);
66 }
67 }
static _getObjectsByType(string $obj_type="", ?int $owner=null)

References ilObject\_getObjectsByType().

+ Here is the call graph for this function:

◆ getByObjId()

ILIAS\Help\GuidedTour\Tour\TourManager::getByObjId ( int  $obj_id)

Definition at line 85 of file TourManager.php.

86 {
87 return \ilObjectFactory::getInstanceByObjId($obj_id);
88 }

Field Documentation

◆ $any_active

bool ILIAS\Help\GuidedTour\Tour\TourManager::$any_active = null
protected

Definition at line 31 of file TourManager.php.

◆ $sm

ILIAS Help GuidedTour Settings SettingsManager ILIAS\Help\GuidedTour\Tour\TourManager::$sm
private

Definition at line 32 of file TourManager.php.


The documentation for this class was generated from the following file: