/**
  * Do mapping
  */
 protected function dMap()
 {
     if (!$_POST['lnodes']) {
         ilUtil::sendFailure($this->lng->txt('select_one'), true);
         $this->ctrl->redirect($this, 'dEditTree');
     }
     $ref_id = end($_POST['lnodes']);
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
     ilECSNodeMappingAssignments::deleteDisconnectableMappings($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], $ref_id);
     $nodes = (array) $_POST['rnodes'];
     $nodes = (array) array_reverse($nodes);
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
     include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
     include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
     foreach ($nodes as $cms_id) {
         $assignment = new ilECSNodeMappingAssignment($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], (int) $cms_id);
         $assignment->setRefId($ref_id);
         $assignment->setObjId(ilObject::_lookupObjId($ref_id));
         $assignment->enablePositionUpdate(false);
         $assignment->enableTreeUpdate(false);
         $assignment->enableTitleUpdate(ilECSNodeMappingAssignments::lookupDefaultTitleUpdate($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid']));
         $assignment->update();
         // Delete subitems mappings for cms subtree
         $cmsTree = new ilECSCmsTree((int) $_REQUEST['tid']);
         $childs = $cmsTree->getSubTreeIds($cms_id);
         ilECSNodeMappingAssignments::deleteMappingsByCsId($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid'], $childs);
     }
     ilECSCmsData::updateStatus($this->getServer()->getServerId(), $this->getMid(), (int) $_REQUEST['tid']);
     // Save parameter cid
     $this->ctrl->setParameter($this, 'lid', (int) $ref_id);
     ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
     $this->ctrl->redirect($this, 'dEditTree');
 }