ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExportLimitation Class Reference

Export limitation checker. More...

+ Collaboration diagram for ilExportLimitation:

Public Member Functions

 __construct ()
 
 getLimitationMode ()
 
 getLimitationNumber ()
 
 checkLimitation (int $ref_id, array $options)
 

Data Fields

const SET_EXPORT_DISABLED = 1
 
const SET_EXPORT_LIMITED = 0
 

Protected Attributes

const SET_LIMIT_NUMBER = "rep_export_limit_number"
 
const SET_LIMITATION = "rep_export_limitation"
 
ilTree $tree
 
ilSetting $settings
 
ilLanguage $lng
 

Detailed Description

Export limitation checker.

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

Definition at line 25 of file class.ilExportLimitation.php.

Constructor & Destructor Documentation

◆ __construct()

ilExportLimitation::__construct ( )

Definition at line 36 of file class.ilExportLimitation.php.

References $DIC, ILIAS\Repository\lng(), and ILIAS\Repository\settings().

37  {
38  global $DIC;
39 
40  $this->tree = $DIC->repositoryTree();
41  $this->settings = $DIC->settings();
42  $this->lng = $DIC->language();
43  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ checkLimitation()

ilExportLimitation::checkLimitation ( int  $ref_id,
array  $options 
)

Definition at line 55 of file class.ilExportLimitation.php.

References getLimitationMode(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\settings().

55  : void
56  {
57  $max = (int) $this->settings->get(self::SET_LIMIT_NUMBER);
58 
59  if ($this->getLimitationMode() == self::SET_EXPORT_DISABLED) {
61  $this->lng->txt("exp_error_disabled")
62  );
63  }
64 
65  $cnt = 0;
66  foreach ($this->tree->getSubTree($root = $this->tree->getNodeData($ref_id)) as $node) {
67  if (isset($options[$node["child"]]) && (in_array((int) $options[$node["child"]]["type"], [1, 2]))) {
68  $cnt++;
69  }
70  }
71  if ($max > 0 && $cnt > $max) {
72  throw new ilExportLimitationExceptionException(str_replace(
73  "%1",
74  (string) $max,
75  $this->lng->txt("exp_error_too_many_objects")
76  ));
77  }
78  }
$ref_id
Definition: ltiauth.php:65
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ getLimitationMode()

ilExportLimitation::getLimitationMode ( )

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

References ILIAS\Repository\settings().

Referenced by checkLimitation().

45  : int
46  {
47  return (int) $this->settings->get(self::SET_LIMITATION);
48  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLimitationNumber()

ilExportLimitation::getLimitationNumber ( )

Definition at line 50 of file class.ilExportLimitation.php.

References ILIAS\Repository\settings().

50  : int
51  {
52  return (int) $this->settings->get(self::SET_LIMIT_NUMBER);
53  }
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilExportLimitation::$lng
protected

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

◆ $settings

ilSetting ilExportLimitation::$settings
protected

Definition at line 33 of file class.ilExportLimitation.php.

◆ $tree

ilTree ilExportLimitation::$tree
protected

Definition at line 32 of file class.ilExportLimitation.php.

◆ SET_EXPORT_DISABLED

const ilExportLimitation::SET_EXPORT_DISABLED = 1

◆ SET_EXPORT_LIMITED

const ilExportLimitation::SET_EXPORT_LIMITED = 0

◆ SET_LIMIT_NUMBER

const ilExportLimitation::SET_LIMIT_NUMBER = "rep_export_limit_number"
protected

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

◆ SET_LIMITATION

const ilExportLimitation::SET_LIMITATION = "rep_export_limitation"
protected

Definition at line 28 of file class.ilExportLimitation.php.


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