ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSCGroups.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5include_once './Services/SystemCheck/classes/class.ilSCGroup.php';
6
13{
14
18 private static $instance = null;
19
20 private $groups = array();
21
25 private function __construct()
26 {
27 $this->read();
28 }
29
34 public static function getInstance()
35 {
36 if (self::$instance == null) {
37 return self::$instance = new self();
38 }
39 return self::$instance;
40 }
41
46 public function updateFromComponentDefinition($a_component_id)
47 {
48 foreach ($this->getGroups() as $group) {
49 if ($group->getComponentId() == $a_component_id) {
50 return $group->getId();
51 }
52 }
53
54 $component_group = new ilSCGroup();
55 $component_group->setComponentId($a_component_id);
56 $component_group->create();
57
58 return $component_group->getId();
59 }
60
64 public function lookupGroupByComponentId($a_component_id)
65 {
66 global $DIC;
67
68 $ilDB = $DIC['ilDB'];
69
70 $query = 'SELECT id FROM sysc_groups ' .
71 'WHERE component = ' . $ilDB->quote($a_component_id, 'text');
72 $res = $ilDB->query($query);
73 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
74 return $row->id;
75 }
76 return 0;
77 }
78
79
84 public function getGroups()
85 {
86 return (array) $this->groups;
87 }
88
92 protected function read()
93 {
94 global $DIC;
95
96 $ilDB = $DIC['ilDB'];
97
98 $query = 'SELECT id FROM sysc_groups ' .
99 'ORDER BY id ';
100 $res = $ilDB->query($query);
101
102 $this->groups = array();
103 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
104 $this->groups[] = new ilSCGroup($row->id);
105 }
106 }
107}
An exception for terminatinating execution or to throw for unit testing.
Defines a system check group including different tasks of a component.
Description of class.
read()
read groups
lookupGroupByComponentId($a_component_id)
getGroups()
Get groups.
static getInstance()
Get singleton instance.
updateFromComponentDefinition($a_component_id)
Update from component definition reader.
__construct()
Singleton constructor.
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46