svg
Cadoles/nineskeletor/pipeline/head There was a failure building this commit Details

This commit is contained in:
afornerot 2023-02-16 17:03:53 +01:00
parent 9554b9cdd3
commit eef04429ee
192 changed files with 9375 additions and 17414 deletions

22
.env
View File

@ -7,7 +7,7 @@ APP_SESSIONTIME=1440
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
# Database
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8"
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/nineblog?serverVersion=13&charset=utf8"
# Redis Session
REDIS_HOST=127.0.0.1
@ -23,7 +23,7 @@ APP_WEBURL=127.0.0.1:8000
APP_MASTERIDENTITY=SQL # SQL | SSO | LDAP
APP_AUTH=SQL # SQL | CAS | LDAP | OPENID | à faire SAML
APP_ALIAS=/
APP_NAME=Nineskeletor
APP_NAME=Nineblog
APP_MODEREGISTRATION= # null | BYADMIN | BYUSER
APP_ADMINS='["admin"]'
@ -76,13 +76,13 @@ LDAP_USERWRITER=0 # LDAP_USER compte writer ? 0/1
LDAP_USER= # DN compte access ldap
LDAP_PASSWORD= # Password comte access ldap
LDAP_BASEDN= # Base DN ex:dc=nine,dc=fr
LDAP_BASEORGANISATION= # Base Organisation ex:ou=nineskeletor,dc=nine,dc=fr
LDAP_BASENIVEAU01= # Base Niveau01 ex:ou=niveau01,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASENIVEAU02= # Base Niveau02 ex:ou=niveau02,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASENIVEAU03= # Base Niveau03 ex:ou=niveau03,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASENIVEAU04= # Base Niveau04 ex:ou=niveau04,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASEGROUP= # Base Group ex:ou=groups,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASEUSER= # Base User ex:ou=users,ou=nineskeletor,dc=nine,dc=fr
LDAP_BASEORGANISATION= # Base Organisation ex:ou=nineblog,dc=nine,dc=fr
LDAP_BASENIVEAU01= # Base Niveau01 ex:ou=niveau01,ou=nineblog,dc=nine,dc=fr
LDAP_BASENIVEAU02= # Base Niveau02 ex:ou=niveau02,ou=nineblog,dc=nine,dc=fr
LDAP_BASENIVEAU03= # Base Niveau03 ex:ou=niveau03,ou=nineblog,dc=nine,dc=fr
LDAP_BASENIVEAU04= # Base Niveau04 ex:ou=niveau04,ou=nineblog,dc=nine,dc=fr
LDAP_BASEGROUP= # Base Group ex:ou=groups,ou=nineblog,dc=nine,dc=fr
LDAP_BASEUSER= # Base User ex:ou=users,ou=nineblog,dc=nine,dc=fr
LDAP_USERNAME=uid # Attribut id d'un user
LDAP_FIRSTNAME=givenname # Attribut firstname d'un user
LDAP_LASTNAME=sn # Attribut lastname d'un user
@ -157,7 +157,7 @@ MERCURE_JWT_SECRET="!changeme!changeme!changeme!changeme!changeme!changeme!"
MINIO_URL=http://127.0.0.1:9000
MINIO_KEY=minio
MINIO_SECRET=changeme
MINIO_BUCKET=ninegate
MINIO_BUCKET=nineblog
MINIO_ROOT=
MINIO_PATH_STYLE=1
MINIO_SECURE=0
@ -169,7 +169,7 @@ HYDRA_CONSENTCHALLENGE="http://127.0.0.1:4445/oauth2/auth/requests/consent?conse
HYDRA_CONSENTCHALLENGEACCEPT="http://127.0.0.1:4445/oauth2/auth/requests/consent/accept?consent_challenge="
# Lock
LOCK_DSN="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8"
LOCK_DSN="postgresql://symfony:ChangeMe@127.0.0.1:5432/nineblog?serverVersion=13&charset=utf8"
# Sentry
SENTRY_DSN=

View File

@ -26,6 +26,9 @@ body {
color: var(--colorftbodylight);
}
/* FONT */
body {
font-family: var(--fontbody);
@ -61,6 +64,16 @@ a:hover {
color: var(--colorfttitlelight-darker);
}
.btn-link {
text-decoration: none;
cursor: pointer;
color: var(--colorfttitlelight);
}
.btn-link:hover {
color: var(--colorfttitlelight-darker);
}
main {
display:flex;
overflow:hidden;
@ -99,6 +112,24 @@ border-width: 1px;
padding:0.5rem;
}
#page {
overflow-y: auto;
width:100%;
}
.ckeditor-content img {
max-width:100%;
height:auto !important;
}
.hide {
display: none !important;
}
.card-body .form-group:first-child {
margin-top: 0px !important;
}
@media (max-width: 991px) {
#header {
display:none !important;
@ -274,318 +305,138 @@ border-width: 1px;
}
}
/* PAGE */
#page {
overflow-y: auto;
width:100%;
}
/*== CHILD ======================================================================================================================================= */
.ckeditor-content img {
max-width:100%;
height:auto !important;
}
.hide {
display: none !important;
}
.card-body .form-group:first-child {
margin-top: 0px !important;
}
/* ITEM */
.itemframe {
width: 100%
}
.items-list {
display:flex;
flex-wrap: wrap;
margin-bottom: 5px;
}
.item {
padding:10px;
display:flex;
text-align: center;
justify-content: center;
margin-right:5px;
margin-bottom:5px;
flex-wrap: wrap;
color: var(--colorftbodydark) !important;
}
.item-action {
width: 100%;
color: var(--colorftbodydark) !important;
padding-top:10px;
height:35px;
}
.item-action i {
font-size: 22px;
}
.item-container {
display:flex;
flex-wrap: nowrap;
justify-content: space-around;
}
.item-content {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
flex-direction: column;
}
.item img {
margin:0px auto 10px auto;
}
.item h3 {
margin:0px;
.child-sidebar {
background-color: var(--colorbgbodyimportant);
color: var(--colorftbodydark);
}
.item-subtitle {
font-size: 10px;
margin:0px;
.child-sidebar h3 {
color: var(--colorftbodydark);
}
.item-description {
color: var(--colorftbodydark);
text-align: left;
padding: 0px 5px;
}
.item-description img {
max-width: 100% !important;
height: auto !important;
}
.item-description p:last-child {
margin-bottom: 0px;
}
.item-verysmall {
width: 80px;
padding:5px 2px 2px 2px;
}
.item-verysmall .item-link {
width: 76px;
}
.item-verysmall img {
height:40px;
}
.item-verysmall h3{
font-size: 10px;
font-family: var(--fontbody);
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item-verysmall .item-subtitle{
display:none;
}
.item-verysmall .item-action {
padding-top:0px;
height:25px;
}
.item-verysmall .item-action i {
font-size: 14px;
}
.item-small {
width: 100px;
padding:10px 5px;
}
.item-small .item-link {
width: 90px;
}
.item-small img {
height:60px;
}
.item-small h3{
font-size: 12px;
font-family: var(--fontbody);
text-transform: uppercase;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.item-small .item-subtitle{
display:none;
}
.item-small .item-action i {
font-size: 16px;
}
.item-medium {
width: 150px;
}
.item-medium .item-link {
width: 130px;
}
.item-medium img {
height:90px;
}
.item-medium h3{
font-size: 18px;
}
.item-large {
width:300px;
justify-content: left;
}
.item-large .item-link {
display: flex;
}
.item-large img {
height:120px;
}
.item-large .item-title {
text-align:left;
padding-left:10px;
}
.item-large h3{
font-size: 25px;
border-bottom: 1px solid var(--colorftbodydark);
}
.item-large .item-container {
flex-direction: column;
}
.item-large .item-action {
text-align: left;
}
.item-large .item-description {
margin-top:15px;
}
.item-list {
width:100%;
justify-content: left;
margin-right: 0px;
}
.item-list .item-container {
flex-direction: column;
width:100%;
}
.item-list .item-content {
flex-wrap: nowrap;
flex-direction: row;
}
.item-list .item-link {
display:flex;
align-items: center;
}
.item-list img {
height:40px;
margin:0px;
}
.item-list .item-title {
text-align:left;
padding-left:10px;
}
.item-list h3{
font-size: 18px;
font-family: var(--fontbody);
text-transform: uppercase;
}
.item-list .item-subtitle{
display:none;
}
.item-list .item-action {
width:auto;
}
.item-list .item-description {
padding:10px 0px 5px 0px;
}
/* WIDGET */
.widget{
margin-bottom:30px;
}
.widget-bordered {
border:1px solid;
}
.widget-menu {
float: right;
color: #fff;
margin: 10px 5px 0px 0px;
display:none;
}
.widget-menu i {
cursor:pointer;
}
.widget-header {
padding:10px 10px 5px 10px;
font-family: var(--fonttitle);
font-size: 25px;
}
.widget-logo {
height:40px;
margin-right:5px;
margin-top:-5px;
cursor: pointer;
}
.widget-title {
cursor: pointer;
}
.widget-body {
padding: 5px 0px 0px 0px;
}
.widget-bordered .widget-body {
padding: 5px;
}
.widget-body .items-list {
margin-bottom: 5px;
}
.widget-body .item-list:first-child {
margin-top: 0px;
}
.widget-body .items-list:last-child {
margin-bottom: -5px;
}
.widget-body .item-description {
padding:10px 0px 0px 0px;
}
.widget-body .slick {
min-height: 200px;
}
.widget-body .slick-slide {
min-height: 200px;
}
.widget-body .slick-arrow {
display: none !important;
}
.widget-body .slick-dots {
bottom: 5px;
color: var(--colorftbodydark);
}
.widgetplaceholder {
background-color: var(--colorbgbodydark);
}
.cat-list {
.child-sidebar a {
color: var(--colorfttitledark);
}
.child-sidebar a:hover {
color: var(--colorfttitledark-lighter);
}
/*== GRID ======================================================================================================================================= */
.gutter-sizer { width: 0%;float:left; }
.grid-sizer {
width: 0.1%;
margin-bottom: 0%;
float:left;
}
.grid-item {
background-color:var(--colorbgbodydark);
padding: 5px 10px;
display: inline-block;
cursor: pointer;
color: var(--colorfttitledark);
overflow:hidden;
}
.grid-image {
width:100%;
transition: transform 0.3s;
background-position: center;
background-size: cover;
}
.grid-item-title {
background-color:var(--colorbgbodyimportant);
color: var(--colorfttitledark);
width:auto;
padding:15px;
text-align:center;
margin:auto;
}
.grid-item-size-1 { width: 100% }
.grid-item-size-2 { width: 50% }
.grid-item-size-3 { width: 33.3% }
.grid-item-size-4 { width: 25% }
.grid-item-size-5 { width: 20% }
.grid-item-full { width: 100%; margin-bottom: 0%; font-size:20px;float:left; }
.grid-item-full h1 {margin: 0; border:none; padding: 20px 0px 0px 10px; }
.grid-tag {font-style:italic}
.grid-image {cursor: pointer;}
@media (max-width: 980px) {
.grid-item-size-1 { width: 30% }
.grid-item-size-2 { width: 50% }
.grid-item-size-3 { width: 50% }
.grid-item-size-4 { width: 50% }
.grid-item-size-5 { width: 50% }
}
/*== HERO ======================================================================================================================================= */
.herobody {
min-height:500px;
width:100%;
padding:0px 100px;
}
.herobody .title {
height: auto;
position: relative;
top: 5%;
left: 5%;
font-size: 20px;
width:40%;
float: left;
}
.heroheader span {
color: var(--colorftbodydark);
text-shadow: 1px 1px 2px black;
}
.herobody .title h1, .heroheader h1, .heroheader h1 {
color: var(--colorftbodydark);
font-size: 50px;
margin:0px;
text-shadow: 1px 1px 2px black;
}
.herobody .navigation {
width:45%;
position: relative;
right: 5%;
top: 5%;
float: right;
}
@media (max-width: 1099px) {
.herobody {
padding:0px 50px;
}
.herobody .title {
width:90%;
}
.herobody .navigation {
width:90%;
}
}
.herobody .grid-item {
padding: 5px;
background-color: transparent;
height: 200px;
}
.herobody .grid-image {
background-color: var(--colorbgbodydark);
}

View File

@ -8,20 +8,23 @@ oneup_uploader:
frontend: dropzone
storage:
directory: "%kernel.project_dir%/var/tmp/logo"
icon:
image:
frontend: dropzone
storage:
directory: "%kernel.project_dir%/var/tmp/icon"
slide:
frontend: dropzone
storage:
directory: "%kernel.project_dir%/var/tmp/slide"
directory: "%kernel.project_dir%/var/tmp/image"
header:
frontend: dropzone
storage:
directory: "%kernel.project_dir%/var/tmp/header"
file:
childheader:
frontend: dropzone
storage:
directory: "%kernel.project_dir%/var/tmp/childheader"
child:
frontend: dropzone
namer: App\Service\UploadSamename
storage:
directory: "%kernel.project_dir%/var/tmp/file"
directory: "%kernel.project_dir%/var/tmp/child"

View File

@ -98,6 +98,11 @@ app_admin_config_logo:
controller: App\Controller\ConfigController::logo
defaults: { access: admin }
app_admin_config_image:
path: /admin/admin/image
controller: App\Controller\ConfigController::image
defaults: { access: admin }
#== Theme =======================================================================================================
#-- Access admin
app_admin_theme:
@ -158,6 +163,14 @@ app_all_crop02:
path: /all/crop02/{type}/{reportinput}
controller: App\Controller\CropController::crop02
app_cropentity01:
path: /admin/cropentity01/{type}/{idparent}
defaults: { _controller: App\Controller\CropController::cropentity01 }
app_cropentity02:
path: /admin/cropentity02/{type}/{idparent}
defaults: { _controller: App\Controller\CropController::cropentity02 }
#== Minio =======================================================================================================
#-- Access public
app_minio_logo:
@ -168,9 +181,13 @@ app_minio_image:
path: /minio/image
controller: App\Controller\MinioController::image
app_minio_document:
path: /minio/document
controller: App\Controller\MinioController::document
app_minio_show:
path: /minio/show
controller: App\Controller\MinioController::show
app_minio_download:
path: /minio/download
controller: App\Controller\MinioController::download
#== Hydra =======================================================================================================
#-- Access public
@ -195,11 +212,11 @@ app_hydra_consent:
controller: App\Controller\HydraController::consent
#== Ckeditor ====================================================================================================
#-- Access all
#-- Access admin
app_ckeditor_upload:
path: /all/upload/{{category}}/{{id}}/{{usage}}
path: /admin/upload
controller: App\Controller\MinioController::ckupload
defaults: { access: all, category: all, id: 0, usage: all }
defaults: { access: admin }
#== Audit =======================================================================================================
#--Access admin
@ -821,800 +838,257 @@ app_all_preference:
controller: App\Controller\UserController::preference
defaults: { access: all }
#== ICON =================================================================================================================================================
#== Menu ====================================================================================================
app_menu:
path: /admin/menu
defaults: { _controller: App\Controller\MenuController::list }
#-- Access admin
app_admin_icon:
path: /admin/icon
controller: App\Controller\IconController::list
defaults: { access: admin }
app_menu_submit:
path: /admin/menu/submit/{id}
defaults: { _controller: App\Controller\MenuController::submit }
app_admin_icon_submit:
path: /admin/icon/submit
controller: App\Controller\IconController::submit
defaults: { access: admin }
app_menu_delete:
path: /admin/menu/delete/{id}
defaults: { _controller: App\Controller\MenuController::delete }
app_admin_icon_update:
path: /admin/icon/update/{id}
controller: App\Controller\IconController::update
defaults: { access: admin }
app_menu_order:
path: /admin/menu/order/{id}/{order}
defaults: { _controller: App\Controller\MenuController::order }
app_admin_icon_delete:
path: /admin/icon/delete/{id}
controller: App\Controller\IconController::delete
defaults: { access: admin }
app_admin_icon_select:
path: /admin/icon/select
controller: App\Controller\IconController::select
defaults: { access: admin }
#== Blogtype ====================================================================================================
app_typeblog:
path: /admin/blogtype
defaults: { _controller: App\Controller\BlogtypeController::list }
app_admin_icon_upload:
path: /admin/icon/upload
controller: App\Controller\IconController::upload
defaults: { access: admin }
app_typeblog_submit:
path: /admin/blogtype/submit
defaults: { _controller: App\Controller\BlogtypeController::submit }
#-- Access all
app_all_icon:
path: /all/icon
controller: App\Controller\IconController::list
defaults: { access: all }
app_typeblog_update:
path: /admin/blogtype/update/{id}
defaults: { _controller: App\Controller\BlogtypeController::update }
app_all_icon_submit:
path: /all/icon/submit
controller: App\Controller\IconController::submit
defaults: { access: all }
app_typeblog_delete:
path: /admin/blogtype/delete/{id}
defaults: { _controller: App\Controller\BlogtypeController::delete }
app_all_icon_update:
path: /all/icon/update/{id}
controller: App\Controller\IconController::update
defaults: { access: all }
app_typeblog_upload:
path: /admin/blogtype/upload
defaults: { _controller: App\Controller\BlogtypeController::upload }
app_all_icon_delete:
path: /all/icon/delete/{id}
controller: App\Controller\IconController::delete
defaults: { access: all }
app_typeblog_selectlist:
path: /admin/blogtype/select
defaults: { _controller: App\Controller\BlogtypeController::select }
app_all_icon_select:
path: /all/icon/select
controller: App\Controller\IconController::select
defaults: { access: all }
app_typeblog_home:
path: /blogtype/{id}
defaults: { _controller: App\Controller\BlogtypeController::home }
app_all_icon_upload:
path: /all/icon/upload
controller: App\Controller\IconController::upload
defaults: { access: all }
#== Blog ====================================================================================================
app_blog:
path: /admin/blog
defaults: { _controller: App\Controller\BlogController::list }
#== ALERT ================================================================================================================================================
app_blog_submit:
path: /admin/blog/submit
defaults: { _controller: App\Controller\BlogController::submit }
#-- Access admin
app_admin_alert:
path: /admin/alert
controller: App\Controller\AlertController::list
defaults: { access: admin }
app_blog_update:
path: /admin/blog/update/{id}
defaults: { _controller: App\Controller\BlogController::update }
app_admin_alert_submit:
path: /admin/alert/submit
controller: App\Controller\AlertController::submit
defaults: { access: admin }
app_blog_delete:
path: /admin/blog/delete/{id}
defaults: { _controller: App\Controller\BlogController::delete }
app_admin_alert_update:
path: /admin/alert/update/{id}
controller: App\Controller\AlertController::update
defaults: { access: admin }
app_blog_selectlist:
path: /admin/blog/select
defaults: { _controller: App\Controller\BlogController::select }
app_admin_alert_delete:
path: /admin/alert/delete/{id}
controller: App\Controller\AlertController::delete
defaults: { access: admin }
#== Pagetype ====================================================================================================
app_typepage:
path: /admin/pagetype
defaults: { _controller: App\Controller\PagetypeController::list }
app_admin_alert_order:
path: /admin/alert/order
controller: App\Controller\AlertController::order
defaults: { access: admin }
app_typepage_submit:
path: /admin/pagetype/submit
defaults: { _controller: App\Controller\PagetypeController::submit }
#-- Access all
app_all_alert_read:
path: /all/alert/read
controller: App\Controller\AlertController::read
defaults: { access: all }
app_typepage_update:
path: /admin/pagetype/update/{id}
defaults: { _controller: App\Controller\PagetypeController::update }
#== ALERT CATEGORY =======================================================================================================================================
app_typepage_delete:
path: /admin/pagetype/delete/{id}
defaults: { _controller: App\Controller\PagetypeController::delete }
#-- Access admin
app_admin_alertcategory_submit:
path: /admin/alertcategory/submit
controller: App\Controller\AlertcategoryController::submit
defaults: { access: admin }
app_typepage_upload:
path: /admin/pagetype/upload
defaults: { _controller: App\Controller\PagetypeController::upload }
app_admin_alertcategory_update:
path: /admin/alertcategory/update/{id}
controller: App\Controller\AlertcategoryController::update
defaults: { access: admin }
app_typepage_selectlist:
path: /admin/pagetype/select
defaults: { _controller: App\Controller\PagetypeController::select }
app_admin_alertcategory_delete:
path: /admin/alertcategory/delete/{id}
controller: App\Controller\AlertcategoryController::delete
defaults: { access: admin }
app_typepage_home:
path: /pagetype/{id}
defaults: { _controller: App\Controller\PagetypeController::home }
#== ITEM =================================================================================================================================================
#== Page ====================================================================================================
app_page:
path: /admin/page
defaults: { _controller: App\Controller\PageController::list }
#-- Access admin
app_admin_item:
path: /admin/item
controller: App\Controller\ItemController::list
defaults: { access: admin }
app_admin_item_submit:
path: /admin/item/submit
controller: App\Controller\ItemController::submit
defaults: { access: admin }
app_admin_item_update:
path: /admin/item/update/{id}
controller: App\Controller\ItemController::update
defaults: { access: admin }
app_admin_item_delete:
path: /admin/item/delete/{id}
controller: App\Controller\ItemController::delete
defaults: { access: admin }
app_admin_item_order:
path: /admin/item/order
controller: App\Controller\ItemController::order
defaults: { access: admin }
#== ITEM CATEGORY ========================================================================================================================================
#-- Access admin
app_admin_itemcategory_submit:
path: /admin/itemcategory/submit
controller: App\Controller\ItemcategoryController::submit
defaults: { access: admin }
app_admin_itemcategory_update:
path: /admin/itemcategory/update/{id}
controller: App\Controller\ItemcategoryController::update
defaults: { access: admin }
app_admin_itemcategory_delete:
path: /admin/itemcategory/delete/{id}
controller: App\Controller\ItemcategoryController::delete
defaults: { access: admin }
app_admin_itemcategory_order:
path: /admin/itemcategory/order
controller: App\Controller\ItemcategoryController::order
defaults: { access: admin }
#== BOOKMARK =============================================================================================================================================
#-- Access config
app_admin_bookmark_submit:
path: /admin/bookmark/submit/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::submit
defaults: { access: admin }
app_admin_bookmark_update:
path: /admin/bookmark/update/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::update
defaults: { access: admin }
app_admin_bookmark_delete:
path: /admin/bookmark/delete/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::delete
defaults: { access: admin }
app_admin_bookmark_heart:
path: /admin/bookmark/heart
controller: App\Controller\BookmarkController::heart
defaults: { access: admin }
#-- Access all
app_all_bookmark_submit:
path: /all/bookmark/submit/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::submit
defaults: { access: all }
app_all_bookmark_update:
path: /all/bookmark/update/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::update
defaults: { access: all }
app_all_bookmark_delete:
path: /all/bookmark/delete/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::delete
defaults: { access: all }
app_all_bookmark_heart:
path: /all/bookmark/heart
controller: App\Controller\BookmarkController::heart
defaults: { access: all }
#== FILE =================================================================================================================
#-- Access admin
app_admin_file_list:
path: /admin/file/list/{category}/{id}
controller: App\Controller\FileController::list
defaults: { access: admin }
app_admin_file_upload:
path: /admin/file/upload/{category}/{id}/{type}
controller: App\Controller\FileController::upload
defaults: { access: admin }
app_admin_file_folder:
path: /admin/file/folder/{category}/{id}
controller: App\Controller\FileController::folder
defaults: { access: admin }
app_admin_file_rename:
path: /admin/file/rename/{category}/{id}
controller: App\Controller\FileController::rename
defaults: { access: admin }
app_admin_file_trash:
path: /admin/file/trash/{category}/{id}
controller: App\Controller\FileController::trash
defaults: { access: admin }
app_admin_file_restaure:
path: /admin/file/restaure/{category}/{id}
controller: App\Controller\FileController::restaure
defaults: { access: admin }
app_admin_file_purgetrash:
path: /admin/file/purgetrash/{category}/{id}
controller: App\Controller\FileController::purgetrash
defaults: { access: admin }
app_admin_file_delete:
path: /admin/file/delete/{category}/{id}
controller: App\Controller\FileController::delete
defaults: { access: admin }
app_admin_file_move:
path: /admin/file/move/{category}/{id}
controller: App\Controller\FileController::move
defaults: { access: admin }
app_admin_file_view:
path: /admin/file/view/{category}/{id}
controller: App\Controller\FileController::view
defaults: { access: all }
app_admin_file_show:
path: /admin/file/show/{category}/{id}
controller: App\Controller\FileController::show
defaults: { access: all }
app_admin_file_download:
path: /admin/file/download/{category}/{id}
controller: App\Controller\FileController::download
defaults: { access: all }
#-- Access all
app_all_file_list:
path: /file/list/{category}/{id}
controller: App\Controller\FileController::list
defaults: { access: all }
app_all_file_upload:
path: /all/file/upload/{category}/{id}/{type}
controller: App\Controller\FileController::upload
defaults: { access: all }
app_all_file_folder:
path: /all/file/folder/{category}/{id}
controller: App\Controller\FileController::folder
defaults: { access: all }
app_all_file_rename:
path: /all/file/rename/{category}/{id}
controller: App\Controller\FileController::rename
defaults: { access: all }
app_all_file_trash:
path: /all/file/trash/{category}/{id}
controller: App\Controller\FileController::trash
defaults: { access: all }
app_all_file_restaure:
path: /all/file/restaure/{category}/{id}
controller: App\Controller\FileController::restaure
defaults: { access: all }
app_all_file_purgetrash:
path: /all/file/purgetrash/{category}/{id}
controller: App\Controller\FileController::purgetrash
defaults: { access: all }
app_all_file_delete:
path: /all/file/delete/{category}/{id}
controller: App\Controller\FileController::delete
defaults: { access: all }
app_all_file_move:
path: /all/file/move/{category}/{id}
controller: App\Controller\FileController::move
defaults: { access: all }
app_all_file_view:
path: /file/view/{category}/{id}
controller: App\Controller\FileController::view
defaults: { access: all }
app_all_file_show:
path: /file/show/{category}/{id}
controller: App\Controller\FileController::show
defaults: { access: all }
app_all_file_download:
path: /file/download/{category}/{id}
controller: App\Controller\FileController::download
defaults: { access: all }
#== PAGEWIDGETSLIDE ================================================================================================================================================
#-- Access admin
app_admin_pagewidgetslide_upload:
path: /admin/pagewidgetslide/upload/{idwidget}
controller: App\Controller\PagewidgetslideController::upload
defaults: { access: admin }
app_admin_pagewidgetslide_list:
path: /admin/pagewidgetslide/{idwidget}
controller: App\Controller\PagewidgetslideController::list
defaults: { access: admin }
app_admin_pagewidgetslide_submit:
path: /config/pagewidgetslide/submit/{idwidget}
controller: App\Controller\PagewidgetslideController::submit
defaults: { access: admin }
app_admin_pagewidgetslide_update:
path: /admin/pagewidgetslide/update/{idwidget}/{id}
controller: App\Controller\PagewidgetslideController::update
defaults: { access: admin }
app_admin_pagewidgetslide_delete:
path: /admin/pagewidgetslide/delete/{idwidget}/{id}
controller: App\Controller\PagewidgetslideController::delete
defaults: { access: admin }
#-- Access all
app_all_pagewidgetslide_upload:
path: /all/pagewidgetslide/upload/{idwidget}
controller: App\Controller\PagewidgetslideController::upload
defaults: { access: all }
app_all_pagewidgetslide_list:
path: /all/pagewidgetslide/{idwidget}
controller: App\Controller\PagewidgetslideController::list
defaults: { access: all }
app_all_pagewidgetslide_submit:
path: /all/pagewidgetslide/submit/{idwidget}
controller: App\Controller\PagewidgetslideController::submit
defaults: { access: all }
app_all_pagewidgetslide_update:
path: /all/pagewidgetslide/update/{idwidget}/{id}
controller: App\Controller\PagewidgetslideController::update
defaults: { access: all }
app_all_pagewidgetslide_delete:
path: /all/pagewidgetslide/delete/{idwidget}/{id}
controller: App\Controller\PagewidgetslideController::delete
defaults: { access: all }
#== PAGE TEMPLATE ========================================================================================================================================
#-- Access admin
app_admin_page_template:
path: /admin/template
controller: App\Controller\PagetemplateController::list
defaults: { access: admin, usage: template }
app_admin_page_template_tablelist:
path: /admin/template/tablelist
controller: App\Controller\PagetemplateController::tablelist
defaults: { access: admin, usage: template }
app_admin_template_submit:
path: /admin/template/submit
controller: App\Controller\PagetemplateController::submit
defaults: { access: admin, usage: template }
app_admin_page_template_update:
path: /admin/template/update/{id}
controller: App\Controller\PagetemplateController::update
defaults: { access: admin, usage: template }
app_admin_page_template_delete:
path: /admin/template/delete/{id}
controller: App\Controller\PagetemplateController::delete
defaults: { access: admin, usage: template }
app_admin_page_template_view:
path: /admin/template/view/{id}
controller: App\Controller\PagetemplateController::view
defaults: { access: admin, usage: template }
#-- Access all
app_all_page_template_selectlist:
path: /all/template/selectlist
controller: App\Controller\PagetemplateController::selectlist
defaults: { access: admin, usage: template }
#== PAGE =================================================================================================================================================
#-- Access admin
app_admin_page_portal:
path: /admin/page/
controller: App\Controller\PageController::list
defaults: { access: admin, usage: portal }
app_admin_page_portal_tablelist:
path: /admin/page/tablelist
controller: App\Controller\PageController::tablelist
defaults: { access: admin, usage: portal }
app_admin_page_portal_submit:
app_page_submit:
path: /admin/page/submit
controller: App\Controller\PageController::submit
defaults: { access: admin, usage: portal }
defaults: { _controller: App\Controller\PageController::submit }
app_admin_page_portal_update:
app_page_update:
path: /admin/page/update/{id}
controller: App\Controller\PageController::update
defaults: { access: admin, usage: portal }
defaults: { _controller: App\Controller\PageController::update }
app_admin_page_portal_delete:
app_page_delete:
path: /admin/page/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: admin, usage: portal }
app_admin_page_portal_view:
path: /admin/page/view/{id}
controller: App\Controller\PageController::view
defaults: { access: admin, usage: portal }
app_admin_page_portal_order:
path: /admin/page/order
controller: App\Controller\PageController::order
defaults: { access: admin, usage: portal }
#-- Access all
# usage=user
app_all_page_user_submit:
path: /all/page/user/submit
controller: App\Controller\PageController::submit
defaults: { access: all, usage: user }
app_all_page_user_update:
path: /all/page/user/update/{id}
controller: App\Controller\PageController::update
defaults: { access: all, usage: user }
app_all_page_user_delete:
path: /all/page/user/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: all, usage: user }
app_all_page_user_order:
path: /all/page/user/order
controller: App\Controller\PageController::order
defaults: { access: all, usage: user }
# usage=group
app_all_page_group_submit:
path: /all/page/group/submit
controller: App\Controller\PageController::submit
defaults: { access: all, usage: group }
app_all_page_group_update:
path: /all/page/group/update/{id}
controller: App\Controller\PageController::update
defaults: { access: all, usage: group }
app_all_page_group_delete:
path: /all/page/group/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: all, usage: group }
app_all_page_group_order:
path: /all/page/group/order
controller: App\Controller\PageController::order
defaults: { access: all, usage: group }
#-- Access visitor
# usage=portal
app_all_page_portal_view:
path: /page/portal/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: portal }
# usage=user
app_all_page_user_view:
path: /page/user/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: user }
# usage=group
app_all_page_group_view:
path: /page/group/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: group }
#-- Page spécifique
app_all_page_application:
path: /page/application
controller: App\Controller\PageController::application
defaults: { access: all }
#== PAGE WIDGET ==========================================================================================================================================
#-- Access admin
app_admin_pagewidget_widget_sumbit:
path: /admin/pagewidget/submit/{idpage}/{idwidgettype}
controller: App\Controller\PagewidgetController::submit
defaults: { access: admin }
app_admin_pagewidget_widget_update:
path: /admin/pagewidget/update/{idpage}/{idwidget}
controller: App\Controller\PagewidgetController::update
defaults: { access: admin }
app_admin_pagewidget_delete:
path: /admin/pagewidget/delete/{idwidget}
controller: App\Controller\PagewidgetController::delete
defaults: { access: admin }
app_admin_pagewidget_order:
path: /admin/pagewidget/order
controller: App\Controller\PagewidgetController::order
defaults: { access: admin }
app_admin_pagewidget_ckeditor:
path: /admin/pagewidget/ckeditor/{idwidget}
controller: App\Controller\PagewidgetController::ckeditor
defaults: { access: admin }
app_admin_pagewidget_view_url:
path: /admin/pagewidget/view/url/{id}
controller: App\Controller\PagewidgetController::viewurl
defaults: { access: admin }
app_admin_pagewidget_view_urlfixe:
path: /admin/pagewidget/view/urlfixe/{id}
controller: App\Controller\PagewidgetController::viewurlfixe
defaults: { access: admin }
app_admin_pagewidget_view_item:
path: /admin/pagewidget/view/item/{id}
controller: App\Controller\PagewidgetController::viewitem
defaults: { access: admin }
app_admin_pagewidget_view_itemessential:
path: /admin/pagewidget/view/itemessential/{id}
controller: App\Controller\PagewidgetController::viewitemessential
defaults: { access: admin }
app_admin_pagewidget_view_alert:
path: /admin/pagewidget/view/alert/{id}
controller: App\Controller\PagewidgetController::viewalert
defaults: { access: admin }
app_admin_pagewidget_view_flux:
path: /admin/pagewidget/view/flux/{id}
controller: App\Controller\PagewidgetController::viewflux
defaults: { access: admin }
app_admin_pagewidget_view_rss:
path: /admin/pagewidget/view/rss/{id}
controller: App\Controller\PagewidgetController::viewrss
defaults: { access: admin }
app_admin_pagewidget_view_bookmark:
path: /admin/pagewidget/view/bookmark/{id}
controller: App\Controller\PagewidgetController::viewbookmark
defaults: { access: admin }
app_admin_pagewidget_view_link:
path: /admin/pagewidget/view/link/{id}
controller: App\Controller\PagewidgetController::viewlink
defaults: { access: admin }
app_admin_pagewidget_view_editor:
path: /admin/pagewidget/view/editor/{id}
controller: App\Controller\PagewidgetController::vieweditor
defaults: { access: admin }
app_admin_pagewidget_view_slide:
path: /admin/pagewidget/view/pagewidgetslide/{id}
controller: App\Controller\PagewidgetController::viewslide
defaults: { access: admin }
app_admin_pagewidget_view_file:
path: /admin/pagewidget/view/file/{id}
controller: App\Controller\PagewidgetController::viewfile
defaults: { access: admin }
app_admin_pagewidget_view_galery:
path: /admin/pagewidget/view/galery/{id}
controller: App\Controller\PagewidgetController::viewgalery
defaults: { access: admin }
app_admin_pagewidget_view_calendar:
path: /admin/pagewidget/view/calendar/{id}
controller: App\Controller\PagewidgetController::viewcalendar
defaults: { access: admin }
app_admin_pagewidget_view_blog:
path: /admin/pagewidget/view/blog/{id}
controller: App\Controller\PagewidgetController::viewblog
defaults: { access: admin }
app_admin_pagewidget_view_project:
path: /admin/pagewidget/view/project/{id}
controller: App\Controller\PagewidgetController::viewproject
defaults: { access: admin }
app_admin_pagewidget_view_info:
path: /admin/pagewidget/view/info/{id}
controller: App\Controller\PagewidgetController::viewinfo
defaults: { access: admin }
app_admin_pagewidget_view_chat:
path: /admin/pagewidget/view/chat/{id}
controller: App\Controller\PagewidgetController::viewchat
defaults: { access: admin }
app_admin_pagewidget_view_group:
path: /admin/pagewidget/view/group/{id}
controller: App\Controller\PagewidgetController::viewgroup
defaults: { access: admin }
app_admin_pagewidget_view_groupmessage:
path: /admin/pagewidget/view/groupmessage/{id}
controller: App\Controller\PagewidgetController::viewgroupmessage
defaults: { access: admin }
#-- Access all
app_all_pagewidget_widget_sumbit:
path: /all/pagewidget/submit/{idpage}/{idwidgettype}
controller: App\Controller\PagewidgetController::submit
defaults: { access: all }
app_all_pagewidget_widget_update:
path: /all/pagewidget/update/{idpage}/{idwidget}
controller: App\Controller\PagewidgetController::update
defaults: { access: all }
app_all_pagewidget_delete:
path: /all/pagewidget/delete/{idwidget}
controller: App\Controller\PagewidgetController::delete
defaults: { access: all }
app_all_pagewidget_order:
path: /all/pagewidget/order
controller: App\Controller\PagewidgetController::order
defaults: { access: all }
app_all_pagewidget_ckeditor:
path: /all/pagewidget/ckeditor/{idwidget}
controller: App\Controller\PagewidgetController::ckeditor
defaults: { access: all }
app_all_pagewidget_view_url:
path: /pagewidget/view/url/{id}
controller: App\Controller\PagewidgetController::viewurl
defaults: { access: all }
app_all_pagewidget_view_urlfixe:
path: /pagewidget/view/urlfixe/{id}
controller: App\Controller\PagewidgetController::viewurlfixe
defaults: { access: all }
app_all_pagewidget_view_item:
path: /pagewidget/view/item/{id}
controller: App\Controller\PagewidgetController::viewitem
defaults: { access: all }
app_all_pagewidget_view_itemessential:
path: /pagewidget/view/itemessential/{id}
controller: App\Controller\PagewidgetController::viewitemessential
defaults: { access: all }
app_all_pagewidget_view_alert:
path: /pagewidget/view/alert/{id}
controller: App\Controller\PagewidgetController::viewalert
defaults: { access: all }
app_all_pagewidget_view_flux:
path: /pagewidget/view/flux/{id}
controller: App\Controller\PagewidgetController::viewflux
defaults: { access: all }
app_all_pagewidget_view_rss:
path: /pagewidget/view/rss/{id}
controller: App\Controller\PagewidgetController::viewrss
defaults: { access: all }
app_all_pagewidget_view_bookmark:
path: /pagewidget/view/bookmark/{id}
controller: App\Controller\PagewidgetController::viewbookmark
defaults: { access: all }
app_all_pagewidget_view_link:
path: /pagewidget/view/link/{id}
controller: App\Controller\PagewidgetController::viewlink
defaults: { access: all }
app_all_pagewidget_view_editor:
path: /pagewidget/view/editor/{id}
controller: App\Controller\PagewidgetController::vieweditor
defaults: { access: all }
app_all_pagewidget_view_slide:
path: /pagewidget/view/pagewidgetslide/{id}
controller: App\Controller\PagewidgetController::viewslide
defaults: { access: all }
app_all_pagewidget_view_file:
path: /pagewidget/view/file/{id}
controller: App\Controller\PagewidgetController::viewfile
defaults: { access: all }
app_all_pagewidget_view_galery:
path: /pagewidget/view/galery/{id}
controller: App\Controller\PagewidgetController::viewgalery
defaults: { access: all }
app_all_pagewidget_view_calendar:
path: /pagewidget/view/calendar/{id}
controller: App\Controller\PagewidgetController::viewcalendar
defaults: { access: all }
app_all_pagewidget_view_blog:
path: /pagewidget/view/blog/{id}
controller: App\Controller\PagewidgetController::viewblog
defaults: { access: all }
app_all_pagewidget_view_project:
path: /pagewidget/view/project/{id}
controller: App\Controller\PagewidgetController::viewproject
defaults: { access: all }
app_all_pagewidget_view_info:
path: /pagewidget/view/info/{id}
controller: App\Controller\PagewidgetController::viewinfo
defaults: { access: all }
app_all_pagewidget_view_chat:
path: /pagewidget/view/chat/{id}
controller: App\Controller\PagewidgetController::viewchat
defaults: { access: all }
app_all_pagewidget_view_group:
path: /pagewidget/view/group/{id}
controller: App\Controller\PagewidgetController::viewgroup
defaults: { access: all }
app_all_pagewidget_view_groupmessage:
path: /pagewidget/view/groupmessage/{id}
controller: App\Controller\PagewidgetController::viewgroupmessage
defaults: { access: all }
defaults: { _controller: App\Controller\PageController::delete }
app_page_selectlist:
path: /admin/page/select
defaults: { _controller: App\Controller\PageController::select }
app_page_home:
path: /page
defaults: { _controller: App\Controller\PageController::home }
#== Pin ====================================================================================================
app_pin:
path: /admin/pin
defaults: { _controller: App\Controller\PinController::list }
app_pin_submit:
path: /admin/pin/submit
defaults: { _controller: App\Controller\PinController::submit }
app_pin_update:
path: /admin/pin/update/{id}
defaults: { _controller: App\Controller\PinController::update }
app_pin_delete:
path: /admin/pin/delete/{id}
defaults: { _controller: App\Controller\PinController::delete }
app_pin_view:
path: /pin/{id}
defaults: { _controller: App\Controller\PinController::view }
app_pin_select:
path: /admin/pin/select
defaults: { _controller: App\Controller\PinController::select }
#== Child ========================================================================================================
app_child_select:
path: /admin/child/select
defaults: { _controller: App\Controller\ChildController::select }
app_child:
path: /admin/child/{catparent}/{idparent}
defaults: { _controller: App\Controller\ChildController::list }
app_child_submit:
path: /admin/child/submit/{catparent}/{idparent}/{idchildtype}
defaults: { _controller: App\Controller\ChildController::submit }
app_child_submit_image:
path: /admin/child/submit/{catparent}/{idparent}/{idchildtype}/image
defaults: { _controller: App\Controller\ChildController::submitimage }
app_child_submit_video:
path: /admin/child/submit/{catparent}/{idparent}/{idchildtype}/video
defaults: { _controller: App\Controller\ChildController::submitvideo }
app_child_submit_file:
path: /admin/child/submit/{catparent}/{idparent}/{idchildtype}/file
defaults: { _controller: App\Controller\ChildController::submitfile }
app_child_update:
path: /admin/child/update/{catparent}/{idparent}/{idchild}
defaults: { _controller: App\Controller\ChildController::update }
app_child_bind:
path: /admin/child/bind/{catparent}/{idparent}
defaults: { _controller: App\Controller\ChildController::bind }
app_child_ajaxbind:
path: /admin/child/ajaxbind/{catparent}/{idparent}
defaults: { _controller: App\Controller\ChildController::ajaxbind }
app_child_addbind:
path: /admin/child/addbind/{catparent}/{idparent}
defaults: { _controller: App\Controller\ChildController::addbind }
app_child_delete:
path: /admin/child/delete/{catparent}/{idparent}/{idchild}
defaults: { _controller: App\Controller\ChildController::delete }
app_child_upload:
path: /admin/child/upload/{catparent}/{idparent}/{idchild}/{type}
defaults: { _controller: App\Controller\ChildController::upload }
app_child_order:
path: /admin/child/order/{catparent}/{idparent}
defaults: { _controller: App\Controller\ChildController::order }
app_child_search:
path: /search
defaults: { _controller: App\Controller\ChildController::search }
app_child_json:
path: /child/json/{catparent}/{idparent}/{idchild}
defaults: { _controller: App\Controller\ChildController::restjson }
app_child_view:
path: /child/{catparent}/{idparent}/{idchild}
defaults: { _controller: App\Controller\ChildController::view }
#== Childheader ====================================================================================================
app_childheader_submit:
path: /admin/childheader/submit/{idchild}
defaults: { _controller: App\Controller\ChildheaderController::submit }
app_childheader_update:
path: /admin/childheader/update/{catparent}/{idparent}/{id}
defaults: { _controller: App\Controller\ChildheaderController::update }
app_childheader_delete:
path: /admin/childheader/delete/{catparent}/{idparent}/{id}
defaults: { _controller: App\Controller\ChildheaderController::delete }
app_childheader_select:
path: /admin/childheader/select/{idchild}
defaults: { _controller: App\Controller\ChildheaderController::select }
app_childheader_order:
path: /admin/childheader/order/{idchild}
defaults: { _controller: App\Controller\ChildheaderController::order }
app_childheader_view:
path: /childheader/view/{id}
defaults: { _controller: App\Controller\ChildheaderController::view }
#== Tag ====================================================================================================
app_tag:
path: /admin/tag
defaults: { _controller: App\Controller\TagController::list }
app_tag_submit:
path: /admin/tag/submit
defaults: { _controller: App\Controller\TagController::submit }
app_tag_delete:
path: /admin/tag/delete/{id}
defaults: { _controller: App\Controller\TagController::delete }
app_tag_select:
path: /admin/tag/select
defaults: { _controller: App\Controller\TagController::select }

View File

@ -174,12 +174,6 @@ services:
tags:
- name: 'doctrine.event_subscriber'
App\EventListener\PurgefileSubscriber:
public: true
arguments: ['@App\Service\MinioService']
tags:
- name: 'doctrine.event_subscriber'
App\EventListener\Niveau01Subscriber:
public: true
arguments: ['@doctrine.orm.entity_manager','@App\Service\LdapService']

View File

@ -1,6 +1,6 @@
{
"client_id": "nineskeletor",
"client_name": "Nineskeletor",
"client_id": "nineblog",
"client_name": "Nineblog",
"client_secret": "changeme",
"grant_types": [
"authorization_code",

View File

@ -17,7 +17,7 @@ services:
# Service redis pour le stockage des sessions
redis:
image: redis:4.0
container_name: ninegate-redis
container_name: nineblog-redis
ports:
- 6379:6379
environment:
@ -28,10 +28,10 @@ services:
# Service postgresql pour le stockage de la bdd applicative
postgresql:
image: postgres:13-alpine
container_name: ninegate-postgresql
hostname: ninegate-postgresql
container_name: nineblog-postgresql
hostname: nineblog-postgresql
environment:
POSTGRES_MULTIPLE_DATABASES: ninegate,hydra
POSTGRES_MULTIPLE_DATABASES: nineblog,hydra
POSTGRES_PASSWORD: ChangeMe
POSTGRES_USER: symfony
ports:
@ -43,7 +43,7 @@ services:
# Service websocket
mercure:
image: dunglas/mercure
container_name: ninegate-mercure
container_name: nineblog-mercure
restart: unless-stopped
ports:
- "80"
@ -62,7 +62,7 @@ services:
# Service de stockage Minio
minio1:
image: minio/minio:RELEASE.2021-01-16T02-19-44Z
container_name: ninegate-minio1
container_name: nineblog-minio1
volumes:
- data1-1:/data1
- data1-2:/data2
@ -81,7 +81,7 @@ services:
# Service de stockage Minio
minio2:
image: minio/minio:RELEASE.2021-01-16T02-19-44Z
container_name: ninegate-minio2
container_name: nineblog-minio2
volumes:
- data2-1:/data1
- data2-2:/data2
@ -100,7 +100,7 @@ services:
# Service de stockage Minio
minio3:
image: minio/minio:RELEASE.2021-01-16T02-19-44Z
container_name: ninegate-minio3
container_name: nineblog-minio3
volumes:
- data3-1:/data1
- data3-2:/data2
@ -119,7 +119,7 @@ services:
# Service de stockage Minio
minio4:
image: minio/minio:RELEASE.2021-01-16T02-19-44Z
container_name: ninegate-minio4
container_name: nineblog-minio4
volumes:
- data4-1:/data1
- data4-2:/data2
@ -138,7 +138,7 @@ services:
# Service nginx orchestrateur des minio
nginx:
image: nginx:1.19.2-alpine
container_name: ninegate-nginx
container_name: nineblog-nginx
volumes:
- ./containers/minio/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
@ -152,7 +152,7 @@ services:
# Service hydra
hydra:
image: cadoles/hydra-v1
container_name: ninegate-hydra
container_name: nineblog-hydra
volumes:
- ./containers/hydra/clients.d:/etc/hydra/clients.d
ports:
@ -178,7 +178,7 @@ services:
hydra-dispatcher:
build:
context: ./containers/hydra-dispatcher
container_name: ninegate-hydra-dispatcher
container_name: nineblog-hydra-dispatcher
links:
- hydra
ports:
@ -202,15 +202,15 @@ services:
# Service fake smtp = optionnel
mailer:
image: schickling/mailcatcher
container_name: ninegate-mailer
container_name: nineblog-mailer
ports:
- 1025:1025
- 1080:1080
# Service fake openldap = optionnel si ninegate a une synchronisation avec un annuaire
# Service fake openldap = optionnel si nineblog a une synchronisation avec un annuaire
openldap:
image: osixia/openldap:1.5.0
container_name: ninegate-openldap
container_name: nineblog-openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "nine"
@ -232,7 +232,7 @@ services:
# Service tool phpldapadmin = optionnel dans le cas de la présence d'un fake openldap
phpldapadmin:
image: osixia/phpldapadmin:latest
container_name: ninegate-phpldapadmin
container_name: nineblog-phpldapadmin
environment:
PHPLDAPADMIN_LDAP_HOSTS: "openldap"
PHPLDAPADMIN_HTTPS: "false"
@ -244,7 +244,7 @@ services:
# Service tool adminer = optionnel
adminer:
image: adminer
container_name: ninegate-adminer
container_name: nineblog-adminer
restart: always
ports:
- 6081:8080

View File

@ -1,298 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230201080252 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE alert_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE alertcategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE audit_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE bookmark_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE cron_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE groupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE icon_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE item_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE itemcategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau01_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau02_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau03_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau04_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE page_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagecategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagewidget_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagewidgetslide_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE registration_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE useraccount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usergroupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usermodo_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE whitelist_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE widget_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE alert (id INT NOT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, publishedat DATE NOT NULL, unpublishedat DATE DEFAULT NULL, fghideable BOOLEAN NOT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_17FD46C164C19C1 ON alert (category)');
$this->addSql('COMMENT ON COLUMN alert.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE alertgroupe (alert INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(alert, groupe))');
$this->addSql('CREATE INDEX IDX_64DB975617FD46C1 ON alertgroupe (alert)');
$this->addSql('CREATE INDEX IDX_64DB97564B98C21 ON alertgroupe (groupe)');
$this->addSql('CREATE TABLE alertuserread (alert INT NOT NULL, useraccount INT NOT NULL, PRIMARY KEY(alert, useraccount))');
$this->addSql('CREATE INDEX IDX_D4317FA917FD46C1 ON alertuserread (alert)');
$this->addSql('CREATE INDEX IDX_D4317FA9E157AA1A ON alertuserread (useraccount)');
$this->addSql('CREATE TABLE alertcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_EC575F7E54B9D732 ON alertcategory (icon_id)');
$this->addSql('CREATE TABLE audit (id INT NOT NULL, entityname VARCHAR(250) NOT NULL, entityid VARCHAR(250) NOT NULL, datesubmit TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, username VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, detail TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX search_idx ON audit (entityname, entityid, datesubmit)');
$this->addSql('COMMENT ON COLUMN audit.detail IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE bookmark (id INT NOT NULL, icon_id INT DEFAULT NULL, user_id INT DEFAULT NULL, pagewidget_id INT DEFAULT NULL, item_id INT DEFAULT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, rowOrder INT DEFAULT NULL, color VARCHAR(24) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_DA62921D54B9D732 ON bookmark (icon_id)');
$this->addSql('CREATE INDEX IDX_DA62921DA76ED395 ON bookmark (user_id)');
$this->addSql('CREATE INDEX IDX_DA62921D55B7C7A2 ON bookmark (pagewidget_id)');
$this->addSql('CREATE INDEX IDX_DA62921D126F525E ON bookmark (item_id)');
$this->addSql('CREATE TABLE config (id VARCHAR(255) NOT NULL, title VARCHAR(250) NOT NULL, value TEXT DEFAULT NULL, defaultvalue TEXT NOT NULL, roworder VARCHAR(255) NOT NULL, visible BOOLEAN NOT NULL, changeable BOOLEAN NOT NULL, required BOOLEAN NOT NULL, type VARCHAR(255) NOT NULL, grouped VARCHAR(255) NOT NULL, category VARCHAR(255) NOT NULL, help TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cron (id INT NOT NULL, command VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, statut INT DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, startexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, endexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, nextexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, repeatinterval INT DEFAULT NULL, jsonargument TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE groupe (id INT NOT NULL, owner_id INT DEFAULT NULL, pagetemplate_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, email VARCHAR(250) DEFAULT NULL, isopen BOOLEAN DEFAULT false NOT NULL, isworkgroup BOOLEAN DEFAULT false NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)');
$this->addSql('CREATE INDEX IDX_4B98C216D71CE5E ON groupe (pagetemplate_id)');
$this->addSql('CREATE TABLE icon (id INT NOT NULL, user_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, tags VARCHAR(250) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_659429DBEA750E8 ON icon (label)');
$this->addSql('CREATE INDEX IDX_659429DBA76ED395 ON icon (user_id)');
$this->addSql('CREATE TABLE item (id INT NOT NULL, icon_id INT DEFAULT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, slug VARCHAR(128) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, essential BOOLEAN DEFAULT false, protected BOOLEAN DEFAULT false, color VARCHAR(24) DEFAULT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1F1B251E989D9B62 ON item (slug)');
$this->addSql('CREATE INDEX IDX_1F1B251E54B9D732 ON item (icon_id)');
$this->addSql('CREATE INDEX IDX_1F1B251E64C19C1 ON item (category)');
$this->addSql('COMMENT ON COLUMN item.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE itemgroupe (item INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(item, groupe))');
$this->addSql('CREATE INDEX IDX_A4267B6D1F1B251E ON itemgroupe (item)');
$this->addSql('CREATE INDEX IDX_A4267B6D4B98C21 ON itemgroupe (groupe)');
$this->addSql('CREATE TABLE itemcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(24) DEFAULT NULL, rowOrder INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_7959DEE854B9D732 ON itemcategory (icon_id)');
$this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6DFC7E23EA750E8 ON niveau01 (label)');
$this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)');
$this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
$this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
$this->addSql('CREATE TABLE page (id INT NOT NULL, pagecategory_id INT DEFAULT NULL, user_id INT DEFAULT NULL, page_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, roworder INT NOT NULL, maxwidth INT NOT NULL, fonticon VARCHAR(255) DEFAULT NULL, url TEXT DEFAULT NULL, toreload BOOLEAN DEFAULT NULL, html TEXT DEFAULT NULL, template TEXT DEFAULT NULL, parentfor VARCHAR(255) DEFAULT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_140AB6207AED5C04 ON page (pagecategory_id)');
$this->addSql('CREATE INDEX IDX_140AB620A76ED395 ON page (user_id)');
$this->addSql('CREATE INDEX IDX_140AB620C4663E4 ON page (page_id)');
$this->addSql('COMMENT ON COLUMN page.template IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN page.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE pagegroupe (page INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(page, groupe))');
$this->addSql('CREATE INDEX IDX_E8009F6B140AB620 ON pagegroupe (page)');
$this->addSql('CREATE INDEX IDX_E8009F6B4B98C21 ON pagegroupe (groupe)');
$this->addSql('CREATE TABLE pagecategory (id INT NOT NULL, name VARCHAR(100) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE pagewidget (id INT NOT NULL, page_id INT DEFAULT NULL, widget_id INT DEFAULT NULL, icon_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, loc VARCHAR(255) NOT NULL, roworder INT NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, viewheader BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_69400D9AC4663E4 ON pagewidget (page_id)');
$this->addSql('CREATE INDEX IDX_69400D9AFBE885E2 ON pagewidget (widget_id)');
$this->addSql('CREATE INDEX IDX_69400D9A54B9D732 ON pagewidget (icon_id)');
$this->addSql('COMMENT ON COLUMN pagewidget.parameter IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE pagewidgetslide (id INT NOT NULL, pagewidget_id INT DEFAULT NULL, title VARCHAR(100) DEFAULT NULL, subtitle VARCHAR(250) DEFAULT NULL, url VARCHAR(500) DEFAULT NULL, target VARCHAR(32) NOT NULL, roworder INT DEFAULT NULL, image VARCHAR(100) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_DF96542055B7C7A2 ON pagewidgetslide (pagewidget_id)');
$this->addSql('CREATE TABLE registration (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, email VARCHAR(128) NOT NULL, isvisible BOOLEAN NOT NULL, postaladress VARCHAR(250) DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, statut INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7F85E0677 ON registration (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7E7927C74 ON registration (email)');
$this->addSql('CREATE INDEX IDX_62A8A7A759FDD7AB ON registration (niveau01_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A74B487845 ON registration (niveau02_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A7F3F41F20 ON registration (niveau03_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A76E232799 ON registration (niveau04_id)');
$this->addSql('CREATE TABLE useraccount (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, apikey VARCHAR(255) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, roles TEXT NOT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, isactive BOOLEAN NOT NULL, email VARCHAR(128) NOT NULL, avatar VARCHAR(250) DEFAULT \'0\', isvisible BOOLEAN NOT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, preference TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AF85E0677 ON useraccount (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AE7927C74 ON useraccount (email)');
$this->addSql('CREATE INDEX IDX_E157AA1A59FDD7AB ON useraccount (niveau01_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A4B487845 ON useraccount (niveau02_id)');
$this->addSql('CREATE INDEX IDX_E157AA1AF3F41F20 ON useraccount (niveau03_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A6E232799 ON useraccount (niveau04_id)');
$this->addSql('COMMENT ON COLUMN useraccount.roles IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN useraccount.preference IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE usergroupe (id INT NOT NULL, user_id INT DEFAULT NULL, group_id INT DEFAULT NULL, rolegroup INT NOT NULL, apikey VARCHAR(60) NOT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6C439BE5A76ED395 ON usergroupe (user_id)');
$this->addSql('CREATE INDEX IDX_6C439BE5FE54D947 ON usergroupe (group_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6C439BE5A76ED395FE54D947 ON usergroupe (user_id, group_id)');
$this->addSql('CREATE TABLE usermodo (id INT NOT NULL, user_id INT NOT NULL, niveau01_id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D162D6C4A76ED395 ON usermodo (user_id)');
$this->addSql('CREATE INDEX IDX_D162D6C459FDD7AB ON usermodo (niveau01_id)');
$this->addSql('CREATE TABLE whitelist (id INT NOT NULL, label VARCHAR(250) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CB069864EA750E8 ON whitelist (label)');
$this->addSql('CREATE TABLE widget (id INT NOT NULL, icon_id INT DEFAULT NULL, roworder INT NOT NULL, name VARCHAR(100) NOT NULL, description TEXT DEFAULT NULL, routeview VARCHAR(255) NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, viewheader BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, access TEXT DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_85F91ED054B9D732 ON widget (icon_id)');
$this->addSql('COMMENT ON COLUMN widget.access IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN widget.parameter IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE alert ADD CONSTRAINT FK_17FD46C164C19C1 FOREIGN KEY (category) REFERENCES alertcategory (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertgroupe ADD CONSTRAINT FK_64DB975617FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertgroupe ADD CONSTRAINT FK_64DB97564B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertuserread ADD CONSTRAINT FK_D4317FA917FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertuserread ADD CONSTRAINT FK_D4317FA9E157AA1A FOREIGN KEY (useraccount) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertcategory ADD CONSTRAINT FK_EC575F7E54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921DA76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D55B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D126F525E FOREIGN KEY (item_id) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C217E3C61F9 FOREIGN KEY (owner_id) REFERENCES useraccount (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C216D71CE5E FOREIGN KEY (pagetemplate_id) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE icon ADD CONSTRAINT FK_659429DBA76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251E54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251E64C19C1 FOREIGN KEY (category) REFERENCES itemcategory (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemgroupe ADD CONSTRAINT FK_A4267B6D1F1B251E FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemgroupe ADD CONSTRAINT FK_A4267B6D4B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemcategory ADD CONSTRAINT FK_7959DEE854B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau02 ADD CONSTRAINT FK_F4F52F9959FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau03 ADD CONSTRAINT FK_83F21F0F4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau04 ADD CONSTRAINT FK_1D968AACF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6207AED5C04 FOREIGN KEY (pagecategory_id) REFERENCES pagecategory (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620C4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagegroupe ADD CONSTRAINT FK_E8009F6B140AB620 FOREIGN KEY (page) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagegroupe ADD CONSTRAINT FK_E8009F6B4B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9AC4663E4 FOREIGN KEY (page_id) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9AFBE885E2 FOREIGN KEY (widget_id) REFERENCES widget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9A54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidgetslide ADD CONSTRAINT FK_DF96542055B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A759FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A74B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A7F3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A76E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A59FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1AF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A6E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5FE54D947 FOREIGN KEY (group_id) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C4A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C459FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE widget ADD CONSTRAINT FK_85F91ED054B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE alert_id_seq CASCADE');
$this->addSql('DROP SEQUENCE alertcategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE audit_id_seq CASCADE');
$this->addSql('DROP SEQUENCE bookmark_id_seq CASCADE');
$this->addSql('DROP SEQUENCE cron_id_seq CASCADE');
$this->addSql('DROP SEQUENCE groupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE icon_id_seq CASCADE');
$this->addSql('DROP SEQUENCE item_id_seq CASCADE');
$this->addSql('DROP SEQUENCE itemcategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau01_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau02_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau03_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau04_id_seq CASCADE');
$this->addSql('DROP SEQUENCE page_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagecategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagewidget_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagewidgetslide_id_seq CASCADE');
$this->addSql('DROP SEQUENCE registration_id_seq CASCADE');
$this->addSql('DROP SEQUENCE useraccount_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usergroupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usermodo_id_seq CASCADE');
$this->addSql('DROP SEQUENCE whitelist_id_seq CASCADE');
$this->addSql('DROP SEQUENCE widget_id_seq CASCADE');
$this->addSql('ALTER TABLE alert DROP CONSTRAINT FK_17FD46C164C19C1');
$this->addSql('ALTER TABLE alertgroupe DROP CONSTRAINT FK_64DB975617FD46C1');
$this->addSql('ALTER TABLE alertgroupe DROP CONSTRAINT FK_64DB97564B98C21');
$this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA917FD46C1');
$this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA9E157AA1A');
$this->addSql('ALTER TABLE alertcategory DROP CONSTRAINT FK_EC575F7E54B9D732');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D54B9D732');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921DA76ED395');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D55B7C7A2');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D126F525E');
$this->addSql('ALTER TABLE groupe DROP CONSTRAINT FK_4B98C217E3C61F9');
$this->addSql('ALTER TABLE groupe DROP CONSTRAINT FK_4B98C216D71CE5E');
$this->addSql('ALTER TABLE icon DROP CONSTRAINT FK_659429DBA76ED395');
$this->addSql('ALTER TABLE item DROP CONSTRAINT FK_1F1B251E54B9D732');
$this->addSql('ALTER TABLE item DROP CONSTRAINT FK_1F1B251E64C19C1');
$this->addSql('ALTER TABLE itemgroupe DROP CONSTRAINT FK_A4267B6D1F1B251E');
$this->addSql('ALTER TABLE itemgroupe DROP CONSTRAINT FK_A4267B6D4B98C21');
$this->addSql('ALTER TABLE itemcategory DROP CONSTRAINT FK_7959DEE854B9D732');
$this->addSql('ALTER TABLE niveau02 DROP CONSTRAINT FK_F4F52F9959FDD7AB');
$this->addSql('ALTER TABLE niveau03 DROP CONSTRAINT FK_83F21F0F4B487845');
$this->addSql('ALTER TABLE niveau04 DROP CONSTRAINT FK_1D968AACF3F41F20');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB6207AED5C04');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB620A76ED395');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB620C4663E4');
$this->addSql('ALTER TABLE pagegroupe DROP CONSTRAINT FK_E8009F6B140AB620');
$this->addSql('ALTER TABLE pagegroupe DROP CONSTRAINT FK_E8009F6B4B98C21');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9AC4663E4');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9AFBE885E2');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9A54B9D732');
$this->addSql('ALTER TABLE pagewidgetslide DROP CONSTRAINT FK_DF96542055B7C7A2');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A759FDD7AB');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A74B487845');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A7F3F41F20');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A76E232799');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A59FDD7AB');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A4B487845');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1AF3F41F20');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A6E232799');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5A76ED395');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5FE54D947');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C4A76ED395');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C459FDD7AB');
$this->addSql('ALTER TABLE widget DROP CONSTRAINT FK_85F91ED054B9D732');
$this->addSql('DROP TABLE alert');
$this->addSql('DROP TABLE alertgroupe');
$this->addSql('DROP TABLE alertuserread');
$this->addSql('DROP TABLE alertcategory');
$this->addSql('DROP TABLE audit');
$this->addSql('DROP TABLE bookmark');
$this->addSql('DROP TABLE config');
$this->addSql('DROP TABLE cron');
$this->addSql('DROP TABLE groupe');
$this->addSql('DROP TABLE icon');
$this->addSql('DROP TABLE item');
$this->addSql('DROP TABLE itemgroupe');
$this->addSql('DROP TABLE itemcategory');
$this->addSql('DROP TABLE niveau01');
$this->addSql('DROP TABLE niveau02');
$this->addSql('DROP TABLE niveau03');
$this->addSql('DROP TABLE niveau04');
$this->addSql('DROP TABLE page');
$this->addSql('DROP TABLE pagegroupe');
$this->addSql('DROP TABLE pagecategory');
$this->addSql('DROP TABLE pagewidget');
$this->addSql('DROP TABLE pagewidgetslide');
$this->addSql('DROP TABLE registration');
$this->addSql('DROP TABLE useraccount');
$this->addSql('DROP TABLE usergroupe');
$this->addSql('DROP TABLE usermodo');
$this->addSql('DROP TABLE whitelist');
$this->addSql('DROP TABLE widget');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -0,0 +1,245 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230203163146 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE Blog_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE Page_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE audit_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE blogtype_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE child_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE childheader_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE cron_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE groupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE menu_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE menuchild_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau01_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau02_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau03_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau04_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagetype_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pin_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE registration_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE useraccount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usergroupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usermodo_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE whitelist_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE Blog (id INT NOT NULL, blogtype_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, externalcode VARCHAR(255) DEFAULT NULL, externalid VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6027FE7DA930CED1 ON Blog (blogtype_id)');
$this->addSql('CREATE TABLE Page (id INT NOT NULL, pagetype_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, externalcode VARCHAR(255) DEFAULT NULL, externalid VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B438191E53A99D0E ON Page (pagetype_id)');
$this->addSql('CREATE TABLE audit (id INT NOT NULL, entityname VARCHAR(250) NOT NULL, entityid VARCHAR(250) NOT NULL, datesubmit TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, username VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, detail TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX search_idx ON audit (entityname, entityid, datesubmit)');
$this->addSql('COMMENT ON COLUMN audit.detail IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE blogtype (id INT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, sortby VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE child (id INT NOT NULL, blog_id INT DEFAULT NULL, page_id INT DEFAULT NULL, childtype_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, subname VARCHAR(255) DEFAULT NULL, description TEXT DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, filename VARCHAR(255) DEFAULT NULL, fileextention VARCHAR(255) DEFAULT NULL, fileminetype VARCHAR(255) DEFAULT NULL, url VARCHAR(255) DEFAULT NULL, externalcode VARCHAR(255) DEFAULT NULL, externalid VARCHAR(255) DEFAULT NULL, externalscript VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_22B35429DAE07E97 ON child (blog_id)');
$this->addSql('CREATE INDEX IDX_22B35429C4663E4 ON child (page_id)');
$this->addSql('CREATE INDEX IDX_22B35429552AAF4C ON child (childtype_id)');
$this->addSql('CREATE TABLE childtag (child INT NOT NULL, tag VARCHAR(255) NOT NULL, PRIMARY KEY(child, tag))');
$this->addSql('CREATE INDEX IDX_B8AAB0A822B35429 ON childtag (child)');
$this->addSql('CREATE INDEX IDX_B8AAB0A8389B783 ON childtag (tag)');
$this->addSql('CREATE TABLE childpin (child INT NOT NULL, pin INT NOT NULL, PRIMARY KEY(child, pin))');
$this->addSql('CREATE INDEX IDX_EA62AD822B35429 ON childpin (child)');
$this->addSql('CREATE INDEX IDX_EA62AD8B5852DF3 ON childpin (pin)');
$this->addSql('CREATE TABLE childheader (id INT NOT NULL, child_id INT DEFAULT NULL, filename VARCHAR(255) NOT NULL, roworder INT NOT NULL, credit VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B74CE6CEDD62C21B ON childheader (child_id)');
$this->addSql('CREATE TABLE childtype (id INT NOT NULL, name VARCHAR(255) NOT NULL, roworder INT NOT NULL, submitroute VARCHAR(255) NOT NULL, havechildheader BOOLEAN NOT NULL, havefile BOOLEAN NOT NULL, haveurl BOOLEAN NOT NULL, havepin BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE config (id VARCHAR(255) NOT NULL, title VARCHAR(250) NOT NULL, value TEXT DEFAULT NULL, defaultvalue TEXT NOT NULL, roworder VARCHAR(255) NOT NULL, visible BOOLEAN NOT NULL, changeable BOOLEAN NOT NULL, required BOOLEAN NOT NULL, type VARCHAR(255) NOT NULL, grouped VARCHAR(255) NOT NULL, category VARCHAR(255) NOT NULL, help TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cron (id INT NOT NULL, command VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, statut INT DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, startexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, endexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, nextexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, repeatinterval INT DEFAULT NULL, jsonargument TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE groupe (id INT NOT NULL, owner_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, email VARCHAR(250) DEFAULT NULL, isopen BOOLEAN DEFAULT false NOT NULL, isworkgroup BOOLEAN DEFAULT false NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)');
$this->addSql('CREATE TABLE menu (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE menuchild (id INT NOT NULL, menu_id INT DEFAULT NULL, blog_id INT DEFAULT NULL, page_id INT DEFAULT NULL, blogtype_id INT DEFAULT NULL, pagetype_id INT DEFAULT NULL, childtype VARCHAR(255) NOT NULL, roworder INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_B7D9D47CCCD7E912 ON menuchild (menu_id)');
$this->addSql('CREATE INDEX IDX_B7D9D47CDAE07E97 ON menuchild (blog_id)');
$this->addSql('CREATE INDEX IDX_B7D9D47CC4663E4 ON menuchild (page_id)');
$this->addSql('CREATE INDEX IDX_B7D9D47CA930CED1 ON menuchild (blogtype_id)');
$this->addSql('CREATE INDEX IDX_B7D9D47C53A99D0E ON menuchild (pagetype_id)');
$this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6DFC7E23EA750E8 ON niveau01 (label)');
$this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)');
$this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
$this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
$this->addSql('CREATE TABLE pagetype (id INT NOT NULL, name VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, sortby VARCHAR(255) NOT NULL, image VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE pin (id INT NOT NULL, name VARCHAR(255) NOT NULL, subname VARCHAR(255) DEFAULT NULL, description TEXT DEFAULT NULL, image VARCHAR(255) DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE registration (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, email VARCHAR(128) NOT NULL, isvisible BOOLEAN NOT NULL, postaladress VARCHAR(250) DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, statut INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7F85E0677 ON registration (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7E7927C74 ON registration (email)');
$this->addSql('CREATE INDEX IDX_62A8A7A759FDD7AB ON registration (niveau01_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A74B487845 ON registration (niveau02_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A7F3F41F20 ON registration (niveau03_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A76E232799 ON registration (niveau04_id)');
$this->addSql('CREATE TABLE tag (id VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE useraccount (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, apikey VARCHAR(255) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, roles TEXT NOT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, isactive BOOLEAN NOT NULL, email VARCHAR(128) NOT NULL, avatar VARCHAR(250) DEFAULT \'0\', isvisible BOOLEAN NOT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, preference TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AF85E0677 ON useraccount (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AE7927C74 ON useraccount (email)');
$this->addSql('CREATE INDEX IDX_E157AA1A59FDD7AB ON useraccount (niveau01_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A4B487845 ON useraccount (niveau02_id)');
$this->addSql('CREATE INDEX IDX_E157AA1AF3F41F20 ON useraccount (niveau03_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A6E232799 ON useraccount (niveau04_id)');
$this->addSql('COMMENT ON COLUMN useraccount.roles IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN useraccount.preference IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE usergroupe (id INT NOT NULL, user_id INT DEFAULT NULL, group_id INT DEFAULT NULL, rolegroup INT NOT NULL, apikey VARCHAR(60) NOT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6C439BE5A76ED395 ON usergroupe (user_id)');
$this->addSql('CREATE INDEX IDX_6C439BE5FE54D947 ON usergroupe (group_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6C439BE5A76ED395FE54D947 ON usergroupe (user_id, group_id)');
$this->addSql('CREATE TABLE usermodo (id INT NOT NULL, user_id INT NOT NULL, niveau01_id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D162D6C4A76ED395 ON usermodo (user_id)');
$this->addSql('CREATE INDEX IDX_D162D6C459FDD7AB ON usermodo (niveau01_id)');
$this->addSql('CREATE TABLE whitelist (id INT NOT NULL, label VARCHAR(250) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CB069864EA750E8 ON whitelist (label)');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE Blog ADD CONSTRAINT FK_6027FE7DA930CED1 FOREIGN KEY (blogtype_id) REFERENCES blogtype (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE Page ADD CONSTRAINT FK_B438191E53A99D0E FOREIGN KEY (pagetype_id) REFERENCES pagetype (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE child ADD CONSTRAINT FK_22B35429DAE07E97 FOREIGN KEY (blog_id) REFERENCES Blog (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE child ADD CONSTRAINT FK_22B35429C4663E4 FOREIGN KEY (page_id) REFERENCES Page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE child ADD CONSTRAINT FK_22B35429552AAF4C FOREIGN KEY (childtype_id) REFERENCES childtype (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE childtag ADD CONSTRAINT FK_B8AAB0A822B35429 FOREIGN KEY (child) REFERENCES child (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE childtag ADD CONSTRAINT FK_B8AAB0A8389B783 FOREIGN KEY (tag) REFERENCES tag (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE childpin ADD CONSTRAINT FK_EA62AD822B35429 FOREIGN KEY (child) REFERENCES child (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE childpin ADD CONSTRAINT FK_EA62AD8B5852DF3 FOREIGN KEY (pin) REFERENCES pin (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE childheader ADD CONSTRAINT FK_B74CE6CEDD62C21B FOREIGN KEY (child_id) REFERENCES child (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C217E3C61F9 FOREIGN KEY (owner_id) REFERENCES useraccount (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE menuchild ADD CONSTRAINT FK_B7D9D47CCCD7E912 FOREIGN KEY (menu_id) REFERENCES menu (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE menuchild ADD CONSTRAINT FK_B7D9D47CDAE07E97 FOREIGN KEY (blog_id) REFERENCES Blog (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE menuchild ADD CONSTRAINT FK_B7D9D47CC4663E4 FOREIGN KEY (page_id) REFERENCES Page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE menuchild ADD CONSTRAINT FK_B7D9D47CA930CED1 FOREIGN KEY (blogtype_id) REFERENCES blogtype (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE menuchild ADD CONSTRAINT FK_B7D9D47C53A99D0E FOREIGN KEY (pagetype_id) REFERENCES pagetype (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau02 ADD CONSTRAINT FK_F4F52F9959FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau03 ADD CONSTRAINT FK_83F21F0F4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau04 ADD CONSTRAINT FK_1D968AACF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A759FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A74B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A7F3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A76E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A59FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1AF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A6E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5FE54D947 FOREIGN KEY (group_id) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C4A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C459FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE Blog_id_seq CASCADE');
$this->addSql('DROP SEQUENCE Page_id_seq CASCADE');
$this->addSql('DROP SEQUENCE audit_id_seq CASCADE');
$this->addSql('DROP SEQUENCE blogtype_id_seq CASCADE');
$this->addSql('DROP SEQUENCE child_id_seq CASCADE');
$this->addSql('DROP SEQUENCE childheader_id_seq CASCADE');
$this->addSql('DROP SEQUENCE cron_id_seq CASCADE');
$this->addSql('DROP SEQUENCE groupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE menu_id_seq CASCADE');
$this->addSql('DROP SEQUENCE menuchild_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau01_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau02_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau03_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau04_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagetype_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pin_id_seq CASCADE');
$this->addSql('DROP SEQUENCE registration_id_seq CASCADE');
$this->addSql('DROP SEQUENCE useraccount_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usergroupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usermodo_id_seq CASCADE');
$this->addSql('DROP SEQUENCE whitelist_id_seq CASCADE');
$this->addSql('ALTER TABLE Blog DROP CONSTRAINT FK_6027FE7DA930CED1');
$this->addSql('ALTER TABLE Page DROP CONSTRAINT FK_B438191E53A99D0E');
$this->addSql('ALTER TABLE child DROP CONSTRAINT FK_22B35429DAE07E97');
$this->addSql('ALTER TABLE child DROP CONSTRAINT FK_22B35429C4663E4');
$this->addSql('ALTER TABLE child DROP CONSTRAINT FK_22B35429552AAF4C');
$this->addSql('ALTER TABLE childtag DROP CONSTRAINT FK_B8AAB0A822B35429');
$this->addSql('ALTER TABLE childtag DROP CONSTRAINT FK_B8AAB0A8389B783');
$this->addSql('ALTER TABLE childpin DROP CONSTRAINT FK_EA62AD822B35429');
$this->addSql('ALTER TABLE childpin DROP CONSTRAINT FK_EA62AD8B5852DF3');
$this->addSql('ALTER TABLE childheader DROP CONSTRAINT FK_B74CE6CEDD62C21B');
$this->addSql('ALTER TABLE groupe DROP CONSTRAINT FK_4B98C217E3C61F9');
$this->addSql('ALTER TABLE menuchild DROP CONSTRAINT FK_B7D9D47CCCD7E912');
$this->addSql('ALTER TABLE menuchild DROP CONSTRAINT FK_B7D9D47CDAE07E97');
$this->addSql('ALTER TABLE menuchild DROP CONSTRAINT FK_B7D9D47CC4663E4');
$this->addSql('ALTER TABLE menuchild DROP CONSTRAINT FK_B7D9D47CA930CED1');
$this->addSql('ALTER TABLE menuchild DROP CONSTRAINT FK_B7D9D47C53A99D0E');
$this->addSql('ALTER TABLE niveau02 DROP CONSTRAINT FK_F4F52F9959FDD7AB');
$this->addSql('ALTER TABLE niveau03 DROP CONSTRAINT FK_83F21F0F4B487845');
$this->addSql('ALTER TABLE niveau04 DROP CONSTRAINT FK_1D968AACF3F41F20');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A759FDD7AB');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A74B487845');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A7F3F41F20');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A76E232799');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A59FDD7AB');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A4B487845');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1AF3F41F20');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A6E232799');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5A76ED395');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5FE54D947');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C4A76ED395');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C459FDD7AB');
$this->addSql('DROP TABLE Blog');
$this->addSql('DROP TABLE Page');
$this->addSql('DROP TABLE audit');
$this->addSql('DROP TABLE blogtype');
$this->addSql('DROP TABLE child');
$this->addSql('DROP TABLE childtag');
$this->addSql('DROP TABLE childpin');
$this->addSql('DROP TABLE childheader');
$this->addSql('DROP TABLE childtype');
$this->addSql('DROP TABLE config');
$this->addSql('DROP TABLE cron');
$this->addSql('DROP TABLE groupe');
$this->addSql('DROP TABLE menu');
$this->addSql('DROP TABLE menuchild');
$this->addSql('DROP TABLE niveau01');
$this->addSql('DROP TABLE niveau02');
$this->addSql('DROP TABLE niveau03');
$this->addSql('DROP TABLE niveau04');
$this->addSql('DROP TABLE pagetype');
$this->addSql('DROP TABLE pin');
$this->addSql('DROP TABLE registration');
$this->addSql('DROP TABLE tag');
$this->addSql('DROP TABLE useraccount');
$this->addSql('DROP TABLE usergroupe');
$this->addSql('DROP TABLE usermodo');
$this->addSql('DROP TABLE whitelist');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230203164540 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE child ADD roworder INT NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE child DROP roworder');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

BIN
public/medias/logo/logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -57,11 +57,11 @@
color: var(--colorbgbodydark);
}
.card-body .table a {
.select2-results__option, .card-body a, .card-body .table a, .list-group-item a, .list-group-item .btn-link, .card-header .btn-link {
color: var(--colorbgbodydark);
}
.card-body .table a:hover {
.card-body a:hover, .card-body .table a:hover, .list-group-item a:hover, .list-group-item .btn-link:hover, .card-header .btn-link:hover {
color: var(--colorfttitlelight-darker);
}

View File

@ -2,16 +2,15 @@
namespace App\Command;
use App\Entity\Childattribut;
use App\Entity\Childtype;
use App\Entity\Childtypeattribut;
use App\Entity\Config;
use App\Entity\Cron;
use App\Entity\Group;
use App\Entity\Icon;
use App\Entity\Menu;
use App\Entity\Niveau01;
use App\Entity\Page;
use App\Entity\Pagecategory;
use App\Entity\Pagewidget;
use App\Entity\User;
use App\Entity\Widget;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Id\AssignedGenerator;
use Doctrine\ORM\Mapping\ClassMetadata;
@ -21,7 +20,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
class InitCommand extends Command
{
@ -72,19 +70,7 @@ class InitCommand extends Command
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Page');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Pagecategory');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Widget');
$metadata = $this->em->getClassMetaData('App\Entity\Menu');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
@ -190,6 +176,21 @@ class InitCommand extends Command
'Description de votre site'
);
$this->insertConfig(
10, // order
'site', // category
'appimage', // id
'Image home de votre site', // title
'', // value
'header/body.jpg', // default
'image', // type,
true, // visible
true, // changeable
false, // required
'', // grouped
'Image home de votre site'
);
$this->insertConfig(
100, // order
'site', // category
@ -251,6 +252,21 @@ class InitCommand extends Command
"La couleur de fond quand le site a besoin d'avoir une couleur de fond claire"
);
$this->insertConfig(
3, // order
'colorbgbody', // category
'colorbgbodyimportant', // id
'Couleur de fond important', // title
'', // value
'#078eb5', // default
'color', // type,
true, // visible
true, // changeable
false, // required
'', // grouped
"La couleur de fond quand le site a besoin d'avoir une couleur de fond important"
);
// colorfttitle = Couleur des fontes titre
$this->insertConfig(
1, // order
@ -497,413 +513,27 @@ class InitCommand extends Command
}
$this->em->flush();
// == ICON ================================================================================================================================================
$finder = new Finder();
$finder->in('public/medias/icon/');
$finder->name('icon_*');
foreach ($finder as $file) {
$image = 'icon/'.$file->getRelativePathname();
$icon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => $image]);
if (!$icon) {
$icon = new Icon();
$icon->setLabel($image);
$this->em->persist($icon);
}
}
$this->em->flush();
// == FILES ================================================================================================================================================
$finder = new Finder();
$finder->in('public/medias/file/');
$finder->name('*.png');
$files = [];
foreach ($finder as $file) {
$path = $this->container->getParameter('appAlias').'medias/file/'.$file->getRelativePathname();
$key = pathinfo($file, PATHINFO_FILENAME);
$files[$key] = $path;
}
$this->filesystem->dumpFile($this->rootmedias.'/file/files.json', json_encode($files));
// == PAGECATEGORY ========================================================================================================================================
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(1);
if (!$entityPagecategory) {
$entityPagecategory = new Pagecategory();
$entityPagecategory->setId(1);
$entityPagecategory->setName('URL');
$this->em->persist($entityPagecategory);
}
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2);
if (!$entityPagecategory) {
$entityPagecategory = new Pagecategory();
$entityPagecategory->setId(2);
$entityPagecategory->setName('Widget');
$this->em->persist($entityPagecategory);
}
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(3);
if (!$entityPagecategory) {
$entityPagecategory = new Pagecategory();
$entityPagecategory->setId(3);
$entityPagecategory->setName('Editeur');
$this->em->persist($entityPagecategory);
}
// == WIDGET ==============================================================================================================================================
// Widget Page web
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-2000);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_ribbon.png']);
$entityWidget->setId(-2000);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Page web');
$entityWidget->setDescription("Affiche le contenu d'une page web");
$entityWidget->setRouteview('app_admin_pagewidget_view_url');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'url', 'loc' => 'col1', 'type' => 'string', 'label' => 'URL', 'value' => '', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Bureau
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1990);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_computer.png']);
$entityWidget->setId(-1990);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Bureau');
$entityWidget->setDescription('Affiche vos items de bureau');
$entityWidget->setRouteview('app_admin_pagewidget_view_item');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true'], ['id' => 'withbookmark', 'loc' => 'col1', 'type' => 'withbookmark', 'label' => 'Avec Favoris', 'value' => '0', 'mandatory' => 'true'], ['id' => 'itemcategory', 'loc' => 'col1', 'type' => 'itemcategory', 'label' => 'Catégorie Affichée', 'value' => '', 'mandatory' => 'false'], ['id' => 'search', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Zone de Recherche', 'value' => '0', 'mandatory' => 'true'], ['id' => 'menu', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Menu des Catégories', 'value' => '0', 'mandatory' => 'true'], ['id' => 'menuall', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Menu toutes les Catégories', 'value' => '1', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Bureau Essentiel
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1850);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_computer.png']);
$entityWidget->setId(-1850);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Bureau Essentiel');
$entityWidget->setDescription('Affiche les items de bureau essentiel');
$entityWidget->setRouteview('app_admin_pagewidget_view_itemessential');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Liens
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1960);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_star.png']);
$entityWidget->setId(-1960);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Liens');
$entityWidget->setDescription('Bibliothèque de Liens');
$entityWidget->setRouteview('app_admin_pagewidget_view_bookmark');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Lien
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1950);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_bolt.png']);
$entityWidget->setId(-1950);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Lien');
$entityWidget->setDescription("Création d'un Lien unique");
$entityWidget->setRouteview('app_admin_pagewidget_view_link');
$entityWidget->setHeight('200');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(false);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'url', 'loc' => 'col1', 'type' => 'string', 'label' => 'URL', 'value' => '', 'mandatory' => 'true'], ['id' => 'target', 'loc' => 'col1', 'type' => 'target', 'label' => 'Ouvrir le lien dans', 'value' => '0', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Annonce
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1980);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_megaphone.png']);
$entityWidget->setId(-1980);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Annonces');
$entityWidget->setDescription('Affiche vos annonces');
$entityWidget->setRouteview('app_admin_pagewidget_view_alert');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(false);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'alertcategory', 'loc' => 'col1', 'type' => 'alertcategory', 'label' => 'Catégorie Affichée', 'value' => '', 'mandatory' => 'false']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Informations
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1860);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_info.png']);
$entityWidget->setId(-1860);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Informations');
$entityWidget->setDescription('Afficher les informations associées à la page');
$entityWidget->setRouteview('app_admin_pagewidget_view_info');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(false);
$entityWidget->setViewheader(true);
$entityWidget->setViewheader(true);
$entityWidget->setColorheaderback('#5b5b5b');
$entityWidget->setColorheaderfont('#ffffff');
$entityWidget->setColorbodyback('#5b5b5b');
$entityWidget->setColorbodyfont('#ffffff');
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => []];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Carrousel
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1930);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_easel.png']);
$entityWidget->setId(-1930);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Carrousel');
$entityWidget->setDescription("Carrousel d'images");
$entityWidget->setRouteview('app_admin_pagewidget_view_slide');
$entityWidget->setHeight('400');
$entityWidget->setAutoajust(false);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(false);
$entityWidget->setColorheaderback('#5b5b5b');
$entityWidget->setColorheaderfont('#ffffff');
$entityWidget->setColorbodyback('#5b5b5b');
$entityWidget->setColorbodyfont('#ffffff');
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'interval', 'loc' => 'col1', 'type' => 'integer', 'label' => 'Interval en seconde entre 2 images', 'value' => '5', 'mandatory' => 'false']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget File
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1920);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_folder.png']);
$entityWidget->setId(-1920);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Fichiers');
$entityWidget->setDescription('Répertoire de fichiers');
$entityWidget->setRouteview('app_admin_pagewidget_view_file');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modelist', 'loc' => 'col1', 'type' => 'modelist', 'label' => 'Mode Affichage', 'value' => '0', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Galery
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1910);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_image.png']);
$entityWidget->setId(-1910);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Galerie');
$entityWidget->setDescription("Galerie d'images");
$entityWidget->setRouteview('app_admin_pagewidget_view_galery');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => []];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Texte
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1940);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_compose.png']);
$entityWidget->setId(-1940);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Texte');
$entityWidget->setDescription('Votre propre texte à éditer');
$entityWidget->setRouteview('app_admin_pagewidget_view_editor');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setViewheader(true);
$entityWidget->setOpened(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'html', 'loc' => 'col5', 'type' => 'hidden', 'label' => 'Texte', 'value' => '', 'mandatory' => 'false']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
$this->em->flush();
// == PAGETEMPALTE =======================================================================================================================================
// Template app
$entityPage = $this->em->getRepository('App\Entity\Page')->find(-100);
if (!$entityPage) {
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2);
$entityGroup = $this->em->getRepository("App\Entity\Group")->find(-1);
$entityPage = new Page();
$entityPage->setId(-100);
$entityPage->setRowOrder(0);
$entityPage->setName('Applications');
$entityPage->setParentfor('app');
$entityPage->setMaxwidth(1000);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->addGroup($entityGroup);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 12,"rows":[]}]}]}');
$this->em->persist($entityPage);
$this->em->flush();
$entityPagewidget = $this->em->getRepository('App\Entity\Pagewidget')->find(-110);
if (!$entityPagewidget) {
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1990);
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId(-110);
$entityPagewidget->setLoc('R1C1');
$entityPagewidget->setRoworder(0);
$entityPagewidget->setName('Applications');
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->isAutoajust());
$entityPagewidget->setBorder($entityWidget->isBorder());
$entityPagewidget->setOpened($entityWidget->isOpened());
$entityPagewidget->setViewheader($entityWidget->isViewheader());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$param['fields'] = ['fields' => [['id' => 'modedesktop', 'value' => 2], ['id' => 'withbookmark', 'value' => 0], ['id' => 'itemcategory', 'value' => null], ['id' => 'menu', 'value' => 1], ['id' => 'search', 'value' => 1], ['id' => 'menuall', 'value' => 1]]];
$entityPagewidget->setParameter($param['fields']);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
// Template Group
$entityPage = $this->em->getRepository('App\Entity\Page')->find(-110);
if (!$entityPage) {
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2);
$entityPage = new Page();
$entityPage->setId(-110);
$entityPage->setRowOrder(0);
$entityPage->setName('Groupe Template');
$entityPage->setParentfor('group');
$entityPage->setMaxwidth(0);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 3,"rows":[]},{"id":1,"size": 6,"rows":[{"id":0,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]},{"id":2,"size": 3,"rows":[]}]}]}');
$this->em->persist($entityPage);
$this->em->flush();
// Widget Nos Liens
/*
$fields = ['fields' => [['id' => 'modedesktop', 'value' => 2]]];
$this->addWidget(-120, $entityPage, -1960, 'R1C2R1C1', 0, 'Nos Liens', true, $fields);
// Widget Nos Fichiers
$fields=["fields"=>[]];
$this->addWidget(-130,$entityPage,-1920,"R1C2R1C2",0,"Nos Fichiers",true,$fields);
// Widget Info Page
$fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields);
// Widget Tâche
$fields=["fields"=>[]];
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
// Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields);
// Widget Notre Calendrier
$fields=["fields"=>[["id"=>"nbday","value"=>30]]];
$this->addWidget(-160,$entityPage,-1900,"R1C2R1C1",1,"Notre Calendrier",true,$fields);
// Chat
$fields=["fields"=>[]];
$this->addWidget(-170,$entityPage,-1840,"R1C3",0,"Chat",false,$fields);
*/
}
$output->writeln('');
// == CHILDTYPE ==============================================================================================================================================
// Création des childtypes
$this->insertChildtype(1, 'Articles', 1, 'app_child_submit', true, false, false, false);
$this->insertChildtype(12, 'Images', 12, 'app_child_submit_image', false, true, false, false);
$this->insertChildtype(13, 'Embed Images', 13, 'app_child_submit', false, false, true, false);
$this->insertChildtype(14, 'Vidéos', 14, 'app_child_submit_video', false, true, false, false);
$this->insertChildtype(15, 'Embed Vidéos', 15, 'app_child_submit', false, false, true, false);
$this->insertChildtype(16, 'Ressources', 16, 'app_child_submit_file', true, true, false, false);
$this->insertChildtype(17, 'Embed Ressources', 17, 'app_child_submit', true, false, true, false);
$this->insertChildtype(21, 'Liens Externes', 21, 'app_child_submit', false, false, true, false);
$this->insertChildtype(22, 'Bibliographies', 22, 'app_child_submit', false, false, true, false);
// == MENU ==============================================================================================================================================
$this->insertMenu(-1, 'Entête');
$this->insertMenu(-2, 'Accueil');
return Command::SUCCESS;
}
@ -933,6 +563,76 @@ class InitCommand extends Command
$this->em->flush();
}
protected function insertChildtype($id, $name, $roworder, $submitroute, $havechildheader, $havefile, $haveurl, $havepin)
{
$entity = $this->em->getRepository("App\Entity\Childtype")->find($id);
if (!$entity) {
$entity = new Childtype();
$entity->setId($id);
}
$entity->setName($name);
$entity->setRoworder($roworder);
$entity->setSubmitroute($submitroute);
$entity->setHavechildheader($havechildheader);
$entity->setHavefile($havefile);
$entity->setHaveurl($haveurl);
$entity->setHavepin($havepin);
$this->em->persist($entity);
$this->em->flush();
}
protected function insertChildattribut($id, $name, $label, $required, $type, $extra = [])
{
$entity = $this->em->getRepository("App\Entity\Childattribut")->find($id);
if (!$entity) {
$entity = new Childattribut();
$entity->setId($id);
}
$entity->setName($name);
$entity->setLabel($label);
$entity->setRequired($required);
$entity->setType($type);
$entity->setExtra($extra);
$this->em->persist($entity);
$this->em->flush();
}
protected function insertChildtypeattribut($id, $name, $roworder)
{
$type = $this->em->getRepository("App\Entity\Childtype")->find($id);
$attribut = $this->em->getRepository("App\Entity\Childattribut")->findOneBy(['name' => $name]);
$entity = $this->em->getRepository("App\Entity\Childtypeattribut")->findOneBy(['childtype' => $type, 'childattribut' => $attribut]);
if (!$entity) {
$entity = new Childtypeattribut();
}
$entity->setChildtype($type);
$entity->setChildattribut($attribut);
$entity->setRoworder($roworder);
$this->em->persist($entity);
$this->em->flush();
}
private function insertMenu($id, $name)
{
$entity = $this->em->getRepository("App\Entity\Menu")->find($id);
if (!$entity) {
$entity = new Menu();
$entity->setId($id);
}
$entity->setName($name);
$this->em->persist($entity);
$this->em->flush();
}
private function writelnred($string)
{
$this->output->writeln('<fg=red>'.$string.'</>');

View File

@ -1,175 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Alert;
use App\Form\AlertType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class AlertController extends AbstractController
{
private $data = 'alert';
private $entity = "App\Entity\Alert";
private $twig = 'Alert/';
private $route = 'app_admin_alert';
public function list($access, Request $request, ManagerRegistry $em): Response
{
$alerts = $em->getRepository($this->entity)->findBy([], ['rowOrder' => 'asc']);
$alertcategorys = $em->getRepository('App\Entity\Alertcategory')->findAll();
$groups = $em->getRepository('App\Entity\Group')->findBy([], ['label' => 'asc']);
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data.'s' => $alerts,
'alertcategorys' => $alertcategorys,
'groups' => $groups,
'access' => $access,
]);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Alert();
// Création du formulaire
$form = $this->createForm(AlertType::class, $data, ['mode' => 'submit', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'icons' => $em->getRepository('App\Entity\Icon')->findAll(),
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(AlertType::class, $data, ['mode' => 'update', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Si non masquable on s'assure qu'il n'y a pas de reader
if (!$data->getFghideable()) {
$readers = $data->getReaders();
foreach ($readers as $reader) {
$data->removeReader($reader);
}
}
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
public function order($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$id = $request->request->get('id');
$order = $request->request->get('order');
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
$data->setRoworder($order);
$em->getManager()->flush();
return new JsonResponse($output);
}
public function read($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$id = $request->request->get('id');
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
if (!$data->getReaders()->contains($this->getUser())) {
$data->addReader($this->getUser());
$em->getManager()->flush();
}
return new JsonResponse($output);
}
}

View File

@ -1,124 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Alertcategory;
use App\Form\AlertcategoryType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class AlertcategoryController extends AbstractController
{
private $data = 'alertcategory';
private $entity = "App\Entity\Alertcategory";
private $twig = 'Alertcategory/';
private $route = 'app_admin_alertcategory';
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Alertcategory();
// Création du formulaire
$form = $this->createForm(AlertcategoryType::class, $data, ['mode' => 'submit', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_alert'));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'icons' => $em->getRepository('App\Entity\Icon')->findAll(),
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(AlertcategoryType::class, $data, [
'mode' => 'update',
'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null),
]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_alert'));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'update',
'icons' => $em->getRepository('App\Entity\Icon')->findAll(),
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_alert'));
}
}

View File

@ -0,0 +1,175 @@
<?php
namespace App\Controller;
use App\Entity\Blog as Entity;
use App\Form\BlogType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class BlogController extends AbstractController
{
private $data = 'blog';
private $route = 'app_blog';
private $render = 'Blog/';
private $entity = "App\Entity\Blog";
public function list(ManagerRegistry $em)
{
// Récupérer les blogs
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit(Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = new Entity();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute('app_child', ['catparent' => 'blog', 'idparent' => $data->getId()]);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
'from' => 'blog',
]);
}
public function update($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
$from = $request->get('from');
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
if ('child' == $from) {
return $this->redirectToRoute('app_child', ['catparent' => 'blog', 'idparent' => $data->getId()]);
} else {
return $this->redirectToRoute($this->route);
}
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
'from' => $from,
]);
}
public function delete($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute($this->route);
}
public function home(ManagerRegistry $em)
{
$heros = $em->getRepository("App\Entity\Child")->findHeads('blog');
$blogs = $em->getRepository($this->entity)->findBy([], ['submitdate' => 'DESC']);
return $this->render($this->render.'home.html.twig', [
'useheader' => true,
'usesidebar' => false,
'heros' => $heros,
'blogs' => $blogs,
]);
}
public function select(Request $request, ManagerRegistry $em)
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && ('submit' == $mode || 'update' == $mode)) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -0,0 +1,172 @@
<?php
namespace App\Controller;
use App\Entity\Blogtype as Entity;
use App\Form\BlogtypeType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class BlogtypeController extends AbstractController
{
private $data = 'blogtype';
private $route = 'app_typeblog';
private $render = 'Blogtype/';
private $entity = "App\Entity\Blogtype";
public function home($id,ManagerRegistry $em)
{
$data = $em->getRepository($this->entity)->find($id);
return $this->render($this->render.'home.html.twig', [
'useheader' => false,
'usemenu' => true,
'usesidebar' => false,
$this->data => $data,
]);
}
public function list(ManagerRegistry $em)
{
// Récupérer les blogtypes
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit(Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = new Entity();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute($this->route);
}
public function upload()
{
return $this->render($this->render.'upload.html.twig');
}
public function select(Request $request, ManagerRegistry $em)
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -1,236 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Bookmark;
use App\Form\BookmarkType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class BookmarkController extends AbstractController
{
private $data = 'bookmark';
private $entity = "App\Entity\Bookmark";
private $twig = 'Bookmark/';
private $route = 'app_admin_bookmark';
public function submit($access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Initialisation de l'enregistrement
$data = new Bookmark();
$pagewidget = null;
if ('false' == $touser) {
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
}
// Création du formulaire
$form = $this->createForm(BookmarkType::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Bookmark widget ou desktop
if ('true' == $touser) {
$data->setUser($this->getUser());
} else {
$data->setPagewidget($pagewidget);
}
// Icon
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'entity' => $data,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'submit',
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'touser' => $touser,
'form' => $form->createView(),
'usage' => $usage,
]);
}
public function update($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Récupération de l'enregistrement courant
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
if ('false' == $touser) {
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
}
// Création du formulaire
$form = $this->createForm(BookmarkType::class, $data, [
'mode' => 'update',
'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null),
]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Icon
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'entity' => $data,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'update',
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'touser' => $touser,
'form' => $form->createView(),
'usage' => $usage,
]);
}
public function delete($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Récupération de l'enregistrement courant
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
if ('false' == $touser) {
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
}
// Supprimer la donnée
$em->getManager()->remove($data);
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
public function heart(Request $request, ManagerRegistry $em): Response
{
$output = [];
$iditem = $request->request->get('iditem');
// On s'assure que l'item existe
$item = $em->getRepository("App\Entity\Item")->find($iditem);
if (!$item) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'item n'existe pas déjà dans les bookmark de l'utilisateur
$user = $this->getUser();
$bookmark = $em->getRepository($this->entity)->findOneBy(['user' => $user, 'item' => $item]);
if (!$bookmark) {
$bookmark = new Bookmark();
$bookmark->setTitle($item->getTitle());
$bookmark->setSubtitle($item->getSubtitle());
$bookmark->setUrl($item->getUrl());
$bookmark->setIcon($item->getIcon());
$bookmark->setColor($item->getColor());
$bookmark->setTarget($item->getTarget());
$bookmark->setItem($item);
$bookmark->setUser($user);
$em->getManager()->persist($bookmark);
$em->getManager()->flush();
}
$output = $bookmark->getId();
return new JsonResponse($output);
}
}

View File

@ -0,0 +1,829 @@
<?php
namespace App\Controller;
use App\Entity\Child as Entity;
use App\Entity\Childblog;
use App\Entity\Childpage;
use App\Form\ChildType as Form;
use App\Service\ToolService;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\KernelInterface;
class ChildController extends AbstractController
{
private $data = 'child';
private $route = 'app_child';
private $render = 'Child/';
private $entity = "App\Entity\Child";
private $appKernel;
private $tool;
public function __construct(KernelInterface $appKernel, ToolService $tool)
{
$this->appKernel = $appKernel;
$this->tool = $tool;
}
public function search(Request $request, ManagerRegistry $em)
{
$alpha = $request->get('alpha');
$query = $request->get('query');
$catparents = ($request->get('catparents') ? explode(',', $request->get('catparents')) : null);
$childtypes = ($request->get('childtypes') ? $request->get('childtypes') : '1');
$tags = ($request->get('tags') ? $request->get('tags') : null);
$first = ($request->get('first') ? $request->get('first') : 1);
$maxresult = 50;
$nopagination = in_array(30, explode(',', $childtypes));
// $nopagination = true;
if (!$catparents) {
$catparents = ['map'];
}
if (!$alpha) {
$alpha = 'a';
}
$childmaps = [];
$childblogs = [];
$childpages = [];
foreach ($catparents as $catparent) {
switch ($catparent) {
case 'blog':
$q = $em->createQueryBuilder();
$q->select('child');
$q->from("App\Entity\Blog", 'parent');
$q->from("App\Entity\Childblog", 'relation');
$q->from('App:Child', 'child');
$q->from("App\Entity\Childtype", 'childtype');
$q->andwhere('parent=relation.blog');
$q->andwhere('relation.child=child');
$q->andwhere('child.childtype=childtype');
// Si childtype = photoaerienn = filtre alpha
if (!$query && in_array(30, explode(',', $childtypes))) {
$q->andWhere('parent.name LIKE :alpha OR parent.name LIKE :alphaupper');
$q->setParameter('alpha', $alpha.'%');
$q->setParameter('alphaupper', strtoupper($alpha).'%');
}
// Si filtre par childtype
if ($childtypes) {
$q->andWhere('childtype.id IN(:childtypes)');
$q->setParameter('childtypes', explode(',', $childtypes));
}
// Si filtre par query
if ($query) {
$q->andWhere('LOWER(child.name) LIKE :query OR LOWER(child.subname) LIKE :query');
$q->setParameter('query', strtolower('%'.$query.'%'));
}
// Si filtre par tags
if ($tags) {
$q->from('App:Tag', 'tag');
$q->andWhere('tag.id IN(:tags)');
$q->andWhere('tag MEMBER OF child.tags');
$q->setParameter('tags', explode(',', $tags));
}
$c = $q;
$c->select('count(child.id)');
$count = $c->getQuery()->getSingleScalarResult();
$q->select('child');
$q->addOrderBy('parent.name', 'ASC');
$q->addOrderBy('relation.roworder', 'ASC');
if (!$nopagination) {
$q->setMaxResults($maxresult);
$q->setFirstResult(0 + (($first - 1) * $maxresult));
}
$childblogs = $q->getQuery()->getResult();
foreach ($childblogs as $relation) {
$relation->setCatparent('blog');
$relation->setIdparent($relation->getChildblogs()[0]->getBlog()->getId());
$relation->setNameparent($relation->getChildblogs()[0]->getBlog()->getName());
}
break;
case 'page':
$q = $em->createQueryBuilder();
$q->select('child');
$q->from("App\Entity\Page", 'parent');
$q->from("App\Entity\Childpage", 'relation');
$q->from('App:Child', 'child');
$q->from("App\Entity\Childtype", 'childtype');
$q->andwhere('parent=relation.page');
$q->andwhere('relation.child=child');
$q->andwhere('child.childtype=childtype');
// Si childtype = photoaerienn = filtre alpha
if (!$query && in_array(30, explode(',', $childtypes))) {
$q->andWhere('parent.name LIKE :alpha OR parent.name LIKE :alphaupper');
$q->setParameter('alpha', $alpha.'%');
$q->setParameter('alphaupper', strtoupper($alpha).'%');
}
// Si filtre par childtype
if ($childtypes) {
$q->andWhere('childtype.id IN(:childtypes)');
$q->setParameter('childtypes', explode(',', $childtypes));
}
// Si filtre par query
if ($query) {
$q->andWhere('LOWER(child.name) LIKE :query OR LOWER(child.subname) LIKE :query');
$q->setParameter('query', strtolower('%'.$query.'%'));
}
// Si filtre par tags
if ($tags) {
$q->from('App:Tag', 'tag');
$q->andWhere('tag.id IN(:tags)');
$q->andWhere('tag MEMBER OF child.tags');
$q->setParameter('tags', explode(',', $tags));
}
$c = $q;
$c->select('count(child.id)');
$count = $c->getQuery()->getSingleScalarResult();
$q->select('child');
$q->addOrderBy('parent.name', 'ASC');
$q->addOrderBy('relation.roworder', 'ASC');
if (!$nopagination) {
$q->setMaxResults($maxresult);
$q->setFirstResult(0 + (($first - 1) * $maxresult));
}
$childpages = $q->getQuery()->getResult();
foreach ($childpages as $relation) {
$relation->setCatparent('page');
$relation->setIdparent($relation->getChildpages()[0]->getPage()->getId());
$relation->setNameparent($relation->getChildpages()[0]->getPage()->getName());
}
break;
}
}
$childs = array_merge($childmaps, $childblogs, $childpages);
return $this->render($this->render.'search.html.twig', [
'childs' => $childs,
'catparents' => $catparents,
'lsttags' => $em->getRepository('App:Tag')->findAll(),
'lsttypes' => $em->getRepository("App\Entity\Childtype")->findAll(),
'tags' => explode(',', $tags),
'query' => $query,
'childtypes' => $childtypes,
'isalpha' => (!$query && in_array(30, explode(',', $childtypes))),
'useheader' => true,
'usesidebar' => false,
'maxwidth' => true,
'nopagination' => $nopagination,
'count' => $count,
'first' => $first,
'maxresult' => $maxresult,
]);
}
public function list($catparent, $idparent, ManagerRegistry $em)
{
// En fonction du parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
// Récupérer les childtypes
$childtypes = $em->getRepository("App\Entity\Childtype")->findBy([], ['roworder' => 'ASC']);
// Récupérer les childs
$datas = $em->getRepository($this->entity)->findBy(["blog"=>$parent]);
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
// Récupérer les childtypes
$childtypes = $em->getRepository("App\Entity\Childtype")->findBy([], ['roworder' => 'ASC']);
// Récupérer les childs
$datas = $em->getRepository($this->entity)->findBy(["page"=>$parent]);
break;
}
return $this->render($this->render.'list.html.twig', [
'catparent' => $catparent,
'parent' => $parent,
'childtypes' => $childtypes,
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit($catparent, $idparent, $idchildtype, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
}
// Récupérer du childtype
$childtype = $em->getRepository("App\Entity\Childtype")->find($idchildtype);
if (!$childtype) {
throw $this->createNotFoundException('Not exist');
}
// Redirige vers la submitroute
if ('app_child_submit' != $childtype->getSubmitroute()) {
return $this->redirectToRoute($childtype->getSubmitroute(), ['catparent' => $catparent, 'idparent' => $parent->getId(), 'idchildtype' => $idchildtype]);
}
// Récupérer le roworder
switch ($catparent) {
case 'blog':
$last = $em->getRepository("App\Entity\Child")->findOneBy(['blog' => $parent], ['roworder' => 'DESC']);
$lastorder = ($last ? $last->getRoworder() + 1 : 1);
// Initialisation de l'enregistrement
$data = new Entity();
$data->setChildtype($childtype);
$data->setBlog($parent);
$data->setRoworder($lastorder);
if (1 == $childtype->getId()) {
$data->setName($parent->getName());
}
break;
case 'page':
$last = $em->getRepository("App\Entity\Child")->findOneBy(['page' => $parent], ['roworder' => 'DESC']);
$lastorder = ($last ? $last->getRoworder() + 1 : 1);
// Initialisation de l'enregistrement
$data = new Entity();
$data->setChildtype($childtype);
$data->setPage($parent);
$data->setRoworder($lastorder);
if (1 == $childtype->getId()) {
$data->setName($parent->getName());
}
break;
}
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit', 'childtype' => $childtype]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$data->setUrl($this->formatEmbed($data->getUrl()));
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route, ['catparent' => $catparent, 'idparent' => $parent->getId()]);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'catparent' => $catparent,
'parent' => $parent,
'childtype' => $childtype,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function submitimage($catparent, $idparent, $idchildtype, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
}
// Récupérer du childtype
$childtype = $em->getRepository("App\Entity\Childtype")->find($idchildtype);
if (!$childtype) {
throw $this->createNotFoundException('Not exist');
}
// Rendu
return $this->render($this->render.'upload.html.twig', [
'useheader' => true,
'usesidebar' => true,
'type' => 'child',
'catparent' => $catparent,
'idparent' => $idparent,
'idchildtype' => $childtype->getId(),
'typeupload' => 'image',
]);
}
public function submitvideo($catparent, $idparent, $idchildtype, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
}
// Récupérer du childtype
$childtype = $em->getRepository("App\Entity\Childtype")->find($idchildtype);
if (!$childtype) {
throw $this->createNotFoundException('Not exist');
}
// Rendu
return $this->render($this->render.'upload.html.twig', [
'useheader' => true,
'usesidebar' => true,
'type' => 'child',
'catparent' => $catparent,
'idparent' => $idparent,
'idchildtype' => $childtype->getId(),
'typeupload' => 'video',
]);
}
public function submitfile($catparent, $idparent, $idchildtype, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
}
// Récupérer du childtype
$childtype = $em->getRepository("App\Entity\Childtype")->find($idchildtype);
if (!$childtype) {
throw $this->createNotFoundException('Not exist');
}
// Rendu
return $this->render($this->render.'upload.html.twig', [
'useheader' => true,
'usesidebar' => true,
'type' => 'child',
'catparent' => $catparent,
'idparent' => $idparent,
'idchildtype' => $childtype->getId(),
'typeupload' => 'all',
]);
}
public function update($catparent, $idparent, $idchild, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
break;
}
$data = $em->getRepository($this->entity)->find($idchild);
$data->setUrl($this->formatEmbed($data->getUrl()));
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update', 'childtype' => $data->getChildtype()]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route, ['catparent' => $catparent, 'idparent' => $idparent]);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'catparent' => $catparent,
'parent' => $parent,
'childtype' => $data->getChildtype(),
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($catparent, $idparent, $idchild, Request $request, ManagerRegistry $em)
{
$child = $em->getRepository($this->entity)->find($idchild);
// Récupérer le parent et la relation
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
break;
}
// Controle avant suppression
$error = false;
if (!$parent || !$child ) {
$error = true;
}
if ($error) {
return $this->redirectToRoute($this->route.'_update', ['catparent' => $catparent, 'idparent' => $idparent, 'idchild' => $idchild]);
} else {
$em->getManager()->remove($child);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route, ['catparent' => $catparent, 'idparent' => $idparent]);
}
}
public function upload($catparent, $idparent, $idchild, $type, Request $request, ManagerRegistry $em)
{
// Récupérer la map
$data = $em->getRepository($this->entity)->find($idchild);
if (!$data) {
throw $this->createNotFoundException('Not exist');
}
// Rendu
return $this->render($this->render.'upload.html.twig', [
'useheader' => true,
'usesidebar' => true,
'type' => 'child',
'catparent' => $catparent,
'idparent' => $idparent,
'idchild' => $idchild,
'idchildtype' => $data->getChildtype()->getId(),
'typeupload' => $type,
]);
}
public function order($catparent, $idparent, Request $request, ManagerRegistry $em)
{
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
break;
}
if ($parent) {
$childids = explode(',', $request->request->get('lstordered'));
$i = 1;
foreach ($childids as $id) {
$child = $em->getRepository($this->entity)->find($id);
$child->setRoworder($i);
if ($child) {
$child->setRoworder($i);
$em->getManager()->flush();
}
++$i;
}
}
return new JsonResponse([]);
}
public function select(Request $request, ManagerRegistry $em)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
public function view($catparent, $idparent, $idchild, Request $request, ManagerRegistry $em)
{
$framed = boolval($request->get('framed'));
$size = intval($request->get('size'));
// Récupérer le parent
switch ($catparent) {
case 'blog':
$parent = $em->getRepository("App\Entity\Blog")->find($idparent);
break;
case 'page':
$parent = $em->getRepository("App\Entity\Page")->find($idparent);
break;
}
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
// Récupérer le type de parent
switch ($catparent) {
case 'blog':
$typeparent = $parent->getBlogtype()->getName();
break;
case 'page':
$typeparent = $parent->getPagetype()->getName();
break;
}
// Récupérer le child
$child = $em->getRepository("App\Entity\Child")->find($idchild);
$firstchild = $em->getRepository("App\Entity\Child")->findFirstchild($catparent, $idparent);
if (!$child) {
$child = $firstchild;
}
if (!$child) {
throw $this->createNotFoundException('Not exist');
}
switch ($child->getChildtype()->getId()) {
// Image / Image embed
case 12:
case 13:
$imageprev = $em->getRepository($this->entity)->findPrev($catparent, $idparent, [12, 13], $relation->getRoworder());
$imagenext = $em->getRepository($this->entity)->findNext($catparent, $idparent, [12, 13], $relation->getRoworder());
return $this->render($this->render.'image.html.twig', [
'catparent' => $catparent,
'parent' => $parent,
'typeparent' => $typeparent,
'firstchild' => $firstchild,
$this->data => $child,
'useheader' => false,
'usesidebar' => false,
'maxwidth' => true,
'imageprev' => $imageprev,
'imagenext' => $imagenext,
]);
break;
// Video / Video embed
case 14:
case 15:
return $this->render($this->render.'video.html.twig', [
'catparent' => $catparent,
'parent' => $parent,
'typeparent' => $typeparent,
'firstchild' => $firstchild,
$this->data => $child,
'useheader' => (!$framed),
'usesidebar' => false,
'maxwidth' => true,
'framed' => $framed,
'size' => $size,
]);
break;
// Ressource / Ressource embed / Lien externe / Biblio
case 16:
case 17:
case 21:
case 22:
return $this->render($this->render.'file.html.twig', [
'catparent' => $catparent,
'parent' => $parent,
'typeparent' => $typeparent,
'firstchild' => $firstchild,
$this->data => $child,
'useheader' => (!$framed),
'usesidebar' => false,
'maxwidth' => true,
'framed' => $framed,
'size' => $size,
]);
break;
// Lien externe / Bibliographie
case 21:
case 12:
$size = 2;
// no break
default:
$images = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [12, 13], $idchild);
$videos = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [14, 15], $idchild);
$contacts = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [20], $idchild);
$ressources = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [16, 17], $idchild);
$links = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [21], $idchild);
$bibliographys = $em->getRepository($this->entity)->findOtherchilds($catparent, $idparent, [22], $idchild);
return $this->render($this->render.'view.html.twig', [
'useheader' => false,
'usemenu' => true,
'maxsize' => ($catparent=="page" ? 900 : 1200),
'catparent' => $catparent,
'parent' => $parent,
'typeparent' => $typeparent,
'firstchild' => $firstchild,
$this->data => $child,
'usesidebar' => false,
'maxwidth' => true,
'framed' => $framed,
'size' => $size,
'pages' => $em->getRepository($this->entity)->findPages($catparent, $idparent),
'images' => $images,
'videos' => $videos,
'contacts' => $contacts,
'ressources' => $ressources,
'links' => $links,
'bibliographys' => $bibliographys,
]);
break;
}
}
public function restjson($catparent, $idparent, $idchild, Request $request, ManagerRegistry $em)
{
// S'assurer que l'on doit ou non configurer le proxy
$url = 'https://'.$this->getParameter('appWeburl').'/'.$this->getParameter('appAlias');
$clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false]);
$token = $this->getParameter('appSecret');
try {
$response = $clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
return 0;
}
}
// Entete
$headers = [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
];
if ($token) {
$headers['Authorization'] = 'token '.$token;
}
// Paramétrage unirest
\Unirest\Request::verifyPeer(false);
\Unirest\Request::verifyHost(false);
\Unirest\Request::timeout(5);
$query = ['key' => $token, 'parentcat' => $catparent, 'parentid' => $idparent, 'childid' => $idchild, 'refreshcache' => true];
$query = json_encode($query);
try {
$response = \Unirest\Request::post($url.'/rest/getChild', $headers, $query);
} catch (\Exception $e) {
return false;
}
return new JsonResponse([]);
}
protected function formatEmbed($url)
{
// Formatage youtube
if (false === stripos($url, 'https://www.youtube.com/embed') && false !== stripos($url, 'youtube')) {
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', '', $url);
$tmp = explode('&', $url);
$url = 'https://www.youtube.com/embed/'.$tmp[0];
}
if (false === stripos($url, 'https://www.youtube.com/embed') && false !== stripos($url, 'youtu.be')) {
$url = str_replace('http://youtu.be/', 'https://www.youtube.com/embed/', $url);
$url = str_replace('https://youtu.be/', 'https://www.youtube.com/embed/', $url);
}
// Formatage Dalymotion
if (false === stripos($url, 'https://www.dailymotion.com/embed') && false !== stripos($url, 'dailymotion')) {
$url = str_replace('http://www.dailymotion.com', 'https://www.dailymotion.com', $url);
$url = str_replace('https://www.dailymotion.com/video/', '', $url);
$tmp = explode('?', $url);
$url = 'https://www.dailymotion.com/embed/video/'.$tmp[0];
}
// Formatage Peertube
if (false !== stripos($url, '/watch/')) {
$url = str_replace('/watch/', '/embed/', $url);
}
return $url;
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -0,0 +1,161 @@
<?php
namespace App\Controller;
use App\Form\ChildheaderType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class ChildheaderController extends AbstractController
{
private $data = 'childheader';
private $route = 'app_childheader';
private $render = 'Childheader/';
private $entity = "App\Entity\Childheader";
public function submit($idchild, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$child = $em->getRepository("App\Entity\Child")->find($idchild);
if (!$child) {
throw $this->createNotFoundException('Not exist');
}
$modal = $request->get('modal');
return $this->render($this->render.'upload.html.twig', [
'useheader' => false,
'usesidebar' => false,
'idchild' => $idchild,
'modal' => $modal,
]);
}
public function update($catparent, $idparent, $id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
$idchild = $data->getChild()->getId();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute('app_child_update', ['catparent' => $catparent, 'idparent' => $idparent, 'idchild' => $idchild]);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
'catparent' => $catparent,
'idparent' => $idparent,
'idchild' => $idchild,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($catparent, $idparent, $id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
$idchild = $data->getChild()->getId();
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
}
return $this->redirectToRoute('app_child_update', ['catparent' => $catparent, 'idparent' => $idparent, 'idchild' => $idchild]);
}
public function view($id, Request $request, ManagerRegistry $em)
{
// Récupérer le childheader
$data = $em->getRepository("App\Entity\Childheader")->find($id);
if (!$data) {
throw $this->createNotFoundException('Not exist');
}
$imageprev = $em->getRepository($this->entity)->findPrev($data->getChild()->getId(), $data->getRoworder());
$imagenext = $em->getRepository($this->entity)->findNext($data->getChild()->getId(), $data->getRoworder());
return $this->render($this->render.'image.html.twig', [
$this->data => $data,
'useheader' => false,
'usesidebar' => false,
'maxwidth' => true,
'imageprev' => $imageprev,
'imagenext' => $imagenext,
]);
}
public function select($idchild, Request $request, ManagerRegistry $em)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$child = $em->getRepository("App\Entity\Child")->find($idchild);
$childheaders = $child->getChildheaders();
$output = [];
foreach ($childheaders as $childheader) {
array_push($output, ['id' => $childheader->getId(), 'filename' => $childheader->getFilename(), 'credit' => $childheader->getCredit()]);
}
return new JsonResponse($output);
}
public function order($idchild, Request $request, ManagerRegistry $em)
{
$childheaderids = explode(',', $request->get('lstordered'));
$i = 1;
foreach ($childheaderids as $id) {
$childheader = $em->getRepository($this->entity)->find($id);
if ($childheader) {
$childheader->setRoworder($i);
$em->getManager()->flush();
}
++$i;
}
return new JsonResponse([]);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -84,4 +84,9 @@ class ConfigController extends AbstractController
{
return $this->render($this->twig.'logo.html.twig');
}
public function image($access): Response
{
return $this->render($this->twig.'image.html.twig');
}
}

View File

@ -2,7 +2,9 @@
namespace App\Controller;
use App\Entity\Childheader;
use App\Service\MinioService;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
@ -130,6 +132,126 @@ class CropController extends AbstractController
]);
}
// Etape 01 - Téléchargement de l'image associé à un entity
public function cropentity01($type, $idparent)
{
return $this->render('Crop/crop01.html.twig', [
'useheader' => false,
'usesidebar' => false,
'type' => $type,
'idparent' => $idparent,
]);
}
// Etape 02 - Couper votre l'image
public function cropentity02($type, $idparent, Request $request, ManagerRegistry $em)
{
// Récupération de l'image à cropper
$file = $request->query->get('file');
$large_image_location = $this->minio->download($type.'/'.$file, $type.'/'.$file, true);
// Récupérer les tailles de l'image
$width = $this->getWidth($large_image_location);
$height = $this->getHeight($large_image_location);
// Définir le pourcentage de réduction de l'image
switch ($type) {
case 'childheader':
$max_height = 1600;
$max_width = 1600;
$parent = $em->getRepository("App\Entity\Child")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
switch ($parent->getChildtype()->getId()) {
case 1: $ratio = '16:4';
break;
case 16: $ratio = '4:6';
break;
case 17: $ratio = '4:6';
break;
default: $ratio = 'none';
break;
}
break;
}
if ($max_height > 0) {
$scale = $max_height / $height;
if (($width * $scale) > $max_width) {
$scale = $max_width / $width;
}
$this->resizeImage($large_image_location, $width, $height, $scale);
$this->minio->upload($large_image_location, $type.'/'.$file, false);
} else {
$scale = 1;
}
// Construction du formulaire
$submited = false;
$form = $this->createFormBuilder()
->add('submit', SubmitType::class, ['label' => 'Valider', 'attr' => ['class' => 'btn btn-success']])
->add('x', HiddenType::class)
->add('y', HiddenType::class)
->add('w', HiddenType::class)
->add('h', HiddenType::class)
->add('xs', HiddenType::class)
->add('ys', HiddenType::class)
->add('ws', HiddenType::class)
->add('hs', HiddenType::class)
->getForm();
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation on généère la miniature croppée
if ($form->get('submit')->isClicked() && $form->isValid()) {
// Récupération des valeurs du formulaire
$data = $form->getData();
// Récupération des valeurs du formulaire
$data = $form->getData();
$tmpdir = $this->appKernel->getProjectDir().'/var/tmp';
$thumb_image_location = "$tmpdir/$type/".dirname($file).'/thumb_'.basename($file);
$cropped = $this->resizeThumbnailImage($thumb_image_location, $large_image_location, $data['ws'], $data['hs'], $data['xs'], $data['ys'], $scale);
// Dépot des fichiers sur minio
$this->minio->upload($thumb_image_location, $type.'/'.dirname($file).'/thumb_'.basename($file), false);
$submited = true;
switch ($type) {
case 'childheader':
$parent = $em->getRepository("App\Entity\Child")->find($idparent);
if (!$parent) {
throw $this->createNotFoundException('Not exist');
}
$last = $em->getRepository("App\Entity\Childheader")->findOneBy(['child' => $parent], ['roworder' => 'DESC']);
$lastorder = ($last ? $last->getRoworder() + 1 : 1);
$data = new Childheader();
$data->setChild($parent);
$data->setFilename($type.'/'.dirname($file).'/thumb_'.basename($file));
$data->setRoworder($lastorder);
$em->getManager()->persist($data);
$em->getManager()->flush();
break;
}
$submited = true;
}
return $this->render('Crop/crop02.html.twig', [
'useheader' => false,
'usesidebar' => false,
'form' => $form->createView(),
'type' => $type,
'file' => $file,
'ratio' => $ratio,
'idparent' => $idparent,
'submited' => $submited,
]);
}
// Calcul de la hauteur
protected function getHeight($image)
{

View File

@ -1,721 +0,0 @@
<?php
namespace App\Controller;
use App\Service\MinioService;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
class FileController extends AbstractController
{
private $minio;
public function __construct(MinioService $minio)
{
$this->minio = $minio;
}
public function list($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
// Récupération des paramètres
$folder = $request->query->get('folder');
$usage = $request->query->get('usage');
$view = $request->get('view');
$sort = $request->get('sort');
$order = $request->get('order');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
// Récupérer les files icons
$tbicons = json_decode(file_get_contents($this->getParameter('kernel.project_dir').'/public/medias/file/files.json'), true);
// Récupérer les préférences utilisateur
if (!$this->getUser()) {
$preference['widgetfolder'][$id] = ['folder' => null, 'sort' => null, 'order' => null, 'view' => null];
} else {
$preference = $this->getUser()->getPreference();
if (is_null($preference)) {
$preference = [];
}
// Initalisation des préférences si aucune
if (!array_key_exists('widgetfolder', $preference) || !array_key_exists($id, $preference['widgetfolder'])) {
$preference['widgetfolder'][$id] = ['folder' => null, 'sort' => null, 'order' => null, 'view' => null];
}
}
// Si aucun folder on récupére la preference
if (!$folder && $preference['widgetfolder'][$id]['folder']) {
$folder = $preference['widgetfolder'][$id]['folder'];
}
// On s'assure que le folder existe toujours
if ($folder && 0 == $this->minio->countKeys($folder)) {
$folder = null;
}
// On s'assure qu'il est bien dans le folder de base
if (false === stripos($folder, 'file/pagewidget/'.$id.'/')) {
$folder = null;
}
// Si pas de folder on est sur la racine
if (!$folder) {
$folder = 'file/pagewidget/'.$id.'/';
}
// Trie
if (!$order) {
$order = $preference['widgetfolder'][$id]['order'];
}
if (!$order) {
$order = 'SORT_ASC';
}
if (!$sort) {
$sort = $preference['widgetfolder'][$id]['sort'];
}
if (!$sort) {
$sort = 'name';
}
// View
if (!$view) {
$view = $preference['widgetfolder'][$id]['view'];
}
// Récuperer les files et folders du folder en cours
$files = $this->minio->listFiles($folder, '/');
$folders = $this->minio->listFolders($folder, '/');
// Ajouter basename et thumb des entrées récupérées
if ($files) {
foreach ($files as $key => $value) {
if ('.dir' == pathinfo($value['Key'], PATHINFO_BASENAME)) {
unset($files[$key]);
continue;
}
$files[$key]['basename'] = pathinfo($value['Key'], PATHINFO_BASENAME);
$files[$key]['dirname'] = pathinfo($value['Key'], PATHINFO_DIRNAME);
$files[$key]['extention'] = pathinfo($value['Key'], PATHINFO_EXTENSION);
// thumb ?
if (1 == $this->minio->countKeys($files[$key]['dirname'].'/.thumb/'.$files[$key]['basename'])) {
$files[$key]['thumb'] = $this->generateUrl('app_minio_image', ['file' => $files[$key]['dirname'].'/.thumb/'.$files[$key]['basename']]);
}
// file icon ?
elseif (array_key_exists($files[$key]['extention'], $tbicons)) {
$files[$key]['thumb'] = $tbicons[$files[$key]['extention']];
}
// blank file icon
else {
$files[$key]['thumb'] = $tbicons['blank'];
}
}
$filesdate = array_column($files, 'LastModified');
$filesname = array_column($files, 'basename');
switch ($sort) {
case 'name':
array_multisort($filesname, 'SORT_ASC' == $order ? SORT_ASC : SORT_DESC, $files);
break;
case 'date':
array_multisort($filesdate, 'SORT_ASC' == $order ? SORT_ASC : SORT_DESC, $files);
break;
}
}
if ($folders) {
foreach ($folders as $key => $value) {
if ('.thumb' == pathinfo($value['Prefix'], PATHINFO_BASENAME) || '.trash' == pathinfo($value['Prefix'], PATHINFO_BASENAME)) {
unset($folders[$key]);
continue;
}
$folders[$key]['basename'] = pathinfo($value['Prefix'], PATHINFO_BASENAME);
$folders[$key]['thumb'] = $tbicons['dir'];
}
$foldersname = array_column($folders, 'basename');
array_multisort($foldersname, 'SORT_ASC' == $order ? SORT_ASC : SORT_DESC, $folders);
}
// Mise à jour des préférences
$preference['widgetfolder'][$id] = ['folder' => $folder, 'sort' => $sort, 'order' => $order, 'view' => $view];
if ($this->getUser()) {
$this->getUser()->setPreference($preference);
$em->getManager()->flush();
}
// Construction de la navigation des folers
$basefolder = 'file/pagewidget/'.$id;
$parents = [['basename' => 'Home', 'folder' => $basefolder.'/']];
$tmp = explode('/', $folder);
unset($tmp[0]);
unset($tmp[1]);
unset($tmp[2]);
array_pop($tmp);
foreach ($tmp as $value) {
$basefolder = $basefolder.'/'.$value;
array_push($parents, ['basename' => $value, 'folder' => $basefolder.'/']);
}
// Flag poubelle
$fgtrash = false;
if (stripos($folder, '.trash') >= 1) {
$fgtrash = true;
}
return $this->render('File\list.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access,
'category' => $category,
'id' => $id,
'folder' => $folder,
'usage' => $usage,
'view' => $view,
'sort' => $sort,
'order' => $order,
'canadd' => $canadd,
'fgtrash' => $fgtrash,
'parents' => $parents,
'folders' => $folders,
'files' => $files,
]);
}
public function upload($access, $category, $id, $type, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$folder = urldecode($request->get('folder'));
if (!$folder) {
$folder = 'file/'.$category.'/'.$id.'/';
}
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($folder, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
return $this->render('File\upload.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'maxsize' => ('all' == $access ? 1200 : null),
'access' => $access,
'category' => $category,
'id' => $id,
'type' => $type,
'folder' => $folder,
'forcereload' => ('pagewidget' == $category),
]);
}
public function folder($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$infolder = $usage = $request->query->get('folder');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($infolder, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
$folder = $request->get('folder');
$form = $this->createFormBuilder()
->add('folder', TextType::class, ['label' => 'Répertoire'])
->add('submit', SubmitType::class, ['label' => 'Valider', 'attr' => ['class' => 'btn btn-success']])
->getForm();
$form->handleRequest($request);
$toclose = false;
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
if ('.thumb' == $data['folder'] || '.dir' == $data['folder'] || '.trash' == $data['folder']) {
$form->addError(new FormError('Nom de répertoire réservé, merci de choisir un autre nom de répertoire'));
$request->getSession()->getFlashBag()->clear();
$request->getSession()->getFlashBag()->add('error', 'Nom de répertoire réservé, merci de choisir un autre nom de répertoire');
} else {
$filesystem = new Filesystem();
$filesystem->dumpFile($this->getParameter('kernel.project_dir').'/var/tmp/.dir', '');
$this->minio->upload($this->getParameter('kernel.project_dir').'/var/tmp/.dir', $infolder.$data['folder'].'/.dir');
$toclose = true;
}
}
return $this->render('File\folder.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access,
'id' => $id,
'folder' => $folder,
'form' => $form->createView(),
'toclose' => $toclose,
]);
}
public function rename($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$oldfile = $usage = $request->query->get('file');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($oldfile, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
$form = $this->createFormBuilder()
->add('folder', TextType::class, ['label' => 'Renommer'])
->add('submit', SubmitType::class, ['label' => 'Valider', 'attr' => ['class' => 'btn btn-success']])
->getForm();
$form->handleRequest($request);
$toclose = false;
if ($form->isSubmitted() && $form->isValid()) {
$data = $form->getData();
if ('.thumb' == $data['folder'] || '.dir' == $data['folder'] || '.trash' == $data['folder']) {
$form->addError(new FormError('Nom réservé, merci de choisir un autre nom'));
$this->get('session')->getFlashBag()->clear();
$request->getSession()->getFlashBag()->add('error', 'Nom réservé, merci de choisir un autre nom');
} else {
$newfile = pathinfo($oldfile, PATHINFO_DIRNAME).'/'.$data['folder'];
if ('/' == substr($oldfile, -1)) {
$newfile = $newfile.'/';
}
$files = $this->minio->listFiles($oldfile);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
// Déplacer le fichier dans .trash
try {
$this->minio->move($file, str_replace($oldfile, $newfile, $file), true);
} catch (\Exception $e) {
}
// Déplacer le thumb dans .trash
try {
$oldthumb = pathinfo($oldfile, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($oldfile, PATHINFO_BASENAME);
$newthumb = pathinfo($newfile, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($newfile, PATHINFO_BASENAME);
$this->minio->move($oldthumb, $newthumb, true);
} catch (\Exception $e) {
}
}
$toclose = true;
}
} else {
$form->get('folder')->setData(basename($oldfile));
}
return $this->render('File\folder.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access,
'id' => $id,
'folder' => $oldfile,
'form' => $form->createView(),
'toclose' => $toclose,
]);
}
public function trash($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$file = $usage = $request->query->get('file');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($file, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
$files = $this->minio->listFiles($file);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
// Déplacer le fichier dans .trash
try {
$this->minio->move($file, str_replace($basefolder, $basefolder.'.trash/', $file), true);
} catch (\Exception $e) {
}
// Déplacer le thumb dans .trash
try {
$thumb = pathinfo($file, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($file, PATHINFO_BASENAME);
$this->minio->move($thumb, str_replace($basefolder, $basefolder.'.trash/', $thumb), true);
} catch (\Exception $e) {
}
}
return new JsonResponse();
}
public function restaure($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$file = $usage = $request->query->get('file');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($file, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
$files = $this->minio->listFiles($file);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
// Déplacer le fichier de .trash vers sa cible d'origine
try {
$this->minio->move($file, str_replace('/.trash/', '/', $file), true);
} catch (\Exception $e) {
}
// Déplacer le thumb dans .trash
try {
$thumb = pathinfo($file, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($file, PATHINFO_BASENAME);
$this->minio->move($thumb, str_replace('/.trash/', '/', $thumb), true);
} catch (\Exception $e) {
}
}
return new JsonResponse();
}
public function purgetrash($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/.trash';
$files = $this->minio->listFiles($basefolder);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
try {
$this->minio->delete($file);
} catch (\Exception $e) {
}
}
return $this->redirectToRoute('app_'.$access.'_file_list', ['category' => $category, 'id' => $id]);
}
public function delete($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$file = $usage = $request->query->get('file');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($file, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
// Si en mode naviation rechercher le prochain fichier à afficher
if (!$request->isXmlHttpRequest()) {
$files = $this->minio->listFiles(dirname($file).'/', '/');
dump($files);
if ($files) {
$basename = basename($file);
$date = array_column($files, 'LastModified');
array_multisort($date, SORT_DESC, $files);
foreach ($files as $key => $tbfile) {
if ($basename == basename($tbfile['Key'])) {
$next = (array_key_exists($key + 1, $files) ? $files[$key + 1] : $files[0]);
if ($next['Key'] == $file) {
unset($next);
}
}
}
}
}
$files = $this->minio->listFiles($file);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
// Supprimer le fichier
try {
$this->minio->delete($file);
} catch (\Exception $e) {
}
// Supprimer le thumb
try {
$thumb = pathinfo($file, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($file, PATHINFO_BASENAME);
$this->minio->delete($thumb);
} catch (\Exception $e) {
}
}
// Appel ajax
if ($request->isXmlHttpRequest()) {
return new JsonResponse();
} else {
if (isset($next)) {
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_file_view'), ['category' => $category, 'id' => $id, 'usage' => $usage, 'file' => $next['Key']]);
} else {
return $this->render('File\redirect.html.twig');
}
}
}
public function move($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$source = $usage = $request->query->get('source');
$destination = $usage = $request->query->get('destination');
// Permission
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
$basefolder = 'file/'.$category.'/'.$id.'/';
if (false === stripos($source, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
if (false === stripos($destination, $basefolder)) {
throw $this->createAccessDeniedException('Permission denied');
}
$isdirdest = false;
if ('/' == substr($source, -1)) {
$isdirdest = true;
$destination = $destination.basename($source).'/';
// On ne peut déplacer un répertoire vers un répertoire enfant
if (0 === stripos($destination, $source)) {
return new JsonResponse();
}
}
$files = $this->minio->listFiles($source);
foreach ($files as $tbfile) {
$file = $tbfile['Key'];
if ($isdirdest) {
$dest = str_replace($source, $destination, $file);
} else {
$dest = str_replace(pathinfo($source, PATHINFO_DIRNAME).'/', $destination, $file);
}
// Déplacer le fichier
try {
$this->minio->move($file, $dest, true);
} catch (\Exception $e) {
}
// Thumb
if (!$isdirdest) {
$oldthumb = pathinfo($source, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($source, PATHINFO_BASENAME);
$newthumb = pathinfo($dest, PATHINFO_DIRNAME).'/.thumb/'.pathinfo($dest, PATHINFO_BASENAME);
// Déplacer le thumb
try {
$this->minio->move($oldthumb, $newthumb, true);
} catch (\Exception $e) {
}
}
}
exit;
return new JsonResponse();
}
public function view($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$file = $request->query->get('file');
$basename = basename($file);
$path = dirname($file);
$usage = $request->query->get('usage');
$navigation = boolval($request->query->get('navigation'));
$canadd = $this->getPermission($em, $access, $category, $id, $usage);
// Si en mode navigation on recherche le fichier précédent ou suivant
$next = [];
$prev = [];
if ($navigation) {
$files = $this->minio->listFiles($path.'/', '/');
if ($files) {
$date = array_column($files, 'LastModified');
array_multisort($date, SORT_DESC, $files);
foreach ($files as $key => $value) {
if ($basename == basename($value['Key'])) {
$next = (array_key_exists($key + 1, $files) ? $files[$key + 1] : $files[0]);
$prev = (array_key_exists($key - 1, $files) ? $files[$key - 1] : end($files));
}
}
}
}
$tmpfile = $this->minio->download($file, basename($file));
if (str_starts_with(mime_content_type($tmpfile), 'image/') || 'application/pdf' == mime_content_type($tmpfile) || 'text/plain' == mime_content_type($tmpfile)) {
return $this->render('File\view.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access,
'category' => $category,
'id' => $id,
'usage' => $usage,
'navigation' => $navigation,
'file' => $file,
'basename' => basename($file),
'canadd' => $canadd,
'prev' => $prev,
'next' => $next,
'isimage' => str_starts_with(mime_content_type($tmpfile), 'image/'),
]);
} else {
$response = new BinaryFileResponse($tmpfile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($file));
return $response;
}
}
public function show($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$file = $request->query->get('file');
$usage = $request->query->get('usage');
$this->getPermission($em, $access, $category, $id, $usage);
$tmpfile = $this->minio->download($file, basename($file));
if (str_starts_with(mime_content_type($tmpfile), 'image/') || 'application/pdf' == mime_content_type($tmpfile) || 'text/plain' == mime_content_type($tmpfile)) {
$response = new BinaryFileResponse($tmpfile);
$response->headers->set('Content-Type', mime_content_type($tmpfile));
} else {
$response = new BinaryFileResponse($tmpfile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($file));
}
return $response;
}
public function download($access, $category, $id, Request $request, ManagerRegistry $em): Response
{
$file = $request->query->get('file');
$usage = $request->query->get('usage');
$this->getPermission($em, $access, $category, $id, $usage);
$tmpfile = $this->minio->download($file, basename($file));
$response = new BinaryFileResponse($tmpfile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($file));
return $response;
}
public function getPermission($em, $access, $category, $id, $usage = '')
{
if ('all' == $access) {
switch ($category) {
case 'pagewidget':
// Récupération du widget
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($id);
// Vérifier que l'on peut voir
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCansee($this->getUser(), $pagewidget)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Retourner la permission d'ajout
return $em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage);
break;
case 'projecttask':
// Récupération de la tache
$projecttask = $em->getRepository('CadolesPortalBundle:Projecttask')->find($id);
if (!$projecttask) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de voir
$project = $projecttask->getProject();
$user = $this->getUser();
$em->getRepository('CadolesPortalBundle:Project')->getPermission($user, $project, $cansee, $canupdate, $canadd);
if (!$cansee) {
throw $this->createAccessDeniedException('Permission denied');
}
return $canupdate;
break;
case 'calendarevent':
// Récupération de l'event'
$calendarevent = $em->getRepository('CadolesPortalBundle:Calendarevent')->find($id);
if (!$calendarevent) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de voir
$calendar = $calendarevent->getCalendar();
$user = $this->getUser();
$em->getRepository('CadolesPortalBundle:Calendar')->getPermission($user, $calendar, $cansee, $canupdate, $canadd);
if (!$cansee) {
throw $this->createAccessDeniedException('Permission denied');
}
return $canadd;
break;
}
} else {
return true;
}
}
}

View File

@ -15,37 +15,13 @@ class HomeController extends AbstractController
return $this->redirectToRoute('app_login');
}
// Récupération de la page encours
$id = $request->query->get('id');
// Calcul des pages de l'utilisateur
$em->getRepository("App\Entity\Page")->getPagesUser($this->getUser(), $id, $pagecurrent, $pagesportal, $pagesuser, $groups);
// si aucune page = page par défaut
if ($pagecurrent) {
return $this->render('Page/pages.html.twig', [
'useheader' => true,
'usemenu' => true,
'usesidebar' => false,
'entity' => $pagecurrent,
'access' => 'all',
'pagesportal' => $pagesportal,
'pagesuser' => $pagesuser,
'groups' => $groups,
'canadd' => true,
'widgetsuser' => $em->getRepository("App\Entity\Widget")->getWidgetAccess('all'),
'widgetsgroup' => $em->getRepository("App\Entity\Widget")->getWidgetAccess('group'),
]);
}
if (!$this->getUser()) {
return $this->render('Home/home.html.twig', [
'useheader' => true,
'usemenu' => false,
'useheader' => false,
'usemenu' => true,
'usesidebar' => false,
'maxsize' => 1000,
]);
}
if ($this->getUser()->hasRole('ROLE_USER')) {
return $this->redirectToRoute('app_user_home');
}

View File

@ -1,180 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Icon;
use App\Form\IconType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class IconController extends AbstractController
{
private $data = 'icon';
private $entity = "App\Entity\Icon";
private $twig = 'Icon/';
private $route = 'app_admin_icon';
public function list($access, Request $request, ManagerRegistry $em): Response
{
$inframe = $request->get('inframe');
if ('admin' == $access) {
$icons = $em->getRepository($this->entity)->findBy(['user' => null], ['label' => 'ASC']);
} else {
$icons = $em->getRepository($this->entity)->findBy(['user' => $this->getUser()], ['label' => 'ASC']);
}
return $this->render($this->twig.'list.html.twig', [
'useheader' => !$inframe,
'usemenu' => false,
'usesidebar' => ('admin' == $access && !$inframe),
'access' => $access,
$this->data.'s' => $icons,
'inframe' => $inframe,
]);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
$inframe = $request->get('inframe');
// Initialisation de l'enregistrement
$data = new Icon();
// Création du formulaire
$form = $this->createForm(IconType::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
if ($data->getLabel()) {
if ('all' == $access) {
$data->setUser($this->getUser());
}
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route), ['inframe' => $inframe]);
}
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => !$inframe,
'usemenu' => false,
'usesidebar' => ('admin' == $access && !$inframe),
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
'inframe' => $inframe,
'issystem' => false,
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
$inframe = $request->get('inframe');
// Récupération de l'enregistrement courant
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(IconType::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route), ['inframe' => $inframe]);
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => !$inframe,
'usemenu' => false,
'usesidebar' => ('admin' == $access && !$inframe),
'access' => $access,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
'refresh' => false,
'inframe' => $inframe,
'issystem' => (0 === stripos($data->getLabel(), 'icon/icon_')),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
$inframe = $request->get('inframe');
// Récupération de l'enregistrement courant
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que cet enregistrement est supprimable
if (0 === stripos($data->getLabel(), 'icon/icon_')) {
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id, 'inframe' => $inframe]);
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id, 'inframe' => $inframe]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route), ['inframe' => $inframe]);
}
public function select($access, Request $request, ManagerRegistry $em): Response
{
// Affichage du formulaire
$icons = $em->getRepository($this->entity)->findBy(['user' => null], ['label' => 'ASC']);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $em->getRepository($this->entity)->findBy(['user' => $this->getUser()], ['label' => 'ASC']);
}
return $this->render($this->twig.'select.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'access' => $access,
$this->data.'s' => $icons,
'iconsuser' => $iconsuser,
]);
}
public function upload($access): Response
{
return $this->render($this->twig.'upload.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
]);
}
}

View File

@ -1,160 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Item;
use App\Form\ItemType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ItemController extends AbstractController
{
private $data = 'item';
private $entity = "App\Entity\Item";
private $twig = 'Item/';
private $route = 'app_admin_item';
public function list($access, Request $request, ManagerRegistry $em): Response
{
$itemcategorys = $em->getRepository('App\Entity\Itemcategory')->findBy([], ['rowOrder' => 'asc']);
$groups = $em->getRepository('App\Entity\Group')->findBy([], ['label' => 'asc']);
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
'itemcategorys' => $itemcategorys,
'groups' => $groups,
]);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Item();
// Création du formulaire
$form = $this->createForm(ItemType::class, $data, ['mode' => 'submit', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'icons' => $em->getRepository('App\Entity\Icon')->findAll(),
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(ItemType::class, $data, ['mode' => 'update', 'access' => $access, 'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null)]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'update',
'icons' => $em->getRepository('App\Entity\Icon')->findAll(),
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
public function order($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$id = $request->request->get('id');
$categoryid = $request->request->get('categoryid');
$order = $request->request->get('order');
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
$data->setRoworder($order);
$itemcategory = $em->getRepository("App\Entity\Itemcategory")->find($categoryid);
if ($itemcategory) {
$data->setItemcategory($itemcategory);
}
$em->getManager()->flush();
return new JsonResponse($output);
}
}

View File

@ -1,129 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Itemcategory;
use App\Form\ItemcategoryType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ItemcategoryController extends AbstractController
{
private $data = 'itemcategory';
private $entity = "App\Entity\Itemcategory";
private $twig = 'Itemcategory/';
private $route = 'app_admin_itemcategory';
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Itemcategory();
// Création du formulaire
$form = $this->createForm(ItemcategoryType::class, $data, ['mode' => 'submit', 'access' => $access]);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item'));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->createForm(ItemcategoryType::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Sauvegarde
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item'));
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item'));
}
public function order($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$id = $request->request->get('id');
$order = $request->request->get('order');
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
$data->setRoworder($order);
$em->getManager()->flush();
return new JsonResponse($output);
}
}

View File

@ -0,0 +1,192 @@
<?php
namespace App\Controller;
use App\Entity\Menuchild;
use App\Form\MenuchildType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class MenuController extends AbstractController
{
private $data = 'menu';
private $route = 'app_menu';
private $render = 'Menu/';
private $entity = "App\Entity\Menu";
public function home(ManagerRegistry $em)
{
return $this->render($this->render.'home.html.twig', [
'useheader' => true,
'usesidebar' => false,
'usemonocolor' => true,
]);
}
public function list(ManagerRegistry $em)
{
// Récupérer les menus
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$menu = $em->getRepository($this->entity)->find($id);
// Initialisation de l'enregistrement
$data = new Menuchild();
$data->setMenu($menu);
$data->setRoworder(0);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$error=false;
switch($data->getChildtype()) {
case "blog":
$error=(!$data->getBlog());
break;
case "blogtype":
$error=(!$data->getBlogtype());
break;
case "page":
$error=(!$data->getPage());
break;
case "pagetype":
$error=(!$data->getPagetype());
break;
}
if(!$error) {
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository("App\Entity\Menuchild")->find($id);
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route);
}
return $this->redirectToRoute($this->route);
}
public function upload()
{
return $this->render($this->render.'upload.html.twig');
}
public function view($id, Request $request, ManagerRegistry $em)
{
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Not exist');
}
return $this->render($this->render.'view.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
]);
}
public function order($id,$order,Request $request, ManagerRegistry $em)
{
$data = $em->getRepository("App\Entity\Menuchild")->find($id);
$data->setRoworder($order);
$em->getManager()->flush();
return new JsonResponse();
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -8,6 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use Symfony\Component\HttpKernel\KernelInterface;
class MinioController extends AbstractController
@ -64,11 +65,34 @@ class MinioController extends AbstractController
return $this->returnminio($file, $em);
}
public function document(Request $request, ManagerRegistry $em)
public function show(Request $request, ManagerRegistry $em): Response
{
$file = $request->query->get('file');
$tmpfile = $this->minio->download($file, basename($file));
if (str_starts_with(mime_content_type($tmpfile), 'image/') || 'application/pdf' == mime_content_type($tmpfile) || 'text/plain' == mime_content_type($tmpfile)) {
$response = new BinaryFileResponse($tmpfile);
$response->headers->set('Content-Type', mime_content_type($tmpfile));
} else {
$response = new BinaryFileResponse($tmpfile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($file));
}
return $this->returnminio($file, $em);
return $response;
}
public function download(Request $request, ManagerRegistry $em): Response
{
$file = $request->query->get('file');
// C'est une url = on affiche l'url
if (0 === stripos($file, 'http')) {
$tmpfile = $file;
} else {
$tmpfile = $this->minio->download($file, basename($file));
}
$response = new BinaryFileResponse($tmpfile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, basename($file));
return $response;
}
private function returnminio($file, $em)
@ -78,6 +102,7 @@ class MinioController extends AbstractController
case 'avatar/noavatar.png':
case 'avatar/system.jpg':
case 'header/header.jpg':
case 'header/body.jpg':
case 'logo/logo.png':
$file = 'medias/'.$file;
$filePath = $file;

View File

@ -2,547 +2,174 @@
namespace App\Controller;
use App\Entity\Page;
use App\Form\PageSubmitType;
use App\Form\PageUpdateEditorType;
use App\Form\PageUpdateToolType;
use App\Form\PageUpdateURLType;
use App\Form\PageUpdateWidgetType;
use App\Entity\Page as Entity;
use App\Form\PageType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PageController extends AbstractController
{
private $data = 'page';
private $entity = "App\Entity\Page";
private $twig = 'Page/';
private $route = 'app_admin_page_usage';
private $route = 'app_page';
private $render = 'Page/';
private $entity = 'App\Entity\Page';
public function list($access, $usage)
public function list(ManagerRegistry $em)
{
return $this->render($this->twig.'list.html.twig', [
// Récupérer les pages
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
'usage' => $usage,
'istemplate' => false,
]);
}
public function tablelist($access, $usage, Request $request, ManagerRegistry $em): Response
public function submit(Request $request, ManagerRegistry $em)
{
$query = $request->query->all();
$start = $query['start'];
$length = $query['length'];
$search = $query['search'];
$draw = $query['draw'];
$ordercolumn = $query['order'][0]['column'];
$orderdir = $query['order'][0]['dir'];
$alluser = $query['alluser'];
// Initialisation de l'enregistrement
$data = new Entity();
// On sauvegarde en session le flag alluser
$request->getSession()->set('alluserpage', $alluser);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Query de base
$qbase = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
$qsearch = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
if ('false' == $alluser) {
$qbase->where('table.user is null');
$qbase->andWhere('table.parentfor is null');
$qsearch->where('table.user is null');
$qsearch->andWhere('table.parentfor is null');
} else {
$qbase->from('App:User', 'user')
->where('table.user=user');
$qsearch->from('App:User', 'user')
->where('table.user=user');
}
if ('false' == $alluser) {
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value');
} else {
$qsearch->andWhere('table.id LIKE :value OR table.name LIKE :value OR user.username LIKE :value');
}
$qsearch->setParameter('value', '%'.$search['value'].'%');
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if ('' == $search['value']) {
$totalf = $total;
} else {
$totalf = $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
}
// Parcours des Enregistrement
if ('' == $search['value']) {
$qb = $qbase->select('table');
} else {
$qb = $qsearch->select('table');
}
// Order
if ($ordercolumn) {
switch ($ordercolumn) {
case 1:
$qb->orderBy('table.roworder', $orderdir);
break;
case 2:
$qb->orderBy('table.name', $orderdir);
break;
case 4:
if ('true' == $alluser) {
$qb->orderBy('user.username', $orderdir);
}
break;
}
}
// Execution de la requete d'affichage
$datas = $qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = [
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => [],
];
foreach ($datas as $data) {
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$route = str_replace('_usage', '_'.$usage, $route);
$action = '';
// $action.="<a href='".$this->generateUrl($route.'_update', array('id'=>$data->getId()))."'><i class='fa fa-file fa-fw'></i></a>";
$action .= "<a href='".$this->generateUrl($route.'_update', ['id' => $data->getId()])."'><i class='fa fa-cog fa-fw fa-2x'></i></a>";
$action .= "<a href='".$this->generateUrl($route.'_view', ['id' => $data->getId()])."'><i class='fa fa-eye fa-fw fa-2x'></i></a>";
$action .= "<a href='".$this->generateUrl($route.'_delete', ['id' => $data->getId()])."' data-method='delete'><i class='fa fa-trash fa-fw fa-2x'></i></a>";
$user = '';
if ($data->getUser()) {
$user .= "<img src='".$this->generateUrl('app_minio_image', ['file' => 'avatar/'.$data->getUser()->getAvatar()])."' class='avatar' style='margin:0px 5px 0px 0px;display:inline-block;'>";
$user .= $data->getUser()->getUsername();
}
$icon = '';
if ($data->getFonticon()) {
$icon .= "<i class='".$data->getFonticon()." fa-fw'></i>&nbsp;";
}
array_push($output['data'], [
$action,
$data->getRoworder(),
$icon.$data->getName(),
$data->getPagecategory()->getName(),
$user,
]);
}
// Retour
return new Response(json_encode($output), 200);
}
private function entityForm(Page $entity, $access, $em)
{
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
if ($em->getManager()->contains($entity)) {
// Type Tools
if ($entity->getPagecategory()->getId() < 0) {
return $this->createForm(PageUpdateToolType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
// Type URL
if (1 == $entity->getPagecategory()->getId()) {
return $this->createForm(PageUpdateURLType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
// Type Widget
elseif (2 == $entity->getPagecategory()->getId()) {
return $this->createForm(PageUpdateWidgetType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
// Type Editeur
elseif (3 == $entity->getPagecategory()->getId()) {
return $this->createForm(PageUpdateEditorType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
} else {
return $this->createForm(PageSubmitType::class, $entity, [
'mode' => 'update',
'access' => $access,
'user' => $this->getUser(),
]);
}
}
public function submit($access, $usage, Request $request, ManagerRegistry $em): Response
{
$entity = new Page();
$entity->setMaxwidth(0);
$entity->setRoworder(0);
$form = $this->entityForm($entity, $access, $em);
// Récupération des data du formulaire
$form->handleRequest($request);
// Une page d'usage groupe doit avoir au moins un group de selectionné
$datausage = $form->get('usage')->getData();
if ('group' == $datausage && $entity->getGroups()->isEmpty()) {
$form->addError(new FormError('Vous devez selectionner au minimum un groupe'));
}
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
if ('all' == $access) {
$entity->setUser($this->getUser());
}
$data = $form->getData();
// Si template on duplique le template
if ($entity->getPage()) {
$page = $em->getRepository("App\Entity\Page")->clonePage($this->getUser(), $entity->getPage());
$page->setName($entity->getName());
$page->setRoworder($entity->getRoworder());
$page->setMaxwidth($entity->getMaxwidth());
foreach ($entity->getGroups() as $group) {
$page->addGroup($group);
}
$em->getManager()->persist($page);
$em->getManager()->persist($data);
$em->getManager()->flush();
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$route = str_replace('_usage', '_'.$usage, $route);
return $this->redirect($this->generateUrl($route.'_update', ['id' => $page->getId()]));
} else {
$em->getManager()->persist($entity);
$em->getManager()->flush();
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$route = str_replace('_usage', '_'.$usage, $route);
return $this->redirect($this->generateUrl($route.'_update', ['id' => $entity->getId()]));
}
// Retour à la liste
return $this->redirectToRoute('app_child', ['catparent' => 'page', 'idparent' => $data->getId()]);
}
return $this->render($this->twig.'submit.html.twig', [
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'maxwidth' => ('user' == $access),
$this->data => $entity,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'usage' => $usage,
'access' => $access,
'form' => $form->createView(),
'from' => 'page',
]);
}
public function update($id, $access, $usage, Request $request, ManagerRegistry $em): Response
public function update($id, Request $request, ManagerRegistry $em)
{
$entity = $em->getRepository($this->entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de modifier
if ('all' == $access) {
$em->getRepository($this->entity)->getPermission($this->getUser(), $entity, $cansee, $canupdate, $canadd);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
$from = $request->get('from');
// Création du formulaire
$form = $this->entityForm($entity, $access, $em);
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
if ('admin' == $access) {
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$route = str_replace('_usage', '_'.$usage, $route);
return $this->redirect($this->generateUrl($route.'_view', ['id' => $id]));
// Retour à la liste
if ('child' == $from) {
return $this->redirectToRoute('app_child', ['catparent' => 'page', 'idparent' => $data->getId()]);
} else {
return $this->redirect($this->generateUrl('app_home', ['id' => $id]));
return $this->redirectToRoute($this->route);
}
}
// Type URL
if (1 == $entity->getPagecategory()->getId()) {
return $this->render($this->twig.'updateurl.html.twig', [
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'maxwidth' => ('all' == $access),
$this->data => $entity,
'access' => $access,
'usage' => $usage,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
'from' => $from,
]);
}
// Type Widget
elseif (2 == $entity->getPagecategory()->getId()) {
return $this->render($this->twig.'updatewidget.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'maxwidth' => ('all' == $access),
$this->data => $entity,
'access' => $access,
'mode' => 'update',
'usage' => $usage,
'form' => $form->createView(),
]);
}
// Type Editeur
elseif (3 == $entity->getPagecategory()->getId()) {
return $this->render($this->twig.'updateeditor.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'maxwidth' => ('all' == $access),
$this->data => $entity,
'access' => $access,
'usage' => $usage,
'mode' => 'update',
'form' => $form->createView(),
]);
}
}
public function delete($id, $access, $usage, Request $request, ManagerRegistry $em): Response
public function delete($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de supprimer
if ('all' == $access) {
$em->getRepository($this->entity)->getPermission($this->getUser(), $data, $cansee, $canupdate, $canadd);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id]);
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
// Retour
if ('admin' == $access) {
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$route = str_replace('_usage', '_'.$usage, $route);
return $this->redirect($this->generateUrl($route));
} else {
return $this->redirect($this->generateUrl('app_home'));
}
return $this->redirectToRoute($this->route);
}
public function order($access, Request $request, ManagerRegistry $em): Response
public function home(ManagerRegistry $em)
{
$heros = $em->getRepository($this->entity)->findBy(['ishead' => true], ['submitdate' => 'DESC']);
$pages = $em->getRepository($this->entity)->findBy([], ['submitdate' => 'DESC']);
return $this->render($this->render.'home.html.twig', [
'useheader' => true,
'usesidebar' => false,
'heros' => $heros,
'pages' => $pages,
]);
}
public function select(Request $request, ManagerRegistry $em)
{
$output = [];
$id = $request->request->get('id');
$order = $request->request->get('order');
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$entity = $em->getRepository($this->entity)->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
// On s'assure que l'utilisateur à la permission
if ('all' == $access) {
$em->getRepository($this->entity)->getPermission($this->getUser(), $entity, $cansee, $canupdate, $canadd);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
$entity->setRoworder($order);
$em->getManager()->flush();
return new JsonResponse($output);
}
public function view($id, $access, $usage, Request $request, ManagerRegistry $em): Response
protected function getErrorForm($id, $form, $request, $data, $mode)
{
$entity = $em->getRepository($this->entity)->find($id);
if (!$entity) {
return $this->redirect($this->generateUrl('app_home'));
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
// Permissions
if ('admin' == $access) {
$canupdate = true;
} else {
// On s'assure que l'utilisateur à la permission de voir
$em->getRepository($this->entity)->getPermission($this->getUser(), $entity, $cansee, $canupdate, $canadd);
if (!$cansee) {
return $this->redirect($this->generateUrl('app_home'));
}
if ($form->get('submit')->isClicked() && ('submit' == $mode || 'update' == $mode)) {
}
// Type Calendrier
if (-100 == $entity->getPageCategory()->getId()) {
$entity->setUrl($this->generateUrl('app_user_calendar_view'));
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
return $this->render($this->twig.'viewurl.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'usage' => $usage,
]);
}
// Type Blob
if (-90 == $entity->getPageCategory()->getId()) {
$entity->setUrl($this->generateUrl('app_user_blog_view'));
return $this->render($this->twig.'viewurl.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'usage' => $usage,
]);
}
// Type URL
if (1 == $entity->getPageCategory()->getId()) {
return $this->render($this->twig.'viewurl.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'usage' => $usage,
]);
}
// Type Widgets
if (2 == $entity->getPageCategory()->getId()) {
return $this->render($this->twig.'viewwidget.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'widgets' => $em->getRepository("App\Entity\Widget")->getWidgetAccess($access, 'config'),
'usage' => "$usage",
]);
}
// Type Editeur
if (3 == $entity->getPageCategory()->getId()) {
return $this->render($this->twig.'vieweditor.html.twig', [
'useheader' => ('config' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('config' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'usage' => $usage,
]);
}
}
public function application($access, Request $request, ManagerRegistry $em): Response
{
$entity = $em->getRepository($this->entity)->findOneBy(['parentfor' => 'app']);
if (!$entity) {
return $this->redirect($this->generateUrl('app_home'));
}
$canupdate = false;
return $this->render($this->twig.'viewwidget.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
$this->data => $entity,
'access' => $access,
'canupdate' => $canupdate,
'mode' => 'view',
'widgets' => $em->getRepository('App\Entity\Widget')->getWidgetAccess($access, 'config'),
'usage' => 'portal',
'selwidget' => null,
]);
}
protected function getPreference($user, $key, $id, $default)
{
$preference = $user->getPreference();
$return = $default;
if (is_array($preference)) {
if (array_key_exists($key, $preference)) {
if (array_key_exists($id, $preference[$key])) {
$return = $preference[$key][$id];
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
return $return;
}
protected function setPreference($user, $key, $id, $value)
{
$preference = $user->getPreference();
$toupdate = false;
if (!array_key_exists($key, $preference)) {
$toupdate = true;
$preference[$key] = [];
}
if (!array_key_exists($id, $preference[$key])) {
$toupdate = true;
$preference[$key][$id] = $value;
}
if ($value && $preference[$key][$id] != $value) {
$toupdate = true;
$preference[$key][$id] = $value;
}
// Mise à jour des préferences
if ($toupdate) {
$em = $this->getDoctrine()->getManager();
$user->setPreference($preference);
$em->persist($this->getUser());
$em->flush();
}
}
}

View File

@ -1,286 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Page;
use App\Form\PagetemplateSubmitType;
use App\Form\PageUpdateWidgetType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PagetemplateController extends AbstractController
{
private $data = 'page';
private $entity = "App\Entity\Page";
private $twig = 'Pagetemplate/';
private $route = 'app_admin_page_template';
public function list($access): Response
{
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
]);
}
public function tablelist($access, Request $request, ManagerRegistry $em): Response
{
$query = $request->query->all();
$start = $query['start'];
$length = $query['length'];
$search = $query['search'];
$draw = $query['draw'];
$ordercolumn = $query['order'][0]['column'];
$orderdir = $query['order'][0]['dir'];
// Query de base
$qbase = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
$qsearch = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
$qbase->where('table.user is null');
$qbase->andWhere('table.parentfor is not null');
$qsearch->where('table.user is null');
$qsearch->andWhere('table.parentfor is not null');
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value OR table.parentfor LIKE :value');
$qsearch->setParameter('value', '%'.$search['value'].'%');
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if ('' == $search['value']) {
$totalf = $total;
} else {
$totalf = $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
}
// Parcours des Enregistrement
if ('' == $search['value']) {
$qb = $qbase->select('table');
} else {
$qb = $qsearch->select('table');
}
// Order
if ($ordercolumn) {
switch ($ordercolumn) {
case 1:
$qb->orderBy('table.roworder', $orderdir);
break;
case 2:
$qb->orderBy('table.name', $orderdir);
break;
case 3:
$qb->orderBy('table.parentfor', $orderdir);
break;
}
}
// Execution de la requete d'affichage
$datas = $qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = [
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => [],
];
foreach ($datas as $data) {
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$action = '';
$action .= "<a href='".$this->generateUrl($route.'_update', ['id' => $data->getId()])."'><i class='fa fa-cog fa-fw fa-2x'></i></a>";
$action .= "<a href='".$this->generateUrl($route.'_view', ['id' => $data->getId()])."'><i class='fa fa-eye fa-fw fa-2x'></i></a>";
array_push($output['data'], [
$action,
$data->getRoworder(),
$data->getName(),
$data->getParentfor(),
]);
}
// Retour
return new Response(json_encode($output), 200);
}
private function entityForm(Page $entity, $access, $em)
{
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
if ($em->getManager()->contains($entity)) {
return $this->createForm(PageUpdateWidgetType::class, $entity, [
'mode' => 'update',
'access' => $access,
'for' => $entity->getParentfor(),
]);
} else {
return $this->createForm(PagetemplateSubmitType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
$pagecategory = $em->getRepository("App\Entity\Pagecategory")->find(2);
$data = new Page();
$data->setMaxwidth(0);
$data->setRoworder(0);
$data->setParentfor('user');
$data->setPagecategory($pagecategory);
$form = $this->entityForm($data, $access, $em);
$form->handleRequest($request);
// Sur erreur
if ('app' == $data->getParentfor()) {
$tmp = $em->getRepository($this->entity)->findOneBy(['parentfor' => 'app']);
if ($tmp) {
$form->addError(new FormError("Il ne peut avoir qu'un seul template de type Application"));
}
}
$data = $form->getData();
if ($form->get('submit')->isClicked() && $form->isValid()) {
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
return $this->redirect($this->generateUrl($route.'_update', ['id' => $data->getId()]));
}
return $this->render('Pagetemplate\submit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'access' => $access,
'usage' => 'template',
'form' => $form->createView(),
]);
}
public function update($id, $access, Request $request, ManagerRegistry $em): Response
{
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Création du formulaire
$form = $this->entityForm($data, $access, $em);
$form->handleRequest($request);
if ($form->get('submit')->isClicked() && $form->isValid()) {
$em->getManager()->flush();
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
return $this->redirect($this->generateUrl($route.'_view', ['id' => $id]));
}
return $this->render('Page\updatewidget.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->data => $data,
'access' => $access,
'mode' => 'update',
'usage' => 'template',
'form' => $form->createView(),
]);
}
public function delete($id, $access, Request $request, ManagerRegistry $em): Response
{
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de supprimer
if ('all' == $access) {
$em->getRepository($this->entity)->getPermission($this->getUser(), $data, $cansee, $canupdate);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Tentative de suppression
try {
$group = $em->getRepository("App\Entity\Group")->findOneBy(['pagetemplate' => $data]);
if ($group) {
throw new \Exception('Impossible de supprimer ce modèle, il est utilisé par au moins un groupe');
}
if ('app' == $data->getParentfor()) {
throw new \Exception('Vous ne pouvez pas supprimer un template de type Application');
}
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id]);
}
// Retour
return $this->redirect($this->generateUrl($this->route));
}
public function selectlist($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->andWhere('table.parentfor is not null')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
public function view($id, $access, Request $request, ManagerRegistry $em): Response
{
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Permissions
$canupdate = true;
return $this->render('Page\viewwidget.html.twig', [
'useheader' => true,
'usemenu' => true,
'usesidebar' => true,
$this->data => $data,
'access' => $access,
'canupdate' => $canupdate,
'usage' => 'template',
'widgets' => $em->getRepository("App\Entity\Widget")->getWidgetAccess($access),
'group' => '',
]);
}
}

View File

@ -0,0 +1,174 @@
<?php
namespace App\Controller;
use App\Entity\Pagetype as Entity;
use App\Form\PagetypeType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class PagetypeController extends AbstractController
{
private $data = 'pagetype';
private $route = 'app_typepage';
private $render = 'Pagetype/';
private $entity = "App\Entity\Pagetype";
public function home($id,ManagerRegistry $em)
{
$data = $em->getRepository($this->entity)->find($id);
return $this->render($this->render.'home.html.twig', [
'useheader' => false,
'usemenu' => true,
'usesidebar' => false,
'usemonocolor' => true,
$this->data => $data,
]);
}
public function list(ManagerRegistry $em)
{
// Récupérer les pagetypes
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit(Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = new Entity();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->getManager()->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, Request $request, ManagerRegistry $em)
{
// Initialisation de l'enregistrement
$data = $em->getRepository($this->entity)->find($id);
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
}
return $this->redirectToRoute($this->route);
}
public function upload()
{
return $this->render($this->render.'upload.html.twig');
}
public function select(Request $request, ManagerRegistry $em)
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -1,958 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Pagewidget;
use App\Form\PagewidgetckeditorType;
use App\Form\PagewidgetType;
use App\Service\MinioService;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PagewidgetController extends AbstractController
{
private $data = 'pagewidget';
private $labelentity = "App\Entity\Pagewidget";
private $twig = 'Pagewidget/';
private $route = 'app_admin_pagewidget';
private $minio;
private $em;
private $user;
private $entity;
private $page;
private $id;
private $access;
private $usage;
private $group;
private $cansee;
private $canupdate;
private $canadd;
public function __construct(MinioService $minio)
{
$this->minio = $minio;
}
private function searchArray($array, $key, $value)
{
$results = [];
if (is_array($array)) {
if (isset($array[$key]) && $array[$key] == $value) {
$results[] = $array;
}
foreach ($array as $subarray) {
$results = array_merge($results, $this->searchArray($subarray, $key, $value));
}
}
return $results;
}
private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access)
{
if ($em->getManager()->contains($entity)) {
$widgettype = $em->getRepository('App\Entity\Pagewidget')->find($id)->getWidget();
$params = $widgettype->getParameter();
$values = $entity->getParameter();
foreach ($params['fields'] as $key => $param) {
$tmp = $this->searchArray($values, 'id', $param['id']);
if (is_array($tmp) && !empty($tmp)) {
$params['fields'][$key]['value'] = $tmp[0]['value'];
} else {
$params['fields'][$key]['value'] = $param['value'];
}
}
return $this->createForm(PagewidgetType::class, $entity, [
'param' => $params,
'mode' => 'update',
'access' => $access,
'idicon' => ($entity->getIcon() ? $entity->getIcon()->getId() : $widgettype->getIcon()->getId()),
'method' => 'POST',
]);
} else {
$widgettype = $em->getManager()->getRepository("App\Entity\Widget")->find($id);
$entity->setName($widgettype->getName());
$entity->setHeight($widgettype->getHeight());
$entity->setAutoajust($widgettype->isAutoajust());
$entity->setBorder($widgettype->isBorder());
$entity->setViewheader($widgettype->isViewheader());
$entity->setColorheaderback($widgettype->getColorheaderback());
$entity->setColorheaderfont($widgettype->getColorheaderfont());
$entity->setColorbodyback($widgettype->getColorbodyback());
$entity->setColorbodyfont($widgettype->getColorbodyfont());
$entity->setIcon($widgettype->getIcon());
$entity->setWidget($widgettype);
$param = $widgettype->getParameter();
return $this->createForm(PagewidgetType::class, $entity, [
'param' => $param,
'mode' => 'submit',
'access' => $access,
'idicon' => $widgettype->getIcon()->getId(),
'method' => 'POST',
]);
}
}
public function submit($access, $idpage, $idwidgettype, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$entity = new Pagewidget();
$form = $this->entityForm($em, $entity, $idpage, $idwidgettype, $access, $usage);
$form->handleRequest($request);
// On s'assure que la page où l'on souhaite insérer un widget est bien du bon type
$page = $em->getRepository("App\Entity\Page")->findoneby(['id' => $idpage]);
if (!$page) {
throw $this->createNotFoundException('Unable to find entity.');
}
if (2 != $page->getPagecategory()->getId()) {
throw $this->createAccessDeniedException('Permission denied');
}
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$widgettype = $em->getRepository('App\Entity\Widget')->findoneby(['id' => $idwidgettype]);
// Localisation par défaut en R1C1
$entity->setLoc('R1C1');
$entity->setRoworder('1');
// Rattachement icon / panel / widgettype
$entity->setIcon($icon);
$entity->setPage($page);
$entity->setWidget($widgettype);
// Récupération des paramétres
$jsons = $widgettype->getParameter();
$param = [];
$param['fields'] = [];
foreach ($jsons['fields'] as $field) {
$tmp = [];
$tmp['id'] = $field['id'];
$tmp['value'] = ('hidden' != $field['type'] ? $form->get($field['id'])->getData() : '');
array_push($param['fields'], $tmp);
}
$entity->setParameter($param);
$em = $em->getManager();
$em->persist($entity);
$em->flush();
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'submit',
'usage' => $usage,
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
]);
}
public function update($access, $idpage, $idwidget, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Recherche du pagewidget
$entity = $em->getRepository($this->labelentity)->find($idwidget);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de modifier
if ('all' == $access) {
$em->getRepository('App\Entity\Page')->getPermission($this->getUser(), $entity->getPage(), $cansee, $canupdate, $canadd);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Création du formulaire
$form = $this->entityForm($em, $entity, $idpage, $idwidget, $access);
$form->handleRequest($request);
// Validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$idicon = $form->get('idicon')->getData();
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$entity->setIcon($icon);
// Récupération des paramétres
$widgettype = $entity->getWidget();
$jsons = $widgettype->getParameter();
$param = [];
$param['fields'] = [];
foreach ($jsons['fields'] as $field) {
$tmp = [];
$tmp['id'] = $field['id'];
$tmp['value'] = ('hidden' != $field['type'] ? $form->get($field['id'])->getData() : '');
array_push($param['fields'], $tmp);
}
$entity->setParameter($param);
$em->getManager()->flush();
// Si widget RSS On supprime le potentiel cache de ce flux
if (-1880 == $entity->getWidget()->getId()) {
$dir = $this->container->getParameter('kernel.root_dir').'/../web/uploads/flux/';
$mask = $dir.'widget-'.$entity->getId().'.*';
array_map('unlink', glob($mask));
}
// Retour
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'update',
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group,
]);
}
public function delete($access, $idwidget, Request $request, ManagerRegistry $em): Response
{
// Récupération des parametres
$output = [];
// Recherche du pagetwidget
$entity = $em->getRepository($this->labelentity)->find($idwidget);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de supprimer
if ('all' == $access) {
$em->getRepository('App\Entity\Page')->getPermission($this->getUser(), $entity->getPage(), $cansee, $canupdate, $canadd);
if (!$canupdate) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Tentative de suppression
try {
$em->getManager()->remove($entity);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
throw $this->createAccessDeniedException('Permission denied');
}
return new JsonResponse($output);
}
public function order($access, Request $request, ManagerRegistry $em): Response
{
$idwidget = $request->request->get('idwidget');
$order = $request->request->get('order');
$idloc = $request->request->get('idloc');
$entity = $em->getRepository($this->labelentity)->find($idwidget);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
$entity->setRoworder($order);
$entity->setLoc($idloc);
$em->getManager()->flush();
return new JsonResponse([]);
}
public function ckeditor($access, $idwidget, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Recherche du pagewidget
$entity = $em->getRepository($this->labelentity)->find($idwidget);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que l'utilisateur à la permission de modifier
if ('all' == $access) {
$em->getRepository('App\Entity\Page')->getPermission($this->getUser(), $entity->getPage(), $cansee, $canupdate, $canadd);
if (!$canadd) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Création du formulaire
$form = $this->createForm(PagewidgetckeditorType::class, ['ckeditor' => $entity->getParameter()['fields'][0]['value']], ['idwidget' => $idwidget, 'usage' => $usage]);
// Récupération des data du formulaire
$form->handleRequest($request);
if ($form->get('submit')->isClicked() && $form->isValid()) {
$ckeditor = $form->get('ckeditor')->getData();
$param = $entity->getParameter();
$param['fields'][0]['value'] = $ckeditor;
$entity->setParameter($param);
$em->getManager()->flush();
// Retour
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $entity->getPage()->getId()]));
}
return $this->render($this->twig.'ckeditor.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'entity' => $entity,
'usage' => $usage,
'access' => $access,
'idpage' => $entity->getPage()->getId(),
'form' => $form->createView(),
]);
}
protected function setRequest($em, $request, $id, $access)
{
$this->em = $em;
$this->user = $this->getUser();
$this->id = $id;
$this->access = $access;
$this->usage = $request->query->get('usage');
$this->group = $request->query->get('group');
// Le widget existe-t-il ?
$this->entity = $this->em->getRepository($this->labelentity)->find($this->id);
if (!$this->entity) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Permissions
if ('admin' == $this->access) {
$this->canupdate = true;
$this->canadd = true;
} else {
// On s'assure que l'utilisateur à la permission de voir
$this->page = $this->entity->getPage();
$this->em->getRepository('App\Entity\Page')->getPermission($this->user, $this->page, $this->cansee, $this->canupdate, $this->canadd);
if (!$this->cansee) {
throw $this->createAccessDeniedException('Permission denied');
}
}
$this->getPreference($this->entity);
}
protected function getPreference(&$entity)
{
$user = $this->getUser();
if ($user) {
if ($entity->isViewheader()) {
$preference = $user->getPreference();
$id = $entity->getId();
// Preference widgetshowhide
if (is_array($preference)) {
if (array_key_exists('widgetshowhide', $preference)) {
if (array_key_exists($id, $preference['widgetshowhide'])) {
$entity->setOpened('true' == $preference['widgetshowhide'][$id]);
}
}
}
}
}
}
protected function getKeyPreference(&$entity, $key, $value)
{
$user = $this->getUser();
if (!$user) {
return $value;
}
$preference = $user->getPreference();
$id = $entity->getId();
if (!is_array($preference)) {
return $value;
}
if (!array_key_exists($key, $preference)) {
return $value;
}
if (!array_key_exists($id, $preference[$key])) {
return $value;
}
return $preference[$key][$id];
}
protected function getRender($view, $params)
{
// Paramétres toujours présent dans un rendu de widget
$allways = [
'entity' => $this->entity,
'canupdate' => $this->canupdate, // Permissions de modifier le widget
'canadd' => $this->canadd, // Permission d'ajouter des éléments au widget
'access' => $this->access,
'usage' => $this->usage,
];
// Parametres spéficiques
$params = array_merge($allways, $params);
// Rendu
return $this->render($this->twig.'\\'.$view, $params);
}
public function viewurl($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$url = '';
$imagemedia = false;
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
if ('url' == $parameter['id']) {
$url = $parameter['value'];
}
}
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
$imagemedia = true;
}
return $this->getRender('viewurl.html.twig', [
'url' => $url,
'imagemedia' => $imagemedia,
]);
}
public function viewurlfixe($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$url = '';
$imagemedia = false;
// Récupération des paramétres du widget
$widgettype = $this->entity->getWidget();
$jsons = $widgettype->getParameter();
$param = [];
$param['fields'] = [];
foreach ($jsons->fields as $field) {
if ('url' == $field->id) {
$url = $field->value;
}
}
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
$imagemedia = true;
}
return $this->getRender('viewurl.html.twig', [
'url' => $url,
'imagemedia' => $imagemedia,
]);
}
public function viewitem($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modedesktop = 0;
$menu = false;
$menuall = true;
$search = false;
$withbookmark = true;
$bookmarks = null;
$itemsordered = null;
$itemcategorys = null;
// Récupération des paramétres du widget
$iditemcategory = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
case 'withbookmark':
$withbookmark = $parameter['value'];
break;
case 'itemcategory':
$iditemcategory = $parameter['value'];
break;
case 'search':
$search = (1 == $parameter['value']);
break;
case 'menu':
$menu = (1 == $parameter['value']);
break;
case 'menuall':
$menuall = (1 == $parameter['value']);
break;
}
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$this->em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, $iditemcategory, $withbookmark, false);
// Render
return $this->getRender('viewitem.html.twig', [
'canadd' => $this->user,
'modedesktop' => $modedesktop,
'search' => $search,
'menu' => $menu,
'menuall' => $menuall,
'withbookmark' => $withbookmark,
'bookmarks' => $bookmarks,
'items' => $items,
'itemcategorys' => $itemcategorys,
]);
}
public function viewitemessential($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modedesktop = 0;
$itemsordered = null;
$bookmarks = null;
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, null, 0, true);
// Render
return $this->getRender('viewitemessential.html.twig', [
'canadd' => $this->user,
'modedesktop' => $modedesktop,
'items' => $items,
'bookmarks' => $bookmarks,
]);
}
public function viewalert($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$alertsordered = null;
// Récupération des paramétres du widget
$idalertcategory = null;
$alertcategoryfilter = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'alertcategory':
$idalertcategory = $parameter['value'];
if ($idalertcategory) {
$alertcategoryfilter = $this->em->getRepository('App:Alertcategory')->find($idalertcategory);
}
break;
}
}
// Profilage
$alertsordered = $this->em->getRepository('App\Entity\Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter);
// Render
return $this->getRender('viewalert.html.twig', [
'alerts' => $alertsordered,
]);
}
public function viewbookmark($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modedesktop = 0;
$bookmarks = null;
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
}
// Bookmark du widget
$bookmarks = $em->getRepository('App\Entity\Bookmark')->findBy(['pagewidget' => $this->entity]);
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Render
return $this->getRender('viewbookmark.html.twig', [
'canadd' => $this->canadd,
'modedesktop' => $modedesktop,
'bookmarks' => $bookmarks,
]);
}
public function viewlink($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$url = '';
$target = '_blank';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'url':
$url = $parameter['value'];
break;
case 'target':
$target = $parameter['value'];
break;
}
}
// Render
return $this->getRender('viewlink.html.twig', [
'url' => $url,
'target' => $target,
]);
}
public function viewinfo($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
if (1 == $this->entity->getPage()->getGroups()->count()) {
$this->entity->setName($this->entity->getPage()->getGroups()[0]->getLabel());
} elseif (0 == $this->entity->getPage()->getGroups()->count() && $this->entity->getPage()->getUser()) {
$this->entity->setName($this->entity->getPage()->getName());
}
// Render
return $this->getRender('viewinfo.html.twig', [
'usage' => $this->usage,
'id' => $id,
'idpage' => $this->entity->getPage()->getId(),
]);
}
public function vieweditor($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$html = '';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'html':
$html = $parameter['value'];
break;
}
}
// Render
return $this->getRender('vieweditor.html.twig', [
'html' => $html,
]);
}
public function viewslide($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$interval = '2';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'interval':
$interval = $parameter['value'];
break;
}
}
// Récupération des slides
$slides = $this->em->getRepository('App\Entity\Pagewidgetslide')->findBy(['pagewidget' => $this->entity], ['roworder' => 'ASC', 'title' => 'ASC']);
// Render
return $this->getRender('viewslide.html.twig', [
'slides' => $slides,
'interval' => $interval,
]);
}
public function viewfile($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$view = 'small';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modelist':
$view = (0 == $parameter['value'] ? 'small' : 'list');
break;
}
}
// Préference
$widgetfolder = $this->getKeyPreference($this->entity, 'widgetfolder', '');
$view = ($widgetfolder && $widgetfolder['view'] ? $widgetfolder['view'] : $view);
// Render
return $this->getRender('viewfile.html.twig', [
'category' => 'pagewidget',
'id' => $id,
'view' => $view,
]);
}
public function viewgalery($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
$directory = 'file/pagewidget/'.$id.'/.thumb/';
$files = $this->minio->listFiles($directory, '/');
if ($files) {
$date = array_column($files, 'LastModified');
array_multisort($date, SORT_DESC, $files);
}
// Render
return $this->getRender('viewgalery.html.twig', [
'files' => $files,
]);
}
public function viewcalendar(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$nbday = '0';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'nbday':
$nbday = $parameter['value'];
break;
}
}
// Récupérer les events de l'utilisateur
$user = $this->getUser();
$events = $this->em->getRepository('App:Calendarevent')->getUserCalendarevents($user, $this->get('session')->get('color')['main'], $this->usage, $this->group, $firstcalendar);
// Render
return $this->getRender('viewcalendar.html.twig', [
'events' => $events,
'nbday' => $nbday,
'firstcalendar' => $firstcalendar,
'usage' => $this->usage,
]);
}
public function viewblog(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$nbarticle = 10;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'nbarticle':
$nbarticle = $parameter['value'];
break;
}
}
// On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur
if ('group' == $this->usage) {
$blogs = $this->em->getRepository('App:Blog')->getBlogsGroup($this->getUser(), $this->group);
if ($blogs) {
$firstblog = $blogs[0]->getId();
}
} else {
$this->em->getRepository('App:Blog')->getBlogsUser($this->getUser(), $blogsuser, $blogsadmin, $blogsshared);
$blogs = array_merge($blogsuser, $blogsadmin->toArray(), $blogsshared);
$firstblog = 'all';
}
// On récupère les nbarticle de ses blogs
$this->em->getRepository('App:Blogarticle')->getBlogsArticles($blogs, 0, $nbarticle, $count, $blogarticles);
// Render
return $this->getRender('viewblog.html.twig', [
'blogarticles' => $blogarticles,
'nbarticle' => $nbarticle,
'firstblog' => $firstblog,
'usage' => $this->usage,
]);
}
public function viewproject(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Parametres
$nbarticle = 10;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'nbarticle':
$nbarticle = $parameter['value'];
break;
}
}
// On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur
$user = $this->getUser();
if ('group' == $this->usage) {
$projects = $this->em->getRepository('App:Project')->getProjectsGroup($this->getUser(), $this->group);
if ($projects) {
$firstproject = $projects[0]->getId();
}
} else {
$this->em->getRepository('App:Project')->getProjectsUser($user, $projectsuser, $projectsadmin, $projectsshared);
$projects = array_merge($projectsuser, $projectsadmin->toArray(), $projectsshared);
$firstproject = 'all';
}
// On récupère les nbarticle de ses projects
$this->em->getRepository('App:Projecttask')->getProjectsTasks($projects, 0, $nbarticle, $count, $projecttasks);
foreach ($projecttasks as $key => $projecttask) {
if (100 == $projecttask->getPercentage()) {
unset($projecttasks[$key]);
}
}
if ('group' != $this->usage) {
foreach ($projecttasks as $key => $projecttask) {
if (!$user) {
unset($projecttasks[$key]);
} else {
if ($projecttask->getUser() && $projecttask->getUser() != $user) {
unset($projecttasks[$key]);
} elseif (!$projecttask->getUser() && $projecttask->getOwner() && $projecttask->getOwner() != $user) {
unset($projecttasks[$key]);
}
}
}
}
// Render
return $this->getRender('viewproject.html.twig', [
'projecttasks' => $projecttasks,
'nbarticle' => $nbarticle,
'firstproject' => $firstproject,
'usage' => $this->usage,
]);
}
}

View File

@ -1,223 +0,0 @@
<?php
namespace App\Controller;
use App\Entity\Pagewidgetslide;
use App\Form\PagewidgetslideType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PagewidgetslideController extends AbstractController
{
private $data = 'pagewidgetslide';
private $labelentity = "App\Entity\Pagewidgetslide";
private $twig = 'Pagewidgetslide/';
private $route = 'app_admin_pagewidgetslide';
public function list($idwidget, $access, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Recherche des pagewidgetslides du widget
$datas = $em->getRepository($this->labelentity)->findBy(['pagewidget' => $pagewidget], ['roworder' => 'ASC', 'title' => 'ASC']);
return $this->render($this->twig.'list.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
'maxsize' => ('all' == $access ? 1200 : null),
'access' => $access,
'pagewidget' => $pagewidget,
'usage' => $usage,
$this->data.'s' => $datas,
]);
}
public function submit($idwidget, $access, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Initialisation de l'enregistrement
$data = new Pagewidgetslide();
$data->setRoworder(0);
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Création du formulaire
$form = $this->createForm(PagewidgetslideType::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
if ($data->getImage()) {
$data->setPagewidget($pagewidget);
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('app_'.$access.'_pagewidgetslide_list', ['idwidget' => $idwidget, 'usage' => $usage]));
}
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
'maxsize' => ('all' == $access ? 1200 : null),
'entity' => $data,
'mode' => 'submit',
'access' => $access,
'pagewidget' => $pagewidget,
'usage' => $usage,
'form' => $form->createView(),
]);
}
public function update($id, $idwidget, $access, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Récupération de l'enregistrement courant
$data = $em->getRepository("App\Entity\Pagewidgetslide")->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Création du formulaire
$form = $this->createForm(PagewidgetslideType::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
if ($data->getImage()) {
// Sauvegarde
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('app_'.$access.'_pagewidgetslide_list', ['idwidget' => $idwidget, 'usage' => $usage]));
}
}
// Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => ('admin' == $access),
'usesidebar' => ('admin' == $access),
'maxsize' => ('all' == $access ? 1200 : null),
'entity' => $data,
'mode' => 'update',
'access' => $access,
'pagewidget' => $pagewidget,
'usage' => $usage,
'form' => $form->createView(),
]);
}
public function delete($id, $idwidget, $access, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// Récupération de l'enregistrement courant
$data = $em->getRepository("App\Entity\Pagewidgetslide")->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
// Tentative de suppression
try {
$em->getManager()->remove($data);
$em->getManager()->flush();
} catch (\Exception $e) {
$request->getSession()->getFlashBag()->add('error', $e->getMessage());
throw $this->createAccessDeniedException('Permission denied');
}
// Retour à la list
return $this->redirect($this->generateUrl('app_'.$access.'_pagewidgetslide_list', ['idwidget' => $idwidget, 'usage' => $usage]));
}
public function upload($idwidget, $access, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
// On s'assure que le widget existe
$pagewidget = $em->getRepository("App\Entity\Pagewidget")->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que l'on peut générer un pagewidgetslide
if ('all' == $access) {
if (!$em->getRepository("App\Entity\Pagewidget")->getCanadd($this->getUser(), $pagewidget, $usage)) {
throw $this->createAccessDeniedException('Permission denied');
}
}
return $this->render($this->twig.'upload.html.twig', [
'useheader' => false,
'usemenu' => false,
'usesidebar' => false,
'pagewidget' => $pagewidget,
]);
}
}

View File

@ -0,0 +1,187 @@
<?php
namespace App\Controller;
use App\Entity\Pin as Entity;
use App\Form\PinType as Form;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class PinController extends AbstractController
{
private $data = 'pin';
private $route = 'app_pin';
private $render = 'Pin/';
private $entity = 'App:Pin';
public function list()
{
$em = $this->getDoctrine()->getManager();
// Récupérer les pins
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit(Request $request)
{
$em = $this->getDoctrine()->getManager();
// Initialisation de l'enregistrement
$data = new Entity();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function update($id, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->find($id);
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'update']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView(),
]);
}
public function delete($id, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->find($id);
// Controle avant suppression
$error = false;
if ($id < 0) {
$error = true;
}
if ($error) {
return $this->redirectToRoute($this->route);
} else {
$em->remove($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
}
public function view($id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Not exist');
}
return $this->render($this->render.'view.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
]);
}
public function select(Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$output = [];
$em = $this->getDoctrine()->getManager();
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -0,0 +1,137 @@
<?php
namespace App\Controller;
use App\Entity\Tag as Entity;
use App\Form\TagType as Form;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
class TagController extends AbstractController
{
private $data = 'tag';
private $route = 'app_tag';
private $render = 'Tag/';
private $entity = 'App:Tag';
public function list()
{
$em = $this->getDoctrine()->getManager();
// Récupérer les tags
$datas = $em->getRepository($this->entity)->findAll();
return $this->render($this->render.'list.html.twig', [
$this->data.'s' => $datas,
'useheader' => true,
'usesidebar' => true,
]);
}
public function submit(Request $request)
{
$em = $this->getDoctrine()->getManager();
// Initialisation de l'enregistrement
$data = new Entity();
// Création du formulaire
$form = $this->createForm(Form::class, $data, ['mode' => 'submit']);
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => true,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView(),
]);
}
public function delete($id, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->entity)->find($id);
// Controle avant suppression
$error = false;
if ($id < 0) {
$error = true;
}
if ($error) {
return $this->redirectToRoute($this->route);
} else {
$em->remove($data);
$em->flush();
// Retour à la liste
return $this->redirectToRoute($this->route);
}
}
public function select(Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$output = [];
$em = $this->getDoctrine()->getManager();
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.id LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.id');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getId()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -1,413 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="alert")
* @ORM\Entity(repositoryClass="App\Repository\AlertRepository")
*/
class Alert
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=100)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="content", type="text", nullable=true)
*/
private $content;
/**
* @var int
*
* @ORM\Column(name="rowOrder", type="integer", nullable=true)
*/
private $rowOrder;
/**
* @var datetime
*
* @ORM\Column(name="publishedat", type="date")
*/
protected $publishedat;
/**
* @var datetime
*
* @ORM\Column(name="unpublishedat", type="date", nullable=true)
*/
protected $unpublishedat;
/**
* @ORM\Column(name="fghideable", type="boolean")
*/
private $fghideable;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToOne(targetEntity="Alertcategory", inversedBy="alerts")
* @ORM\JoinColumn(name="category", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
protected $alertcategory;
/**
* @ORM\ManyToMany(targetEntity="Group", inversedBy="alerts", cascade={"persist"})
* @ORM\JoinTable(name="alertgroupe",
* joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToMany(targetEntity="User", inversedBy="alertreaders", cascade={"persist"})
* @ORM\JoinTable(name="alertuserread",
* joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="useraccount", referencedColumnName="id")}
* )
*/
protected $readers;
// Is Online
public function isOnline()
{
$today = new \DateTime();
if (null === $this->unpublishedat &&
$this->publishedat->getTimestamp() <= $today->getTimestamp()
) {
return true;
}
if (
$this->publishedat->getTimestamp() <= $today->getTimestamp() &&
$this->unpublishedat->getTimestamp() >= $today->getTimestamp()
) {
return true;
}
return false;
}
// IsPending
public function isPending()
{
$today = new \DateTime();
if ($this->publishedat->getTimestamp() > $today->getTimestamp()) {
return true;
}
return false;
}
// IsArchived
public function isArchived()
{
$today = new \DateTime();
if (null === $this->unpublishedat) {
return false;
}
if ($this->unpublishedat->getTimestamp() < $today->getTimestamp()) {
return true;
}
return false;
}
/**
* Constructor.
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->readers = new ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set title.
*
* @param string $title
*
* @return Alert
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set content.
*
* @param string $content
*
* @return Alert
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content.
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* Set rowOrder.
*
* @param int $rowOrder
*
* @return Alert
*/
public function setRowOrder($rowOrder)
{
$this->rowOrder = $rowOrder;
return $this;
}
/**
* Get rowOrder.
*
* @return int
*/
public function getRowOrder()
{
return $this->rowOrder;
}
/**
* Set publishedat.
*
* @param \DateTime $publishedat
*
* @return Alert
*/
public function setpublishedat($publishedat)
{
$this->publishedat = $publishedat;
return $this;
}
/**
* Get publishedat.
*
* @return \DateTime
*/
public function getpublishedat()
{
return $this->publishedat;
}
/**
* Set unpublishedat.
*
* @param \DateTime $unpublishedat
*
* @return Alert
*/
public function setUnpublishedat($unpublishedat)
{
$this->unpublishedat = $unpublishedat;
return $this;
}
/**
* Get unpublishedat.
*
* @return \DateTime
*/
public function getUnpublishedat()
{
return $this->unpublishedat;
}
/**
* Set roles.
*
* @param array $roles
*
* @return Alert
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles.
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Set alertcategory.
*
* @return Alert
*/
public function setAlertcategory(Alertcategory $alertcategory)
{
$this->alertcategory = $alertcategory;
return $this;
}
/**
* Get alertcategory.
*
* @return Alertcategory
*/
public function getAlertcategory()
{
return $this->alertcategory;
}
/**
* Add group.
*
* @return Alert
*/
public function addGroup(Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group.
*/
public function removeGroup(Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set fghideable.
*
* @param bool $fghideable
*
* @return Alert
*/
public function setFghideable($fghideable)
{
$this->fghideable = $fghideable;
return $this;
}
/**
* Get fghideable.
*
* @return bool
*/
public function getFghideable()
{
return $this->fghideable;
}
/**
* Add reader.
*
* @return Alert
*/
public function addReader(User $reader)
{
$this->readers[] = $reader;
return $this;
}
/**
* Remove reader.
*/
public function removeReader(User $reader)
{
$this->readers->removeElement($reader);
}
/**
* Get readers.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getReaders()
{
return $this->readers;
}
public function isFghideable(): ?bool
{
return $this->fghideable;
}
}

View File

@ -1,175 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="alertcategory")
*/
class Alertcategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=100)
*/
private $label;
/**
* @var int
*
* @ORM\Column(name="color", type="string", nullable=true)
*/
private $color;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="alertcategorys")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @ORM\OneToMany(targetEntity="Alert", mappedBy="alertcategory", cascade={"persist"}, orphanRemoval=true)
* @ORM\JoinColumn(name="alerts", referencedColumnName="id")
*/
protected $alerts;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor.
*/
public function __construct()
{
$this->alerts = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set label.
*
* @param string $label
*
* @return Alertcategory
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set color.
*
* @param string $color
*
* @return Alertcategory
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set icon.
*
* @param Icon $icon
*
* @return Alertcategory
*/
public function setIcon(Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon.
*
* @return Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Add alert.
*
* @return Alertcategory
*/
public function addAlert(Alert $alert)
{
$this->alerts[] = $alert;
return $this;
}
/**
* Remove alert.
*/
public function removeAlert(Alert $alert)
{
$this->alerts->removeElement($alert);
}
/**
* Get alerts.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAlerts()
{
return $this->alerts;
}
}

View File

@ -2,6 +2,7 @@
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**

201
src/Entity/Blog.php Normal file
View File

@ -0,0 +1,201 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Blog.
*
* @ORM\Table(name="Blog")
* @ORM\Entity(repositoryClass="App\Repository\BlogRepository")
* @ORM\HasLifecycleCallbacks
*/
class Blog
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $submitdate;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $externalcode;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $externalid;
/**
* @ORM\ManyToOne(targetEntity="Blogtype", inversedBy="blogs")
*/
private $blogtype;
/**
* @ORM\OneToMany(targetEntity="Child", mappedBy="blog", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $childs;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="blog", cascade={"persist"}, orphanRemoval=true)
*/
private $menuchilds;
public function __construct()
{
$this->childs = new ArrayCollection();
$this->menuchilds = new ArrayCollection();
}
/**
* @ORM\PrePersist
*/
public function onPrePersist()
{
$this->submitdate = new \DateTime('now');
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSubmitdate(): ?\DateTimeInterface
{
return $this->submitdate;
}
public function setSubmitdate(\DateTimeInterface $submitdate): self
{
$this->submitdate = $submitdate;
return $this;
}
public function getExternalcode(): ?string
{
return $this->externalcode;
}
public function setExternalcode(?string $externalcode): self
{
$this->externalcode = $externalcode;
return $this;
}
public function getExternalid(): ?string
{
return $this->externalid;
}
public function setExternalid(?string $externalid): self
{
$this->externalid = $externalid;
return $this;
}
public function getBlogtype(): ?Blogtype
{
return $this->blogtype;
}
public function setBlogtype(?Blogtype $blogtype): self
{
$this->blogtype = $blogtype;
return $this;
}
/**
* @return Collection<int, Child>
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Child $child): self
{
if (!$this->childs->contains($child)) {
$this->childs->add($child);
$child->setBlog($this);
}
return $this;
}
public function removeChild(Child $child): self
{
if ($this->childs->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getBlog() === $this) {
$child->setBlog(null);
}
}
return $this;
}
/**
* @return Collection<int, Menuchild>
*/
public function getMenuchilds(): Collection
{
return $this->menuchilds;
}
public function addMenuchild(Menuchild $menuchild): self
{
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setBlog($this);
}
return $this;
}
public function removeMenuchild(Menuchild $menuchild): self
{
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getBlog() === $this) {
$menuchild->setBlog(null);
}
}
return $this;
}
}

180
src/Entity/Blogtype.php Normal file
View File

@ -0,0 +1,180 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Blogtype.
*
* @ORM\Table(name="blogtype")
* @ORM\Entity(repositoryClass="App\Repository\BlogtypeRepository")
*/
class Blogtype
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string")
*/
private $sortby;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $image;
/**
* @ORM\OneToMany(targetEntity="Blog", mappedBy="blogtype", cascade={"persist"}, orphanRemoval=false)
*/
private $blogs;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="blogtype", cascade={"persist"}, orphanRemoval=true)
*/
private $menuchilds;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function __construct()
{
$this->blogs = new ArrayCollection();
$this->menuchilds = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSortby(): ?string
{
return $this->sortby;
}
public function setSortby(string $sortby): self
{
$this->sortby = $sortby;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
/**
* @return Collection<int, Blog>
*/
public function getBlogs(): Collection
{
return $this->blogs;
}
public function addBlog(Blog $blog): self
{
if (!$this->blogs->contains($blog)) {
$this->blogs->add($blog);
$blog->setBlogtype($this);
}
return $this;
}
public function removeBlog(Blog $blog): self
{
if ($this->blogs->removeElement($blog)) {
// set the owning side to null (unless already changed)
if ($blog->getBlogtype() === $this) {
$blog->setBlogtype(null);
}
}
return $this;
}
/**
* @return Collection<int, Menuchild>
*/
public function getMenuchilds(): Collection
{
return $this->menuchilds;
}
public function addMenuchild(Menuchild $menuchild): self
{
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setBlogtype($this);
}
return $this;
}
public function removeMenuchild(Menuchild $menuchild): self
{
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getBlogtype() === $this) {
$menuchild->setBlogtype(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}

View File

@ -1,337 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="bookmark")
*/
class Bookmark
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=100)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="subtitle", type="string", length=250, nullable=true)
*/
private $subtitle;
/**
* @var string
*
* @ORM\Column(name="url", type="string", length=500)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="target", type="string", length=32)
*/
private $target;
/**
* @var int
*
* @ORM\Column(name="rowOrder", type="integer", nullable=true)
*/
private $rowOrder;
/**
* @var string
*
* @ORM\Column(name="color", type="string", length=24, nullable=true)
*/
private $color;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="bookmarks")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="bookmarks")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @ORM\ManyToOne(targetEntity="Pagewidget", inversedBy="bookmarks")
* @ORM\JoinColumn(nullable=true)
*/
private $pagewidget;
/**
* @ORM\ManyToOne(targetEntity="Item", inversedBy="bookmarks")
* @ORM\JoinColumn(nullable=true)
*/
private $item;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set title.
*
* @param string $title
*
* @return Bookmark
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set subtitle.
*
* @param string $subtitle
*
* @return Bookmark
*/
public function setSubtitle($subtitle)
{
$this->subtitle = $subtitle;
return $this;
}
/**
* Get subtitle.
*
* @return string
*/
public function getSubtitle()
{
return $this->subtitle;
}
/**
* Set url.
*
* @param string $url
*
* @return Bookmark
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url.
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set target.
*
* @param string $target
*
* @return Bookmark
*/
public function setTarget($target)
{
$this->target = $target;
return $this;
}
/**
* Get target.
*
* @return string
*/
public function getTarget()
{
return $this->target;
}
/**
* Set rowOrder.
*
* @param int $rowOrder
*
* @return Bookmark
*/
public function setRowOrder($rowOrder)
{
$this->rowOrder = $rowOrder;
return $this;
}
/**
* Get rowOrder.
*
* @return int
*/
public function getRowOrder()
{
return $this->rowOrder;
}
/**
* Set color.
*
* @param string $color
*
* @return Bookmark
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set icon.
*
* @param Icon $icon
*
* @return Bookmark
*/
public function setIcon(Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon.
*
* @return Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Set user.
*
* @param User $user
*
* @return Bookmark
*/
public function setUser(User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* Set pagewidget.
*
* @param Pagewidget $pagewidget
*
* @return Bookmark
*/
public function setPagewidget(Pagewidget $pagewidget = null)
{
$this->pagewidget = $pagewidget;
return $this;
}
/**
* Get pagewidget.
*
* @return Pagewidget
*/
public function getPagewidget()
{
return $this->pagewidget;
}
/**
* Set item.
*
* @param Item $item
*
* @return Bookmark
*/
public function setItem(Item $item = null)
{
$this->item = $item;
return $this;
}
/**
* Get item.
*
* @return Item
*/
public function getItem()
{
return $this->item;
}
}

404
src/Entity/Child.php Normal file
View File

@ -0,0 +1,404 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Child.
*
* @ORM\Table(name="child")
* @ORM\Entity(repositoryClass="App\Repository\ChildRepository")
* @ORM\HasLifecycleCallbacks
*/
class Child
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="integer")
*/
private $roworder;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $subname;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $submitdate;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $filename;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $fileextention;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $fileminetype;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $url;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $externalcode;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $externalid;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $externalscript;
/**
* @ORM\ManyToOne(targetEntity="Blog", inversedBy="childs")
*/
private $blog;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="childs")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity="Childtype", inversedBy="childs")
*/
private $childtype;
/**
* @ORM\OneToMany(targetEntity="Childheader", mappedBy="child", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $childheaders;
/**
* @ORM\ManyToMany(targetEntity="Tag", inversedBy="childs", cascade={"persist"})
* @ORM\JoinTable(name="childtag",
* joinColumns={@ORM\JoinColumn(name="child", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="tag", referencedColumnName="id")}
* )
*/
private $tags;
/**
* @ORM\ManyToMany(targetEntity="Pin", inversedBy="pins", cascade={"persist"})
* @ORM\JoinTable(name="childpin",
* joinColumns={@ORM\JoinColumn(name="child", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="pin", referencedColumnName="id")}
* )
* @ORM\OrderBy({"name" = "ASC"})
*/
private $pins;
public function __construct()
{
$this->childheaders = new ArrayCollection();
$this->tags = new ArrayCollection();
$this->pins = new ArrayCollection();
}
/**
* @ORM\PrePersist
*/
public function onPrePersist()
{
$this->submitdate = new \DateTime('now');
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSubname(): ?string
{
return $this->subname;
}
public function setSubname(?string $subname): self
{
$this->subname = $subname;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getSubmitdate(): ?\DateTimeInterface
{
return $this->submitdate;
}
public function setSubmitdate(\DateTimeInterface $submitdate): self
{
$this->submitdate = $submitdate;
return $this;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(?string $filename): self
{
$this->filename = $filename;
return $this;
}
public function getFileextention(): ?string
{
return $this->fileextention;
}
public function setFileextention(?string $fileextention): self
{
$this->fileextention = $fileextention;
return $this;
}
public function getFileminetype(): ?string
{
return $this->fileminetype;
}
public function setFileminetype(?string $fileminetype): self
{
$this->fileminetype = $fileminetype;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getExternalcode(): ?string
{
return $this->externalcode;
}
public function setExternalcode(?string $externalcode): self
{
$this->externalcode = $externalcode;
return $this;
}
public function getExternalid(): ?string
{
return $this->externalid;
}
public function setExternalid(?string $externalid): self
{
$this->externalid = $externalid;
return $this;
}
public function getExternalscript(): ?string
{
return $this->externalscript;
}
public function setExternalscript(?string $externalscript): self
{
$this->externalscript = $externalscript;
return $this;
}
public function getBlog(): ?Blog
{
return $this->blog;
}
public function setBlog(?Blog $blog): self
{
$this->blog = $blog;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
$this->page = $page;
return $this;
}
public function getChildtype(): ?Childtype
{
return $this->childtype;
}
public function setChildtype(?Childtype $childtype): self
{
$this->childtype = $childtype;
return $this;
}
/**
* @return Collection<int, Childheader>
*/
public function getChildheaders(): Collection
{
return $this->childheaders;
}
public function addChildheader(Childheader $childheader): self
{
if (!$this->childheaders->contains($childheader)) {
$this->childheaders->add($childheader);
$childheader->setChild($this);
}
return $this;
}
public function removeChildheader(Childheader $childheader): self
{
if ($this->childheaders->removeElement($childheader)) {
// set the owning side to null (unless already changed)
if ($childheader->getChild() === $this) {
$childheader->setChild(null);
}
}
return $this;
}
/**
* @return Collection<int, Tag>
*/
public function getTags(): Collection
{
return $this->tags;
}
public function addTag(Tag $tag): self
{
if (!$this->tags->contains($tag)) {
$this->tags->add($tag);
}
return $this;
}
public function removeTag(Tag $tag): self
{
$this->tags->removeElement($tag);
return $this;
}
/**
* @return Collection<int, Pin>
*/
public function getPins(): Collection
{
return $this->pins;
}
public function addPin(Pin $pin): self
{
if (!$this->pins->contains($pin)) {
$this->pins->add($pin);
}
return $this;
}
public function removePin(Pin $pin): self
{
$this->pins->removeElement($pin);
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Childheader.
*
* @ORM\Table(name="childheader")
* @ORM\Entity(repositoryClass="App\Repository\ChildheaderRepository")
*/
class Childheader
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $filename;
/**
* @ORM\Column(type="integer")
*/
private $roworder;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $credit;
/**
* @ORM\ManyToOne(targetEntity="Child", inversedBy="childheaders")
*/
private $child;
public function getId(): ?int
{
return $this->id;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(string $filename): self
{
$this->filename = $filename;
return $this;
}
public function getChild(): ?Child
{
return $this->child;
}
public function setChild(?Child $child): self
{
$this->child = $child;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getCredit(): ?string
{
return $this->credit;
}
public function setCredit(?string $credit): self
{
$this->credit = $credit;
return $this;
}
}

216
src/Entity/Childtype.php Normal file
View File

@ -0,0 +1,216 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Childtype.
*
* @ORM\Table(name="childtype")
* @ORM\Entity(repositoryClass="App\Repository\ChildtypeRepository")
*/
class Childtype
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="integer")
*/
private $roworder;
/**
* @ORM\Column(type="string")
*/
private $submitroute;
/**
* @ORM\Column(type="boolean")
*/
private $havechildheader;
/**
* @ORM\Column(type="boolean")
*/
private $havefile;
/**
* @ORM\Column(type="boolean")
*/
private $haveurl;
/**
* @ORM\Column(type="boolean")
*/
private $havepin;
/**
* @ORM\OneToMany(targetEntity="Child", mappedBy="childtype", cascade={"persist"}, orphanRemoval=false)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $childs;
public function __construct()
{
$this->childs = new ArrayCollection();
$this->childtypeattributs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getSubmitroute(): ?string
{
return $this->submitroute;
}
public function setSubmitroute(string $submitroute): self
{
$this->submitroute = $submitroute;
return $this;
}
public function getHavechildheader(): ?bool
{
return $this->havechildheader;
}
public function setHavechildheader(bool $havechildheader): self
{
$this->havechildheader = $havechildheader;
return $this;
}
public function getHavefile(): ?bool
{
return $this->havefile;
}
public function setHavefile(bool $havefile): self
{
$this->havefile = $havefile;
return $this;
}
public function getHaveurl(): ?bool
{
return $this->haveurl;
}
public function setHaveurl(bool $haveurl): self
{
$this->haveurl = $haveurl;
return $this;
}
/**
* @return Collection|Child[]
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Child $child): self
{
if (!$this->childs->contains($child)) {
$this->childs[] = $child;
$child->setChildtype($this);
}
return $this;
}
public function removeChild(Child $child): self
{
if ($this->childs->contains($child)) {
$this->childs->removeElement($child);
// set the owning side to null (unless already changed)
if ($child->getChildtype() === $this) {
$child->setChildtype(null);
}
}
return $this;
}
public function getHavepin(): ?bool
{
return $this->havepin;
}
public function setHavepin(bool $havepin): self
{
$this->havepin = $havepin;
return $this;
}
public function isHavechildheader(): ?bool
{
return $this->havechildheader;
}
public function isHavefile(): ?bool
{
return $this->havefile;
}
public function isHaveurl(): ?bool
{
return $this->haveurl;
}
public function isHavepin(): ?bool
{
return $this->havepin;
}
}

View File

@ -2,6 +2,7 @@
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**

View File

@ -2,6 +2,7 @@
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
@ -80,11 +81,6 @@ class Group
*/
private $owner;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="templategroups")
*/
private $pagetemplate;
/**
* @var ArrayCollection
* @var UserGroup
@ -93,27 +89,9 @@ class Group
*/
private $users;
/**
* @ORM\ManyToMany(targetEntity="Alert", mappedBy="groups")
*/
protected $alerts;
/**
* @ORM\ManyToMany(targetEntity="Item", mappedBy="groups")
*/
protected $items;
/**
* @ORM\ManyToMany(targetEntity="Page", mappedBy="groups")
*/
protected $pages;
public function __construct()
{
$this->users = new ArrayCollection();
$this->alerts = new ArrayCollection();
$this->items = new ArrayCollection();
$this->pages = new ArrayCollection();
}
// == CODE A NE PAS REGENERER
@ -279,97 +257,4 @@ class Group
return $this;
}
/**
* @return Collection<int, Alert>
*/
public function getAlerts(): Collection
{
return $this->alerts;
}
public function addAlert(Alert $alert): self
{
if (!$this->alerts->contains($alert)) {
$this->alerts->add($alert);
$alert->addGroup($this);
}
return $this;
}
public function removeAlert(Alert $alert): self
{
if ($this->alerts->removeElement($alert)) {
$alert->removeGroup($this);
}
return $this;
}
/**
* @return Collection<int, Item>
*/
public function getItems(): Collection
{
return $this->items;
}
public function addItem(Item $item): self
{
if (!$this->items->contains($item)) {
$this->items->add($item);
$item->addGroup($this);
}
return $this;
}
public function removeItem(Item $item): self
{
if ($this->items->removeElement($item)) {
$item->removeGroup($this);
}
return $this;
}
public function getPagetemplate(): ?Page
{
return $this->pagetemplate;
}
public function setPagetemplate(?Page $pagetemplate): self
{
$this->pagetemplate = $pagetemplate;
return $this;
}
/**
* @return Collection<int, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->addGroup($this);
}
return $this;
}
public function removePage(Page $page): self
{
if ($this->pages->removeElement($page)) {
$page->removeGroup($this);
}
return $this;
}
}

View File

@ -1,400 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @ORM\Table(name="icon")
* @UniqueEntity(fields="label", message="Une Icône existe déjà avec ce label")
*/
class Icon
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=250, unique=true)
*/
private $label;
/**
* @ORM\Column(type="string", length=250, nullable=true)
*/
private $tags;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="icons")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @var ArrayCollection
* @var Item
*
* @ORM\OneToMany(targetEntity="Item", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $items;
/**
* @var ArrayCollection
* @var Itemcategory
*
* @ORM\OneToMany(targetEntity="Itemcategory", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $itemcategorys;
/**
* @var ArrayCollection
* @var Alertcategory
*
* @ORM\OneToMany(targetEntity="Alertcategory", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $alertcategorys;
/**
* @var ArrayCollection
* @var Pagewidget
*
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $pagewidgets;
/**
* @var ArrayCollection
* @var Widget
*
* @ORM\OneToMany(targetEntity="Widget", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $widgets;
/**
* @var ArrayCollection
* @var Bookmark
*
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $bookmarks;
/**
* @var ArrayCollection
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="icon", cascade={"persist"}, orphanRemoval=false)
*/
private $groups;
/**
* Constructor.
*/
public function __construct()
{
$this->items = new \Doctrine\Common\Collections\ArrayCollection();
$this->itemcategorys = new \Doctrine\Common\Collections\ArrayCollection();
$this->alertcategorys = new \Doctrine\Common\Collections\ArrayCollection();
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->widgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->bookmarks = new \Doctrine\Common\Collections\ArrayCollection();
$this->groups = new ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set label.
*
* @param string $label
*
* @return Icon
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set user.
*
* @param User $user
*
* @return Icon
*/
public function setUser(User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* Add item.
*
* @return Icon
*/
public function addItem(Item $item)
{
$this->items[] = $item;
return $this;
}
/**
* Remove item.
*/
public function removeItem(Item $item)
{
$this->items->removeElement($item);
}
/**
* Get items.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getItems()
{
return $this->items;
}
/**
* Add itemcategory.
*
* @return Icon
*/
public function addItemcategory(Itemcategory $itemcategory)
{
$this->itemcategorys[] = $itemcategory;
return $this;
}
/**
* Remove itemcategory.
*/
public function removeItemcategory(Itemcategory $itemcategory)
{
$this->itemcategorys->removeElement($itemcategory);
}
/**
* Get itemcategorys.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getItemcategorys()
{
return $this->itemcategorys;
}
/**
* Add alertcategory.
*
* @return Icon
*/
public function addAlertcategory(Alertcategory $alertcategory)
{
$this->alertcategorys[] = $alertcategory;
return $this;
}
/**
* Remove alertcategory.
*/
public function removeAlertcategory(Alertcategory $alertcategory)
{
$this->alertcategorys->removeElement($alertcategory);
}
/**
* Get alertcategorys.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getAlertcategorys()
{
return $this->alertcategorys;
}
/**
* Add pagewidget.
*
* @return Icon
*/
public function addPagewidget(Pagewidget $pagewidget)
{
$this->pagewidgets[] = $pagewidget;
return $this;
}
/**
* Remove pagewidget.
*/
public function removePagewidget(Pagewidget $pagewidget)
{
$this->pagewidgets->removeElement($pagewidget);
}
/**
* Get pagewidgets.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPagewidgets()
{
return $this->pagewidgets;
}
/**
* Add widget.
*
* @return Icon
*/
public function addWidget(Widget $widget)
{
$this->widgets[] = $widget;
return $this;
}
/**
* Remove widget.
*/
public function removeWidget(Widget $widget)
{
$this->widgets->removeElement($widget);
}
/**
* Get widgets.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getWidgets()
{
return $this->widgets;
}
/**
* Add bookmark.
*
* @return Icon
*/
public function addBookmark(Bookmark $bookmark)
{
$this->bookmarks[] = $bookmark;
return $this;
}
/**
* Remove bookmark.
*/
public function removeBookmark(Bookmark $bookmark)
{
$this->bookmarks->removeElement($bookmark);
}
/**
* Get bookmarks.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getBookmarks()
{
return $this->bookmarks;
}
/**
* Add group.
*
* @return Icon
*/
public function addGroup(Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group.
*/
public function removeGroup(Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set tags.
*
* @param string $tags
*
* @return Icon
*/
public function setTags($tags)
{
$this->tags = $tags;
return $this;
}
/**
* Get tags.
*
* @return string
*/
public function getTags()
{
return $this->tags;
}
}

View File

@ -1,359 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="item")
* @ORM\Entity(repositoryClass="App\Repository\ItemRepository")
*/
class Item
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=100)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="subtitle", type="string", length=250, nullable=true)
*/
private $subtitle;
/**
* @var string
*
* @ORM\Column(length=128, unique=true, nullable=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(name="url", type="string", length=500)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="target", type="string", length=32)
*/
private $target;
/**
* @var string
*
* @ORM\Column(name="content", type="text", nullable=true)
*/
private $content;
/**
* @var int
*
* @ORM\Column(name="rowOrder", type="integer", nullable=true)
*/
private $rowOrder;
/**
* @var bool
*
* @ORM\Column(name="essential", type="boolean", nullable=true, options={"default":false})
*/
private $essential = false;
/**
* @var bool
*
* @ORM\Column(name="protected", type="boolean", nullable=true, options={"default":false})
*/
private $protected;
/**
* @var string
*
* @ORM\Column(name="color", type="string", length=24, nullable=true)
*/
private $color;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="items")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @var ArrayCollection
* @var Bookmark
*
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="item", cascade={"persist"}, orphanRemoval=true)
*/
private $bookmarks;
/**
* @ORM\ManyToOne(targetEntity="Itemcategory", inversedBy="items")
* @ORM\JoinColumn(name="category", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
protected $itemcategory;
/**
* @ORM\ManyToMany(targetEntity="Group", inversedBy="items", cascade={"persist"})
* @ORM\JoinTable(name="itemgroupe",
* joinColumns={@ORM\JoinColumn(name="item", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
public function __construct()
{
$this->bookmarks = new ArrayCollection();
$this->groups = new ArrayCollection();
}
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getTarget(): ?string
{
return $this->target;
}
public function setTarget(string $target): self
{
$this->target = $target;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getRowOrder(): ?int
{
return $this->rowOrder;
}
public function setRowOrder(?int $rowOrder): self
{
$this->rowOrder = $rowOrder;
return $this;
}
public function isEssential(): ?bool
{
return $this->essential;
}
public function setEssential(?bool $essential): self
{
$this->essential = $essential;
return $this;
}
public function isProtected(): ?bool
{
return $this->protected;
}
public function setProtected(?bool $protected): self
{
$this->protected = $protected;
return $this;
}
public function getColor(): ?string
{
return $this->color;
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getRoles(): array
{
return $this->roles;
}
public function setRoles(?array $roles): self
{
$this->roles = $roles;
return $this;
}
public function getIcon(): ?Icon
{
return $this->icon;
}
public function setIcon(?Icon $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Bookmark>
*/
public function getBookmarks(): Collection
{
return $this->bookmarks;
}
public function addBookmark(Bookmark $bookmark): self
{
if (!$this->bookmarks->contains($bookmark)) {
$this->bookmarks->add($bookmark);
$bookmark->setItem($this);
}
return $this;
}
public function removeBookmark(Bookmark $bookmark): self
{
if ($this->bookmarks->removeElement($bookmark)) {
// set the owning side to null (unless already changed)
if ($bookmark->getItem() === $this) {
$bookmark->setItem(null);
}
}
return $this;
}
public function getItemcategory(): ?Itemcategory
{
return $this->itemcategory;
}
public function setItemcategory(?Itemcategory $itemcategory): self
{
$this->itemcategory = $itemcategory;
return $this;
}
/**
* @return Collection<int, Group>
*/
public function getGroups(): Collection
{
return $this->groups;
}
public function addGroup(Group $group): self
{
if (!$this->groups->contains($group)) {
$this->groups->add($group);
}
return $this;
}
public function removeGroup(Group $group): self
{
$this->groups->removeElement($group);
return $this;
}
}

View File

@ -1,213 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Entity
* @ORM\Table(name="itemcategory")
* @ORM\HasLifecycleCallbacks
* @UniqueEntity(fields="label", message="Une Catégorie existe déjà avec ce label")
*/
class Itemcategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="label", type="string", length=100)
*/
private $label;
/**
* @var string
*
* @ORM\Column(name="color", type="string", length=24, nullable=true)
*/
private $color;
/**
* @var int
*
* @ORM\Column(name="rowOrder", type="integer", nullable=true)
*/
private $rowOrder;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="itemcategorys")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @var ArrayCollection
* @var UserGroup
*
* @ORM\OneToMany(targetEntity="Item", mappedBy="itemcategory", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"rowOrder" = "ASC","title" = "ASC"})
*/
protected $items;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor.
*/
public function __construct()
{
$this->items = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set label.
*
* @param string $label
*
* @return Itemcategory
*/
public function setLabel($label)
{
$this->label = $label;
return $this;
}
/**
* Get label.
*
* @return string
*/
public function getLabel()
{
return $this->label;
}
/**
* Set color.
*
* @param string $color
*
* @return Itemcategory
*/
public function setColor($color)
{
$this->color = $color;
return $this;
}
/**
* Get color.
*
* @return string
*/
public function getColor()
{
return $this->color;
}
/**
* Set rowOrder.
*
* @param int $rowOrder
*
* @return Itemcategory
*/
public function setRowOrder($rowOrder)
{
$this->rowOrder = $rowOrder;
return $this;
}
/**
* Get rowOrder.
*
* @return int
*/
public function getRowOrder()
{
return $this->rowOrder;
}
/**
* Set icon.
*
* @param Icon $icon
*
* @return Itemcategory
*/
public function setIcon(Icon $icon = null)
{
$this->icon = $icon;
return $this;
}
/**
* Get icon.
*
* @return Icon
*/
public function getIcon()
{
return $this->icon;
}
/**
* Add item.
*
* @return Itemcategory
*/
public function addItem(Item $item)
{
$this->items[] = $item;
return $this;
}
/**
* Remove item.
*/
public function removeItem(Item $item)
{
$this->items->removeElement($item);
}
/**
* Get items.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getItems()
{
return $this->items;
}
}

93
src/Entity/Menu.php Normal file
View File

@ -0,0 +1,93 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Menu.
*
* @ORM\Table(name="menu")
* @ORM\Entity(repositoryClass="App\Repository\MenuRepository")
*/
class Menu
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="menu", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $menuchilds;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function __construct()
{
$this->menuchilds = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Menuchild>
*/
public function getMenuchilds(): Collection
{
return $this->menuchilds;
}
public function addMenuchild(Menuchild $menuchild): self
{
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setMenu($this);
}
return $this;
}
public function removeMenuchild(Menuchild $menuchild): self
{
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getMenu() === $this) {
$menuchild->setMenu(null);
}
}
return $this;
}
}

145
src/Entity/Menuchild.php Normal file
View File

@ -0,0 +1,145 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Menu.
*
* @ORM\Table(name="menuchild")
* @ORM\Entity(repositoryClass="App\Repository\MenuchildRepository")
*/
class Menuchild
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $childtype;
/**
* @ORM\Column(type="integer")
*/
private $roworder;
/**
* @ORM\ManyToOne(targetEntity="Menu", inversedBy="menuchilds")
*/
private $menu;
/**
* @ORM\ManyToOne(targetEntity="Blog", inversedBy="menuchilds")
*/
private $blog;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="menuchilds")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity="Blogtype", inversedBy="menuchilds")
*/
private $blogtype;
/**
* @ORM\ManyToOne(targetEntity="Pagetype", inversedBy="menuchilds")
*/
private $pagetype;
public function getId(): ?int
{
return $this->id;
}
public function getChildtype(): ?string
{
return $this->childtype;
}
public function setChildtype(string $childtype): self
{
$this->childtype = $childtype;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getMenu(): ?Menu
{
return $this->menu;
}
public function setMenu(?Menu $menu): self
{
$this->menu = $menu;
return $this;
}
public function getBlog(): ?Blog
{
return $this->blog;
}
public function setBlog(?Blog $blog): self
{
$this->blog = $blog;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
$this->page = $page;
return $this;
}
public function getBlogtype(): ?Blogtype
{
return $this->blogtype;
}
public function setBlogtype(?Blogtype $blogtype): self
{
$this->blogtype = $blogtype;
return $this;
}
public function getPagetype(): ?Pagetype
{
return $this->pagetype;
}
public function setPagetype(?Pagetype $pagetype): self
{
$this->pagetype = $pagetype;
return $this;
}
}

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

657
src/Entity/Page.php Executable file → Normal file
View File

@ -3,640 +3,199 @@
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Page.
*
* @ORM\Entity
* @ORM\Table(name="page")
* @ORM\Table(name="Page")
* @ORM\Entity(repositoryClass="App\Repository\PageRepository")
* @ORM\HasLifecycleCallbacks
*/
class Page
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
* @ORM\Column(type="string")
*/
private $name;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer")
* @ORM\Column(type="datetime", nullable=false)
*/
private $roworder;
private $submitdate;
/**
* @var int
*
* @ORM\Column(name="maxwidth", type="integer")
* @ORM\Column(type="string", nullable=true)
*/
private $maxwidth;
private $externalcode;
/**
* @var string
*
* @ORM\Column(name="fonticon", type="string", nullable=true)
* @ORM\Column(type="string", nullable=true)
*/
private $fonticon;
private $externalid;
/**
* @var string
*
* @ORM\Column(name="url", type="text", nullable=true)
* @ORM\ManyToOne(targetEntity="Pagetype", inversedBy="pages")
*/
private $url;
private $pagetype;
/**
* @var bool
*
* @ORM\Column(name="toreload", type="boolean", nullable=true)
* @ORM\OneToMany(targetEntity="Child", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"roworder" = "ASC"})
*/
private $toreload;
private $childs;
/**
* @var string
*
* @ORM\Column(name="html", type="text", nullable=true)
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
*/
private $html;
private $menuchilds;
/**
* @var string
*
* @ORM\Column(name="template", type="array", nullable=true)
*/
private $template;
/**
* @var string
*
* @ORM\Column(name="parentfor", type="string", nullable=true)
*/
protected $parentfor;
/**
* @var string
*
* @ORM\Column(name="roles", type="array", nullable=true)
*/
private $roles;
/**
* @ORM\ManyToOne(targetEntity="Pagecategory", inversedBy="pages")
*/
private $pagecategory;
/**
* @ORM\ManyToMany(targetEntity="Group", inversedBy="pages", cascade={"persist"})
* @ORM\JoinTable(name="pagegroupe",
* joinColumns={@ORM\JoinColumn(name="page", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="groupe", referencedColumnName="id")}
* )
*/
protected $groups;
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="pages")
* @ORM\JoinColumn(nullable=true)
*/
private $user;
/**
* @var ArrayCollection
* @var Pagewidget
*
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="page", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"loc" = "ASC", "roworder" = "ASC"})
*/
private $pagewidgets;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="pages")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $page;
/**
* @var ArrayCollection
* @var Page
*
* @ORM\OneToMany(targetEntity="Page", mappedBy="page", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
/**
* @var ArrayCollection
* @var Group
*
* @ORM\OneToMany(targetEntity="Group", mappedBy="pagetemplate", cascade={"persist"}, orphanRemoval=false)
*/
private $templategroups;
/* champs calculé non stocké en base */
private $canupdate;
public function getCanupdate()
{
return $this->canupdate;
}
public function setCanupdate($canupdate)
{
$this->canupdate = $canupdate;
return $this;
}
/* champs calculé non stocké en base */
private $counterread;
public function getCounterRead()
{
return $this->counterread;
}
public function setCounterRead($counterread)
{
$this->counterread = $counterread;
return $this;
}
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor.
*/
public function __construct()
{
$this->groups = new \Doctrine\Common\Collections\ArrayCollection();
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
$this->templategroups = new ArrayCollection();
$this->childs = new ArrayCollection();
$this->menuchilds = new ArrayCollection();
}
/**
* Get id.
*
* @return int
* @ORM\PrePersist
*/
public function getId()
public function onPrePersist()
{
$this->submitdate = new \DateTime('now');
}
public function getId(): ?int
{
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return Page
*/
public function setName($name)
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
public function getSubmitdate(): ?\DateTimeInterface
{
return $this->name;
return $this->submitdate;
}
/**
* Set roworder.
*
* @param int $roworder
*
* @return Page
*/
public function setRoworder($roworder)
public function setSubmitdate(\DateTimeInterface $submitdate): self
{
$this->roworder = $roworder;
$this->submitdate = $submitdate;
return $this;
}
public function getExternalcode(): ?string
{
return $this->externalcode;
}
public function setExternalcode(?string $externalcode): self
{
$this->externalcode = $externalcode;
return $this;
}
public function getExternalid(): ?string
{
return $this->externalid;
}
public function setExternalid(?string $externalid): self
{
$this->externalid = $externalid;
return $this;
}
public function getPagetype(): ?Pagetype
{
return $this->pagetype;
}
public function setPagetype(?Pagetype $pagetype): self
{
$this->pagetype = $pagetype;
return $this;
}
/**
* Get roworder.
*
* @return int
* @return Collection<int, Child>
*/
public function getRoworder()
public function getChilds(): Collection
{
return $this->roworder;
return $this->childs;
}
/**
* Set maxwidth.
*
* @param int $maxwidth
*
* @return Page
*/
public function setMaxwidth($maxwidth)
public function addChild(Child $child): self
{
$this->maxwidth = $maxwidth;
if (!$this->childs->contains($child)) {
$this->childs->add($child);
$child->setPage($this);
}
return $this;
}
public function removeChild(Child $child): self
{
if ($this->childs->removeElement($child)) {
// set the owning side to null (unless already changed)
if ($child->getPage() === $this) {
$child->setPage(null);
}
}
return $this;
}
/**
* Get maxwidth.
*
* @return int
* @return Collection<int, Menuchild>
*/
public function getMaxwidth()
public function getMenuchilds(): Collection
{
return $this->maxwidth;
return $this->menuchilds;
}
/**
* Set url.
*
* @param string $url
*
* @return Page
*/
public function setUrl($url)
public function addMenuchild(Menuchild $menuchild): self
{
$this->url = $url;
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setPage($this);
}
return $this;
}
/**
* Get url.
*
* @return string
*/
public function getUrl()
public function removeMenuchild(Menuchild $menuchild): self
{
return $this->url;
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getPage() === $this) {
$menuchild->setPage(null);
}
}
/**
* Set html.
*
* @param string $html
*
* @return Page
*/
public function setHtml($html)
{
$this->html = $html;
return $this;
}
/**
* Get html.
*
* @return string
*/
public function getHtml()
{
return $this->html;
}
/**
* Set template.
*
* @param array $template
*
* @return Page
*/
public function setTemplate($template)
{
$this->template = $template;
return $this;
}
/**
* Get template.
*
* @return array
*/
public function getTemplate()
{
return $this->template;
}
/**
* Set parentfor.
*
* @param string $parentfor
*
* @return Page
*/
public function setParentfor($parentfor)
{
$this->parentfor = $parentfor;
return $this;
}
/**
* Get parentfor.
*
* @return string
*/
public function getParentfor()
{
return $this->parentfor;
}
/**
* Set roles.
*
* @param array $roles
*
* @return Page
*/
public function setRoles($roles)
{
$this->roles = $roles;
return $this;
}
/**
* Get roles.
*
* @return array
*/
public function getRoles()
{
return $this->roles;
}
/**
* Set pagecategory.
*
* @param Pagecategory $pagecategory
*
* @return Page
*/
public function setPagecategory(Pagecategory $pagecategory = null)
{
$this->pagecategory = $pagecategory;
return $this;
}
/**
* Get pagecategory.
*
* @return Pagecategory
*/
public function getPagecategory()
{
return $this->pagecategory;
}
/**
* Add group.
*
* @return Page
*/
public function addGroup(Group $group)
{
$this->groups[] = $group;
return $this;
}
/**
* Remove group.
*/
public function removeGroup(Group $group)
{
$this->groups->removeElement($group);
}
/**
* Get groups.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getGroups()
{
return $this->groups;
}
/**
* Set user.
*
* @param User $user
*
* @return Page
*/
public function setUser(User $user = null)
{
$this->user = $user;
return $this;
}
/**
* Get user.
*
* @return User
*/
public function getUser()
{
return $this->user;
}
/**
* Add pagewidget.
*
* @return Page
*/
public function addPagewidget(Pagewidget $pagewidget)
{
$this->pagewidgets[] = $pagewidget;
return $this;
}
/**
* Remove pagewidget.
*/
public function removePagewidget(Pagewidget $pagewidget)
{
$this->pagewidgets->removeElement($pagewidget);
}
/**
* Get pagewidgets.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPagewidgets()
{
return $this->pagewidgets;
}
/**
* Set page.
*
* @param Page $page
*
* @return Page
*/
public function setPage(Page $page = null)
{
$this->page = $page;
return $this;
}
/**
* Get page.
*
* @return Page
*/
public function getPage()
{
return $this->page;
}
/**
* Add page.
*
* @return Page
*/
public function addPage(Page $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page.
*/
public function removePage(Page $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
/**
* Add templategroup.
*
* @return Page
*/
public function addTemplategroup(Group $templategroup)
{
$this->templategroups[] = $templategroup;
return $this;
}
/**
* Remove templategroup.
*/
public function removeTemplategroup(Group $templategroup)
{
$this->templategroups->removeElement($templategroup);
}
/**
* Get templategroups.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getTemplategroups()
{
return $this->templategroups;
}
/**
* Set fonticon.
*
* @param string $fonticon
*
* @return Page
*/
public function setFonticon($fonticon)
{
$this->fonticon = $fonticon;
return $this;
}
/**
* Get fonticon.
*
* @return string
*/
public function getFonticon()
{
return $this->fonticon;
}
/**
* Set toreload.
*
* @param bool $toreload
*
* @return Page
*/
public function setToreload($toreload)
{
$this->toreload = $toreload;
return $this;
}
/**
* Get toreload.
*
* @return bool
*/
public function getToreload()
{
return $this->toreload;
}
public function isToreload(): ?bool
{
return $this->toreload;
}
}

View File

@ -1,119 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* Pagetype.
*
* @ORM\Entity
* @ORM\Table(name="pagecategory")
*/
class Pagecategory
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var ArrayCollection
* @var Page
*
* @ORM\OneToMany(targetEntity="Page", mappedBy="pagecategory", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* Constructor.
*/
public function __construct()
{
$this->pages = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* Set name.
*
* @param string $name
*
* @return Pagecategory
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Add page.
*
* @return Pagecategory
*/
public function addPage(Page $page)
{
$this->pages[] = $page;
return $this;
}
/**
* Remove page.
*/
public function removePage(Page $page)
{
$this->pages->removeElement($page);
}
/**
* Get pages.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getPages()
{
return $this->pages;
}
}

180
src/Entity/Pagetype.php Normal file
View File

@ -0,0 +1,180 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Pagetype.
*
* @ORM\Table(name="pagetype")
* @ORM\Entity(repositoryClass="App\Repository\PagetypeRepository")
*/
class Pagetype
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string")
*/
private $sortby;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $image;
/**
* @ORM\OneToMany(targetEntity="Page", mappedBy="pagetype", cascade={"persist"}, orphanRemoval=false)
*/
private $pages;
/**
* @ORM\OneToMany(targetEntity="Menuchild", mappedBy="pagetype", cascade={"persist"}, orphanRemoval=true)
*/
private $menuchilds;
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function __construct()
{
$this->pages = new ArrayCollection();
$this->menuchilds = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSortby(): ?string
{
return $this->sortby;
}
public function setSortby(string $sortby): self
{
$this->sortby = $sortby;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
/**
* @return Collection<int, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->setPagetype($this);
}
return $this;
}
public function removePage(Page $page): self
{
if ($this->pages->removeElement($page)) {
// set the owning side to null (unless already changed)
if ($page->getPagetype() === $this) {
$page->setPagetype(null);
}
}
return $this;
}
/**
* @return Collection<int, Menuchild>
*/
public function getMenuchilds(): Collection
{
return $this->menuchilds;
}
public function addMenuchild(Menuchild $menuchild): self
{
if (!$this->menuchilds->contains($menuchild)) {
$this->menuchilds->add($menuchild);
$menuchild->setPagetype($this);
}
return $this;
}
public function removeMenuchild(Menuchild $menuchild): self
{
if ($this->menuchilds->removeElement($menuchild)) {
// set the owning side to null (unless already changed)
if ($menuchild->getPagetype() === $this) {
$menuchild->setPagetype(null);
}
}
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}

View File

@ -1,420 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Pagewidget.
*
* @ORM\Entity
* @ORM\Table(name="pagewidget")
* @ORM\Entity(repositoryClass="App\Repository\PagewidgetRepository")
*/
class Pagewidget
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="loc", type="string")
*/
private $loc;
/**
* @var string
*
* @ORM\Column(name="roworder", type="integer")
*/
private $roworder;
/**
* @var int
*
* @ORM\Column(name="height", type="integer")
*/
private $height;
/**
* @var bool
*
* @ORM\Column(name="autoajust", type="boolean", options={"default":false})
*/
protected $autoajust;
/**
* @var bool
*
* @ORM\Column(name="border", type="boolean", options={"default":true})
*/
protected $border;
/**
* @var bool
*
* @ORM\Column(name="opened", type="boolean", options={"default":true})
*/
protected $opened;
/**
* @var bool
*
* @ORM\Column(name="viewheader", type="boolean", options={"default":true})
*/
protected $viewheader;
/**
* @var string
*
* @ORM\Column(name="colorheaderback", type="string", nullable=true)
*/
protected $colorheaderback;
/**
* @var string
*
* @ORM\Column(name="colorheaderfont", type="string", nullable=true)
*/
protected $colorheaderfont;
/**
* @var string
*
* @ORM\Column(name="colorbodyback", type="string", nullable=true)
*/
protected $colorbodyback;
/**
* @var string
*
* @ORM\Column(name="colorbodyfont", type="string", nullable=true)
*/
protected $colorbodyfont;
/**
* @var string
*
* @ORM\Column(name="parameter", type="array", nullable=true)
*/
private $parameter;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="pagewidgets")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity="Widget", inversedBy="pagewidgets")
*/
private $widget;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="pagewidgets")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @var ArrayCollection
* @var Bookmark
*
* @ORM\OneToMany(targetEntity="Bookmark", mappedBy="pagewidget", cascade={"persist"}, orphanRemoval=true)
*/
private $bookmarks;
/**
* @var ArrayCollection
* @var Slide
*
* @ORM\OneToMany(targetEntity="Pagewidgetslide", mappedBy="pagewidget", cascade={"persist"}, orphanRemoval=true)
*/
private $pagewidgetslides;
public function __construct()
{
$this->bookmarks = new ArrayCollection();
$this->pagewidgetslides = new ArrayCollection();
}
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getLoc(): ?string
{
return $this->loc;
}
public function setLoc(string $loc): self
{
$this->loc = $loc;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getHeight(): ?int
{
return $this->height;
}
public function setHeight(int $height): self
{
$this->height = $height;
return $this;
}
public function isAutoajust(): ?bool
{
return $this->autoajust;
}
public function setAutoajust(bool $autoajust): self
{
$this->autoajust = $autoajust;
return $this;
}
public function isBorder(): ?bool
{
return $this->border;
}
public function setBorder(bool $border): self
{
$this->border = $border;
return $this;
}
public function isOpened(): ?bool
{
return $this->opened;
}
public function setOpened(bool $opened): self
{
$this->opened = $opened;
return $this;
}
public function isViewheader(): ?bool
{
return $this->viewheader;
}
public function setViewheader(bool $viewheader): self
{
$this->viewheader = $viewheader;
return $this;
}
public function getColorheaderback(): ?string
{
return $this->colorheaderback;
}
public function setColorheaderback(?string $colorheaderback): self
{
$this->colorheaderback = $colorheaderback;
return $this;
}
public function getColorheaderfont(): ?string
{
return $this->colorheaderfont;
}
public function setColorheaderfont(?string $colorheaderfont): self
{
$this->colorheaderfont = $colorheaderfont;
return $this;
}
public function getColorbodyback(): ?string
{
return $this->colorbodyback;
}
public function setColorbodyback(?string $colorbodyback): self
{
$this->colorbodyback = $colorbodyback;
return $this;
}
public function getColorbodyfont(): ?string
{
return $this->colorbodyfont;
}
public function setColorbodyfont(?string $colorbodyfont): self
{
$this->colorbodyfont = $colorbodyfont;
return $this;
}
public function getParameter(): array
{
return $this->parameter;
}
public function setParameter(?array $parameter): self
{
$this->parameter = $parameter;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
$this->page = $page;
return $this;
}
public function getWidget(): ?Widget
{
return $this->widget;
}
public function setWidget(?Widget $widget): self
{
$this->widget = $widget;
return $this;
}
public function getIcon(): ?Icon
{
return $this->icon;
}
public function setIcon(?Icon $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Bookmark>
*/
public function getBookmarks(): Collection
{
return $this->bookmarks;
}
public function addBookmark(Bookmark $bookmark): self
{
if (!$this->bookmarks->contains($bookmark)) {
$this->bookmarks->add($bookmark);
$bookmark->setPagewidget($this);
}
return $this;
}
public function removeBookmark(Bookmark $bookmark): self
{
if ($this->bookmarks->removeElement($bookmark)) {
// set the owning side to null (unless already changed)
if ($bookmark->getPagewidget() === $this) {
$bookmark->setPagewidget(null);
}
}
return $this;
}
/**
* @return Collection<int, Pagewidgetslide>
*/
public function getPagewidgetslides(): Collection
{
return $this->pagewidgetslides;
}
public function addPagewidgetslide(Pagewidgetslide $pagewidgetslide): self
{
if (!$this->pagewidgetslides->contains($pagewidgetslide)) {
$this->pagewidgetslides->add($pagewidgetslide);
$pagewidgetslide->setPagewidget($this);
}
return $this;
}
public function removePagewidgetslide(Pagewidgetslide $pagewidgetslide): self
{
if ($this->pagewidgetslides->removeElement($pagewidgetslide)) {
// set the owning side to null (unless already changed)
if ($pagewidgetslide->getPagewidget() === $this) {
$pagewidgetslide->setPagewidget(null);
}
}
return $this;
}
}

View File

@ -1,158 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="pagewidgetslide")
* @ORM\HasLifecycleCallbacks
*/
class Pagewidgetslide
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=100, nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="subtitle", type="string", length=250, nullable=true)
*/
private $subtitle;
/**
* @var string
*
* @ORM\Column(name="url", type="string", length=500, nullable=true)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="target", type="string", length=32)
*/
private $target;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer", nullable=true)
*/
private $roworder;
/**
* @var string
*
* @ORM\Column(name="image", type="string", length=100, nullable=true)
*/
private $image;
/**
* @ORM\ManyToOne(targetEntity="Pagewidget", inversedBy="pagewidgetslides")
*/
private $pagewidget;
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getTarget(): ?string
{
return $this->target;
}
public function setTarget(string $target): self
{
$this->target = $target;
return $this;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(?int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getPagewidget(): ?Pagewidget
{
return $this->pagewidget;
}
public function setPagewidget(?Pagewidget $pagewidget): self
{
$this->pagewidget = $pagewidget;
return $this;
}
}

161
src/Entity/Pin.php Normal file
View File

@ -0,0 +1,161 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Pin.
*
* @ORM\Table(name="pin")
* @ORM\Entity(repositoryClass="App\Repository\PinRepository")
* @ORM\HasLifecycleCallbacks
*/
class Pin
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $name;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $subname;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $image;
/**
* @ORM\Column(type="datetime", nullable=false)
*/
private $submitdate;
/**
* @ORM\ManyToMany(targetEntity="Child", mappedBy="pins")
*/
protected $childs;
public function __construct()
{
$this->childs = new ArrayCollection();
}
/**
* @ORM\PrePersist
*/
public function onPrePersist()
{
$this->submitdate = new \DateTime('now');
}
public function getId(): ?string
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSubname(): ?string
{
return $this->subname;
}
public function setSubname(?string $subname): self
{
$this->subname = $subname;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getSubmitdate(): ?\DateTimeInterface
{
return $this->submitdate;
}
public function setSubmitdate(\DateTimeInterface $submitdate): self
{
$this->submitdate = $submitdate;
return $this;
}
/**
* @return Collection|Child[]
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Child $child): self
{
if (!$this->childs->contains($child)) {
$this->childs[] = $child;
$child->addPin($this);
}
return $this;
}
public function removeChild(Child $child): self
{
if ($this->childs->contains($child)) {
$this->childs->removeElement($child);
$child->removePin($this);
}
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
}

View File

@ -3,6 +3,7 @@
namespace App\Entity;
use App\Validator;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;

74
src/Entity/Tag.php Normal file
View File

@ -0,0 +1,74 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Tag.
*
* @ORM\Table(name="tag")
* @ORM\Entity(repositoryClass="App\Repository\TagRepository")
* @UniqueEntity("id", message="Ce nom de tag existe dèja")
*/
class Tag
{
/**
* @ORM\Id
* @ORM\Column(type="string")
*/
private $id;
/**
* @ORM\ManyToMany(targetEntity="Child", mappedBy="tags")
*/
protected $childs;
public function __construct()
{
$this->childs = new ArrayCollection();
}
public function getId(): ?string
{
return $this->id;
}
public function setId(string $id): self
{
$this->id = $id;
return $this;
}
/**
* @return Collection|Child[]
*/
public function getChilds(): Collection
{
return $this->childs;
}
public function addChild(Child $child): self
{
if (!$this->childs->contains($child)) {
$this->childs[] = $child;
$child->addTag($this);
}
return $this;
}
public function removeChild(Child $child): self
{
if ($this->childs->contains($child)) {
$this->childs->removeElement($child);
$child->removeTag($this);
}
return $this;
}
}

View File

@ -5,6 +5,7 @@ namespace App\Entity;
use App\Validator;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\LegacyPasswordAuthenticatedUserInterface;
@ -191,17 +192,11 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
*/
private $modos;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Alert", mappedBy="readers")
*/
protected $alertreaders;
public function __construct()
{
$this->groups = new ArrayCollection();
$this->ownergroups = new ArrayCollection();
$this->modos = new ArrayCollection();
$this->alertreaders = new ArrayCollection();
}
// == CODE A NE PAS REGENERER
@ -683,31 +678,4 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
return $this;
}
/**
* @return Collection<int, Alert>
*/
public function getAlertreaders(): Collection
{
return $this->alertreaders;
}
public function addAlertreader(Alert $alertreader): self
{
if (!$this->alertreaders->contains($alertreader)) {
$this->alertreaders->add($alertreader);
$alertreader->addReader($this);
}
return $this;
}
public function removeAlertreader(Alert $alertreader): self
{
if ($this->alertreaders->removeElement($alertreader)) {
$alertreader->removeReader($this);
}
return $this;
}
}

View File

@ -2,6 +2,7 @@
namespace App\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

View File

@ -1,385 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Widget.
*
* @ORM\Entity
* @ORM\Table(name="widget")
* @ORM\Entity(repositoryClass="App\Repository\WidgetRepository")
*/
class Widget
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
*
* @ORM\Column(name="roworder", type="integer")
*/
private $roworder;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="routeview", type="string")
*/
private $routeview;
/**
* @var int
*
* @ORM\Column(name="height", type="integer")
*/
private $height;
/**
* @var bool
*
* @ORM\Column(name="autoajust", type="boolean", options={"default":false})
*/
protected $autoajust;
/**
* @var bool
*
* @ORM\Column(name="border", type="boolean", options={"default":true})
*/
protected $border;
/**
* @var bool
*
* @ORM\Column(name="opened", type="boolean", options={"default":true})
*/
protected $opened;
/**
* @var bool
*
* @ORM\Column(name="viewheader", type="boolean", options={"default":true})
*/
protected $viewheader;
/**
* @var string
*
* @ORM\Column(name="colorheaderback", type="string", nullable=true)
*/
protected $colorheaderback;
/**
* @var string
*
* @ORM\Column(name="colorheaderfont", type="string", nullable=true)
*/
protected $colorheaderfont;
/**
* @var string
*
* @ORM\Column(name="colorbodyback", type="string", nullable=true)
*/
protected $colorbodyback;
/**
* @var string
*
* @ORM\Column(name="colorbodyfont", type="string", nullable=true)
*/
protected $colorbodyfont;
/**
* @var string
*
* @ORM\Column(name="access", type="array", nullable=true)
*/
protected $access;
/**
* @var string
*
* @ORM\Column(name="parameter", type="array", nullable=true)
*/
private $parameter;
/**
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="widgets")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $icon;
/**
* @var ArrayCollection
* @var Order
*
* @ORM\OneToMany(targetEntity="Pagewidget", mappedBy="widget", cascade={"persist"}, orphanRemoval=true)
*/
private $pagewidgets;
public function __construct()
{
$this->pagewidgets = new ArrayCollection();
}
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getId(): ?int
{
return $this->id;
}
public function getRoworder(): ?int
{
return $this->roworder;
}
public function setRoworder(int $roworder): self
{
$this->roworder = $roworder;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getRouteview(): ?string
{
return $this->routeview;
}
public function setRouteview(string $routeview): self
{
$this->routeview = $routeview;
return $this;
}
public function getHeight(): ?int
{
return $this->height;
}
public function setHeight(int $height): self
{
$this->height = $height;
return $this;
}
public function isAutoajust(): ?bool
{
return $this->autoajust;
}
public function setAutoajust(bool $autoajust): self
{
$this->autoajust = $autoajust;
return $this;
}
public function isBorder(): ?bool
{
return $this->border;
}
public function setBorder(bool $border): self
{
$this->border = $border;
return $this;
}
public function isOpened(): ?bool
{
return $this->opened;
}
public function setOpened(bool $opened): self
{
$this->opened = $opened;
return $this;
}
public function isViewheader(): ?bool
{
return $this->viewheader;
}
public function setViewheader(bool $viewheader): self
{
$this->viewheader = $viewheader;
return $this;
}
public function getColorheaderback(): ?string
{
return $this->colorheaderback;
}
public function setColorheaderback(?string $colorheaderback): self
{
$this->colorheaderback = $colorheaderback;
return $this;
}
public function getColorheaderfont(): ?string
{
return $this->colorheaderfont;
}
public function setColorheaderfont(?string $colorheaderfont): self
{
$this->colorheaderfont = $colorheaderfont;
return $this;
}
public function getColorbodyback(): ?string
{
return $this->colorbodyback;
}
public function setColorbodyback(?string $colorbodyback): self
{
$this->colorbodyback = $colorbodyback;
return $this;
}
public function getColorbodyfont(): ?string
{
return $this->colorbodyfont;
}
public function setColorbodyfont(?string $colorbodyfont): self
{
$this->colorbodyfont = $colorbodyfont;
return $this;
}
public function getAccess(): array
{
return $this->access;
}
public function setAccess(?array $access): self
{
$this->access = $access;
return $this;
}
public function getParameter(): array
{
return $this->parameter;
}
public function setParameter(?array $parameter): self
{
$this->parameter = $parameter;
return $this;
}
public function getIcon(): ?Icon
{
return $this->icon;
}
public function setIcon(?Icon $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Pagewidget>
*/
public function getPagewidgets(): Collection
{
return $this->pagewidgets;
}
public function addPagewidget(Pagewidget $pagewidget): self
{
if (!$this->pagewidgets->contains($pagewidget)) {
$this->pagewidgets->add($pagewidget);
$pagewidget->setWidget($this);
}
return $this;
}
public function removePagewidget(Pagewidget $pagewidget): self
{
if ($this->pagewidgets->removeElement($pagewidget)) {
// set the owning side to null (unless already changed)
if ($pagewidget->getWidget() === $this) {
$pagewidget->setWidget(null);
}
}
return $this;
}
}

View File

@ -1,73 +0,0 @@
<?php
namespace App\EventListener;
use App\Entity\Icon;
use App\Entity\Pagewidget;
use App\Entity\Pagewidgetslide;
use App\Service\MinioService;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
class PurgefileSubscriber implements EventSubscriberInterface
{
private $entity;
private $minio;
public function __construct(MinioService $minio)
{
$this->minio = $minio;
}
public function getSubscribedEvents(): array
{
return [
Events::preRemove,
];
}
public function preRemove(LifecycleEventArgs $args): void
{
$this->entity = $args->getObject();
// Sur suppression de pagewidget
if ($this->entity instanceof Pagewidget) {
try {
$files = $this->minio->listFiles('file/pagewidget/'.$this->entity->getId().'/');
if ($files) {
foreach ($files as $file) {
$this->minio->delete($file['Key']);
}
}
} catch (\Exception $e) {
}
}
// Sur suppression pagewidgetslide
if ($this->entity instanceof Pagewidgetslide) {
try {
$files = $this->minio->listFiles($this->entity->getImage());
if ($files) {
foreach ($files as $file) {
$this->minio->delete($file['Key']);
}
}
} catch (\Exception $e) {
}
}
// Sur suppression icon
if ($this->entity instanceof Icon) {
try {
$files = $this->minio->listFiles($this->entity->getLabel());
if ($files) {
foreach ($files as $file) {
$this->minio->delete($file['Key']);
}
}
} catch (\Exception $e) {
}
}
}
}

View File

@ -1,117 +0,0 @@
<?php
namespace App\Form;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\CallbackTransformer;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class AlertType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('title', TextType::class, [
'label' => 'Titre',
])
->add('content', CKEditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
'disabled' => ('delete' == $options['mode'] ? true : false),
'config' => ['height' => '500px', 'filebrowserUploadRoute' => 'app_ckeditor_upload'],
])
->add('fghideable', ChoiceType::class, [
'label' => "Permettre aux utilisateurs de masquer l'annonce",
'choices' => ['non' => '0', 'oui' => '1'],
])
->add('alertcategory', EntityType::class, [
'label' => 'Catégorie',
'class' => 'App\Entity\Alertcategory',
'choice_label' => 'label',
'placeholder' => '-- Sélectionnez une Catégorie --',
])
->add('roles', ChoiceType::class, [
'label' => 'Visible pour les Rôles',
'choices' => [
'Visiteur' => 'ROLE_ANONYME',
'Utilisateur' => 'ROLE_USER',
'Manager' => 'ROLE_MANAGER',
'Master' => 'ROLE_MASTER',
'Modérateur' => 'ROLE_MODO',
'Administateur' => 'ROLE_ADMIN',
],
'multiple' => true,
'expanded' => true,
])
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'App\Entity\Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'app_'.$options['access'].'_group_selectlist',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des groupes',
])
->add('publishedat', DateType::class, [
'label' => 'Publier du',
'widget' => 'single_text',
])
->add('unpublishedat', DateType::class, [
'label' => 'Jusqu\'au',
'required' => false,
'widget' => 'single_text',
]);
$builder->get('publishedat')->addModelTransformer(new CallbackTransformer(
function ($value) {
if (!$value) {
return new \DateTime('now');
}
return $value;
},
function ($value) {
return $value;
}
));
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Alert',
'mode' => 'string',
'appNiveau01labels' => 'string',
'access' => 'string',
]);
}
}

View File

@ -1,47 +0,0 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class AlertcategoryType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
]
);
$builder->add('label',
TextType::class, [
'label' => 'Label',
]
);
$builder->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]);
$builder->add('color', TextType::class, [
'label' => 'Couleur',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Alertcategory',
'mode' => 'string',
'idicon' => null,
'access' => 'string',
]);
}
}

View File

@ -2,41 +2,40 @@
namespace App\Form;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class IconType extends AbstractType
class BlogType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
]
);
])
$builder->add('label',
HiddenType::class, [
'label' => 'Label',
]
);
->add('name', TextType::class, [
'label' => 'Titre',
])
$builder->add('tags', TextType::class, [
'label' => 'Tags',
'required' => false,
->add('blogtype', EntityType::class, [
'label' => 'Type',
'class' => 'App\Entity\Blogtype',
'choice_label' => 'name',
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Icon',
'data_class' => 'App\Entity\Blog',
'mode' => 'string',
'blogtype' => 'App\Entity\Blogtype',
]);
}
}

53
src/Form/BlogtypeType.php Normal file
View File

@ -0,0 +1,53 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
class BlogtypeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('image', HiddenType::class, ['empty_data' => 'noimage.png'])
->add('name', TextType::class, [
'label' => 'Titre',
])
->add('description', CkeditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
'config' => [
'height' => '300px',
'filebrowserUploadRoute' => 'app_ckeditor_upload',
],
])
->add('sortby', ChoiceType::class, [
'label' => 'Ordonner par',
'choices' => ['Par date' => 'bydate', 'Par Nom' => 'byname'],
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Blogtype',
'mode' => 'string',
]);
}
}

View File

@ -1,64 +0,0 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class BookmarkType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'),
'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']),
])
->add('title', TextType::class, [
'label' => 'Titre',
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('subtitle', TextareaType::class, [
'label' => 'Sous Titre',
'required' => false,
'disabled' => ('delete' == $options['mode'] ? true : false),
'attr' => ['rows' => '4'],
])
->add('color', TextType::class, [
'label' => 'Couleur',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('url')
->add('target', ChoiceType::class, [
'label' => 'Ouvrir le lien dans',
'choices' => [
'Nouvel onglet/fenêtre' => '_blank',
'iFrame' => 'frame',
'Onglet courant' => '_self',
],
])
->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Bookmark',
'mode' => 'string',
'idicon' => null,
]);
}
}

100
src/Form/ChildType.php Normal file
View File

@ -0,0 +1,100 @@
<?php
namespace App\Form;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class ChildType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$childtype = $options['childtype'];
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('name', TextType::class, [
'label' => 'Titre',
])
->add('subname', TextareaType::class, [
'label' => 'Sous Titre',
'required' => false,
'attr' => ['rows' => 5],
])
->add('description', CkeditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
'config' => [
'height' => '600px',
'filebrowserUploadRoute' => 'app_ckeditor_upload',
],
])
->add('tags', Select2EntityType::class, [
'label' => 'Tags',
'class' => 'App\Entity\Tag',
'multiple' => true,
'remote_route' => 'app_tag_select',
'primary_key' => 'id',
'text_property' => 'id',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des tags',
]);
if ($childtype->getHavepin()) {
$builder->add('pins', Select2EntityType::class, [
'label' => 'Pins',
'class' => 'App\Entity\Pin',
'multiple' => true,
'remote_route' => 'app_pin_select',
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des pins',
]);
}
if ($childtype->getHaveurl()) {
$builder->add('url', TextareaType::class, [
'label' => 'URL',
'required' => false,
'attr' => ['rows' => 3],
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Child',
'mode' => 'string',
'childtype' => 'App\Entity\Childtype',
]);
}
}

View File

@ -8,30 +8,27 @@ use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class ItemcategoryType extends AbstractType
class ChildheaderType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
]
);
])
$builder->add('label',
TextType::class, [
'label' => 'Label',
]
);
->add('credit', TextType::class, [
'label' => 'Crédit',
'required' => false,
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Itemcategory',
'data_class' => 'App\Entity\Childheader',
'mode' => 'string',
'access' => 'string',
]);
}
}

View File

@ -1,128 +0,0 @@
<?php
namespace App\Form;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class ItemType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'),
'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']),
])
->add('title', TextType::class, [
'label' => 'Titre',
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('subtitle', TextareaType::class, [
'label' => 'Sous Titre',
'required' => false,
'disabled' => ('delete' == $options['mode'] ? true : false),
'attr' => ['rows' => '4'],
])
->add('content', CKEditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
'disabled' => ('delete' == $options['mode'] ? true : false),
'config' => ['height' => '500px', 'filebrowserUploadRoute' => 'app_ckeditor_upload'],
])
->add('itemcategory', EntityType::class, [
'label' => 'Catégorie',
'class' => 'App\Entity\Itemcategory',
'choice_label' => 'label',
'placeholder' => '-- Sélectionnez une Catégorie --',
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('roles', ChoiceType::class, [
'label' => 'Visible pour les Rôles',
'choices' => [
'Visiteur' => 'ROLE_ANONYME',
'Utilisateur' => 'ROLE_USER',
'Manager' => 'ROLE_MANAGER',
'Master' => 'ROLE_MASTER',
'Modérateur' => 'ROLE_MODO',
'Administateur' => 'ROLE_ADMIN',
],
'multiple' => true,
'expanded' => true,
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'App\Entity\Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'app_'.$options['access'].'_group_selectlist',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des groupes',
])
->add('color', TextType::class, [
'label' => 'Couleur',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('url')
->add('protected', CheckboxType::class, [
'label' => "Force l'authentification de l'utilisateur ?",
'required' => false,
])
->add('essential', CheckboxType::class, [
'label' => 'Item essentiel ?',
'required' => false,
])
->add('target', ChoiceType::class, [
'label' => 'Ouvrir le lien dans',
'choices' => [
'Nouvel onglet/fenêtre' => '_blank',
'iFrame' => 'frame',
'Onglet courant' => '_top',
],
])
->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Item',
'mode' => 'string',
'access' => 'string',
'idicon' => null,
]);
}
}

104
src/Form/MenuchildType.php Normal file
View File

@ -0,0 +1,104 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class MenuchildType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('childtype', ChoiceType::class, [
'label' => 'Ordonner par',
'choices' => ['blog' => 'blog', 'blogtype' => 'blogtype','page' => 'page', 'pagetype' => 'pagetype'],
])
->add('blog', Select2EntityType::class, [
'label' => 'Blog',
'required' => false,
'remote_route' => 'app_blog_selectlist',
'class' => "App\Entity\Blog",
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => '== Choisir Blog ==',
])
->add('blogtype', Select2EntityType::class, [
'label' => 'Type de Blog',
'required' => false,
'remote_route' => 'app_typeblog_selectlist',
'class' => "App\Entity\Blogtype",
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => '== Choisir Type de Blog ==',
])
->add('page', Select2EntityType::class, [
'label' => 'Page',
'required' => false,
'remote_route' => 'app_page_selectlist',
'class' => "App\Entity\Page",
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => '== Choisir Page ==',
])
->add('pagetype', Select2EntityType::class, [
'label' => 'Type de Page',
'required' => false,
'remote_route' => 'app_typepage_selectlist',
'class' => "App\Entity\Pagetype",
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => '== Choisir Type de Page ==',
])
;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Menuchild',
'mode' => 'string',
]);
}
}

View File

@ -1,148 +0,0 @@
<?php
namespace App\Form;
use App\Form\Type\FaChoiceType;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class PageSubmitType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$access = $options['access'];
$user = $options['user'];
$builder
->add('submit', SubmitType::class, [
'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'),
'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']),
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('pagecategory', EntityType::class, [
'label' => 'Catégorie de Page',
'class' => 'App\Entity\Pagecategory',
'choice_label' => 'name',
'placeholder' => '-- Sélectionnez une catégorie --',
'query_builder' => function (EntityRepository $er) use ($access) {
if ('admin' == $access) {
return $er->createQueryBuilder('pc')
->select('pc');
} else {
return $er->createQueryBuilder('pc')
->select('pc')
->where('pc.id>0');
}
},
])
->add('usage', ChoiceType::class, [
'label' => 'Usage',
'mapped' => false,
'choices' => ['Personnel' => 'user', 'Groupe de Travail' => 'group'],
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('fonticon', FaChoiceType::class, [
'label' => 'Icône',
'required' => false,
])
->add('page',
Select2EntityType::class, [
'label' => 'Modèle de Page',
'disabled' => ('delete' == $options['mode'] ? true : false),
'required' => false,
'multiple' => false,
'remote_route' => 'app_all_page_template_selectlist',
'class' => 'App\Entity\Page',
'req_params' => ['usage' => 'parent.children[usage]'],
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => '-- Selectionner un modèle de page --',
'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px'],
]
)
->add('groups', EntityType::class, [
'label' => 'Partager avec les Groupes',
'class' => 'App\Entity\Group',
'choice_label' => 'label',
'required' => false,
'multiple' => true,
'expanded' => false,
'placeholder' => '-- Selectionner un groupe --',
'query_builder' => function (EntityRepository $er) use ($user) {
return $er->createQueryBuilder('g')
->select('g')
->From('App:UserGroup', 'ug')
->where('g.isworkgroup=:isworkgroup')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('ug.rolegroup>=:role')
->setParameter('isworkgroup', true)
->setParameter('role', 90)
->setParameter('user', $user);
},
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
]);
if ('admin' == $access) {
$builder->add('user', Select2EntityType::class, [
'label' => 'Propriétaire',
'disabled' => ('delete' == $options['mode'] ? true : false),
'required' => false,
'multiple' => false,
'remote_route' => 'app_admin_user_selectlist',
'class' => 'App\Entity\User',
'primary_key' => 'id',
'text_property' => 'username',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner un propriétaire',
'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px'],
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Page',
'mode' => 'string',
'access' => 'string',
'user' => 'App\Entity\User',
]);
}
}

View File

@ -2,15 +2,14 @@
namespace App\Form;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagetemplateSubmitType extends AbstractType
class PageType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
@ -21,24 +20,13 @@ class PagetemplateSubmitType extends AbstractType
])
->add('name', TextType::class, [
'label' => 'Nom',
'label' => 'Titre',
])
->add('parentfor', ChoiceType::class, [
'label' => 'Modèle pour les',
'choices' => [
'Utilisateurs' => 'user',
'Groupes' => 'group',
'Application' => 'app',
],
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
->add('pagetype', EntityType::class, [
'label' => 'Type',
'class' => 'App\Entity\Pagetype',
'choice_label' => 'name',
]);
}
@ -47,7 +35,7 @@ class PagetemplateSubmitType extends AbstractType
$resolver->setDefaults([
'data_class' => 'App\Entity\Page',
'mode' => 'string',
'access' => 'string',
'pagetype' => 'App\Entity\Pagetype',
]);
}
}

View File

@ -1,114 +0,0 @@
<?php
namespace App\Form;
use App\Form\Type\FaChoiceType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class PageUpdateWidgetType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('fonticon', FaChoiceType::class, [
'label' => 'Icône',
'required' => false,
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
])
->add('template', HiddenType::class, [
'label' => 'Template',
'required' => false,
]);
if ('admin' == $options['access'] && 'group' != $options['for']) {
$builder
->add('roles', ChoiceType::class, [
'label' => 'Visible pour les Rôles',
'choices' => [
'Visiteur' => 'ROLE_ANONYME',
'Utilisateur' => 'ROLE_USER',
'Manager' => 'ROLE_MANAGER',
'Master' => 'ROLE_MASTER',
'Modérateur' => 'ROLE_MODO',
'Administateur' => 'ROLE_ADMIN',
],
'multiple' => true,
'expanded' => true,
'disabled' => ('delete' == $options['mode'] ? true : false),
])
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'App\Entity\Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'app_admin_group_selectlist',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner un groupe',
])
->add('user', Select2EntityType::class, [
'label' => 'Propriétaire',
'disabled' => ('delete' == $options['mode'] ? true : false),
'required' => false,
'multiple' => false,
'remote_route' => 'app_admin_user_selectlist',
'class' => 'App\Entity\User',
'primary_key' => 'id',
'text_property' => 'username',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000, // if 'cache' is true
'language' => 'fr',
'placeholder' => 'Selectionner un propriétaire',
'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px'],
]);
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Page',
'access' => 'string',
'mode' => 'string',
'for' => 'string',
]);
}
}

View File

@ -2,13 +2,16 @@
namespace App\Form;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
class PagewidgetckeditorType extends AbstractType
class PagetypeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
@ -17,24 +20,34 @@ class PagewidgetckeditorType extends AbstractType
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('ckeditor', CKEditorType::class, [
'label' => 'Texte',
'required' => false,
->add('image', HiddenType::class, ['empty_data' => 'noimage.png'])
->add('name', TextType::class, [
'label' => 'Titre',
])
->add('description', CkeditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
'config' => [
'height' => 600,
'height' => '300px',
'filebrowserUploadRoute' => 'app_ckeditor_upload',
'filebrowserUploadRouteParameters' => ['category' => 'pagewidget', 'id' => $options['idwidget'], 'usage' => $options['usage']],
],
])
->add('sortby', ChoiceType::class, [
'label' => 'Ordonner par',
'choices' => ['Par date' => 'bydate', 'Par Nom' => 'byname'],
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Pagetype',
'mode' => 'string',
'idwidget' => 'string',
'usage' => 'string',
]);
}
}

View File

@ -1,247 +0,0 @@
<?php
namespace App\Form;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagewidgetType extends AbstractType
{
public $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
// Ajout des champs commun à tout les widgets
$builder
->add('submit', SubmitType::class, [
'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'),
'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']),
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('height', IntegerType::class, [
'label' => 'Hauteur du Widget',
])
->add('border', ChoiceType::class, [
'label' => 'Afficher les Bords',
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('autoajust', ChoiceType::class, [
'label' => 'Ajuster la Hauteur au Contenu',
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('opened', ChoiceType::class, [
'label' => "Afficher le corps du widget à l'ouverture",
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('viewheader', ChoiceType::class, [
'label' => "Afficher l'Entête",
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('colorheaderback', TextType::class, [
'label' => "Couleur de Fond de l'Entête",
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorheaderfont', TextType::class, [
'label' => "Couleur du Texte de l'Entête",
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorbodyback', TextType::class, [
'label' => 'Couleur de Fond du Corps',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorbodyfont', TextType::class, [
'label' => 'Couleur du Texte du Corps',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]);
foreach ($options['param']['fields'] as $field) {
if ('string' == $field['type']) {
$builder
->add($field['id'], TextType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
]);
} elseif ('integer' == $field['type']) {
$builder
->add($field['id'], IntegerType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
]);
} elseif ('boolean' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Non' => 0, 'Oui' => 1],
]);
} elseif ('desktopmode' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Très Petit' => '0', 'Petit' => '1', 'Moyen' => '2', 'Grand' => '3', 'Liste' => '4'],
]);
} elseif ('modelist' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Pavet' => '0', 'Liste' => '1'],
]);
} elseif ('withbookmark' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Favoris + Items' => '0', 'Items uniquement' => '1', 'Favoris uniquement' => '2'],
]);
} elseif ('itemcategory' == $field['type']) {
$id = $field['value'];
$categorys = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Itemcategory")->findAll();
$choices = [];
foreach ($categorys as $category) {
$choices[$category->getLabel()] = $category->getId();
}
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $id,
'required' => ('true' == $field['mandatory']),
'choices' => $choices,
'placeholder' => '-- Sélectionnez une catégorie --',
]);
} elseif ('alertcategory' == $field['type']) {
$id = $field['value'];
$categorys = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Alertcategory")->findAll();
$choices = [];
foreach ($categorys as $category) {
$choices[$category->getLabel()] = $category->getId();
}
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $id,
'required' => ('true' == $field['mandatory']),
'choices' => $choices,
'placeholder' => '-- Sélectionnez une catégorie --',
]);
} elseif ('appexternal' == $field['type']) {
$id = $field['value'];
$appexternals = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Appexternal")->findAll();
$choices = [];
foreach ($appexternals as $appexternal) {
$choices[$appexternal->getName()] = $appexternal->getId();
}
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $id,
'required' => ('true' == $field['mandatory']),
'choices' => $choices,
'placeholder' => '-- Sélectionnez une application --',
]);
} elseif ('apponly' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Documents + Tâches' => '0', 'Documents uniquement' => '1', 'Tâches uniquement' => '2'],
]);
} elseif ('target' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Nouvel onglet/fenêtre' => '_blank', 'iFrame' => 'frame', 'Onglet courant' => '_self'],
]);
} elseif ('ckeditor' == $field['type']) {
$builder
->add($field['id'], CKEditorType::class, [
'config_name' => 'full_config',
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'config' => ['filebrowserUploadRoute' => 'app_'.$options['access'].'_pagewidget_upload'],
]);
} elseif ('clock' == $field['type']) {
$builder
->add($field['id'], ChoiceType::class, [
'label' => $field['label'],
'mapped' => false,
'label_attr' => ['loc' => $field['loc']],
'data' => $field['value'],
'required' => ('true' == $field['mandatory']),
'choices' => ['Analogique' => '0', 'Numérique' => '1'],
]);
}
}
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Pagewidget',
'param' => [],
'mode' => 'string',
'access' => 'string',
'idicon' => 'string',
]);
}
}

View File

@ -2,17 +2,16 @@
namespace App\Form;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagewidgetslideType extends AbstractType
class PinType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
@ -22,44 +21,33 @@ class PagewidgetslideType extends AbstractType
'attr' => ['class' => 'btn btn-success'],
])
->add('title', TextType::class, [
->add('image', HiddenType::class, ['empty_data' => 'noimage.png'])
->add('name', TextType::class, [
'label' => 'Titre',
'required' => false,
])
->add('subtitle', TextareaType::class, [
->add('subname', TextareaType::class, [
'label' => 'Sous Titre',
'required' => false,
'attr' => ['rows' => '4'],
'attr' => ['rows' => 5],
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('url', TextType::class, [
'label' => 'URL',
->add('description', CkeditorType::class, [
'config_name' => 'full_config',
'label' => 'Description',
'required' => false,
])
->add('target', ChoiceType::class, [
'label' => 'Ouvrir le lien dans',
'choices' => [
'Nouvel onglet/fenêtre' => '_blank',
'iFrame' => 'frame',
'Onglet courant' => '_self',
'config' => [
'height' => '600px',
'filebrowserUploadRoute' => 'app_ckupload',
],
])
->add('image', HiddenType::class, [
'label' => 'image',
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Pagewidgetslide',
'data_class' => 'App\Entity\Pin',
'mode' => 'string',
]);
}

51
src/Form/TagType.php Normal file
View File

@ -0,0 +1,51 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class TagType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('id', TextType::class, [
'label' => 'Tag',
])
->add('childs', Select2EntityType::class, [
'label' => 'Lié aux childs',
'class' => 'App:Child',
'multiple' => true,
'remote_route' => 'app_child_select',
'primary_key' => 'id',
'text_property' => 'name',
'minimum_input_length' => 0,
'page_limit' => 100,
'allow_clear' => true,
'delay' => 250,
'cache' => false,
'cache_timeout' => 60000,
'language' => 'fr',
'placeholder' => 'Selectionner des childs',
]);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => 'App\Entity\Tag',
'mode' => 'string',
]);
}
}

View File

@ -1,74 +0,0 @@
<?php
namespace App\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
class FaChoiceType extends AbstractType
{
/**
* Cache for multiple icon fields or sub-requests.
*
* @var array
*/
private $choices;
private $fontawesomeIconsFile;
public function __construct($fontawesomeIconsFile)
{
// Liste des icones FontAwesome au format JSON
// Récupéré depuis le dépôt officiel via la commande "make fetch-fontawesome-icons"
// Voir service.yml
$this->fontawesomeIconsFile = $fontawesomeIconsFile;
}
public function buildView(FormView $view, FormInterface $form, array $options)
{
// Pass this flag is necessary to render the label as raw.
// See below the twig field template for more details.
$view->vars['raw_label'] = true;
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'attr' => [
// It's the key of the solution and can be done in many ways.
// Now, the rendered <select> element will have a new font.
'class' => 'select2-icon',
],
'choices' => $this->getFontAwesomeIconChoices(),
]);
}
public function getParent()
{
return ChoiceType::class;
}
protected function getFontAwesomeIconChoices()
{
if (null !== $this->choices) {
return $this->choices;
}
$fileContent = file_get_contents($this->fontawesomeIconsFile);
if (!$fileContent) {
throw new \Error('Could not load fontawesome icons file');
}
$icons = json_decode($fileContent, true);
foreach ($icons as $iconName => $iconStyle) {
$iconClass = $iconStyle['type'].' fa-'.$iconName;
$this->choices[$iconStyle['name']] = trim($iconClass);
}
return $this->choices;
}
}

View File

@ -1,114 +0,0 @@
<?php
namespace App\Repository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\EntityRepository;
class AlertRepository extends EntityRepository
{
// getOnlineAlert
public function getOnlineAlert(array $roles = [], string $order = 'ASC'): array
{
if (!in_array($order, ['ASC', 'DESC'], true)) {
throw new \UnexpectedValueException('Wrong order: '.$order);
}
$qb = $this->createQueryBuilder('a');
$qb->join('a.roles', 'r');
if (count($roles)) {
$ids = [];
foreach ($roles as $r) {
$ids[] = (int) $r->getId();
}
$qb->andWhere($qb->expr()->in('r.id', $ids));
}
$qb->andWhere('a.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('a.unpublishedat', ':today'),
$qb->expr()->isNull('a.unpublishedat')
))
->orderBy('a.rowOrder', $order);
return $qb->getQuery()
->setParameter('today', date('Y-m-d'))
->getResult()
;
}
public function getUserAlerts($user, $idalertcategory, $alertcategoryfilter)
{
// Profilage
$roles = ($user ? $user->getRoles() : ['ROLE_ANONYME']);
$groups = ($user ? $user->getGroups() : []);
$userreads = ($user ? $user->getAlertreaders() : new ArrayCollection());
// Initialisation du calcul des alerts
$alerts = new ArrayCollection();
// Récupération des alerts par rôles
foreach ($roles as $role) {
$qb = $this->createQueryBuilder('a');
$qb->select('alert')
->from('App:Alert', 'alert')
->where($qb->expr()->like('alert.roles', $qb->expr()->literal("%$role%")))
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter('today', date('Y-m-d'));
if ($idalertcategory && $alertcategoryfilter) {
$qb->andWhere('alert.alertcategory=:alertcategory')
->setParameter('alertcategory', $alertcategoryfilter);
}
$alertsroles = $qb->getQuery()->getResult();
foreach ($alertsroles as $alertrole) {
if (!$alerts->contains($alertrole) && !$userreads->contains($alertrole)) {
$alerts->add($alertrole);
}
}
}
// Récupération des alerts par group
foreach ($groups as $group) {
$qb = $this->createQueryBuilder('a');
$qb->select('alert')
->from('App:Alert', 'alert')
->where(':group MEMBER OF alert.groups')
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter('group', $group->getGroup())
->setParameter('today', date('Y-m-d'));
if ($idalertcategory && $alertcategoryfilter) {
$qb->andWhere('alert.alertcategory=:alertcategory')
->setParameter('alertcategory', $alertcategoryfilter);
}
$alertsgroups = $qb->getQuery()->getResult();
foreach ($alertsgroups as $alertgroup) {
if (!$alerts->contains($alertgroup) && !$userreads->contains($alertgroup)) {
$alerts->add($alertgroup);
}
}
}
// Trie des alerts
$alertsordered = $alerts->getIterator();
$alertsordered->uasort(function ($first, $second) {
return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1;
});
return $alertsordered;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Blog;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Blog|null find($id, $lockMode = null, $lockVersion = null)
* @method Blog|null findOneBy(array $criteria, array $orderBy = null)
* @method Blog[] findAll()
* @method Blog[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class BlogRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Blog::class);
}
// /**
// * @return Blog[] Returns an array of Blog objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->orderBy('b.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Blog
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Blogtype;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Blogtype|null find($id, $lockMode = null, $lockVersion = null)
* @method Blogtype|null findOneBy(array $criteria, array $orderBy = null)
* @method Blogtype[] findAll()
* @method Blogtype[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class BlogtypeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Blogtype::class);
}
// /**
// * @return Blogtype[] Returns an array of Blogtype objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->orderBy('b.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Blogtype
{
return $this->createQueryBuilder('b')
->andWhere('b.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -0,0 +1,173 @@
<?php
namespace App\Repository;
use App\Entity\Child;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class ChildRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Child::class);
}
public function findPages($catparent, $idparent)
{
switch ($catparent) {
case 'blog':
// Rechercher la premiere page
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.blog=:idblog AND c.childtype=:idchildtype')
->setParameter('idblog', $idparent)
->setParameter('idchildtype', 1)
->orderby('c.roworder', 'ASC');
$childs = $qb->getQuery()->getResult();
return $childs;
break;
case 'page':
// Rechercher la premiere page
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.page=:idpage AND c.childtype=:idchildtype')
->setParameter('idpage', $idparent)
->setParameter('idchildtype', 1)
->orderby('c.roworder', 'ASC');
$childs = $qb->getQuery()->getResult();
return $childs;
break;
}
return null;
}
public function findFirstchild($catparent, $idparent)
{
switch ($catparent) {
case 'blog':
// Rechercher la premiere page
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.blog=:idblog AND c.childtype=:idchildtype')
->setParameter('idblog', $idparent)
->setParameter('idchildtype', 1)
->orderby('c.roworder', 'ASC')
->setMaxResults(1);
$child = $qb->getQuery()->getOneOrNullResult();
if ($child) {
return $child;
}
break;
case 'page':
// Rechercher la premiere page
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.page=:idpage AND c.childtype=:idchildtype')
->setParameter('idpage', $idparent)
->setParameter('idchildtype', 1)
->orderby('c.roworder', 'ASC')
->setMaxResults(1);
$child = $qb->getQuery()->getOneOrNullResult();
if ($child) {
return $child;
}
break;
}
return null;
}
public function findNext($catparent, $idparent, $tbchildtype, $roworder)
{
switch ($catparent) {
case 'blog':
$qb = $this->createQueryBuilder('c')
->select('c')
->where('c.blog=:idblog AND c.childtype IN(:tbchildtype) AND c.roworder>:roworder')
->setParameter('idblog', $idparent)
->setParameter('tbchildtype', $tbchildtype)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'ASC')
->setMaxResults(1);
break;
case 'page':
$qb = $this->createQueryBuilder('c')
->select('c')
->where('c.page=:idpage AND c.childtype IN(:tbchildtype) AND c.roworder>:roworder')
->setParameter('idpage', $idparent)
->setParameter('tbchildtype', $tbchildtype)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'ASC')
->setMaxResults(1);
break;
}
$child = $qb->getQuery()->getOneOrNullResult();
return $child;
}
public function findPrev($catparent, $idparent, $tbchildtype, $roworder)
{
switch ($catparent) {
case 'blog':
$qb = $this->createQueryBuilder('c')
->select('c')
->where('c.blog=:idblog AND c.childtype IN(:tbchildtype) AND c.roworder<:roworder')
->setParameter('idblog', $idparent)
->setParameter('tbchildtype', $tbchildtype)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'DESC')
->setMaxResults(1);
break;
case 'page':
$qb = $this->createQueryBuilder('c')
->select('c')
->where('c.page=:idpage AND c.childtype IN(:tbchildtype) AND c.roworder<:roworder')
->setParameter('idpage', $idparent)
->setParameter('tbchildtype', $tbchildtype)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'DESC')
->setMaxResults(1);
break;
}
$child = $qb->getQuery()->getOneOrNullResult();
return $child;
}
public function findOtherchilds($catparent, $idparent, $tbidchildtype, $idchild, $firstonly = false)
{
switch ($catparent) {
case 'blog':
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.blog=:idblog AND c.childtype IN(:tbidchildtype) AND c.id!=:idchild')
->setParameter('idblog', $idparent)
->setParameter('tbidchildtype', $tbidchildtype)
->setParameter('idchild', $idchild)
->orderby('c.roworder', 'ASC');
break;
case 'page':
$qb = $this->createQueryBuilder('c')->select('c')
->where('c.page=:idpage AND c.childtype IN(:tbidchildtype) AND c.id!=:idchild')
->setParameter('idpage', $idparent)
->setParameter('tbidchildtype', $tbidchildtype)
->setParameter('idchild', $idchild)
->orderby('c.roworder', 'ASC');
break;
}
if ($firstonly) {
$qb->setMaxResults(1);
}
$childs = $qb->getQuery()->getResult();
return $childs;
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Repository;
use App\Entity\Childheader;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class ChildheaderRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Childheader::class);
}
public function findNext($idchild, $roworder)
{
$qb = $this->createQueryBuilder('c')->select('c')->where('c.child=:idchild AND c.roworder>:roworder')
->setParameter('idchild', $idchild)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'ASC')
->setMaxResults(1);
$child = $qb->getQuery()->getOneOrNullResult();
return $child;
}
public function findPrev($idchild, $roworder)
{
$qb = $this->createQueryBuilder('c')->select('c')->where('c.child=:idchild AND c.roworder<:roworder')
->setParameter('idchild', $idchild)
->setParameter('roworder', $roworder)
->orderby('c.roworder', 'DESC')
->setMaxResults(1);
$child = $qb->getQuery()->getOneOrNullResult();
return $child;
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Repository;
use App\Entity\Childtype;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class ChildtypeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Childtype::class);
}
}

View File

@ -1,196 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Item;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Item>
*
* @method Item|null find($id, $lockMode = null, $lockVersion = null)
* @method Item|null findOneBy(array $criteria, array $orderBy = null)
* @method Item[] findAll()
* @method Item[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ItemRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Item::class);
}
public function save(Item $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Item $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function getUserItems($user, &$bookmarks, &$itemsordered, &$itemcategorys, $iditemcategory = null, $withbookmark = 1, $fgessential = false)
{
// Profilage
$roles = ($user ? $user->getRoles() : ['ROLE_ANONYME']);
$groups = ($user ? $user->getGroups() : []);
// Bookmark de l'utilisateur
$bookmarks = [];
if ($user) {
$bookmarks = $this->getEntityManager()->getRepository("App\Entity\Bookmark")->findBy(['user' => $user]);
}
$itemcategoryfilter = null;
if ($iditemcategory) {
$itemcategoryfilter = $this->getEntityManager()->getRepository("App\Entity\Itemcategory")->findBy(['id' => $iditemcategory]);
}
// Bookmark lié à un item
$bookmarksitems = new ArrayCollection();
if (0 == $withbookmark) {
foreach ($bookmarks as $bookmark) {
if ($bookmark->getItem()) {
$bookmarksitems->add($bookmark->getItem());
}
}
}
// Initialisation du calcul des items
$items = new ArrayCollection();
$itemalls = new ArrayCollection();
// Récupération des items par rôles
$itemsroles = [];
foreach ($roles as $role) {
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('item')
->from("App\Entity\Item", 'item')
->where($qb->expr()->like('item.roles', $qb->expr()->literal("%$role%")));
if ($iditemcategory && $itemcategoryfilter) {
$qb->andWhere('item.itemcategory=:itemcategory')
->setParameter('itemcategory', $itemcategoryfilter);
}
$itemsroles = $qb->getQuery()->getResult();
foreach ($itemsroles as $itemrole) {
if (!$bookmarksitems->contains($itemrole) && !$items->contains($itemrole)) {
if (!$fgessential || ($fgessential && $itemrole->isEssential())) {
$items->add($itemrole);
}
}
if (!$itemalls->contains($itemrole)) {
$itemalls->add($itemrole);
}
}
}
// Récupération des items par group
$itemsgroups = [];
foreach ($groups as $group) {
$qb = $this->getEntityManager()->createQueryBuilder();
$qb->select('item')
->from("App\Entity\Item", 'item')
->where(':group MEMBER OF item.groups')
->setParameter('group', $group->getGroup());
if ($iditemcategory && $itemcategoryfilter) {
$qb->andWhere('item.itemcategory=:itemcategory')
->setParameter('itemcategory', $itemcategoryfilter);
}
$itemsgroups = $qb->getQuery()->getResult();
foreach ($itemsgroups as $itemgroup) {
if (!$bookmarksitems->contains($itemgroup) && !$items->contains($itemgroup)) {
if (!$fgessential || ($fgessential && $itemgroup->isEssential())) {
$items->add($itemgroup);
}
}
if (!$itemalls->contains($itemgroup)) {
$itemalls->add($itemgroup);
}
}
}
// Pour chaque bookmark lié à un item : on vérifie qu'il est tjr la permission de voir cet item sinon on l'enlève de ses fav
foreach ($bookmarks as $key => $bookmark) {
$item = $bookmark->getItem();
if ($item) {
if (!$itemalls->contains($item)) {
unset($bookmarks[$key]);
}
}
}
// Trie des items
$itemsordered = $items->getIterator();
$itemsordered->uasort(function ($first, $second) {
if ((int) $first->getRowOrder() > (int) $second->getRowOrder()) {
$return = 1;
} elseif ((int) $first->getRowOrder() == (int) $second->getRowOrder()) {
if ($first->getTitle() > $second->getTitle()) {
$return = 1;
} else {
$return = -1;
}
} else {
$return = -1;
}
return $return;
});
$itemsordered = iterator_to_array($itemsordered);
switch ($withbookmark) {
// items uniquement
case 1: $bookmarks = null;
break;
// bookmarks uniquement
case 2: $itemsordered = null;
break;
}
// Catégories affichées
$itemcategorys = new ArrayCollection();
if ($iditemcategory && $itemcategoryfilter) {
$itemcategorys = $itemcategoryfilter;
if (empty($itemsordered)) {
$itemcategorys = null;
}
} elseif ($itemsordered) {
foreach ($itemsordered as $key => $item) {
if (!$itemcategorys->contains($item->getItemcategory())) {
$itemcategorys->add($item->getItemcategory());
}
}
// Trie des itemcategorys
$itemcategorysordered = $itemcategorys->getIterator();
$itemcategorysordered->uasort(function ($first, $second) {
if ((int) $first->getRowOrder() > (int) $second->getRowOrder()) {
$return = 1;
} else {
$return = -1;
}
return $return;
});
$itemcategorys = iterator_to_array($itemcategorysordered);
}
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Repository;
use App\Entity\Menu;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Menu>
*
* @method Menu|null find($id, $lockMode = null, $lockVersion = null)
* @method Menu|null findOneBy(array $criteria, array $orderBy = null)
* @method Menu[] findAll()
* @method Menu[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MenuRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Menu::class);
}
public function save(Menu $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Menu $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Menu[] Returns an array of Menu objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Menu
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Repository;
use App\Entity\Menuchild;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Menuchild>
*
* @method Menuchild|null find($id, $lockMode = null, $lockVersion = null)
* @method Menuchild|null findOneBy(array $criteria, array $orderBy = null)
* @method Menuchild[] findAll()
* @method Menuchild[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MenuchildRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Menuchild::class);
}
public function save(Menuchild $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Menuchild $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Menuchild[] Returns an array of Menuchild objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Menuchild
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -3,11 +3,15 @@
namespace App\Repository;
use App\Entity\Page;
use App\Entity\Pagewidget;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Page|null find($id, $lockMode = null, $lockVersion = null)
* @method Page|null findOneBy(array $criteria, array $orderBy = null)
* @method Page[] findAll()
* @method Page[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PageRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
@ -15,404 +19,32 @@ class PageRepository extends ServiceEntityRepository
parent::__construct($registry, Page::class);
}
public function save(Page $entity, bool $flush = false): void
// /**
// * @return Page[] Returns an array of Page objects
// */
/*
public function findByExampleField($value)
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
public function remove(Page $entity, bool $flush = false): void
/*
public function findOneBySomeField($value): ?Page
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// getPagesUser
// $user = l'utilisateur en cours
// $id = la page en cours que l'on cherche à afficher
// &$pagecurrent = l'entité de la page à afficher
// &$pagesuser = les pages de l'utilisateur
// &$pages = les pages système de l'utilistauer
// &$pagesshared = les pages partagées pour l'utilisateur
public function getPagesUser($user, $id, &$pagecurrent, &$pagesportal, &$pagesuser, &$groupsshared)
{
// Profilage
$roles = ($user ? $user->getRoles() : ['ROLE_ANONYME']);
$groups = ($user ? $user->getGroups() : []);
// CREATION DES PAGES TEMPLATE UTILISATEUR
if ($user) {
// Initialisation du calcul des templates
$templatesnotorder = new ArrayCollection();
// Récupération des templates par rôles
foreach ($roles as $role) {
$qb = $this->createQueryBuilder('page');
$qb->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere('page.user is null')
->andWhere("page.parentfor='user'");
$templatesroles = $qb->getQuery()->getResult();
foreach ($templatesroles as $templaterole) {
if (!$templatesnotorder->contains($templaterole)) {
$templatesnotorder->add($templaterole);
}
}
}
// Récupération des templates par group
foreach ($groups as $group) {
$qb = $this->createQueryBuilder('page');
$qb->where(':group MEMBER OF page.groups')
->andWhere('page.user is null')
->andWhere("page.parentfor='user'")
->setParameter('group', $group->getGroup());
$templatesgroups = $qb->getQuery()->getResult();
foreach ($templatesgroups as $templategroup) {
if (!$templatesnotorder->contains($templategroup)) {
$templatesnotorder->add($templategroup);
}
}
}
// Pour chaque template associé au profil de l'utilisateur on s'assure qu'il possède bien la page
foreach ($templatesnotorder as $template) {
$exist = $this->getEntityManager()->getRepository("App\Entity\Page")->findBy(['page' => $template]);
if (!$exist) {
$page = $this->clonePage($user, $template);
}
}
}
// GENERATION DES PAGES UTILISATEURS
// Une page utilisateur est une page dont il est le propriétaire mais qui n'est pas partagé dans un groupe
$pagesuser = false;
if ($user) {
$qb = $this->createQueryBuilder('page');
$qb->where('page.user=:user')
->setParameter('user', $user)
->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC');
$pagesuser = $qb->getQuery()->getResult();
foreach ($pagesuser as $key => $pageuser) {
if (!$pageuser->getGroups()->isEmpty()) {
unset($pagesuser[$key]);
}
}
}
// Permission sur les pages = il a forcement le droit des les modifier : elles sont à lui
if ($pagesuser) {
foreach ($pagesuser as $pageuser) {
$pageuser->setCanupdate(true);
}
}
// GENERATION DES PAGES GROUPES DE TRAVAIL
// Une page groupe de travail est une page associée à un groupe isworkgroup sur lequel l'utilisateur est inscrit
if ($user) {
// En premier lieu on liste les groupes de travail de l'utilisateur
$groupsshared = $this->getEntityManager()->createQueryBuilder()
->select('g')
->from('App\Entity\Group', 'g')
->from('App\Entity\UserGroup', 'ug')
->where('g.isworkgroup=:isworkgroup')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->setParameter('isworkgroup', true)
->setParameter('user', $user)
->orderBy('g.label')
->getQuery()->getResult();
// Pour chaque groupe de travail : on s'assure que le groupe possède au moins une page
// Sinon création de la page template associée au groupe
foreach ($groupsshared as $key => $groupshared) {
$pagesshared = $this->createQueryBuilder('page')
->from('App\Entity\Group', 'g')
->where('g.id=:id')
->andWhere('g MEMBER OF page.groups')
->setParameter('id', $groupshared->getId())
->orderBy('page.roworder')
->addOrderBy('page.name')
->getQuery()->getResult();
if (empty($pagesshared)) {
unset($groupsshared[$key]);
} else {
// Si l'utilisateur est manager du group il aura les permissions de modification sur la page
$usergroup = $this->getEntityManager()->getRepository("App\Entity\UserGroup")->findOneBy(['user' => $user, 'group' => $groupshared]);
if ($usergroup && $usergroup->getRolegroup() >= 90) {
foreach ($pagesshared as $key2 => $pageshared) {
$pagesshared[$key2]->setCanupdate(true);
}
}
$groupsshared[$key]->pagesshared = $pagesshared;
}
}
}
$pagesshared = false;
if ($user) {
$pagesshared = $this->createQueryBuilder('page')
->from('App\Entity\Group', 'g')
->from('App\Entity\UserGroup', 'ug')
->from('App\Entity\UserGroup', 'proprio')
->where('g.isworkgroup=:isworkgroup')
->andWhere('g=ug.group')
->andWhere('ug.user=:user')
->andWhere('g MEMBER OF page.groups')
->andWhere('page.user != :user')
->andWhere('page.user is not null')
->andWhere('proprio.user=page.user')
->andWhere('proprio.group=g')
->setParameter('isworkgroup', true)
->setParameter('user', $user)
->orderBy('page.roworder', 'ASC')
->addOrderBy('page.name', 'ASC')
->getQuery()->getResult();
}
// GENERATION DES PAGES ADMINISTRATEUR
// Initialisation du calcul des pages
$pagesnotorder = new ArrayCollection();
// Récupération des pages par rôles
foreach ($roles as $role) {
$qb = $this->createQueryBuilder('page');
$qb->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere('page.user is null')
->andWhere('page.parentfor is null');
$pagesroles = $qb->getQuery()->getResult();
foreach ($pagesroles as $pagerole) {
if (!$pagesnotorder->contains($pagerole)) {
$pagesnotorder->add($pagerole);
}
}
}
// Récupération des pages par group
foreach ($groups as $group) {
if (!$group->getGroup()->isIsworkgroup()) {
$qb = $this->createQueryBuilder('page');
$qb->where(':group MEMBER OF page.groups')
->andWhere('page.user is null')
->andWhere('page.parentfor is null')
->setParameter('group', $group->getGroup());
$pagesgroups = $qb->getQuery()->getResult();
foreach ($pagesgroups as $pagegroup) {
if (!$pagesnotorder->contains($pagegroup)) {
$pagesnotorder->add($pagegroup);
}
}
}
}
// Permission sur les pages
foreach ($pagesnotorder as $pageadmin) {
$pageadmin->setCanupdate(false);
}
// Trie des pages
$pagesportal = $pagesnotorder->getIterator();
$pagesportal->uasort(function ($first, $second) {
return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1;
});
// Afficher par défaut la pagebookmarké par l'utilisateur en préférence
if ($user && !isset($id)) {
$preference = $user->getPreference();
if (is_array($preference) && array_key_exists('pagebookmark', $preference)) {
$id = $preference['pagebookmark'][0];
}
}
// On récupère la page à afficher
$pagecurrent = false;
if (isset($id)) {
$pagecurrent = $this->find($id);
// On s'assure que la page fait partie des pages du profil
$have = false;
foreach ($pagesportal as $v) {
if ($v == $pagecurrent) {
$have = true;
}
}
if ($pagesuser) {
foreach ($pagesuser as $v) {
if ($v == $pagecurrent) {
$have = true;
}
}
}
if ($groupsshared) {
foreach ($groupsshared as $groupshared) {
foreach ($groupshared->pagesshared as $v) {
if ($v == $pagecurrent) {
$have = true;
}
}
}
}
if (!$have) {
$pagecurrent = false;
}
}
// ou On récupère la premier page profilée comme page d'accueil
if (!$pagecurrent) {
$pagesportal->rewind();
if ($pagesportal->current()) {
$id = $pagesportal->current()->getId();
$pagecurrent = $this->find($id);
}
// Si aucune page profilé on récupère la premiere page perso
if (!$pagecurrent) {
if ($pagesuser) {
$pagecurrent = $pagesuser[0];
}
}
// Si aucune page profilé on récupère la premiere page perso
if (!$pagecurrent) {
if ($groupsshared) {
if ($groupsshared[0]) {
$pagecurrent = $groupsshared[0]->pagesshared[0];
}
}
}
}
// ou On récupère la premiere page de l'utilisateur
if (!$pagecurrent && !empty($pagesuser)) {
$pagecurrent = $pagesuser[$this->firstkey($pagesuser)];
}
// ou On récupère la premiere page partagées
if (!$pagecurrent && !empty($pagesshared)) {
$pagecurrent = $pagesshared[$this->firstkey($pagesshared)];
}
}
public function getPermission($user, $page, &$cansee, &$canupdate, &$canadd)
{
// si page de l'utilisateur
if ($page->getUser() == $user && !is_null($user)) {
$cansee = true;
$canupdate = true;
$canadd = true;
} else {
$canupdate = false;
$cansee = false;
// Profilage
$roles = ($user ? $user->getRoles() : ['ROLE_ANONYME']);
$groups = ($user ? $user->getGroups() : []);
// La page est-elle dans les pages associées au role de l'utilisateur ?
foreach ($roles as $role) {
$qb = $this->createQueryBuilder('page');
$qb->where($qb->expr()->like('page.roles', $qb->expr()->literal("%$role%")))
->andWhere('page.id=:id')
->andWhere('page.user is null')
->setParameter('id', $page->getId());
$inpagerole = $qb->getQuery()->getResult();
if ($inpagerole) {
$cansee = true;
}
}
// La page est-elle dans les pages associées aux groupes de l'utilisateur ?
foreach ($groups as $group) {
$qb = $this->createQueryBuilder('page');
$qb->where(':group MEMBER OF page.groups')
->andWhere('page.id=:id')
->setParameter('id', $page->getId())
->setParameter('group', $group->getGroup());
$inpagegroup = $qb->getQuery()->getResult();
if ($inpagegroup) {
$cansee = true;
// Est-il manager du groupe
if ($group->getGroup()->isIsworkgroup()) {
if ($group->getRolegroup() >= 90) {
$canupdate = true;
}
if ($group->getRolegroup() >= 50) {
$canadd = true;
}
}
}
}
}
}
public function clonePage($user, $template)
{
$page = new Page();
$page->setName($template->getName());
$page->setRoworder($template->getRoworder());
$page->setMaxwidth($template->getMaxwidth());
$page->setUrl($template->getUrl());
$page->setHtml($template->getHtml());
$page->setTemplate($template->getTemplate());
$page->setPagecategory($template->getPagecategory());
$page->setUser($user);
$page->setPage($template);
$this->getEntityManager()->persist($page);
$this->getEntityManager()->flush();
$widgets = $template->getPagewidgets();
foreach ($widgets as $widget) {
$pagewidget = new Pagewidget();
$pagewidget->setName($widget->getName());
$pagewidget->setLoc($widget->getLoc());
$pagewidget->setRoworder($widget->getRoworder());
$pagewidget->setHeight($widget->getHeight());
$pagewidget->setAutoajust($widget->isAutoajust());
$pagewidget->setBorder($widget->isBorder());
$pagewidget->setOpened($widget->isOpened());
$pagewidget->setViewheader($widget->isViewheader());
$pagewidget->setColorheaderback($widget->getColorheaderback());
$pagewidget->setColorheaderfont($widget->getColorheaderfont());
$pagewidget->setColorbodyback($widget->getColorbodyback());
$pagewidget->setColorbodyfont($widget->getColorbodyfont());
$pagewidget->setParameter($widget->getParameter());
$pagewidget->setPage($page);
$pagewidget->setWidget($widget->getWidget());
$pagewidget->setIcon($widget->getIcon());
$this->getEntityManager()->persist($pagewidget);
$this->getEntityManager()->flush();
// dupliquer slide et bookmarks ??
}
return $page;
}
private function firstkey($array)
{
foreach ($array as $key => $unused) {
return $key;
}
return null;
}
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Pagetype;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Pagetype|null find($id, $lockMode = null, $lockVersion = null)
* @method Pagetype|null findOneBy(array $criteria, array $orderBy = null)
* @method Pagetype[] findAll()
* @method Pagetype[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PagetypeRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Pagetype::class);
}
// /**
// * @return Pagetype[] Returns an array of Pagetype objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Pagetype
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

View File

@ -1,110 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Pagewidget;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Pagewidget>
*
* @method Pagewidget|null find($id, $lockMode = null, $lockVersion = null)
* @method Pagewidget|null findOneBy(array $criteria, array $orderBy = null)
* @method Pagewidget[] findAll()
* @method Pagewidget[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PagewidgetRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Pagewidget::class);
}
public function save(Pagewidget $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Pagewidget $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function getCansee($user, $pagewidget)
{
$cansee = false;
if (!$pagewidget) {
return $cansee;
}
$page = $pagewidget->getPage();
if (!$page) {
return $cansee;
}
// Si visiteur la page partage avec visitor ?
if (!$user) {
if ($page->getRoles() && in_array('ROLE_ANONYME', $page->getRoles())) {
$cansee = true;
}
} else {
// Si propriétaire de la page il peut voir
if ($page->getUser() == $user) {
$cansee = true;
}
// Si membre du groupe il peut voir
else {
foreach ($page->getGroups() as $group) {
$usergroup = $this->getEntityManager()->getRepository('App\Entity\UserGroup')->findoneby(['user' => $user, 'group' => $group]);
if ($usergroup) {
$cansee = true;
}
}
}
}
return $cansee;
}
public function getCanadd($user, $pagewidget, $usage)
{
$canadd = false;
if (!$pagewidget) {
return $canadd;
}
$page = $pagewidget->getPage();
if (!$page) {
return $canadd;
}
if ($user) {
// Si propriétaire de la page il peut ajouter
if ($page->getUser() == $user) {
$canadd = true;
}
// Si membre du groupe il peut ajouter
else {
foreach ($page->getGroups() as $group) {
$usergroup = $this->getEntityManager()->getRepository('App\Entity\UserGroup')->findoneby(['user' => $user, 'group' => $group]);
if ($usergroup and $usergroup->getRolegroup() >= 50) {
$canadd = true;
}
}
}
}
return $canadd;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Repository;
use App\Entity\Pin;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Pin|null find($id, $lockMode = null, $lockVersion = null)
* @method Pin|null findOneBy(array $criteria, array $orderBy = null)
* @method Pin[] findAll()
* @method Pin[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class PinRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Pin::class);
}
// /**
// * @return Pin[] Returns an array of Pin objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
/*
public function findOneBySomeField($value): ?Pin
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

Some files were not shown because too many files have changed in this diff Show More