ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\COPage\ReadingTime\ReadingTimeManager Class Reference
+ Collaboration diagram for ILIAS\COPage\ReadingTime\ReadingTimeManager:

Public Member Functions

 __construct ()
 
 saveTime (\ilPageObject $page)
 
 getTime (\ilPageObject $page)
 
 getTimeForId (string $parent_type, int $page_id, string $lang="-")
 
 setMissingReadingTimes (string $parent_type, int $parent_id)
 
 getParentReadingTime (string $a_parent_type, int $a_parent_id)
 

Protected Attributes

ILIAS Refinery Factory $refinery
 
ReadingTimeDBRepo $repo
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ReadingTimeManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\ReadingTime\ReadingTimeManager::__construct ( )

Definition at line 29 of file class.ReadingTimeManager.php.

30 {
31 global $DIC;
32
33 $this->refinery = $DIC->refinery();
34 $this->repo = new ReadingTimeDBRepo();
35 }
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Member Function Documentation

◆ getParentReadingTime()

ILIAS\COPage\ReadingTime\ReadingTimeManager::getParentReadingTime ( string  $a_parent_type,
int  $a_parent_id 
)

Definition at line 91 of file class.ReadingTimeManager.php.

94 : int {
95 return $this->repo->getParentReadingTime($a_parent_type, $a_parent_id);
96 }

◆ getTime()

ILIAS\COPage\ReadingTime\ReadingTimeManager::getTime ( \ilPageObject  $page)

Definition at line 56 of file class.ReadingTimeManager.php.

56 : int
57 {
58 return $this->repo->getTime(
59 $page->getId(),
60 $page->getParentType(),
61 $page->getLanguage()
62 );
63 }

References ilPageObject\getId(), ilPageObject\getLanguage(), and ilPageObject\getParentType().

+ Here is the call graph for this function:

◆ getTimeForId()

ILIAS\COPage\ReadingTime\ReadingTimeManager::getTimeForId ( string  $parent_type,
int  $page_id,
string  $lang = "-" 
)

Definition at line 65 of file class.ReadingTimeManager.php.

69 : int {
70 return $this->repo->getTime(
71 $page_id,
72 $parent_type,
73 $lang
74 );
75 }

◆ saveTime()

ILIAS\COPage\ReadingTime\ReadingTimeManager::saveTime ( \ilPageObject  $page)

Definition at line 37 of file class.ReadingTimeManager.php.

37 : void
38 {
39 $minutes = 0;
40
41 $page->buildDom();
42 $xml = $page->getXMLFromDom();
43
44 $transf = $this->refinery->string()->estimatedReadingTime(true);
45 $minutes = $transf->transform(strip_tags($xml));
46 $minutes = max($minutes, 1);
47
48 $this->repo->saveTime(
49 $page->getId(),
50 $page->getParentType(),
51 $page->getLanguage(),
52 $minutes
53 );
54 }

References ilPageObject\buildDom(), ilPageObject\getId(), ilPageObject\getLanguage(), ilPageObject\getParentType(), ilPageObject\getXMLFromDom(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ setMissingReadingTimes()

ILIAS\COPage\ReadingTime\ReadingTimeManager::setMissingReadingTimes ( string  $parent_type,
int  $parent_id 
)

Definition at line 77 of file class.ReadingTimeManager.php.

77 : void
78 {
79 $pages = $this->repo->getPagesWithMissingReadingTime($parent_type, $parent_id);
80 foreach ($pages as $p) {
82 $p["parent_type"],
83 (int) $p["page_id"],
84 0,
85 $p["lang"]
86 );
87 $this->saveTime($page);
88 }
89 }
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")

References ilPageObjectFactory\getInstance().

+ Here is the call graph for this function:

Field Documentation

◆ $refinery

ILIAS Refinery Factory ILIAS\COPage\ReadingTime\ReadingTimeManager::$refinery
protected

Definition at line 26 of file class.ReadingTimeManager.php.

◆ $repo

ReadingTimeDBRepo ILIAS\COPage\ReadingTime\ReadingTimeManager::$repo
protected

Definition at line 27 of file class.ReadingTimeManager.php.


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