/** * 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'); }
public static function updateStatus($a_server_id, $a_mid, $a_tree_id) { // Set all status to pending unmapped self::writeAllStatus($a_server_id, $a_mid, $a_tree_id, self::MAPPING_UNMAPPED); // Set mapped for mapped and their descendent include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php'; include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php'; foreach (ilECSNodeMappingAssignments::lookupAssignmentIds($a_server_id, $a_mid, $a_tree_id) as $assignment) { $cmsTree = new ilECSCmsTree($a_tree_id); $subIds = self::lookupCmsIds(array_merge($cmsTree->getSubTreeIds($assignment), array($assignment))); self::writeStatus($a_server_id, $a_mid, $a_tree_id, $subIds, self::MAPPING_MAPPED); } }