<?php
namespace Claromentis\Quiz\Legacy;

$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_54cf13db4639035f60fcc95d308" . "c7905" => base64_decode("YWxsX3N1Ym1" . "pc3Npb25fbG" . "luaw=="), "_05e653a8ccd4bde7dd92" . "9ace42f54ffb" => base64_decode("LCBVc2" . "Vyczog"), "_f2d41627f09270f0dbd2" . "1d27e02868d7" => base64_decode("cm" . "Vz" . "ZX" . "Q="), "_31767d7ad58e706dbf4" . "7b7a51a0fe6c4" => base64_decode("Y291bnQ" . "="), "_00d834fcefc47858ad1ef77d0b" . "f75a53" => base64_decode("c3VibWlzc2lvbl9saW" . "5r"), "_a51236f" . "5e7f12cf" . "84a77615" . "2098d24a" . "9" => base64_decode("dGV" . "4dA" . "=="), "_c672423099aedaba70b728f141" . "2a0006" => base64_decode("cXVpei5zdXJ2ZXlfc3VibWlzc2lvb" . "g=="), "_4d707fab93bebb00" . "bbe69e8159697c90" => base64_decode(""), "_feb90375" . "89181bc30" . "fa0f1cf78" . "b9f056" => base64_decode("dGl" . "0bG" . "U="), "_45cfb07ca02e9f642e6" . "3fbdc9fa81fd9" => base64_decode("cXVpei5wb2xscy1zdXJ2ZXk" . "uc3VydmV5X3RpdGxl"), "_fd5a3a643" . "834299cbda" . "dfc3540ba0" . "bcb" => base64_decode("cmVzcG9uc" . "2U="), "_6e66ac980" . "979009c899" . "e5f51f8191" . "0b8" => base64_decode("cXVpei" . "5tb2Rp" . "ZmllZA" . "=="), "_c927258f5322288a992c77be40ae0" . "b53" => base64_decode("dX" . "Js"), "_c05fc248d5ab54a" . "d876be7ab77eb8fa" . "7" => base64_decode("L3BvbGxzLXN1cnZleXMvc3VydmV5Lw=" . "="), "_8fb5c82f3e66b643f7b3147b7d89c" . "b95" => base64_decode("IG5vdGlmaWNhdGlvbnMuIE" . "lEOiA="), "_007ff1b538ceff6123ca12ddd1" . "a3735a" => base64_decode("cXVpei5yZX" . "N1bHRz"), "_928c1bf4c88ce09e0a3ac6" . "678ba33ef7" => base64_decode("cXVpei5jb21tb24ubW9kd" . "WxlX25hbWU="), "_fc9d7314a9d9958d8fa0a403" . "ba8ff197" => base64_decode("Z2V0X2NsY" . "XNz"), "_b66252d7bbf361012a6" . "531a8e3a73230" => base64_decode("YXJyYXlfZ" . "GlmZg=="), "_dadf790ba" . "f241afac94" . "2824c1e6e3" . "7c4" => base64_decode("dHlwZ" . "Q=="), "_ebff9d37" . "a7bb577c5" . "7bee4dd9f" . "0e5fd7" => base64_decode("YXJyYXlfdm" . "FsdWVz"), "_cfab6b96076" . "035c6baf5226" . "2d211da48" => base64_decode("UmVwb3NpdG9yeUl0ZW1BYnN0cmFjdCBwYXNzZWQgdG8gU2VuZE5vdGlmaWN" . "hdGlvbkFuZFVwZGF0ZUZsYWcgd2FzIG5vdCBhIFF1aXosIFBvbGwgb3IgU3" . "VydmV5LCBpcyBvZiB0eXBlIA=="), "_d1b2dd86c373d0757" . "21aba593f8089ad" => base64_decode("cXVpei5wb2xscy1zdXJ2ZXlzLmFuX2Fub25" . "5bW91c191c2Vy"), "_6a919d1406d7d3" . "8aff9524e5117b5" . "df8" => base64_decode("b2JqX25" . "hbWU="), "_69ac716a656611c3" . "6c9e979f6ddc43af" => base64_decode("cXVpei5h" . "ZGRlZA=="), "_b6dc715da4677cfd04" . "438cfaa533e851" => base64_decode("cmVzcG9u" . "c2VfYm9k" . "eQ=="), "_31a2dbb2bcf46bb8d7f1b55f3dd445" . "00" => base64_decode("cXVpei5wb2xscy1zdXJ2ZXkucG9sbF90aXRsZ" . "Q=="), "_2b2fdacf7b15" . "2cff4f3819c30" . "fd58b1a" => base64_decode("L3F1a" . "Xov"), "_8b4d2105c8c" . "2e2c877b39f0" . "9bde764d5" => base64_decode("dXNlcl9u" . "YW1l"), "_2147cc6e22b2298b71fda83bdcc89" . "65d" => base64_decode("L3BvbGxzLXN1cnZleX" . "MvcG9sbC9yZXN1bHRz" . "Lw=="), "_58d64569ded0e1f2f5d44183a5" . "137873" => base64_decode("IEVycm9yOi" . "A="), "_81db39c6ca7b5ffb" . "ac9f8109e358f9ec" => base64_decode("L3J" . "lc3" . "Vsd" . "HM="), "_ab8199b97ed2d8fa1f096f35efbbe6" . "47" => base64_decode("L3BvbGxzLXN1cnZleXMv" . "cG9sbC8="), "_d91066c76" . "9070cf6d70" . "cea9558d2b" . "17f" => base64_decode("cXVpei5wb2xsX3N1Ym1pc3" . "Npb24="), "_8dabb06efc95d" . "f4cff7c4afe918" . "57b53" => base64_decode("bmFtZQ" . "=="), "_6f1661e9df1863cacfe" . "4b3af33542a43" => base64_decode("RXJyb3IgZW5jb3VudGVyZWQgdHJ5aW5nIHRvI" . "HNlbmQg"), "_230299a3938f51" . "5ddb881826b1db8" . "ea8" => base64_decode("Iy9yZXN1bHRzL2luZGl2a" . "WR1YWwv"));
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["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_ebff9d37a7bb577c57bee" . "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["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ebff9d37a7bb577c57bee4d" . "d9f0e5fd7"]($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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_ebff9d37a7bb57" . "7c57bee4dd9f0e5" . "fd7"]($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["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_ebff9d37a7bb577c57b" . "ee4dd9f0e5fd7"]($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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_f2d41627f09270f0dbd21d27e02868d" . "7"]($question);
            $this->Send(
                $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_007ff1b538ceff6123ca12ddd" . "1a3735a"],
                [$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_dadf790" . "baf241af" . "ac942824" . "c1e6e37c" . "4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_31a2dbb2bcf46bb8d7f1b55" . "f3dd44500"]), $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_8dabb06efc95df4cff7c4afe91857b" . "53"] => $question->GetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_a51236f5e7" . "f12cf84a776" . "152098d24a9"]), $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_c927258f5322288a992" . "c77be40ae0b53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_2147cc6e22b22" . "98b71fda83bdcc" . "8965d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)],
                
                
                $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_ebff9d37a7bb577c57bee4" . "dd9f0e5fd7"]($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["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_007ff1b538ceff6" . "123ca12ddd1a3735" . "a"],
                [$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_dadf790ba" . "f241afac94" . "2824c1e6e3" . "7c4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_45cfb07ca02e9" . "f642e63fbdc9fa" . "81fd9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_8dabb06efc95df4cff7c4" . "afe91857b53"] => $survey->title, $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_c927258f5322288a9" . "92c77be40ae0b53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c05fc248d5ab" . "54ad876be7ab7" . "7eb8fa7"] . $survey->id . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_81db39c6ca7b5f" . "fbac9f8109e358f" . "9ec"])],
                
                
                $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_ebff9d37a7bb577c57bee4d" . "d9f0e5fd7"]($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["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_ebff9d37a7bb577c57bee4" . "dd9f0e5fd7"]($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["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_4d707fab93bebb00bbe69e" . "8159697c90"];
        $error_message = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_4d707fab93bebb00bbe69e81596" . "97c90"];
        
        
        if (!$_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new) {
            $_00247c058b3269a449cb8586c5ceafb6 = $this->attempt_repository->GetAttemptedUserIds($_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_b66252d7bbf361012a6531a8e3a7" . "3230"]($_b057ebc3c3d1b3f5d5f3945924d33d21, $_00247c058b3269a449cb8586c5ceafb6);
        }
        if ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Poll) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_31a2dbb2bcf46bb8d7f1b55f3dd44" . "500"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_ab8199b97ed2d8fa1f096" . "f35efbbe647"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $question = $this->poll_facade->GetQuestionForPoll($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
            if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_31767d7ad58e" . "706dbf47b7a51" . "a0fe6c4"]($question)) {
                
                
                $question = $question[0];
                $_feb9037589181bc30fa0f1cf78b9f056 = $question->text;
            }
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->poll_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Survey) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_45cfb07ca02e9f642e" . "63fbdc9fa81fd9"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_c05fc248d5ab54ad" . "876be7ab77eb8fa7"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->survey_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Quiz) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_928c1bf4c" . "88ce09e0a3" . "ac6678ba33" . "ef7"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_2b2fdacf7b152cff4f38" . "19c30fd58b1a"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->quiz_repository;
        } else {
            
            
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_cfab6b96076035c6baf522" . "62d211da48"] . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_fc9d7314a9d9958d8fa0" . "a403ba8ff197"]($_59cdb5ce92fcf760d09d3c6ed5b03aaa));
            return false;
        }
        
        
        $_59cdb5ce92fcf760d09d3c6ed5b03aaa->SetSentNotification(true);
        $_8652ba33e6ffeba02459fa9cbb320851->Save($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
        try {
            $_d33e28100550cc691652a709f7582796 = $this->Send(
                $_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new ? $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_69ac716a6" . "56611c36c9" . "e979f6ddc4" . "3af"] : $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_6e66ac980979009c899e5f51f8" . "1910b8"],
                [$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_dadf790baf2" . "41afac942824" . "c1e6e37c4"] => $_dadf790baf241afac942824c1e6e37c4, $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_c927258f" . "5322288a9" . "92c77be40" . "ae0b53"] => $_c927258f5322288a992c77be40ae0b53, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_feb9037589181bc30fa0f1cf78b9f0" . "56"] => $_feb9037589181bc30fa0f1cf78b9f056],
                
                
                $_b057ebc3c3d1b3f5d5f3945924d33d21
            );
        } catch (Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_d33e28100550cc691652a709f7582796 = false;
            $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
        }
        if (!$_d33e28100550cc691652a709f7582796) {
            $this->logger->error($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_6f1661e9" . "df1863cac" . "fe4b3af33" . "542a43"] . $_dadf790baf241afac942824c1e6e37c4 . $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_8fb5c82f" . "3e66b643f" . "7b3147b7d" . "89cb95"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_05e653a8ccd4bde" . "7dd929ace42f54ff" . "b"] . $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_31767d7" . "ad58e706" . "dbf47b7a" . "51a0fe6c" . "4"]($_b057ebc3c3d1b3f5d5f3945924d33d21) . ($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_58d64569ded0e1f2f5d44183a513787" . "3"] . $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["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_d1b2dd86c373d0" . "75721aba593f808" . "9ad"]);
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $_b1d9743b68fd81cc4d60987cbf4b4f57 = $this->attempt_facade->GetAttemptAnswers($_7adc269a13af5c45b5a1caf4ec75a795);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_ebff9d37a7bb577c57bee4d" . "d9f0e5fd7"]($_b1d9743b68fd81cc4d60987cbf4b4f57)[0]->GetPropertyCollection()->GetValue($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_fd5a3a643834299cbdadfc3540ba0b" . "cb"]);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_ebff9d37a7bb577" . "c57bee4dd9f0e5fd" . "7"]($_fd5a3a643834299cbdadfc3540ba0bcb)[0];
        $data = [$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_6a919d1406d7d38aff9524e5117b5d" . "f8"] => $question->GetProperty($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_a51236f5e7f12cf84a7761" . "52098d24a9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_8b4d2105c8c2e" . "2c877b39f09bde" . "764d5"] => $_8b4d2105c8c2e2c877b39f09bde764d5, $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_b6dc715da4677cfd04438cfaa5" . "33e851"] => $_fd5a3a643834299cbdadfc3540ba0bcb, $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_54cf13db463903" . "5f60fcc95d308c7" . "905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_2147cc6e22b2298b71" . "fda83bdcc8965d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_54cf13db4639035f" . "60fcc95d308c7905"]];
        $this->Send($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_d91066c769070cf" . "6d70cea9558d2b17" . "f"], $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["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_6a919d1406d7d38aff9524e511" . "7b5df8"] => $survey->title, $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_00d834fcefc47858ad1ef77d0b" . "f75a53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_c05fc248d5ab54ad876be7ab77eb8fa" . "7"] . $survey->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_230299a3938f515dd" . "b881826b1db8ea8"] . $_7adc269a13af5c45b5a1caf4ec75a795->id), $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_54cf13db4" . "639035f60f" . "cc95d308c7" . "905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_c05fc248d5ab54ad876be7ab77eb8f" . "a7"] . $survey->id . $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_81db39c6ca7b" . "5ffbac9f8109e" . "358f9ec"])];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_00d834f" . "cefc4785" . "8ad1ef77" . "d0bf75a5" . "3"]];
        $user = $this->attempt_facade->GetAttemptUser($_7adc269a13af5c45b5a1caf4ec75a795);
        $_15a5ec69c6db0ed2f1a45f893b4c8441 = !$user || $survey->anonymous;
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $this->Send($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c672423099aedaba70b" . "728f1412a0006"], $data, $_cad11492b3df9538e8d4816cb7264175, Plugin::IM_TYPE_QUIZ, null, $_f3c6503ca6d913adb51076e07b9a7a35, false, $_aaa5c303d68b56e51664da889c8f730c);
    }
}