ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilDerivedTaskProviderMasterFactory.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
16 protected $service;
17
21 protected $default_provider_factories = array(
22 ilExerciseDerivedTaskProviderFactory::class,
23 \ilForumDerivedTaskProviderFactory::class,
24 \ILIAS\Survey\Tasks\DerivedTaskProviderFactory::class,
25 ilBlogDerivedTaskProviderFactory::class
26 );
27
32
37 {
38 if (is_null($provider_factories)) {
39 $this->provider_factories = array_map(function ($class) use ($service) {
40 return new $class($service);
42 } else {
43 $this->provider_factories = $provider_factories;
44 }
45 $this->service = $service;
46 }
47
55 public function getAllProviders($active_only = false, $user_id = null)
56 {
57 $providers = array();
58
59 if ($user_id == 0) {
60 $user_id = $this->service->getDependencies()->user()->getId();
61 }
62
63 foreach ($this->provider_factories as $provider_factory) {
64 foreach ($provider_factory->getProviders() as $provider) {
65 if (!$active_only || $provider->isActive()) {
66 $providers[] = $provider;
67 }
68 }
69 }
70
71 return $providers;
72 }
73}
An exception for terminatinating execution or to throw for unit testing.
getAllProviders($active_only=false, $user_id=null)
Get all task providers.
__construct(ilTaskService $service, $provider_factories=null)
Constructor.
Class ChatMainBarProvider \MainMenu\Provider.