コード例 #1
0
 /**
  * export released
  *
  * @access protected
  * @return
  */
 protected function exportReleased()
 {
     global $ilObjDataCache;
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     $exported = ilECSExport::getExportedIds();
     $ilObjDataCache->preloadObjectCache($exported);
     include_once 'Services/Utilities/classes/class.ilCSVWriter.php';
     $writer = new ilCSVWriter();
     $writer->addColumn($this->lng->txt('title'));
     $writer->addColumn($this->lng->txt('description'));
     $writer->addColumn($this->lng->txt('ecs_field_courseID'));
     $writer->addColumn($this->lng->txt('ecs_field_term'));
     $writer->addColumn($this->lng->txt('ecs_field_lecturer'));
     $writer->addColumn($this->lng->txt('ecs_field_courseType'));
     $writer->addColumn($this->lng->txt('ecs_field_semester_hours'));
     $writer->addColumn($this->lng->txt('ecs_field_credits'));
     $writer->addColumn($this->lng->txt('ecs_field_room'));
     $writer->addColumn($this->lng->txt('ecs_field_cycle'));
     $writer->addColumn($this->lng->txt('ecs_field_begin'));
     $writer->addColumn($this->lng->txt('ecs_field_end'));
     $writer->addColumn($this->lng->txt('last_update'));
     include_once './Services/WebServices/ECS/classes/class.ilECSDataMappingSettings.php';
     $settings = ilECSDataMappingSettings::_getInstance();
     foreach ($exported as $obj_id) {
         include_once './Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
         $values = ilAdvancedMDValues::_getValuesByObjId($obj_id);
         $writer->addRow();
         $writer->addColumn(ilObject::_lookupTitle($obj_id));
         $writer->addColumn(ilObject::_lookupDescription($obj_id));
         $field = $settings->getMappingByECSName('courseID');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('term');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('lecturer');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('courseType');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('semester_hours');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('credits');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('room');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('cycle');
         $writer->addColumn(isset($values[$field]) ? $values[$field] : '');
         $field = $settings->getMappingByECSName('begin');
         $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
         $field = $settings->getMappingByECSName('end');
         $writer->addColumn(isset($values[$field]) ? ilFormat::formatUnixTime($values[$field], true) : '');
         $writer->addColumn($ilObjDataCache->lookupLastUpdate($obj_id));
     }
     ilUtil::deliverData($writer->getCSVString(), date("Y_m_d") . "_ecs_export.csv", "text/csv");
 }
コード例 #2
0
 /**
  * get command frame
  *
  * @access public
  * @param
  * @return
  */
 public function getCommandFrame($a_cmd)
 {
     switch ($a_cmd) {
         case 'show':
             include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
             include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
             if (ilECSExport::_isRemote(ilECSImport::lookupServerId($this->obj_id), ilECSImport::_lookupEContentId($this->obj_id))) {
                 return '_blank';
             }
         default:
             return parent::getCommandFrame($a_cmd);
     }
 }
コード例 #3
0
 /**
  * Handle export reset.
  * Delete exported econtent and create it again 
  *
  * @return bool
  * @static
  * throws ilException, ilECSConnectorException
  */
 public static function handleExportReset(ilECSSetting $server)
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     // Delete all export events
     $queue = new ilECSEventQueueReader($server->getServerId());
     $queue->deleteAllExportedEvents();
     // Read all local export info
     $local_econtent_ids = ilECSExport::_getAllEContentIds($server->getServerId());
     $types = self::getAllEContentTypes();
     $list = self::getAllResourceIds($server, $types, true);
     // merge in one array
     $all_remote_ids = array();
     foreach ($list as $resource_type => $remote_ids) {
         $all_remote_ids = array_merge($all_remote_ids, (array) $remote_ids);
     }
     $all_remote_ids = array_unique($all_remote_ids);
     $GLOBALS['ilLog']->write(__METHOD__ . ': Resources = ' . print_r($all_remote_ids, true));
     $GLOBALS['ilLog']->write(__METHOD__ . ': Local = ' . print_r($local_econtent_ids, true));
     foreach ($local_econtent_ids as $local_econtent_id => $local_obj_id) {
         if (!in_array($local_econtent_id, $all_remote_ids)) {
             // Delete this deprecated info
             $GLOBALS['ilLog']->write(__METHOD__ . ': Deleting deprecated econtent id ' . $local_econtent_id);
             ilECSExport::_deleteEContentIds($server->getServerId(), array($local_econtent_id));
         }
     }
     return true;
 }
コード例 #4
0
 /**
  * Is remote object from same installation?
  * 
  * @return boolean 
  */
 public function isLocalObject()
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
     if (ilECSExport::_isRemote(ilECSImport::lookupServerId($this->getId()), ilECSImport::_lookupEContentId($this->getId()))) {
         return false;
     }
     return true;
 }
コード例 #5
0
 /**
  * handle delete
  * Objects that are moved to the trash call ECS-Remove
  * 
  * @see ilRepUtil	 
  * @param array $a_subbtree_nodes
  */
 public static function _handleDelete(array $a_subbtree_nodes)
 {
     // active?
     include_once './Services/WebServices/ECS/classes/class.ilECSServerSettings.php';
     if (!ilECSServerSettings::getInstance()->activeServerExists()) {
         return;
     }
     include_once './Services/WebServices/ECS/classes/class.ilECSSetting.php';
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     $exported = ilECSExport::getExportedIds();
     foreach ($a_subbtree_nodes as $node) {
         if (in_array($node['obj_id'], $exported)) {
             if ($content_obj = ilObjectFactory::getInstanceByRefId($node['child'], false)) {
                 $settings = self::getInstanceByObject($content_obj);
                 // Read export server ids
                 foreach (ilECSExport::getExportServerIds($node['obj_id']) as $sid) {
                     $server = ilECSSetting::getInstanceByServerId($sid);
                     $export_settings = new ilECSExport($sid, $content_obj->getId());
                     $settings->doDelete($server, $export_settings);
                 }
             }
         }
     }
 }
コード例 #6
0
 /**
  * Delete
  */
 public function delete()
 {
     global $ilDB;
     // --- cascading delete
     include_once 'Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
     ilECSCmsData::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSCommunityCache.php';
     ilECSCommunityCache::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSDataMappingSetting.php';
     ilECSDataMappingSetting::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php';
     ilECSEventQueueReader::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
     ilECSNodeMappingAssignment::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSParticipantSetting.php';
     ilECSParticipantSetting::deleteByServerId($this->getServerId());
     include_once 'Services/WebServices/ECS/classes/class.ilECSExport.php';
     ilECSExport::deleteByServerId($this->getServerId());
     // resetting server id to flag items in imported list
     include_once 'Services/WebServices/ECS/classes/class.ilECSImport.php';
     ilECSImport::resetServerId($this->getServerId());
     $ilDB->manipulate('DELETE FROM ecs_server ' . 'WHERE server_id = ' . $ilDB->quote($this->getServerId(), 'integer'));
     $this->server_id = NULL;
     return true;
 }
コード例 #7
0
 /**
  * Handle export reset.
  * Delete exported econtent and create it again 
  *
  * @return bool
  * @static
  * throws ilException, ilECSConnectorException
  */
 public static function handleExportReset(ilECSSetting $server)
 {
     include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
     // Delete all export events
     $queue = new ilECSEventQueueReader($server->getServerId());
     $queue->deleteAllExportedEvents();
     // Read all local export info
     $local_econtent_ids = ilECSExport::_getAllEContentIds($server->getServerId());
     $types = self::getAllEContentTypes();
     $list = self::getAllResourceIds($server, $types, true);
     // Delete all deprecated local export info
     foreach ($list as $resource_type => $remote_econtent_ids) {
         if ($remote_econtent_ids) {
             foreach ($local_econtent_ids as $econtent_id => $obj_id) {
                 if (!in_array($econtent_id, $remote_econtent_ids)) {
                     ilECSExport::_deleteEContentIds($server->getServerId(), array($econtent_id));
                 }
             }
             // Delete all with deprecated remote info
             foreach ($remote_econtent_ids as $econtent_id) {
                 if (!isset($local_econtent_ids[$econtent_id])) {
                     ilECSExport::_deleteEContentIds($server->getServerId(), array($econtent_id));
                 }
             }
         }
     }
     return true;
 }
コード例 #8
0
 /**
  * Parse
  *
  * @access public
  * @param array array of released content obj_ids
  * 
  */
 public function parse($a_obj_ids)
 {
     global $ilObjDataCache;
     $ilObjDataCache->preloadObjectCache($a_obj_ids);
     // read obj_ids
     $obj_ids = array();
     foreach ($a_obj_ids as $obj_id) {
         $ref_ids = ilObject::_getAllReferences($obj_id);
         $ref_id = current($ref_ids);
         $obj_ids[$ref_id] = $obj_id;
     }
     foreach ($obj_ids as $ref_id => $obj_id) {
         include_once './Services/WebServices/ECS/classes/class.ilECSExport.php';
         $tmp_arr['sids'] = ilECSExport::lookupServerIds($obj_id);
         $tmp_arr['ref_id'] = $ref_id;
         $tmp_arr['obj_id'] = $obj_id;
         $tmp_arr['title'] = $ilObjDataCache->lookupTitle($obj_id);
         $tmp_arr['desc'] = $ilObjDataCache->lookupDescription($obj_id);
         $tmp_arr['md'] = '';
         $tmp_arr['last_update'] = $ilObjDataCache->lookupLastUpdate($obj_id);
         $content[] = $tmp_arr;
     }
     $this->setData($content ? $content : array());
 }