<?php
namespace Claromentis\Quiz\Controller\Rest\V1;

$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"] ?: array()) + array("_ada909094c" . "3f2b48f2ba6" . "6bec3334aab" => base64_decode("cXVpei5mYWNhZGUu" . "cXVpeg=="), "_0c5123aa744f69bbc0e8b3ea2f6e84" . "7d" => base64_decode("bG1" . "zZw" . "=="), "_556c6740a7c938ba7b49ba50f10c" . "f12d" => base64_decode("cXVpei5lcnJvci5ub19wcmV2aWV" . "3X3Blcm1z"), "_378a2afc2803a91e" . "1b7526bbba785672" => base64_decode("cXVpei5lcnJvci5ub3RfZm91bm" . "Q="), "_a6cb83fd" . "acd366dfe" . "0da33afe9" . "34397a" => base64_decode("cXVpel9w" . "cmV2aWV3"));
use Claromentis\Core\Application;
use Claromentis\Core\Http\JsonPrettyResponse;
use Claromentis\Core\Repository\Exception\NotFoundException;
use Claromentis\Quiz\Facade;
use Claromentis\Quiz\Permissions\QuizPermissions;
use RestExForbidden;
use RestExNotFound;
use RestFormat;
use Symfony\Component\HttpFoundation\JsonResponse;









class AdminController
{
    
    
    
    
    protected $formatter;
    
    
    
    
    
    
    public function __construct(RestFormat $formatter)
    {
        $this->formatter = $formatter;
    }
    
    
    
    
    
    
    
    
    
    
    public function Preview(Application $_6eb6fcb92c942851e079f8ec5fb80324, $quiz_id)
    {
        
        
        
        
        $_876ca2097b275e704d71e00d36b3e7c5 = $_6eb6fcb92c942851e079f8ec5fb80324[$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_ada909094c3f2b48f2ba66bec3334" . "aab"]];
        try {
            $quiz = $_876ca2097b275e704d71e00d36b3e7c5->GetEntireQuiz($quiz_id);
        } catch (NotFoundException $_c35473364fa7a050299058f332ec29c1) {
            throw new RestExNotFound($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_0c5123aa744f69bbc0e8b3ea2f6e" . "847d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_378a2afc2803a9" . "1e1b7526bbba785" . "672"]));
        }
        if (!QuizPermissions::CanPreview($_6eb6fcb92c942851e079f8ec5fb80324->acl, $_6eb6fcb92c942851e079f8ec5fb80324->security, $quiz)) {
            throw new RestExForbidden($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_0c5123aa744f69bbc0" . "e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_556c6740a7c938ba7b49ba50f1" . "0cf12d"]));
        }
        $_6eb6fcb92c942851e079f8ec5fb80324->session->set($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_a6cb83f" . "dacd366d" . "fe0da33a" . "fe934397" . "a"], $quiz_id);
        return new JsonPrettyResponse(array());
    }
    
    
    
    
    
    
    
    public function StopPreview(Application $_6eb6fcb92c942851e079f8ec5fb80324)
    {
        $_6eb6fcb92c942851e079f8ec5fb80324->session->remove($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_a6cb83fda" . "cd366dfe0d" . "a33afe9343" . "97a"]);
        return new JsonPrettyResponse(array());
    }
}