/** * MOB/File fieldtypes objects are head dependencies * They must be exported and imported first, so the new DC has the new IDs of those objects available * * @param $a_entity * @param $a_target_release * @param $a_ids * * @return array */ public function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids) { foreach ($a_ids as $id) { $m_ids = ilObjMediaPool::getAllMobIds($id); foreach ($m_ids as $m) { $mob_ids[] = $m; } } $dependencies = array(ilDataCollectionDatatype::INPUTFORMAT_FILE => array('component' => 'Modules/File', 'entity' => 'file', 'ids' => array()), ilDataCollectionDatatype::INPUTFORMAT_MOB => array('component' => 'Services/MediaObjects', 'entity' => 'mob', 'ids' => array())); // Direct SQL query is faster than looping over objects $page_object_ids = array(); foreach ($a_ids as $dcl_obj_id) { $sql = "SELECT stloc2.value AS ext_id, f.`datatype_id` FROM il_dcl_stloc2_value AS stloc2 " . "INNER JOIN il_dcl_record_field AS rf ON (rf.`id` = stloc2.`record_field_id`) " . "INNER JOIN il_dcl_field AS f ON (rf.`field_id` = f.`id`) " . "INNER JOIN il_dcl_table AS t ON (t.`id` = f.`table_id`) " . "WHERE t.`obj_id` = " . $this->db->quote($dcl_obj_id, 'integer') . " " . "AND f.datatype_id IN (" . implode(',', array_keys($dependencies)) . ") AND stloc2.`value` IS NOT NULL"; $set = $this->db->query($sql); while ($rec = $this->db->fetchObject($set)) { $dependencies[$rec->datatype_id]['ids'][] = (int) $rec->ext_id; } } // Return external dependencies/IDs if there are any $return = array(); if (count($dependencies[ilDataCollectionDatatype::INPUTFORMAT_FILE]['ids'])) { $return[] = $dependencies[ilDataCollectionDatatype::INPUTFORMAT_FILE]; } if (count($dependencies[ilDataCollectionDatatype::INPUTFORMAT_MOB]['ids'])) { $return[] = $dependencies[ilDataCollectionDatatype::INPUTFORMAT_MOB]; } return $return; }