<?php
namespace Claromentis\Quiz\Legacy;

$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"] = (@$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] ?: array()) + array("_31767d7ad58e706db" . "f47b7a51a0fe6c4" => base64_decode("Y2" . "91" . "bn" . "Q="), "_cfab6b960" . "76035c6baf" . "52262d211d" . "a48" => base64_decode("UmVwb3NpdG9yeUl0ZW1BYnN0cmFjdCBwYXNzZWQgdG8gU2VuZE5vdGlmaWNhdGlvbkFuZFVwZGF0ZUZsYWcgd2FzIG5vdCBhIFF1aXosIFBvbGwgb3IgU3VydmV5LCBp" . "cyBvZiB0eXBlIA=="), "_c672423" . "099aedab" . "a70b728f" . "1412a000" . "6" => base64_decode("cXVpei5zdXJ2ZXlfc3VibW" . "lzc2lvbg=="), "_d91066c769" . "070cf6d70ce" . "a9558d2b17f" => base64_decode("cXVpei5wb2" . "xsX3N1Ym1p" . "c3Npb24="), "_230299a3938f515ddb8818" . "26b1db8ea8" => base64_decode("Iy9yZXN1bHRzL2" . "luZGl2aWR1YWwv"), "_007ff1b538ceff612" . "3ca12ddd1a3735a" => base64_decode("cXVpei5yZXN1b" . "HRz"), "_05e653a8ccd4bde7dd929" . "ace42f54ffb" => base64_decode("LCBV" . "c2Vy" . "czog"), "_ab8199b97ed2d8fa1f096f35efbbe64" . "7" => base64_decode("L3BvbGxzLXN1cnZleXMv" . "cG9sbC8="), "_69ac716a656611c" . "36c9e979f6ddc43a" . "f" => base64_decode("cXVpei5hZGRl" . "ZA=="), "_2147cc6e22b2298b71" . "fda83bdcc8965d" => base64_decode("L3BvbGxzLXN1c" . "nZleXMvcG9sbC" . "9yZXN1bHRzLw=" . "="), "_fc9d7314a9d9958d8fa0a403ba" . "8ff197" => base64_decode("Z2V0" . "X2Ns" . "YXNz"), "_54cf13db4639035f60fc" . "c95d308c7905" => base64_decode("YWxsX3N1Ym1pc3Npb25fbGlu" . "aw=="), "_c05fc248d5ab54ad876be7ab77eb" . "8fa7" => base64_decode("L3BvbGxzLXN1cnZleXMvc3Vy" . "dmV5Lw=="), "_f2d41627f09270f0dbd21d27e028" . "68d7" => base64_decode("cmVzZ" . "XQ="), "_b6dc715da4677" . "cfd04438cfaa53" . "3e851" => base64_decode("cmVzcG9uc2VfYm9ke" . "Q=="), "_c927258f5322288a992c77b" . "e40ae0b53" => base64_decode("dX" . "Js"), "_a51236f" . "5e7f12cf" . "84a77615" . "2098d24a" . "9" => base64_decode("dGV4d" . "A=="), "_58d64569ded0" . "e1f2f5d44183a" . "5137873" => base64_decode("IEVycm9" . "yOiA="), "_8dabb06efc95df4cff" . "7c4afe91857b53" => base64_decode("bmFt" . "ZQ=="), "_fd5a3a64383429" . "9cbdadfc3540ba0" . "bcb" => base64_decode("cmVzcG9uc" . "2U="), "_ebff9d37a7bb577c57bee4" . "dd9f0e5fd7" => base64_decode("YXJyYXlfd" . "mFsdWVz"), "_2b2fdacf7b152cff4" . "f3819c30fd58b1a" => base64_decode("L3F1a" . "Xov"), "_6e66ac980979009c899e5f51f8" . "1910b8" => base64_decode("cXVpei5tb2RpZmll" . "ZA=="), "_8fb5c82f3e66b643f7b31" . "47b7d89cb95" => base64_decode("IG5vdGlmaWNhdGlvbnMuIElEOiA" . "="), "_feb9037589181bc30fa0f1cf78" . "b9f056" => base64_decode("dGl0" . "bGU="), "_45cfb07ca02e9f642e" . "63fbdc9fa81fd9" => base64_decode("cXVpei5wb2xscy1zdXJ2" . "ZXkuc3VydmV5X3RpdGxl"), "_6f1661e9df1863cacfe4b3af335" . "42a43" => base64_decode("RXJyb3IgZW5jb3VudGVyZWQgdHJ5aW5nIHRvIH" . "NlbmQg"), "_b66252d7bbf361012a6531a8e3a7323" . "0" => base64_decode("YXJyYXlfZGl" . "mZg=="), "_00d834fcefc478" . "58ad1ef77d0bf75" . "a53" => base64_decode("c3Vib" . "Wlzc2" . "lvbl9" . "saW5r"), "_dadf790baf241afac942824" . "c1e6e37c4" => base64_decode("dHlw" . "ZQ=="), "_928c1bf4c88ce09e0a3ac6678ba33e" . "f7" => base64_decode("cXVpei5jb21tb24ubW9kd" . "WxlX25hbWU="), "_31a2dbb2bcf" . "46bb8d7f1b55" . "f3dd44500" => base64_decode("cXVpei5wb2xscy1zdXJ2ZXku" . "cG9sbF90aXRsZQ=="), "_6a919d1406d7" . "d38aff9524e51" . "17b5df8" => base64_decode("b2JqX25hbW" . "U="), "_4d707fab93bebb" . "00bbe69e8159697" . "c90" => base64_decode(""), "_81db39c6ca7" . "b5ffbac9f810" . "9e358f9ec" => base64_decode("L3Jlc3Vs" . "dHM="), "_8b4d2105c8c2e2c877b39f09b" . "de764d5" => base64_decode("dXN" . "lcl" . "9uY" . "W1l"), "_d1b2dd86c373d075721aba593f" . "8089ad" => base64_decode("cXVpei5wb2xscy1zdXJ2" . "ZXlzLmFuX2Fub255bW91" . "c191c2Vy"));
use ClaAggregation;
use Claromentis\Core\Http\HttpUtil;
use Claromentis\Core\Localization\Lmsg;
use Claromentis\Core\Repository\RepositoryItemAbstract;
use Claromentis\Quiz\Facade\AttemptFacade;
use Claromentis\Quiz\Facade\PollFacade;
use Claromentis\Quiz\Model\Attempt;
use Claromentis\Quiz\Model\Quiz;
use Claromentis\Quiz\Model\Survey;
use Claromentis\Quiz\Model\Poll;
use Claromentis\Quiz\Permissions\PollPermissions;
use Claromentis\Quiz\Permissions\QuizPermissions;
use Claromentis\Quiz\Permissions\SurveyPermissions;
use Claromentis\Core\Acl\AclRepository;
use Claromentis\Quiz\Plugin;
use Claromentis\Quiz\Repository\AttemptRepository;
use Claromentis\Quiz\Repository\PollRepository;
use Claromentis\Quiz\Repository\QuizRepository;
use Claromentis\Quiz\Repository\SurveyRepository;
use Exception;
use IMessage;
use Psr\Log\LoggerInterface;
class NotificationSender
{
    
    
    
    
    protected $attempt_facade;
    
    
    
    
    protected $poll_permissions;
    
    
    
    
    protected $survey_permissions;
    
    
    
    
    private $acl;
    
    
    
    
    private $survey_repository;
    
    
    
    
    private $poll_repository;
    
    
    
    
    private $poll_facade;
    
    
    
    
    private $attempt_repository;
    
    
    
    
    private $http_util;
    
    
    
    
    private $lmsg;
    
    
    
    
    private $logger;
    
    
    
    
    private QuizRepository $quiz_repository;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function __construct(AclRepository $acl, SurveyRepository $_d788c955b64166f591e5ce0a44478441, PollRepository $poll_repository, PollFacade $poll_facade, AttemptRepository $_9fefbd062970af83dc4cc0837cee7d3d, HttpUtil $_019f644d80568a97cf247afb364302a5, Lmsg $lmsg, LoggerInterface $_e9abd43fa12cace21feb1774e5f75144, AttemptFacade $attempt_facade, PollPermissions $poll_permissions, SurveyPermissions $survey_permissions, QuizRepository $_bd1f015f5330aa0ada93292e3c30af2f)
    {
        $this->acl = $acl;
        $this->survey_repository = $_d788c955b64166f591e5ce0a44478441;
        $this->attempt_repository = $_9fefbd062970af83dc4cc0837cee7d3d;
        $this->poll_repository = $poll_repository;
        $this->poll_facade = $poll_facade;
        $this->http_util = $_019f644d80568a97cf247afb364302a5;
        $this->lmsg = $lmsg;
        $this->logger = $_e9abd43fa12cace21feb1774e5f75144;
        $this->attempt_facade = $attempt_facade;
        $this->poll_permissions = $poll_permissions;
        $this->survey_permissions = $survey_permissions;
        $this->quiz_repository = $_bd1f015f5330aa0ada93292e3c30af2f;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function Send($_2309c8b802668c9b68f43c54df11b2e1, $_75df4d581011f8631adf17a266cf8665, $_d2395bcf4fa80dd2aca9e4f8d900a51b, $_346b4689ff43b16d217843029edeec78 = Plugin::IM_TYPE_QUIZ, $_b15aac3aa29c10ea6d1228f58cb9a7e8 = null, $_f3c6503ca6d913adb51076e07b9a7a35 = null, $_1b6a787fc42b2015321a1dcf5c460fc2 = false, $_aaa5c303d68b56e51664da889c8f730c = null) : bool
    {
        return \NotificationMessage::Send($_2309c8b802668c9b68f43c54df11b2e1, $_75df4d581011f8631adf17a266cf8665, $_d2395bcf4fa80dd2aca9e4f8d900a51b, $_346b4689ff43b16d217843029edeec78, $_b15aac3aa29c10ea6d1228f58cb9a7e8, $_f3c6503ca6d913adb51076e07b9a7a35, $_1b6a787fc42b2015321a1dcf5c460fc2, $_aaa5c303d68b56e51664da889c8f730c);
    }
    
    
    
    
    public function SendNotificationPoll(Poll $_b3ee1ca1d7e4bff63ae777968483325d)
    {
        if ($_b3ee1ca1d7e4bff63ae777968483325d->getNotification() && $_b3ee1ca1d7e4bff63ae777968483325d->IsLive() && (int) $_b3ee1ca1d7e4bff63ae777968483325d->start_date === 0 && !$_b3ee1ca1d7e4bff63ae777968483325d->NotificationSent()) {
            
            
            $acl = $this->acl->Get(PollPermissions::CLASS_POLL, $_b3ee1ca1d7e4bff63ae777968483325d->id);
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_ebff9d37a7" . "bb577c57bee" . "4dd9f0e5fd7"]($acl->GetIndividualsList(PollPermissions::PERM_ANSWER));
            $this->SendNotificationAndUpdateFlag($_b3ee1ca1d7e4bff63ae777968483325d, $_b057ebc3c3d1b3f5d5f3945924d33d21);
        }
    }
    
    
    
    
    
    
    public function SendNotificationOncePollPublished(Poll $_b3ee1ca1d7e4bff63ae777968483325d) : void
    {
        if ($_b3ee1ca1d7e4bff63ae777968483325d->getNotification() && $_b3ee1ca1d7e4bff63ae777968483325d->IsLive() && !$_b3ee1ca1d7e4bff63ae777968483325d->IsFuture() && !$_b3ee1ca1d7e4bff63ae777968483325d->NotificationSent()) {
            
            
            $acl = $this->acl->Get(PollPermissions::CLASS_POLL, $_b3ee1ca1d7e4bff63ae777968483325d->id);
            
            
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_ebff9d37a7bb577c" . "57bee4dd9f0e5fd7"]($acl->GetIndividualsList(PollPermissions::PERM_ANSWER));
            $this->SendNotificationAndUpdateFlag($_b3ee1ca1d7e4bff63ae777968483325d, $_b057ebc3c3d1b3f5d5f3945924d33d21);
        }
    }
    
    
    
    
    public function SendNotificationSurvey(Survey $survey) : void
    {
        if ($survey->GetNotification() && $survey->IsLive() && (int) $survey->start_date === 0 && !$survey->NotificationSent()) {
            
            
            $acl = $this->acl->Get(SurveyPermissions::CLASS_SURVEY, $survey->id);
            
            
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_ebff9d37a7bb577" . "c57bee4dd9f0e5fd" . "7"]($acl->GetIndividualsList(SurveyPermissions::PERM_TAKE));
            $this->SendNotificationAndUpdateFlag($survey, $_b057ebc3c3d1b3f5d5f3945924d33d21);
        }
    }
    
    
    
    
    
    public function SendNotificationOnceSurveyPublished(Survey $survey) : void
    {
        if ($survey->GetNotification() && $survey->IsLive() && !$survey->IsFuture() && !$survey->NotificationSent()) {
            
            
            $acl = $this->acl->Get(SurveyPermissions::CLASS_SURVEY, $survey->id);
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_ebff9d37a7bb577c57bee4dd9" . "f0e5fd7"]($acl->GetIndividualsList(SurveyPermissions::PERM_TAKE));
            $this->SendNotificationAndUpdateFlag($survey, $_b057ebc3c3d1b3f5d5f3945924d33d21);
        }
    }
    public function SendNotificationOncePollEnds(Poll $_b3ee1ca1d7e4bff63ae777968483325d) : void
    {
        if ($_b3ee1ca1d7e4bff63ae777968483325d->hasEnded() && !$_b3ee1ca1d7e4bff63ae777968483325d->end_notification_sent) {
            $question = $this->poll_facade->GetQuestionForPoll($_b3ee1ca1d7e4bff63ae777968483325d);
            $question = $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_f2d4162" . "7f09270f" . "0dbd21d2" . "7e02868d" . "7"]($question);
            $this->Send(
                $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_007ff1b538ceff6123ca1" . "2ddd1a3735a"],
                [$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_dadf790baf241afac942824c1e6e3" . "7c4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_31a2dbb2bcf46" . "bb8d7f1b55f3dd" . "44500"]), $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_8dabb06efc95d" . "f4cff7c4afe918" . "57b53"] => $question->GetProperty($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_a51236f5e7f12cf8" . "4a776152098d24a9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_c927258f5322288a99" . "2c77be40ae0b53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_2147cc6e22" . "b2298b71fda" . "83bdcc8965d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)],
                
                
                $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_ebff9d37a7bb577c57bee4dd9f0e5" . "fd7"]($this->attempt_repository->GetAttemptedUserIds($_b3ee1ca1d7e4bff63ae777968483325d->id))
            );
            $_b3ee1ca1d7e4bff63ae777968483325d->SetSentEndNotification(true);
            $this->poll_repository->Save($_b3ee1ca1d7e4bff63ae777968483325d);
        }
    }
    
    
    
    
    
    
    
    public function SendNotificationForEndedSurvey(Survey $survey) : void
    {
        if ($survey->hasEnded() && !$survey->end_notification_sent) {
            $this->Send(
                $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_007ff1b538ceff6123ca12ddd1a37" . "35a"],
                [$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_dadf790baf241afa" . "c942824c1e6e37c4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_45cfb07ca02e9f6" . "42e63fbdc9fa81fd" . "9"]), $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_8dabb06efc9" . "5df4cff7c4af" . "e91857b53"] => $survey->title, $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_c927258" . "f5322288" . "a992c77b" . "e40ae0b5" . "3"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_c05fc248d5ab54ad876be7ab77eb8f" . "a7"] . $survey->id . $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_81db39c6ca7b5ffbac9f810" . "9e358f9ec"])],
                
                
                $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_ebff9d37a7bb577c" . "57bee4dd9f0e5fd7"]($this->attempt_repository->GetAttemptedUserIds($survey->id))
            );
            $survey->SetSentEndNotification(true);
            $this->survey_repository->Save($survey);
        }
    }
    
    
    
    
    public function SendNotificationForQuiz(Quiz $quiz) : void
    {
        if ($quiz->IsLive() && !$quiz->NotificationSent()) {
            
            
            $acl = $this->acl->Get(QuizPermissions::CLASS_QUIZ, $quiz->id);
            
            
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_ebff9d37a7bb577c57bee4dd9f0e5f" . "d7"]($acl->GetIndividualsList(QuizPermissions::PERM_ATTEMPT));
            $this->SendNotificationAndUpdateFlag($quiz, $_b057ebc3c3d1b3f5d5f3945924d33d21);
        }
    }
    public function SendNotificationsForAllPublishedQuizzes()
    {
        
        
        foreach ($this->quiz_repository->ListQuizzesWhichNeedNotifications() as $quiz) {
            $this->SendNotificationForQuiz($quiz);
        }
    }
    
    
    
    
    
    
    public function SendNotificationsForAllPublishedSurveys()
    {
        
        
        foreach ($this->survey_repository->ListSurveysWhichNeedNotifications() as $survey) {
            $this->SendNotificationOnceSurveyPublished($survey);
        }
    }
    
    
    
    
    public function SendNotificationsForAllEndedSurveys()
    {
        foreach ($this->survey_repository->ListSurveysThatNeedEndNotification() as $survey) {
            $this->SendNotificationForEndedSurvey($survey);
        }
    }
    
    
    
    
    
    
    public function SendNotificationsForAllPublishedPolls()
    {
        foreach ($this->poll_repository->ListScheduledPolls() as $_b3ee1ca1d7e4bff63ae777968483325d) {
            $this->SendNotificationOncePollPublished($_b3ee1ca1d7e4bff63ae777968483325d);
        }
    }
    
    
    
    
    public function SendNotificationsForAllEndedPolls()
    {
        foreach ($this->poll_repository->ListPollsThatNeedEndNotification() as $_b3ee1ca1d7e4bff63ae777968483325d) {
            $this->SendNotificationOncePollEnds($_b3ee1ca1d7e4bff63ae777968483325d);
        }
    }
    
    
    
    
    
    public function SendNotificationsForCreatedPolls() : void
    {
        foreach ($this->poll_repository->ListPollsWithoutStartDate() as $_b3ee1ca1d7e4bff63ae777968483325d) {
            $this->SendNotificationPoll($_b3ee1ca1d7e4bff63ae777968483325d);
        }
    }
    
    
    
    
    
    
    public function SendNotificationsForCreatedSurveys() : void
    {
        foreach ($this->survey_repository->ListSurveysWithoutStartDate() as $survey) {
            $this->SendNotificationSurvey($survey);
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    private function SendNotificationAndUpdateFlag(RepositoryItemAbstract $_59cdb5ce92fcf760d09d3c6ed5b03aaa, array $_b057ebc3c3d1b3f5d5f3945924d33d21) : bool
    {
        $_feb9037589181bc30fa0f1cf78b9f056 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_4d707fab93bebb0" . "0bbe69e8159697c9" . "0"];
        $error_message = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_4d707fab93bebb00bbe69e8159697c" . "90"];
        
        
        if (!$_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new) {
            $_00247c058b3269a449cb8586c5ceafb6 = $this->attempt_repository->GetAttemptedUserIds($_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_b66252d" . "7bbf3610" . "12a6531a" . "8e3a7323" . "0"]($_b057ebc3c3d1b3f5d5f3945924d33d21, $_00247c058b3269a449cb8586c5ceafb6);
        }
        if ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Poll) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_31a2dbb2bc" . "f46bb8d7f1b" . "55f3dd44500"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_ab8199b97ed2" . "d8fa1f096f35e" . "fbbe647"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $question = $this->poll_facade->GetQuestionForPoll($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
            if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_31767d7ad58e706" . "dbf47b7a51a0fe6c" . "4"]($question)) {
                
                
                $question = $question[0];
                $_feb9037589181bc30fa0f1cf78b9f056 = $question->text;
            }
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->poll_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Survey) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_45cfb07ca02e9f642e63fbdc9fa81fd" . "9"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_c05fc248d5ab54ad876be7a" . "b77eb8fa7"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->survey_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Quiz) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_928c1bf4c88ce09e0a3" . "ac6678ba33ef7"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_2b2fdacf7b1" . "52cff4f3819c" . "30fd58b1a"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->quiz_repository;
        } else {
            
            
            $this->logger->error($GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_cfab6b960760" . "35c6baf52262d" . "211da48"] . $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_fc9d7314a9d9958d8f" . "a0a403ba8ff197"]($_59cdb5ce92fcf760d09d3c6ed5b03aaa));
            return false;
        }
        
        
        $_59cdb5ce92fcf760d09d3c6ed5b03aaa->SetSentNotification(true);
        $_8652ba33e6ffeba02459fa9cbb320851->Save($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
        try {
            $_d33e28100550cc691652a709f7582796 = $this->Send(
                $_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new ? $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_69ac716a656611c36c9e" . "979f6ddc43af"] : $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6e66ac980979009c899e5f51f81910b" . "8"],
                [$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_dadf790baf241afac942824" . "c1e6e37c4"] => $_dadf790baf241afac942824c1e6e37c4, $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_c927258f" . "5322288a9" . "92c77be40" . "ae0b53"] => $_c927258f5322288a992c77be40ae0b53, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_feb9037589181bc30fa" . "0f1cf78b9f056"] => $_feb9037589181bc30fa0f1cf78b9f056],
                
                
                $_b057ebc3c3d1b3f5d5f3945924d33d21
            );
        } catch (Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_d33e28100550cc691652a709f7582796 = false;
            $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
        }
        if (!$_d33e28100550cc691652a709f7582796) {
            $this->logger->error($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_6f1661e9df1" . "863cacfe4b3a" . "f33542a43"] . $_dadf790baf241afac942824c1e6e37c4 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_8fb5c82f3e66b643f7b314" . "7b7d89cb95"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_05e653a" . "8ccd4bde" . "7dd929ac" . "e42f54ff" . "b"] . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_31767d7ad58e70" . "6dbf47b7a51a0fe" . "6c4"]($_b057ebc3c3d1b3f5d5f3945924d33d21) . ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_58d64569de" . "d0e1f2f5d44" . "183a5137873"] . $error_message));
        }
        return $_d33e28100550cc691652a709f7582796;
    }
    public function SendPollCompletedNotification(Poll $_b3ee1ca1d7e4bff63ae777968483325d, Attempt $_7adc269a13af5c45b5a1caf4ec75a795)
    {
        $question = $_b3ee1ca1d7e4bff63ae777968483325d->getQuestions()[0];
        $_cad11492b3df9538e8d4816cb7264175 = $this->poll_permissions->GetUsersWhoCan(PollPermissions::PERM_MANAGE, $_b3ee1ca1d7e4bff63ae777968483325d->id);
        $user = $this->attempt_facade->GetAttemptUser($_7adc269a13af5c45b5a1caf4ec75a795);
        $_15a5ec69c6db0ed2f1a45f893b4c8441 = !$user || $_b3ee1ca1d7e4bff63ae777968483325d->anonymous;
        $_8b4d2105c8c2e2c877b39f09bde764d5 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->fullname : ($this->lmsg)($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_d1b2dd86c373d075721aba593f8089" . "ad"]);
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $_b1d9743b68fd81cc4d60987cbf4b4f57 = $this->attempt_facade->GetAttemptAnswers($_7adc269a13af5c45b5a1caf4ec75a795);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_ebff9d37a7bb577c57b" . "ee4dd9f0e5fd7"]($_b1d9743b68fd81cc4d60987cbf4b4f57)[0]->GetPropertyCollection()->GetValue($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_fd5a3a64" . "3834299cb" . "dadfc3540" . "ba0bcb"]);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_ebff9d37a7b" . "b577c57bee4d" . "d9f0e5fd7"]($_fd5a3a643834299cbdadfc3540ba0bcb)[0];
        $data = [$GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_6a919d1406d7d38aff9524e5117b" . "5df8"] => $question->GetProperty($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_a51236f5e7f12cf84a" . "776152098d24a9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_8b4d2105c8c2e2c" . "877b39f09bde764d" . "5"] => $_8b4d2105c8c2e2c877b39f09bde764d5, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_b6dc715da4" . "677cfd04438" . "cfaa533e851"] => $_fd5a3a643834299cbdadfc3540ba0bcb, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_54cf13db4639035f" . "60fcc95d308c7905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_2147cc6e22b2298b71fda83bdc" . "c8965d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_54cf13db46" . "39035f60fcc" . "95d308c7905"]];
        $this->Send($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_d91066c769070cf6d70cea9" . "558d2b17f"], $data, $_cad11492b3df9538e8d4816cb7264175, Plugin::IM_TYPE_QUIZ, null, $_f3c6503ca6d913adb51076e07b9a7a35, false, $_aaa5c303d68b56e51664da889c8f730c);
    }
    public function SendSurveyCompletedNotification(Survey $survey, Attempt $_7adc269a13af5c45b5a1caf4ec75a795)
    {
        $_cad11492b3df9538e8d4816cb7264175 = $this->survey_permissions->GetUsersWhoCan(PollPermissions::PERM_MANAGE, $survey->id);
        $data = [$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6a919d1406d7d38aff95" . "24e5117b5df8"] => $survey->title, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_00d834fcefc47858ad1ef77d0bf75a" . "53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_c05fc248d5ab54ad876be7ab77eb8fa" . "7"] . $survey->id . $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_230299a3938f515ddb881826b1" . "db8ea8"] . $_7adc269a13af5c45b5a1caf4ec75a795->id), $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_54cf13db" . "4639035f6" . "0fcc95d30" . "8c7905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_c05fc248d5" . "ab54ad876be" . "7ab77eb8fa7"] . $survey->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_81db39c6ca7b5ffbac9f8109e358f9" . "ec"])];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_00d834fcefc4" . "7858ad1ef77d0" . "bf75a53"]];
        $user = $this->attempt_facade->GetAttemptUser($_7adc269a13af5c45b5a1caf4ec75a795);
        $_15a5ec69c6db0ed2f1a45f893b4c8441 = !$user || $survey->anonymous;
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $this->Send($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_c672423099aedaba70b728f141" . "2a0006"], $data, $_cad11492b3df9538e8d4816cb7264175, Plugin::IM_TYPE_QUIZ, null, $_f3c6503ca6d913adb51076e07b9a7a35, false, $_aaa5c303d68b56e51664da889c8f730c);
    }
}