ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLearningHistoryProviderFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
12 {
16  protected $service;
17 
21  protected static $providers = array(
22  ilTrackingLearningHistoryProvider::class,
23  ilBadgeLearningHistoryProvider::class,
24  ilCourseLearningHistoryProvider::class,
25  ilFirstLoginLearningHistoryProvider::class,
26  ilCertificateLearningHistoryProvider::class,
27  ilSkillLearningHistoryProvider::class
28  );
29 
33  public function __construct($service)
34  {
35  $this->service = $service;
36  }
37 
45  public function getAllProviders($active_only = false, $user_id = null)
46  {
47  $providers = array();
48 
49  if ($user_id == 0) {
50  $user_id = $this->service->user()->getId();
51  }
52 
53  foreach (self::$providers as $provider) {
55  $providerInstance = new $provider($user_id, $this->service->factory(), $this->service->language());
56  if (!$active_only || $providerInstance->isActive()) {
57  $providers[] = $providerInstance;
58  }
59  }
60 
61  return $providers;
62  }
63 }