3declare(strict_types = 1);
 
   12    const TABLE = 
'prg_auto_content';
 
   39    public function readFor(
int $prg_obj_id) : array
 
   42            . self::FIELD_PRG_OBJ_ID . 
',' 
   43            . self::FIELD_CAT_REF_ID . 
',' 
   44            . self::FIELD_EDITOR_ID . 
',' 
   45            . self::FIELD_LAST_EDITED
 
   46            . PHP_EOL . 
'FROM ' . self::TABLE
 
   47            . PHP_EOL . 
'WHERE ' . self::FIELD_PRG_OBJ_ID . 
' = ' 
   48            . $this->db->quote($prg_obj_id, 
'integer');
 
   52        while ($rec = $this->db->fetchAssoc(
$res)) {
 
   54                (
int) $rec[self::FIELD_PRG_OBJ_ID],
 
   55                (
int) $rec[self::FIELD_CAT_REF_ID],
 
   56                (
int) $rec[self::FIELD_EDITOR_ID],
 
   57                new \DateTimeImmutable($rec[self::FIELD_LAST_EDITED])
 
   69        int $last_edited_usr_id = 
null,
 
   70        \DateTimeImmutable $last_edited = 
null 
   72        if (is_null($last_edited_usr_id)) {
 
   75        if (is_null($last_edited)) {
 
   76            $last_edited = new \DateTimeImmutable();
 
   92        $ilAtomQuery = $this->db->buildAtomQuery();
 
   93        $ilAtomQuery->addTableLock(self::TABLE);
 
   95        $current_usr_id = $this->current_usr_id;
 
   96        $ilAtomQuery->addQueryCallable(
 
   98                $query = 
'DELETE FROM ' . self::TABLE
 
   99                    . PHP_EOL . 
'WHERE prg_obj_id = ' . $ac->
getPrgObjId()
 
  103                $now = 
new \DateTimeImmutable();
 
  104                $now = $now->format(
'Y-m-d H:i:s');
 
  108                        self::FIELD_PRG_OBJ_ID => [
'integer', $ac->
getPrgObjId()],
 
  110                        self::FIELD_EDITOR_ID => [
'integer', $current_usr_id],
 
  111                        self::FIELD_LAST_EDITED => [
'timestamp', $now]
 
  122    public function delete(
int $prg_obj_id, array $cat_ref_ids)
 
  126                return $this->db->quote($id, 
'integer');
 
  130        $ids = implode(
',', $ids);
 
  132        $query = 
'DELETE FROM ' . self::TABLE
 
  133            . PHP_EOL . 
'WHERE prg_obj_id = ' . $this->db->quote($prg_obj_id, 
'integer')
 
  134            . PHP_EOL . 
'AND cat_ref_id IN (' . $ids . 
')';
 
  135        $this->db->manipulate(
$query);
 
  143        $query = 
'DELETE FROM ' . self::TABLE
 
  144            . PHP_EOL . 
'WHERE prg_obj_id = ' . $this->db->quote($prg_obj_id, 
'integer');
 
  145        $this->db->manipulate(
$query);
 
  155        $query = 
'SELECT ' . self::FIELD_PRG_OBJ_ID
 
  156            . PHP_EOL . 
'FROM ' . self::TABLE . 
' prgs' 
  157            . PHP_EOL . 
'INNER JOIN object_reference oref ON ' 
  158            . 
'prgs.' . self::FIELD_PRG_OBJ_ID . 
' =  oref.obj_id' 
  159            . PHP_EOL . 
'WHERE ' . self::FIELD_CAT_REF_ID . 
' = ' . 
$ilDB->quote($cat_ref_id, 
'integer')
 
  160            . PHP_EOL . 
'AND oref.deleted IS NULL';
 
An exception for terminatinating execution or to throw for unit testing.
Class ilStudyProgrammeAutoCategoryDBRepository.
deleteFor(int $prg_obj_id)
Delete all category-surveillance settings for a StudyProgramme.
update(ilStudyProgrammeAutoCategory $ac)
Store a category-surveillance setting.
readFor(int $prg_obj_id)
Read category-surveillance settings of programme.ilStudyProgrammeAutoCategory[]
create(int $prg_obj_id, int $category_ref_id, int $last_edited_usr_id=null, \DateTimeImmutable $last_edited=null)
Build an auto-category object.ilStudyProgrammeAutoCategory
static getProgrammesFor(int $cat_ref_id)
Get all programmes' ref_ids monitoring the given category.int[]
__construct(ilDBInterface $db, int $current_usr_id)
Class ilStudyProgrammeAutoCategory.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
manipulate($query)
Run a (write) Query on the database.
insert($table_name, $values)
Persistence of "monitored" categories for a StudyProgramme.
foreach($_POST as $key=> $value) $res