ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilDB;
67
68 $query = 'SELECT id FROM sysc_groups ' .
69 'WHERE component = ' . $ilDB->quote($a_component_id, 'text');
70 $res = $ilDB->query($query);
71 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
72 return $row->id;
73 }
74 return 0;
75 }
76
77
82 public function getGroups()
83 {
84 return (array) $this->groups;
85 }
86
90 protected function read()
91 {
92 global $ilDB;
93
94 $query = 'SELECT id FROM sysc_groups ' .
95 'ORDER BY id ';
96 $res = $ilDB->query($query);
97
98 $this->groups = array();
99 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
100 $this->groups[] = new ilSCGroup($row->id);
101 }
102 }
103}
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