ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
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 68 of file TourManager.php.

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

◆ 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 ));
55 return $tour_obj->getId();
56 }

◆ deleteTour()

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

Definition at line 89 of file TourManager.php.

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

◆ getAll()

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

Definition at line 61 of file TourManager.php.

61 : \Generator
62 {
63 foreach (\ilObject::_getObjectsByType("gdtr") as $tour) {
64 yield \ilObjectFactory::getInstanceByObjId($tour["obj_id"]);
65 }
66 }
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 84 of file TourManager.php.

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

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: