/** * send notifications about new EContent * * @return bool */ protected function sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id) { global $ilLog; if (!count($rcps = $a_server->getApprovalRecipients())) { return true; } include_once './Services/Mail/classes/class.ilMail.php'; include_once './Services/Language/classes/class.ilLanguageFactory.php'; $lang = ilLanguageFactory::_getLanguage(); $lang->loadLanguageModule('ecs'); // @TODO: read mail $mail = new ilMail(self::MAIL_SENDER); $message = $lang->txt('ecs_export_created_body_a') . "\n\n"; $message .= $lang->txt('title') . ': ' . $this->content_obj->getTitle() . "\n"; if (strlen($desc = $this->content_obj->getDescription())) { $message .= $lang->txt('desc') . ': ' . $desc . "\n"; } // Participant info $message .= "\n" . $lang->txt('ecs_published_for'); try { $found = false; $receivers = null; include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php'; $details = ilECSEContentDetails::getInstance($a_server->getServerId(), $a_econtent_id, $this->getECSObjectType()); if ($details instanceof ilECSEContentDetails) { $receivers = $details->getReceivers(); } if ($receivers) { foreach ($receivers as $member) { $found = true; include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php'; $part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member); $message .= "\n\n" . $part->getParticipantName() . "\n"; $message .= $part->getDescription(); } } if ($found) { $message .= "\n\n"; } else { $message .= ' ' . $lang->txt('ecs_not_published') . "\n\n"; } } catch (ilECSConnectorException $e) { $ilLog->write(__METHOD__ . ': Cannot read approvements.'); return false; } include_once './Services/Link/classes/class.ilLink.php'; $href = ilLink::_getStaticLink($this->content_obj->getRefId(), 'crs', true); $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n"; $message .= ilMail::_getAutoGeneratedMessageString(); $mail->sendMail($a_server->getApprovalRecipientsAsString(), '', '', $lang->txt('ecs_new_approval_subject'), $message, array(), array('normal')); return true; }