mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-05-15 04:38:23 -04:00
Compare commits
150 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65876e5b78 | |||
| 4c5d635d5b | |||
| 8d22092ea8 | |||
| 2d64d6d422 | |||
| c16d1e7e95 | |||
| e066ace8f8 | |||
| 50c051f0cc | |||
| 8d2af9053a | |||
| 7b024ebffe | |||
| 9ff095a2ee | |||
| 9caca508ed | |||
| b79c54fd32 | |||
| 418455c508 | |||
| 2a8f73cc76 | |||
| ad4b9a8ff2 | |||
| d944701957 | |||
| f1e37487e9 | |||
| 9c9ad71a49 | |||
| 542895c11c | |||
| 4539470537 | |||
| 5a019b2c92 | |||
| 8866cafd31 | |||
| f104c1b61b | |||
| 94275f49b2 | |||
| 4b659c5db1 | |||
| c7df62b483 | |||
| bf28eac68a | |||
| e4aaf461fb | |||
| 50abb9d909 | |||
| 3da8af3344 | |||
| 94509caf3c | |||
| ae3be2b977 | |||
| 1e3ae2fbbb | |||
| 8a0e09cb80 | |||
| 7433051f85 | |||
| 763e00435c | |||
| 8189bbce9a | |||
| baef9a1df0 | |||
| 03cf1c5493 | |||
| ef6f403e1b | |||
| 9e21124e90 | |||
| 299ba8ade7 | |||
| c20024ed96 | |||
| 75564bc3e6 | |||
| 2c18dc8c1d | |||
| 9d9e4bb8f6 | |||
| 047633c2ce | |||
| 104a20925a | |||
| e5d28d796a | |||
| 0479c7814c | |||
| ab82a55452 | |||
| 181720aa64 | |||
| b992286c2e | |||
| 88d2163e4c | |||
| 997abf460e | |||
| a4e5a647d6 | |||
| c706bb7361 | |||
| 48d998ec67 | |||
| 90b551ad31 | |||
| 09523f2bb0 | |||
| c916e5e580 | |||
| 57783b8e85 | |||
| 2f441f36f8 | |||
| 537e5dc139 | |||
| 82c50eb03b | |||
| 344c406b5a | |||
| 13af227a7d | |||
| 073ad62ccf | |||
| f3ec54db20 | |||
| fea20bcda9 | |||
| f61aa35ac3 | |||
| 7e676ddedd | |||
| f04f93e89b | |||
| f26631bedf | |||
| 799261a7d5 | |||
| 5c6f2d28bc | |||
| 498c80f404 | |||
| 619c335379 | |||
| 1c7997c549 | |||
| faf0c20d7d | |||
| 0166c48daa | |||
| d1ce6ba6da | |||
| 2eabeb4205 | |||
| ccc947d444 | |||
| b24f0baddb | |||
| 9fee30f1ee | |||
| 5f7894781c | |||
| f517250bbf | |||
| 7dedd9586b | |||
| b7c2b8a632 | |||
| 67f49b40e9 | |||
| 566c5ef0ba | |||
| 376268aa42 | |||
| 2331beab17 | |||
| 6e7c5c81e6 | |||
| c86e6af390 | |||
| 7f07490bdf | |||
| e78d6c3c12 | |||
| 04dd5ee6b7 | |||
| 133f430445 | |||
| ee6b71534a | |||
| 0bd86285ca | |||
| 96e4fc36d1 | |||
| 0b5b5575d4 | |||
| 48ccf671ef | |||
| 06f706b3a8 | |||
| d2a23628cd | |||
| fbd644fd8a | |||
| 70b9478dd2 | |||
| dda94c1b7c | |||
| 47512a221e | |||
| d01bf2fca7 | |||
| caf44ba58a | |||
| 28c2f0a13d | |||
| 13ed334ea1 | |||
| 585c05d1d7 | |||
| a3156ac246 | |||
| 509a135e74 | |||
| 52f2d242da | |||
| 615752d61a | |||
| 54adf4ea22 | |||
| a630de66e2 | |||
| 2b9cd625d6 | |||
| d2a884b0bb | |||
| 1cb85d50ca | |||
| e595c1d7de | |||
| db63c4ea4d | |||
| 9a32aa1730 | |||
| bfdfcb87cf | |||
| 1b4eecb54d | |||
| 44efcd8e32 | |||
| abf3da8030 | |||
| 1d3f07b7b7 | |||
| 7869a96c81 | |||
| 3b2937d189 | |||
| cf5f7effbf | |||
| e453c0edcc | |||
| 3546298a08 | |||
| d277180e45 | |||
| a63eafb833 | |||
| d4b3b1b47d | |||
| c4d382dbf0 | |||
| b850b38b85 | |||
| 7d1a208534 | |||
| f1ee7cfeaf | |||
| ea03d22558 | |||
| 45566d373f | |||
| e9fd3407a7 | |||
| 1419032b64 | |||
| 9f85296cea |
+2
-2
@@ -33,8 +33,8 @@ MAIL_USERNAME=null
|
|||||||
MAIL_PASSWORD=null
|
MAIL_PASSWORD=null
|
||||||
MAIL_ENCRYPTION=null
|
MAIL_ENCRYPTION=null
|
||||||
|
|
||||||
NEXMO_KEY=4587feffd # Votre Clé Nexmo API
|
NEXMO_KEY= # Votre Clé Nexmo API
|
||||||
NEXMO_SECRET=54dasf4e8fa4s4fd4f5s # Votre Mot de passe Nexmo API
|
NEXMO_SECRET= # Votre Mot de passe Nexmo API
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
PUSHER_APP_ID=
|
||||||
PUSHER_APP_KEY=
|
PUSHER_APP_KEY=
|
||||||
|
|||||||
+61
-3
@@ -4,15 +4,25 @@ services:
|
|||||||
- mysql:5.7
|
- mysql:5.7
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
MYSQL_DATABASE: homestead
|
MYSQL_DATABASE: ddb
|
||||||
MYSQL_ROOT_PASSWORD: secret
|
MYSQL_ROOT_PASSWORD: password
|
||||||
DB_HOST: mysql
|
DB_HOST: mysql
|
||||||
DB_USERNAME: root
|
DB_USERNAME: root
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
- test
|
||||||
- deploy
|
- deploy
|
||||||
- deploy
|
|
||||||
|
unit_test:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- cp .env.example .env
|
||||||
|
- composer install
|
||||||
|
- php artisan key:generate
|
||||||
|
- php artisan migrate
|
||||||
|
- php artisan db:seed
|
||||||
|
- vendor/bin/phpunit
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
@@ -52,3 +62,51 @@ deploy_736:
|
|||||||
url: http://736.exvps.ca
|
url: http://736.exvps.ca
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
|
deploy_227:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||||
|
|
||||||
|
- ~/.composer/vendor/bin/envoy run deploy_227 --commit="$CI_COMMIT_SHA"
|
||||||
|
environment:
|
||||||
|
name: CCMRC227
|
||||||
|
url: http://227.exvps.ca
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
deploy_117:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||||
|
|
||||||
|
- ~/.composer/vendor/bin/envoy run deploy_117 --commit="$CI_COMMIT_SHA"
|
||||||
|
environment:
|
||||||
|
name: CCMRC117
|
||||||
|
url: http://117.exvps.ca
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
|
deploy_dev:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||||
|
- eval $(ssh-agent -s)
|
||||||
|
- ssh-add <(echo "$SSH_PRIVATE_KEY")
|
||||||
|
- mkdir -p ~/.ssh
|
||||||
|
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||||
|
|
||||||
|
- ~/.composer/vendor/bin/envoy run deploy_dev --commit="$CI_COMMIT_SHA"
|
||||||
|
environment:
|
||||||
|
name: dev
|
||||||
|
url: http://dev.exvps.ca
|
||||||
|
only:
|
||||||
|
- dev
|
||||||
+1325
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
C:37:"PHPUnit\Runner\DefaultTestResultCache":273:{a:2:{s:7:"defects";a:2:{s:32:"Tests\Feature\AdminTest::testUrl";i:3;s:30:"Tests\Feature\ECCTest::testUrl";i:3;}s:5:"times";a:3:{s:32:"Tests\Feature\AdminTest::testUrl";d:0.099;s:30:"Tests\Feature\ECCTest::testUrl";d:0.014;s:33:"Tests\Feature\PublicTest::testUrl";d:0.031;}}}
|
||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/** Version 3.2.0 **/
|
||||||
|
Nouveauté
|
||||||
|
|
||||||
|
Modernisation de l'affichage de l'horaire avec fullcalendar
|
||||||
|
Modernisation de la structure de la base de donnée de l'horaire
|
||||||
|
Modernisation de l'interface avec Material UI / Dashboard
|
||||||
|
Ajout d'une bibliothèque d'image
|
||||||
|
Ajout de nouvelle configuration
|
||||||
|
Le nombre de période dans l'horaire est maintenant dynamique
|
||||||
|
Le nombre de niveau dans l'horaire est maintenant dynamique
|
||||||
|
Les activitées sont maintenant dynamique
|
||||||
|
L'horaire est maintenant disponible sur le site publique
|
||||||
|
Les photos du calendrier sont disponible au publique depuis la page d'accueil
|
||||||
|
|
||||||
|
Bug
|
||||||
|
|
||||||
|
Correction de 22 bugs
|
||||||
|
|
||||||
|
|
||||||
/** ALPHA 3.0.5 **/
|
/** ALPHA 3.0.5 **/
|
||||||
Front-End
|
Front-End
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
# Set the base image for subsequent instructions
|
# Set the base image for subsequent instructions
|
||||||
FROM php:7.2
|
FROM php:7.4
|
||||||
|
|
||||||
# Update packages
|
# Update packages
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
||||||
# Install PHP and composer dependencies
|
# Install PHP and composer dependencies
|
||||||
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev autoconf libc-dev pkg-config
|
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev autoconf libc-dev pkg-config libzip-dev
|
||||||
|
|
||||||
# Clear out the local repository of retrieved package files
|
# Clear out the local repository of retrieved package files
|
||||||
RUN apt-get clean
|
RUN apt-get clean
|
||||||
@@ -14,7 +14,7 @@ RUN apt-get clean
|
|||||||
# Here you can install any other extension that you need during the test and deployment process
|
# Here you can install any other extension that you need during the test and deployment process
|
||||||
RUN docker-php-ext-install pdo_mysql zip
|
RUN docker-php-ext-install pdo_mysql zip
|
||||||
|
|
||||||
RUN pecl install mcrypt-1.0.1
|
RUN pecl install mcrypt
|
||||||
|
|
||||||
# Install Composer
|
# Install Composer
|
||||||
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
||||||
|
|||||||
+147
-2
@@ -11,6 +11,18 @@
|
|||||||
$releases_dir_736 = '/var/www/c-cms/escadron736/releases';
|
$releases_dir_736 = '/var/www/c-cms/escadron736/releases';
|
||||||
$app_dir_736 = '/var/www/c-cms/escadron736';
|
$app_dir_736 = '/var/www/c-cms/escadron736';
|
||||||
$new_release_dir_736 = $releases_dir_736 .'/'. $release;
|
$new_release_dir_736 = $releases_dir_736 .'/'. $release;
|
||||||
|
|
||||||
|
$releases_dir_dev = '/var/www/c-cms/dev/releases';
|
||||||
|
$app_dir_dev = '/var/www/c-cms/dev';
|
||||||
|
$new_release_dir_dev = $releases_dir_dev .'/'. $release;
|
||||||
|
|
||||||
|
$releases_dir_227 = '/var/www/c-cms/ccmrc227/releases';
|
||||||
|
$app_dir_227 = '/var/www/c-cms/ccmrc227';
|
||||||
|
$new_release_dir_227 = $releases_dir_227 .'/'. $release;
|
||||||
|
|
||||||
|
$releases_dir_117 = '/var/www/c-cms/ccmrc117/releases';
|
||||||
|
$app_dir_117 = '/var/www/c-cms/ccmrc117';
|
||||||
|
$new_release_dir_117 = $releases_dir_117 .'/'. $release;
|
||||||
@endsetup
|
@endsetup
|
||||||
|
|
||||||
@story('deploy_697')
|
@story('deploy_697')
|
||||||
@@ -25,6 +37,25 @@
|
|||||||
update_symlinks_736
|
update_symlinks_736
|
||||||
@endstory
|
@endstory
|
||||||
|
|
||||||
|
@story('deploy_dev')
|
||||||
|
clone_repository_dev
|
||||||
|
run_composer_dev
|
||||||
|
update_symlinks_dev
|
||||||
|
remove_old_release_dev
|
||||||
|
@endstory
|
||||||
|
|
||||||
|
@story('deploy_227')
|
||||||
|
clone_repository_227
|
||||||
|
run_composer_227
|
||||||
|
update_symlinks_227
|
||||||
|
@endstory
|
||||||
|
|
||||||
|
@story('deploy_117')
|
||||||
|
clone_repository_117
|
||||||
|
run_composer_117
|
||||||
|
update_symlinks_117
|
||||||
|
@endstory
|
||||||
|
|
||||||
@task('clone_repository_697')
|
@task('clone_repository_697')
|
||||||
echo 'Cloning repository'
|
echo 'Cloning repository'
|
||||||
[ -d {{ $releases_dir_697 }} ] || mkdir {{ $releases_dir_697 }}
|
[ -d {{ $releases_dir_697 }} ] || mkdir {{ $releases_dir_697 }}
|
||||||
@@ -36,7 +67,7 @@
|
|||||||
@task('run_composer_697')
|
@task('run_composer_697')
|
||||||
echo "Starting deployment ({{ $release }})"
|
echo "Starting deployment ({{ $release }})"
|
||||||
cd {{ $new_release_dir_697 }}
|
cd {{ $new_release_dir_697 }}
|
||||||
composer install --prefer-dist --no-scripts -q -o
|
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||||
@endtask
|
@endtask
|
||||||
|
|
||||||
@task('update_symlinks_697')
|
@task('update_symlinks_697')
|
||||||
@@ -56,6 +87,8 @@
|
|||||||
echo 'Migrate DB'
|
echo 'Migrate DB'
|
||||||
cd {{ $app_dir_697 }}/current/
|
cd {{ $app_dir_697 }}/current/
|
||||||
php artisan migrate
|
php artisan migrate
|
||||||
|
php artisan db:seed --class=ConfigsTableSeeder
|
||||||
|
|
||||||
@endtask
|
@endtask
|
||||||
|
|
||||||
@task('clone_repository_736')
|
@task('clone_repository_736')
|
||||||
@@ -69,7 +102,7 @@
|
|||||||
@task('run_composer_736')
|
@task('run_composer_736')
|
||||||
echo "Starting deployment ({{ $release }})"
|
echo "Starting deployment ({{ $release }})"
|
||||||
cd {{ $new_release_dir_736 }}
|
cd {{ $new_release_dir_736 }}
|
||||||
composer install --prefer-dist --no-scripts -q -o
|
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||||
@endtask
|
@endtask
|
||||||
|
|
||||||
@task('update_symlinks_736')
|
@task('update_symlinks_736')
|
||||||
@@ -89,4 +122,116 @@
|
|||||||
echo 'Migrate DB'
|
echo 'Migrate DB'
|
||||||
cd {{ $app_dir_736 }}/current/
|
cd {{ $app_dir_736 }}/current/
|
||||||
php artisan migrate
|
php artisan migrate
|
||||||
|
php artisan db:seed --class=ConfigsTableSeeder
|
||||||
|
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('clone_repository_dev')
|
||||||
|
echo 'Cloning repository'
|
||||||
|
[ -d {{ $releases_dir_dev }} ] || mkdir {{ $releases_dir_dev }}
|
||||||
|
git clone --depth 1 --single-branch -b dev {{ $repository }} {{ $new_release_dir_dev }}
|
||||||
|
cd {{ $new_release_dir_dev }}
|
||||||
|
git reset --hard {{ $commit }}
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('run_composer_dev')
|
||||||
|
echo "Starting deployment ({{ $release }})"
|
||||||
|
cd {{ $new_release_dir_dev }}
|
||||||
|
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('update_symlinks_dev')
|
||||||
|
echo "Linking storage directory"
|
||||||
|
rm -rf {{ $new_release_dir_dev }}/storage
|
||||||
|
ln -nfs {{ $app_dir_dev }}/storage {{ $new_release_dir_dev }}/storage
|
||||||
|
|
||||||
|
echo 'Linking .env file'
|
||||||
|
ln -nfs {{ $app_dir_dev }}/.env {{ $new_release_dir_dev }}/.env
|
||||||
|
|
||||||
|
echo 'Linking current release'
|
||||||
|
ln -nfs {{ $new_release_dir_dev }} {{ $app_dir_dev }}/current
|
||||||
|
|
||||||
|
echo 'Setting permission'
|
||||||
|
chmod -R 777 {{ $app_dir_dev }}/current/bootstrap/
|
||||||
|
|
||||||
|
echo 'Migrate DB'
|
||||||
|
cd {{ $app_dir_dev }}/current/
|
||||||
|
php artisan migrate
|
||||||
|
php artisan db:seed --class=ConfigsTableSeeder
|
||||||
|
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('remove_old_release_dev')
|
||||||
|
cd {{ $releases_dir_dev }}
|
||||||
|
rm -fr $(ls -t1 | tail -n +3)
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('clone_repository_227')
|
||||||
|
echo 'Cloning repository'
|
||||||
|
[ -d {{ $releases_dir_227 }} ] || mkdir {{ $releases_dir_227 }}
|
||||||
|
git clone --depth 1 {{ $repository }} {{ $new_release_dir_227 }}
|
||||||
|
cd {{ $new_release_dir_227 }}
|
||||||
|
git reset --hard {{ $commit }}
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('run_composer_227')
|
||||||
|
echo "Starting deployment ({{ $release }})"
|
||||||
|
cd {{ $new_release_dir_227 }}
|
||||||
|
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('update_symlinks_227')
|
||||||
|
echo "Linking storage directory"
|
||||||
|
rm -rf {{ $new_release_dir_227 }}/storage
|
||||||
|
ln -nfs {{ $app_dir_227 }}/storage {{ $new_release_dir_227 }}/storage
|
||||||
|
|
||||||
|
echo 'Linking .env file'
|
||||||
|
ln -nfs {{ $app_dir_227 }}/.env {{ $new_release_dir_227 }}/.env
|
||||||
|
|
||||||
|
echo 'Linking current release'
|
||||||
|
ln -nfs {{ $new_release_dir_227 }} {{ $app_dir_227 }}/current
|
||||||
|
|
||||||
|
echo 'Setting permission'
|
||||||
|
chmod -R 777 {{ $app_dir_227 }}/current/bootstrap/
|
||||||
|
|
||||||
|
echo 'Migrate DB'
|
||||||
|
cd {{ $app_dir_227 }}/current/
|
||||||
|
php artisan migrate
|
||||||
|
php artisan db:seed --class=ConfigsTableSeeder
|
||||||
|
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('clone_repository_117')
|
||||||
|
echo 'Cloning repository'
|
||||||
|
[ -d {{ $releases_dir_117 }} ] || mkdir {{ $releases_dir_117 }}
|
||||||
|
git clone --depth 1 {{ $repository }} {{ $new_release_dir_117 }}
|
||||||
|
cd {{ $new_release_dir_117 }}
|
||||||
|
git reset --hard {{ $commit }}
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('run_composer_117')
|
||||||
|
echo "Starting deployment ({{ $release }})"
|
||||||
|
cd {{ $new_release_dir_117 }}
|
||||||
|
composer install --prefer-dist --no-scripts -q -o --no-dev
|
||||||
|
@endtask
|
||||||
|
|
||||||
|
@task('update_symlinks_117')
|
||||||
|
echo "Linking storage directory"
|
||||||
|
rm -rf {{ $new_release_dir_117 }}/storage
|
||||||
|
ln -nfs {{ $app_dir_117 }}/storage {{ $new_release_dir_117 }}/storage
|
||||||
|
|
||||||
|
echo 'Linking .env file'
|
||||||
|
ln -nfs {{ $app_dir_117 }}/.env {{ $new_release_dir_117 }}/.env
|
||||||
|
|
||||||
|
echo 'Linking current release'
|
||||||
|
ln -nfs {{ $new_release_dir_117 }} {{ $app_dir_117 }}/current
|
||||||
|
|
||||||
|
echo 'Setting permission'
|
||||||
|
chmod -R 777 {{ $app_dir_117 }}/current/bootstrap/
|
||||||
|
|
||||||
|
echo 'Migrate DB'
|
||||||
|
cd {{ $app_dir_117 }}/current/
|
||||||
|
php artisan migrate
|
||||||
|
php artisan db:seed --class=ConfigsTableSeeder
|
||||||
|
|
||||||
@endtask
|
@endtask
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2018 Mathieu Lagace
|
Copyright (c) 2019 Mathieu Lagace
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+19124
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Booking
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $item_id
|
||||||
|
* @property int $amount
|
||||||
|
* @property int $bookable_id
|
||||||
|
* @property string $bookable_type
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $comment
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $bookable
|
||||||
|
* @property-read \App\Item $item
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \App\User $user
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereAmount($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereBookableId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereBookableType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereComment($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereItemId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Booking whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Booking extends Model
|
||||||
|
{
|
||||||
|
public function bookable()
|
||||||
|
{
|
||||||
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\User');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function item()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Item');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,46 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\ComplementaryActivity
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $public_body
|
||||||
|
* @property string $public_slogan
|
||||||
|
* @property string $public_header_picture
|
||||||
|
* @property string $admin_desc
|
||||||
|
* @property string $calendar_color
|
||||||
|
* @property string $calendar_icon
|
||||||
|
* @property string $begin_time
|
||||||
|
* @property string $end_time
|
||||||
|
* @property string $location
|
||||||
|
* @property int $is_mandatory
|
||||||
|
* @property int $is_promoted
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Picture[] $pictures
|
||||||
|
* @property-read int|null $pictures_count
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereAdminDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereBeginTime($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereCalendarColor($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereCalendarIcon($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereEndTime($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereIsMandatory($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereIsPromoted($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereLocation($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity wherePublicBody($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity wherePublicHeaderPicture($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity wherePublicSlogan($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ComplementaryActivity whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class ComplementaryActivity extends Model
|
class ComplementaryActivity extends Model
|
||||||
{
|
{
|
||||||
public function pictures()
|
public function pictures()
|
||||||
|
|||||||
@@ -4,6 +4,28 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Config
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property int $state
|
||||||
|
* @property array $data
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereData($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereState($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Config whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Config extends Model
|
class Config extends Model
|
||||||
{
|
{
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@@ -19,4 +41,14 @@ class Config extends Model
|
|||||||
{
|
{
|
||||||
return Config::where('name',$configName)->first()->data();
|
return Config::where('name',$configName)->first()->data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function find($name)
|
||||||
|
{
|
||||||
|
return Config::where('name',$name)->first();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Course
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $ocom
|
||||||
|
* @property int $periode
|
||||||
|
* @property int $level
|
||||||
|
* @property string $location
|
||||||
|
* @property string $desc
|
||||||
|
* @property string $comment
|
||||||
|
* @property string $comment_officer
|
||||||
|
* @property int $event_id
|
||||||
|
* @property string $user_id
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Booking[] $bookings
|
||||||
|
* @property-read int|null $bookings_count
|
||||||
|
* @property-read \App\Event $event
|
||||||
|
* @property-read \App\LessonPlan|null $lessonPlan
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \App\User $user
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereComment($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereCommentOfficer($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereEventId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereLevel($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereLocation($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereOcom($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course wherePeriode($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Course whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Course extends Model
|
||||||
|
{
|
||||||
|
public function bookings()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Booking', 'bookable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\User');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function instructor()
|
||||||
|
{
|
||||||
|
if (\App\User::find($this->user_id)) {
|
||||||
|
return \App\User::find($this->user_id)->fullname();
|
||||||
|
} else {
|
||||||
|
return $this->user_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ocom()
|
||||||
|
{
|
||||||
|
if ($this->ocom != null) {
|
||||||
|
$ocom = \App\OCOM::findByOCOM($this->ocom);
|
||||||
|
if ($ocom != null) {
|
||||||
|
return $ocom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function event()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Event');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function use_course()
|
||||||
|
{
|
||||||
|
return $this->name == "" && $this->ocom == "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function lessonPlan()
|
||||||
|
{
|
||||||
|
return $this->hasOne('App\LessonPlan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allFuture()
|
||||||
|
{
|
||||||
|
$courses = Course::all();
|
||||||
|
foreach ($courses as $key => $course) {
|
||||||
|
if (date('c', strtotime($course->event->date_begin)) <= date('c')) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allThisYear()
|
||||||
|
{
|
||||||
|
$courses = Course::all();
|
||||||
|
foreach ($courses as $key => $course) {
|
||||||
|
if (date('c', strtotime($course->event->date_begin)) <= date('c', strtotime(\App\Config::getData('instruction_year_begin')))) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
if (date('c', strtotime($course->event->date_begin)) >= date('c', strtotime(\App\Config::getData('instruction_year_end')))) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allForUser($user_id)
|
||||||
|
{
|
||||||
|
$courses = Course::all();
|
||||||
|
foreach ($courses as $key => $course) {
|
||||||
|
if ($course->user_id != $user_id) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allForAuthUser()
|
||||||
|
{
|
||||||
|
return self::allForUser(\Auth::user()->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allFutureForUser($user_id)
|
||||||
|
{
|
||||||
|
$courses = Course::all();
|
||||||
|
foreach ($courses as $key => $course) {
|
||||||
|
if (date('c', strtotime($course->event->date_begin)) <= date('c')) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
if ($course->user_id != $user_id) {
|
||||||
|
$courses->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allFutureForAuthUser()
|
||||||
|
{
|
||||||
|
return self::allFutureForUser(\Auth::user()->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+146
@@ -0,0 +1,146 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Event
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $date_begin
|
||||||
|
* @property string $date_end
|
||||||
|
* @property string $type
|
||||||
|
* @property string $user_id
|
||||||
|
* @property string $location
|
||||||
|
* @property int $is_mandatory
|
||||||
|
* @property int $use_weekly_msg
|
||||||
|
* @property int $use_schedule
|
||||||
|
* @property string $desc
|
||||||
|
* @property array $msg
|
||||||
|
* @property array $weekly_msg_file
|
||||||
|
* @property array $schedule
|
||||||
|
* @property string $calendar_color
|
||||||
|
* @property string $calendar_icon
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Booking[] $bookings
|
||||||
|
* @property-read int|null $bookings_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Course[] $courses
|
||||||
|
* @property-read int|null $courses_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \App\User $user
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereCalendarColor($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereCalendarIcon($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereDateBegin($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereDateEnd($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereIsMandatory($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereLocation($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereMsg($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereSchedule($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereUseSchedule($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereUseWeeklyMsg($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereUserId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Event whereWeeklyMsgFile($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Event extends Model
|
||||||
|
{
|
||||||
|
protected $casts = [
|
||||||
|
'schedule' => 'array',
|
||||||
|
'msg' => 'array',
|
||||||
|
'weekly_msg_file' => 'array'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function bookings()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Booking', 'bookable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function courses()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Course');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function type()
|
||||||
|
{
|
||||||
|
return \App\EventType::find($this->type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\User');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function course($p,$l)
|
||||||
|
{
|
||||||
|
$courses = $this->courses;
|
||||||
|
|
||||||
|
foreach ($courses as $c)
|
||||||
|
{
|
||||||
|
if ($c->periode == $p && $c->level == $l)
|
||||||
|
{
|
||||||
|
return $c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function future()
|
||||||
|
{
|
||||||
|
$events = collect();
|
||||||
|
|
||||||
|
foreach (Event::all() as $event)
|
||||||
|
{
|
||||||
|
if (date('U',strtotime($event->date_begin)) >= time())
|
||||||
|
{
|
||||||
|
$events->push($event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allThisYear()
|
||||||
|
{
|
||||||
|
$events = Event::all();
|
||||||
|
foreach ($events as $key => $event)
|
||||||
|
{
|
||||||
|
if (date('c',strtotime($event->date_begin)) <= date('c',strtotime(\App\Config::getData('instruction_year_begin'))))
|
||||||
|
{
|
||||||
|
$events->forget($key);
|
||||||
|
}
|
||||||
|
if (date('c',strtotime($event->date_begin)) >= date('c',strtotime(\App\Config::getData('instruction_year_end'))))
|
||||||
|
{
|
||||||
|
$events->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nbPeriode()
|
||||||
|
{
|
||||||
|
return (count($this->schedule["periodes"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nbNiveau()
|
||||||
|
{
|
||||||
|
return count($this->schedule["niveaux"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\EventType
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $admin_desc
|
||||||
|
* @property string $calendar_color
|
||||||
|
* @property string $calendar_icon
|
||||||
|
* @property string $begin_time
|
||||||
|
* @property string $end_time
|
||||||
|
* @property string $location
|
||||||
|
* @property int $is_mandatory
|
||||||
|
* @property int $use_weekly_msg
|
||||||
|
* @property string $weekly_msg_publication_time
|
||||||
|
* @property int $use_schedule
|
||||||
|
* @property array $schedule_model
|
||||||
|
* @property int $is_promoted
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereAdminDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereBeginTime($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereCalendarColor($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereCalendarIcon($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereEndTime($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereIsMandatory($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereIsPromoted($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereLocation($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereScheduleModel($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereUseSchedule($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereUseWeeklyMsg($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\EventType whereWeeklyMsgPublicationTime($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class EventType extends Model
|
||||||
|
{
|
||||||
|
protected $casts = [
|
||||||
|
'schedule_model' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function getScheduleModelData($level,$periode)
|
||||||
|
{
|
||||||
|
if (isset($this->schedule_model['default_value']))
|
||||||
|
{
|
||||||
|
dd($this->schedule_model ['default_value']);
|
||||||
|
return $this->schedule_model['default_value'][$periode-1][$level-1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'ocom' => 'M103.03',
|
||||||
|
'name' => 'Super cours',
|
||||||
|
'location' => 'Bic',
|
||||||
|
'instructor' => 'Math',
|
||||||
|
'desc' => ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nbLevel()
|
||||||
|
{
|
||||||
|
return count($this->schedule_model['niveaux']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nbPeriode()
|
||||||
|
{
|
||||||
|
return count($this->schedule_model['periodes']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Throwable;
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
@@ -32,7 +32,7 @@ class Handler extends ExceptionHandler
|
|||||||
* @param \Exception $exception
|
* @param \Exception $exception
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function report(Exception $exception)
|
public function report(Throwable $exception)
|
||||||
{
|
{
|
||||||
parent::report($exception);
|
parent::report($exception);
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ class Handler extends ExceptionHandler
|
|||||||
* @param \Exception $exception
|
* @param \Exception $exception
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function render($request, Exception $exception)
|
public function render($request, Throwable $exception)
|
||||||
{
|
{
|
||||||
return parent::render($request, $exception);
|
return parent::render($request, $exception);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,444 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use League\Flysystem\FileNotFoundException;
|
||||||
|
use mysql_xdevapi\Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\GoogleDriveFile
|
||||||
|
*
|
||||||
|
* @property string $id
|
||||||
|
* @property string $type
|
||||||
|
* @property string $name
|
||||||
|
* @property string $path
|
||||||
|
* @property array $rank_permission
|
||||||
|
* @property array $job_permission
|
||||||
|
* @property array $user_permission
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereJobPermission($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile wherePath($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereRankPermission($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\GoogleDriveFile whereUserPermission($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class GoogleDriveFile extends Model
|
||||||
|
{
|
||||||
|
protected $primaryKey = 'id'; // or null
|
||||||
|
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
|
// In Laravel 6.0+ make sure to also set $keyType
|
||||||
|
protected $keyType = 'string';
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'rank_permission' => 'array',
|
||||||
|
'job_permission' => 'array',
|
||||||
|
'user_permission' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function icon($extension)
|
||||||
|
{
|
||||||
|
$icon = "fas fa-file";
|
||||||
|
switch ($extension)
|
||||||
|
{
|
||||||
|
case 'pdf':
|
||||||
|
$icon = 'fas fa-file-pdf text-pdf';
|
||||||
|
break;
|
||||||
|
case 'php':
|
||||||
|
$icon = 'fas fa-file-code text-code';
|
||||||
|
break;
|
||||||
|
case 'pptx':
|
||||||
|
$icon = 'fas fa-file-powerpoint text-powerpoint';
|
||||||
|
break;
|
||||||
|
case 'docx':
|
||||||
|
case 'odt':
|
||||||
|
$icon = 'fas fa-file-word text-word';
|
||||||
|
break;
|
||||||
|
case 'ods':
|
||||||
|
case 'xlsx':
|
||||||
|
$icon = 'fas fa-file-excel text-excel';
|
||||||
|
break;
|
||||||
|
case 'png':
|
||||||
|
case 'PNG':
|
||||||
|
case 'jpg':
|
||||||
|
case 'jpeg':
|
||||||
|
$icon = 'fas fa-file-image text-image';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return $icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function checkConfig()
|
||||||
|
{
|
||||||
|
$configNull = (\Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_ID')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_SECRET')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_REFRESH_TOKEN')) != "" && \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_FOLDER_ID')) != "");
|
||||||
|
$configOk = true;
|
||||||
|
|
||||||
|
if ($configNull)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
\Storage::cloud()->listContents("/", false);
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$configOk = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $configNull && $configOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findByName($name)
|
||||||
|
{
|
||||||
|
return GoogleDriveFile::where('name','=',$name)->get()->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findByPath($path)
|
||||||
|
{
|
||||||
|
return GoogleDriveFile::where('path','=',$path)->get()->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findByPathInDrive($path,$current_directory = '/')
|
||||||
|
{
|
||||||
|
if ($path != "")
|
||||||
|
{
|
||||||
|
$exploded_path = explode('/',$path);
|
||||||
|
if ($exploded_path[0] == "")
|
||||||
|
{
|
||||||
|
array_splice($exploded_path,0,1);
|
||||||
|
}
|
||||||
|
$contents = collect(Storage::cloud()->listContents($current_directory, false));
|
||||||
|
|
||||||
|
$dir = $contents->where('type', '=', 'dir')
|
||||||
|
->where('name', '=', $exploded_path[0])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ( ! $dir)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
array_splice($exploded_path,0,1);
|
||||||
|
$newPath = implode('/',$exploded_path);
|
||||||
|
if ($newPath == "")
|
||||||
|
{
|
||||||
|
return $dir['basename'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GoogleDriveFile::findByPathInDrive($newPath,$dir['basename']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function createByPathInDrive($path,$current_directory = '/')
|
||||||
|
{
|
||||||
|
if ($path != "")
|
||||||
|
{
|
||||||
|
$exploded_path = explode('/',$path);
|
||||||
|
$size = count($exploded_path);
|
||||||
|
if ($size > 1)
|
||||||
|
{
|
||||||
|
$parent = self::findByName($exploded_path[$size-2]);
|
||||||
|
\Storage::cloud()->createDir($parent->id.'/'.$exploded_path[$size-1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
\Storage::cloud()->createDir('/'.$exploded_path[$size-1]);
|
||||||
|
}
|
||||||
|
return self::findByPathInDrive($path);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPermission($subject, $value)
|
||||||
|
{
|
||||||
|
$explodedSubject = explode('.',$subject);
|
||||||
|
$subject = $explodedSubject[0];
|
||||||
|
$id = $explodedSubject[1];
|
||||||
|
|
||||||
|
$permission = null;
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$permission = $this->rank_permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'job')
|
||||||
|
{
|
||||||
|
$permission = $this->job_permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'user')
|
||||||
|
{
|
||||||
|
$permission = $this->user_permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
[$id] = $value;
|
||||||
|
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$this->rank_permission = $permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'job')
|
||||||
|
{
|
||||||
|
$this->job_permission = $permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'user')
|
||||||
|
{
|
||||||
|
$this->user_permission = $permission;
|
||||||
|
}
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllPermission($subject)
|
||||||
|
{
|
||||||
|
$permission = null;
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$permission = $this->rank_permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'job')
|
||||||
|
{
|
||||||
|
$permission = $this->job_permission;
|
||||||
|
}
|
||||||
|
elseif ($subject == 'user')
|
||||||
|
{
|
||||||
|
$permission = $this->user_permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPermission($subject)
|
||||||
|
{
|
||||||
|
$explodedSubject = explode('.',$subject);
|
||||||
|
$subject = $explodedSubject[0];
|
||||||
|
$id = $explodedSubject[1];
|
||||||
|
|
||||||
|
if (isset($this->getAllPermission($subject)[$id]))
|
||||||
|
{
|
||||||
|
return $this->getAllPermission($subject)[$id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canUser($user, $permission = 'r')
|
||||||
|
{
|
||||||
|
if (strpos($this->getPermission('rank.0'),$permission) !== false)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (strpos($this->getPermission('user.'.$user->id),$permission) === false)
|
||||||
|
{
|
||||||
|
if (strpos($this->getPermission('job.'.$user->job->id),$permission) === false)
|
||||||
|
{
|
||||||
|
if (strpos($this->getPermission('rank.'.$user->rank->id),$permission) === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canAuthUser($perm = 'r')
|
||||||
|
{
|
||||||
|
return $this->canUser(\Auth::user(),$perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPermForUser($folder,$user,$perm = 'r')
|
||||||
|
{
|
||||||
|
if ($folder == '' || $folder == "root")
|
||||||
|
{
|
||||||
|
if ($user->p('file_manage') == 1)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$dir = \App\GoogleDriveFile::find($folder);
|
||||||
|
if ($dir == null)
|
||||||
|
{
|
||||||
|
$path = GoogleDriveFile::getPathFolder($folder);
|
||||||
|
$exploderPath = explode('/',$path);
|
||||||
|
for ($i = count($exploderPath)-1; $i >= 0; $i--)
|
||||||
|
{
|
||||||
|
$dir = \App\GoogleDriveFile::find($exploderPath[$i]);
|
||||||
|
if ($dir != null)
|
||||||
|
{
|
||||||
|
$metaData = \Storage::cloud()->getMetadata($folder);
|
||||||
|
$googleDriveFile = new GoogleDriveFile();
|
||||||
|
$googleDriveFile->id = $folder;
|
||||||
|
$googleDriveFile->type = 'directory';
|
||||||
|
$googleDriveFile->name = $metaData['name'];
|
||||||
|
$googleDriveFile->path = self::recreatePath($folder);
|
||||||
|
$googleDriveFile->rank_permission = $dir->rank_permission;
|
||||||
|
$googleDriveFile->job_permission = $dir->job_permission;
|
||||||
|
$googleDriveFile->user_permission = $dir->user_permission;
|
||||||
|
$googleDriveFile->save();
|
||||||
|
return $dir->canUser($user,$perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $dir->canUser($user,$perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPermForAuthUser($folder,$perm = 'r')
|
||||||
|
{
|
||||||
|
return self::getPermForUser($folder,\Auth::user(),$perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPathFolder($folder)
|
||||||
|
{
|
||||||
|
$allDir = \Storage::cloud()->allDirectories();
|
||||||
|
foreach ($allDir as $dir)
|
||||||
|
{
|
||||||
|
$exploderDir = explode('/',$dir);
|
||||||
|
if ($exploderDir[count($exploderDir)-1] == $folder)
|
||||||
|
{
|
||||||
|
return $dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function recreatePath($folder)
|
||||||
|
{
|
||||||
|
$path = [];
|
||||||
|
$name = [];
|
||||||
|
$directories = collect(json_decode(self::getPathArray(),true));
|
||||||
|
foreach ($directories as $dir)
|
||||||
|
{
|
||||||
|
$path[$dir['basename']] = $dir['dirname'];
|
||||||
|
$name[$dir['basename']] = $dir['name'];
|
||||||
|
}
|
||||||
|
$realPath = $name[$folder];
|
||||||
|
$foo = $folder;
|
||||||
|
while ($foo != "")
|
||||||
|
{
|
||||||
|
$bar = explode('/',$path[$foo]);
|
||||||
|
$foo = $bar[count($bar)-1];
|
||||||
|
if ($foo != "")
|
||||||
|
{
|
||||||
|
$realPath = $name[$foo].'/'.$realPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $realPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPathArray()
|
||||||
|
{
|
||||||
|
$contents = collect(Storage::cloud()->listContents('/', true));
|
||||||
|
return json_encode($contents->where('type', '=', 'dir'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getSidebarFile()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
$user = \Auth::user();
|
||||||
|
$sidebarArray = [];
|
||||||
|
$dirList = \App\GoogleDriveFile::all();
|
||||||
|
$temp = $dirList->where('path','=','.Privé/.Cadet')->first();
|
||||||
|
if ($temp != null)
|
||||||
|
{
|
||||||
|
if ($dirList->where('path','=','.Privé/.Cadet')->first()->canAuthUser())
|
||||||
|
{
|
||||||
|
$sidebarArray['Cadet'] = [
|
||||||
|
'route' => 'admin.files.cadet',
|
||||||
|
'icon' => 'fas fa-folder-open',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp = $dirList->where('path','=','.Privé/.Staff')->first();
|
||||||
|
if ($temp != null)
|
||||||
|
{
|
||||||
|
if ($dirList->where('path','=','.Privé/.Staff')->first()->canAuthUser())
|
||||||
|
{
|
||||||
|
$sidebarArray['Staff'] = [
|
||||||
|
'route' => 'admin.files.staff',
|
||||||
|
'icon' => 'fas fa-folder-open',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp = $dirList->where('path','=','.Privé/.ETAMAS')->first();
|
||||||
|
if ($temp != null)
|
||||||
|
{
|
||||||
|
if ($dirList->where('path','=','.Privé/.ETAMAS')->first()->canAuthUser())
|
||||||
|
{
|
||||||
|
$sidebarArray['ETAMAS'] = [
|
||||||
|
'route' => 'admin.files.etamas',
|
||||||
|
'icon' => 'fas fa-folder-open',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp = $dirList->where('path','=','.Privé/.Officier')->first();
|
||||||
|
if ($temp != null)
|
||||||
|
{
|
||||||
|
if ($dirList->where('path','=','.Privé/.Officier')->first()->canAuthUser())
|
||||||
|
{
|
||||||
|
$sidebarArray['Officier'] = [
|
||||||
|
'route' => 'admin.files.officier',
|
||||||
|
'icon' => 'fas fa-folder-open',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sidebarArray['Publique'] = [
|
||||||
|
'route' => 'admin.files.publique',
|
||||||
|
'icon' => 'fas fa-folder-open',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
if (\Auth::user()->p('drive_see') == 1)
|
||||||
|
{
|
||||||
|
$sidebarArray['Google Drive'] = [
|
||||||
|
'route' => 'admin.drive',
|
||||||
|
'icon' => 'fab fa-google-drive',
|
||||||
|
'perm' => null,
|
||||||
|
'child' => null
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $sidebarArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getDownloadURL($path,$file)
|
||||||
|
{
|
||||||
|
$dir = urlencode(\App\GoogleDriveFile::findByPath($path)->id);
|
||||||
|
return '/file/get?d='.$dir.'&f='.urlencode($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,32 +24,27 @@ class AdminController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
Log::saveLog('Affichage du tableau de bord');
|
clog('navigate','success','consulte le tableau de bord');
|
||||||
|
|
||||||
$futureEvent_to_filtered = \App\Schedule::all()->sortBy('date');
|
return view('admin.dashboard',['futureEvent' => \App\Event::future()->take(3),'userClasse' => \Auth::user()->futureCourses()->forPage(1,6)]);
|
||||||
$futureEvent_to_filtered_pass_1 = collect();
|
|
||||||
$futureEvent = collect();
|
|
||||||
|
|
||||||
foreach ($futureEvent_to_filtered as $day) {
|
|
||||||
if ($day->date >= date('Y-m-d')) {
|
|
||||||
$futureEvent_to_filtered_pass_1->push($day);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($futureEvent_to_filtered_pass_1 as $day) {
|
|
||||||
if ($day->date <= date('Y-m-d',strtotime("+2 week"))) {
|
|
||||||
$futureEvent->push($day);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return view('admin.dashboard',['futureEvent' => $futureEvent,'userClasse' => \Auth::User()->getClasse()->forPage(1,6)]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
Log::saveLog('Affichage des notes de mise a jour');
|
clog('navigate','success','consulte les notes de mise à jours');
|
||||||
|
|
||||||
return view('admin.update');
|
return view('admin.update');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function status()
|
||||||
|
{
|
||||||
|
$alerts = \App\Event::checkForError();
|
||||||
|
return view('admin.status.index',['alerts' => $alerts]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function instruction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ArticleController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
clogNav('consulte les articles');
|
||||||
|
return view('admin.article.index',['activity' => \App\ComplementaryActivity::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function editActivity($id)
|
||||||
|
{
|
||||||
|
return view('admin.article.editActivity',['article' => \App\ComplementaryActivity::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateActivity(Request $request, $id)
|
||||||
|
{
|
||||||
|
$a = \App\ComplementaryActivity::find($id);
|
||||||
|
|
||||||
|
$a->public_slogan = $request->public_slogan;
|
||||||
|
$a->public_body = $request->public_body;
|
||||||
|
$a->public_header_picture = $request->public_header_picture;
|
||||||
|
|
||||||
|
$a->save();
|
||||||
|
clog('edit','success','a ajouté un article');
|
||||||
|
return redirect('/admin/article')->with('success','Article modifié avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pictureActivity($id)
|
||||||
|
{
|
||||||
|
return view('admin.article.pictureActivity',['article' => \App\ComplementaryActivity::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pictureActivityCreate($id)
|
||||||
|
{
|
||||||
|
return view('admin.article.picture.add',['article' => \App\ComplementaryActivity::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pictureActivityStore(Request $request, $id)
|
||||||
|
{
|
||||||
|
$p = new \App\Picture();
|
||||||
|
|
||||||
|
$p->url = $request->url;
|
||||||
|
$p->title = $request->title;
|
||||||
|
$p->desc = $request->desc;
|
||||||
|
$p->pictureable_id = $id;
|
||||||
|
$p->pictureable_type = "App\ComplementaryActivity";
|
||||||
|
|
||||||
|
$p->save();
|
||||||
|
clog('add','success','a ajouté une photo avec succès');
|
||||||
|
return redirect('/admin/article/activity/picture/'.$id)->with('success','Photo ajoutéé avec succès');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,12 +22,9 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
protected function redirectTo()
|
protected function redirectTo()
|
||||||
{
|
{
|
||||||
if(\Auth::User()->getAcces(2))
|
|
||||||
{
|
return '/admin';
|
||||||
return '/admin';
|
|
||||||
} else if(\Auth::User()->getAcces(1)){
|
|
||||||
return '/ecc';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Where to redirect users after login.
|
* Where to redirect users after login.
|
||||||
|
|||||||
@@ -0,0 +1,175 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Booking;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class BookingController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index($type, $id)
|
||||||
|
{
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'course':
|
||||||
|
$event = \App\Course::find($id);
|
||||||
|
$event->fulltime = $event->event->date_begin.', Niveau '.$event->level.', Période '.$event->periode;
|
||||||
|
$event->fulldesc = $event->ocom;
|
||||||
|
break;
|
||||||
|
case 'event':
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
$event->fulltime = $event->date_begin;
|
||||||
|
$event->fulldesc = $event->desc;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
clogNav('consulte les réservations');
|
||||||
|
return view('admin.booking.index',['event' => $event,'event_type' => $type,'event_id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function create($type,$id)
|
||||||
|
{
|
||||||
|
$event = null;
|
||||||
|
if($type == 'course')
|
||||||
|
{
|
||||||
|
$event = \App\Course::find($id)->event;
|
||||||
|
}
|
||||||
|
else if ($type == 'event')
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
}
|
||||||
|
return view('admin.booking.create',['items' => \App\Item::training(),'event_type' => $type,'event_id' => $id,'event' => $event]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request,$type,$id)
|
||||||
|
{
|
||||||
|
$b = new Booking();
|
||||||
|
|
||||||
|
$b->item_id = $request->item_id;
|
||||||
|
$b->amount = $request->amount;
|
||||||
|
$b->bookable_id = $id;
|
||||||
|
$b->user_id = \Auth::user()->id;
|
||||||
|
if (!$request->comment == '')
|
||||||
|
{
|
||||||
|
$b->comment = $request->comment;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$b->comment = 'Aucun commentaire';
|
||||||
|
}
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 'course':
|
||||||
|
$b->bookable_type = 'App\Course';
|
||||||
|
break;
|
||||||
|
case 'event':
|
||||||
|
$b->bookable_type = 'App\Event';
|
||||||
|
default:
|
||||||
|
$b->bookable_type = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$b->save();
|
||||||
|
clog('add','success','a ajouté une réservation avec succès',null,'App\Booking',$b->id);
|
||||||
|
return redirect('/admin/booking/course/'.$id)->with('success','Réservation ajouté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Booking $booking
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show(Booking $booking)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Booking $booking
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function edit(Booking $booking)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Booking $booking
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Booking $booking)
|
||||||
|
{
|
||||||
|
$b = Booking::find($request->booking_id);
|
||||||
|
$b->amount = $request->amount;
|
||||||
|
$b->comment = $request->comment;
|
||||||
|
|
||||||
|
$b->save();
|
||||||
|
return back()->with('success','Modification sauvegardé avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Booking $booking
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request)
|
||||||
|
{
|
||||||
|
$b = Booking::find($request->id);
|
||||||
|
|
||||||
|
$b->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function modalItem($id,$event_type,$event_id)
|
||||||
|
{
|
||||||
|
$event = null;
|
||||||
|
if ($event_type == 'course')
|
||||||
|
{
|
||||||
|
$event = \App\Course::find($event_id)->event;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($event_id);
|
||||||
|
}
|
||||||
|
return view('admin.booking.modal.create',['item' => \App\Item::find($id),'event' => $event]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function modalItemEdit($id,$event_type,$event_id)
|
||||||
|
{
|
||||||
|
$event = null;
|
||||||
|
if ($event_type == 'course')
|
||||||
|
{
|
||||||
|
$event = \App\Course::find($event_id)->event;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($event_id);
|
||||||
|
}
|
||||||
|
return view('admin.booking.modal.edit',['booking' => \App\Booking::find($id),'event' => $event]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,6 @@ class CalendarController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
Log::saveLog("Affichage de l'horaire");
|
|
||||||
|
|
||||||
$this->listClass();
|
$this->listClass();
|
||||||
|
|
||||||
@@ -134,8 +133,12 @@ class CalendarController extends Controller
|
|||||||
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'other':
|
||||||
|
echo '<div class="row" style="color:#DF0174;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-handshake-o fa-stack-1x fa-inverse"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
echo '<div class="row" style="color:#0B615E;"><span class="fa-stack fa-lg col-md-2"><i class="fa fa-circle fa-stack-2x"></i></span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
echo '<div class="row" style="color:'.\App\ComplementaryActivity::find($activity->type)->calendar_color.';"><span class="fa-stack fa-lg col-md-2">'.\App\ComplementaryActivity::find($activity->type)->calendar_icon.'</span><div class="col-md-10 calendar_event_name">'.ucfirst($activity->data['event_name'])."</div></div>";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
@@ -161,9 +164,6 @@ class CalendarController extends Controller
|
|||||||
|
|
||||||
$url = str_replace("-","_", $Requestdate);
|
$url = str_replace("-","_", $Requestdate);
|
||||||
|
|
||||||
/** Dont work ... API stuff
|
|
||||||
* Log::saveLog("a consulté l'horaire du ".$date);
|
|
||||||
**/
|
|
||||||
|
|
||||||
$today = Schedule::where('date','=',$Requestdate)->get();
|
$today = Schedule::where('date','=',$Requestdate)->get();
|
||||||
$isEmpty = $today->isEmpty();
|
$isEmpty = $today->isEmpty();
|
||||||
@@ -366,7 +366,11 @@ class CalendarController extends Controller
|
|||||||
$UserList = User::all();
|
$UserList = User::all();
|
||||||
$LocalList = Local::all();
|
$LocalList = Local::all();
|
||||||
|
|
||||||
return view('admin.calendar.calendar_add' ,['RequestDate' => $date, 'Userslist' => $UserList, 'LocalsList' => $LocalList]);
|
return view('admin.calendar.calendar_add' ,[
|
||||||
|
'RequestDate' => $date,
|
||||||
|
'Userslist' => $UserList,
|
||||||
|
'LocalsList' => $LocalList,
|
||||||
|
'ComplementaryActivity' => \App\ComplementaryActivity::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
@@ -442,8 +446,6 @@ class CalendarController extends Controller
|
|||||||
|
|
||||||
$schedule->save();
|
$schedule->save();
|
||||||
|
|
||||||
/** Logs and Notification */
|
|
||||||
Log::saveLog("Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
|
||||||
|
|
||||||
$userToNotify = $schedule->getUserToNotify();
|
$userToNotify = $schedule->getUserToNotify();
|
||||||
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
\Notification::send($userToNotify, new Alert(\Auth::User()->id,"Ajout de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date,"/admin/calendar"));
|
||||||
@@ -684,7 +686,6 @@ class CalendarController extends Controller
|
|||||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Modification d'une activité a l'horaire",\Auth::User()->fullname()." à modifié l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date."<br>".$string_Change));
|
\Notification::send($userToNotify, new mail(\Auth::User(),"Modification d'une activité a l'horaire",\Auth::User()->fullname()." à modifié l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date."<br>".$string_Change));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::saveLog("Modification de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
|
||||||
|
|
||||||
return redirect('/admin/calendar');
|
return redirect('/admin/calendar');
|
||||||
|
|
||||||
@@ -705,7 +706,6 @@ class CalendarController extends Controller
|
|||||||
\Notification::send($userToNotify, new mail(\Auth::User(),"Suppression d'une activité a l'horaire",\Auth::User()->fullname()." à supprimé l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
|
\Notification::send($userToNotify, new mail(\Auth::User(),"Suppression d'une activité a l'horaire",\Auth::User()->fullname()." à supprimé l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date));
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::saveLog("Suppression de l'activité, ".$schedule->data['event_name']." à l'horaire le ".$schedule->date);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,4 +737,10 @@ class CalendarController extends Controller
|
|||||||
|
|
||||||
return $filtered_classes;
|
return $filtered_classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$date = request('date');
|
||||||
|
return view('admin.calendar.modal.show',['schedules' => \App\Schedule::all()->where('date',$date),'date' => $date]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ class ComplementaryActivityController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('public.activity');
|
clogNav('consulte les configurations d\'activité');
|
||||||
|
return view('admin.configs.activity',['configs' => \App\Config::all(),'activities' => \App\ComplementaryActivity::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +25,7 @@ class ComplementaryActivityController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
//
|
return view('admin.configs.activity-add');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,9 +34,42 @@ class ComplementaryActivityController extends Controller
|
|||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store()
|
||||||
{
|
{
|
||||||
//
|
$activity = new ComplementaryActivity();
|
||||||
|
|
||||||
|
$activity->name = request('name');
|
||||||
|
$activity->admin_desc = request('admin_desc');
|
||||||
|
$activity->public_body = 'Veuillez modifier le text de description publique par défaut';
|
||||||
|
$activity->calendar_color = request('calendar_color');
|
||||||
|
$activity->calendar_icon = request('calendar_icon');
|
||||||
|
$activity->begin_time = request('begin_time');
|
||||||
|
$activity->end_time = request('end_time');
|
||||||
|
$activity->location = request('location');
|
||||||
|
$activity->public_slogan = "Veuillez modifier le slogan publique par défaut";
|
||||||
|
$activity->public_header_picture = "./assets/img/bg2.jpg";
|
||||||
|
$activity->location = request('location');
|
||||||
|
$activity->location = request('location');
|
||||||
|
if(request('is_mandatory') == 'on')
|
||||||
|
{
|
||||||
|
$activity->is_mandatory = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity->is_mandatory = false;
|
||||||
|
}
|
||||||
|
if(request('is_promoted') == 'on')
|
||||||
|
{
|
||||||
|
$activity->is_promoted = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity->is_promoted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activity->save();
|
||||||
|
clog('add','success','a ajouté une activité',null,'App\ComplementaryActivity',$activity->id);
|
||||||
|
return redirect('/admin/config/activity')->with('success','Activité ajouté avec succes');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,9 +78,9 @@ class ComplementaryActivityController extends Controller
|
|||||||
* @param \App\ComplementaryActivity $complementaryActivity
|
* @param \App\ComplementaryActivity $complementaryActivity
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(ComplementaryActivity $complementaryActivity)
|
public function show($id)
|
||||||
{
|
{
|
||||||
//
|
return view('public.activity',['activity' => ComplementaryActivity::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,9 +89,9 @@ class ComplementaryActivityController extends Controller
|
|||||||
* @param \App\ComplementaryActivity $complementaryActivity
|
* @param \App\ComplementaryActivity $complementaryActivity
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function edit(ComplementaryActivity $complementaryActivity)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
//
|
return view('admin.configs.activity-edit',['activity' => \App\ComplementaryActivity::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,9 +101,37 @@ class ComplementaryActivityController extends Controller
|
|||||||
* @param \App\ComplementaryActivity $complementaryActivity
|
* @param \App\ComplementaryActivity $complementaryActivity
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, ComplementaryActivity $complementaryActivity)
|
public function update($id)
|
||||||
{
|
{
|
||||||
//
|
$activity = ComplementaryActivity::find($id);
|
||||||
|
|
||||||
|
$activity->name = request('name');
|
||||||
|
$activity->admin_desc = request('admin_desc');
|
||||||
|
$activity->calendar_color = request('calendar_color');
|
||||||
|
$activity->calendar_icon = request('calendar_icon');
|
||||||
|
$activity->begin_time = request('begin_time');
|
||||||
|
$activity->end_time = request('end_time');
|
||||||
|
$activity->location = request('location');
|
||||||
|
if(request('is_mandatory') == 'true')
|
||||||
|
{
|
||||||
|
$activity->is_mandatory = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity->is_mandatory = false;
|
||||||
|
}
|
||||||
|
if(request('is_promoted') == 'true')
|
||||||
|
{
|
||||||
|
$activity->is_promoted = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$activity->is_promoted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$activity->save();
|
||||||
|
clog('edit','success','a modifié une activité',null,'App\ComplementaryActivity',$activity->id);
|
||||||
|
return redirect('/admin/config/activity')->with('success','Modification sauvegarder avec succes');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,8 +140,13 @@ class ComplementaryActivityController extends Controller
|
|||||||
* @param \App\ComplementaryActivity $complementaryActivity
|
* @param \App\ComplementaryActivity $complementaryActivity
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function destroy(ComplementaryActivity $complementaryActivity)
|
public function destroy()
|
||||||
{
|
{
|
||||||
//
|
$id = request('id');
|
||||||
|
|
||||||
|
$activity = ComplementaryActivity::find($id);
|
||||||
|
|
||||||
|
clog('delete','success','a supprimé une activité',null,'App\ComplementaryActivity',$id);
|
||||||
|
$activity->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Config;
|
use App\Config;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use phpDocumentor\Reflection\Types\Boolean;
|
||||||
|
|
||||||
class ConfigController extends Controller
|
class ConfigController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
@@ -14,9 +16,32 @@ class ConfigController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
clogNav('consulte les configurations');
|
||||||
return view ('admin.configs.general',['configs' => Config::all()]);
|
return view ('admin.configs.general',['configs' => Config::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function customisation()
|
||||||
|
{
|
||||||
|
return view ('admin.configs.perso',['configs' => Config::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function customisationUpdate()
|
||||||
|
{
|
||||||
|
$configs = [
|
||||||
|
'public_index_img_url'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($configs as $config) {
|
||||||
|
$c = \App\Config::all()->where('name',$config)->first();
|
||||||
|
$c->data = [request($config)];
|
||||||
|
$c->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
clog('edit','success','a modifié la configuration');
|
||||||
|
|
||||||
|
return redirect('/admin/config/customisation')->with('success','Modification sauvegarder avec succès !');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
@@ -69,17 +94,31 @@ class ConfigController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function update()
|
public function update()
|
||||||
{
|
{
|
||||||
$config = Config::all()->where('name',request('perm'))->first();
|
$configs = [
|
||||||
|
'is_schedule_public',
|
||||||
|
'is_schedule_build',
|
||||||
|
'escadron_name_full',
|
||||||
|
'escadron_name_short',
|
||||||
|
'escadron_number',
|
||||||
|
'escadron_phone',
|
||||||
|
'escadron_element',
|
||||||
|
'element_title',
|
||||||
|
'escadron_address',
|
||||||
|
'escadron_direct_googlemap_link',
|
||||||
|
'media_facebook',
|
||||||
|
'media_twitter',
|
||||||
|
'media_instagram',
|
||||||
|
'media_email',
|
||||||
|
|
||||||
if (request('value') == "true") {
|
];
|
||||||
$config->state = 1;
|
|
||||||
} else {
|
foreach ($configs as $config) {
|
||||||
$config->state = 0;
|
$c = \App\Config::all()->where('name',$config)->first();
|
||||||
|
$c->data = [request($config)];
|
||||||
|
$c->save();
|
||||||
}
|
}
|
||||||
|
clog('edit','success','a modifié la configuration');
|
||||||
$config->save();
|
return redirect('/admin/config')->with('success','Modification sauvegarder avec succès !');
|
||||||
|
|
||||||
\App\Log::saveLog('Modification de la configuration du site');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,4 +131,55 @@ class ConfigController extends Controller
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showfilesConfig()
|
||||||
|
{
|
||||||
|
$error = [];
|
||||||
|
return view('admin.configs.file',['configs' => Config::all(),'error' => $error]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editfilesConfig()
|
||||||
|
{
|
||||||
|
$configList = [
|
||||||
|
'cadet_list',
|
||||||
|
];
|
||||||
|
|
||||||
|
$configListEncrypt = [
|
||||||
|
'GOOGLE_DRIVE_CLIENT_ID',
|
||||||
|
'GOOGLE_DRIVE_CLIENT_SECRET',
|
||||||
|
'GOOGLE_DRIVE_REFRESH_TOKEN',
|
||||||
|
'GOOGLE_DRIVE_FOLDER_ID'
|
||||||
|
];
|
||||||
|
|
||||||
|
if (\request('is_active') == 'on')
|
||||||
|
{
|
||||||
|
$config = \App\Config::find('is_Google_Drive_enabled');
|
||||||
|
$config->data = ['true'];
|
||||||
|
$config->save();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$config = \App\Config::find('is_Google_Drive_enabled');
|
||||||
|
$config->data = ['false'];
|
||||||
|
$config->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($configList as $configName)
|
||||||
|
{
|
||||||
|
$config = \App\Config::find($configName);
|
||||||
|
$config->data = [\request($configName)];
|
||||||
|
$config->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($configListEncrypt as $configName)
|
||||||
|
{
|
||||||
|
$config = \App\Config::find($configName);
|
||||||
|
$config->data = [\Crypt::encryptString(\request($configName))];
|
||||||
|
$config->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
clog('edit','success','a modifié la configuration des fichiers');
|
||||||
|
return redirect('/admin/config/files')->with('success','Modification sauvegarder avec succès !');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Course;
|
||||||
|
use App\GoogleDriveFile;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class CourseController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$mode = 'future';
|
||||||
|
if (\request('all'))
|
||||||
|
{
|
||||||
|
$courses = Course::all();
|
||||||
|
$mode = 'all';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$courses = Course::allFuture();
|
||||||
|
}
|
||||||
|
foreach ($courses as $course)
|
||||||
|
{
|
||||||
|
if($course->ocom() != null)
|
||||||
|
{
|
||||||
|
$course->ocom()->updateWasGiven();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view('admin.course.index',['courses' => $courses,'mode' => $mode]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$course = Course::find($id);
|
||||||
|
$user = \App\User::find($course->user_id);
|
||||||
|
$name = $course->user_id;
|
||||||
|
if ($user != null)
|
||||||
|
{
|
||||||
|
$name = $user->fullname();
|
||||||
|
}
|
||||||
|
return view('admin.course.show',['course' => $course,'username' => $name,'lessonPlanDir' => \App\GoogleDriveFile::findByPath('.Systeme/.Fichier/.PlanDeCours')->id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param Course $course
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Course $course)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param Course $course
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Course $course)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCommentOfficer(Request $request, $id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
|
||||||
|
$course->comment_officer = $request->comment_officer;
|
||||||
|
$course->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregisté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateComment(Request $request, $id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
|
||||||
|
$course->comment = $request->comment;
|
||||||
|
$course->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregisté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCommentOfficerPlan(Request $request, $id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
|
||||||
|
$course->lessonPlan->comment = $request->comment_officer;
|
||||||
|
$course->lessonPlan->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregisté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateCommentPlan(Request $request, $id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
|
||||||
|
$course->lessonPlan->desc = $request->comment;
|
||||||
|
$course->lessonPlan->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregisté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateLessonPlan(Request $request, $id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
$name = $course->ocom.'_'.$course->instructor().'_'.$course->event->date_begin.'_'.'v'.date('c').'.'.\request()->file('file')->getClientOriginalExtension();
|
||||||
|
$name = urlencode($name);
|
||||||
|
$dirID = \App\GoogleDriveFile::findByPath('.Systeme/.Fichier/.PlanDeCours')->id;
|
||||||
|
|
||||||
|
if ($course->lessonPlan != null)
|
||||||
|
{
|
||||||
|
$lessonPlan = $course->lessonPlan;
|
||||||
|
$contents = collect(\Storage::cloud()->listContents($dirID, false));
|
||||||
|
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($course->lessonPlan->file, PATHINFO_FILENAME))
|
||||||
|
->where('extension', '=', pathinfo($course->lessonPlan->file, PATHINFO_EXTENSION))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
\Storage::cloud()->delete($file['path']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lessonPlan = new \App\LessonPlan();
|
||||||
|
}
|
||||||
|
\Storage::cloud()->putFileAs($dirID,\request()->file('file'),$name);
|
||||||
|
$metadata = \Storage::cloud()->getMetadata($dirID.'/'.$name);
|
||||||
|
|
||||||
|
$lessonPlan->user_id = \Auth::user()->id;
|
||||||
|
$lessonPlan->file = $metadata['name'];
|
||||||
|
$lessonPlan->course_id = $course->id;
|
||||||
|
$lessonPlan->desc = "";
|
||||||
|
$lessonPlan->comment = "";
|
||||||
|
$lessonPlan->save();
|
||||||
|
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param Course $course
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Course $course)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function validatePlan($id)
|
||||||
|
{
|
||||||
|
$course = Course::findOrFail($id);
|
||||||
|
if ($course->lessonPlan)
|
||||||
|
{
|
||||||
|
if ($course->lessonPlan->approved)
|
||||||
|
{
|
||||||
|
$course->lessonPlan->approved = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$course->lessonPlan->approved = true;
|
||||||
|
}
|
||||||
|
$course->lessonPlan->save();
|
||||||
|
return strval($course->lessonPlan->approved);
|
||||||
|
}
|
||||||
|
return abort(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,425 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Course;
|
||||||
|
use App\Event;
|
||||||
|
use App\EventType;
|
||||||
|
use App\GoogleDriveFile;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
class EventController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
$event = new Event();
|
||||||
|
|
||||||
|
if (\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
if (\request()->hasFile('files'))
|
||||||
|
{
|
||||||
|
$dir = \App\GoogleDriveFile::findByPath('.Systeme/.Fichier/.MessageDeLaSemaine');
|
||||||
|
$files = [];
|
||||||
|
foreach (\request()->file('files') as $f)
|
||||||
|
{
|
||||||
|
$name = urlencode(pathinfo($f->getClientOriginalName())['filename'].'_'.uniqid().'.'.$f->getClientOriginalExtension());
|
||||||
|
\Storage::cloud()->putFileAs($dir->id,$f,$name);
|
||||||
|
array_push($files,$name);
|
||||||
|
}
|
||||||
|
$event->weekly_msg_file = $files;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->weekly_msg_file = [''];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$event->weekly_msg_file = [''];
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->name = request('name');
|
||||||
|
$event->date_begin = request('begin_time');
|
||||||
|
$event->date_end = request('end_time');
|
||||||
|
$event->type = request('type');
|
||||||
|
$event->user_id = \Auth::user()->id;
|
||||||
|
$event->location = request('location');
|
||||||
|
|
||||||
|
if(request('is_mandatory') != null){
|
||||||
|
$event->is_mandatory = 1;
|
||||||
|
} else {
|
||||||
|
$event->is_mandatory = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->desc = \request('admin_desc');
|
||||||
|
|
||||||
|
if(\request("use_weekly_msg"))
|
||||||
|
{
|
||||||
|
$event->use_weekly_msg = 1;
|
||||||
|
$event->weekly_msg_publication_time = \request('date_msg');
|
||||||
|
$event->msg = request('admin_desc');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->use_weekly_msg = 0;
|
||||||
|
$event->weekly_msg_publication_time = "";
|
||||||
|
$event->msg = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(\request("use_schedule"))
|
||||||
|
{
|
||||||
|
$event->use_schedule = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->use_schedule = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->calendar_color = \request('calendar_color');
|
||||||
|
$event->calendar_icon = \request('calendar_icon');
|
||||||
|
|
||||||
|
$nbLevel = 1;
|
||||||
|
$niveaux = [];
|
||||||
|
while (\request('level_name_'.$nbLevel))
|
||||||
|
{
|
||||||
|
array_push($niveaux,['name' => \request('level_name_'.$nbLevel)]);
|
||||||
|
$nbLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nbPeriode = 1;
|
||||||
|
$periodes = [];
|
||||||
|
while (\request('periode_name_'.$nbPeriode))
|
||||||
|
{
|
||||||
|
array_push($periodes,[
|
||||||
|
'name' => \request('periode_name_'.$nbPeriode),
|
||||||
|
'begin_time' => \request('periode_begin_time_'.$nbPeriode),
|
||||||
|
'end_time' => \request('periode_end_time_'.$nbPeriode)
|
||||||
|
]);
|
||||||
|
$nbPeriode++;
|
||||||
|
}
|
||||||
|
$event->schedule = [
|
||||||
|
'periodes' => $periodes,
|
||||||
|
'niveaux' => $niveaux,
|
||||||
|
'courses' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
$event->save();
|
||||||
|
|
||||||
|
if ($event->use_schedule) {
|
||||||
|
for ($l=1; $l < $nbLevel; $l++) {
|
||||||
|
for ($p=1; $p < $nbPeriode; $p++) {
|
||||||
|
|
||||||
|
$course = new \App\Course();
|
||||||
|
|
||||||
|
$users = \App\User::all();
|
||||||
|
$instructor = request('instruc_n'.$l.'_p'.$p);
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
|
||||||
|
{
|
||||||
|
$instructor = $user->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$course->user_id = $instructor;
|
||||||
|
$course->location = request('location_n'.$l.'_p'.$p);
|
||||||
|
$course->periode = $p;
|
||||||
|
$course->level = $l;
|
||||||
|
|
||||||
|
$course->event_id = $event->id;
|
||||||
|
|
||||||
|
if(\request("use_course_n".$l."_p".$p) == 'on')
|
||||||
|
{
|
||||||
|
$course->name = request('name_n'.$l.'_p'.$p);
|
||||||
|
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||||
|
$course->desc = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$course->name = "";
|
||||||
|
$course->ocom = "";
|
||||||
|
if (request('desc_n'.$l.'_p'.$p) == null)
|
||||||
|
{
|
||||||
|
$course->desc = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$course->desc = request('desc_n'.$l.'_p'.$p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$course->comment_officer = "";
|
||||||
|
$course->comment = "";
|
||||||
|
$course->save();
|
||||||
|
|
||||||
|
$ocom = \App\OCOM::where('ocom','=',request('ocom_n'.$l.'_p'.$p))->first();
|
||||||
|
if ($ocom != null)
|
||||||
|
{
|
||||||
|
$foo = $ocom->courses();
|
||||||
|
$foo->push($course);
|
||||||
|
$ocom->saveCourses($foo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clog('add','success','a ajouté un évènement',null,'App\Event',$event->id);
|
||||||
|
return redirect('/admin/schedule')->with('success','Événement ajouter à l\'horaire');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Event $event
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show(Event $event)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.event.edit',['event' => \App\Event::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Event $event
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
$event = Event::findOrFail($id);
|
||||||
|
|
||||||
|
// if (\App\GoogleDriveFile::checkConfig())
|
||||||
|
// {
|
||||||
|
// if (\request()->hasFile('files'))
|
||||||
|
// {
|
||||||
|
// $dir = \App\GoogleDriveFile::findByPath('.Systeme/.Fichier/.MessageDeLaSemaine');
|
||||||
|
// $files = [];
|
||||||
|
// foreach (\request()->file('files') as $f)
|
||||||
|
// {
|
||||||
|
// $name = urlencode(pathinfo($f->getClientOriginalName())['filename'].'_'.uniqid().'.'.$f->getClientOriginalExtension());
|
||||||
|
// \Storage::cloud()->putFileAs($dir->id,$f,$name);
|
||||||
|
// array_push($files,$name);
|
||||||
|
// }
|
||||||
|
// $event->weekly_msg_file = $files;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// $event->weekly_msg_file = [''];
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// $event->weekly_msg_file = [''];
|
||||||
|
// }
|
||||||
|
|
||||||
|
$event->name = request('name');
|
||||||
|
$event->date_begin = request('begin_time');
|
||||||
|
$event->date_end = request('end_time');
|
||||||
|
$event->user_id = \Auth::user()->id;
|
||||||
|
$event->location = request('location');
|
||||||
|
|
||||||
|
if(request('is_mandatory') != null){
|
||||||
|
$event->is_mandatory = 1;
|
||||||
|
} else {
|
||||||
|
$event->is_mandatory = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->desc = \request('admin_desc');
|
||||||
|
|
||||||
|
if(\request("use_weekly_msg"))
|
||||||
|
{
|
||||||
|
$event->use_weekly_msg = 1;
|
||||||
|
$event->weekly_msg_publication_time = \request('date_msg');
|
||||||
|
$event->msg = request('admin_desc');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->use_weekly_msg = 0;
|
||||||
|
$event->weekly_msg_publication_time = "";
|
||||||
|
$event->msg = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(\request("use_schedule"))
|
||||||
|
{
|
||||||
|
$event->use_schedule = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->use_schedule = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$event->calendar_color = \request('calendar_color');
|
||||||
|
$event->calendar_icon = \request('calendar_icon');
|
||||||
|
|
||||||
|
$nbLevel = 1;
|
||||||
|
$niveaux = [];
|
||||||
|
while (\request('level_name_'.$nbLevel))
|
||||||
|
{
|
||||||
|
array_push($niveaux,['name' => \request('level_name_'.$nbLevel)]);
|
||||||
|
$nbLevel++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nbPeriode = 1;
|
||||||
|
$periodes = [];
|
||||||
|
while (\request('periode_name_'.$nbPeriode))
|
||||||
|
{
|
||||||
|
array_push($periodes,[
|
||||||
|
'name' => \request('periode_name_'.$nbPeriode),
|
||||||
|
'begin_time' => \request('periode_begin_time_'.$nbPeriode),
|
||||||
|
'end_time' => \request('periode_end_time_'.$nbPeriode)
|
||||||
|
]);
|
||||||
|
$nbPeriode++;
|
||||||
|
}
|
||||||
|
$event->schedule = [
|
||||||
|
'periodes' => $periodes,
|
||||||
|
'niveaux' => $niveaux,
|
||||||
|
'courses' => []
|
||||||
|
];
|
||||||
|
|
||||||
|
$event->save();
|
||||||
|
|
||||||
|
if ($event->use_schedule) {
|
||||||
|
for ($l=1; $l < $nbLevel; $l++) {
|
||||||
|
for ($p=1; $p < $nbPeriode; $p++) {
|
||||||
|
|
||||||
|
$course = $event->course($p,$l);
|
||||||
|
if ($course == null)
|
||||||
|
{
|
||||||
|
$course = new Course();
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = \App\User::all();
|
||||||
|
$instructor = request('instruc_n'.$l.'_p'.$p);
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
if($user->fullname() == request('instruc_n'.$l.'_p'.$p))
|
||||||
|
{
|
||||||
|
$instructor = $user->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$course->user_id = $instructor;
|
||||||
|
$course->location = request('location_n'.$l.'_p'.$p);
|
||||||
|
$course->periode = $p;
|
||||||
|
$course->level = $l;
|
||||||
|
|
||||||
|
$course->event_id = $event->id;
|
||||||
|
|
||||||
|
if(\request("use_course_n".$l."_p".$p) == 'on')
|
||||||
|
{
|
||||||
|
$course->name = request('name_n'.$l.'_p'.$p);
|
||||||
|
$course->ocom = request('ocom_n'.$l.'_p'.$p);
|
||||||
|
$course->desc = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$course->name = "";
|
||||||
|
$course->ocom = "";
|
||||||
|
if (request('desc_n'.$l.'_p'.$p) == null)
|
||||||
|
{
|
||||||
|
$course->desc = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$course->desc = request('desc_n'.$l.'_p'.$p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$course->comment_officer = "";
|
||||||
|
$course->comment = "";
|
||||||
|
$course->save();
|
||||||
|
|
||||||
|
$ocom = \App\OCOM::where('ocom','=',request('ocom_n'.$l.'_p'.$p))->first();
|
||||||
|
if ($ocom != null)
|
||||||
|
{
|
||||||
|
$foo = $ocom->courses();
|
||||||
|
$foo->push($course);
|
||||||
|
$ocom->saveCourses($foo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clog('add','success','a modifier un évènement',null,'App\Event',$event->id);
|
||||||
|
return redirect('/admin/schedule')->with('success','Événement modifier à l\'horaire');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Event $event
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy(Event $event)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkEvent()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toJson($id)
|
||||||
|
{
|
||||||
|
$event = Event::findOrFail($id);
|
||||||
|
$model = $event->schedule;
|
||||||
|
$default_value = [];
|
||||||
|
if ($event->use_schedule == 1) {
|
||||||
|
foreach ($model['periodes'] as $periode_index => $periode)
|
||||||
|
{
|
||||||
|
$niveau_array = [];
|
||||||
|
foreach ($model['niveaux'] as $niveau_index => $niveau)
|
||||||
|
{
|
||||||
|
$course = $event->course($periode_index+1,$niveau_index+1);
|
||||||
|
$use_course = "on";
|
||||||
|
if ($course->name == null) {
|
||||||
|
$use_course = "off";
|
||||||
|
}
|
||||||
|
array_push($niveau_array,[
|
||||||
|
'ocom' => $course->ocom,
|
||||||
|
'name' => $course->name,
|
||||||
|
'location' => $course->location,
|
||||||
|
'instructor' => $course->instructor(),
|
||||||
|
'desc' => $course->desc,
|
||||||
|
'use_course' => $use_course
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
array_push($default_value,$niveau_array);
|
||||||
|
}
|
||||||
|
$model['default_value'] = $default_value;
|
||||||
|
}
|
||||||
|
$event->schedule_model = $model;
|
||||||
|
return $event->toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\EventType;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EventTypeController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.event_type.create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$eventType = new EventType();
|
||||||
|
$eventType->name = $request->name;
|
||||||
|
$eventType->location = $request->location;
|
||||||
|
$eventType->begin_time = $request->begin_time;
|
||||||
|
$eventType->end_time = $request->end_time;
|
||||||
|
$eventType->calendar_icon = $request->calendar_icon;
|
||||||
|
$eventType->calendar_color = $request->calendar_color;
|
||||||
|
$eventType->admin_desc = $request->admin_desc;
|
||||||
|
|
||||||
|
if ($request->use_weekly_msg == 'on')
|
||||||
|
{
|
||||||
|
$eventType->use_weekly_msg = 1;
|
||||||
|
$eventType->weekly_msg_publication_time = $request->weekly_msg_publication_time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->use_weekly_msg = 0;
|
||||||
|
$eventType->weekly_msg_publication_time = '';
|
||||||
|
}
|
||||||
|
if ($request->use_schedule == 'on')
|
||||||
|
{
|
||||||
|
$eventType->use_schedule = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->use_schedule = 0;
|
||||||
|
}
|
||||||
|
if ($request->is_mandatory == 'on')
|
||||||
|
{
|
||||||
|
$eventType->is_mandatory = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->is_mandatory = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nbOfLevel = 1;
|
||||||
|
while (\request('level_name_'.$nbOfLevel))
|
||||||
|
{
|
||||||
|
$nbOfLevel++;
|
||||||
|
}
|
||||||
|
$nbOfLevel = $nbOfLevel-1;
|
||||||
|
|
||||||
|
$nbOfPeriode = 1;
|
||||||
|
while (\request('periode_name_'.$nbOfPeriode))
|
||||||
|
{
|
||||||
|
$nbOfPeriode++;
|
||||||
|
}
|
||||||
|
$nbOfPeriode = $nbOfPeriode -1;
|
||||||
|
|
||||||
|
$model = [];
|
||||||
|
for ($x = 1; $x <= $nbOfPeriode; $x++) {
|
||||||
|
$model['periodes'][$x-1] = [
|
||||||
|
'name' => \Request('periode_name_'.$x),
|
||||||
|
'begin_time' => \Request('periode_begin_time_'.$x),
|
||||||
|
'end_time' => \Request('periode_end_time_'.$x)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
for ($i = 1; $i <= $nbOfLevel; $i++) {
|
||||||
|
$model['niveaux'][$i-1] = [
|
||||||
|
'name' => \Request('level_name_'.$i)
|
||||||
|
];
|
||||||
|
|
||||||
|
for ($x = 1; $x <= $nbOfPeriode; $x++) {
|
||||||
|
$model['default_value'][$x-1][$i-1] = [
|
||||||
|
'ocom' => \Request('ocom_n'.$i.'_p'.$x),
|
||||||
|
'name' => \Request('name_n'.$i.'_p'.$x),
|
||||||
|
'location' => \Request('location_n'.$i.'_p'.$x),
|
||||||
|
'instructor' => \Request('instruc_n'.$i.'_p'.$x),
|
||||||
|
'desc' => \Request('desc_n'.$i.'_p'.$x),
|
||||||
|
'use_course' => \Request('use_course_n'.$i.'_p'.$x),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$eventType->schedule_model = $model;
|
||||||
|
$eventType->save();
|
||||||
|
return redirect('/admin/config/instruction')->with('success','Type d\'évenement ajouté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\EventType $eventType
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$event_type = EventType::findOrFail($id);
|
||||||
|
return view('admin.event_type.show',['event_type' => $event_type]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\EventType $eventType
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(EventType $eventType)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\EventType $eventType
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$eventType = EventType::findOrFail($id);
|
||||||
|
|
||||||
|
$eventType->name = $request->name;
|
||||||
|
$eventType->location = $request->location;
|
||||||
|
$eventType->begin_time = $request->begin_time;
|
||||||
|
$eventType->end_time = $request->end_time;
|
||||||
|
$eventType->calendar_icon = $request->calendar_icon;
|
||||||
|
$eventType->calendar_color = $request->calendar_color;
|
||||||
|
$eventType->admin_desc = $request->admin_desc;
|
||||||
|
|
||||||
|
if ($request->use_weekly_msg == 'on')
|
||||||
|
{
|
||||||
|
$eventType->use_weekly_msg = 1;
|
||||||
|
$eventType->weekly_msg_publication_time = $request->weekly_msg_publication_time;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->use_weekly_msg = 0;
|
||||||
|
$eventType->weekly_msg_publication_time = '';
|
||||||
|
}
|
||||||
|
if ($request->use_schedule == 'on')
|
||||||
|
{
|
||||||
|
$eventType->use_schedule = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->use_schedule = 0;
|
||||||
|
}
|
||||||
|
if ($request->is_mandatory == 'on')
|
||||||
|
{
|
||||||
|
$eventType->is_mandatory = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$eventType->is_mandatory = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$nbOfLevel = 1;
|
||||||
|
while (\request('level_name_'.$nbOfLevel))
|
||||||
|
{
|
||||||
|
$nbOfLevel++;
|
||||||
|
}
|
||||||
|
$nbOfLevel = $nbOfLevel-1;
|
||||||
|
|
||||||
|
$nbOfPeriode = 1;
|
||||||
|
while (\request('periode_name_'.$nbOfPeriode))
|
||||||
|
{
|
||||||
|
$nbOfPeriode++;
|
||||||
|
}
|
||||||
|
$nbOfPeriode = $nbOfPeriode -1;
|
||||||
|
|
||||||
|
$model = [];
|
||||||
|
for ($x = 1; $x <= $nbOfPeriode; $x++) {
|
||||||
|
$model['periodes'][$x-1] = [
|
||||||
|
'name' => \Request('periode_name_'.$x),
|
||||||
|
'begin_time' => \Request('periode_begin_time_'.$x),
|
||||||
|
'end_time' => \Request('periode_end_time_'.$x)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
for ($i = 1; $i <= $nbOfLevel; $i++) {
|
||||||
|
$model['niveaux'][$i-1] = [
|
||||||
|
'name' => \Request('level_name_'.$i)
|
||||||
|
];
|
||||||
|
|
||||||
|
for ($x = 1; $x <= $nbOfPeriode; $x++) {
|
||||||
|
$model['default_value'][$x-1][$i-1] = [
|
||||||
|
'ocom' => \Request('ocom_n'.$i.'_p'.$x),
|
||||||
|
'name' => \Request('name_n'.$i.'_p'.$x),
|
||||||
|
'location' => \Request('location_n'.$i.'_p'.$x),
|
||||||
|
'instructor' => \Request('instruc_n'.$i.'_p'.$x),
|
||||||
|
'desc' => \Request('desc_n'.$i.'_p'.$x),
|
||||||
|
'use_course' => \Request('use_course_n'.$i.'_p'.$x),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$eventType->schedule_model = $model;
|
||||||
|
$eventType->save();
|
||||||
|
return redirect()->back()->with('success','Modification sauvegardé avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\EventType $eventType
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$e = EventType::findOrFail($id);
|
||||||
|
$e->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toJson($id)
|
||||||
|
{
|
||||||
|
return EventType::findOrFail($id)->toArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\GoogleDriveFile;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class FilesController extends Controller
|
class FilesController extends Controller
|
||||||
@@ -84,6 +85,67 @@ class FilesController extends Controller
|
|||||||
|
|
||||||
public function guide()
|
public function guide()
|
||||||
{
|
{
|
||||||
return view('admin.files.guide');
|
if (\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
$dirID = \App\GoogleDriveFile::findByPath('.Privé/.Staff/.Guide');
|
||||||
|
$dir = collect(\Storage::cloud()->listContents($dirID->id,false))->sortBy('name');
|
||||||
|
return view('admin.files.guide',['dir' => $dir]);
|
||||||
|
}
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function instruction()
|
||||||
|
{
|
||||||
|
if (\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Privé/.Staff/.Instruction')->first()->id, 'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cadet()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Privé/.Cadet')->first()->id, 'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function staff()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Privé/.Staff')->first()->id, 'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function etamas()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Privé/.ETAMAS')->first()->id, 'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function officier()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Privé/.Officier')->first()->id, 'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function publique()
|
||||||
|
{
|
||||||
|
if (!\App\GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas configuré');
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => \App\GoogleDriveFile::where('path','=','.Publique')->first()->id, 'mode' => 'folder']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,635 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\GoogleDriveFile;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Psy\Util\Str;
|
||||||
|
use Symfony\Component\Console\Input\Input;
|
||||||
|
|
||||||
|
class GoogleDriveController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @param string $dir
|
||||||
|
* @param bool $recursive
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index($folder = '')
|
||||||
|
{
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => $folder]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexFolder($folder = '')
|
||||||
|
{
|
||||||
|
return view('admin.files.Google Drive.index',['folder' => $folder,'mode' => 'folder']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new file.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function createFile()
|
||||||
|
{
|
||||||
|
Storage::cloud()->put(\request('currentDir'.'/'.\request('name')), '');
|
||||||
|
return back()->with('success','Fichier créer avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createFolder()
|
||||||
|
{
|
||||||
|
Storage::cloud()->makeDirectory(\request('currentDir').'/'.\request('name'));
|
||||||
|
return back()->with('success','Dossier créer avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function uploadFile()
|
||||||
|
{
|
||||||
|
Storage::cloud()->putFileAs(\request('currentDir'),\request()->file('fichier'),\request()->file('fichier')->getClientOriginalName());
|
||||||
|
return back()->with('success','Fichier téléversé avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$path = Storage::cloud()->makeDirectory('Test Dir');
|
||||||
|
dd($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param $filename
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
$filename = \request('file');
|
||||||
|
$contents = collect(Storage::cloud()->listContents('/1nEe35-GvLX598RketTI-UoaOxIMNxfka', true));
|
||||||
|
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
|
||||||
|
->where('extension', '=', pathinfo($filename, PATHINFO_EXTENSION))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
|
||||||
|
//return $file; // array with file info
|
||||||
|
|
||||||
|
$rawData = Storage::cloud()->get($file['path']);
|
||||||
|
|
||||||
|
return response($rawData, 200)
|
||||||
|
->header('ContentType', $file['mimetype'])
|
||||||
|
->header('Content-Disposition', "attachment; filename='$filename'");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showMetadata($dir,$file)
|
||||||
|
{
|
||||||
|
if ($dir == 'root')
|
||||||
|
{
|
||||||
|
$dir = '/';
|
||||||
|
}
|
||||||
|
$contents = collect(Storage::cloud()->listContents($dir, true));
|
||||||
|
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($file, PATHINFO_FILENAME))
|
||||||
|
->where('extension', '=', pathinfo($file, PATHINFO_EXTENSION))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPathArray()
|
||||||
|
{
|
||||||
|
$contents = collect(Storage::cloud()->listContents('/', true));
|
||||||
|
return json_encode($contents->where('type', '=', 'dir'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPath($folder)
|
||||||
|
{
|
||||||
|
$contents = collect(Storage::cloud()->listContents('/', true));
|
||||||
|
$dir = collect($contents->where('type', '=', 'dir'));
|
||||||
|
foreach ($dir as $d)
|
||||||
|
{
|
||||||
|
if($d['basename'] == $folder)
|
||||||
|
{
|
||||||
|
return $d['dirname'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFile()
|
||||||
|
{
|
||||||
|
if(\request('f'))
|
||||||
|
{
|
||||||
|
$dir = '/';
|
||||||
|
if (\request('d') && urldecode(\request('d')) != '')
|
||||||
|
{
|
||||||
|
$dir = \request('d');
|
||||||
|
}
|
||||||
|
$filename = urldecode(\request('f'));
|
||||||
|
|
||||||
|
$recursive = false; // Get subdirectories also?
|
||||||
|
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
|
||||||
|
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
if ($file == null)
|
||||||
|
{
|
||||||
|
$filename = \request('f');
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
}
|
||||||
|
|
||||||
|
$rawData = Storage::cloud()->get($file['path']);
|
||||||
|
$filename = urlencode($filename);
|
||||||
|
return response($rawData, 200)
|
||||||
|
->header('Content-Type', $file['mimetype'])
|
||||||
|
->header('Content-Disposition', "attachment; filename=$filename");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteFile()
|
||||||
|
{
|
||||||
|
if(\request('f'))
|
||||||
|
{
|
||||||
|
$dir = '/';
|
||||||
|
if (\request('d') && urldecode(\request('d')) != '')
|
||||||
|
{
|
||||||
|
$dir = \request('d');
|
||||||
|
}
|
||||||
|
$filename = urldecode(\request('f'));
|
||||||
|
|
||||||
|
$recursive = false; // Get subdirectories also?
|
||||||
|
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
|
||||||
|
|
||||||
|
$file = $contents
|
||||||
|
->where('type', '=', 'file')
|
||||||
|
->where('filename', '=', pathinfo($filename, PATHINFO_FILENAME))
|
||||||
|
->where('extension', '=', pathinfo($filename, PATHINFO_EXTENSION))
|
||||||
|
->first(); // there can be duplicate file names!
|
||||||
|
|
||||||
|
Storage::cloud()->delete($file['path']);
|
||||||
|
|
||||||
|
return back()->with('success','Fichier supprimé avec succès');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteDir()
|
||||||
|
{
|
||||||
|
$directoryID = \request('d');
|
||||||
|
|
||||||
|
// Now find that directory and use its ID (path) to delete it
|
||||||
|
$dir = '/';
|
||||||
|
$recursive = false; // Get subdirectories also?
|
||||||
|
$contents = collect(Storage::cloud()->listContents($dir, $recursive));
|
||||||
|
|
||||||
|
$directory = $contents
|
||||||
|
->where('type', '=', 'dir')
|
||||||
|
->where('basename', '=', $directoryID)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
Storage::cloud()->deleteDirectory($directory['path']);
|
||||||
|
|
||||||
|
return back()->with('success','Dossier supprimé avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list($folder = 'root')
|
||||||
|
{
|
||||||
|
$recursive = false; // Get subdirectories also?
|
||||||
|
$perm = ['r' => GoogleDriveFile::getPermForAuthUser($folder,'r'),'w' => GoogleDriveFile::getPermForAuthUser($folder,'w'),'p' => GoogleDriveFile::getPermForAuthUser($folder,'p')];
|
||||||
|
if ($folder == 'root')
|
||||||
|
{
|
||||||
|
$contents = collect(Storage::cloud()->listContents('/', $recursive));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$contents = collect(Storage::cloud()->listContents($folder, $recursive));
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.files.Google Drive.explorer',[
|
||||||
|
'directories' => $contents->where('type', '=', 'dir')->sortByDesc('name'),
|
||||||
|
'files' => $contents->where('type', '=', 'file'),
|
||||||
|
'currentDir' => $folder,
|
||||||
|
'permission' => $perm]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkFileSystem()
|
||||||
|
{
|
||||||
|
$error = [];
|
||||||
|
if(\App\Config::getData('is_Google_Drive_enabled') == "true")
|
||||||
|
{
|
||||||
|
if (GoogleDriveFile::checkConfig())
|
||||||
|
{
|
||||||
|
$structure = $this->getFileStructure();
|
||||||
|
$this->checkStructure($structure,'/','/',$error);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error = ['Il y a un probleme avec vos configurations'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$error = ['Google Drive n\'est pas actif'];
|
||||||
|
}
|
||||||
|
return $error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function checkStructure()
|
||||||
|
{
|
||||||
|
$structure = $this->getFileStructure();
|
||||||
|
|
||||||
|
foreach ($structure as $directory => $value)
|
||||||
|
{
|
||||||
|
$basename = GoogleDriveFile::findByPathInDrive($directory);
|
||||||
|
if ($basename == false)
|
||||||
|
{
|
||||||
|
$basename = GoogleDriveFile::createByPathInDrive($directory);
|
||||||
|
}
|
||||||
|
|
||||||
|
$googleDriveFile = GoogleDriveFile::findByPath($directory);
|
||||||
|
if ($googleDriveFile == null)
|
||||||
|
{
|
||||||
|
$googleDriveFile = new GoogleDriveFile();
|
||||||
|
$googleDriveFile->id = $basename;
|
||||||
|
$googleDriveFile->type = 'directory';
|
||||||
|
$googleDriveFile->rank_permission = $value['rank'];
|
||||||
|
$googleDriveFile->job_permission = [];
|
||||||
|
$googleDriveFile->user_permission = [];
|
||||||
|
$googleDriveFile->path = $directory;
|
||||||
|
$name = explode('/',$directory);
|
||||||
|
$googleDriveFile->name = $name[count($name)-1];
|
||||||
|
$googleDriveFile->save();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($googleDriveFile->id != $basename)
|
||||||
|
{
|
||||||
|
$googleDriveFile->id = $basename;
|
||||||
|
$googleDriveFile->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editPermission($folder)
|
||||||
|
{
|
||||||
|
$f = GoogleDriveFile::find($folder);
|
||||||
|
if ($f == null)
|
||||||
|
{
|
||||||
|
$metadata = \Storage::cloud()->getMetadata($folder);
|
||||||
|
$f = new GoogleDriveFile();
|
||||||
|
$f->id = $folder;
|
||||||
|
$f->type = 'directory';
|
||||||
|
$f->name = $metadata['name'];
|
||||||
|
$f->rank_permission = [1 => 'rwp'];
|
||||||
|
$f->job_permission = [];
|
||||||
|
$f->user_permission = [];
|
||||||
|
$f->path = $this->recreatePath($folder);
|
||||||
|
$f->save();
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.permission',['dir' => $f]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFileStructure()
|
||||||
|
{
|
||||||
|
return collect([
|
||||||
|
'.Systeme' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Systeme/.Fichier' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Systeme/.Fichier/.MessageDeLaSemaine' => [
|
||||||
|
'rank' => [1 => 'rwp',0 => 'r'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Systeme/.Fichier/.PlanDeCours' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.Cadet' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.ETAMAS' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.Officier' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.Staff' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.Staff/.Guide' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Privé/.Staff/.Instruction' => [
|
||||||
|
'rank' => [1 => 'rwp'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Publique' => [
|
||||||
|
'rank' => [1 => 'rwp',0 => 'r'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Publique/.Fichier' => [
|
||||||
|
'rank' => [1 => 'rwp',0 => 'r'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
'.Publique/.Image' => [
|
||||||
|
'rank' => [1 => 'rwp',0 => 'r'],
|
||||||
|
'job' => [],
|
||||||
|
'user' => []
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listLockDirectory($d)
|
||||||
|
{
|
||||||
|
$contents = collect(\Storage::cloud()->listContents($d, false));
|
||||||
|
$dir = $contents->where('type', '=', 'dir');
|
||||||
|
$dir = $dir->where('filename','=','');
|
||||||
|
|
||||||
|
return $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function recreatePath($folder)
|
||||||
|
{
|
||||||
|
$path = [];
|
||||||
|
$name = [];
|
||||||
|
$directories = collect(json_decode($this->getPathArray(),true));
|
||||||
|
foreach ($directories as $dir)
|
||||||
|
{
|
||||||
|
$path[$dir['basename']] = $dir['dirname'];
|
||||||
|
$name[$dir['basename']] = $dir['name'];
|
||||||
|
}
|
||||||
|
$realPath = $name[$folder];
|
||||||
|
$foo = $folder;
|
||||||
|
while ($foo != "")
|
||||||
|
{
|
||||||
|
$bar = explode('/',$path[$foo]);
|
||||||
|
$foo = $bar[count($bar)-1];
|
||||||
|
if ($foo != "")
|
||||||
|
{
|
||||||
|
$realPath = $name[$foo].'/'.$realPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $realPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function editPermissionModal($folder,$subject,$id)
|
||||||
|
{
|
||||||
|
$dir = GoogleDriveFile::find($folder);
|
||||||
|
$foo = null;
|
||||||
|
$perm = null;
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
if ($id == 0)
|
||||||
|
{
|
||||||
|
$foo = new \App\Rank();
|
||||||
|
$foo->name = "Utilisateur non authentifié";
|
||||||
|
$foo->id = 0;
|
||||||
|
if (isset($dir->rank_permission[$id]))
|
||||||
|
{
|
||||||
|
$perm = $dir->rank_permission[$id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$perm = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$foo = \App\Rank::find($id);
|
||||||
|
$perm = $dir->rank_permission[$id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif ($subject == 'job')
|
||||||
|
{
|
||||||
|
$foo = \App\Job::find($id);
|
||||||
|
$perm = $dir->job_permission[$id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$foo = \App\User::find($id);
|
||||||
|
$perm = $dir->user_permission[$id];
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.permission.edit',['folder' => $dir,'subject' => $foo,'perm' => $perm,'s' => $subject]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPermissionModal($folder,$subject)
|
||||||
|
{
|
||||||
|
$dir = GoogleDriveFile::find($folder);
|
||||||
|
$list = null;
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$list = \App\Rank::all();
|
||||||
|
}
|
||||||
|
elseif ($subject == 'job')
|
||||||
|
{
|
||||||
|
$list = \App\Job::all();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$list = \App\User::all();
|
||||||
|
}
|
||||||
|
return view('admin.files.Google Drive.permission.add',['folder' => $dir,'list' => $list,'s' => $subject]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchPermission(Request $request,$folder,$subject,$id)
|
||||||
|
{
|
||||||
|
$f = GoogleDriveFile::find($folder);
|
||||||
|
$permstring = '';
|
||||||
|
if (isset($request->read))
|
||||||
|
{
|
||||||
|
if ($request->read == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'r';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($request->write))
|
||||||
|
{
|
||||||
|
if ($request->write == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'w';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($request->perm))
|
||||||
|
{
|
||||||
|
if ($request->perm == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'p';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$temp = $f->rank_permission;
|
||||||
|
$temp[$id] = $permstring;
|
||||||
|
$f->rank_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'job')
|
||||||
|
{
|
||||||
|
$temp = $f->job_permission;
|
||||||
|
$temp[$id] = $permstring;
|
||||||
|
$f->job_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'user')
|
||||||
|
{
|
||||||
|
$temp = $f->user_permission;
|
||||||
|
$temp[$id] = $permstring;
|
||||||
|
$f->user_permission = $temp;
|
||||||
|
}
|
||||||
|
$f->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregistré avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPermission(Request $request,$folder,$subject)
|
||||||
|
{
|
||||||
|
$f = GoogleDriveFile::find($folder);
|
||||||
|
$permstring = '';
|
||||||
|
if (isset($request->read))
|
||||||
|
{
|
||||||
|
if ($request->read == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'r';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($request->write))
|
||||||
|
{
|
||||||
|
if ($request->write == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'w';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($request->perm))
|
||||||
|
{
|
||||||
|
if ($request->perm == 'on')
|
||||||
|
{
|
||||||
|
$permstring = $permstring.'p';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$temp = $f->rank_permission;
|
||||||
|
$temp[$request->id] = $permstring;
|
||||||
|
$f->rank_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'job')
|
||||||
|
{
|
||||||
|
$temp = $f->job_permission;
|
||||||
|
$temp[$request->id] = $permstring;
|
||||||
|
$f->job_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'user')
|
||||||
|
{
|
||||||
|
$temp = $f->user_permission;
|
||||||
|
$temp[$request->id] = $permstring;
|
||||||
|
$f->user_permission = $temp;
|
||||||
|
}
|
||||||
|
$f->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregistré avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deletePermission($folder,$subject,$id)
|
||||||
|
{
|
||||||
|
$f = GoogleDriveFile::find($folder);
|
||||||
|
if ($subject == 'rank')
|
||||||
|
{
|
||||||
|
$temp = $f->rank_permission;
|
||||||
|
unset($temp[$id]);
|
||||||
|
$f->rank_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'job')
|
||||||
|
{
|
||||||
|
$temp = $f->job_permission;
|
||||||
|
unset($temp[$id]);
|
||||||
|
$f->job_permission = $temp;
|
||||||
|
}
|
||||||
|
if ($subject == 'user')
|
||||||
|
{
|
||||||
|
$temp = $f->user_permission;
|
||||||
|
unset($temp[$id]);
|
||||||
|
$f->user_permission = $temp;
|
||||||
|
}
|
||||||
|
$f->save();
|
||||||
|
return redirect()->back()->with('success','Modification enregistré avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ class InventoryController extends Controller
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$items = Item::all();
|
$items = Item::all();
|
||||||
|
clogNav('consulte l\'inventaire');
|
||||||
return view('admin.inventory.index',[ 'items' => $items]);
|
return view('admin.inventory.index',[ 'items' => $items]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +30,12 @@ class InventoryController extends Controller
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function management()
|
||||||
|
{
|
||||||
|
clogNav('consulte la gestion de l\'inventaire');
|
||||||
|
return view('admin.inventory.management');
|
||||||
|
}
|
||||||
|
|
||||||
public function booking()
|
public function booking()
|
||||||
{
|
{
|
||||||
$items = Item::all();
|
$items = Item::all();
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Item;
|
||||||
|
use App\ItemCategory;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ItemCategoryController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
clogNav('consulte la gestion des catégories d\'inventaire');
|
||||||
|
return view('admin.itemcategory.index',['categories' => ItemCategory::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.itemcategory.add');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store()
|
||||||
|
{
|
||||||
|
$c = new ItemCategory();
|
||||||
|
|
||||||
|
$c->name = \request('name');
|
||||||
|
$c->desc = \request('desc');
|
||||||
|
if (\request('is_training') == 1)
|
||||||
|
{
|
||||||
|
$c->is_training = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c->is_training = 0;
|
||||||
|
}
|
||||||
|
if (\request('is_op_appro') == 1)
|
||||||
|
{
|
||||||
|
$c->is_op_appro = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c->is_op_appro = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->save();
|
||||||
|
clog('add','success','a ajouté une catégorie a l\'inventaire',null,'App\ItemCategory',$c->id);
|
||||||
|
return redirect('/admin/inventory/management/category/')->with('success','Catégorie ajouté avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\ItemCategory $itemCategory
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(ItemCategory $itemCategory)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\ItemCategory $itemCategory
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('admin.itemcategory.edit',['category' => ItemCategory::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\ItemCategory $itemCategory
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update($id)
|
||||||
|
{
|
||||||
|
$c = ItemCategory::find($id);
|
||||||
|
|
||||||
|
$c->name = \request('name');
|
||||||
|
$c->desc = \request('desc');
|
||||||
|
if (\request('is_training') == 1)
|
||||||
|
{
|
||||||
|
$c->is_training = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c->is_training = 0;
|
||||||
|
}
|
||||||
|
if (\request('is_op_appro') == 1)
|
||||||
|
{
|
||||||
|
$c->is_op_appro = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$c->is_op_appro = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$c->save();
|
||||||
|
clog('edit','success','a modifié une catégorie de l\'inventaire',null,'App\ItemCategory',$c->id);
|
||||||
|
return redirect('/admin/inventory/management/category/')->with('success','Catégorie modifié avec succès');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\ItemCategory $itemCategory
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$c = ItemCategory::find($id);
|
||||||
|
|
||||||
|
$c->delete();
|
||||||
|
clog('delete','success','a supprimé une catégorie de l\'inventaire',null,'App\ItemCategory',$c->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ class ItemController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
return view('admin.item.add');
|
return view('admin.item.add',['categories' => \App\ItemCategory::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,17 +33,20 @@ class ItemController extends Controller
|
|||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store()
|
||||||
{
|
{
|
||||||
$item = new Item;
|
$item = new Item;
|
||||||
|
|
||||||
$item->name = request('name');
|
$item->name = request('name');
|
||||||
$item->desc = request('desc');
|
$item->desc = request('desc');
|
||||||
$item->quantiy = request('qt');
|
$item->quantity = request('quantity');
|
||||||
|
$item->official_number = request('official_number');
|
||||||
|
$item->metadata = ['size' => request('metadata-size')];
|
||||||
|
$item->category_id = request('category_id');
|
||||||
|
|
||||||
$item->save();
|
$item->save();
|
||||||
|
clog('add','success',"a ajouté un item à l'inventaire",null,"App\Item",$item->id);
|
||||||
return redirect('/admin/inventory');
|
return redirect('/admin/inventory')->with('success','Item sauvegardé avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +70,7 @@ class ItemController extends Controller
|
|||||||
{
|
{
|
||||||
$item = Item::find($id);
|
$item = Item::find($id);
|
||||||
|
|
||||||
return view('admin.item.edit',['item' => $item]);
|
return view('admin.item.edit',['item' => $item,'categories' => \App\ItemCategory::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,11 +86,14 @@ class ItemController extends Controller
|
|||||||
|
|
||||||
$item->name = request('name');
|
$item->name = request('name');
|
||||||
$item->desc = request('desc');
|
$item->desc = request('desc');
|
||||||
$item->quantity = request('qt');
|
$item->quantity = request('quantity');
|
||||||
|
$item->official_number = request('official_number');
|
||||||
|
$item->metadata = ['size' => request('metadata-size')];
|
||||||
|
$item->category_id = request('category_id');
|
||||||
|
|
||||||
$item->save();
|
$item->save();
|
||||||
|
clog('edit','success',"a modifié un item à l'inventaire",null,"App\Item",$item->id);
|
||||||
return redirect('/admin/inventory');
|
return redirect('/admin/inventory')->with('success','Item sauvegardé avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,5 +107,6 @@ class ItemController extends Controller
|
|||||||
$item = Item::find(request('id'));
|
$item = Item::find(request('id'));
|
||||||
|
|
||||||
$item->delete();
|
$item->delete();
|
||||||
|
clog('delete','success',"a supprimé un item à l'inventaire",null,"App\Item",$item->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class JobController extends Controller
|
|||||||
|
|
||||||
$jobs = $jobs_sorted->values();
|
$jobs = $jobs_sorted->values();
|
||||||
|
|
||||||
return view('admin.job.index', ['jobs' => $jobs]);
|
return view('admin.configs.jobs.index', ['jobs' => $jobs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,90 +43,22 @@ class JobController extends Controller
|
|||||||
{
|
{
|
||||||
$job = new Job;
|
$job = new Job;
|
||||||
|
|
||||||
$job->name = request('name');
|
$job->name = $request->name;
|
||||||
$job->acces_level = request('acces_level');
|
$job->desc = $request->desc;
|
||||||
$job->desc = request('desc');
|
|
||||||
|
|
||||||
if (null !==(request('schedule_see'))) {
|
$tpermission = [];
|
||||||
$job->schedule_see = request('schedule_see');
|
|
||||||
} else {
|
foreach (\App\Permission::all() as $perm)
|
||||||
$job->schedule_see = false;
|
{
|
||||||
}
|
$tkey = $perm->ckey;
|
||||||
|
$tpermission[$tkey] = $request->$tkey;
|
||||||
if (null !==(request('schedule_edit'))) {
|
|
||||||
$job->schedule_edit = 1;
|
|
||||||
} else {
|
|
||||||
$job->schedule_edit = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('schedule_notify'))) {
|
|
||||||
$job->schedule_notify = 1;
|
|
||||||
} else {
|
|
||||||
$job->schedule_notify = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('message_see'))) {
|
|
||||||
$job->message_see = 1;
|
|
||||||
} else {
|
|
||||||
$job->message_see = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('message_edit'))) {
|
|
||||||
$job->message_edit = 1;
|
|
||||||
} else {
|
|
||||||
$job->message_edit = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('message_notify'))) {
|
|
||||||
$job->message_notify = 1;
|
|
||||||
} else {
|
|
||||||
$job->message_notify = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('paper_edit'))) {
|
|
||||||
$job->paper_edit = 1;
|
|
||||||
} else {
|
|
||||||
$job->paper_edit = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('paper_publish'))) {
|
|
||||||
$job->paper_publish = 1;
|
|
||||||
} else {
|
|
||||||
$job->paper_publish = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('paper_notify'))) {
|
|
||||||
$job->paper_notify = 1;
|
|
||||||
} else {
|
|
||||||
$job->paper_notify = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('inventory_see'))) {
|
|
||||||
$job->inventory_see = 1;
|
|
||||||
} else {
|
|
||||||
$job->inventory_see = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('inventory_edit'))) {
|
|
||||||
$job->inventory_edit = 1;
|
|
||||||
} else {
|
|
||||||
$job->inventory_edit = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('inventory_notify'))) {
|
|
||||||
$job->inventory_notify = 1;
|
|
||||||
} else {
|
|
||||||
$job->inventory_notify = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('user_see'))) {
|
|
||||||
$job->user_see = 1;
|
|
||||||
} else {
|
|
||||||
$job->user_see = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('user_edit'))) {
|
|
||||||
$job->user_edit = 1;
|
|
||||||
} else {
|
|
||||||
$job->user_edit = false;
|
|
||||||
}
|
|
||||||
if (null !==(request('user_notify'))) {
|
|
||||||
$job->user_notify = 1;
|
|
||||||
} else {
|
|
||||||
$job->user_notify = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$job->permissions = json_encode($tpermission);
|
||||||
$job->save();
|
$job->save();
|
||||||
|
|
||||||
return redirect('/admin/config/job/'.$job->id);
|
clog('add','success','Poste ajouté avec succès');
|
||||||
|
return redirect('/admin/config/jobs')->with('success','Poste ajouté avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -162,19 +94,44 @@ class JobController extends Controller
|
|||||||
* @param \App\Job $job
|
* @param \App\Job $job
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, Job $job)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$job = Job::find($id);
|
||||||
|
|
||||||
|
$job->name = $request->name;
|
||||||
|
$job->desc = $request->desc;
|
||||||
|
|
||||||
|
$tpermission = [];
|
||||||
|
|
||||||
|
foreach (\App\Permission::all() as $perm)
|
||||||
|
{
|
||||||
|
$tkey = $perm->ckey;
|
||||||
|
$tpermission[$tkey] = $request->$tkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
$job->permissions = json_encode($tpermission);
|
||||||
|
$job->save();
|
||||||
|
|
||||||
|
clog('add','success','Poste modifié avec succès');
|
||||||
|
return redirect('/admin/config/jobs')->with('success','Poste modifié avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param \App\Job $job
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Job $job)
|
public function destroy(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$job = Job::find($request->id);
|
||||||
|
foreach (\App\User::all() as $user)
|
||||||
|
{
|
||||||
|
if($user->job->id == $job->id)
|
||||||
|
{
|
||||||
|
$user->job_id = 1;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clog('delete','success','Poste supprimé avec succès');
|
||||||
|
$job->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\LessonPlan;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class LessonPlanController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\LessonPlan $lessonPlan
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(LessonPlan $lessonPlan)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\LessonPlan $lessonPlan
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(LessonPlan $lessonPlan)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\LessonPlan $lessonPlan
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, LessonPlan $lessonPlan)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\LessonPlan $lessonPlan
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(LessonPlan $lessonPlan)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@ class MessageController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
clogNav('consulte les messages');
|
||||||
return view('admin.message.index', ['messages' => \App\Message::all()]);
|
return view('admin.message.index', ['messages' => \App\Message::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +66,7 @@ class MessageController extends Controller
|
|||||||
|
|
||||||
$msg->save();
|
$msg->save();
|
||||||
|
|
||||||
\App\Log::savelog("Publication du message : ".request('msg_title'));
|
clog('add','success','a ajouté un message',null,'App\Message',$msg->id);
|
||||||
|
|
||||||
return redirect('/admin/message');
|
return redirect('/admin/message');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +79,7 @@ class MessageController extends Controller
|
|||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
\Auth::User()->seenMessage($id);
|
\Auth::User()->seenMessage($id);
|
||||||
|
clog('see','success','a consulté un message',null,'App\Message',$id);
|
||||||
return view('admin.message.show', ['message' => Message::find($id)]);
|
return view('admin.message.show', ['message' => Message::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,5 +119,6 @@ class MessageController extends Controller
|
|||||||
$msg = Message::find($id);
|
$msg = Message::find($id);
|
||||||
|
|
||||||
$msg->delete();
|
$msg->delete();
|
||||||
|
clog('delete','success','a supprimé un message',null,'App\Message',$id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ class NewsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('public.allnews',['news' => \App\News::paginate(9)]);
|
return view('public.allnews',['news' => News::allWithWeeklyMsg()->where('publish','=','1')->sortByDesc('updated_at')->paginate(9)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function indexAdmin()
|
||||||
|
{
|
||||||
|
clogNav('a consulté les nouvelles');
|
||||||
|
return view('admin.news.index',['news' => News::allWithWeeklyMsg()->sortByDesc('updated_at')->paginate(9)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +30,7 @@ class NewsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
//
|
return view('admin.news.create');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +41,24 @@ class NewsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$n = new News();
|
||||||
|
|
||||||
|
$n->title = $request->title;
|
||||||
|
$n->body = $request->body;
|
||||||
|
if ($request->publish == "1")
|
||||||
|
{
|
||||||
|
$n->publish = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$n->publish = 0;
|
||||||
|
}
|
||||||
|
$n->user_id = \Auth::user()->id;
|
||||||
|
|
||||||
|
$n->save();
|
||||||
|
clog('add','success','a ajouté une nouvelle',null,'App\News',$n->id);
|
||||||
|
return redirect('/admin/news')->with('success','Nouvelle ajouté avec succès');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +69,14 @@ class NewsController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
return view('public.news', ['new' => \App\News::find($id)]);
|
if (\request('type') == 'msg')
|
||||||
|
{
|
||||||
|
return view('public.news', ['new' => \App\News::getWeeklyMsg(\App\Event::find($id))]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return view('public.news', ['new' => \App\News::find($id)]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,9 +85,9 @@ class NewsController extends Controller
|
|||||||
* @param \App\News $news
|
* @param \App\News $news
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function edit(News $news)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
//
|
return view('admin.news.update',['news' => News::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,9 +97,25 @@ class NewsController extends Controller
|
|||||||
* @param \App\News $news
|
* @param \App\News $news
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, News $news)
|
public function update(Request $request, $id)
|
||||||
{
|
{
|
||||||
//
|
$n = News::find($id);
|
||||||
|
|
||||||
|
$n->title = $request->title;
|
||||||
|
$n->body = $request->body;
|
||||||
|
if ($request->publish == "1")
|
||||||
|
{
|
||||||
|
$n->publish = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$n->publish = 0;
|
||||||
|
}
|
||||||
|
$n->user_id = \Auth::user()->id;
|
||||||
|
|
||||||
|
$n->save();
|
||||||
|
clog('edit','success','a modifié une nouvelle',null,'App\News',$id);
|
||||||
|
return redirect('/admin/news')->with('success','Nouvelle modifié avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,8 +124,11 @@ class NewsController extends Controller
|
|||||||
* @param \App\News $news
|
* @param \App\News $news
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function destroy(News $news)
|
public function destroy()
|
||||||
{
|
{
|
||||||
//
|
$news = News::find(request('id'));
|
||||||
|
|
||||||
|
$news->delete();
|
||||||
|
clog('delete','success','a supprimé une nouvelle',null,'App\News',$id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Notifications\DatabaseNotification;
|
||||||
|
|
||||||
|
class NotificationController extends Controller
|
||||||
|
{
|
||||||
|
public function markAsRead($id)
|
||||||
|
{
|
||||||
|
$n = DatabaseNotification::find($id);
|
||||||
|
$n->read_at = date('Y-m-d h:i:s');
|
||||||
|
$n->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function markAllAsRead()
|
||||||
|
{
|
||||||
|
$notifications = \Auth::user()->unreadNotifications;
|
||||||
|
foreach ($notifications as $n)
|
||||||
|
{
|
||||||
|
$n->read_at = date('Y-m-d h:i:s');
|
||||||
|
$n->save();
|
||||||
|
}
|
||||||
|
return $notifications;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\OCOM;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Routing\Redirector;
|
||||||
|
use function GuzzleHttp\json_encode;
|
||||||
|
use function GuzzleHttp\Psr7\str;
|
||||||
|
|
||||||
|
class OCOMController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
OCOM::wasUpdateGivenAll();
|
||||||
|
return view('admin.ocom.index',['ocoms' => OCOM::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('admin.ocom.add');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generate()
|
||||||
|
{
|
||||||
|
$file = fopen(\request()->file('file'),'r');
|
||||||
|
$data = fread($file,filesize(\request()->file('file')));
|
||||||
|
fclose($file);
|
||||||
|
$data = str_replace(["\r","\n"],'',$data);
|
||||||
|
|
||||||
|
// Detection et nettoyage des ORENs
|
||||||
|
preg_match_all('/[MX\d][X\d]\d+,[^,]+/',$data,$matches_orens);
|
||||||
|
foreach ($matches_orens[0] as $key => $oren) {
|
||||||
|
$oren = str_replace('"','',$oren);
|
||||||
|
$matches_orens[0][$key] = $oren;
|
||||||
|
}
|
||||||
|
$orens_pass_2 = collect($matches_orens[0])->unique();
|
||||||
|
$orens = [];
|
||||||
|
foreach ($orens_pass_2 as $oren)
|
||||||
|
{
|
||||||
|
$foo = explode(',',$oren);
|
||||||
|
$orens[$foo[0]] = $foo[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detection et nettoyage des OCOMs
|
||||||
|
preg_match_all('/[MC][X\d]\d{2}\.\d{2}\w?,[^,]+,\d/',$data,$matches_ocom);
|
||||||
|
foreach ($matches_ocom[0] as $key => $ocom) {
|
||||||
|
$ocom = str_replace('"','',$ocom);
|
||||||
|
$matches_ocom[0][$key] = $ocom;
|
||||||
|
}
|
||||||
|
$ocoms_pass_2 = collect($matches_ocom[0])->unique();
|
||||||
|
|
||||||
|
foreach ($ocoms_pass_2 as $ocom_pass_2)
|
||||||
|
{
|
||||||
|
$foo = explode(',',$ocom_pass_2);
|
||||||
|
|
||||||
|
if (OCOM::findByOCOM($foo[0]) == null)
|
||||||
|
{
|
||||||
|
preg_match('/[X\d]\d{2}/',$ocom_pass_2,$matches);
|
||||||
|
$oren = $matches[0];
|
||||||
|
$complementary = false;
|
||||||
|
if ($foo[0][0] == "C")
|
||||||
|
{
|
||||||
|
$complementary = true;
|
||||||
|
}
|
||||||
|
$nocom = new OCOM();
|
||||||
|
$nocom->ocom = $foo[0];
|
||||||
|
$nocom->objectif_competence = $foo[1];
|
||||||
|
$nocom->nbPeriode = $foo[2];
|
||||||
|
$nocom->objectif_rendement = $orens[$oren];
|
||||||
|
$nocom->oren = $oren;
|
||||||
|
$nocom->complementary = $complementary;
|
||||||
|
$nocom->course_id = '';
|
||||||
|
|
||||||
|
$nocom->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->updateOCOMDB();
|
||||||
|
return redirect('/admin/ocom')->with('success','Base de donnée des cours générée avec succès!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function g()
|
||||||
|
{
|
||||||
|
OCOM::truncate();
|
||||||
|
|
||||||
|
$matches = [];
|
||||||
|
$orens = [];
|
||||||
|
preg_match_all('/[X\d]\d\d,[^,]*/',\request('text'),$matches);
|
||||||
|
foreach ($matches[0] as $match)
|
||||||
|
{
|
||||||
|
$match = str_replace('"',"",$match);
|
||||||
|
$match = trim(preg_replace('/\s\s+/', ' ', $match));
|
||||||
|
$oren = "";
|
||||||
|
preg_match('/[X\d]\d\d/',$match,$oren);
|
||||||
|
$value = preg_replace('/[X\d]\d\d,/','',$match);
|
||||||
|
if($value != "")
|
||||||
|
{
|
||||||
|
$orens[$oren[0]] = preg_replace('/[X\d]\d\d,/','',$match);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match_all('/[MC]\S\d\d.\d\d[A-Z]?,[^,]*,\d/',$text,$matches);
|
||||||
|
|
||||||
|
foreach ($matches[0] as $match)
|
||||||
|
{
|
||||||
|
$newocom = new OCOM();
|
||||||
|
|
||||||
|
$match = str_replace('"',"",$match);
|
||||||
|
|
||||||
|
$ocom = "";
|
||||||
|
preg_match('/[MC]\S\d\d.\d\d[A-Z]?/',$match,$ocom);
|
||||||
|
|
||||||
|
if(!OCOM::where('ocom',$ocom)->first())
|
||||||
|
{
|
||||||
|
$oren = "";
|
||||||
|
preg_match('/[X\d]\d\d/',$ocom[0],$oren);
|
||||||
|
|
||||||
|
$obj_competence = str_replace($ocom[0].",","",$match);
|
||||||
|
$obj_competence = trim(preg_replace('/\s\s+/', ' ', $obj_competence));
|
||||||
|
$obj_competence = trim($obj_competence,"\\");
|
||||||
|
|
||||||
|
$nbPeriode = preg_replace('/[MC]\S\d\d.\d\d[A-Z]?,[^,]*,/','',$match);
|
||||||
|
$newocom->nbPeriode = $nbPeriode;
|
||||||
|
|
||||||
|
$obj_competence = str_replace(",".$nbPeriode,'',$obj_competence);
|
||||||
|
|
||||||
|
$newocom->ocom = $ocom[0];
|
||||||
|
$newocom->oren = $oren[0];
|
||||||
|
|
||||||
|
if ($newocom->ocom[0] == 'C' || $newocom->ocom[0] == 'c')
|
||||||
|
{
|
||||||
|
$newocom->complementary = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$newocom->complementary = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newocom->course_id = '';
|
||||||
|
|
||||||
|
$newocom->objectif_competence = $obj_competence;
|
||||||
|
$newocom->objectif_rendement = $orens[$oren[0]];
|
||||||
|
$newocom->objectif_rendement = trim($newocom->objectif_rendement,"\\");
|
||||||
|
$newocom->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return redirect('/admin/ocom')->with('success','Base de donnée des cours générée avec succès!');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showgenerate()
|
||||||
|
{
|
||||||
|
return view('admin.ocom.generate');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateOCOMDB()
|
||||||
|
{
|
||||||
|
$ocoms = OCOM::all();
|
||||||
|
|
||||||
|
$from = strtotime(\App\Config::getData('instruction_year_begin'));
|
||||||
|
$to = strtotime(\App\Config::getData('instruction_year_end'));
|
||||||
|
$allEvent = \App\Event::all();
|
||||||
|
$events = collect();
|
||||||
|
|
||||||
|
foreach ($allEvent as $e)
|
||||||
|
{
|
||||||
|
if ($e->use_schedule == 1)
|
||||||
|
{
|
||||||
|
if (strtotime($e->date_begin) >= $from)
|
||||||
|
{
|
||||||
|
if (strtotime($e->date_begin) <= $to)
|
||||||
|
{
|
||||||
|
$events->push($e);
|
||||||
|
foreach ($e->courses as $c)
|
||||||
|
{
|
||||||
|
$r = $ocoms->where('ocom',$c->ocom)->first();
|
||||||
|
if ($r != null)
|
||||||
|
{
|
||||||
|
$r->saveCourse($c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($ocoms as $o)
|
||||||
|
{
|
||||||
|
$o->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$ocom = new OCOM();
|
||||||
|
$ocom->ocom = $request->ocom;
|
||||||
|
$ocom->objectif_competence = $request->objectif_competence;
|
||||||
|
$ocom->nbPeriode = $request->nbPeriode;
|
||||||
|
$ocom->objectif_rendement = $request->objectif_rendement;
|
||||||
|
$ocom->oren = $request->oren;
|
||||||
|
|
||||||
|
if ($ocom->ocom[0] == 'C' || $ocom->ocom[0] == 'c')
|
||||||
|
{
|
||||||
|
$ocom->complementary = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ocom->complementary = false;
|
||||||
|
}
|
||||||
|
$ocom->course_id = "";
|
||||||
|
$ocom->save();
|
||||||
|
clog('add','success','a ajouter un ocom',\Auth::User()->id);
|
||||||
|
return redirect('/admin/ocom/'.$ocom->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param $OCOM
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function show($OCOM)
|
||||||
|
{
|
||||||
|
return view('admin.ocom.show',['ocom' => OCOM::find($OCOM)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param $id
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
return view('admin.ocom.edit',['ocom' => OCOM::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param Request $request
|
||||||
|
* @param $id
|
||||||
|
* @return RedirectResponse|Redirector
|
||||||
|
*/
|
||||||
|
public function update(Request $request,$id)
|
||||||
|
{
|
||||||
|
$ocom = OCOM::find($id);
|
||||||
|
$ocom->ocom = $request->ocom;
|
||||||
|
$ocom->objectif_competence = $request->objectif_competence;
|
||||||
|
$ocom->nbPeriode = $request->nbPeriode;
|
||||||
|
$ocom->objectif_rendement = $request->objectif_rendement;
|
||||||
|
$ocom->oren = $request->oren;
|
||||||
|
|
||||||
|
if ($ocom->ocom[0] == 'C' || $ocom->ocom[0] == 'c')
|
||||||
|
{
|
||||||
|
$ocom->complementary = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ocom->complementary = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ocom->save();
|
||||||
|
clog('edit','success','a modifié un ocom',\Auth::User()->id);
|
||||||
|
return redirect('/admin/ocom/'.$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param OCOM $oCOM
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
OCOM::find($id)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonList()
|
||||||
|
{
|
||||||
|
$ocoms = OCOM::all();
|
||||||
|
|
||||||
|
$name = [];
|
||||||
|
|
||||||
|
foreach ($ocoms as $ocom) {
|
||||||
|
array_push($name, $ocom->ocom);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(string $ocom)
|
||||||
|
{
|
||||||
|
$foo = OCOM::all()->where('ocom','=',$ocom)->first();
|
||||||
|
if($foo != null)
|
||||||
|
{
|
||||||
|
return $foo->objectif_competence;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Permission;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class PermissionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Permission $permission
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Permission $permission)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Permission $permission
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Permission $permission)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Permission $permission
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Permission $permission)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Permission $permission
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Permission $permission)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,11 @@ class PictureController extends Controller
|
|||||||
return view('public.allpicture',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
return view('public.allpicture',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function indexAdmin()
|
||||||
|
{
|
||||||
|
clogNav('consulte les images');
|
||||||
|
return view('admin.picture.index',['pictures' => \App\Picture::paginate(\App\Config::getData('text_public_picture_nb'))]);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
@@ -24,7 +29,7 @@ class PictureController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
//
|
return view('admin.picture.add');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,9 +38,20 @@ class PictureController extends Controller
|
|||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store()
|
||||||
{
|
{
|
||||||
//
|
$pic = new Picture();
|
||||||
|
|
||||||
|
$pic->title = request('title');
|
||||||
|
$pic->url = request('url');
|
||||||
|
$pic->desc = request('desc');
|
||||||
|
$pic->pictureable_id = 0;
|
||||||
|
$pic->pictureable_type = "";
|
||||||
|
|
||||||
|
$pic->save();
|
||||||
|
clog('add','success','a ajouté une image',null,'App\Picture',$pic->id);
|
||||||
|
return redirect('/admin/picture')->with('success','Image ajoutée avec succès');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +62,7 @@ class PictureController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function show($id)
|
public function show($id)
|
||||||
{
|
{
|
||||||
|
clog('see','success','a consulté une image',null,'App\Picture',$id);
|
||||||
return view('public.picture',['picture' => \App\Picture::find($id)]);
|
return view('public.picture',['picture' => \App\Picture::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,9 +72,9 @@ class PictureController extends Controller
|
|||||||
* @param \App\Picture $picture
|
* @param \App\Picture $picture
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function edit(Picture $picture)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
//
|
return view('admin.picture.edit',['picture' => Picture::find($id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,9 +84,24 @@ class PictureController extends Controller
|
|||||||
* @param \App\Picture $picture
|
* @param \App\Picture $picture
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, Picture $picture)
|
public function update($id)
|
||||||
{
|
{
|
||||||
//
|
$pic = Picture::find($id);
|
||||||
|
|
||||||
|
$pic->title = request('title');
|
||||||
|
$pic->url = request('url');
|
||||||
|
$pic->desc = request('desc');
|
||||||
|
|
||||||
|
$pic->save();
|
||||||
|
clog('edit','success','a modifié une image',null,'App\Picture',$id);
|
||||||
|
if ($pic->pictureable_type == "App\ComplementaryActivity")
|
||||||
|
{
|
||||||
|
return redirect('admin/article/activity/picture/'.$pic->pictureable->id)->with('success','Image sauvegarder avec succès');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return redirect('/admin/picture')->with('success','Image sauvegarder avec succès');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,8 +110,11 @@ class PictureController extends Controller
|
|||||||
* @param \App\Picture $picture
|
* @param \App\Picture $picture
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function destroy(Picture $picture)
|
public function destroy($id)
|
||||||
{
|
{
|
||||||
//
|
$pic = Picture::find($id);
|
||||||
|
|
||||||
|
$pic->delete();
|
||||||
|
clog('delete','success','a supprimé une image',null,'App\Picture',$id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ProfilController extends Controller
|
||||||
|
{
|
||||||
|
public function courses()
|
||||||
|
{
|
||||||
|
$mode = 'future';
|
||||||
|
if (\request('all'))
|
||||||
|
{
|
||||||
|
$courses = \App\Course::allForAuthUser();
|
||||||
|
$mode = 'all';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$courses = \App\Course::allFutureForAuthUser();
|
||||||
|
}
|
||||||
|
return view('admin.user.profil.courses',['courses' => $courses,'mode' => $mode]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\News;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class PublicController extends Controller
|
class PublicController extends Controller
|
||||||
@@ -14,8 +15,8 @@ class PublicController extends Controller
|
|||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('public.index',[
|
return view('public.index',[
|
||||||
'news' => \App\News::all()->sortByDesc('created_at')->take(3),
|
'news' => \App\News::allWithWeeklyMsg()->where('publish','=','1')->sortByDesc('created_at')->take(3),
|
||||||
'activities' => \App\ComplementaryActivity::all(),
|
'activities' => \App\ComplementaryActivity::all()->where('is_promoted','1'),
|
||||||
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public'))
|
'pictures' => \App\Picture::all()->sortByDesc('created_at')->take(\App\Config::getData('nb_activity_public'))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ class PublicController extends Controller
|
|||||||
|
|
||||||
$config->save();
|
$config->save();
|
||||||
|
|
||||||
return redirect('/');;
|
return redirect('/?editMode');;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class RankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//
|
return view('admin.configs.ranks.index',['ranks' => Rank::all()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,7 +24,7 @@ class RankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
//
|
return view('admin.configs.ranks.add');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,25 @@ class RankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$r = new Rank();
|
||||||
|
|
||||||
|
$r->name = $request->name;
|
||||||
|
$r->desc = $request->desc;
|
||||||
|
$r->acces_level = 1;
|
||||||
|
|
||||||
|
$tpermission = [];
|
||||||
|
|
||||||
|
foreach (\App\Permission::all() as $perm)
|
||||||
|
{
|
||||||
|
$tkey = $perm->ckey;
|
||||||
|
$tpermission[$tkey] = $request->$tkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
$r->permissions = json_encode($tpermission);
|
||||||
|
$r->save();
|
||||||
|
|
||||||
|
clog('add','success','Grade ajouté avec succès');
|
||||||
|
return redirect('/admin/config/ranks')->with('success','Grade ajouté avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,9 +62,9 @@ class RankController extends Controller
|
|||||||
* @param \App\Rank $rank
|
* @param \App\Rank $rank
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function show(Rank $rank)
|
public function show($rank)
|
||||||
{
|
{
|
||||||
//
|
return view('admin.configs.ranks.show',['rank' => Rank::find($rank)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +75,7 @@ class RankController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(Rank $rank)
|
public function edit(Rank $rank)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,19 +85,43 @@ class RankController extends Controller
|
|||||||
* @param \App\Rank $rank
|
* @param \App\Rank $rank
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, Rank $rank)
|
public function update(Request $request, $rank)
|
||||||
{
|
{
|
||||||
//
|
$r = Rank::find($rank);
|
||||||
|
|
||||||
|
$r->name = $request->name;
|
||||||
|
$r->desc = $request->desc;
|
||||||
|
|
||||||
|
$tpermission = [];
|
||||||
|
|
||||||
|
foreach (\App\Permission::all() as $perm)
|
||||||
|
{
|
||||||
|
$tkey = $perm->ckey;
|
||||||
|
$tpermission[$tkey] = $request->$tkey;
|
||||||
|
}
|
||||||
|
|
||||||
|
$r->permissions = json_encode($tpermission);
|
||||||
|
$r->save();
|
||||||
|
|
||||||
|
clog('edit','success','Grade modifié avec succès');
|
||||||
|
return redirect('/admin/config/ranks')->with('success','Grade modifié avec succès');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
|
||||||
* @param \App\Rank $rank
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
*/
|
||||||
public function destroy(Rank $rank)
|
public function destroy(Request $request)
|
||||||
{
|
{
|
||||||
//
|
$rank = Rank::find($request->id);
|
||||||
|
foreach (\App\User::all() as $user)
|
||||||
|
{
|
||||||
|
if($user->rank->id == $rank->id)
|
||||||
|
{
|
||||||
|
$user->rank_id = 1;
|
||||||
|
$user->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clog('delete','success','Grade supprimé avec succès');
|
||||||
|
$rank->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,219 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use \App\Schedule;
|
use \App\Schedule;
|
||||||
|
use function GuzzleHttp\json_encode;
|
||||||
|
use PDF;
|
||||||
|
|
||||||
class ScheduleController extends Controller
|
class ScheduleController extends Controller
|
||||||
{
|
{
|
||||||
//
|
public function index()
|
||||||
|
{
|
||||||
|
return view('admin.configs.schedule',['configs' => \App\Config::all(),'events_type' => \App\EventType::all()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
$instruction_year_begin = \App\Config::find('instruction_year_begin');
|
||||||
|
$instruction_year_end = \App\Config::find('instruction_year_end');
|
||||||
|
|
||||||
|
$instruction_year_begin->data = [date('Y-m-d',strtotime($request->instruction_year_begin))];
|
||||||
|
$instruction_year_end->data = [date('Y-m-d',strtotime($request->instruction_year_end))];
|
||||||
|
|
||||||
|
$instruction_year_begin->save();
|
||||||
|
$instruction_year_end->save();
|
||||||
|
|
||||||
|
return redirect('/admin/config/instruction')->with('success','Modification sauvegarder avec succès !');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function apiIndex()
|
||||||
|
{
|
||||||
|
$start = strtotime(request()->start);
|
||||||
|
$end = strtotime(request()->end);
|
||||||
|
$allschedules = Schedule::all();
|
||||||
|
|
||||||
|
$allevents = \App\Event::all();
|
||||||
|
$events = [];
|
||||||
|
$jsonevents = [];
|
||||||
|
$schedules = [];
|
||||||
|
|
||||||
|
foreach ($allschedules as $schedule) {
|
||||||
|
if(strtotime($schedule->date) >= $start && strtotime($schedule->date) <= $end) {
|
||||||
|
array_push($schedules,$schedule);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($allevents as $event) {
|
||||||
|
if(strtotime($event->date_begin) >= $start && strtotime($event->date_begin) <= $end) {
|
||||||
|
array_push($events,$event);
|
||||||
|
}
|
||||||
|
else if(strtotime($event->date_end) >= $start && strtotime($event->date_end) <= $end) {
|
||||||
|
array_push($events,$event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($schedules as $schedule) {
|
||||||
|
|
||||||
|
$color = $this->getColor($schedule->type);
|
||||||
|
|
||||||
|
$event = [
|
||||||
|
'title' => $schedule->data['event_name'],
|
||||||
|
'start' => date('c',strtotime($schedule->date.'T'.$schedule->data['event_begin_time'])),
|
||||||
|
'end' => date('c',strtotime($schedule->date.'T'.$schedule->data['event_end_time'])),
|
||||||
|
'color' => $color,
|
||||||
|
'source' => 'schedule',
|
||||||
|
'id' => $schedule->id
|
||||||
|
];
|
||||||
|
array_push($jsonevents,$event);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($events as $event) {
|
||||||
|
|
||||||
|
if($event->calendar_color == null)
|
||||||
|
{
|
||||||
|
$color = $this->getColor($event->type);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$color = $event->calendar_color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($event->calendar_icon == null)
|
||||||
|
{
|
||||||
|
$icon = "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$icon = $event->calendar_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
$myevent = [
|
||||||
|
'title' => $event->name,
|
||||||
|
'start' => date('c',strtotime($event->date_begin)),
|
||||||
|
'end' => date('c',strtotime($event->date_end)),
|
||||||
|
'color' => $color,
|
||||||
|
'extraParams' => [
|
||||||
|
'db_type' => 'event'],
|
||||||
|
'id' => $event->id,
|
||||||
|
'icon' => $icon
|
||||||
|
];
|
||||||
|
array_push($jsonevents,$myevent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($jsonevents);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadModal($id,$db_type)
|
||||||
|
{
|
||||||
|
if($db_type == "event")
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event = \App\Schedule::find($id);
|
||||||
|
}
|
||||||
|
return view('public.modal.schedule',['event' => $event]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadModalFull($id,$db_type)
|
||||||
|
{
|
||||||
|
if($db_type == "event")
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event = \App\Schedule::find($id);
|
||||||
|
}
|
||||||
|
return view('admin.schedule.modal.show',['event' => $event]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor($type)
|
||||||
|
{
|
||||||
|
$activity = \App\ComplementaryActivity::all();
|
||||||
|
$color = 'blue';
|
||||||
|
switch ($type) {
|
||||||
|
case 'regular':
|
||||||
|
$color = 'orange';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pilotage':
|
||||||
|
$color = '#58D3F7';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'drill':
|
||||||
|
$color = 'blue';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'music':
|
||||||
|
$color = 'green';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'biathlon':
|
||||||
|
$color = 'red';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'marksmanship':
|
||||||
|
$color = 'grey';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'founding':
|
||||||
|
$color = '#00FF40';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'volunteer':
|
||||||
|
$color = '#DF0174';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'other':
|
||||||
|
$color = '#DF0174';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if ($activity->find($type)) {
|
||||||
|
$color = $activity->find($type)->calendar_color;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
return $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function printtopdf($id)
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
//return view('admin.schedule.print.event',['event' => $event]);
|
||||||
|
$pdf = PDF::loadView('admin.schedule.print.event',['event' => $event])->setPaper('8.5x11', 'landscape');
|
||||||
|
return $pdf->download($event->date_begin.'.pdf');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create($date)
|
||||||
|
{
|
||||||
|
$date = str_replace('/','-',$date);
|
||||||
|
return view('admin.schedule.event.add',['date' => $date]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadModalDefautType($type,$date)
|
||||||
|
{
|
||||||
|
|
||||||
|
$activity = \App\ComplementaryActivity::find($type);
|
||||||
|
$begin_time = $date." ".$activity->begin_time;
|
||||||
|
$end_time = $date." ".$activity->end_time;
|
||||||
|
|
||||||
|
$msg_time = Date('c',strtotime($begin_time.'-4day'));
|
||||||
|
|
||||||
|
return view('admin.schedule.modal.add',[
|
||||||
|
'activity' => \App\ComplementaryActivity::find($type),
|
||||||
|
'begin_time' => $begin_time,
|
||||||
|
'end_time' => $end_time,
|
||||||
|
'msg_time' => $msg_time
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id)
|
||||||
|
{
|
||||||
|
$event = \App\Event::find($id);
|
||||||
|
|
||||||
|
$event->delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ScheduleEditorController extends Controller
|
||||||
|
{
|
||||||
|
public function getCourse(int $id = null)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.editor.course');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCourseEmpty(int $niveau,int $periode,$event_type = 1)
|
||||||
|
{
|
||||||
|
$eventType = \App\EventType::findOrFail($event_type);
|
||||||
|
$data = $eventType->getScheduleModelData($niveau,$periode);
|
||||||
|
$ocom = $data['ocom'];
|
||||||
|
$name = $data['name'];
|
||||||
|
$location = $data['location'];
|
||||||
|
$instructor = $data['instructor'];
|
||||||
|
$desc = $data['desc'];
|
||||||
|
|
||||||
|
return view('admin.schedule.editor.course',[
|
||||||
|
'periode' => $periode,
|
||||||
|
'niveau' => $niveau,
|
||||||
|
'ocom' => $ocom,
|
||||||
|
'name' => $name,
|
||||||
|
'location' => $location,
|
||||||
|
'instructor' => $instructor,
|
||||||
|
'desc' => $desc]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTemplate(int $id)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.editor.template',["eventType" => \App\EventType::find($id)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEventTemplate(int $id)
|
||||||
|
{
|
||||||
|
$eventType = \App\EventType::find($id);
|
||||||
|
|
||||||
|
return json_encode($eventType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmptyPeriode(int $id)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.editor.periode',[
|
||||||
|
'periode_name' => 'Periode '.$id,
|
||||||
|
'periode_begin_time' => '00:00',
|
||||||
|
'periode_end_time' => '00:00',
|
||||||
|
'periode_id' => $id,
|
||||||
|
'nbLevel' => request('nblevel')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEmptyLevel(int $id)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.editor.level',['periode_id' => \request('nbPeriode'),'level_id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLevelHeader(int $id)
|
||||||
|
{
|
||||||
|
return view('admin.schedule.editor.levelHeader',['level_id' => $id,'level_name' => 'Niveau '.$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use phpDocumentor\Reflection\Types\Collection;
|
||||||
|
|
||||||
|
class StatsController extends Controller
|
||||||
|
{
|
||||||
|
public function instruction()
|
||||||
|
{
|
||||||
|
$instructorUTTD = collect();
|
||||||
|
|
||||||
|
$coursesTY = \App\Course::allThisYear();
|
||||||
|
$nbCoursePlanDoneTY = 0;
|
||||||
|
$nbCoursePlanDoneAndCheckTY = 0;
|
||||||
|
foreach ($coursesTY as $course)
|
||||||
|
{
|
||||||
|
if ($course->lessonPlan)
|
||||||
|
{
|
||||||
|
if ($course->lessonPlan->approved)
|
||||||
|
{
|
||||||
|
$nbCoursePlanDoneAndCheckTY++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$nbCoursePlanDoneTY++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$coursesUTTD = clone $coursesTY;
|
||||||
|
$nbCoursePlanDoneUTDP = 0;
|
||||||
|
$nbCoursePlanDoneAndCheckUTDP = 0;
|
||||||
|
foreach ($coursesUTTD as $key => $course)
|
||||||
|
{
|
||||||
|
if (date('c',strtotime($course->event->date_begin)) >= date('c'))
|
||||||
|
{
|
||||||
|
$coursesUTTD->forget($key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$instructorUTTD->push($course->instructor());
|
||||||
|
if ($course->lessonPlan)
|
||||||
|
{
|
||||||
|
if ($course->lessonPlan->approved)
|
||||||
|
{
|
||||||
|
$nbCoursePlanDoneAndCheckUTDP++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$nbCoursePlanDoneUTDP++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$instructorUTTD = $instructorUTTD->unique();
|
||||||
|
$eventTY = \App\Event::allThisYear();
|
||||||
|
$eventUTTD = clone $eventTY;
|
||||||
|
foreach ($eventUTTD as $key => $event)
|
||||||
|
{
|
||||||
|
if (date('c',strtotime($event->date_begin)) >= date('c'))
|
||||||
|
{
|
||||||
|
$eventUTTD->forget($key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('admin.stats.instruction',[
|
||||||
|
'nbCourseThisYear' => count($coursesTY),
|
||||||
|
'nbInstructorUpToThisDay' => count($instructorUTTD),
|
||||||
|
'nbEventThisYear' => count($eventTY),
|
||||||
|
'nbEventUpToThisDay' => count($eventUTTD),
|
||||||
|
'nbCourseUpToThisDay' => count($coursesUTTD),
|
||||||
|
'nbCoursePlanDoneUTDP' => $nbCoursePlanDoneUTDP,
|
||||||
|
'nbCoursePlanDoneTY' => $nbCoursePlanDoneTY,
|
||||||
|
'nbCoursePlanDoneAndCheckUTDP' => $nbCoursePlanDoneAndCheckUTDP,
|
||||||
|
'nbCoursePlanDoneAndCheckTY' => $nbCoursePlanDoneAndCheckTY,
|
||||||
|
'nbCourseInDB' => count(\App\OCOM::all()),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ namespace App\Http\Controllers;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\User;
|
use App\User;
|
||||||
|
|
||||||
|
use function GuzzleHttp\json_encode;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -67,8 +69,8 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$user->avatar = rand(1,16);
|
$user->avatar = rand(1,16);
|
||||||
$user->rank = request('rank');
|
$user->rank_id = request('rank');
|
||||||
$user->job = request('job');
|
$user->job_id = request('job');
|
||||||
$user->password = bcrypt(request('psw'));
|
$user->password = bcrypt(request('psw'));
|
||||||
$user->api_token = str_random(60);
|
$user->api_token = str_random(60);
|
||||||
|
|
||||||
@@ -111,9 +113,9 @@ class UserController extends Controller
|
|||||||
* @param int $id
|
* @param int $id
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function update(Request $request)
|
public function update($id)
|
||||||
{
|
{
|
||||||
$user = User::where('email', request('email'))->first();
|
$user = User::find($id);
|
||||||
|
|
||||||
$user->firstname = request('firstname');
|
$user->firstname = request('firstname');
|
||||||
$user->lastname = request('lastname');
|
$user->lastname = request('lastname');
|
||||||
@@ -139,8 +141,8 @@ class UserController extends Controller
|
|||||||
$user->age = request('age');
|
$user->age = request('age');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->rank = request('rank');
|
$user->rank_id = request('rank');
|
||||||
$user->job = request('job');
|
$user->job_id = request('job');
|
||||||
if (request('psw') != null) {
|
if (request('psw') != null) {
|
||||||
$user->password = bcrypt(request('psw'));
|
$user->password = bcrypt(request('psw'));
|
||||||
}
|
}
|
||||||
@@ -208,7 +210,7 @@ class UserController extends Controller
|
|||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return back()->with('status', 'Votre avatar a été mis à jour !');
|
return back()->with('success', 'Votre avatar a été mis à jour !');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserAvatar()
|
public function UserAvatar()
|
||||||
@@ -229,7 +231,7 @@ class UserController extends Controller
|
|||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return back()->with('status', 'Modification enregistré');
|
return redirect('/admin/profil')->with('success', 'Modification enregistré');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function UserAdress()
|
public function UserAdress()
|
||||||
@@ -245,6 +247,34 @@ class UserController extends Controller
|
|||||||
|
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return back()->with('status', 'Modification enregistré');
|
return redirect('/admin/profil')->with('success', 'Modification enregistré');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function apiList()
|
||||||
|
{
|
||||||
|
$users = \App\User::all();
|
||||||
|
|
||||||
|
$name = [];
|
||||||
|
|
||||||
|
foreach ($users as $user) {
|
||||||
|
array_push($name, $user->fullname());
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showCourses($id)
|
||||||
|
{
|
||||||
|
return view('admin.user.courses',['courses' => User::find($id)->courses]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showCourse($id,$course_id)
|
||||||
|
{
|
||||||
|
return view('admin.user.course',['courses' => User::find($id)->courses]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function userNotification()
|
||||||
|
{
|
||||||
|
return view('admin.user.profil.notifications',['notifications' => \Auth::user()->notifications]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,5 +61,8 @@ class Kernel extends HttpKernel
|
|||||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
'staff' => \App\Http\Middleware\AccesStaff::class,
|
'staff' => \App\Http\Middleware\AccesStaff::class,
|
||||||
'admin' => \App\Http\Middleware\AccesAdmin::class,
|
'admin' => \App\Http\Middleware\AccesAdmin::class,
|
||||||
|
'perm' => \App\Http\Middleware\CheckPerm::class,
|
||||||
|
'fileperm' => \App\Http\Middleware\CheckFilePerm::class,
|
||||||
|
'courseperm' => \App\Http\Middleware\CheckCoursePerm::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class CheckCoursePerm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next,$perm = 'see')
|
||||||
|
{
|
||||||
|
$course = \App\Course::findOrFail($request->id);
|
||||||
|
|
||||||
|
if (\Auth::user()->id == $course->user_id)
|
||||||
|
{
|
||||||
|
if ($perm == 'see' || $perm == 'edit')
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\Auth::user()->p('course_'.$perm.'_all') == 1)
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
if (\Auth::user()->p('course_'.$perm) == 1)
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
if ($perm == 'validate_plan')
|
||||||
|
{
|
||||||
|
abort(401);
|
||||||
|
}
|
||||||
|
clog('navigate','danger','L\'utilisateur n\'est pas autorisé à effectuer cette action',\Auth::user()->id);
|
||||||
|
return redirect('/admin')->with('error','Vous n\'êtes pas autorisé à effectuer cette action');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use Closure;
|
||||||
|
use \App\GoogleDriveFile;
|
||||||
|
use \App\Config;
|
||||||
|
|
||||||
|
class CheckFilePerm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next,$type,$permission = 'r')
|
||||||
|
{
|
||||||
|
if (GoogleDriveFile::checkConfig() && Config::getData('is_Google_Drive_enabled') == 'true')
|
||||||
|
{
|
||||||
|
// Get folder
|
||||||
|
if (isset($request->folder))
|
||||||
|
{
|
||||||
|
$folder = $request->folder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$folder = $request->d;
|
||||||
|
}
|
||||||
|
$dir = GoogleDriveFile::find($folder);
|
||||||
|
|
||||||
|
// Check if $folder is root directory or $dir is null
|
||||||
|
if ($folder == "" || $dir == null)
|
||||||
|
{
|
||||||
|
if (\Auth::check())
|
||||||
|
{
|
||||||
|
if ($permission == 'r')
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (\Auth::user()->p('file_manage') === 1)
|
||||||
|
{
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
abort(401,'Pas connecter');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for specific folder permission
|
||||||
|
if ($dir != null)
|
||||||
|
{
|
||||||
|
if (\Auth::check())
|
||||||
|
{
|
||||||
|
if (!$dir->canAuthUser($permission))
|
||||||
|
{
|
||||||
|
clog('navigate','danger','Vous n\'avez pas la permission d\'accéder',\Auth::user()->id);
|
||||||
|
return redirect('/admin')->with('error','Vous n\'avez pas la permission d\'accéder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (strpos($dir->getPermission('rank.0'),$permission) === false)
|
||||||
|
{
|
||||||
|
clog('navigate','danger','Un utilisateur non authentifié tente d\'accéder a un dossier privé','0');
|
||||||
|
abort(401,'Vous n\'avez pas la permission d\'accéder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clog('navigate','danger','Google Drive n\'est pas activé ou les identifiants sont incorrect',\Auth::user()->id);
|
||||||
|
return redirect('/admin')->with('error','Google Drive n\'est pas activé ou les identifiants sont incorrect');
|
||||||
|
}
|
||||||
|
return abort(500,'Wow... Aucune idée comment ce qui viens d\'arriver');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
|
||||||
|
class CheckPerm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \Closure $next
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function handle($request, Closure $next,$permission)
|
||||||
|
{
|
||||||
|
if (\Auth::user()->p($permission) != 1)
|
||||||
|
{
|
||||||
|
clog('navigate','danger','L\'utilisateur n\'est pas autorisé à effectuer cette action',\Auth::user()->id);
|
||||||
|
return redirect('/admin')->with('error','Vous n\'êtes pas autorisé à effectuer cette action');
|
||||||
|
}
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
function getStatus()
|
function getStatus()
|
||||||
{
|
{
|
||||||
$client = new GuzzleHttp\Client();
|
$client = new GuzzleHttp\Client();
|
||||||
@@ -17,3 +22,87 @@ function getStatus()
|
|||||||
|
|
||||||
return $isBroken;
|
return $isBroken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $type
|
||||||
|
* @param string $result
|
||||||
|
* @param string $event
|
||||||
|
* @param int $user_id
|
||||||
|
* @param null $obj_type
|
||||||
|
* @param null $obj_id
|
||||||
|
*/
|
||||||
|
function clog(string $type,string $result,string $event,$user_id = null,$obj_type = null,$obj_id = null)
|
||||||
|
{
|
||||||
|
$log = new Log;
|
||||||
|
|
||||||
|
$log->result = $result;
|
||||||
|
$log->event = $event;
|
||||||
|
$log->type = $type;
|
||||||
|
|
||||||
|
if ($user_id != null)
|
||||||
|
{
|
||||||
|
$log->user_id = $user_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$log->user_id = \Auth::User()->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($obj_type != null)
|
||||||
|
{
|
||||||
|
$log->logable_type = $obj_type;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$log->logable_type = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj_id != null)
|
||||||
|
{
|
||||||
|
$log->logable_id = $obj_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$log->logable_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$log->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
function clogNav($event)
|
||||||
|
{
|
||||||
|
clog('navigate','success',$event);
|
||||||
|
}
|
||||||
|
|
||||||
|
function GetSizeName($octet)
|
||||||
|
{
|
||||||
|
// Array contenant les differents unités
|
||||||
|
$unite = array('octet','ko','mo','go');
|
||||||
|
|
||||||
|
if ($octet < 1000) // octet
|
||||||
|
{
|
||||||
|
return $octet.' '.$unite[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($octet < 1000000) // ko
|
||||||
|
{
|
||||||
|
$ko = round($octet/1024,2);
|
||||||
|
return $ko.' '.$unite[1];
|
||||||
|
}
|
||||||
|
else // Mo ou Go
|
||||||
|
{
|
||||||
|
if ($octet < 1000000000) // Mo
|
||||||
|
{
|
||||||
|
$mo = round($octet/(1024*1024),2);
|
||||||
|
return $mo.' '.$unite[2];
|
||||||
|
}
|
||||||
|
else // Go
|
||||||
|
{
|
||||||
|
$go = round($octet/(1024*1024*1024),2);
|
||||||
|
return $go.' '.$unite[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+123
@@ -3,7 +3,37 @@
|
|||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use mysql_xdevapi\Collection;
|
||||||
|
use function foo\func;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Item
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $category_id
|
||||||
|
* @property int $quantity
|
||||||
|
* @property string $name
|
||||||
|
* @property string $official_number
|
||||||
|
* @property string $desc
|
||||||
|
* @property array $metadata
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Booking[] $bookings
|
||||||
|
* @property-read int|null $bookings_count
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereCategoryId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereMetadata($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereOfficialNumber($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereQuantity($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Item whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Item extends Model
|
class Item extends Model
|
||||||
{
|
{
|
||||||
public static function explodeItems($items)
|
public static function explodeItems($items)
|
||||||
@@ -17,4 +47,97 @@ class Item extends Model
|
|||||||
$col_items->forget(0);
|
$col_items->forget(0);
|
||||||
return $col_items;
|
return $col_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'metadata' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function bookings()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Booking');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category()
|
||||||
|
{
|
||||||
|
if (\App\ItemCategory::find($this->category_id) == null)
|
||||||
|
{
|
||||||
|
$this->category_id = -1;
|
||||||
|
$this->save();
|
||||||
|
$c = new \App\ItemCategory();
|
||||||
|
$c->name = "[Categorie Supprimé]";
|
||||||
|
$c->is_training = 0;
|
||||||
|
$c->is_op_appro = 0;
|
||||||
|
|
||||||
|
return $c;
|
||||||
|
}
|
||||||
|
return \App\ItemCategory::find($this->category_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function available($begin = null,$end = null)
|
||||||
|
{
|
||||||
|
if ($begin == null && $end == null)
|
||||||
|
{
|
||||||
|
return $this->quantity - $this->booked();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $this->quantity - $this->booked($begin,$end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function booked($begin_time = null,$end_time = null)
|
||||||
|
{
|
||||||
|
$nbBooked = 0;
|
||||||
|
foreach ($this->bookings as $b)
|
||||||
|
{
|
||||||
|
if ($begin_time != null && $end_time != null)
|
||||||
|
{
|
||||||
|
$b_begin_time = null;
|
||||||
|
$b_end_time = null;
|
||||||
|
if ($b->bookable_type == 'App\Course')
|
||||||
|
{
|
||||||
|
$b_begin_time = $b->bookable->event->date_begin;
|
||||||
|
$b_end_time = $b->bookable->event->date_end;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$b_begin_time = $b->bookable->date_begin;
|
||||||
|
$b_end_time = $b->bookable->date_end;
|
||||||
|
}
|
||||||
|
if (date('U',strtotime($b_begin_time)) <= date('U',strtotime($begin_time)) && date('U',strtotime($b_end_time)) <= date('U',strtotime($end_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($begin_time)))
|
||||||
|
{
|
||||||
|
$nbBooked = $nbBooked + $b->amount;
|
||||||
|
}
|
||||||
|
elseif (date('U',strtotime($b_begin_time)) <= date('U',strtotime($begin_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($end_time)))
|
||||||
|
{
|
||||||
|
$nbBooked = $nbBooked + $b->amount;
|
||||||
|
}
|
||||||
|
elseif (date('U',strtotime($b_begin_time)) >= date('U',strtotime($begin_time)) && date('U',strtotime($b_begin_time)) <= date('U',strtotime($end_time)) && date('U',strtotime($b_end_time)) >= date('U',strtotime($end_time)))
|
||||||
|
{
|
||||||
|
$nbBooked = $nbBooked + $b->amount;
|
||||||
|
}
|
||||||
|
elseif (date('U',strtotime($b_begin_time)) >= date('U',strtotime($begin_time)) && date('U',strtotime($b_begin_time)) <= date('U',strtotime($end_time)))
|
||||||
|
{
|
||||||
|
$nbBooked = $nbBooked + $b->amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$nbBooked = $nbBooked + $b->amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $nbBooked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function training()
|
||||||
|
{
|
||||||
|
$training = collect();
|
||||||
|
|
||||||
|
$training = \App\Item::all()->filter(function($value,$key){
|
||||||
|
return $value->category()->is_training == 1 && $value->category()->is_op_appro != 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
return $training;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\ItemCategory
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $desc
|
||||||
|
* @property int $is_training
|
||||||
|
* @property int $is_op_appro
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Item[] $items
|
||||||
|
* @property-read int|null $items_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereIsOpAppro($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereIsTraining($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\ItemCategory whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class ItemCategory extends Model
|
||||||
|
{
|
||||||
|
public function items()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Item','category_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
}
|
||||||
+42
-3
@@ -4,9 +4,48 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Job
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $desc
|
||||||
|
* @property string $permissions
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job wherePermissions($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Job whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Job extends Model
|
class Job extends Model
|
||||||
{
|
{
|
||||||
protected $casts = [
|
public function permissions()
|
||||||
'perm' => 'array',
|
{
|
||||||
];
|
return collect(json_decode($this->permissions,true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function permission($permission)
|
||||||
|
{
|
||||||
|
foreach ($this->permissions() as $perm => $value)
|
||||||
|
{
|
||||||
|
if ($permission == $perm)
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function p($perm)
|
||||||
|
{
|
||||||
|
return $this->permission($perm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\LessonPlan
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $file
|
||||||
|
* @property int|null $course_id
|
||||||
|
* @property string|null $desc
|
||||||
|
* @property string|null $comment
|
||||||
|
* @property int $approved
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \App\Course|null $course
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereApproved($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereComment($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereCourseId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereFile($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\LessonPlan whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class LessonPlan extends Model
|
||||||
|
{
|
||||||
|
public function course()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Course');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,24 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Local
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $desc
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Local whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Local extends Model
|
class Local extends Model
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
+64
-8
@@ -4,6 +4,34 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Log
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $type
|
||||||
|
* @property string $result
|
||||||
|
* @property string $event
|
||||||
|
* @property int $user_id
|
||||||
|
* @property string $logable_type
|
||||||
|
* @property int $logable_id
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $logable
|
||||||
|
* @property-read \App\User $user
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereEvent($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereLogableId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereLogableType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereResult($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Log whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Log extends Model
|
class Log extends Model
|
||||||
{
|
{
|
||||||
public function user()
|
public function user()
|
||||||
@@ -11,17 +39,45 @@ class Log extends Model
|
|||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function saveLog($action, $user = "default")
|
public function logable()
|
||||||
{
|
{
|
||||||
$log = new Log;
|
return $this->morphTo();
|
||||||
|
}
|
||||||
|
|
||||||
if ($user == "default") {
|
public function typeColor()
|
||||||
$user = \Auth::User()->id;
|
{
|
||||||
|
switch ($this->type)
|
||||||
|
{
|
||||||
|
case 'add':
|
||||||
|
return 'success';
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
return 'primary';
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
return 'warning';
|
||||||
|
break;
|
||||||
|
case 'see':
|
||||||
|
return 'info';
|
||||||
|
break;
|
||||||
|
case 'navigate':
|
||||||
|
return 'secondary';
|
||||||
|
break;
|
||||||
|
case 'error':
|
||||||
|
return 'danger';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$log->action = $action;
|
public function logableURL()
|
||||||
$log->user_id = $user;
|
{
|
||||||
|
if ($this->logable != null)
|
||||||
$log->save();
|
{
|
||||||
|
switch ($this->logable_type)
|
||||||
|
{
|
||||||
|
case "App\News":
|
||||||
|
return "/news/".$this->logable->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,42 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Message
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $title
|
||||||
|
* @property string $body
|
||||||
|
* @property int $publish
|
||||||
|
* @property int $private
|
||||||
|
* @property int $user_id
|
||||||
|
* @property array $data
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereBody($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereData($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message wherePrivate($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message wherePublish($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereTitle($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Message whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Message extends Model
|
class Message extends Model
|
||||||
{
|
{
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'data' => 'array',
|
'data' => 'array',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,43 @@
|
|||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Facades\Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\News
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $title
|
||||||
|
* @property string $body
|
||||||
|
* @property int $user_id
|
||||||
|
* @property int $publish
|
||||||
|
* @property array $tags
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Picture[] $pictures
|
||||||
|
* @property-read int|null $pictures_count
|
||||||
|
* @property-read \App\User $user
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereBody($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News wherePublish($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereTags($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereTitle($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\News whereUserId($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class News extends Model
|
class News extends Model
|
||||||
{
|
{
|
||||||
|
protected $casts = [
|
||||||
|
'tags' => 'array',
|
||||||
|
];
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\User');
|
return $this->belongsTo('App\User');
|
||||||
@@ -15,4 +49,47 @@ class News extends Model
|
|||||||
{
|
{
|
||||||
return $this->morphMany('App\Picture', 'pictureable');
|
return $this->morphMany('App\Picture', 'pictureable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allWithWeeklyMsg()
|
||||||
|
{
|
||||||
|
|
||||||
|
$news = \App\News::all();
|
||||||
|
|
||||||
|
foreach (\App\Event::all() as $event)
|
||||||
|
{
|
||||||
|
if($event->use_weekly_msg == 1)
|
||||||
|
{
|
||||||
|
if (strtotime($event->weekly_msg_publication_time) <= time())
|
||||||
|
{
|
||||||
|
$news->push(self::getWeeklyMsg($event));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $news;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getWeeklyMsg(\App\Event $event)
|
||||||
|
{
|
||||||
|
$n = new News();
|
||||||
|
|
||||||
|
$n->event_id = $event->id;
|
||||||
|
$n->title = 'Message de la semaine du '.date('Y-m-d',strtotime($event->date_begin));
|
||||||
|
$n->body = $event->desc;
|
||||||
|
$n->user_id = $event->user_id;
|
||||||
|
$n->publish = 1;
|
||||||
|
$n->created_at = $event->created_at;
|
||||||
|
$n->updated_at = $event->updated_at;
|
||||||
|
$n->tags = ['message de la semaine','Important'];
|
||||||
|
if ($event->weekly_msg_file != null)
|
||||||
|
{
|
||||||
|
$n->files = $event->weekly_msg_file;
|
||||||
|
}
|
||||||
|
return $n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Notifications;
|
namespace App\Notifications;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Messages\BroadcastMessage;
|
||||||
use Illuminate\Notifications\Notification;
|
use Illuminate\Notifications\Notification;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Notifications\Messages\MailMessage;
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
@@ -13,6 +14,7 @@ class Alert extends Notification
|
|||||||
|
|
||||||
protected $fromUser;
|
protected $fromUser;
|
||||||
protected $myNotification;
|
protected $myNotification;
|
||||||
|
private $myUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new notification instance.
|
* Create a new notification instance.
|
||||||
@@ -34,7 +36,7 @@ class Alert extends Notification
|
|||||||
*/
|
*/
|
||||||
public function via($notifiable)
|
public function via($notifiable)
|
||||||
{
|
{
|
||||||
return ['database'];
|
return ['database','broadcast'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,4 +53,18 @@ class Alert extends Notification
|
|||||||
'url' => $this->myUrl,
|
'url' => $this->myUrl,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function toBroadcast($notifiable)
|
||||||
|
{
|
||||||
|
return new BroadcastMessage([
|
||||||
|
'from' => $this->fromUser,
|
||||||
|
'msg' => $this->myNotification,
|
||||||
|
'url' => $this->myUrl,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function broadcastType()
|
||||||
|
{
|
||||||
|
return 'notification.alert';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class ScheduleNotification extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
protected String $name;
|
||||||
|
protected String $msg;
|
||||||
|
protected String $url;
|
||||||
|
protected String $icon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @param String $name
|
||||||
|
* @param String $msg
|
||||||
|
* @param String $url
|
||||||
|
*/
|
||||||
|
public function __construct(String $name,String $msg,String $url)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
$this->msg = $msg;
|
||||||
|
$this->url = $url;
|
||||||
|
$this->icon = '<i class="far fa-calendar"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['database','broadcast'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->name,
|
||||||
|
'msg' => $this->msg,
|
||||||
|
'url' => $this->url,
|
||||||
|
'icon' => $this->icon
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function broadcastType()
|
||||||
|
{
|
||||||
|
return 'notification.schedule';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Messages\MailMessage;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
class SystemNotification extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return (new MailMessage)
|
||||||
|
->line('The introduction to the notification.')
|
||||||
|
->action('Notification Action', url('/'))
|
||||||
|
->line('Thank you for using our application!');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
+119
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use function GuzzleHttp\Promise\all;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\OCOM
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $ocom
|
||||||
|
* @property string $objectif_competence
|
||||||
|
* @property string $nbPeriode
|
||||||
|
* @property string $objectif_rendement
|
||||||
|
* @property string $oren
|
||||||
|
* @property int $complementary
|
||||||
|
* @property string $course_id
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereComplementary($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereCourseId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereNbPeriode($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereObjectifCompetence($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereObjectifRendement($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereOcom($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereOren($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\OCOM whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class OCOM extends Model
|
||||||
|
{
|
||||||
|
public function courses()
|
||||||
|
{
|
||||||
|
$courses_id = explode(',',$this->course_id);
|
||||||
|
$courses = collect();
|
||||||
|
foreach ($courses_id as $course_id)
|
||||||
|
{
|
||||||
|
$courses->push(\App\Course::find($course_id));
|
||||||
|
}
|
||||||
|
return $courses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveCourses($courses)
|
||||||
|
{
|
||||||
|
$courses_id = explode(',',$this->course_id);
|
||||||
|
foreach ($courses as $cours)
|
||||||
|
{
|
||||||
|
if ($cours != null){
|
||||||
|
array_push($courses_id,$cours->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$courses_id = array_unique($courses_id);
|
||||||
|
$courses_id = array_filter($courses_id);
|
||||||
|
$this->course_id = implode(',',$courses_id);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveCourse($course)
|
||||||
|
{
|
||||||
|
$courses_id = explode(',',$this->course_id);
|
||||||
|
array_push($courses_id,$course->id);
|
||||||
|
$courses_id = array_unique($courses_id);
|
||||||
|
$courses_id = array_filter($courses_id);
|
||||||
|
$this->course_id = implode(',',$courses_id);
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function wasGiven()
|
||||||
|
{
|
||||||
|
$courses = Course::where('ocom',$this->ocom)->get();
|
||||||
|
$result = collect();
|
||||||
|
$from = strtotime(\App\Config::getData('instruction_year_begin'));
|
||||||
|
$to = strtotime(\App\Config::getData('instruction_year_end'));
|
||||||
|
|
||||||
|
foreach ($courses as $course)
|
||||||
|
{
|
||||||
|
$event = $course->event;
|
||||||
|
if (strtotime($event->date_begin) >= $from)
|
||||||
|
{
|
||||||
|
if (strtotime($event->date_begin) <= $to)
|
||||||
|
{
|
||||||
|
$result->push($course->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateWasGiven()
|
||||||
|
{
|
||||||
|
$this->course_id = implode(",",$this->wasGiven()->toArray());
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function wasUpdateGivenAll()
|
||||||
|
{
|
||||||
|
$ocoms = OCOM::all();
|
||||||
|
foreach ($ocoms as $o)
|
||||||
|
{
|
||||||
|
$o->updateWasGiven();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function findByOCOM($ocom)
|
||||||
|
{
|
||||||
|
return OCOM::where('ocom','=',$ocom)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDurationInMin()
|
||||||
|
{
|
||||||
|
return $this->nbPeriode * 30;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,359 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Permission
|
||||||
|
*
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Permission newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Permission newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Permission query()
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Permission extends Model
|
||||||
|
{
|
||||||
|
const PERMISSIONS = [
|
||||||
|
'news' => [
|
||||||
|
'news_see' => [
|
||||||
|
'ckey' => 'news_see',
|
||||||
|
'communName' => 'Voir les nouvelles',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les nouvelles',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'news_add' => [
|
||||||
|
'ckey' => 'news_add',
|
||||||
|
'communName' => 'Ajouter une nouvelles',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter une nouvelle',
|
||||||
|
'icon' => 'fa-plus',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'news_edit' => [
|
||||||
|
'ckey' => 'news_edit',
|
||||||
|
'communName' => 'Modifier une nouvelles',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier une nouvelle',
|
||||||
|
'icon' => 'fa-edit',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'news_delete' => [
|
||||||
|
'ckey' => 'news_delete',
|
||||||
|
'communName' => 'Supprimer une nouvelles',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer une nouvelle',
|
||||||
|
'icon' => 'fa-close',
|
||||||
|
'valeur' => 0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'inventory' => [
|
||||||
|
'inventory_see' => [
|
||||||
|
'ckey' => 'inventory_see',
|
||||||
|
'communName' => 'Voir l\'inventaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter l\'inventaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'inventory_add' => [
|
||||||
|
'ckey' => 'inventory_add',
|
||||||
|
'communName' => 'Ajouter item a l\'inventaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un item a l\'inventaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'inventory_edit' => [
|
||||||
|
'ckey' => 'inventory_edit',
|
||||||
|
'communName' => 'Modifier un item de l\'inventaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier un item de l\'inventaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'inventory_delete' => [
|
||||||
|
'ckey' => 'inventory_delete',
|
||||||
|
'communName' => 'Supprimer un item de l\'inventaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer un item de l\'inventaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'user' => [
|
||||||
|
'user_see' => [
|
||||||
|
'ckey' => 'user_see',
|
||||||
|
'communName' => 'Voir la liste des utilisateurs',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter la liste des utilisateurs',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'user_add' => [
|
||||||
|
'ckey' => 'user_add',
|
||||||
|
'communName' => 'Ajouter un utilisateur',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un autre utilisateur',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'user_edit' => [
|
||||||
|
'ckey' => 'user_edit',
|
||||||
|
'communName' => 'Modifier un utilisateur',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier un autre utilisateur',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'user_delete' => [
|
||||||
|
'ckey' => 'user_delete',
|
||||||
|
'communName' => 'Supprimer un utilisateur',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer un autre utilisateur',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'config' => [
|
||||||
|
'config_see' => [
|
||||||
|
'ckey' => 'config_see',
|
||||||
|
'communName' => 'Voir les configurations',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les configurations',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'config_edit' => [
|
||||||
|
'ckey' => 'config_edit',
|
||||||
|
'communName' => 'Modifier les configurations',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier les configurations',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'statistique' => [
|
||||||
|
'stats_see' => [
|
||||||
|
'ckey' => 'stats_see',
|
||||||
|
'communName' => 'Voir les statistiques',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les statistiques',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'Instruction' => [
|
||||||
|
'instruction_guide_see' => [
|
||||||
|
'ckey' => 'instruction_guide_see',
|
||||||
|
'communName' => 'Voir les guides pédagogiques et normes de qualifications',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les guides pédagogiques et normes de qualifications',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'instruction_db_ocom_see' => [
|
||||||
|
'ckey' => 'instruction_db_ocom_see',
|
||||||
|
'communName' => 'Voir la base de donnée de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter la base de donnée des cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'instruction_db_ocom_add' => [
|
||||||
|
'ckey' => 'instruction_db_ocom_add',
|
||||||
|
'communName' => 'Ajouter à la base de donnée de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter à la base de donnée des cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'instruction_db_ocom_edit' => [
|
||||||
|
'ckey' => 'instruction_db_ocom_edit',
|
||||||
|
'communName' => 'Modifier la base de donnée de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier la base de donnée des cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'instruction_db_ocom_delete' => [
|
||||||
|
'ckey' => 'instruction_db_ocom_delete',
|
||||||
|
'communName' => 'Supprimer de la base de donnée de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer de la base de donnée des cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'course_see_all' => [
|
||||||
|
'ckey' => 'course_see_all',
|
||||||
|
'communName' => 'Voir les cours de tous les utilisateurs',
|
||||||
|
'desc' => 'L\'utilisateur peut-il voir les cours de tous les utilisateurs',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'course_comment_officer' => [
|
||||||
|
'ckey' => 'course_comment_officer',
|
||||||
|
'communName' => 'Ajouter un commentaire sur n\'importe quel cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un commentaire sur n\'importe quel cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'course_validate_plan' => [
|
||||||
|
'ckey' => 'course_validate_plan',
|
||||||
|
'communName' => 'Valider n\'importe quel plan de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il valider n\'importe quel plan de cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'course_comment_plan_officer' => [
|
||||||
|
'ckey' => 'course_comment_plan_officer',
|
||||||
|
'communName' => 'Ajouter un commentaire sur n\'importe quel plan de cours',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un commentaire sur n\'importe quel plan de cours',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'Administration' => [
|
||||||
|
'cadet_list_see' => [
|
||||||
|
'ckey' => 'cadet_list_see',
|
||||||
|
'communName' => 'Voir la liste nominative',
|
||||||
|
'desc' => 'L\'utilisateur peut-il voir la liste nominative',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'Horaire' => [
|
||||||
|
'schedule_see' => [
|
||||||
|
'ckey' => 'schedule_see',
|
||||||
|
'communName' => 'Voir l\'horaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter l\'horaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'schedule_add' => [
|
||||||
|
'ckey' => 'schedule_add',
|
||||||
|
'communName' => 'Ajouter un évènement à l\'horaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un évènement à l\'horaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'schedule_edit' => [
|
||||||
|
'ckey' => 'schedule_edit',
|
||||||
|
'communName' => 'Modifier un évènement à l\'horaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier un évènement à l\'horaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'schedule_delete' => [
|
||||||
|
'ckey' => 'schedule_delete',
|
||||||
|
'communName' => 'Supprimer un évènement à l\'horaire',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer un évènement à l\'horaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'article' => [
|
||||||
|
'article_see' => [
|
||||||
|
'ckey' => 'article_see',
|
||||||
|
'communName' => 'Voir les articles',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les articles',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'article_add' => [
|
||||||
|
'ckey' => 'article_add',
|
||||||
|
'communName' => 'Ajouter un article',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter un article',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'article_edit' => [
|
||||||
|
'ckey' => 'article_edit',
|
||||||
|
'communName' => 'Modifier un article',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier un évènement à l\'horaire',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'article_delete' => [
|
||||||
|
'ckey' => 'article_delete',
|
||||||
|
'communName' => 'Supprimer un article',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer un article',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'picture' => [
|
||||||
|
'picture_see' => [
|
||||||
|
'ckey' => 'picture_see',
|
||||||
|
'communName' => 'Voir les images',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les images',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'picture_add' => [
|
||||||
|
'ckey' => 'picture_add',
|
||||||
|
'communName' => 'Ajouter une image',
|
||||||
|
'desc' => 'L\'utilisateur peut-il ajouter une image',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'picture_edit' => [
|
||||||
|
'ckey' => 'picture_edit',
|
||||||
|
'communName' => 'Modifier une image',
|
||||||
|
'desc' => 'L\'utilisateur peut-il modifier une image',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'picture_delete' => [
|
||||||
|
'ckey' => 'picture_delete',
|
||||||
|
'communName' => 'Supprimer une image',
|
||||||
|
'desc' => 'L\'utilisateur peut-il supprimer une image',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'file' => [
|
||||||
|
'file_see' => [
|
||||||
|
'ckey' => 'file_see',
|
||||||
|
'communName' => 'Voir les fichiers publiques',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter les fichiers publiques',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
'drive_see' => [
|
||||||
|
'ckey' => 'drive_see',
|
||||||
|
'communName' => 'Voir l\'explorateur de fichier',
|
||||||
|
'desc' => 'L\'utilisateur peut-il consulter l\'explorateur de fichier',
|
||||||
|
'icon' => 'fa-eye',
|
||||||
|
'valeur' => 0
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
public static function all($value = null,$columns = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
$permissions = collect();
|
||||||
|
foreach (self::PERMISSIONS as $key => $cat)
|
||||||
|
{
|
||||||
|
foreach ($cat as $c)
|
||||||
|
{
|
||||||
|
$p = new Permission();
|
||||||
|
$p->ckey = $c['ckey'];
|
||||||
|
$p->communName = $c['communName'];
|
||||||
|
$p->desc = $c['desc'];
|
||||||
|
$p->icon = $c['icon'];
|
||||||
|
if ($value == null)
|
||||||
|
{
|
||||||
|
$p->value = $c['valeur'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$p->value = $value;
|
||||||
|
}
|
||||||
|
$permissions->push($p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allToArray()
|
||||||
|
{
|
||||||
|
return self::PERMISSIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function allToString($value = null)
|
||||||
|
{
|
||||||
|
$perm = [];
|
||||||
|
foreach (Permission::all($value) as $p)
|
||||||
|
{
|
||||||
|
$perm[$p->ckey] = $p->value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return \GuzzleHttp\json_encode($perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,10 +4,42 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Picture
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $url
|
||||||
|
* @property string $title
|
||||||
|
* @property string $desc
|
||||||
|
* @property int $pictureable_id
|
||||||
|
* @property string $pictureable_type
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $pictureable
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture wherePictureableId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture wherePictureableType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereTitle($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Picture whereUrl($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Picture extends Model
|
class Picture extends Model
|
||||||
{
|
{
|
||||||
public function pictureable()
|
public function pictureable()
|
||||||
{
|
{
|
||||||
return $this->morphTo();
|
return $this->morphTo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function logs()
|
||||||
|
{
|
||||||
|
return $this->morphMany('App\Log', 'logable');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ namespace App\Providers;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@@ -15,6 +18,37 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paginate a standard Laravel Collection.
|
||||||
|
*
|
||||||
|
* @param int $perPage
|
||||||
|
* @param int $total
|
||||||
|
* @param int $page
|
||||||
|
* @param string $pageName
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
Collection::macro('paginate', function($perPage, $total = null, $page = null, $pageName = 'page') {
|
||||||
|
$page = $page ?: LengthAwarePaginator::resolveCurrentPage($pageName);
|
||||||
|
return new LengthAwarePaginator(
|
||||||
|
$this->forPage($page, $perPage),
|
||||||
|
$total ?: $this->count(),
|
||||||
|
$perPage,
|
||||||
|
$page,
|
||||||
|
[
|
||||||
|
'path' => LengthAwarePaginator::resolveCurrentPath(),
|
||||||
|
'pageName' => $pageName,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
Blade::directive('loaderDot', function () {
|
||||||
|
return '<div class="text-center"><div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div></div>';
|
||||||
|
});
|
||||||
|
|
||||||
|
Blade::directive('loaderRipple', function () {
|
||||||
|
return '<div class="lds-ripple"><div></div><div></div></div>';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter;
|
||||||
|
|
||||||
|
class GoogleDriveServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
\Storage::extend('google', function($app, $config) {
|
||||||
|
$client = new \Google_Client();
|
||||||
|
$client->setClientId(\Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_ID')));
|
||||||
|
$client->setClientSecret(\Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_CLIENT_SECRET')));
|
||||||
|
$client->refreshToken(\Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_REFRESH_TOKEN')));
|
||||||
|
$service = new \Google_Service_Drive($client);
|
||||||
|
|
||||||
|
$options = [];
|
||||||
|
if(isset($config['teamDriveId'])) {
|
||||||
|
$options['teamDriveId'] = $config['teamDriveId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$adapter = new GoogleDriveAdapter($service, \Crypt::decryptString(\App\Config::getData('GOOGLE_DRIVE_FOLDER_ID')), $options);
|
||||||
|
|
||||||
|
return new \League\Flysystem\Filesystem($adapter);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
use Laravel\Telescope\IncomingEntry;
|
||||||
|
use Laravel\Telescope\Telescope;
|
||||||
|
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||||
|
|
||||||
|
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
// Telescope::night();
|
||||||
|
|
||||||
|
$this->hideSensitiveRequestDetails();
|
||||||
|
|
||||||
|
Telescope::filter(function (IncomingEntry $entry) {
|
||||||
|
if ($this->app->environment('local')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $entry->isReportableException() ||
|
||||||
|
$entry->isFailedRequest() ||
|
||||||
|
$entry->isFailedJob() ||
|
||||||
|
$entry->isScheduledTask() ||
|
||||||
|
$entry->hasMonitoredTag();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent sensitive request details from being logged by Telescope.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function hideSensitiveRequestDetails()
|
||||||
|
{
|
||||||
|
if ($this->app->environment('local')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Telescope::hideRequestParameters(['_token']);
|
||||||
|
|
||||||
|
Telescope::hideRequestHeaders([
|
||||||
|
'cookie',
|
||||||
|
'x-csrf-token',
|
||||||
|
'x-xsrf-token',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the Telescope gate.
|
||||||
|
*
|
||||||
|
* This gate determines who can access Telescope in non-local environments.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function gate()
|
||||||
|
{
|
||||||
|
Gate::define('viewTelescope', function ($user) {
|
||||||
|
return in_array($user->email, [
|
||||||
|
//
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+44
-3
@@ -4,9 +4,50 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Rank
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $name
|
||||||
|
* @property string $desc
|
||||||
|
* @property string $acces_level
|
||||||
|
* @property string $permissions
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereAccesLevel($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereDesc($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereName($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank wherePermissions($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Rank whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Rank extends Model
|
class Rank extends Model
|
||||||
{
|
{
|
||||||
protected $casts = [
|
public function permissions()
|
||||||
'perm' => 'array',
|
{
|
||||||
];
|
return collect(json_decode($this->permissions,true));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function permission($permission)
|
||||||
|
{
|
||||||
|
foreach ($this->permissions() as $perm => $value)
|
||||||
|
{
|
||||||
|
if ($permission == $perm)
|
||||||
|
{
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function p($perm)
|
||||||
|
{
|
||||||
|
return $this->permission($perm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,38 @@ namespace App;
|
|||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use App\Item;
|
use App\Item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Schedule
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $date
|
||||||
|
* @property string $type
|
||||||
|
* @property string $n1_p1_item
|
||||||
|
* @property string $n1_p2_item
|
||||||
|
* @property string $n2_p1_item
|
||||||
|
* @property string $n2_p2_item
|
||||||
|
* @property string $n3_p1_item
|
||||||
|
* @property string $n3_p2_item
|
||||||
|
* @property array $data
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereData($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereDate($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN1P1Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN1P2Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN2P1Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN2P2Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN3P1Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereN3P2Item($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Schedule whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Schedule extends Model
|
class Schedule extends Model
|
||||||
{
|
{
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
|
|||||||
@@ -4,6 +4,27 @@ namespace App;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\Task
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property int $priority
|
||||||
|
* @property string $body
|
||||||
|
* @property int $completed
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task incomplete()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task whereBody($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task whereCompleted($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task wherePriority($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Task whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class Task extends Model
|
class Task extends Model
|
||||||
{
|
{
|
||||||
public function scopeIncomplete($query)
|
public function scopeIncomplete($query)
|
||||||
|
|||||||
+123
@@ -2,9 +2,67 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use phpDocumentor\Reflection\Types\Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* App\User
|
||||||
|
*
|
||||||
|
* @property int $id
|
||||||
|
* @property string $firstname
|
||||||
|
* @property string $lastname
|
||||||
|
* @property string $email
|
||||||
|
* @property string $password
|
||||||
|
* @property string $rank_id
|
||||||
|
* @property string $adress
|
||||||
|
* @property string $telephone
|
||||||
|
* @property string $age
|
||||||
|
* @property string $avatar
|
||||||
|
* @property string $sexe
|
||||||
|
* @property string $job_id
|
||||||
|
* @property string $api_token
|
||||||
|
* @property string|null $remember_token
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Booking[] $bookings
|
||||||
|
* @property-read int|null $bookings_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Course[] $courses
|
||||||
|
* @property-read int|null $courses_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Event[] $events
|
||||||
|
* @property-read int|null $events_count
|
||||||
|
* @property-read \App\Job $job
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Log[] $logs
|
||||||
|
* @property-read int|null $logs_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Message[] $messages
|
||||||
|
* @property-read int|null $messages_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\News[] $news
|
||||||
|
* @property-read int|null $news_count
|
||||||
|
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
||||||
|
* @property-read int|null $notifications_count
|
||||||
|
* @property-read \App\Rank $rank
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereAdress($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereAge($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereApiToken($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereAvatar($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereEmail($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereFirstname($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereJobId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereLastname($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User wherePassword($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRankId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereRememberToken($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereSexe($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereTelephone($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\User whereUpdatedAt($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
@@ -27,6 +85,16 @@ class User extends Authenticatable
|
|||||||
'password', 'remember_token',
|
'password', 'remember_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function rank()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Rank');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function job()
|
||||||
|
{
|
||||||
|
return $this->belongsTo('App\Job');
|
||||||
|
}
|
||||||
|
|
||||||
public function logs()
|
public function logs()
|
||||||
{
|
{
|
||||||
return $this->hasMany(Log::class);
|
return $this->hasMany(Log::class);
|
||||||
@@ -50,6 +118,26 @@ class User extends Authenticatable
|
|||||||
return $this->hasMany(Message::class);
|
return $this->hasMany(Message::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function events()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Event');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bookings()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Booking');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function courses()
|
||||||
|
{
|
||||||
|
return $this->hasMany('App\Course');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function futureCourses()
|
||||||
|
{
|
||||||
|
return \App\Course::allFutureForUser($this->id);
|
||||||
|
}
|
||||||
|
|
||||||
public function routeNotificationForNexmo($notification)
|
public function routeNotificationForNexmo($notification)
|
||||||
{
|
{
|
||||||
return $this->telephone;
|
return $this->telephone;
|
||||||
@@ -264,4 +352,39 @@ class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
return $this->hasMany('App\News');
|
return $this->hasMany('App\News');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function permission($perm)
|
||||||
|
{
|
||||||
|
if ($this->job->permission($perm) == 0)
|
||||||
|
{
|
||||||
|
if ($this->rank->id == 1)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return $this->rank->permission($perm);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $this->job->permission($perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function p($perm)
|
||||||
|
{
|
||||||
|
return $this->permission($perm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNotificationByDay()
|
||||||
|
{
|
||||||
|
return \Auth::user()->notifications->groupBy(function ($val) {
|
||||||
|
return Carbon::parse($val->created_at)->format('Y-m-d');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNotificationForUI(int $number = 8)
|
||||||
|
{
|
||||||
|
return \Auth::user()->notifications->take($number)->groupBy(function ($val) {
|
||||||
|
return Carbon::parse($val->created_at)->format('Y-m-d');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-7
@@ -5,19 +5,32 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1.3",
|
"php": "^7.4",
|
||||||
|
"barryvdh/laravel-dompdf": "^0.8.4",
|
||||||
|
"barryvdh/laravel-ide-helper": "2.7.0",
|
||||||
|
"davejamesmiller/laravel-breadcrumbs": "5.3.2",
|
||||||
|
"facade/ignition": "^2.0",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
"guzzlehttp/guzzle": "^6.3",
|
"guzzlehttp/guzzle": "^6.3",
|
||||||
"laravel/framework": "5.6.*",
|
"laravel/framework": "^7.0",
|
||||||
"laravel/tinker": "^1.0",
|
"laravel/helpers": "^1.1",
|
||||||
"nexmo/client": "^1.4"
|
"laravel/nexmo-notification-channel": "^2.2",
|
||||||
|
"laravel/telescope": "^3.5",
|
||||||
|
"laravel/tinker": "^2.0",
|
||||||
|
"laravel/ui": "^2.0",
|
||||||
|
"nao-pon/flysystem-google-drive": "^1.1",
|
||||||
|
"nexmo/client": "^2.0",
|
||||||
|
"pragmarx/version": "^1.2",
|
||||||
|
"pusher/pusher-php-server": "~4.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"filp/whoops": "^2.0",
|
"filp/whoops": "^2.0",
|
||||||
"fzaninotto/faker": "^1.4",
|
"fzaninotto/faker": "^1.4",
|
||||||
|
"laravel/dusk": "^5.6",
|
||||||
"mockery/mockery": "^1.0",
|
"mockery/mockery": "^1.0",
|
||||||
"nunomaduro/collision": "^2.0",
|
"nunomaduro/collision": "^4.1",
|
||||||
"phpunit/phpunit": "^7.0"
|
"phpunit/phpunit": "^8.5",
|
||||||
|
"staudenmeir/dusk-updater": "^1.1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
@@ -49,7 +62,8 @@
|
|||||||
],
|
],
|
||||||
"post-autoload-dump": [
|
"post-autoload-dump": [
|
||||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
"@php artisan package:discover"
|
"@php artisan package:discover",
|
||||||
|
"@php artisan version"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
|||||||
Generated
+5294
-975
File diff suppressed because it is too large
Load Diff
+8
-2
@@ -63,7 +63,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'version' => "3.0.2b",
|
'version' => "3.2.5.",
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -158,18 +158,23 @@ return [
|
|||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
Illuminate\Validation\ValidationServiceProvider::class,
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
*/
|
*/
|
||||||
|
Barryvdh\DomPDF\ServiceProvider::class,
|
||||||
|
'Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
*/
|
*/
|
||||||
App\Providers\AppServiceProvider::class,
|
App\Providers\AppServiceProvider::class,
|
||||||
App\Providers\AuthServiceProvider::class,
|
App\Providers\AuthServiceProvider::class,
|
||||||
// App\Providers\BroadcastServiceProvider::class,
|
App\Providers\BroadcastServiceProvider::class,
|
||||||
App\Providers\EventServiceProvider::class,
|
App\Providers\EventServiceProvider::class,
|
||||||
App\Providers\RouteServiceProvider::class,
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
App\Providers\TelescopeServiceProvider::class,
|
||||||
|
App\Providers\GoogleDriveServiceProvider::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -219,6 +224,7 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| View Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Choose a view to display when Breadcrumbs::render() is called.
|
||||||
|
| Built in templates are:
|
||||||
|
|
|
||||||
|
| - 'breadcrumbs::bootstrap4' - Bootstrap 4
|
||||||
|
| - 'breadcrumbs::bootstrap3' - Bootstrap 3
|
||||||
|
| - 'breadcrumbs::bootstrap2' - Bootstrap 2
|
||||||
|
| - 'breadcrumbs::bulma' - Bulma
|
||||||
|
| - 'breadcrumbs::foundation6' - Foundation 6
|
||||||
|
| - 'breadcrumbs::materialize' - Materialize
|
||||||
|
| - 'breadcrumbs::uikit' - UIkit
|
||||||
|
| - 'breadcrumbs::json-ld' - JSON-LD Structured Data
|
||||||
|
|
|
||||||
|
| Or a custom view, e.g. '_partials/breadcrumbs'.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'view' => 'breadcrumbs::bootstrap4',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Breadcrumbs File(s)
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The file(s) where breadcrumbs are defined. e.g.
|
||||||
|
|
|
||||||
|
| - base_path('routes/breadcrumbs.php')
|
||||||
|
| - glob(base_path('breadcrumbs/*.php'))
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => base_path('routes/breadcrumbs.php'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Exceptions
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Determine when to throw an exception.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException)
|
||||||
|
'unnamed-route-exception' => false,
|
||||||
|
|
||||||
|
// When route-bound breadcrumbs are used and the matching breadcrumb doesn't exist (InvalidBreadcrumbException)
|
||||||
|
'missing-route-bound-breadcrumb-exception' => false,
|
||||||
|
|
||||||
|
// When a named breadcrumb is used but doesn't exist (InvalidBreadcrumbException)
|
||||||
|
'invalid-named-breadcrumb-exception' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Classes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Subclass the default classes for more advanced customisations.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Manager
|
||||||
|
'manager-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsManager::class,
|
||||||
|
|
||||||
|
// Generator
|
||||||
|
'generator-class' => DaveJamesMiller\Breadcrumbs\BreadcrumbsGenerator::class,
|
||||||
|
|
||||||
|
];
|
||||||
@@ -26,7 +26,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
|
'cloud' => env('FILESYSTEM_CLOUD', 'google'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -55,13 +55,13 @@ return [
|
|||||||
'visibility' => 'public',
|
'visibility' => 'public',
|
||||||
],
|
],
|
||||||
|
|
||||||
's3' => [
|
'google' => [
|
||||||
'driver' => 's3',
|
'driver' => 'google',
|
||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
'clientId' => '',
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'clientSecret' => '',
|
||||||
'region' => env('AWS_DEFAULT_REGION'),
|
'refreshToken' => '',
|
||||||
'bucket' => env('AWS_BUCKET'),
|
'folderId' => '',
|
||||||
'url' => env('AWS_URL'),
|
// 'teamDriveId' => env('GOOGLE_DRIVE_TEAM_DRIVE_ID'),
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
+1
-1
@@ -164,7 +164,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'secure' => env('SESSION_SECURE_COOKIE', false),
|
'secure' => env('SESSION_SECURE_COOKIE', null),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Telescope\Http\Middleware\Authorize;
|
||||||
|
use Laravel\Telescope\Watchers;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the subdomain where Telescope will be accessible from. If the
|
||||||
|
| setting is null, Telescope will reside under the same domain as the
|
||||||
|
| application. Otherwise, this value will be used as the subdomain.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'domain' => env('TELESCOPE_DOMAIN', null),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the URI path where Telescope will be accessible from. Feel free
|
||||||
|
| to change this path to anything you like. Note that the URI will not
|
||||||
|
| affect the paths of its internal API that aren't exposed to users.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'path' => env('TELESCOPE_PATH', 'telescope'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Storage Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This configuration options determines the storage driver that will
|
||||||
|
| be used to store Telescope's data. In addition, you may set any
|
||||||
|
| custom options as needed by the particular driver you choose.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('TELESCOPE_DRIVER', 'database'),
|
||||||
|
|
||||||
|
'storage' => [
|
||||||
|
'database' => [
|
||||||
|
'connection' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'chunk' => 1000,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Master Switch
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option may be used to disable all Telescope watchers regardless
|
||||||
|
| of their individual configuration, which simply provides a single
|
||||||
|
| and convenient way to enable or disable Telescope data storage.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'enabled' => env('TELESCOPE_ENABLED', true),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Route Middleware
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These middleware will be assigned to every Telescope route, giving you
|
||||||
|
| the chance to add your own middleware to this list or change any of
|
||||||
|
| the existing middleware. Or, you can simply stick with this list.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'web',
|
||||||
|
Authorize::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Ignored Paths & Commands
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following array lists the URI paths and Artisan commands that will
|
||||||
|
| not be watched by Telescope. In addition to this list, some Laravel
|
||||||
|
| commands, like migrations and queue commands, are always ignored.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'ignore_paths' => [
|
||||||
|
'nova-api*',
|
||||||
|
],
|
||||||
|
|
||||||
|
'ignore_commands' => [
|
||||||
|
//
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Telescope Watchers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following array lists the "watchers" that will be registered with
|
||||||
|
| Telescope. The watchers gather the application's profile data when
|
||||||
|
| a request or task is executed. Feel free to customize this list.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'watchers' => [
|
||||||
|
Watchers\CacheWatcher::class => env('TELESCOPE_CACHE_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\CommandWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
|
||||||
|
'ignore' => [],
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\DumpWatcher::class => env('TELESCOPE_DUMP_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\EventWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
|
||||||
|
'ignore' => [],
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
|
||||||
|
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
|
||||||
|
Watchers\LogWatcher::class => env('TELESCOPE_LOG_WATCHER', true),
|
||||||
|
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\ModelWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
|
||||||
|
'events' => ['eloquent.*'],
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\QueryWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
|
||||||
|
'ignore_packages' => true,
|
||||||
|
'slow' => 100,
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\RequestWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
|
||||||
|
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\GateWatcher::class => [
|
||||||
|
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
|
||||||
|
'ignore_abilities' => [],
|
||||||
|
'ignore_packages' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
|
||||||
|
|
||||||
|
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
mode: absorb
|
||||||
|
blade-directive: version
|
||||||
|
current:
|
||||||
|
label: ''
|
||||||
|
major: 3
|
||||||
|
minor: 2
|
||||||
|
patch: 5
|
||||||
|
prerelease: 11-g4c5d635d
|
||||||
|
buildmetadata: ''
|
||||||
|
commit: 41845
|
||||||
|
timestamp:
|
||||||
|
year: 2020
|
||||||
|
month: 6
|
||||||
|
day: 21
|
||||||
|
hour: 18
|
||||||
|
minute: 44
|
||||||
|
second: 55
|
||||||
|
timezone: America/New_York
|
||||||
|
commit:
|
||||||
|
mode: git-local
|
||||||
|
length: 6
|
||||||
|
increment-by: 1
|
||||||
|
git:
|
||||||
|
from: local
|
||||||
|
commit:
|
||||||
|
local: 'git rev-parse --verify HEAD'
|
||||||
|
remote: 'git ls-remote {$repository}'
|
||||||
|
branch: refs/heads/master
|
||||||
|
repository: ''
|
||||||
|
version:
|
||||||
|
local: 'git describe'
|
||||||
|
remote: 'git ls-remote {$repository} | grep tags/ | grep -v {} | cut -d / -f 3 | sort --version-sort | tail -1'
|
||||||
|
matcher: '/^(?P<label>[v|V]*[er]*[sion]*)[\.|\s]*(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/'
|
||||||
|
timestamp:
|
||||||
|
local: 'git show -s --format=%ci'
|
||||||
|
remote: 'git show -s --format=%ci origin/master'
|
||||||
|
format:
|
||||||
|
regex:
|
||||||
|
optional_bracket: '\[(?P<prefix>.*?)(?P<spaces>\s*)(?P<delimiter>\?\=)(?P<optional>.*?)\]'
|
||||||
|
label: '{$label}'
|
||||||
|
major: '{$major}'
|
||||||
|
minor: '{$minor}'
|
||||||
|
patch: '{$patch}'
|
||||||
|
prerelease: '{$prerelease}'
|
||||||
|
buildmetadata: '{$buildmetadata}'
|
||||||
|
commit: '{$commit}'
|
||||||
|
version: 'v {$major}.{$minor}.{$patch} (commit {$commit})'
|
||||||
|
version-only: 'version {$major}.{$minor}.{$patch}'
|
||||||
|
full: '{$version-only}[.?={$prerelease}][+?={$buildmetadata}] (commit {$commit})'
|
||||||
|
compact: 'v{$major}.{$minor}.{$patch}-{$commit}'
|
||||||
|
timestamp-year: '{$timestamp.year}'
|
||||||
|
timestamp-month: '{$timestamp.month}'
|
||||||
|
timestamp-day: '{$timestamp.day}'
|
||||||
|
timestamp-hour: '{$timestamp.hour}'
|
||||||
|
timestamp-minute: '{$timestamp.minute}'
|
||||||
|
timestamp-second: '{$timestamp.second}'
|
||||||
|
timestamp-timezone: '{$timestamp.timezone}'
|
||||||
|
timestamp-datetime: '{$timestamp.year}-{$timestamp.month}-{$timestamp.day} {$timestamp.hour}:{$timestamp.minute}:{$timestamp.second}'
|
||||||
|
timestamp-full: '{$timestamp.year}-{$timestamp.month}-{$timestamp.day} {$timestamp.hour}:{$timestamp.minute}:{$timestamp.second} {$timestamp.timezone}'
|
||||||
@@ -19,30 +19,14 @@ class CreateUsersTable extends Migration
|
|||||||
$table->string('lastname');
|
$table->string('lastname');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->string('password');
|
$table->string('password');
|
||||||
$table->string('rank')->default(1);
|
$table->string('rank_id')->default(1);
|
||||||
$table->string('adress')->default('unknown');
|
$table->string('adress')->default('unknown');
|
||||||
$table->string('telephone')->default('unknown');
|
$table->string('telephone')->default('unknown');
|
||||||
$table->string('age');
|
$table->string('age');
|
||||||
$table->string('avatar')->default('1');
|
$table->string('avatar')->default('1');
|
||||||
$table->string('sexe');
|
$table->string('sexe');
|
||||||
$table->string('job')->default(6);
|
$table->string('job_id')->default(6);
|
||||||
$table->string('acces_level')->default('unknown');
|
$table->string('api_token', 60)->unique()->default(str_shuffle(str_random(60)));
|
||||||
$table->string('schedule_see')->default('unknown');
|
|
||||||
$table->string('schedule_edit')->default('unknown');
|
|
||||||
$table->string('schedule_notify')->default('unknown');
|
|
||||||
$table->string('message_see')->default('unknown');
|
|
||||||
$table->string('message_edit')->default('unknown');
|
|
||||||
$table->string('message_notify')->default('unknown');
|
|
||||||
$table->string('paper_edit')->default('unknown');
|
|
||||||
$table->string('paper_publish')->default('unknown');
|
|
||||||
$table->string('paper_notify')->default('unknown');
|
|
||||||
$table->string('inventory_see')->default('unknown');
|
|
||||||
$table->string('inventory_edit')->default('unknown');
|
|
||||||
$table->string('inventory_notify')->default('unknown');
|
|
||||||
$table->string('user_see')->default('unknown');
|
|
||||||
$table->string('user_edit')->default('unknown');
|
|
||||||
$table->string('user_notify')->default('unknown');
|
|
||||||
$table->string('api_token', 60)->unique()->default(str_random(60));
|
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ class CreateLogsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('logs', function (Blueprint $table) {
|
Schema::create('logs', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->string('type');
|
||||||
|
$table->string('result');
|
||||||
|
$table->text('event');
|
||||||
$table->integer('user_id');
|
$table->integer('user_id');
|
||||||
$table->string('action');
|
$table->string('logable_type');
|
||||||
|
$table->integer('logable_id');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,22 +17,7 @@ class CreateJobsTable extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->text('desc');
|
$table->text('desc');
|
||||||
$table->text('acces_level');
|
$table->text('permissions');
|
||||||
$table->boolean('schedule_see');
|
|
||||||
$table->boolean('schedule_edit');
|
|
||||||
$table->boolean('schedule_notify');
|
|
||||||
$table->boolean('message_see');
|
|
||||||
$table->boolean('message_edit');
|
|
||||||
$table->boolean('message_notify');
|
|
||||||
$table->boolean('paper_edit');
|
|
||||||
$table->boolean('paper_publish');
|
|
||||||
$table->boolean('paper_notify');
|
|
||||||
$table->boolean('inventory_see');
|
|
||||||
$table->boolean('inventory_edit');
|
|
||||||
$table->boolean('inventory_notify');
|
|
||||||
$table->boolean('user_see');
|
|
||||||
$table->boolean('user_edit');
|
|
||||||
$table->boolean('user_notify');
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,22 +16,9 @@ class CreateRanksTable extends Migration
|
|||||||
Schema::create('ranks', function (Blueprint $table) {
|
Schema::create('ranks', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->text('desc');
|
||||||
$table->text('acces_level');
|
$table->text('acces_level');
|
||||||
$table->boolean('schedule_see');
|
$table->text('permissions');
|
||||||
$table->boolean('schedule_edit');
|
|
||||||
$table->boolean('schedule_notify');
|
|
||||||
$table->boolean('message_see');
|
|
||||||
$table->boolean('message_edit');
|
|
||||||
$table->boolean('message_notify');
|
|
||||||
$table->boolean('paper_edit');
|
|
||||||
$table->boolean('paper_publish');
|
|
||||||
$table->boolean('paper_notify');
|
|
||||||
$table->boolean('inventory_see');
|
|
||||||
$table->boolean('inventory_edit');
|
|
||||||
$table->boolean('inventory_notify');
|
|
||||||
$table->boolean('user_see');
|
|
||||||
$table->boolean('user_edit');
|
|
||||||
$table->boolean('user_notify');
|
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,9 +15,12 @@ class CreateItemsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('items', function (Blueprint $table) {
|
Schema::create('items', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
|
$table->integer('category_id');
|
||||||
$table->integer('quantity');
|
$table->integer('quantity');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('official_number');
|
||||||
$table->string('desc');
|
$table->string('desc');
|
||||||
|
$table->text('metadata');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class CreateNewsTable extends Migration
|
|||||||
$table->text('body');
|
$table->text('body');
|
||||||
$table->integer('user_id');
|
$table->integer('user_id');
|
||||||
$table->boolean('publish');
|
$table->boolean('publish');
|
||||||
|
$table->string('tags')->default("[]");
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ class CreateComplementaryActivitiesTable extends Migration
|
|||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->text('public_body');
|
$table->text('public_body');
|
||||||
|
$table->text('public_slogan');
|
||||||
|
$table->text('public_header_picture');
|
||||||
$table->text('admin_desc');
|
$table->text('admin_desc');
|
||||||
|
$table->string('calendar_color')->default('blue');
|
||||||
|
$table->string('calendar_icon')->default('<i class="fa fa-question-circle"></i>');
|
||||||
$table->string('begin_time')->default('12:00');
|
$table->string('begin_time')->default('12:00');
|
||||||
$table->string('end_time')->default('13:00');
|
$table->string('end_time')->default('13:00');
|
||||||
$table->string('location')->default('Escadron');
|
$table->string('location')->default('Escadron');
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class CreatePicturesTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('pictures', function (Blueprint $table) {
|
Schema::create('pictures', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->string('url');
|
$table->text('url');
|
||||||
$table->string('title');
|
$table->string('title');
|
||||||
$table->text('desc');
|
$table->text('desc');
|
||||||
$table->integer('pictureable_id');
|
$table->integer('pictureable_id');
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateEventsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('events', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('date_begin');
|
||||||
|
$table->string('date_end');
|
||||||
|
$table->string('type');
|
||||||
|
$table->string('user_id');
|
||||||
|
$table->string('location');
|
||||||
|
$table->boolean('is_mandatory');
|
||||||
|
$table->boolean('use_weekly_msg');
|
||||||
|
$table->boolean('use_schedule');
|
||||||
|
$table->text('desc');
|
||||||
|
$table->text('msg');
|
||||||
|
$table->string('weekly_msg_file');
|
||||||
|
$table->text('schedule');
|
||||||
|
$table->string('calendar_color');
|
||||||
|
$table->string('calendar_icon');
|
||||||
|
$table->string('weekly_msg_publication_time')->default('-5day');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('events');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateCoursesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('courses', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('ocom');
|
||||||
|
$table->integer('periode');
|
||||||
|
$table->integer('level');
|
||||||
|
$table->string('location');
|
||||||
|
$table->text('desc');
|
||||||
|
$table->text('comment');
|
||||||
|
$table->text('comment_officer');
|
||||||
|
$table->integer('event_id');
|
||||||
|
$table->string('user_id');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('courses');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateBookingsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('bookings', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->integer('item_id');
|
||||||
|
$table->integer('amount');
|
||||||
|
$table->integer('bookable_id');
|
||||||
|
$table->string('bookable_type');
|
||||||
|
$table->integer('user_id');
|
||||||
|
$table->text('comment');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('bookings');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateItemCategoriesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('item_categories', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('desc');
|
||||||
|
$table->boolean('is_training');
|
||||||
|
$table->boolean('is_op_appro');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('item_categories');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateOCOMSTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('o_c_o_m_s', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('ocom');
|
||||||
|
$table->string('objectif_competence');
|
||||||
|
$table->string('nbPeriode');
|
||||||
|
$table->string('objectif_rendement');
|
||||||
|
$table->string('oren');
|
||||||
|
$table->boolean('complementary');
|
||||||
|
$table->string('course_id');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('o_c_o_m_s');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateEventTypesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('event_types', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->text('admin_desc');
|
||||||
|
$table->string('calendar_color')->default('#FFFFFF');
|
||||||
|
$table->string('calendar_icon')->default('fa fa-question-circle');
|
||||||
|
$table->string('begin_time')->default('12:00');
|
||||||
|
$table->string('end_time')->default('13:00');
|
||||||
|
$table->string('location')->default('Escadron');
|
||||||
|
$table->boolean('is_mandatory')->default(false);
|
||||||
|
$table->boolean('use_weekly_msg')->default(false);
|
||||||
|
$table->string('weekly_msg_publication_time')->default('-5day');
|
||||||
|
$table->boolean('use_schedule')->default(false);
|
||||||
|
$table->text('schedule_model');
|
||||||
|
$table->boolean('is_promoted')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('event_types');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateGoogleDriveFileTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('google_drive_files', function (Blueprint $table) {
|
||||||
|
$table->string('id');
|
||||||
|
$table->index('id');
|
||||||
|
$table->string('type');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('path')->default('');
|
||||||
|
$table->string('rank_permission');
|
||||||
|
$table->string('job_permission');
|
||||||
|
$table->string('user_permission');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('google_drive_files');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateLessonPlansTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('lesson_plans', function (Blueprint $table) {
|
||||||
|
$table->bigIncrements('id');
|
||||||
|
$table->integer('user_id');
|
||||||
|
$table->string('file');
|
||||||
|
$table->integer('course_id')->nullable();
|
||||||
|
$table->text('desc')->nullable();
|
||||||
|
$table->text('comment')->nullable();
|
||||||
|
$table->boolean('approved')->default(false);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('lesson_plans');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateWebSocketsStatisticsEntriesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('websockets_statistics_entries', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('app_id');
|
||||||
|
$table->integer('peak_connection_count');
|
||||||
|
$table->integer('websocket_message_count');
|
||||||
|
$table->integer('api_message_count');
|
||||||
|
$table->nullableTimestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('websockets_statistics_entries');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,18 +13,99 @@ class ComplementaryActivitiesSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
DB::table('complementary_activities')->insert([
|
DB::table('complementary_activities')->insert([
|
||||||
[
|
[
|
||||||
'name' => 'Précidrill',
|
'name' => 'Soirée d\'instruction régulière',
|
||||||
|
'calendar_color' => 'orange',
|
||||||
|
'calendar_icon' => '<i class="fas fa-book"></i>',
|
||||||
|
'begin_time' => '18:30',
|
||||||
|
'end_time' => '21:45',
|
||||||
|
'Location' => 'Escadron',
|
||||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Congé',
|
||||||
|
'calendar_color' => 'red',
|
||||||
|
'calendar_icon' => '<i class="fa fa-times"></i>',
|
||||||
|
'begin_time' => '00:01',
|
||||||
|
'end_time' => '23:59',
|
||||||
|
'Location' => 'Escadron',
|
||||||
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Financement',
|
||||||
|
'calendar_color' => 'light-green',
|
||||||
|
'calendar_icon' => '<i class="fa fa-usd"></i>',
|
||||||
|
'begin_time' => '00:01',
|
||||||
|
'end_time' => '23:59',
|
||||||
|
'Location' => 'Escadron',
|
||||||
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Bénévolat',
|
||||||
|
'calendar_color' => 'green',
|
||||||
|
'calendar_icon' => '<i class="fa fa-handshake-o "></i>',
|
||||||
|
'begin_time' => '00:01',
|
||||||
|
'end_time' => '23:59',
|
||||||
|
'Location' => 'Escadron',
|
||||||
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Autre',
|
||||||
|
'calendar_color' => 'purple',
|
||||||
|
'calendar_icon' => '<i class="fa fa-circle "></i>',
|
||||||
|
'begin_time' => '00:01',
|
||||||
|
'end_time' => '23:59',
|
||||||
|
'Location' => 'Escadron',
|
||||||
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Précidrill',
|
||||||
|
'calendar_color' => 'blue',
|
||||||
|
'calendar_icon' => '<i class="fa fa-trophy"></i>',
|
||||||
|
'begin_time' => '19:00',
|
||||||
|
'end_time' => '21:00',
|
||||||
|
'Location' => 'Escadron',
|
||||||
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Musique',
|
'name' => 'Musique',
|
||||||
|
'calendar_color' => 'gold',
|
||||||
|
'calendar_icon' => '<i class="fa fa-music"></i>',
|
||||||
|
'begin_time' => '19:00',
|
||||||
|
'end_time' => '21:00',
|
||||||
|
'Location' => 'Escadron',
|
||||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Tir de précision',
|
'name' => 'Tir de précision',
|
||||||
|
'calendar_color' => 'grey',
|
||||||
|
'calendar_icon' => '<i class="fa fa-bullseye"></i>',
|
||||||
|
'begin_time' => '19:00',
|
||||||
|
'end_time' => '21:00',
|
||||||
|
'Location' => 'Escadron',
|
||||||
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
'public_body' => 'Veuillez modifier le text de description publique par défaut',
|
||||||
|
'public_slogan' => 'Veuillez modifier le slogan publique par défaut',
|
||||||
|
'public_header_picture' => './assets/img/bg2.jpg',
|
||||||
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
'admin_desc' => 'Veuillez modifier la description admin par défaut',
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ class ConfigsTableSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
DB::table('configs')->insert([
|
$configs = [
|
||||||
[
|
[
|
||||||
'name' => 'is_schedule_public',
|
'name' => 'is_schedule_public',
|
||||||
'state' => 0,
|
'state' => 0,
|
||||||
'data' => 'null'
|
'data' => '["true"]'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'is_schedule_build',
|
'name' => 'is_schedule_build',
|
||||||
'state' => 0,
|
'state' => 0,
|
||||||
'data' => 'null'
|
'data' => '["false"]'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'text_public_banner_cadet_desc',
|
'name' => 'text_public_banner_cadet_desc',
|
||||||
@@ -67,6 +67,16 @@ class ConfigsTableSeeder extends Seeder
|
|||||||
'state' => 0,
|
'state' => 0,
|
||||||
'data' => '["Voir toutes les nouvelles!"]'
|
'data' => '["Voir toutes les nouvelles!"]'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'text_public_schedule_desc',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["Voici les activitées à venir !"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'text_public_schedule_title',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["Calendrier"]'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'name' => 'text_public_picture_nb',
|
'name' => 'text_public_picture_nb',
|
||||||
'state' => 0,
|
'state' => 0,
|
||||||
@@ -187,6 +197,97 @@ class ConfigsTableSeeder extends Seeder
|
|||||||
'state' => 0,
|
'state' => 0,
|
||||||
'data' => '["https://drive.google.com/uc?export=download&id=1i1a0sjI8I3nzt4mlcLvznjqYF-12JgfQ"]'
|
'data' => '["https://drive.google.com/uc?export=download&id=1i1a0sjI8I3nzt4mlcLvznjqYF-12JgfQ"]'
|
||||||
],
|
],
|
||||||
]);
|
[
|
||||||
|
'name' => 'admin_periode_begin',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["1" => "19:10","2" => "20:30"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'admin_periode_end',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["1" => "20:10","2" => "21:20"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'admin_periode_nb',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["2"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'admin_level_in_schedule_nb',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["3"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'public_index_img_url',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["./assets/img/bg2.jpg"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'default_weekly_msg',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => "[\"<strong>/* Nom de l'évènement */</strong><br>Heure (Cadets):<br>Lieu:<br>Tenue:<br>Matériel:<br>/* Commentaire */\"]"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'cadet_list',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["#"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'GOOGLE_DRIVE_CLIENT_ID',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["'.\Crypt::encryptString('').'"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'GOOGLE_DRIVE_CLIENT_SECRET',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["'.\Crypt::encryptString('').'"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'GOOGLE_DRIVE_REFRESH_TOKEN',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["'.\Crypt::encryptString('').'"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'GOOGLE_DRIVE_FOLDER_ID',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["'.\Crypt::encryptString('null').'"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'is_Google_Drive_enabled',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["false"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'instruction_year_begin',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["2019-08-1"]'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'instruction_year_end',
|
||||||
|
'state' => 0,
|
||||||
|
'data' => '["2020-05-31"]'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$actualConfigs = \App\Config::all();
|
||||||
|
|
||||||
|
$configToAdd = [];
|
||||||
|
|
||||||
|
foreach ($configs as $config) {
|
||||||
|
$found = false;
|
||||||
|
foreach ($actualConfigs as $actualConfig) {
|
||||||
|
if ($actualConfig->name == $config['name']) {
|
||||||
|
$found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$found) {
|
||||||
|
array_push($configToAdd, $config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($configToAdd != []) {
|
||||||
|
DB::table('configs')->insert($configToAdd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user