/** * Get all available resources * * @param ilECSSetting $a_server * @param bool $a_sender_only * @return array */ public function getAllResourceIds(ilECSSetting $a_server, $a_sender_only = false) { global $ilLog; try { include_once './Services/WebServices/ECS/classes/class.ilECSConnector.php'; $connector = new ilECSConnector($a_server); $connector->addHeader('X-EcsQueryStrings', $a_sender_only ? 'sender=true' : 'all=true'); // #11301 $list = $connector->getResourceList($this->getECSObjectType()); if ($list instanceof ilECSResult) { return $list->getResult()->getLinkIds(); } } catch (ilECSConnectorException $exc) { $ilLog->write(__METHOD__ . ': Error getting resource list. ' . $exc->getMessage()); } }
/** * Update ECS resource * * @param ilECSSetting $a_server * @param ilECSExport $a_export_settings * @param array $a_mids * @throws ilECSConnectorException */ protected function doUpdate(ilECSSetting $a_server, ilECSExport $a_export_settings, array $a_mids = null) { global $ilLog; include_once 'Services/WebServices/ECS/classes/class.ilECSConnector.php'; $econtent_id = $a_export_settings->getEContentId(); if (!$econtent_id) { $ilLog->write(__METHOD__ . ': Missing eid. Aborting.'); throw new ilECSConnectorException('Missing ECS content ID. Aborting.'); } $connector = new ilECSConnector($a_server); if (!$a_mids) { $a_mids = $this->getParticipants($a_server->getServerId(), $econtent_id); } $ilLog->write(__METHOD__ . ': Start updating ECS content - ' . print_r($a_mids, true)); $connector->addHeader(ilECSConnector::HEADER_MEMBERSHIPS, implode(',', (array) $a_mids)); $json = $this->buildJson($a_server); $connector->updateResource($this->getECSObjectType(), $econtent_id, json_encode($json)); $this->handlePermissionUpdate($a_server, true); }