18declare(strict_types=1);
 
   61        $this->db = 
$DIC->database();
 
   63        $this->
logger = $DIC->logger()->wsrv();
 
   65        $this->mapping_id = $a_mapping_id;
 
   77        $this->mapping_id = $a_id;
 
   96        $this->container_id = $a_id;
 
  113        $this->range_dt_start = $start;
 
  131        $this->range_dt_end = $end;
 
  140        if ($this->range_dt_end) {
 
  155        $this->field_name = $a_field;
 
  173        $this->mapping_type = $a_type;
 
  190        $this->mapping_value = $a_value;
 
  218        $this->by_type = $a_type;
 
  235    public function delete(): 
void 
  237        $this->db->manipulateF(
 
  238            'DELETE FROM ecs_container_mapping WHERE mapping_id = %s ',
 
  256        $this->db->manipulateF(
 
  257            'UPDATE ecs_container_mapping SET ' .
 
  258            'container_id = %s, ' .
 
  259            'field_name = %s, ' .
 
  260            'mapping_type = %s, ' .
 
  261            'mapping_value = %s, ' .
 
  262            'date_range_start = %s,' .
 
  263            'date_range_end = %s ' .
 
  264            'WHERE mapping_id = %s',
 
  265            array(
'integer',
'text',
'integer',
'text',
'integer',
'integer',
'integer'),
 
  289        $mapping_id = $this->db->nextId(
'ecs_container_mapping');
 
  290        $this->db->manipulateF(
 
  291            'INSERT INTO ecs_container_mapping  ' .
 
  292            '(mapping_id,container_id,field_name,mapping_type,mapping_value,date_range_start,date_range_end) ' .
 
  293            'VALUES(%s,%s,%s,%s,%s,%s,%s) ',
 
  294            array(
'integer',
'integer',
'text',
'integer',
'text',
'integer',
'integer'),
 
  367        foreach ($part as $part_id) {
 
  369                $part_string .= 
', ';
 
  373            $part_id_arr = explode(
'_', $part_id);
 
  375                ->getParticipantNameByMid((
int) $part_id_arr[1]) : 
"Broken mapping entry in database";
 
  377                $part_string .= 
$name;
 
  379                $part_string .= $part_id;
 
  389    public function matches(array $a_matchable_content): bool
 
  391        if (isset($a_matchable_content[$this->
getFieldName()])) {
 
  408                $values = explode(
',', $a_value);
 
  409                $this->
logger->info(__METHOD__ . 
': Checking for value: ' . $a_value);
 
  410                $this->
logger->info(__METHOD__ . 
': Checking against attribute values: ' . $this->
getMappingValue());
 
  414                $this->
logger->info(__METHOD__ . 
': Checking for value: ' . $a_value);
 
  415                $this->
logger->info(__METHOD__ . 
': Checking against attribute values: ' . $this->
getMappingValue());
 
  416                $values = array((
string) $a_value);
 
  420                $values = array($a_value);
 
  424        foreach ($values as $value) {
 
  425            $value = trim($value);
 
  430                        $attribute_value = trim($attribute_value);
 
  431                        if (strcasecmp($attribute_value, $value) === 0) {
 
  449    protected function read(): bool
 
  454        $res = $this->db->queryF(
 
  455            'SELECT * FROM ecs_container_mapping WHERE mapping_id = %s',
 
  459        while ($row = $this->db->fetchObject(
$res)) {
 
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false)
Format a period of two dates Shows: 14.
 
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
 
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
 
Defines a rule for the assignment of ECS remote courses to categories.
 
setMappingId(int $a_id)
set mapping id
 
setMappingValue(string $a_value)
set mapping value
 
getFieldName()
get field name
 
setDateRangeStart(ilDate $start)
set date range start
 
getMappingValue()
get mapping value
 
participantsToString()
get string presentation of participants
 
getMappingId()
get mapping id
 
setMappingType(int $a_type)
set mapping type
 
getByType()
get mapping by type
 
getDateRangeEnd()
get date range end
 
__construct(int $a_mapping_id=0)
Constructor.
 
setFieldName(string $a_field)
set field name
 
conditionToString()
condition to string
 
getDateRangeStart()
get date range start
 
const ERR_MISSING_BY_TYPE
 
getContainerId()
get container id
 
matchesValue($a_value, int $a_type)
Check if value matches.
 
setByType(string $a_type)
set mapping by type
 
matches(array $a_matchable_content)
Check if rule matches a specific econtent.
 
getMappingAsArray()
get mapping values as array
 
getMappingType()
get mapping type
 
setDateRangeEnd(ilDate $end)
set date range end
 
setContainerId(int $a_id)
set container id
 
Component logger with individual log levels by component id.
 
static _lookupType(int $id, bool $reference=false)
 
static _lookupObjId(int $ref_id)