ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilECSParticipantSettingsRepository.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
27
28 public function __construct()
29 {
30 global $DIC;
31
32 $this->db = $DIC->database();
33 }
34
38 public function getExportableParticipants($a_type): array
39 {
40 $query = 'SELECT sid,mid,export_types FROM ecs_part_settings ep ' .
41 'JOIN ecs_server es ON ep.sid = es.server_id ' .
42 'WHERE export = ' . $this->db->quote(1, 'integer') . ' ' .
43 'AND active = ' . $this->db->quote(1, 'integer') . ' ' .
44 'ORDER BY cname,es.title';
45
46 $res = $this->db->query($query);
47 $mids = array();
48 $counter = 0;
49 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
50 if (in_array($a_type, (array) unserialize($row->export_types, ['allowed_classes' => true]), true)) {
51 $mids[$counter]['sid'] = (int) $row->sid;
52 $mids[$counter]['mid'] = (int) $row->mid;
53 $counter++;
54 }
55 }
56 return $mids;
57 }
58
62 public function getServersContaingExports(): array
63 {
64 $query = 'SELECT DISTINCT(sid) FROM ecs_part_settings ep ' .
65 'JOIN ecs_server es ON ep.sid = es.server_id ' .
66 'WHERE export = ' . $this->db->quote(1, 'integer') . ' ' .
67 'AND active = ' . $this->db->quote(1, 'integer') . ' ';
68 $res = $this->db->query($query);
69 $sids = array();
70 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
71 $sids[] = (int) $row->sid;
72 }
73 return $sids;
74 }
75
76 // Code below is unused according to eclipse. keep around if not true, otherwise remove
77 // /**
78 // * Delete by server
79 // * @global $ilDB
80 // * @param int $a_server_id
81 // */
82 // public static function deleteByServer($a_server_id)
83 // {
84 // global $DIC;
85
86 // $ilDB = $DIC['ilDB'];
87
88 // $query = 'DELETE from ecs_part_settings ' .
89 // 'WHERE sid = ' . $this->db->quote($a_server_id, 'integer');
90 // $this->db->manipulate($query);
91 // }
92}
getServersContaingExports()
Get server ids which allow an export.
getExportableParticipants($a_type)
Get participants which are enabled and export is allowed.
Interface ilDBInterface.
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26
$counter