ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 60 of file Ruleset.php.

References $availrules.

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

◆ availableRulesNames()

sspmod_statistics_Ruleset::availableRulesNames ( )

Definition at line 65 of file Ruleset.php.

References $availrulenames.

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

◆ getRule()

sspmod_statistics_Ruleset::getRule (   $preferRule)

Definition at line 84 of file Ruleset.php.

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

85  {
87  $statrulesConfig = $this->statconfig->getConfigItem('statrules');
88  $statruleConfig = $statrulesConfig->getConfigItem($rule);
89 
90  $presenterClass = SimpleSAML\Module::resolveClass($statruleConfig->getValue('presenter', 'statistics:BaseRule'), 'Statistics_Rulesets');
91  $statrule = new $presenterClass($this->statconfig, $statruleConfig, $rule, $this->available);
92  return $statrule;
93  }
$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:252
resolveSelectedRule($preferRule=null)
Resolve which rule is selected.
Definition: Ruleset.php:73
+ Here is the call graph for this function:

◆ init()

sspmod_statistics_Ruleset::init ( )
private

Definition at line 22 of file Ruleset.php.

References $file, $key, $timeres, and array.

Referenced by __construct().

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

References $preferRule, and $rule.

Referenced by getRule().

74  {
75  $rule = $this->statconfig->getString('default', $this->availrules[0]);
76  if (!empty($preferRule)) {
77  if (in_array($preferRule, $this->availrules, true)) {
79  }
80  }
81  return $rule;
82  }
$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: