<?php
namespace Claromentis\Quiz\Legacy;

$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"] = (@$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"] ?: array()) + array("_007ff1b538ceff" . "6123ca12ddd1a37" . "35a" => base64_decode("cXVpei5yZX" . "N1bHRz"), "_f2d41627f09270f0dbd21d27e0286" . "8d7" => base64_decode("cmVzZ" . "XQ="), "_fc9d7314a9" . "d9958d8fa0a" . "403ba8ff197" => base64_decode("Z2V0X2NsYX" . "Nz"), "_dadf790" . "baf241af" . "ac942824" . "c1e6e37c" . "4" => base64_decode("dHlw" . "ZQ=="), "_31a2dbb2bcf46bb8d7f1b55f3" . "dd44500" => base64_decode("cXVpei5wb2xscy1zd" . "XJ2ZXkucG9sbF90aX" . "RsZQ=="), "_2b2fdacf" . "7b152cff4" . "f3819c30f" . "d58b1a" => base64_decode("L3F1aX" . "ov"), "_d1b2dd86c373d075" . "721aba593f8089ad" => base64_decode("cXVpei5wb2xs" . "cy1zdXJ2ZXlz" . "LmFuX2Fub255" . "bW91c191c2Vy"), "_8fb5c82f3" . "e66b643f7b" . "3147b7d89c" . "b95" => base64_decode("IG5vdGlmaWNhdGlvbnMuIElEO" . "iA="), "_8b4d210" . "5c8c2e2c" . "877b39f0" . "9bde764d" . "5" => base64_decode("dXNlc" . "l9uYW" . "1l"), "_fd5a3a643834299cbdadfc3540b" . "a0bcb" => base64_decode("cmVzcG9" . "uc2U="), "_2147cc6e22b2298b71fda83bdcc896" . "5d" => base64_decode("L3BvbGxzLXN1cnZle" . "XMvcG9sbC9yZXN1bH" . "RzLw=="), "_230299a3" . "938f515dd" . "b881826b1" . "db8ea8" => base64_decode("Iy9yZXN1bHRzL2luZGl2aW" . "R1YWwv"), "_81db39c6ca7b5ffbac9f8109e3" . "58f9ec" => base64_decode("L3Jlc3Vs" . "dHM="), "_928c1bf4c88ce09e0a3" . "ac6678ba33ef7" => base64_decode("cXVpei5jb21tb24u" . "bW9kdWxlX25hbWU="), "_4d707fab93bebb00bbe69" . "e8159697c90" => base64_decode(""), "_ebff9d37a7bb57" . "7c57bee4dd9f0e5" . "fd7" => base64_decode("YXJyYX" . "lfdmFs" . "dWVz"), "_c05fc248d5ab54ad876be7ab77eb8" . "fa7" => base64_decode("L3BvbGxzLXN" . "1cnZleXMvc3" . "VydmV5Lw=="), "_31767d7ad58e706dbf47b" . "7a51a0fe6c4" => base64_decode("Y29" . "1bn" . "Q="), "_6f1661e9d" . "f1863cacfe" . "4b3af33542" . "a43" => base64_decode("RXJyb3IgZW5jb3VudGVyZWQgdHJ" . "5aW5nIHRvIHNlbmQg"), "_c927258f" . "5322288a9" . "92c77be40" . "ae0b53" => base64_decode("dXJ" . "s"), "_05e653a8ccd4bde7dd929a" . "ce42f54ffb" => base64_decode("LCBVc2" . "Vyczog"), "_a51236f5e7f" . "12cf84a77615" . "2098d24a9" => base64_decode("dG" . "V4" . "dA" . "=="), "_cfab6b96076035c6baf52262d211" . "da48" => base64_decode("UmVwb3NpdG9yeUl0ZW1BYnN0cmFjdCBwYXNzZWQgdG8g" . "U2VuZE5vdGlmaWNhdGlvbkFuZFVwZGF0ZUZsYWcgd2Fz" . "IG5vdCBhIFF1aXosIFBvbGwgb3IgU3VydmV5LCBpcyBv" . "ZiB0eXBlIA=="), "_c672423099aedaba70b728f1412a000" . "6" => base64_decode("cXVpei5zdXJ2ZXl" . "fc3VibWlzc2lvbg" . "=="), "_00d834fcefc47858ad1ef77d0bf75a" . "53" => base64_decode("c3VibWlz" . "c2lvbl9s" . "aW5r"), "_69ac716a65661" . "1c36c9e979f6dd" . "c43af" => base64_decode("cXVpei5hZGRlZA" . "=="), "_8dabb06efc95df4cff7c4afe91857b5" . "3" => base64_decode("bmFtZ" . "Q=="), "_b66252d7bbf3610" . "12a6531a8e3a7323" . "0" => base64_decode("YXJyYXlfZG" . "lmZg=="), "_6a919d1406d7d38aff9524e511" . "7b5df8" => base64_decode("b2JqX25" . "hbWU="), "_feb9037589181bc30fa0f1cf78b9" . "f056" => base64_decode("dGl" . "0bG" . "U="), "_6e66ac980979009c899e" . "5f51f81910b8" => base64_decode("cXVpei5tb2RpZmllZA" . "=="), "_58d64569d" . "ed0e1f2f5d" . "44183a5137" . "873" => base64_decode("IEVycm" . "9yOiA="), "_54cf13db4639035f60f" . "cc95d308c7905" => base64_decode("YWxsX3N1Ym1pc3Npb25" . "fbGluaw=="), "_45cfb07c" . "a02e9f642" . "e63fbdc9f" . "a81fd9" => base64_decode("cXVpei5wb2xscy1zdXJ2Z" . "Xkuc3VydmV5X3RpdGxl"), "_d91066c769070cf6d70c" . "ea9558d2b17f" => base64_decode("cXVpei5wb2xsX3N" . "1Ym1pc3Npb24="), "_ab8199b97ed2d8fa1f0" . "96f35efbbe647" => base64_decode("L3BvbGxzLXN1cnZleX" . "MvcG9sbC8="), "_b6dc715da4677cfd0" . "4438cfaa533e851" => base64_decode("cmVzcG9uc2Vf" . "Ym9keQ=="));
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["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_ebff9d37a7bb577" . "c57bee4dd9f0e5fd" . "7"]($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["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_ebff9d37a7bb577c57bee4dd9f0e5" . "fd7"]($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["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_ebff9d37a" . "7bb577c57b" . "ee4dd9f0e5" . "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["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_ebff9d37a7bb57" . "7c57bee4dd9f0e5" . "fd7"]($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["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_f2d41627f09270f0" . "dbd21d27e02868d7"]($question);
            $this->Send(
                $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_007ff1b538ceff61" . "23ca12ddd1a3735a"],
                [$GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_dadf790baf241afac942824c1e6" . "e37c4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_31a2dbb2bcf46bb" . "8d7f1b55f3dd4450" . "0"]), $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_8dabb06efc95df" . "4cff7c4afe91857" . "b53"] => $question->GetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_a51236f5e7" . "f12cf84a776" . "152098d24a9"]), $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c927258f5322288a992c7" . "7be40ae0b53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_2147cc6e22b2298b71fda83bdcc896" . "5d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)],
                
                
                $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_ebff9d37a7bb577c57bee4dd9f0" . "e5fd7"]($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["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_007ff1b538ceff6123ca12ddd1" . "a3735a"],
                [$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_dadf790baf241afac" . "942824c1e6e37c4"] => ($this->lmsg)($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_45cfb07ca02" . "e9f642e63fbd" . "c9fa81fd9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_8dabb06efc95df4cff7c4afe91" . "857b53"] => $survey->title, $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_c927258f5322288a992c77be40" . "ae0b53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_c05fc248d5ab54ad876be7ab77e" . "b8fa7"] . $survey->id . $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_81db39c6ca7b5ffbac9f8" . "109e358f9ec"])],
                
                
                $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_ebff9d37a7bb" . "577c57bee4dd9" . "f0e5fd7"]($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"]["_ebff9d37a7bb577c5" . "7bee4dd9f0e5fd7"]($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["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_4d707fab93bebb00bbe69e8159697" . "c90"];
        $error_message = $GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_4d707fab93bebb00bbe69e815" . "9697c90"];
        
        
        if (!$_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new) {
            $_00247c058b3269a449cb8586c5ceafb6 = $this->attempt_repository->GetAttemptedUserIds($_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_b057ebc3c3d1b3f5d5f3945924d33d21 = $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_b66252d7bbf361012a6531a8e3a73" . "230"]($_b057ebc3c3d1b3f5d5f3945924d33d21, $_00247c058b3269a449cb8586c5ceafb6);
        }
        if ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Poll) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_31a2dbb2bcf46bb" . "8d7f1b55f3dd4450" . "0"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_ab8199b97ed2d8fa1f096f3" . "5efbbe647"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $question = $this->poll_facade->GetQuestionForPoll($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
            if ($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_31767d7" . "ad58e706" . "dbf47b7a" . "51a0fe6c" . "4"]($question)) {
                
                
                $question = $question[0];
                $_feb9037589181bc30fa0f1cf78b9f056 = $question->text;
            }
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->poll_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Survey) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_45cfb07ca02e9f642e63fbdc9fa81fd" . "9"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c05fc248d5ab54ad876b" . "e7ab77eb8fa7"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->survey_repository;
        } elseif ($_59cdb5ce92fcf760d09d3c6ed5b03aaa instanceof Quiz) {
            $_dadf790baf241afac942824c1e6e37c4 = ($this->lmsg)($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_928c1bf4c88ce09" . "e0a3ac6678ba33ef" . "7"]);
            $_c927258f5322288a992c77be40ae0b53 = $this->http_util->CreateInternalLink($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_2b2fdacf7b152cff4f3819c30fd58b" . "1a"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id);
            $_feb9037589181bc30fa0f1cf78b9f056 = $_59cdb5ce92fcf760d09d3c6ed5b03aaa->title;
            $_8652ba33e6ffeba02459fa9cbb320851 = $this->quiz_repository;
        } else {
            
            
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_cfab6b96076035" . "c6baf52262d211d" . "a48"] . $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_fc9d7314a9d" . "9958d8fa0a40" . "3ba8ff197"]($_59cdb5ce92fcf760d09d3c6ed5b03aaa));
            return false;
        }
        
        
        $_59cdb5ce92fcf760d09d3c6ed5b03aaa->SetSentNotification(true);
        $_8652ba33e6ffeba02459fa9cbb320851->Save($_59cdb5ce92fcf760d09d3c6ed5b03aaa);
        try {
            $_d33e28100550cc691652a709f7582796 = $this->Send(
                $_59cdb5ce92fcf760d09d3c6ed5b03aaa->is_new ? $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_69ac716a65" . "6611c36c9e9" . "79f6ddc43af"] : $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_6e66ac9809" . "79009c899e5" . "f51f81910b8"],
                [$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_dadf790baf241afac942824c1e6e" . "37c4"] => $_dadf790baf241afac942824c1e6e37c4, $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_c927258f53222" . "88a992c77be40a" . "e0b53"] => $_c927258f5322288a992c77be40ae0b53, $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_feb9037589181bc30fa0f1cf7" . "8b9f056"] => $_feb9037589181bc30fa0f1cf78b9f056],
                
                
                $_b057ebc3c3d1b3f5d5f3945924d33d21
            );
        } catch (Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_d33e28100550cc691652a709f7582796 = false;
            $error_message = $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage();
        }
        if (!$_d33e28100550cc691652a709f7582796) {
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_6f1661e9df1" . "863cacfe4b3a" . "f33542a43"] . $_dadf790baf241afac942824c1e6e37c4 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_8fb5c82" . "f3e66b64" . "3f7b3147" . "b7d89cb9" . "5"] . $_59cdb5ce92fcf760d09d3c6ed5b03aaa->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_05e653a8ccd4bde7dd929ac" . "e42f54ffb"] . $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_31767d7ad58e706dbf47b7a" . "51a0fe6c4"]($_b057ebc3c3d1b3f5d5f3945924d33d21) . ($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_58d64569ded0e1f2f5d44183a513" . "7873"] . $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["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_d1b2dd86c373d075" . "721aba593f8089ad"]);
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $_b1d9743b68fd81cc4d60987cbf4b4f57 = $this->attempt_facade->GetAttemptAnswers($_7adc269a13af5c45b5a1caf4ec75a795);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_ebff9d37a7bb577c" . "57bee4dd9f0e5fd7"]($_b1d9743b68fd81cc4d60987cbf4b4f57)[0]->GetPropertyCollection()->GetValue($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_fd5a3a643834299cbdadfc3540ba0b" . "cb"]);
        $_fd5a3a643834299cbdadfc3540ba0bcb = $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_ebff9d37a7bb577c57bee4dd" . "9f0e5fd7"]($_fd5a3a643834299cbdadfc3540ba0bcb)[0];
        $data = [$GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_6a919d140" . "6d7d38aff9" . "524e5117b5" . "df8"] => $question->GetProperty($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_a51236f5e7f12cf84a7761" . "52098d24a9"]), $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_8b4d2105c8c" . "2e2c877b39f0" . "9bde764d5"] => $_8b4d2105c8c2e2c877b39f09bde764d5, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_b6dc715da" . "4677cfd044" . "38cfaa533e" . "851"] => $_fd5a3a643834299cbdadfc3540ba0bcb, $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_54cf13db4639035f60fcc95d308c" . "7905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_2147cc6e22b2298b71f" . "da83bdcc8965d"] . $_b3ee1ca1d7e4bff63ae777968483325d->id)];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_54cf13d" . "b4639035" . "f60fcc95" . "d308c790" . "5"]];
        $this->Send($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_d91066c76907" . "0cf6d70cea955" . "8d2b17f"], $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["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_6a919d1406d7d38aff9" . "524e5117b5df8"] => $survey->title, $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_00d834fcefc" . "47858ad1ef77" . "d0bf75a53"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_c05fc248d5ab54ad876be7ab" . "77eb8fa7"] . $survey->id . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_230299a3938f515ddb88" . "1826b1db8ea8"] . $_7adc269a13af5c45b5a1caf4ec75a795->id), $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_54cf13db4639035f60fcc95" . "d308c7905"] => $this->http_util->CreateInternalLink($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_c05fc248d5ab54ad876be7" . "ab77eb8fa7"] . $survey->id . $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_81db39c6ca7" . "b5ffbac9f810" . "9e358f9ec"])];
        $_aaa5c303d68b56e51664da889c8f730c = $data[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_00d834fcefc47858ad" . "1ef77d0bf75a53"]];
        $user = $this->attempt_facade->GetAttemptUser($_7adc269a13af5c45b5a1caf4ec75a795);
        $_15a5ec69c6db0ed2f1a45f893b4c8441 = !$user || $survey->anonymous;
        $_f3c6503ca6d913adb51076e07b9a7a35 = !$_15a5ec69c6db0ed2f1a45f893b4c8441 ? $user->id : 0;
        $this->Send($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_c672423099" . "aedaba70b72" . "8f1412a0006"], $data, $_cad11492b3df9538e8d4816cb7264175, Plugin::IM_TYPE_QUIZ, null, $_f3c6503ca6d913adb51076e07b9a7a35, false, $_aaa5c303d68b56e51664da889c8f730c);
    }
}