20 self::addPurpose($service, $purpose);
21 self::addPreferred($service, $purpose, $preferred);
28 protected static function addPurpose($service, $purpose)
35 self::PURPOSE_PURPOSES_TABLE,
37 'purpose_id' => array(
'int',
$ilDB->nextId(self::PURPOSE_PURPOSES_TABLE)),
38 'service' => array(
'text', $service),
39 'purpose' => array(
'text', $purpose),
49 protected static function addPreferred($service, $purpose, $preferred)
55 self::PURPOSE_MAP_TABLE,
57 'map_id' => array(
'int',
$ilDB->nextId(self::PURPOSE_MAP_TABLE)),
58 'service' => array(
'text', $service),
59 'purpose' => array(
'text', $purpose),
60 'preferred' => array(
'text', $preferred),
61 'selected' => array(
'text', $preferred)
75 $ilDB->manipulate(
"DELETE FROM " . self::PURPOSE_PURPOSES_TABLE .
76 " WHERE service = " .
$ilDB->quote($service,
"txt") .
" AND purpose = " .
$ilDB->quote($purpose,
"txt"));
89 $ilDB->manipulate(
"DELETE FROM " . self::PURPOSE_MAP_TABLE .
90 " WHERE service = " .
$ilDB->quote($service,
"txt") .
" AND purpose = " .
$ilDB->quote($purpose,
"txt") .
91 " AND preferred = " .
$ilDB->quote($preferred,
"txt"));
102 $ilDB = $DIC[
'ilDB'];
104 $ilDB->manipulate(
"DELETE FROM " . self::PURPOSE_PURPOSES_TABLE .
" WHERE service = " .
$ilDB->quote($service,
"txt"));
116 $ilDB = $DIC[
'ilDB'];
118 $query =
'SELECT count(*) num FROM ' . self::PURPOSE_PURPOSES_TABLE .
' WHERE service = ' 119 .
$ilDB->quote($service,
'text') .
' AND purpose = ' .
$ilDB->quote($purpose,
'text');
122 if (
$row[
'num'] != 0) {
136 $ilDB = $DIC[
'ilDB'];
138 $query =
'SELECT purpose FROM ' . self::PURPOSE_PURPOSES_TABLE .
' WHERE service = ' .
$ilDB->quote($service,
'text');
142 $purposes[] =
$row[
'purpose'];
153 $ilDB = $DIC[
'ilDB'];
155 $query =
'SELECT service FROM ' . self::PURPOSE_PURPOSES_TABLE .
' GROUP BY service';
159 $services[] =
$row[
'service'];
170 $ilDB = $DIC[
'ilDB'];
171 $query =
'SELECT service, purpose FROM ' . self::PURPOSE_PURPOSES_TABLE .
' GROUP BY service, purpose having count(*) > 1';
174 if (is_array(
$row) && count(
$row) > 0) {
183 $ilDB = $DIC[
'ilDB'];
184 $query =
'SELECT service, purpose FROM ' . self::PURPOSE_PURPOSES_TABLE .
' GROUP BY service, purpose having count(*) > 1';
187 self::unregisterPurpose(
$row[
'service'],
$row[
'purpose']);
188 self::addPurpose(
$row[
'service'],
$row[
'purpose']);
191 $query =
'SELECT service, purpose, preferred FROM ' . self::PURPOSE_MAP_TABLE .
' GROUP BY service, purpose, preferred having count(*) > 1';
195 self::unregisterPreferred(
$row[
'service'],
$row[
'purpose'],
$row[
'preferred']);
196 self::addPreferred(
$row[
'service'],
$row[
'purpose'],
$row[
'preferred']);
207 $parts = explode(
'/', $service);
208 $service = $parts[1];
210 if (!self::isPurposeRegistered($service, $purpose)) {
211 self::registerPurpose($service, $purpose, $preferred);
219 public static function registerRenderer($renderer,
$path)
223 $ilDB = $DIC[
'ilDB'];
226 self::RENDERER_TABLE,
228 'renderer_id' => array(
'int',
$ilDB->nextId(self::RENDERER_TABLE)),
229 'renderer' => array(
'text', $renderer),
230 'path' => array(
'text',
$path)
240 public static function registerRendererAvailability($renderer, $service, $purpose)
244 $ilDB = $DIC[
'ilDB'];
247 self::RENDERER_AVAIL_TABLE,
249 'availability_id' => array(
'int',
$ilDB->nextId(self::RENDERER_AVAIL_TABLE)),
250 'service' => array(
'text', $service),
251 'purpose' => array(
'text', $purpose),
252 'renderer' => array(
'text', $renderer)
static updateFromXML($service, $purpose, $preferred)
static flushPurposes($service)
static unregisterPreferred($service, $purpose, $preferred)
static isPurposeRegistered($service, $purpose)
const PURPOSE_PURPOSES_TABLE
static registerPurpose($service, $purpose, $preferred)
const RENDERER_AVAIL_TABLE
static unregisterPurpose($service, $purpose)
static getPurposesByService($service)
static checkForMultipleServiceAndPurposeCombination()