3 declare(strict_types=1);
    28     private const TABLE = 
'prg_auto_membership';
    48     public function getFor(
int $prg_obj_id): array
    51             . self::FIELD_PRG_OBJ_ID . 
','    52             . self::FIELD_SOURCE_TYPE . 
','    53             . self::FIELD_SOURCE_ID . 
','    54             . self::FIELD_ENABLED . 
','    55             . self::FIELD_EDITOR_ID . 
','    56             . self::FIELD_LAST_EDITED
    57             . PHP_EOL . 
'FROM ' . self::TABLE
    58             . PHP_EOL . 
'WHERE ' . self::FIELD_PRG_OBJ_ID . 
' = '    59             . $this->db->quote($prg_obj_id, 
'integer');
    60         $res = $this->db->query($query);
    62         while ($rec = $this->db->fetchAssoc(
$res)) {
    64                 (
int) $rec[self::FIELD_PRG_OBJ_ID],
    65                 $rec[self::FIELD_SOURCE_TYPE],
    66                 (
int) $rec[self::FIELD_SOURCE_ID],
    67                 (
bool) $rec[self::FIELD_ENABLED],
    68                 (
int) $rec[self::FIELD_EDITOR_ID],
    80         int $last_edited_usr_id = null,
    83         if (is_null($last_edited_usr_id)) {
    86         if (is_null($last_edited)) {
   104         $ilAtomQuery = $this->db->buildAtomQuery();
   105         $ilAtomQuery->addTableLock(self::TABLE);
   107         $ilAtomQuery->addQueryCallable(
   109                 $query = 
'DELETE FROM ' . self::TABLE
   110                     . PHP_EOL . 
'WHERE prg_obj_id = ' . $ams->
getPrgObjId()
   111                     . PHP_EOL . 
'AND ' . self::FIELD_SOURCE_TYPE . 
' = ' . $this->db->quote($ams->
getSourceType(), 
'string')
   112                     . PHP_EOL . 
'AND ' . self::FIELD_SOURCE_ID . 
' = ' . $ams->
getSourceId();
   115                 $now = $now->format(
'Y-m-d H:i:s');
   119                         self::FIELD_PRG_OBJ_ID => [
'integer', $ams->
getPrgObjId()],
   121                         self::FIELD_SOURCE_ID => [
'integer', $ams->
getSourceId()],
   122                         self::FIELD_ENABLED => [
'integer', $ams->
isEnabled()],
   124                         self::FIELD_LAST_EDITED => [
'timestamp', $now]
   135     public function delete(
int $prg_obj_id, 
string $source_type, 
int $source_id): 
void   137         $query = 
'DELETE FROM ' . self::TABLE
   138             . PHP_EOL . 
'WHERE prg_obj_id = ' . $this->db->quote($prg_obj_id, 
'integer')
   139             . PHP_EOL . 
'AND ' . self::FIELD_SOURCE_TYPE . 
' = ' . $this->db->quote($source_type, 
'string')
   140             . PHP_EOL . 
'AND ' . self::FIELD_SOURCE_ID . 
' = ' . $this->db->quote($source_id, 
'integer');
   142         $this->db->manipulate($query);
   150         $query = 
'DELETE FROM ' . self::TABLE
   151             . PHP_EOL . 
'WHERE prg_obj_id = ' . $this->db->quote($prg_obj_id, 
'integer');
   152         $this->db->manipulate($query);
   161         $query = 
'SELECT ' . self::FIELD_PRG_OBJ_ID
   162             . PHP_EOL . 
'FROM ' . self::TABLE . 
' prgs'   163             . PHP_EOL . 
'INNER JOIN object_reference oref ON '   164             . 
'prgs.' . self::FIELD_PRG_OBJ_ID . 
' =  oref.obj_id'   165             . PHP_EOL . 
'WHERE ' . self::FIELD_SOURCE_TYPE . 
' = ' . $ilDB->quote($source_type, 
'text')
   166             . PHP_EOL . 
'AND ' . self::FIELD_SOURCE_ID . 
' = ' . $ilDB->quote($source_id, 
'integer')
   167             . PHP_EOL . 
'AND ' . self::FIELD_ENABLED . 
' = 1'   168             . PHP_EOL . 
'AND oref.deleted IS NULL';
   170         $res = $ilDB->query($query);
   171         return $ilDB->fetchAll(
$res);
 
insert(string $table_name, array $values)
 
static getProgrammesFor(string $source_type, int $source_id)
Get all programmes' obj_ids monitoring the given source.int[] 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
deleteFor(int $prg_obj_id)
Delete all auto-membership sources of a programme. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
__construct(ilDBInterface $db, int $current_usr_id)
 
manipulate(string $query)
Run a (write) Query on the database. 
 
getFor(int $prg_obj_id)
Read auto-membership sources of programme.ilStudyProgrammeAutoMembershipSource[] 
 
create(int $prg_obj_id, string $source_type, int $source_id, bool $enabled, int $last_edited_usr_id=null, DateTimeImmutable $last_edited=null)
Build an auto-membership source. 
 
update(ilStudyProgrammeAutoMembershipSource $ams)
Update an auto-membership source. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...