18 declare(strict_types=1);
    28     public static function hasAssignments(
int $a_server_id, 
int $a_mid, 
int $a_tree_id): 
bool    37         $query = 
'SELECT ref_id FROM ecs_node_mapping_a ' .
    38             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
    39             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
    40             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
    43         return $res->rowCount() > 0;
    51     public static function lookupSettings(
int $a_server_id, 
int $a_mid, 
int $a_tree_id, 
int $a_node_id)
    57         $query = 
'SELECT title_update, position_update, tree_update FROM ecs_node_mapping_a ' .
    58             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
    59             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
    60             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
    61             'AND cs_id = ' . 
$ilDB->quote($a_node_id, 
'integer');
    64         if (!
$res->numRows()) {
    70             $settings[
'title_update'] = $row->title_update;
    71             $settings[
'position_update'] = $row->position_update;
    72             $settings[
'tree_update'] = $row->tree_update;
    86         $query = 
'SELECT cs_id FROM ecs_node_mapping_a ' .
    87             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
    88             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
    89             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
    93         $assignments = array();
    95             $assignments[] = $row->cs_id;
   107         $ilDB = $DIC[
'ilDB'];
   109         $query = 
'SELECT cs_id FROM ecs_node_mapping_a ' .
   110             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
   111             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   112             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
   113             'AND ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer') . 
' ';
   116         $assignments = array();
   118             $assignments[] = $row->cs_id;
   131         $ilDB = $DIC[
'ilDB'];
   133         $query = 
'SELECT depth FROM ecs_node_mapping_a ' .
   134             'JOIN ecs_cms_tree ON (tree = cs_root AND child = cs_id) ' .
   135             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
   136             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   137             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ';
   140             return $row->depth === 1;
   152         $ilDB = $DIC[
'ilDB'];
   154         $query = 
'SELECT title_update FROM ecs_node_mapping_a ' .
   155             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
   156             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   157             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
   158             'AND cs_id = ' . 
$ilDB->quote(0, 
'integer') . 
' ';
   161             return (
bool) $row->title_update;
   173         $ilDB = $DIC[
'ilDB'];
   175         $query = 
'SELECT cs_id FROM ecs_node_mapping_a ' .
   176             'WHERE server_id = ' . 
$ilDB->quote($a_server_id, 
'integer') . 
' ' .
   177             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   178             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
   179             'AND ref_id = ' . 
$ilDB->quote($a_ref_id, 
'integer') . 
' ';
   184             $cs_ids[] = $row->cs_id;
   196         $ilDB = $DIC[
'ilDB'];
   198         $query = 
'DELETE FROM ecs_node_mapping_a ' .
   199             'WHERE server_id = ' . 
$ilDB->quote($a_server_id) . 
' ' .
   200             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   201             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ' .
   202             'AND ' . 
$ilDB->in(
'cs_id', $cs_ids, 
false, 
'integer');
   203         $ilDB->manipulate($query);
   210     public static function deleteMappings(
int $a_server_id, 
int $a_mid, 
int $a_tree_id): bool
   214         $ilDB = $DIC[
'ilDB'];
   216         $query = 
'DELETE FROM ecs_node_mapping_a ' .
   217             'WHERE server_id = ' . 
$ilDB->quote($a_server_id) . 
' ' .
   218             'AND mid = ' . 
$ilDB->quote($a_mid, 
'integer') . 
' ' .
   219             'AND cs_root = ' . 
$ilDB->quote($a_tree_id, 
'integer') . 
' ';
   220         $ilDB->manipulate($query);
   230         foreach (self::lookupAssignmentsByRefId($a_server_id, $a_mid, $a_tree_id, $a_ref_id) as $assignment) {
   238                     $toDelete[] = $assignment;
   245         self::deleteMappingsByCsId($a_server_id, $a_mid, $a_tree_id, $toDelete);
 const MAPPING_PENDING_DISCONNECTABLE
 
static lookupAssignmentIds(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup assignments. 
 
static deleteMappingsByCsId(int $a_server_id, int $a_mid, int $a_tree_id, array $cs_ids)
Delete mappings. 
 
static lookupSettings(int $a_server_id, int $a_mid, int $a_tree_id, int $a_node_id)
Lookup Settings. 
 
static isWholeTreeMapped(int $a_server_id, int $a_mid, int $a_tree_id)
Check if whole tree is mapped. 
 
static deleteMappings(int $a_server_id, int $a_mid, int $a_tree_id)
Delete mappings. 
 
static lookupDefaultTitleUpdate($a_server_id, $a_mid, $a_tree_id)
Lookup default title update setting. 
 
static lookupAssignmentsByRefId(int $a_server_id, int $a_mid, int $a_tree_id, int $a_ref_id)
Lookup assignments. 
 
static deleteDisconnectableMappings(int $a_server_id, int $a_mid, int $a_tree_id, int $a_ref_id)
delete disconnectable mappings 
 
static lookupStatusByCmsId(int $a_server_id, int $a_mid, int $a_tree_id, string $cms_id)
Lookup status. 
 
static lookupMappedItemsForRefId(int $a_server_id, int $a_mid, int $a_tree_id, int $a_ref_id)
Get cs ids for ref_id. 
 
const MAPPING_PENDING_NOT_DISCONNECTABLE