ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
sspmod_statistics_Ruleset Class Reference
+ Collaboration diagram for sspmod_statistics_Ruleset:

Public Member Functions

 __construct ($statconfig)
 Constructor. More...
 
 availableRules ()
 
 availableRulesNames ()
 
 getRule ($preferRule)
 

Private Member Functions

 init ()
 
 resolveSelectedRule ($preferRule=null)
 Resolve which rule is selected. More...
 

Private Attributes

 $statconfig
 
 $availrulenames
 
 $availrules
 
 $available
 

Detailed Description

Definition at line 6 of file Ruleset.php.

Constructor & Destructor Documentation

◆ __construct()

sspmod_statistics_Ruleset::__construct (   $statconfig)

Constructor.

Definition at line 16 of file Ruleset.php.

References $statconfig, and init().

17  {
18  $this->statconfig = $statconfig;
19  $this->init();
20  }
+ Here is the call graph for this function:

Member Function Documentation

◆ availableRules()

sspmod_statistics_Ruleset::availableRules ( )

Definition at line 59 of file Ruleset.php.

References $availrules.

60  {
61  return $this->availrules;
62  }

◆ availableRulesNames()

sspmod_statistics_Ruleset::availableRulesNames ( )

Definition at line 64 of file Ruleset.php.

References $availrulenames.

65  {
66  return $this->availrulenames;
67  }

◆ getRule()

sspmod_statistics_Ruleset::getRule (   $preferRule)

Definition at line 83 of file Ruleset.php.

References $preferRule, $rule, $statrule, SimpleSAML\Module\resolveClass(), and resolveSelectedRule().

84  {
86  $statrulesConfig = $this->statconfig->getConfigItem('statrules');
87  $statruleConfig = $statrulesConfig->getConfigItem($rule);
88 
89  $presenterClass = SimpleSAML\Module::resolveClass($statruleConfig->getValue('presenter', 'statistics:BaseRule'), 'Statistics_Rulesets');
90  $statrule = new $presenterClass($this->statconfig, $statruleConfig, $rule, $this->available);
91  return $statrule;
92  }
$preferRule
Definition: showstats.php:12
$rule
Definition: showstats.php:43
$statrule
Definition: showstats.php:42
static resolveClass($id, $type, $subclass=null)
Resolve module class.
Definition: Module.php:169
resolveSelectedRule($preferRule=null)
Resolve which rule is selected.
Definition: Ruleset.php:72
+ Here is the call graph for this function:

◆ init()

sspmod_statistics_Ruleset::init ( )
private

Definition at line 22 of file Ruleset.php.

References $key, and $timeres.

Referenced by __construct().

23  {
24  $statdir = $this->statconfig->getValue('statdir');
25  $statrules = $this->statconfig->getValue('statrules');
26  $timeres = $this->statconfig->getValue('timeres');
27 
28  /*
29  * Walk through file lists, and get available [rule][fileslot]...
30  */
31  if (!is_dir($statdir)) {
32  throw new Exception('Statisics output directory [' . $statdir . '] does not exists.');
33  }
34  $filelist = scandir($statdir);
35  $this->available = array();
36  foreach ($filelist as $file) {
37  if (preg_match('/([a-z0-9_]+)-([a-z0-9_]+)-([0-9]+)\.stat/', $file, $matches)) {
38  if (array_key_exists($matches[1], $statrules)) {
39  if (array_key_exists($matches[2], $timeres))
40  $this->available[$matches[1]][$matches[2]][] = $matches[3];
41  }
42  }
43  }
44  if (empty($this->available)) {
45  throw new Exception('No aggregated statistics files found in [' . $statdir . ']');
46  }
47 
48  /*
49  * Create array with information about available rules..
50  */
51  $this->availrules = array_keys($statrules);
52  $available_rules = array();
53  foreach ($this->availrules as $key) {
54  $available_rules[$key] = array('name' => $statrules[$key]['name'], 'descr' => $statrules[$key]['descr']);
55  }
56  $this->availrulenames = $available_rules;
57  }
$timeres
Definition: showstats.php:77
$key
Definition: croninfo.php:18
+ Here is the caller graph for this function:

◆ resolveSelectedRule()

sspmod_statistics_Ruleset::resolveSelectedRule (   $preferRule = null)
private

Resolve which rule is selected.

Taking user preference and checks if it exists.

Definition at line 72 of file Ruleset.php.

References $preferRule, and $rule.

Referenced by getRule().

73  {
74  $rule = $this->statconfig->getString('default', $this->availrules[0]);
75  if (!empty($preferRule)) {
76  if (in_array($preferRule, $this->availrules, true)) {
78  }
79  }
80  return $rule;
81  }
$preferRule
Definition: showstats.php:12
$rule
Definition: showstats.php:43
+ Here is the caller graph for this function:

Field Documentation

◆ $available

sspmod_statistics_Ruleset::$available
private

Definition at line 11 of file Ruleset.php.

◆ $availrulenames

sspmod_statistics_Ruleset::$availrulenames
private

Definition at line 9 of file Ruleset.php.

Referenced by availableRulesNames().

◆ $availrules

sspmod_statistics_Ruleset::$availrules
private

Definition at line 10 of file Ruleset.php.

Referenced by availableRules().

◆ $statconfig

sspmod_statistics_Ruleset::$statconfig
private

Definition at line 8 of file Ruleset.php.

Referenced by __construct().


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