Compare commits
9 Commits
master
...
quiz-answe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3125347382 | ||
|
|
4676ec9b55 | ||
|
|
c5999fb6e7 | ||
|
|
a9a9456e15 | ||
|
|
3bd543654d | ||
|
|
d87c91ee64 | ||
|
|
802b7c179f | ||
|
|
b3cd808265 | ||
|
|
2520cd7fe2 |
@ -14,4 +14,7 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0 #Leave this alone unless
|
||||
MAILER_DSN=smtp://jv-com.mail.protection.outlook.com:25
|
||||
#Anonymous Complaints Email Settings
|
||||
COMPLAINT_RECIPIENT_ADDRESS=chris@jv.com
|
||||
COMPLAINT_RECIPIENT_NAME="Chris Weiser"
|
||||
COMPLAINT_RECIPIENT_NAME="Chris Weiser"
|
||||
#Safety Quiz Result Recipients
|
||||
#Enter full email addresses, separated by commas
|
||||
RESULT_INBOXES=""
|
||||
@ -1,23 +0,0 @@
|
||||
name: Intranet Deployment
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
Deploy:
|
||||
name: Deploy Project files
|
||||
runs-on: intranet
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
SSH-KEY: ${{secrets.read_key}}
|
||||
SSH-KNOWN-HOSTS: gitea.jv.com,192.168.0.214 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBHsv90d6ofdNgJx0W6zPTVpouqDeF/qv/L0guzFBg6YON4jiubCovUZ0h7M8ipg/kXACHLfNBWAmNvsaGrPpHNU=
|
||||
SSH-STRICT: 'false'
|
||||
- name: Copy files to project dir
|
||||
run: xcopy /E /I /Y /V . ${{ vars.PROD_DEPLOY_DIR }}
|
||||
- name: Update Composer Packages
|
||||
working-directory: ${{ vars.PROD_DEPLOY_DIR }}
|
||||
run: composer update --no-interaction --working-dir=${{ vars.PROD_DEPLOY_DIR }}
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
||||
{
|
||||
"gitea.owner": "audrey",
|
||||
"gitea.repo": "intranet",
|
||||
"gitea.instanceURL": "https://gitea.jv.com"
|
||||
}
|
||||
@ -1,5 +1,3 @@
|
||||

|
||||
|
||||
[Install](#install)
|
||||
[Configuring IIS](#iis-configuration)
|
||||
[Updating](#updating)
|
||||
|
||||
@ -39,7 +39,8 @@
|
||||
"symfony/validator": "6.3.*",
|
||||
"symfony/web-link": "6.3.*",
|
||||
"symfony/yaml": "6.3.*",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/cssinliner-extra": "^3.7",
|
||||
"twig/extra-bundle": "^3.7",
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
"config": {
|
||||
|
||||
286
composer.lock
generated
286
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "6c9cd0fccf203daf66cab2a05cf2e389",
|
||||
"content-hash": "94525144f340c9dc7dd003c8b43372f0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
@ -2641,6 +2641,71 @@
|
||||
],
|
||||
"time": "2023-05-29T12:49:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v6.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf",
|
||||
"reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\CssSelector\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Jean-François Simon",
|
||||
"email": "jeanfrancois.simon@sensiolabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Converts CSS selectors to XPath expressions",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/css-selector/tree/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-20T16:43:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/dependency-injection",
|
||||
"version": "v6.3.1",
|
||||
@ -5641,16 +5706,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/runtime",
|
||||
"version": "v6.3.12",
|
||||
"version": "v6.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/runtime.git",
|
||||
"reference": "a8d2b8f6033a33c224b43065a10bab5e4f0be486"
|
||||
"reference": "8e83b5d8e0ace903e1a91dedfe08a84ed2a54b0d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/runtime/zipball/a8d2b8f6033a33c224b43065a10bab5e4f0be486",
|
||||
"reference": "a8d2b8f6033a33c224b43065a10bab5e4f0be486",
|
||||
"url": "https://api.github.com/repos/symfony/runtime/zipball/8e83b5d8e0ace903e1a91dedfe08a84ed2a54b0d",
|
||||
"reference": "8e83b5d8e0ace903e1a91dedfe08a84ed2a54b0d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -5700,7 +5765,7 @@
|
||||
"runtime"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/runtime/tree/v6.3.12"
|
||||
"source": "https://github.com/symfony/runtime/tree/v6.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -5716,7 +5781,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-23T14:35:58+00:00"
|
||||
"time": "2023-06-21T12:08:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/security-bundle",
|
||||
@ -7161,28 +7226,146 @@
|
||||
"time": "2023-04-28T13:28:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/extra-bundle",
|
||||
"version": "v3.6.1",
|
||||
"name": "tijsverkoyen/css-to-inline-styles",
|
||||
"version": "2.2.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/twig-extra-bundle.git",
|
||||
"reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49"
|
||||
"url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
|
||||
"reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49",
|
||||
"reference": "802cc2dd46ec88285d6c7fa85c26ab7f2cd5bc49",
|
||||
"url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/c42125b83a4fa63b187fdf29f9c93cb7733da30c",
|
||||
"reference": "c42125b83a4fa63b187fdf29f9c93cb7733da30c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-libxml": "*",
|
||||
"php": "^5.5 || ^7.0 || ^8.0",
|
||||
"symfony/css-selector": "^2.7 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0 || ^7.5 || ^8.5.21 || ^9.5.10"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TijsVerkoyen\\CssToInlineStyles\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Tijs Verkoyen",
|
||||
"email": "css_to_inline_styles@verkoyen.eu",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
|
||||
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
|
||||
"support": {
|
||||
"issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues",
|
||||
"source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/2.2.6"
|
||||
},
|
||||
"time": "2023-01-03T09:29:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/cssinliner-extra",
|
||||
"version": "v3.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/cssinliner-extra.git",
|
||||
"reference": "59d107afea4ca58be35ae1386bd90b53424f3b34"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/cssinliner-extra/zipball/59d107afea4ca58be35ae1386bd90b53424f3b34",
|
||||
"reference": "59d107afea4ca58be35ae1386bd90b53424f3b34",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
"tijsverkoyen/css-to-inline-styles": "^2.0",
|
||||
"twig/twig": "^2.7|^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^5.4|^6.3"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Twig\\Extra\\CssInliner\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"description": "A Twig extension to allow inlining CSS",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"css",
|
||||
"inlining",
|
||||
"twig"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/twigphp/cssinliner-extra/tree/v3.7.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-29T15:34:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/extra-bundle",
|
||||
"version": "v3.7.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/twig-extra-bundle.git",
|
||||
"reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3",
|
||||
"reference": "f10baafe6eb0ecd615d52d5cbfb713a39f68e8f3",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
|
||||
"symfony/twig-bundle": "^4.4|^5.0|^6.0",
|
||||
"symfony/framework-bundle": "^5.4|^6.0",
|
||||
"symfony/twig-bundle": "^5.4|^6.0",
|
||||
"twig/twig": "^2.7|^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"league/commonmark": "^1.0|^2.0",
|
||||
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0",
|
||||
"symfony/phpunit-bridge": "^5.4|^6.3",
|
||||
"twig/cache-extra": "^3.0",
|
||||
"twig/cssinliner-extra": "^2.12|^3.0",
|
||||
"twig/html-extra": "^2.12|^3.0",
|
||||
@ -7220,7 +7403,7 @@
|
||||
"twig"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.6.1"
|
||||
"source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.7.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -7232,7 +7415,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-05-06T11:11:46+00:00"
|
||||
"time": "2023-07-29T15:34:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
@ -9111,71 +9294,6 @@
|
||||
],
|
||||
"time": "2023-04-25T10:46:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v6.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf",
|
||||
"reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\CssSelector\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com"
|
||||
},
|
||||
{
|
||||
"name": "Jean-François Simon",
|
||||
"email": "jeanfrancois.simon@sensiolabs.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Converts CSS selectors to XPath expressions",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/css-selector/tree/v6.3.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-03-20T16:43:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug-bundle",
|
||||
"version": "v6.3.0",
|
||||
@ -9634,5 +9752,5 @@
|
||||
"ext-iconv": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.2.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
||||
@ -7,12 +7,12 @@ Questions:
|
||||
# Choices:
|
||||
# - {Label: "[Text for this label]", Value: [True/False representing if this is the correct answer]}
|
||||
# - {Label: "[Text for this label]", Value: [True/False representing if this is the correct answer]}
|
||||
Question_1:
|
||||
Q1:
|
||||
Text: "Some safety topics in J.V. Manufacturing Safety Orientation Training are General Safety, Safe Lifting, Fall Protection and Forklift Training."
|
||||
Choices:
|
||||
- {Label: "True", Value: true}
|
||||
- {Label: "False", Value: false}
|
||||
Question2:
|
||||
Q2:
|
||||
Text: "Accidents are caused by:"
|
||||
Choices:
|
||||
- {Label: "Unsafe acts of another employee.", Value: False}
|
||||
|
||||
@ -16,7 +16,7 @@ framework:
|
||||
# sync: 'sync://'
|
||||
|
||||
routing:
|
||||
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
|
||||
#Symfony\Component\Mailer\Messenger\SendEmailMessage: async
|
||||
Symfony\Component\Notifier\Message\ChatMessage: async
|
||||
Symfony\Component\Notifier\Message\SmsMessage: async
|
||||
|
||||
|
||||
@ -34,14 +34,12 @@ class CSPController extends AbstractController
|
||||
$searchQuery = $ticketsRepo->getByKeyword($searchKeywords);
|
||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($searchQuery);
|
||||
$ticketsPerPage = count($paginator);
|
||||
//If no tickets were found, return a special page.
|
||||
//NOTE: we set page information to 1 of 1. Paginator has no tickets, which we're letting the twig template deal with.
|
||||
return $this->render('cspViewer.html.twig',['tickets' => $paginator, 'portal' => $portal, 'pageNum' => 1, 'pageCount' => 1, 'form' => $form]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$paginator = new \Doctrine\ORM\Tools\Pagination\Paginator($query);
|
||||
}
|
||||
|
||||
//Pagination
|
||||
$totalItems = count($paginator);
|
||||
$pageCount = ceil($totalItems / $ticketsPerPage);
|
||||
|
||||
@ -2,6 +2,9 @@
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Form\SafetyQuizType;
|
||||
use Egulias\EmailValidator\Warning\Warning;
|
||||
use Error;
|
||||
use phpDocumentor\Reflection\Types\Boolean;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@ -9,6 +12,12 @@ use Symfony\Component\Yaml\Yaml;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\DependencyInjection\Exception\EnvParameterException;
|
||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
|
||||
use function PHPUnit\Framework\containsIdentical;
|
||||
|
||||
@ -21,7 +30,7 @@ class SafetyController extends AbstractController
|
||||
return $this->render('Training/Safety/safetyHome.html.twig',['content' => $contentFile]);
|
||||
}
|
||||
#[Route('/training/safety/quiz')]
|
||||
public function Quiz(Request $request, LoggerInterface $log)
|
||||
public function Quiz(Request $request, LoggerInterface $log, MailerInterface $mailer)
|
||||
{
|
||||
$form = $this->createForm(SafetyQuizType::class);
|
||||
$form->handleRequest($request);
|
||||
@ -40,6 +49,7 @@ class SafetyController extends AbstractController
|
||||
}
|
||||
}
|
||||
$log->Debug($testerName . ' quiz answers correct: ' . $correctAnswers);
|
||||
$this->sendQuizResults($correctAnswers, $form, $mailer, $log);
|
||||
return $this->render('Training/Safety/quizResults.html.twig', ['testerName'=>$testerName,
|
||||
'correctAnswers'=>$correctAnswers, 'totalAnswers'=>count($data)]);
|
||||
}
|
||||
@ -104,4 +114,74 @@ class SafetyController extends AbstractController
|
||||
|
||||
return new Response($header . $navButtons . $contents);
|
||||
}
|
||||
//Send an email with the quiz results
|
||||
public function sendQuizResults(int $answersCorrect, FormInterface $submittedQuiz, MailerInterface $mailer, LoggerInterface $log)
|
||||
{
|
||||
//Fetch array of mail inboxes to send messages to.
|
||||
//If env var doesn't exist then fail gracefully
|
||||
$recipients = []; //X: keep in method's scope
|
||||
try
|
||||
{
|
||||
$recipients = explode(",", $_SERVER['RESULT_INBOXES']);
|
||||
}
|
||||
catch (EnvParameterException $e)
|
||||
{
|
||||
$log->warning("safety Quiz Submission: Environment Variable RESULT_INBOXES not configured. Quiz results will not be emailed.");
|
||||
return;
|
||||
}
|
||||
|
||||
//If no inboxes configured, cancel
|
||||
if(count($recipients) <= 0)
|
||||
{
|
||||
$log->warning("Safety Quiz Submission: No email recipients configured");
|
||||
return;
|
||||
}
|
||||
|
||||
//Prepare payload data
|
||||
$submittedData = $submittedQuiz->getData();
|
||||
$submission = [];
|
||||
$quiz = Yaml::parseFile('../config/SafetyQuiz.yaml', 2, 2, Yaml::PARSE_OBJECT_FOR_MAP)['Questions'];
|
||||
$questionKeys = array_keys($quiz);
|
||||
foreach($questionKeys as $key)
|
||||
{
|
||||
$questionData = [];
|
||||
$questionData += ['key'=>$key, 'text'=>$quiz[$key]['Text']];
|
||||
$answer = null;
|
||||
foreach($quiz[$key]['Choices'] as $choice)
|
||||
{
|
||||
if($choice['Value'])
|
||||
{
|
||||
$answer = $choice;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$questionData += ['answer'=>$answer, 'submittedAnswer'=>$submittedData[$key]];
|
||||
$submission += $questionData;
|
||||
$quiz[$key] += ['submittedAnswer'=>$submittedData[$key], 'answer'=>$answer];
|
||||
}
|
||||
//var_dump($submission);
|
||||
//Build & send the email
|
||||
$email = (new TemplatedEmail())
|
||||
->from(new Address('noreply@jv.com', 'Internal'))
|
||||
->to(new Address("ajensen@jv.com"))
|
||||
->subject('Safety Quiz Submission')
|
||||
->htmlTemplate('Emails/safetyQuizResults.html.twig')
|
||||
->context([
|
||||
'submission' => $quiz,
|
||||
'answersCorrect' => $answersCorrect,
|
||||
'totalQuestions' => count($questionKeys),
|
||||
'submitterName' => $submittedData['Name']])
|
||||
;
|
||||
try
|
||||
{
|
||||
$log->info("Sending Quiz Results...");
|
||||
$mailer->send($email);
|
||||
}
|
||||
catch (TransportExceptionInterface $e)
|
||||
{
|
||||
$log->error("Failed to email quiz results");
|
||||
$log->error($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,6 @@ class TicketRepository extends EntityRepository
|
||||
{
|
||||
$qb->andwhere('t.description LIKE :keyword'.$i)
|
||||
->orwhere('t.summary LIKE :keyword'.$i)
|
||||
->orwhere('t.id LIKE :keyword'.$i)
|
||||
->setParameter('keyword'.$i, '%'.$keyword.'%');
|
||||
}
|
||||
return $qb
|
||||
|
||||
53
templates/Emails/safetyQuizResults.html.twig
Normal file
53
templates/Emails/safetyQuizResults.html.twig
Normal file
@ -0,0 +1,53 @@
|
||||
{% apply inline_css %}
|
||||
<style>
|
||||
.correct
|
||||
{
|
||||
background-color: #9dff96;
|
||||
}
|
||||
.incorrect
|
||||
{
|
||||
background-color: #ff9696;
|
||||
}
|
||||
</style>
|
||||
<h1>A Quiz-taker has submitted the J.V. Safety Quiz <h1>
|
||||
<h2> {{ submitterName }} has completed the quiz, scoring {{answersCorrect}}/{{totalQuestions}} correct.</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="1">#</td>
|
||||
<td colspan="4">Question</td>
|
||||
<td colspan="2">Submitted Answer</td>
|
||||
<td colspan="2">Correct Answer</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key,question in submission %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if key != null %}
|
||||
{{key}}</td>
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if question["Text"] != null %}
|
||||
{{question["Text"]}}
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="{{ (question['submittedAnswer']==true)? 'correct': 'incorrect' }}">
|
||||
{{question['submittedAnswer']}}
|
||||
</td>
|
||||
<td>
|
||||
{% if question['answer']['Label'] != null %}
|
||||
{{question['answer']['Label']}}
|
||||
{% else %}
|
||||
N/A
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endapply %}
|
||||
@ -37,24 +37,11 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{# Forklift Training #}
|
||||
<div class="card-group">
|
||||
<div class="card text-center service-card">
|
||||
<div class="card-body">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title">Forklift Training</h5>
|
||||
</div>
|
||||
<div class="card-text">
|
||||
<ul class="list-group list-group-flush">
|
||||
<a class="list-group-item list-group-item-action list-item" href="https://sunbeltrentals.csod.com/login/render.aspx?id=defaultclp">Account Creation</a>
|
||||
<a class="list-group-item list-group-item-action list-item" href="https://www.sunbeltrentals.com/training/safety/">Training</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -6,12 +6,12 @@
|
||||
<body>
|
||||
{{ include('_navbar.html.twig')}}
|
||||
<div class="container">
|
||||
<h2>Anonymous Comment Page
|
||||
<h2>Anonymous Complaint Page
|
||||
<h4 class="text-bold">Instructions</h4>
|
||||
|
||||
<p>Type your complaint or problem into the message box below and click "Submit".
|
||||
<br>Messages will be sent directly to {{ complaintReceiverName }}'s email account.
|
||||
<br>Messages will be completely anonymous so comments cannot be traced to a specific person.
|
||||
<br>Messages will be completely anonymous so complaints cannot be traced to a specific person.
|
||||
<br> Feel free to submit any problem or concern.
|
||||
<br><strong>Note: If you add personally identifying information (such as your name) then this won't be anonymous. Avoid this, unless you want your identity to be known</strong>
|
||||
</p>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user