ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\COPage\ReadingTime\ReadingTimeManager Class Reference
+ Collaboration diagram for ILIAS\COPage\ReadingTime\ReadingTimeManager:

Public Member Functions

 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

 $refinery
 
 $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.

Member Function Documentation

◆ getParentReadingTime()

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

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

102  : int {
103  return $this->repo->getParentReadingTime($a_parent_type, $a_parent_id);
104  }

◆ getTime()

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

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

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

64  : int
65  {
66  return $this->repo->getTime(
67  $page->getId(),
68  $page->getParentType(),
69  $page->getLanguage()
70  );
71  }
+ 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 73 of file class.ReadingTimeManager.php.

References $lang.

77  : int {
78  return $this->repo->getTime(
79  $page_id,
80  $parent_type,
81  $lang
82  );
83  }
$lang
Definition: xapiexit.php:25

◆ saveTime()

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

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

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

Referenced by ILIAS\COPage\ReadingTime\ReadingTimeManager\setMissingReadingTimes().

45  : void
46  {
47  $minutes = 0;
48 
49  $page->buildDom();
50  $xml = $page->getXMLFromDom();
51 
52  $transf = $this->refinery->string()->estimatedReadingTime(true);
53  $minutes = $transf->transform(strip_tags($xml));
54  $minutes = max($minutes, 1);
55 
56  $this->repo->saveTime(
57  $page->getId(),
58  $page->getParentType(),
59  $page->getLanguage(),
60  $minutes
61  );
62  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMissingReadingTimes()

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

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

References ilPageObjectFactory\getInstance(), and ILIAS\COPage\ReadingTime\ReadingTimeManager\saveTime().

85  : void
86  {
87  $pages = $this->repo->getPagesWithMissingReadingTime($parent_type, $parent_id);
88  foreach ($pages as $p) {
90  $p["parent_type"],
91  (int) $p["page_id"],
92  0,
93  $p["lang"]
94  );
95  $this->saveTime($page);
96  }
97  }
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
+ Here is the call graph for this function:

Field Documentation

◆ $refinery

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

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

◆ $repo

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

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


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