diff --git a/.env b/.env index 8d812d1..2db0757 100755 --- a/.env +++ b/.env @@ -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= diff --git a/assets/styles/app.css b/assets/styles/app.css index 271a6af..6c784b1 100755 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -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); - background-color: var(--colorbgbodydark); - padding: 5px 10px; - display: inline-block; - cursor: pointer; +} + +.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); + 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); +} diff --git a/config/packages/oneup_uploader.yaml b/config/packages/oneup_uploader.yaml index a58840f..6a5410c 100755 --- a/config/packages/oneup_uploader.yaml +++ b/config/packages/oneup_uploader.yaml @@ -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: - frontend: dropzone + 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" + + + \ No newline at end of file diff --git a/config/routes.yaml b/config/routes.yaml index 9ad23c9..33c3135 100755 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -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_admin_alertcategory_update: - path: /admin/alertcategory/update/{id} - controller: App\Controller\AlertcategoryController::update - defaults: { access: admin } +app_typepage_upload: + path: /admin/pagetype/upload + defaults: { _controller: App\Controller\PagetypeController::upload } -app_admin_alertcategory_delete: - path: /admin/alertcategory/delete/{id} - controller: App\Controller\AlertcategoryController::delete - defaults: { access: admin } +app_typepage_selectlist: + path: /admin/pagetype/select + defaults: { _controller: App\Controller\PagetypeController::select } -#== ITEM ================================================================================================================================================= +app_typepage_home: + path: /pagetype/{id} + defaults: { _controller: App\Controller\PagetypeController::home } -#-- Access admin -app_admin_item: - path: /admin/item - controller: App\Controller\ItemController::list - defaults: { access: admin } +#== Page ==================================================================================================== +app_page: + path: /admin/page + defaults: { _controller: App\Controller\PageController::list } -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 } + defaults: { _controller: App\Controller\PageController::delete } -app_admin_page_portal_view: - path: /admin/page/view/{id} - controller: App\Controller\PageController::view - defaults: { access: admin, usage: portal } +app_page_selectlist: + path: /admin/page/select + defaults: { _controller: App\Controller\PageController::select } -app_admin_page_portal_order: - path: /admin/page/order - controller: App\Controller\PageController::order - defaults: { access: admin, usage: portal } +app_page_home: + path: /page + defaults: { _controller: App\Controller\PageController::home } -#-- Access all -# usage=user -app_all_page_user_submit: - path: /all/page/user/submit - controller: App\Controller\PageController::submit - defaults: { access: all, usage: user } +#== Pin ==================================================================================================== +app_pin: + path: /admin/pin + defaults: { _controller: App\Controller\PinController::list } -app_all_page_user_update: - path: /all/page/user/update/{id} - controller: App\Controller\PageController::update - defaults: { access: all, usage: user } +app_pin_submit: + path: /admin/pin/submit + defaults: { _controller: App\Controller\PinController::submit } -app_all_page_user_delete: - path: /all/page/user/delete/{id} - controller: App\Controller\PageController::delete - defaults: { access: all, usage: user } +app_pin_update: + path: /admin/pin/update/{id} + defaults: { _controller: App\Controller\PinController::update } -app_all_page_user_order: - path: /all/page/user/order - controller: App\Controller\PageController::order - defaults: { access: all, usage: user } +app_pin_delete: + path: /admin/pin/delete/{id} + defaults: { _controller: App\Controller\PinController::delete } -# usage=group -app_all_page_group_submit: - path: /all/page/group/submit - controller: App\Controller\PageController::submit - defaults: { access: all, usage: group } +app_pin_view: + path: /pin/{id} + defaults: { _controller: App\Controller\PinController::view } -app_all_page_group_update: - path: /all/page/group/update/{id} - controller: App\Controller\PageController::update - defaults: { access: all, usage: group } +app_pin_select: + path: /admin/pin/select + defaults: { _controller: App\Controller\PinController::select } -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 } +#== Child ======================================================================================================== +app_child_select: + path: /admin/child/select + defaults: { _controller: App\Controller\ChildController::select } -# usage=group -app_all_page_group_view: - path: /page/group/view/{id} - controller: App\Controller\PageController::view - defaults: { access: all, usage: group } +app_child: + path: /admin/child/{catparent}/{idparent} + defaults: { _controller: App\Controller\ChildController::list } -#-- Page spécifique -app_all_page_application: - path: /page/application - controller: App\Controller\PageController::application - defaults: { access: all } +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 } -#== PAGE WIDGET ========================================================================================================================================== +app_child_submit_file: + path: /admin/child/submit/{catparent}/{idparent}/{idchildtype}/file + defaults: { _controller: App\Controller\ChildController::submitfile } -#-- Access admin -app_admin_pagewidget_widget_sumbit: - path: /admin/pagewidget/submit/{idpage}/{idwidgettype} - controller: App\Controller\PagewidgetController::submit - defaults: { access: admin } +app_child_update: + path: /admin/child/update/{catparent}/{idparent}/{idchild} + defaults: { _controller: App\Controller\ChildController::update } -app_admin_pagewidget_widget_update: - path: /admin/pagewidget/update/{idpage}/{idwidget} - controller: App\Controller\PagewidgetController::update - defaults: { access: admin } +app_child_bind: + path: /admin/child/bind/{catparent}/{idparent} + defaults: { _controller: App\Controller\ChildController::bind } -app_admin_pagewidget_delete: - path: /admin/pagewidget/delete/{idwidget} - controller: App\Controller\PagewidgetController::delete - defaults: { access: admin } +app_child_ajaxbind: + path: /admin/child/ajaxbind/{catparent}/{idparent} + defaults: { _controller: App\Controller\ChildController::ajaxbind } -app_admin_pagewidget_order: - path: /admin/pagewidget/order - controller: App\Controller\PagewidgetController::order - defaults: { access: admin } +app_child_addbind: + path: /admin/child/addbind/{catparent}/{idparent} + defaults: { _controller: App\Controller\ChildController::addbind } -app_admin_pagewidget_ckeditor: - path: /admin/pagewidget/ckeditor/{idwidget} - controller: App\Controller\PagewidgetController::ckeditor - defaults: { access: admin } +app_child_delete: + path: /admin/child/delete/{catparent}/{idparent}/{idchild} + defaults: { _controller: App\Controller\ChildController::delete } -app_admin_pagewidget_view_url: - path: /admin/pagewidget/view/url/{id} - controller: App\Controller\PagewidgetController::viewurl - defaults: { access: admin } +app_child_upload: + path: /admin/child/upload/{catparent}/{idparent}/{idchild}/{type} + defaults: { _controller: App\Controller\ChildController::upload } -app_admin_pagewidget_view_urlfixe: - path: /admin/pagewidget/view/urlfixe/{id} - controller: App\Controller\PagewidgetController::viewurlfixe - defaults: { access: admin } +app_child_order: + path: /admin/child/order/{catparent}/{idparent} + defaults: { _controller: App\Controller\ChildController::order } -app_admin_pagewidget_view_item: - path: /admin/pagewidget/view/item/{id} - controller: App\Controller\PagewidgetController::viewitem - defaults: { access: admin } +app_child_search: + path: /search + defaults: { _controller: App\Controller\ChildController::search } -app_admin_pagewidget_view_itemessential: - path: /admin/pagewidget/view/itemessential/{id} - controller: App\Controller\PagewidgetController::viewitemessential - defaults: { access: admin } +app_child_json: + path: /child/json/{catparent}/{idparent}/{idchild} + defaults: { _controller: App\Controller\ChildController::restjson } -app_admin_pagewidget_view_alert: - path: /admin/pagewidget/view/alert/{id} - controller: App\Controller\PagewidgetController::viewalert - defaults: { access: admin } +app_child_view: + path: /child/{catparent}/{idparent}/{idchild} + defaults: { _controller: App\Controller\ChildController::view } -app_admin_pagewidget_view_flux: - path: /admin/pagewidget/view/flux/{id} - controller: App\Controller\PagewidgetController::viewflux - defaults: { access: admin } +#== Childheader ==================================================================================================== +app_childheader_submit: + path: /admin/childheader/submit/{idchild} + defaults: { _controller: App\Controller\ChildheaderController::submit } -app_admin_pagewidget_view_rss: - path: /admin/pagewidget/view/rss/{id} - controller: App\Controller\PagewidgetController::viewrss - defaults: { access: admin } +app_childheader_update: + path: /admin/childheader/update/{catparent}/{idparent}/{id} + defaults: { _controller: App\Controller\ChildheaderController::update } -app_admin_pagewidget_view_bookmark: - path: /admin/pagewidget/view/bookmark/{id} - controller: App\Controller\PagewidgetController::viewbookmark - defaults: { access: admin } +app_childheader_delete: + path: /admin/childheader/delete/{catparent}/{idparent}/{id} + defaults: { _controller: App\Controller\ChildheaderController::delete } -app_admin_pagewidget_view_link: - path: /admin/pagewidget/view/link/{id} - controller: App\Controller\PagewidgetController::viewlink - defaults: { access: admin } +app_childheader_select: + path: /admin/childheader/select/{idchild} + defaults: { _controller: App\Controller\ChildheaderController::select } -app_admin_pagewidget_view_editor: - path: /admin/pagewidget/view/editor/{id} - controller: App\Controller\PagewidgetController::vieweditor - defaults: { access: admin } +app_childheader_order: + path: /admin/childheader/order/{idchild} + defaults: { _controller: App\Controller\ChildheaderController::order } -app_admin_pagewidget_view_slide: - path: /admin/pagewidget/view/pagewidgetslide/{id} - controller: App\Controller\PagewidgetController::viewslide - defaults: { access: admin } +app_childheader_view: + path: /childheader/view/{id} + defaults: { _controller: App\Controller\ChildheaderController::view } -app_admin_pagewidget_view_file: - path: /admin/pagewidget/view/file/{id} - controller: App\Controller\PagewidgetController::viewfile - defaults: { access: admin } +#== Tag ==================================================================================================== +app_tag: + path: /admin/tag + defaults: { _controller: App\Controller\TagController::list } -app_admin_pagewidget_view_galery: - path: /admin/pagewidget/view/galery/{id} - controller: App\Controller\PagewidgetController::viewgalery - defaults: { access: admin } +app_tag_submit: + path: /admin/tag/submit + defaults: { _controller: App\Controller\TagController::submit } -app_admin_pagewidget_view_calendar: - path: /admin/pagewidget/view/calendar/{id} - controller: App\Controller\PagewidgetController::viewcalendar - defaults: { access: admin } +app_tag_delete: + path: /admin/tag/delete/{id} + defaults: { _controller: App\Controller\TagController::delete } -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 } - \ No newline at end of file +app_tag_select: + path: /admin/tag/select + defaults: { _controller: App\Controller\TagController::select } \ No newline at end of file diff --git a/config/services.yaml b/config/services.yaml index 16ade73..59aa561 100755 --- a/config/services.yaml +++ b/config/services.yaml @@ -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'] diff --git a/containers/hydra/clients.d/nineskeletor.json b/containers/hydra/clients.d/nineblog.json similarity index 86% rename from containers/hydra/clients.d/nineskeletor.json rename to containers/hydra/clients.d/nineblog.json index 4e66d72..e21c07b 100755 --- a/containers/hydra/clients.d/nineskeletor.json +++ b/containers/hydra/clients.d/nineblog.json @@ -1,6 +1,6 @@ { - "client_id": "nineskeletor", - "client_name": "Nineskeletor", + "client_id": "nineblog", + "client_name": "Nineblog", "client_secret": "changeme", "grant_types": [ "authorization_code", diff --git a/docker-compose.yml b/docker-compose.yml index 4a6a916..504b075 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/migrations/Version20230201080252.php b/migrations/Version20230201080252.php deleted file mode 100644 index 45f1554..0000000 --- a/migrations/Version20230201080252.php +++ /dev/null @@ -1,298 +0,0 @@ -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'); - } -} diff --git a/migrations/Version20230203163146.php b/migrations/Version20230203163146.php new file mode 100644 index 0000000..0768ec3 --- /dev/null +++ b/migrations/Version20230203163146.php @@ -0,0 +1,245 @@ +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'); + } +} diff --git a/migrations/Version20230203164540.php b/migrations/Version20230203164540.php new file mode 100644 index 0000000..4c385ee --- /dev/null +++ b/migrations/Version20230203164540.php @@ -0,0 +1,32 @@ +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'); + } +} diff --git a/public/medias/header/body.jpg b/public/medias/header/body.jpg new file mode 100644 index 0000000..1d46ae7 Binary files /dev/null and b/public/medias/header/body.jpg differ diff --git a/public/medias/logo/logo.png b/public/medias/logo/logo.png old mode 100755 new mode 100644 index db76093..7a70747 Binary files a/public/medias/logo/logo.png and b/public/medias/logo/logo.png differ diff --git a/public/themes/ninefulldark/style.css b/public/themes/ninefulldark/style.css index f70356a..0fa1477 100755 --- a/public/themes/ninefulldark/style.css +++ b/public/themes/ninefulldark/style.css @@ -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); } diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 125cded..92c7531 100755 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -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 @@ -250,6 +251,21 @@ class InitCommand extends Command '', // grouped "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( @@ -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(''.$string.''); diff --git a/src/Controller/AlertController.php b/src/Controller/AlertController.php deleted file mode 100644 index 57753fd..0000000 --- a/src/Controller/AlertController.php +++ /dev/null @@ -1,175 +0,0 @@ -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); - } -} diff --git a/src/Controller/AlertcategoryController.php b/src/Controller/AlertcategoryController.php deleted file mode 100644 index eead12b..0000000 --- a/src/Controller/AlertcategoryController.php +++ /dev/null @@ -1,124 +0,0 @@ -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')); - } -} diff --git a/src/Controller/BlogController.php b/src/Controller/BlogController.php new file mode 100644 index 0000000..813f110 --- /dev/null +++ b/src/Controller/BlogController.php @@ -0,0 +1,175 @@ +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()); + } + } + } +} diff --git a/src/Controller/BlogtypeController.php b/src/Controller/BlogtypeController.php new file mode 100644 index 0000000..8b8e972 --- /dev/null +++ b/src/Controller/BlogtypeController.php @@ -0,0 +1,172 @@ +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()); + } + } + } +} diff --git a/src/Controller/BookmarkController.php b/src/Controller/BookmarkController.php deleted file mode 100644 index ee9e300..0000000 --- a/src/Controller/BookmarkController.php +++ /dev/null @@ -1,236 +0,0 @@ -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); - } -} diff --git a/src/Controller/ChildController.php b/src/Controller/ChildController.php new file mode 100644 index 0000000..d56f4f3 --- /dev/null +++ b/src/Controller/ChildController.php @@ -0,0 +1,829 @@ +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()); + } + } + } +} diff --git a/src/Controller/ChildheaderController.php b/src/Controller/ChildheaderController.php new file mode 100644 index 0000000..f72a4c0 --- /dev/null +++ b/src/Controller/ChildheaderController.php @@ -0,0 +1,161 @@ +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()); + } + } + } +} diff --git a/src/Controller/ConfigController.php b/src/Controller/ConfigController.php index 9ab4249..d05e14f 100755 --- a/src/Controller/ConfigController.php +++ b/src/Controller/ConfigController.php @@ -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'); + } } diff --git a/src/Controller/CropController.php b/src/Controller/CropController.php index b25a67a..f5c66fc 100755 --- a/src/Controller/CropController.php +++ b/src/Controller/CropController.php @@ -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) { diff --git a/src/Controller/FileController.php b/src/Controller/FileController.php deleted file mode 100644 index 0d94f55..0000000 --- a/src/Controller/FileController.php +++ /dev/null @@ -1,721 +0,0 @@ -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; - } - } -} diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 47c1f25..0fe38fa 100755 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -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'); + return $this->render('Home/home.html.twig', [ + 'useheader' => false, + 'usemenu' => true, + 'usesidebar' => false, + 'maxsize' => 1000, + ]); - // 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, - 'usesidebar' => false, - 'maxsize' => 1000, - ]); - } if ($this->getUser()->hasRole('ROLE_USER')) { return $this->redirectToRoute('app_user_home'); } diff --git a/src/Controller/IconController.php b/src/Controller/IconController.php deleted file mode 100644 index eb8f640..0000000 --- a/src/Controller/IconController.php +++ /dev/null @@ -1,180 +0,0 @@ -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, - ]); - } -} diff --git a/src/Controller/ItemController.php b/src/Controller/ItemController.php deleted file mode 100644 index 4e71526..0000000 --- a/src/Controller/ItemController.php +++ /dev/null @@ -1,160 +0,0 @@ -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); - } -} diff --git a/src/Controller/ItemcategoryController.php b/src/Controller/ItemcategoryController.php deleted file mode 100644 index 91342db..0000000 --- a/src/Controller/ItemcategoryController.php +++ /dev/null @@ -1,129 +0,0 @@ -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); - } -} diff --git a/src/Controller/MenuController.php b/src/Controller/MenuController.php new file mode 100644 index 0000000..2c87c91 --- /dev/null +++ b/src/Controller/MenuController.php @@ -0,0 +1,192 @@ +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()); + } + } + } +} diff --git a/src/Controller/MinioController.php b/src/Controller/MinioController.php index 36fada7..596657f 100755 --- a/src/Controller/MinioController.php +++ b/src/Controller/MinioController.php @@ -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; diff --git a/src/Controller/PageController.php b/src/Controller/PageController.php index 13460b8..e0d3b95 100644 --- a/src/Controller/PageController.php +++ b/src/Controller/PageController.php @@ -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.="$data->getId()))."'>"; - $action .= " $data->getId()])."'>"; - $action .= " $data->getId()])."'>"; - $action .= " $data->getId()])."' data-method='delete'>"; - - $user = ''; - if ($data->getUser()) { - $user .= " 'avatar/'.$data->getUser()->getAvatar()])."' class='avatar' style='margin:0px 5px 0px 0px;display:inline-block;'>"; - $user .= $data->getUser()->getUsername(); - } - - $icon = ''; - if ($data->getFonticon()) { - $icon .= " "; - } - - 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()->flush(); - $route = str_replace('_admin_', '_'.$access.'_', $this->route); - $route = str_replace('_usage', '_'.$usage, $route); + $em->getManager()->persist($data); + $em->getManager()->flush(); - 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', [ - 'useheader' => true, - 'usemenu' => false, - 'usesidebar' => ('admin' == $access), - 'maxwidth' => ('all' == $access), - $this->data => $entity, - 'access' => $access, - 'usage' => $usage, - 'mode' => 'update', - 'form' => $form->createView(), - ]); - } - // 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(), - ]); - } + // 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, $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) { - $output = []; - $id = $request->request->get('id'); - $order = $request->request->get('order'); + $heros = $em->getRepository($this->entity)->findBy(['ishead' => true], ['submitdate' => 'DESC']); + $pages = $em->getRepository($this->entity)->findBy([], ['submitdate' => 'DESC']); - $entity = $em->getRepository($this->entity)->find($id); - if (!$entity) { - throw $this->createNotFoundException('Unable to find entity.'); - } - - // 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'); - } - } - - $entity->setRoworder($order); - $em->getManager()->flush(); - - return new JsonResponse($output); - } - - public function view($id, $access, $usage, Request $request, ManagerRegistry $em): Response - { - $entity = $em->getRepository($this->entity)->find($id); - if (!$entity) { - return $this->redirect($this->generateUrl('app_home')); - } - - // 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')); - } - } - - // Type Calendrier - if (-100 == $entity->getPageCategory()->getId()) { - $entity->setUrl($this->generateUrl('app_user_calendar_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 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, + return $this->render($this->render.'home.html.twig', [ + 'useheader' => true, + 'usesidebar' => false, + 'heros' => $heros, + 'pages' => $pages, ]); } - protected function getPreference($user, $key, $id, $default) + public function select(Request $request, ManagerRegistry $em) { - $preference = $user->getPreference(); - $return = $default; + $output = []; + $page_limit = $request->query->get('page_limit'); + $q = $request->query->get('q'); - if (is_array($preference)) { - if (array_key_exists($key, $preference)) { - if (array_key_exists($id, $preference[$key])) { - $return = $preference[$key][$id]; - } - } + $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()]); } - return $return; + $ret_string['results'] = $output; + + return new JsonResponse($ret_string); } - protected function setPreference($user, $key, $id, $value) + protected function getErrorForm($id, $form, $request, $data, $mode) { - $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; + if ($form->get('submit')->isClicked() && 'delete' == $mode) { } - // Mise à jour des préferences - if ($toupdate) { - $em = $this->getDoctrine()->getManager(); - $user->setPreference($preference); - $em->persist($this->getUser()); - $em->flush(); + 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()); + } } } } diff --git a/src/Controller/PagetemplateController.php b/src/Controller/PagetemplateController.php deleted file mode 100644 index c4a5496..0000000 --- a/src/Controller/PagetemplateController.php +++ /dev/null @@ -1,286 +0,0 @@ -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 .= " $data->getId()])."'>"; - $action .= " $data->getId()])."'>"; - - 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' => '', - ]); - } -} diff --git a/src/Controller/PagetypeController.php b/src/Controller/PagetypeController.php new file mode 100644 index 0000000..c586d4a --- /dev/null +++ b/src/Controller/PagetypeController.php @@ -0,0 +1,174 @@ +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()); + } + } + } +} diff --git a/src/Controller/PagewidgetController.php b/src/Controller/PagewidgetController.php deleted file mode 100644 index 4533064..0000000 --- a/src/Controller/PagewidgetController.php +++ /dev/null @@ -1,958 +0,0 @@ -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, - ]); - } -} diff --git a/src/Controller/PagewidgetslideController.php b/src/Controller/PagewidgetslideController.php deleted file mode 100644 index 2f1133b..0000000 --- a/src/Controller/PagewidgetslideController.php +++ /dev/null @@ -1,223 +0,0 @@ -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, - ]); - } -} diff --git a/src/Controller/PinController.php b/src/Controller/PinController.php new file mode 100644 index 0000000..5c78664 --- /dev/null +++ b/src/Controller/PinController.php @@ -0,0 +1,187 @@ +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()); + } + } + } +} diff --git a/src/Controller/TagController.php b/src/Controller/TagController.php new file mode 100644 index 0000000..bcc7bf1 --- /dev/null +++ b/src/Controller/TagController.php @@ -0,0 +1,137 @@ +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()); + } + } + } +} diff --git a/src/Entity/Alert.php b/src/Entity/Alert.php deleted file mode 100755 index 67a06c9..0000000 --- a/src/Entity/Alert.php +++ /dev/null @@ -1,413 +0,0 @@ -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; - } -} diff --git a/src/Entity/Alertcategory.php b/src/Entity/Alertcategory.php deleted file mode 100755 index 9bc7682..0000000 --- a/src/Entity/Alertcategory.php +++ /dev/null @@ -1,175 +0,0 @@ -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; - } -} diff --git a/src/Entity/Audit.php b/src/Entity/Audit.php index 6a3e46b..5457768 100755 --- a/src/Entity/Audit.php +++ b/src/Entity/Audit.php @@ -2,6 +2,7 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; /** diff --git a/src/Entity/Blog.php b/src/Entity/Blog.php new file mode 100644 index 0000000..40c1a68 --- /dev/null +++ b/src/Entity/Blog.php @@ -0,0 +1,201 @@ +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 + */ + 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 + */ + 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; + } + +} diff --git a/src/Entity/Blogtype.php b/src/Entity/Blogtype.php new file mode 100644 index 0000000..961da4c --- /dev/null +++ b/src/Entity/Blogtype.php @@ -0,0 +1,180 @@ +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 + */ + 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 + */ + 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; + } +} diff --git a/src/Entity/Bookmark.php b/src/Entity/Bookmark.php deleted file mode 100755 index 71053e5..0000000 --- a/src/Entity/Bookmark.php +++ /dev/null @@ -1,337 +0,0 @@ -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; - } -} diff --git a/src/Entity/Child.php b/src/Entity/Child.php new file mode 100644 index 0000000..68be8be --- /dev/null +++ b/src/Entity/Child.php @@ -0,0 +1,404 @@ +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 + */ + 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 + */ + 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 + */ + 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; + } + +} diff --git a/src/Entity/Childheader.php b/src/Entity/Childheader.php new file mode 100644 index 0000000..b7192ad --- /dev/null +++ b/src/Entity/Childheader.php @@ -0,0 +1,94 @@ +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; + } +} diff --git a/src/Entity/Childtype.php b/src/Entity/Childtype.php new file mode 100644 index 0000000..c41e3bb --- /dev/null +++ b/src/Entity/Childtype.php @@ -0,0 +1,216 @@ +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; + } +} diff --git a/src/Entity/Config.php b/src/Entity/Config.php index 3dae3f8..074f226 100755 --- a/src/Entity/Config.php +++ b/src/Entity/Config.php @@ -2,6 +2,7 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; /** diff --git a/src/Entity/Cron.php b/src/Entity/Cron.php index 68f4f80..3986140 100755 --- a/src/Entity/Cron.php +++ b/src/Entity/Cron.php @@ -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; diff --git a/src/Entity/Group.php b/src/Entity/Group.php index 3238587..f5936ec 100755 --- a/src/Entity/Group.php +++ b/src/Entity/Group.php @@ -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 - */ - 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 - */ - 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 - */ - 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; - } } diff --git a/src/Entity/Icon.php b/src/Entity/Icon.php deleted file mode 100755 index 4ddbb74..0000000 --- a/src/Entity/Icon.php +++ /dev/null @@ -1,400 +0,0 @@ -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; - } -} diff --git a/src/Entity/Item.php b/src/Entity/Item.php deleted file mode 100755 index ebc4006..0000000 --- a/src/Entity/Item.php +++ /dev/null @@ -1,359 +0,0 @@ -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 - */ - 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 - */ - 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; - } -} diff --git a/src/Entity/Itemcategory.php b/src/Entity/Itemcategory.php deleted file mode 100755 index 424a2c0..0000000 --- a/src/Entity/Itemcategory.php +++ /dev/null @@ -1,213 +0,0 @@ -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; - } -} diff --git a/src/Entity/Menu.php b/src/Entity/Menu.php new file mode 100644 index 0000000..b956fd8 --- /dev/null +++ b/src/Entity/Menu.php @@ -0,0 +1,93 @@ +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 + */ + 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; + } +} diff --git a/src/Entity/Menuchild.php b/src/Entity/Menuchild.php new file mode 100644 index 0000000..3d90724 --- /dev/null +++ b/src/Entity/Menuchild.php @@ -0,0 +1,145 @@ +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; + } +} diff --git a/src/Entity/Niveau01.php b/src/Entity/Niveau01.php index 5cc3e1c..f0cc6e0 100755 --- a/src/Entity/Niveau01.php +++ b/src/Entity/Niveau01.php @@ -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; diff --git a/src/Entity/Niveau02.php b/src/Entity/Niveau02.php index fcd93d1..9dd71df 100755 --- a/src/Entity/Niveau02.php +++ b/src/Entity/Niveau02.php @@ -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; diff --git a/src/Entity/Niveau03.php b/src/Entity/Niveau03.php index 01c538a..0083c92 100755 --- a/src/Entity/Niveau03.php +++ b/src/Entity/Niveau03.php @@ -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; diff --git a/src/Entity/Niveau04.php b/src/Entity/Niveau04.php index b2411f2..bfec68e 100755 --- a/src/Entity/Niveau04.php +++ b/src/Entity/Niveau04.php @@ -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; diff --git a/src/Entity/Page.php b/src/Entity/Page.php old mode 100755 new mode 100644 index 174745f..b696e19 --- a/src/Entity/Page.php +++ b/src/Entity/Page.php @@ -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 */ - 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 */ - 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; - } - - /** - * Set html. - * - * @param string $html - * - * @return Page - */ - public function setHtml($html) - { - $this->html = $html; + if ($this->menuchilds->removeElement($menuchild)) { + // set the owning side to null (unless already changed) + if ($menuchild->getPage() === $this) { + $menuchild->setPage(null); + } + } 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; - } } diff --git a/src/Entity/Pagecategory.php b/src/Entity/Pagecategory.php deleted file mode 100755 index a26cae4..0000000 --- a/src/Entity/Pagecategory.php +++ /dev/null @@ -1,119 +0,0 @@ -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; - } -} diff --git a/src/Entity/Pagetype.php b/src/Entity/Pagetype.php new file mode 100644 index 0000000..295f174 --- /dev/null +++ b/src/Entity/Pagetype.php @@ -0,0 +1,180 @@ +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 + */ + 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 + */ + 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; + } +} diff --git a/src/Entity/Pagewidget.php b/src/Entity/Pagewidget.php deleted file mode 100755 index 4b96efe..0000000 --- a/src/Entity/Pagewidget.php +++ /dev/null @@ -1,420 +0,0 @@ -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 - */ - 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 - */ - 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; - } -} diff --git a/src/Entity/Pagewidgetslide.php b/src/Entity/Pagewidgetslide.php deleted file mode 100644 index 361d990..0000000 --- a/src/Entity/Pagewidgetslide.php +++ /dev/null @@ -1,158 +0,0 @@ -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; - } -} diff --git a/src/Entity/Pin.php b/src/Entity/Pin.php new file mode 100644 index 0000000..78d052e --- /dev/null +++ b/src/Entity/Pin.php @@ -0,0 +1,161 @@ +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; + } +} diff --git a/src/Entity/Registration.php b/src/Entity/Registration.php index b8d2580..1565aad 100755 --- a/src/Entity/Registration.php +++ b/src/Entity/Registration.php @@ -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; diff --git a/src/Entity/Tag.php b/src/Entity/Tag.php new file mode 100644 index 0000000..ae7b712 --- /dev/null +++ b/src/Entity/Tag.php @@ -0,0 +1,74 @@ +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; + } +} diff --git a/src/Entity/User.php b/src/Entity/User.php index 1f5c732..04a4c40 100755 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -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 - */ - 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; - } } diff --git a/src/Entity/UserGroup.php b/src/Entity/UserGroup.php index 4ddec36..956d2d7 100755 --- a/src/Entity/UserGroup.php +++ b/src/Entity/UserGroup.php @@ -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; diff --git a/src/Entity/Widget.php b/src/Entity/Widget.php deleted file mode 100755 index de1f2d5..0000000 --- a/src/Entity/Widget.php +++ /dev/null @@ -1,385 +0,0 @@ -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 - */ - 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; - } -} diff --git a/src/EventListener/PurgefileSubscriber.php b/src/EventListener/PurgefileSubscriber.php deleted file mode 100755 index 5990b7a..0000000 --- a/src/EventListener/PurgefileSubscriber.php +++ /dev/null @@ -1,73 +0,0 @@ -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) { - } - } - } -} diff --git a/src/Form/AlertType.php b/src/Form/AlertType.php deleted file mode 100644 index 8331f90..0000000 --- a/src/Form/AlertType.php +++ /dev/null @@ -1,117 +0,0 @@ -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', - ]); - } -} diff --git a/src/Form/AlertcategoryType.php b/src/Form/AlertcategoryType.php deleted file mode 100644 index d1e1367..0000000 --- a/src/Form/AlertcategoryType.php +++ /dev/null @@ -1,47 +0,0 @@ -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', - ]); - } -} diff --git a/src/Form/IconType.php b/src/Form/BlogType.php similarity index 53% rename from src/Form/IconType.php rename to src/Form/BlogType.php index eb00723..c6ad484 100644 --- a/src/Form/IconType.php +++ b/src/Form/BlogType.php @@ -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', ]); } } diff --git a/src/Form/BlogtypeType.php b/src/Form/BlogtypeType.php new file mode 100644 index 0000000..0dc2e82 --- /dev/null +++ b/src/Form/BlogtypeType.php @@ -0,0 +1,53 @@ +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', + ]); + } +} diff --git a/src/Form/BookmarkType.php b/src/Form/BookmarkType.php deleted file mode 100755 index 9ecc749..0000000 --- a/src/Form/BookmarkType.php +++ /dev/null @@ -1,64 +0,0 @@ -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, - ]); - } -} diff --git a/src/Form/ChildType.php b/src/Form/ChildType.php new file mode 100644 index 0000000..ad718cc --- /dev/null +++ b/src/Form/ChildType.php @@ -0,0 +1,100 @@ +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', + ]); + } +} diff --git a/src/Form/ItemcategoryType.php b/src/Form/ChildheaderType.php similarity index 64% rename from src/Form/ItemcategoryType.php rename to src/Form/ChildheaderType.php index 5439656..9a15523 100644 --- a/src/Form/ItemcategoryType.php +++ b/src/Form/ChildheaderType.php @@ -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', ]); } } diff --git a/src/Form/ItemType.php b/src/Form/ItemType.php deleted file mode 100644 index 144a96a..0000000 --- a/src/Form/ItemType.php +++ /dev/null @@ -1,128 +0,0 @@ -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, - ]); - } -} diff --git a/src/Form/MenuchildType.php b/src/Form/MenuchildType.php new file mode 100644 index 0000000..bf7d4d6 --- /dev/null +++ b/src/Form/MenuchildType.php @@ -0,0 +1,104 @@ +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', + ]); + } +} diff --git a/src/Form/PageSubmitType.php b/src/Form/PageSubmitType.php deleted file mode 100644 index c224d1b..0000000 --- a/src/Form/PageSubmitType.php +++ /dev/null @@ -1,148 +0,0 @@ -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', - ]); - } -} diff --git a/src/Form/PagetemplateSubmitType.php b/src/Form/PageType.php similarity index 52% rename from src/Form/PagetemplateSubmitType.php rename to src/Form/PageType.php index 11c972a..149f914 100644 --- a/src/Form/PagetemplateSubmitType.php +++ b/src/Form/PageType.php @@ -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', ]); } } diff --git a/src/Form/PageUpdateWidgetType.php b/src/Form/PageUpdateWidgetType.php deleted file mode 100644 index 5af684f..0000000 --- a/src/Form/PageUpdateWidgetType.php +++ /dev/null @@ -1,114 +0,0 @@ -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', - ]); - } -} diff --git a/src/Form/PagewidgetckeditorType.php b/src/Form/PagetypeType.php similarity index 54% rename from src/Form/PagewidgetckeditorType.php rename to src/Form/PagetypeType.php index 0ea0306..418bc1e 100644 --- a/src/Form/PagewidgetckeditorType.php +++ b/src/Form/PagetypeType.php @@ -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', ]); } } diff --git a/src/Form/PagewidgetType.php b/src/Form/PagewidgetType.php deleted file mode 100644 index 864be8a..0000000 --- a/src/Form/PagewidgetType.php +++ /dev/null @@ -1,247 +0,0 @@ -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', - ]); - } -} diff --git a/src/Form/PagewidgetslideType.php b/src/Form/PinType.php similarity index 51% rename from src/Form/PagewidgetslideType.php rename to src/Form/PinType.php index 7013c26..8a887e6 100644 --- a/src/Form/PagewidgetslideType.php +++ b/src/Form/PinType.php @@ -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', ]); } diff --git a/src/Form/TagType.php b/src/Form/TagType.php new file mode 100644 index 0000000..406c52a --- /dev/null +++ b/src/Form/TagType.php @@ -0,0 +1,51 @@ +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', + ]); + } +} diff --git a/src/Form/Type/FaChoiceType.php b/src/Form/Type/FaChoiceType.php deleted file mode 100644 index 24e0d18..0000000 --- a/src/Form/Type/FaChoiceType.php +++ /dev/null @@ -1,74 +0,0 @@ -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 + {% for childtype in childtypes %} + + {% endfor %} + + + + + + +{% endblock %} + +{% block localscript %} + +{% endblock %} + diff --git a/templates/Child/search.html.twig b/templates/Child/search.html.twig new file mode 100644 index 0000000..9bfa2ab --- /dev/null +++ b/templates/Child/search.html.twig @@ -0,0 +1,387 @@ +{% extends "base.html.twig" %} +{% block localstyle %} + +{% endblock %} + +{% block body %} + +
+
+
+ + + + + + + + + + + {% if is_granted('ROLE_ADMIN') %} + + + {% endif %} +
+ +
+
+
+
+ + +
+
+ + + +
+
+ + +
+
+
+
+
+ +
+ {% set idchildtype=-100 %} + {% set idparent=-100 %} + {% set tbtag=[] %} + {% set tbname=[] %} + + {% for child in childs %} + {% if loop.first %} +

{{ child.childtype.name|replace({"Embed ":""}) }}

+ + {% if not nopagination %} +
+ {% endif %} + + {% if not isalpha and child.childtype.id!=30 %} +
+
+
+ {% endif %} + {% endif %} + + {% if isalpha or child.childtype.id==30 %} + {% if child.idparent != idparent %} + {% if not loop.first %}
{% endif %} +

{{ child.nameparent }}

+
+
+
+ {% set idparent=child.idparent %} + {% set tbname = tbname|merge({("MAP"~child.idparent):child.nameparent}) %} + {% endif %} + {% endif %} + + {% set tagsclass="" %} + {% for tag in child.tags %} + {% set tagid=tag.id|replace({" ":""}) %} + {% if tag.id not in tbtag %} + {% set tbtag = tbtag|merge({(tagid):tag.id}) %} + {% endif %} + {% set tagsclass=tagsclass~" tag-"~tagid %} + {%endfor%} + + {% if child.childtype.id==10 %} + + {% set url = "/"~appAlias~"/uploads/child/"~child.id~"/"~child.filename %} +

{{ child.name }}

+ En savoir plus + + + + {% elseif child.childtype.id==12 or child.childtype.id==13 or child.childtype.id==30 %} + {% if child.childtype.id==12 or child.childtype.id==30 %} + {% set background="/"~appAlias~"/uploads/child/"~child.id~"/thumb/"~child.filename %} + {% else %} + {% set background=child.url %} + {% endif %} + + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + +
+
+
+ {% elseif child.childtype.id==16 or child.childtype.id==17 %} + {% set style="" %} + {%if child.image %} + {% set background=child.image|replace({"**appAlias**":appAlias}) %} + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + {% else %} + + {%endif%} + +
+
+
{{ child.name }}
+
+
+
+ {%else%} + {% set style="" %} + {%if child.image %} + {% set background=child.image|replace({"**appAlias**":appAlias}) %} + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + {%endif%} + +
+
+
{{ child.name }}
+
+
+
+ {% endif %} + + {% if loop.last %} +
+ {% endif %} + {%endfor%} + + {% if not nopagination %} +
+ {% endif %} +
+
+
+ {% if isalpha %} + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z +

+ {% endif %} + + {% if isalpha %} +
+ Afficher Tout + {% for key, name in tbname %} + {{name}} + {% endfor %} +
+ {%else%} + Afficher Tout + {% for key, tag in tbtag %} + {{tag}} + {% endfor %} + {%endif%} +
+
+
+{% endblock %} + +{% block localscript %} + +{% endblock %} diff --git a/templates/Child/upload.html.twig b/templates/Child/upload.html.twig new file mode 100644 index 0000000..ee9ff78 --- /dev/null +++ b/templates/Child/upload.html.twig @@ -0,0 +1,80 @@ +{% extends 'base.html.twig' %} + +{% block encoretags %} + {{ encore_entry_link_tags('dropzone') }} +{% endblock %} + + +{% block body %} +

+ Upload child{% if typeupload!="all" %} = {{ typeupload }}{%endif%} +

+ + {% if idchild is defined %} + Annuler + {% else %} + Annuler + {% endif %} + +
+
+{% endblock %} + + +{% block localscript %} +{{ encore_entry_script_tags('dropzone') }} + + +{% endblock %} \ No newline at end of file diff --git a/templates/Child/video.html.twig b/templates/Child/video.html.twig new file mode 100644 index 0000000..9f3500e --- /dev/null +++ b/templates/Child/video.html.twig @@ -0,0 +1,115 @@ + +{% extends 'base.html.twig' %} + +{% block title %}{{app.session.get("appname")}} - {{child.name}}{% endblock %} + +{% block useractions %} + {% if is_granted('ROLE_ADMIN') %} +
  • + +
  • + {% endif %} +{% endblock %} + +{% block body %} +

    {{child.name}}

    + {% if child.subname %}
    {{child.subname}}
    {% endif %} + +
    + {% if child.childtype.id==14 or child.childtype.id==18 %} + {% set url = "/"~appAlias~"/uploads/child/"~child.id~"/"~child.filename %} + + {% elseif child.childtype.id==10 %} + {% set url = "/"~appAlias~"/uploads/child/"~child.id~"/"~child.filename %} + + {% else %} + + {% endif %} +
    + + {% for attributorder in child.childtype.childtypeattributs %} + {% if attributorder.childattribut.name in child.attributs|keys and not child.attributs[attributorder.childattribut.name] is empty %} + {{ attributorder.childattribut.label }} = {{ child.attributs[attributorder.childattribut.name]}}
    + {% endif %} + {% endfor %} + +
    {{child.description|raw}}
    + + {% set separator="g" %} + {%if otherpages %} +
    + + {% if separator=="d" %} {% set separator="g" %} {%else%} {% set separator="d" %} {%endif%} +
    + +
    +

    Articles associés

    +
    +
    +
    + {% for page in otherpages %} + {% set style="" %} + {%if page.image %} + {% set background=page.image|replace({"**appAlias**":appAlias}) %} + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + {%endif%} + +
    +
    +
    {{ page.name }}
    +
    +
    +
    + {% endfor %} +
    +
    + {% endif %} +{% endblock %} + +{% block localscript %} + +{% endblock %} + + + diff --git a/templates/Child/view.html.twig b/templates/Child/view.html.twig new file mode 100644 index 0000000..661a759 --- /dev/null +++ b/templates/Child/view.html.twig @@ -0,0 +1,240 @@ + +{% extends 'base.html.twig' %} + +{% block title %}{{app.session.get("appname")}} - {{child.name}}{% endblock %} + +{% block menuuser %} + {% if is_granted('ROLE_ADMIN') %} +
  • + +
  • + {% endif %} +{% endblock %} + +{% block beforebody %} + {% if not child.childheaders is empty %} + + {% endif %} +{% endblock %} + +{% block body %} + {% set haveside=true %} + {% if catparent!="blog" and + child.tags is empty and + contacts is empty and + ressources is empty and + links is empty %} + {% set haveside=false %} + {% endif %} + + {%if pages and pages|length > 1%} +
    + {% for page in pages %} + + {{ page.name }} + + {% endfor %} +
    + {% endif %} + +
    + {%if haveside %} +
    +
    + {% endif %} + +

    {{child.name}}

    + {% if child.subname %}
    {{child.subname}}
    {% endif %} + +
    +
    + {% if child.childtype.haveurl and child.url %}Site = {{child.url}}
    {%endif%} +
    + +
    + {{child.description|raw}} +
    + + {% if images %} +
    +

    Galerie Photos

    +
    +
    +
    + {% for image in images %} + {% if image.childtype.id==12 %} + {% set background=path("app_minio_image",{file:"child/"~image.id~"/thumb/"~image.filename}) %} + {% else %} + {% set background=image.url %} + {% endif %} + + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + + {% endfor %} +
    +
    + {% endif %} + + {% if videos %} +
    +

    Videos

    +
    + {% for video in videos %} + {% if video.childtype.id==14 %} + {% set url = path("app_minio_image",{file:"child/"~video.id~"/"~video.filename }) %} + + {% else %} + + {% endif %} + {% endfor %} +
    +
    + {% endif %} + + {% if bibliographys %} +
    + + {% if separator=="d" %} {% set separator="g" %} {%else%} {% set separator="d" %} {%endif%} +
    + + + {% endif %} +
    + + {% if haveside %} +
    +
    +
    + {% if not child.tags is empty %} +
    + {% for tag in child.tags %} + {% if loop.first %} +

    Tags

    + {%endif%} + + {{tag.id}} + {% endfor %} +
    + {% endif %} + +
    +

    Autres Publications

    + {% for otherchidblog in child.childblogs[0].blog.childblogs[0] %} + {{otherchidblog.child.name}}
    + {% endfor %} +
    + {% if not ressources is empty %} +
    +

    Ressources

    + {% for ressource in ressources %} + {% if ressource.childtype.id==16 %} + {% set filename="/"~appAlias~"/uploads/child/"~ressource.id~"/"~ressource.filename %} + {% else %} + {% set filename=ressource.url %} + {% endif %} + + +
    + +
    + {{ ressource.name}}
    + {{ ressource.subname}} +
    +
    +
    + {% endfor %} +
    + {% endif %} + + {% if not links is empty %} + + {% endif %} +
    + + {% if is_granted('ROLE_ADMIN') %} +
    + + {% if not parent.externalcode is empty %} + {{parent.externalcode}} = {{parent.externalid}}
    + {%endif%} +
    +
    +
    + {% endif %} +
    +
    + {% endif %} + +
    +{% endblock %} + + + diff --git a/templates/Itemcategory/edit.html.twig b/templates/Childheader/edit.html.twig old mode 100755 new mode 100644 similarity index 65% rename from templates/Itemcategory/edit.html.twig rename to templates/Childheader/edit.html.twig index 1445def..6e325a9 --- a/templates/Itemcategory/edit.html.twig +++ b/templates/Childheader/edit.html.twig @@ -1,27 +1,30 @@ + {% extends 'base.html.twig' %} {% block body %} {{ form_start(form) }}

    - {% if mode=="update" %} - Modification Catégorie d'Item = {{itemcategory.label}} - {% elseif mode=="submit" %} - Création Catégorie d'Item + {% if mode=="submit" %} + Création tag + {% else %} + Modification tag {% endif %}

    -

    - {{ form_widget(form.submit) }} - Annuler + {{ form_widget(form.submit) }} + + Annuler + {% if mode=="update" %} - + data-confirm="Êtes-vous sûr de vouloir supprimer cet enregistrement ?"> Supprimer - {% endif %} -

    + {% endif %} + +

    {% if app.session.flashbag.has('error') %}
    @@ -40,21 +43,20 @@ {% endfor %}
    {% endif %} - +
    Informations
    - {{ form_row(form.label) }} + {{ form_row(form.credit) }}
    - - - {{ form_end(form) }} {% endblock %} -{% block localjavascript %} -{% endblock %} + + + + diff --git a/templates/Childheader/image.html.twig b/templates/Childheader/image.html.twig new file mode 100644 index 0000000..417abf9 --- /dev/null +++ b/templates/Childheader/image.html.twig @@ -0,0 +1,64 @@ + +{% extends 'base.html.twig' %} + +{% block body %} + {% set url="/"~appAlias~"/uploads/childheader/"~childheader.child.id~"/"~childheader.filename|replace({"thumb_":""}) %} + + +{% endblock %} + +{% block localscript %} + +{% endblock %} + + + diff --git a/templates/Config/edit.html.twig b/templates/Config/edit.html.twig index 2d0f09b..fc0e13e 100755 --- a/templates/Config/edit.html.twig +++ b/templates/Config/edit.html.twig @@ -16,7 +16,7 @@ {% if mode=="update" and not config.required %} Supprimer @@ -68,6 +68,11 @@ Modifier + {% elseif config.type=="image" %} +
    + + Modifier +
    {% endif %} {{ form_row(form.help) }} diff --git a/templates/Icon/upload.html.twig b/templates/Config/image.html.twig similarity index 70% rename from templates/Icon/upload.html.twig rename to templates/Config/image.html.twig index 09d8eac..ab5ea9a 100755 --- a/templates/Icon/upload.html.twig +++ b/templates/Config/image.html.twig @@ -1,4 +1,4 @@ -{% extends 'base.html.twig' %} +{% extends "base.html.twig" %} {% block encoretags %} {{ encore_entry_link_tags('dropzone') }} @@ -8,7 +8,7 @@ Annuler
    {% endblock %} - - {% block localscript %} {{ encore_entry_script_tags('dropzone') }} - -{% endblock %} diff --git a/templates/File/list.html.twig b/templates/File/list.html.twig deleted file mode 100644 index 6c5c61f..0000000 --- a/templates/File/list.html.twig +++ /dev/null @@ -1,346 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} -{% block body %} - -
    - - - -
    - -
    - {% for dir in folders %} -
    -
    -
    - - - -
    -

    {{ dir.basename }}

    -
    -
    - -
    - {% if canadd %} - {% if fgtrash %} - - - - - - - - {% else %} - - - - - {% endif %} - {% endif %} -
    -
    -
    -
    - {% endfor %} - - {% for file in files %} -
    -
    -
    - - - -
    -

    {{ file.basename }}

    -
    le {{ file.LastModified|date("d/m/Y H:i")}}
    -
    -
    - -
    - {% if canadd %} - {% if fgtrash %} - - - - - - - - {% else %} - - - - - {% endif %} - {% endif %} -
    -
    -
    -
    - {% endfor %} -
    - - - -{% endblock %} - - -{% block localscript %} - -{% endblock %} - - - diff --git a/templates/File/redirect.html.twig b/templates/File/redirect.html.twig deleted file mode 100644 index b9389a4..0000000 --- a/templates/File/redirect.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} - -{% block localscript %} - - - -{% endblock %} - - - - diff --git a/templates/File/upload.html.twig b/templates/File/upload.html.twig deleted file mode 100644 index 2ecf7ed..0000000 --- a/templates/File/upload.html.twig +++ /dev/null @@ -1,74 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block encoretags %} - {{ encore_entry_link_tags('dropzone') }} -{% endblock %} - -{% block localstyle %} - -{% endblock %} - -{% block body %} - Annuler - - -
    -{% endblock %} - - -{% block localscript %} - {{ encore_entry_script_tags('dropzone') }} - - -{% endblock %} - diff --git a/templates/Home/home.html.twig b/templates/Home/home.html.twig index abbfac2..7eefa63 100755 --- a/templates/Home/home.html.twig +++ b/templates/Home/home.html.twig @@ -1,21 +1,86 @@ {% extends "base.html.twig" %} -{% block body %} - {% if app.user %} -
    -
    -

    Chat #1

    - {{ render(path("app_publish_sample",{id:1})) }} -
    +{# +https://cdn.pixabay.com/photo/2020/08/09/14/25/business-5475661_960_720.jpg +#} +{% block localstyle %} + +{% endblock %} + +{% block beforebody %} + +
    +
    + +
    +
    + + +
    +

    {{app.session.get("appname")}}

    + {{app.session.get("appsubname")}} +
    - {% else %} -
    - -

    {{app.session.get('appname')}}

    -
    {{app.session.get('appdescription')|raw}}
    -
    - {% endif %} + +
    + +
    + + {% if not app.session.get("appdescription") is empty %} +
    + {{app.session.get("appdescription")|raw}} +
    + {% endif %} +
    + + {% endblock %} diff --git a/templates/Icon/edit.html.twig b/templates/Icon/edit.html.twig deleted file mode 100755 index 662cd54..0000000 --- a/templates/Icon/edit.html.twig +++ /dev/null @@ -1,78 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} - {% if not inframe %} -

    - {% if mode=="update" %} - Modification Icône - {% elseif mode=="submit" %} - Création Icône - {% endif %} -

    - {%endif%} - - {{ form_widget(form.submit) }} - Annuler - - {% if mode=="update" and not issystem %} - - Supprimer - - {% endif %} - -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} -
    -
    - Informations -
    - -
    -
    - - {{ form_widget(form.label) }} - {% if mode=="submit" or not issystem %} - Modifier - {%endif%} -
    - - {% if mode=="submit" or not issystem %} -
    - Privilégiez des images carrées de minimum 90px par 90px et avec un fond transparent -
    - {%endif%} - - {{ form_row(form.tags) }} - -
    -
    - - - {% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %} -
    - {{ render(path("app_"~access~"_audit_renderid",{entityname:"Icon",entityid:icon.id})) }} -
    - {% endif %} -{{ form_end(form) }} -{% endblock %} diff --git a/templates/Icon/list.html.twig b/templates/Icon/list.html.twig deleted file mode 100644 index 3dd930c..0000000 --- a/templates/Icon/list.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "base.html.twig" %} - -{% block body %} - {% if not inframe %} -

    Gestion des Icônes

    - {% endif %} - {% if auditUse and (access=="admin" or access=="audit") %} - Audit - {% endif %} - -

    - Ajouter - {% if inframe %} - Fermer - {% endif %} -

    - -
    - {% for icon in icons %} - - {% endfor %} -
    -{% endblock %} - - diff --git a/templates/Icon/select.html.twig b/templates/Icon/select.html.twig deleted file mode 100644 index 30a9287..0000000 --- a/templates/Icon/select.html.twig +++ /dev/null @@ -1,70 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -
    - - -
    - - - - {% if iconsuser is not empty %} -

    Mes Icônes

    - {% for icon in iconsuser %} - {% set tag = "" %} - {% if icon.tags %} - {% set tag = icon.tags %} - {% endif %} - {% if icon.label starts with 'icon/icon_' %} - {% set tag = tag ~ icon.label|replace({'icon/icon_':'', '.png':''}) %} - {% endif %} - - - {% endfor %} - -

    Icônes Communs

    - {% endif %} - {% for icon in icons %} - {% set tag = "" %} - {% if icon.tags %} - {% set tag = icon.tags %} - {% endif %} - {% if icon.label starts with 'icon/icon_' %} - {% set tag = tag ~ icon.label|replace({'icon/icon_':'', '.png':''}) %} - {% endif %} - - {% endfor %} -
    -
    -{% endblock %} - -{% block localscript %} - -{% endblock %} - - diff --git a/templates/Include/sidebaradmin.html.twig b/templates/Include/sidebaradmin.html.twig index 8d18f70..7d97131 100755 --- a/templates/Include/sidebaradmin.html.twig +++ b/templates/Include/sidebaradmin.html.twig @@ -67,33 +67,43 @@ { 'id': 'sidebar-portal', 'icon': 'fa fa-door-closed', - 'name' : 'PORTAIL', + 'name' : 'NINEBLOG', 'items' : [ { - icon: 'fa fa-copy fa-fw', - route: 'app_admin_page_template', - name: 'Modèles de Page', + icon: 'fas fa-paper-plane', + route: 'app_blog', + name: 'Blog', }, { - icon: 'fa fa-file fa-fw', - route: 'app_admin_page_portal', - name: 'Pages', - }, + icon: 'fas fa-tag', + route: 'app_typeblog', + name: 'Type de Blog', + }, { - icon: 'fa fa-desktop', - route: 'app_admin_item', - name: 'Items', - }, + icon: 'fas fa-file-alt', + route: 'app_page', + name: 'Page', + }, { - icon: 'fa fa-bell', - route: 'app_admin_alert', - name: 'Annonces', - }, + icon: 'fas fa-tag', + route: 'app_typepage', + name: 'Type de Page', + }, { - icon: 'fa fa-bug', - route: 'app_admin_icon', - name: 'Icônes', - }, + icon: 'fas fa-bars', + route: 'app_menu', + name: 'Menu', + }, + { + icon: 'fas fa-thumbtack', + route: 'app_pin', + name: 'Pin', + }, + { + icon: 'fas fa-tag', + route: 'app_tag', + name: 'Tag', + }, ] }, { diff --git a/templates/Include/style.css.twig b/templates/Include/style.css.twig index f3e0392..dbc4f2e 100755 --- a/templates/Include/style.css.twig +++ b/templates/Include/style.css.twig @@ -2,6 +2,7 @@ :root{ --colorbgbodylight: {{ app.session.get('colorbgbodylight')|raw }}; --colorbgbodydark: {{ app.session.get('colorbgbodydark')|raw }}; + --colorbgbodyimportant: {{ app.session.get('colorbgbodyimportant')|raw }}; --colorfttitlelight: {{ app.session.get('colorfttitlelight')|raw }}; --colorfttitledark: {{ app.session.get('colorfttitledark')|raw }}; --colorftbodylight: {{ app.session.get('colorftbodylight')|raw }}; @@ -16,7 +17,9 @@ --colorbgbodylight-darker: {{ app.session.get('colorbgbodylight-darker')|raw }}; --colorbgbodydark-darker: {{ app.session.get('colorbgbodydark-darker')|raw }}; + --colorfttitlelight-darker: {{ app.session.get('colorfttitlelight-darker')|raw }}; + --colorfttitledark-lighter: {{ app.session.get('colorfttitledark-lighter')|raw }}; --colorbgbodydark-rgb: {{ app.session.get('colorbgbodydark-rgb')|raw }}; } diff --git a/templates/Item/edit.html.twig b/templates/Item/edit.html.twig deleted file mode 100755 index 40094dd..0000000 --- a/templates/Item/edit.html.twig +++ /dev/null @@ -1,142 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

    - {% if mode=="update" %} - Modification Item = {{item.title}} - {% elseif mode=="submit" %} - Création Item - {% endif %} -

    - - {{ form_widget(form.submit) }} - Annuler - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - -
    -
    -
    -
    - Informations -
    - -
    - {{ form_row(form.title) }} - {{ form_row(form.subtitle) }} - {{ form_row(form.url) }} -
    le mot clé #login# sera remplacé par le login de l'utilisateur
    - {{ form_row(form.target) }} -
    Attention certains sites n'acceptent pas d'être encapsulés dans une frame. Si vous ne voyez pas votre site apparaître, veuillez changer de cible.
    - - {{ form_row(form.essential) }} - {{ form_row(form.protected) }} - {{ form_row(form.content) }} -
    -
    -
    - - -
    -
    -
    - Affectations -
    - -
    - {{ form_row(form.itemcategory) }} - {{ form_row(form.roles) }} - {{ form_row(form.groups) }} -
    -
    - -
    -
    - Appararence -
    - -
    - {{ form_row(form.color) }} - -
    - {% if item.icon %} - - {% endif %} -
    - - -
    - {{ form_row(form.idicon) }} - Selectionner un Icône - Détacher l'Icône -
    -
    -
    -
    -
    -{{ form_end(form) }} -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/Item/list.html.twig b/templates/Item/list.html.twig deleted file mode 100644 index 4df27c6..0000000 --- a/templates/Item/list.html.twig +++ /dev/null @@ -1,230 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} - -{% block body %} -

    - Gestion des Items -

    - -

    - Ajouter un Item - Ajouter une Categorie -

    - -
    -
    - {% for itemcategory in itemcategorys %} -
    - - -
    - {% for item in itemcategory.items %} - - {% endfor %} -
    -
    - {% endfor %} -
    - - - -
    - -{% endblock %} - -{% block localscript %} - -{% endblock %} - diff --git a/templates/Menu/edit.html.twig b/templates/Menu/edit.html.twig new file mode 100644 index 0000000..063e0c7 --- /dev/null +++ b/templates/Menu/edit.html.twig @@ -0,0 +1,103 @@ + +{% extends 'base.html.twig' %} + +{% block body %} +{{ form_start(form) }} +

    + {% if mode=="submit" %} + Création blogtype + {% else %} + Modification blogtype + {% endif %} +

    + + {{ form_widget(form.submit) }} + + Annuler + + {% if mode=="update" and blogtype.id>0 %} + + Supprimer + + {% endif %} + +

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    +
    + Informations +
    + +
    + {{ form_row(form.childtype) }} + {{ form_row(form.blog) }} + {{ form_row(form.blogtype) }} + {{ form_row(form.page) }} + {{ form_row(form.pagetype) }} +
    +
    +{{ form_end(form) }} +{% endblock %} + +{% block localscript %} + +{% endblock %} + + + + diff --git a/templates/Menu/list.html.twig b/templates/Menu/list.html.twig new file mode 100644 index 0000000..ece1259 --- /dev/null +++ b/templates/Menu/list.html.twig @@ -0,0 +1,62 @@ +{% extends "base.html.twig" %} + +{% block body %} +

    + menus +

    + + {% for menu in menus %} +
    +
    + {{menu.name}} + +
    +
      + {% for menuchild in menu.menuchilds %} +
      + +
      + {% if menuchild.childtype == "blog" %} + {{menuchild.blog.name}} + {% elseif menuchild.childtype == "blogtype" %} + {{menuchild.blogtype.name}} + {% elseif menuchild.childtype == "page" %} + {{menuchild.page.name}} + {% elseif menuchild.childtype == "pagetype" %} + {{menuchild.pagetype.name}} + {% endif %} +
      {{menuchild.childtype}} +
      + + + +
      + {% endfor %} +
    +
    + {% endfor %} +{% endblock %} + +{% block localscript %} + +{% endblock %} diff --git a/templates/Page/application.html.twig b/templates/Page/application.html.twig deleted file mode 100644 index c8657b6..0000000 --- a/templates/Page/application.html.twig +++ /dev/null @@ -1,334 +0,0 @@ - -{% extends '@CadolesCore/base.html.twig' %} - -{% set color = app.session.get('color') %} -{% set colormain = color['main'] %} - -{% block pagewrapper %} -
    -
    -
    qsdfqsdfqsd
    - -
    - {% if bookmarks is not empty %} -
    - {% if items is not empty %} -

    Favoris

    - {% else %} -

    - {% endif %} - -
    - {% else %} - - {% endif %} - - {% set mycategs = [] %} - {% for itemcategory in itemcategorys %} - {% set haveitem=false %} - - {% for item in items if item.itemcategory==itemcategory %} - - {% if loop.index ==1 %} - {% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %} - {% endif %} - {% endfor %} - {% endfor %} - - {% for itemcategory in mycategs %} - {% set haveitem=false %} - - {% for item in items if item.itemcategory==itemcategory %} - - {% if loop.index ==1 %} - {% set haveitem=true %} - - {% if mycategs|length > 1 or bookmarks is not empty %} -

    {{ itemcategory.label }}

    - {% else %} -

    - {% endif %} - - - {% endif %} - {% endfor %} -
    -
    -{% endblock %} - -{% block localjavascript %} - $('document').ready(function(){ - // Ajustement des frames - $(window).resize(function() { - AjustFrame(); - }); - - - // Création des grilles d'items - var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'}; - $('body').imagesLoaded(function() { - var grid = $('.grid').masonry(optiongrid); - }); - - // Preview item de bureau - $( ".grid .item-preview" ).click(function() { - if($(this).parent().children(".grid-item-body").css('display') == 'none') { - $(this).html(''); - heightbody=$(this).parent().children(".grid-item-body").height()+30; - heightitem=$(this).parent().parent().height(); - - - $(this).parent().children(".grid-item-body").show(); - $(this).parent().parent().css("width","100%"); - - $(this).parent().parent().css("height",heightitem+heightbody); - $(this).parent().children(".grid-item-content").css("height",heightitem+heightbody); - $(this).parent().children(".item-preview").css("height",heightitem+heightbody); - - var grid = $('.grid').masonry(optiongrid); - } - else { - $(this).html(''); - - $(this).parent().children(".grid-item-body").hide(); - $(this).parent().parent().css("width",""); - $(this).parent().parent().css("height",""); - $(this).parent().children(".grid-item-content").css("height",""); - $(this).parent().children(".item-preview").css("height",""); - - var grid = $('.grid').masonry(optiongrid); - } - }); - - // Sur click item à sonder - {% if activate_widsonde %} - $( ".linktosonde" ).click(function() { - title=$(this).attr("data-sonde"); - //$.getScript( "{{ widsonde_url }}?appli="+title ); - }); - {% endif %} - - }); - - - // Ajout d'un bookmark - function addBookmark(idwidget,touser) { - var url="{{ path('cadoles_portal_user_bookmark_submit',{idpage:0,idwidget:'xx',touser:'yy'})}}"; - url=url.replace('xx',idwidget); - url=url.replace('yy',touser); - - $(location).attr('href', url); - } - - // Modifciation d'un bookmark - function modBookmark(idbookmark) { - var url="{{ path('cadoles_portal_user_bookmark_update',{idpage:0,id:'xx'})}}"; - - url=url.replace('xx',idbookmark); - $(location).attr('href', url); - } - - // Ajouter un item aux bookmark - function heartBookmark(iditem) { - var idbookmark; - - $.ajax({ - method: "POST", - url: "{{ path('cadoles_portal_user_bookmark_heart') }}", - data: { - iditem:iditem - }, - success: function(idbookmark) { - location.reload(); - } - }); - - } - - // Supprimer un fichier - function delFile(directory,filename) { - var r = confirm("Confirmez-vous la suppression de ce fichier ?"); - if (r == true) { - $.ajax({ - method: "POST", - url: "{{ path('cadoles_core_user_file_delete') }}", - data: { - directory:directory, - filename:filename - }, - success: function() { - location.reload(); - } - }); - } - } - - // Ajustement des frames - function AjustFrame() { - $('.frameajust').iframeAutoHeight({ - minHeight: 500, // Sets the iframe height to this value if the calculated value is less - heightOffset: 0, // Optionally add some buffer to the bottom - callback: function(callbackObject) { $(this).parent().css("height",callbackObject.newFrameHeight) ;} - }); - - if($(".frameitem").length>0) { - var heightbody = $('html').height(); - var heightheader = $('.header').height(); - if($('.pagemenu').css("display")=="none") - var heightmenu = 0; - else - var heightmenu = $('.pagemenu').height(); - - var heightframe = heightbody-heightheader-heightmenu; - - $(".frameitem").height(heightframe); - } - - } - - - // Affichage d'un Flux - function showFlux(idwidget, id) { - if(id=="all") - $(".widget[data-id="+idwidget+"]").find(".feed").show(); - else { - $(".widget[data-id="+idwidget+"]").find(".feed").hide(); - $(".widget[data-id="+idwidget+"]").find(".flux-"+id).show(); - } - - var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'}; - var grid = $('.grid').masonry(optiongrid); - } - - // Affichage des frames associés aux items de bureau - function resizeFrame() { - var iFrame = document.getElementById('frameContent'); - - var heightbody = $('html').height(); - var heightheader = $('.header').height(); - if($('#appmenu').css("display")=="none") - var heightmenu = 0; - else - var heightmenu = $('#appmenu').height(); - - - var heightframe = heightbody-heightheader-heightmenu; - - $(".pageframe").each(function( index ) { - $(this).height(heightframe); - }); - } - - - function showFrameitem(id,url,forcereload) { - $(".pageframe").hide(); - - // Si force le rechargement et frame existante on la détruit - if(forcereload&&$("#frameitem-"+id).length) - $("#frameitem-"+id).remove(); - - // Si la frame en cours existe déjà on l'affiche - if($("#frameitem-"+id).length) - $("#frameitem-"+id).show(); - // Sinon on la génère - else - $("#pagecontainer").append(""); - - - resizeFrame(); - } - -{% endblock %} diff --git a/templates/Page/default.html.twig b/templates/Page/default.html.twig deleted file mode 100644 index 1f24738..0000000 --- a/templates/Page/default.html.twig +++ /dev/null @@ -1,141 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} -.thumbnail { - text-align:center; -} - -.thumbnail img { - width:200px; - border: 5px solid #fff; - border-radius: 10px; -} - -.caption p { - text-align:justify; - font-size:14px; - word-wrap: break-word; - -} - -.caption ul { - margin-top:-10px; - padding-left: 20px; -} - -.caption li { - text-align:left; - font-size:14px; - word-wrap: break-word; - font-style: italic; - -} - -h3 { - margin-top:10px; -} -{% endblock %} - - -{% block body %} -
    - - -

    {{ app.session.get('appname') }}

    -
    - -
    - - {% if not app.user and moderegistration!="none" and appMasteridentity=="SQL"%} - Mot de passe oublié ? - {% endif %} -
    - -
    -
    -
    - - -
    -

    Portail
    Profilé

    -

    Tous les éléments du portail peuvent être distribués en fonction du profil de l'utilisateur.

    -

    Il est possible de définir le profil de l'utilisateur en fonction : -

      -
    • De son groupe d'appartenance
    • -
    • D'attributs Annuaire
    • -
    • D'attributs SSO
    • -
    -

    -

    En fonction du profil de l'utilisateur, il est possible de distribuer : -

      -
    • Des pages en onglet
    • -
    • Des Flux RSS
    • -
    • Des Annonces
    • -
    • Des Applications Web
    • -
    • Des Calendriers
    • -
    -

    -
    -
    -
    - -
    -
    - - -
    -

    Portail
    Personnalisable

    -

    En fonction de la configuration et de leur profil, les utilisateurs du portail sont libres de créer leur propre page.

    -

    Les pages de l'utilisateur pouvant prendre plusieurs formes : -

      -
    • Une page pointant sur l'adresse d'un autre site
    • -
    • Une page construite par l'utilisateur via l'utilisation d'un éditeur riche
    • -
    • Une page constituée de widgets qu'il dispose selon son libre choix
    • -
    -

    -
    -
    -
    - - -
    -
    - - -
    -

    Portail
    Evolutif

    -

    Ninegate est évolutif dans le sens où, vous disposerez d'une large bibliothèque de widgets qui composeront vos pages.

    -

    Voici quelques exemples : -

      -
    • Widget URL
    • -
    • Widget Flux RSS
    • -
    • Widget Editeur de texte
    • -
    • Widget Gestionnaire de tâches
    • -
    • Widget Calendriers
    • -
    • Widget Favoris
    • -
    • Widget Dépôt de Fichiers
    • -
    • Et bien d'autres encore
    • -
    -
    -
    -
    - -
    -
    - - -
    -

    Portail
    Open Source

    -

    Ce projet est opensource -

      -
    • Vous pouvez à tout moment modifier le code de votre portail
    • -
    • Distribuer {{ app.session.get('appname') }}
    • -
    -

    -

    Ninegate est développé dans le cadre du projet Envole. Vous pourrez trouver le code source de Ninegate sur la forge du projet

    -

    Ninegate est propulsé par la société Cadoles

    -
    -
    -
    -
    -{% endblock %} \ No newline at end of file diff --git a/templates/Page/edit.html.twig b/templates/Page/edit.html.twig new file mode 100644 index 0000000..649478f --- /dev/null +++ b/templates/Page/edit.html.twig @@ -0,0 +1,83 @@ + +{% extends 'base.html.twig' %} + +{% block body %} +{{ form_start(form) }} +

    + {% if mode=="submit" %} + Création page + {% else %} + Modification page + {% endif %} +

    + + {{ form_widget(form.submit) }} + + + {% if from=="child" %} + Annuler + {% else %} + Annuler + {% endif %} + + {% if mode=="update" and page.id>0%} + + Supprimer + + {% endif %} + +

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    +
    +
    +
    + Informations +
    + +
    + {{ form_row(form.name) }} + {{ form_row(form.pagetype) }} +
    +
    +
    + +
    +
    +
    + + +{{ form_end(form) }} +{% endblock %} + +{% block localscript %} + +{% endblock %} + + + diff --git a/templates/Page/home.html.twig b/templates/Page/home.html.twig new file mode 100644 index 0000000..061bab4 --- /dev/null +++ b/templates/Page/home.html.twig @@ -0,0 +1,204 @@ + +{% extends 'base.html.twig' %} + + +{% block localstyle %} + +{% endblock %} + +{% block beforebody %} + {%if heros %} + + {% endif %} +{% endblock %} + +{% block useractions %} + {% if is_granted('ROLE_ADMIN') %} +
  • + +
  • + {% endif %} +{% endblock %} + +{% block body %} +
    +

    Actualités

    +
    +
    +
    + {% for page in pages %} + {% if not page.childpages is empty %} + {% set background="" %} + {% if not page.childpages[0].child.childheaders is empty and page.childpages[0].child.childheaders[0] %} + {% set background="/"~appAlias~"/uploads/childheader/"~page.childpages[0].child.id~"/"~page.childpages[0].child.childheaders[0].filename %} + {% endif %} + + {% set style="height:auto;background-position: center ; background-size: cover; background-image: url("~background~")" %} + +
    +
    +
    + {{ page.childpages[0].child.name }} +
    {{ page.pagetype.name }}
    + + {% if page.childpages[0].child.subname %} + {{ page.childpages[0].child.subname|nl2br }}
    + {% endif %} + {% for tag in page.childpages[0].child.tags %} + {% if loop.first %}
    {%endif%} + #{{tag.id}} + {% endfor %} +
    + +
    +
    +
    +
    + {% endif %} + {% endfor %} +
    +
    +{% endblock %} + +{% block localscript %} + +{% endblock %} \ No newline at end of file diff --git a/templates/Page/list.html.twig b/templates/Page/list.html.twig index c282575..c03dd24 100644 --- a/templates/Page/list.html.twig +++ b/templates/Page/list.html.twig @@ -1,36 +1,42 @@ -{% extends 'base.html.twig' %} - +{% extends "base.html.twig" %} {% block body %}

    - Gestion des Pages + pages

    - - Ajouter une Page -
    - - -
    -

    +

    Ajouter

    - Liste des Pages + Liste des pages
    - - - + + + + + - - - + + + {% for page in pages %} + + + + + + + + {% endfor %} +
    ActionOrdre
    ActionIDDateType NomCatégoriePropriétaire
    + + {{page.id}}{{page.submitdate|date("Y-m-d")}}{{page.pagetype.name}}{{page.name}}
    @@ -40,51 +46,13 @@ {% block localscript %} {% endblock %} + diff --git a/templates/Page/menugroupe.html.twig b/templates/Page/menugroupe.html.twig deleted file mode 100644 index fc04186..0000000 --- a/templates/Page/menugroupe.html.twig +++ /dev/null @@ -1,69 +0,0 @@ - {% if not inmenu %} - - {% else %} - {% for groupshared in groups %} - {% if groupshared.pagesshared|length == 1 %} - {% set page = groupshared.pagesshared[0] %} - {% set forcereload=true %} - {% if page.pagecategory.id==1 %} - {% set forcereload=page.toreload %} - {% endif %} - - {% set isactive="" %} - {% if entity.id is defined and page.id==entity.id %} - {% set isactive="class='active'" %} - {% endif %} - - - {% else %} - - {% endif %} - {% endfor %} - {% endif %} \ No newline at end of file diff --git a/templates/Page/pages.html.twig b/templates/Page/pages.html.twig deleted file mode 100644 index 9e4748c..0000000 --- a/templates/Page/pages.html.twig +++ /dev/null @@ -1,461 +0,0 @@ - -{% extends 'base.html.twig' %} - -{% block localstyle %} - -{% endblock %} - -{% block menuapp %} - - - - - {% if groups|length > 0 and groups|length < 10 %} -
    - - {% endif %} - {% endfor %} - - {% elseif groups|length > 0 %} - - {% endif %} - -{% endblock %} - -{% block menuuser %} - {% if canadd and app.user %} - - {% endif %} - - - - - - {% endblock %} - -{% block body %} -
    - - - - - - -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/Page/submit.html.twig b/templates/Page/submit.html.twig deleted file mode 100644 index 46abd92..0000000 --- a/templates/Page/submit.html.twig +++ /dev/null @@ -1,88 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

    - Nouvelle Page -

    - -

    - {{ form_widget(form.submit) }} - {% if access=="admin" %} - Annuler - {% else %} - Annuler - {% endif %} -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    -
    - Informations -
    - -
    - {{ form_row(form.name) }} - {{ form_row(form.pagecategory) }} - {{ form_row(form.usage) }} - {% if form.user is defined %} - {{ form_row(form.user) }} - {% endif %} - - {{ form_row(form.page) }} - {{ form_row(form.groups) }} - - {{ form_row(form.roworder) }} - {{ form_row(form.fonticon) }} - {{ form_row(form.maxwidth) }} -
    -
    -{{ form_end(form) }} -{% endblock %} - -{% block localscript %} - -{% endblock %} \ No newline at end of file diff --git a/templates/Page/updateeditor.html.twig b/templates/Page/updateeditor.html.twig deleted file mode 100644 index 3d8f89b..0000000 --- a/templates/Page/updateeditor.html.twig +++ /dev/null @@ -1,72 +0,0 @@ -{% extends '@CadolesCore/base.html.twig' %} - -{% block pagewrapper %} -{{ form_start(form) }} -

    - {% if mode=="update" %} - Modification Page Editeur = {{entity.name}} - {% elseif mode=="submit" %} - Création Page Editeur - {% endif %} -

    - -

    - {{ form_widget(form.submit) }} - {% if access=="config" %} - Annuler - {% else %} - Annuler - {% endif %} - - {% if mode=="update" %} - - Supprimer - - {% endif %} -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    - {% if form.roles is defined %} -
    - {% else %} -
    - {% endif %} - - {{ form_row(form.name) }} - {{ form_row(form.roworder) }} - {{ form_row(form.fonticon) }} - {{ form_row(form.maxwidth) }} - {{ form_row(form.html) }} -
    - - {% if form.roles is defined %} -
    - {{ form_row(form.user) }} - {{ form_row(form.roles) }} - {{ form_row(form.groups) }} -
    - {% endif %} -
    -{{ form_end(form) }} -{% endblock %} \ No newline at end of file diff --git a/templates/Page/updatetool.html.twig b/templates/Page/updatetool.html.twig deleted file mode 100644 index 12adcb5..0000000 --- a/templates/Page/updatetool.html.twig +++ /dev/null @@ -1,66 +0,0 @@ -{% extends '@CadolesCore/base.html.twig' %} - -{% block pagewrapper %} -{{ form_start(form) }} -

    - Modification Page {{ entity.pagecategory.name}} = {{entity.name}} -

    - -

    - {{ form_widget(form.submit) }} - {% if access=="config" %} - Annuler - {% else %} - Annuler - {% endif %} - - {% if mode=="update" %} - - Supprimer - - {% endif %} -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    - {% if form.roles is defined %} -
    - {% else %} -
    - {% endif %} - - {{ form_row(form.name) }} - {{ form_row(form.roworder) }} - {{ form_row(form.fonticon) }} -
    - - {% if form.roles is defined %} -
    - {{ form_row(form.user) }} - {{ form_row(form.roles) }} - {{ form_row(form.groups) }} -
    - {% endif %} -
    -{{ form_end(form) }} -{% endblock %} \ No newline at end of file diff --git a/templates/Page/updateurl.html.twig b/templates/Page/updateurl.html.twig deleted file mode 100644 index 6c9b25b..0000000 --- a/templates/Page/updateurl.html.twig +++ /dev/null @@ -1,76 +0,0 @@ -{% extends '@CadolesCore/base.html.twig' %} - -{% block pagewrapper %} -{{ form_start(form) }} -

    - {% if mode=="update" %} - Modification Page URL = {{entity.name}} - {% elseif mode=="submit" %} - Création Page URL - {% endif %} -

    - -

    - {{ form_widget(form.submit) }} - {% if access=="config" %} - Annuler - {% else %} - Annuler - {% endif %} - - {% if mode=="update" %} - - Supprimer - - {% endif %} -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    - {% if form.roles is defined %} -
    - {% else %} -
    - {% endif %} - - {{ form_row(form.name) }} - {{ form_row(form.url) }} - le mot clé #login# sera remplacé par le login de l'utilisateur
    - Attention certains sites n'acceptent pas d'être encapsulés dans une frame.

    - - {{ form_row(form.toreload) }} - {{ form_row(form.roworder) }} - {{ form_row(form.fonticon) }} - {{ form_row(form.maxwidth) }} -
    - - {% if form.roles is defined %} -
    - {{ form_row(form.user) }} - {{ form_row(form.roles) }} - {{ form_row(form.groups) }} -
    - {% endif %} -
    -{{ form_end(form) }} -{% endblock %} \ No newline at end of file diff --git a/templates/Page/updatewidget.html.twig b/templates/Page/updatewidget.html.twig deleted file mode 100644 index eb8e6eb..0000000 --- a/templates/Page/updatewidget.html.twig +++ /dev/null @@ -1,552 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block localstyle %} - - -{% endblock %} -{% block body %} -{{ form_start(form) }} -

    - {% if mode=="update" %} - {% if usage=="template" %} - Modification Modèle de Page = {{page.name}} - {% else %} - Modification Page Widget = {{page.name}} - {% endif %} - {% elseif mode=="submit" %} - Création Page Widget - {% endif %} -

    - -

    - {{ form_widget(form.submit) }} - {% if access=="admin" %} - Annuler - {% else %} - Annuler - {% endif %} - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    - {% if form.roles is defined %} -
    - {% else %} -
    - {% endif %} -
    -
    - Informations -
    - -
    - {{ form_row(form.name) }} - {{ form_row(form.roworder) }} - {{ form_row(form.fonticon) }} - {{ form_row(form.maxwidth) }} - {{ form_row(form.template) }} -
    -
    -
    - - {% if form.roles is defined %} -
    -
    -
    - Affectations -
    -
    - {{ form_row(form.user) }} - {{ form_row(form.roles) }} - {{ form_row(form.groups) }} -
    -
    -
    - {% endif %} -
    - -
    -
    - Template de Mise en Page -
    -
    -
    -
    -
    -{{ form_end(form) }} -{% endblock %} - - -{% block localscript %} - - -{% endblock %} \ No newline at end of file diff --git a/templates/Page/vieweditor.html.twig b/templates/Page/vieweditor.html.twig deleted file mode 100644 index f974bd5..0000000 --- a/templates/Page/vieweditor.html.twig +++ /dev/null @@ -1,23 +0,0 @@ - -{% extends '@CadolesCore/base.html.twig' %} - -{% block pagewrapper %} - {% if access=="config" %} - - {% endif %} - -
    - {{ entity.html | raw }} -
    -{% endblock %} - -{% block localjavascript %} - $('document').ready(function(){ - }); - -{% endblock %} diff --git a/templates/Page/viewurl.html.twig b/templates/Page/viewurl.html.twig deleted file mode 100644 index a9c887d..0000000 --- a/templates/Page/viewurl.html.twig +++ /dev/null @@ -1,59 +0,0 @@ - -{% extends '@CadolesCore/base.html.twig' %} - -{% block localstyle %} - #pageiframe { margin: 0px -30px;} -{% endblock %} - -{% if app.user %} - {% set username = app.user.username %} -{% else %} - {% set username = "" %} -{% endif %} - -{% block pagewrapper %} - {% if access=="config" %} - - {% endif %} - -
    - -
    -{% endblock %} - - -{% block localjavascript %} - $(window).resize(function() { - resizeFrame(); - }); - - $('document').ready(function(){ - resizeFrame(); - }); - - function resizeFrame() { - $("body").css("overflow-y","hidden"); - $(".col-md-10").css("padding","0"); - - var iFrame = document.getElementById('frameContent'); - - var heightbody = $('html').height(); - var heightheader = $('.header').height(); - if($('.pagemenu').css("display")=="none") - var heightmenu = 0; - else - var heightmenu = $('.pagemenu').height(); - - - var heightframe = heightbody-heightheader-heightmenu; - - if($("#frameContent").length>0) { - $("#frameContent").height(heightframe); - } - } -{% endblock %} diff --git a/templates/Page/viewwidget.html.twig b/templates/Page/viewwidget.html.twig deleted file mode 100644 index e9ea46d..0000000 --- a/templates/Page/viewwidget.html.twig +++ /dev/null @@ -1,598 +0,0 @@ - -{% extends 'base.html.twig' %} - -{% block menuuser %} - {% if access=="admin" %} -
  • -
  • -
  • - {% endif %} -{% endblock %} - -{% block body %} -
    - -
    - - - - - {% if access!="all" %} - - {% endif %} -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/Pagetemplate/list.html.twig b/templates/Pagetemplate/list.html.twig deleted file mode 100644 index c4c6979..0000000 --- a/templates/Pagetemplate/list.html.twig +++ /dev/null @@ -1,58 +0,0 @@ -{% extends 'base.html.twig' %} - - -{% block body %} -

    - Gestion des Modèles de Page -

    - -

    - Ajouter un Modèle -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    -
    - Liste des Modèles -
    - -
    -
    - - - - - - - - - -
    ActionOrdreNomPour
    -
    -
    -
    -{% endblock %} - -{% block localscript %} - -{% endblock %} diff --git a/templates/Pagetype/edit.html.twig b/templates/Pagetype/edit.html.twig new file mode 100644 index 0000000..9b184ca --- /dev/null +++ b/templates/Pagetype/edit.html.twig @@ -0,0 +1,108 @@ + +{% extends 'base.html.twig' %} + +{% block body %} +{{ form_start(form) }} +

    + {% if mode=="submit" %} + Création pagetype + {% else %} + Modification pagetype + {% endif %} +

    + + {{ form_widget(form.submit) }} + + Annuler + + {% if mode=="update" and pagetype.id>0%} + + Supprimer + + {% endif %} + +

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    +
    + Informations +
    + +
    + {{ form_row(form.name) }} + {{ form_row(form.sortby) }} + {{ form_row(form.description) }} + + {% set image= "noimage.png" %} + {% if pagetype.image %} + {% set image= pagetype.image %} + {% endif %} + +
    +
    + {{ form_widget(form.image) }} + + Modifier +
    +
    +
    +{{ form_end(form) }} +{% endblock %} + +{% block localscript %} + +{% endblock %} + + + diff --git a/templates/Pagetype/home.html.twig b/templates/Pagetype/home.html.twig new file mode 100755 index 0000000..54c2ae9 --- /dev/null +++ b/templates/Pagetype/home.html.twig @@ -0,0 +1,55 @@ +{% extends "base.html.twig" %} + +{% block localstyle %} + +{% endblock %} + +{% block beforebody %} + +
    +
    + +
    +
    + + +
    +

    {{pagetype.name}}

    +
    +
    + + {% if not pagetype.description is empty %} +
    + {{pagetype.description|raw}} +
    + {% endif %} + +
    + + + + +{% endblock %} diff --git a/templates/Pagetype/list.html.twig b/templates/Pagetype/list.html.twig new file mode 100644 index 0000000..d15e28a --- /dev/null +++ b/templates/Pagetype/list.html.twig @@ -0,0 +1,52 @@ +{% extends "base.html.twig" %} + +{% block body %} +

    + pagetypes +

    + +

    Ajouter

    + +
    +
    + Liste des pagetypes +
    + +
    +
    + + + + + + + + + {% for pagetype in pagetypes %} + + + + + {% endfor %} + +
    ActionNom
    + + {{pagetype.name}}
    +
    +
    +
    +{% endblock %} + +{% block localscript %} + +{% endblock %} + diff --git a/templates/Pagetype/upload.html.twig b/templates/Pagetype/upload.html.twig new file mode 100755 index 0000000..018d06b --- /dev/null +++ b/templates/Pagetype/upload.html.twig @@ -0,0 +1,38 @@ +{% extends "base.html.twig" %} + +{% block encoretags %} + {{ encore_entry_link_tags('dropzone') }} +{% endblock %} + +{% block body %} + Annuler + +
    +
    +{% endblock %} + +{% block localscript %} + {{ encore_entry_script_tags('dropzone') }} + + +{% endblock %} diff --git a/templates/Pagewidget/ckeditor.html.twig b/templates/Pagewidget/ckeditor.html.twig deleted file mode 100644 index 2b9effe..0000000 --- a/templates/Pagewidget/ckeditor.html.twig +++ /dev/null @@ -1,115 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

    - Modification Widget -

    - -

    - {{ form_widget(form.submit) }} - Annuler -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - -
    -
    Informations
    -
    - {{ form_row(form.ckeditor) }} -
    -
    - -{{ form_end(form) }} -{% endblock %} - -{% block localscript %} - -{% endblock %} \ No newline at end of file diff --git a/templates/Pagewidget/edit.html.twig b/templates/Pagewidget/edit.html.twig deleted file mode 100644 index aa19c82..0000000 --- a/templates/Pagewidget/edit.html.twig +++ /dev/null @@ -1,172 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

    - {% if mode=="update" or mode=="updatetemplate" %} - Modification Widget - {% elseif mode=="submit" or mode=="submittemplate" %} - Création Widget - {% endif %} -

    - -

    - {{ form_widget(form.submit) }} - Annuler -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - -
    -
    -
    -
    Informations
    -
    - {{ form_row(form.name) }} -
    -
    -
    - -
    -
    -
    Informations
    -
    -
    - {% if entity.icon.label %} - - {% endif %} -
    - -
    - {{ form_row(form.idicon) }} - Selectionner un Icône - Détacher l'Icône -
    -
    -
    -
    -
    -
    -
    Informations
    -
    -
    -
    - {{ form_row(form.autoajust) }} - {{ form_row(form.height) }} - {{ form_row(form.border) }} - {{ form_row(form.opened) }} -
    - -
    - {{ form_row(form.viewheader) }} - {{ form_row(form.colorheaderback) }} - {{ form_row(form.colorheaderfont) }} - {{ form_row(form.colorbodyback) }} - {{ form_row(form.colorbodyfont) }} -
    - -
    - -
    - -
    - {{ form_widget(form) }} -
    -
    -
    -
    -
    -
    - -{{ form_end(form) }} -{% endblock %} - -{% block localscript %} - -{% endblock %} \ No newline at end of file diff --git a/templates/Pagewidget/viewalert.html.twig b/templates/Pagewidget/viewalert.html.twig deleted file mode 100644 index 086289b..0000000 --- a/templates/Pagewidget/viewalert.html.twig +++ /dev/null @@ -1,42 +0,0 @@ -{% set widgetname="alert" %} -{% extends 'Pagewidget/widget.twig' %} -{% block widgetbody %} - {% for alert in alerts %} - {% if loop.first %} -
    - {% endif %} -
    -
    -
    - - -
    - {% if alert.fghideable and app.user %} - - {%endif%} - -
    -
    - -
    - {{ alert.content|raw }} -
    -
    -
    - - {% if loop.last %} -
    - {% endif %} - {% endfor %} -{% endblock %} - diff --git a/templates/Pagewidget/viewblog.html.twig b/templates/Pagewidget/viewblog.html.twig deleted file mode 100644 index 181d573..0000000 --- a/templates/Pagewidget/viewblog.html.twig +++ /dev/null @@ -1,101 +0,0 @@ - -{% import "Pagewidget/constants.twig" as constants %} - -{% set stylewidget = constants.mystylewidget(entity) %} -{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} -{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} -{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} -{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} - -{%if mini %} - -{% else %} -
    -
    - {% if canupdate %} - - - {% endif %} - - {% if access=="config" %} - - {% else %} - {% if canadd %} - {% set idblog = "" %} - {% set url= path('app_user_blogarticle_submit') %} - {% if usage=="group" and firstblog is defined %} - {% set url= path('app_user_blogarticle_submit',{idblog:firstblog,page:entity.page.id}) %} - {% endif %} - - - {% endif %} - - {% set url= path('app_user_blog_view') %} - {% if usage=="group" and firstblog is defined %} - {% set url= path('app_user_blog_view',{id:firstblog}) %} - {% endif %} - - - {% endif %} - - {% if look=="list" %} - - {% else %} - - {% endif %} -
    - -
    - {% if entity.icon %} - - {% else %} - - {% endif %} - {{ entity.name }} -
    - - {% if blogarticles|length >= 1 %} - - {% endif %} -
    -{% endif %} - - diff --git a/templates/Pagewidget/viewbookmark.html.twig b/templates/Pagewidget/viewbookmark.html.twig deleted file mode 100644 index 035f218..0000000 --- a/templates/Pagewidget/viewbookmark.html.twig +++ /dev/null @@ -1,90 +0,0 @@ -{% set widgetname="bookmark" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} -
    - {% for bookmark in bookmarks %} - {% set havebookmark=true %} - {% if bookmark.item %} - {% set bookmarktitle = bookmark.item.title %} - {% set bookmarksubtitle = bookmark.item.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.item.color ? bookmark.item.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.item.target %} - {% set bookmarkurl = ( bookmark.item.protected and not app.user ? path("app_login") : bookmark.item.url|replace({'#login#': username}) ) %} - {% set bookmarkcontent = bookmark.item.content %} - {% set bookmarkicon = (bookmark.item.icon ? bookmark.item.icon.label : "icon/icon_pin.png") %} - {% else %} - {% set bookmarktitle = bookmark.title %} - {% set bookmarksubtitle = bookmark.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.target %} - {% set bookmarkurl = bookmark.url|replace({'#login#': username}) %} - {% set bookmarkcontent = null %} - {% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %} - {% endif %} - -
    -
    -
    - {% if bookmarktarget == 'frame' %} - - {% else %} - - {% endif %} - - -
    -

    {{ bookmarktitle }}

    -
    {{ bookmarksubtitle|nl2br }}
    -
    -
    - -
    - {% if canadd %} - {% if bookmark.item %} - - {% else %} - - - {% endif %} - {% endif %} - - {% if bookmarkcontent %} - - {% endif %} -
    -
    - -
    {{ bookmarkcontent|raw }}
    -
    -
    - {% endfor %} - - {% if canadd %} - - {% endif %} -
    -{% endblock %} - - - diff --git a/templates/Pagewidget/viewcalendar.html.twig b/templates/Pagewidget/viewcalendar.html.twig deleted file mode 100644 index 531a6a6..0000000 --- a/templates/Pagewidget/viewcalendar.html.twig +++ /dev/null @@ -1,100 +0,0 @@ -{% import "Pagewidget/constants.twig" as constants %} - -{% set stylewidget = constants.mystylewidget(entity) %} -{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} -{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} -{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} - -{%if mini %} - -{% else %} -
    -
    - {% if canupdate %} - - - {% endif %} - {% if access=="config" %} - - {% else %} - {% set url= path('app_'~access~'_calendar_view') %} - {% if usage=="group" and firstcalendar is defined %} - {% set url= path('app_'~access~'_calendar_view',{id:firstcalendar}) %} - {% endif %} - - {% endif %} - - {% if look=="list" %} - - {% else %} - - {% endif %} -
    - -
    - {% if entity.icon %} - - {% else %} - - {% endif %} - {{ entity.name }} -
    - - {% set firstflux="" %} - - {% if events|length >= 1 %} -
    - {% set monthsel = "" %} - {% for i in 0..(nbday-1) %} - {% set dateeventstart = 'now'|date_modify("+"~i~" day midnight") %} - {% set dateeventend = 'now'|date_modify("+"~(i+1)~" day midnight") %} - - {% set fgaffday=false %} - {% for event in events %} - {% if event.start< dateeventend and event.end>=dateeventstart %} - - {% if monthsel == "" or dateeventstart|date("Y-m")!=monthsel %} - {% set monthsel = dateeventstart|date("Y-m") %} - {% set libmonth = constants.libmonth(dateeventstart|date("m")) %} -

    {{ libmonth ~ " " ~ dateeventstart|date("Y") }}

    - {% endif %} - - {% if not fgaffday %} - {% set fgaffday=true %} - {% set libday = constants.libday(dateeventstart|date("N")) %} -
    {{ libday ~ " " ~ dateeventstart|date("d/m/Y") }}
    - {% endif %} - -
    - {{ event.name }} = - {% if not event.allDay %} - {{ event.start | date("H:i") }} - - {%endif%} - {{ event.title }} -
    - {% endif %} - - {% endfor %} - - {% endfor %} - - {% if url is defined %} - - {% endif %} -
    - {% endif %} -
    -{% endif %} - - - diff --git a/templates/Pagewidget/vieweditor.html.twig b/templates/Pagewidget/vieweditor.html.twig deleted file mode 100644 index f7abbe4..0000000 --- a/templates/Pagewidget/vieweditor.html.twig +++ /dev/null @@ -1,28 +0,0 @@ -{% set widgetname="editor" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} - {% if html is empty and canadd %} -
    -
    - Modifier votre texte -
    - {% else %} -
    - {{ html | raw }} -
    - {% endif %} - -{% endblock %} - - - - - - diff --git a/templates/Pagewidget/viewfile.html.twig b/templates/Pagewidget/viewfile.html.twig deleted file mode 100644 index 3665846..0000000 --- a/templates/Pagewidget/viewfile.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% set widgetname="file" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canupdate %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} - -{% endblock %} - - - diff --git a/templates/Pagewidget/viewflux.html.twig b/templates/Pagewidget/viewflux.html.twig deleted file mode 100644 index ae4cefd..0000000 --- a/templates/Pagewidget/viewflux.html.twig +++ /dev/null @@ -1,141 +0,0 @@ -{% set theme = app.session.get('theme') %} -{% if theme is not empty %} - {{ include('@Theme/'~theme~'/function.html.twig') }} -{% endif %} - -{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} - -{% set stylewidget = constants.mystylewidget(entity) %} -{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} -{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} -{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} -{% set color = app.session.get('color') %} - -{% set colorbodyfont = entity.colorbodyfont %} -{% if colorbodyfont is null %} - {% set colorbodyfont = color['fontcolorhover'] %} -{% endif %} - -{% set colorbodyback = entity.colorbodyback %} -{% if colorbodyback is null %} - {% set colorbodyback = color['main'] %} -{% endif %} - -{% set colorbodyfont = entity.colorbodyfont %} -{% if colorbodyfont is null %} - {% if colorbodyback==color['fontcolorhover'] %} - {% set colorbodyfont = color['main'] %} - {% else %} - {% set colorbodyfont = color['fontcolorhover'] %} - {% endif %} -{% endif %} - -{% if modelist==0 %} - {% set stylegrid="grid-preview" %} -{% elseif modelist==1 %} - {% set stylegrid="grid-list" %} -{% endif %} - -{%if mini %} - -{% else %} -
    -
    - {% if canupdate %} - - - {% endif %} - - {% if look=="list" %} - - {% else %} - - {% endif %} -
    - -
    - {% if entity.icon %} - - {% else %} - - {% endif %} - {{ entity.name }} -
    - - {% set firstflux="" %} - -
    - {% if fluxs is defined %} - {% if fluxs|length > 1 %} -
    Tout
    - - {% for flux in fluxs %} - {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} - {% if flux.color is not null %} - {% set stylefeed = "background-color: #" ~ flux.color ~ ";" %} - {% endif %} - -
    {{ flux.title }}
    - {% endfor %} - {% endif %} - {% endif %} - -
    - {% for feed in feeds %} - {% if loop.index==1 %} -
    -
    - {% endif %} - - - {% set stylecolor = "background-color: #" ~ color['main'] ~ ";" %} - {% if feed.color is defined and feed.color is not null %} - {% set stylecolor = "background-color: #" ~ feed.color ~ ";" %} - {% endif %} - {% set stylefeed = "" %} - {% if feed.image is not null and feed.image != ""%} - {% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %} - {% endif %} - - - - {% endfor %} -
    -
    -
    -{% endif %} - - - diff --git a/templates/Pagewidget/viewframe.html.twig b/templates/Pagewidget/viewframe.html.twig deleted file mode 100644 index 18c8661..0000000 --- a/templates/Pagewidget/viewframe.html.twig +++ /dev/null @@ -1,77 +0,0 @@ -{% set theme = app.session.get('theme') %} -{% if theme is not empty %} - {{ include('@Theme/'~theme~'/function.html.twig') }} -{% endif %} - -{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} - -{% set stylewidget = constants.mystylewidget(entity) %} -{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} -{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} -{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} -{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} -{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} - -{% set color = app.session.get('color') %} -{% set colorbodyback = entity.colorbodyback %} -{% if colorbodyback is null %} - {% set colorbodyback = color['main'] %} -{% endif %} - -{% set colorbodyfont = entity.colorbodyfont %} -{% if colorbodyfont is null %} - {% set colorbodyfont = color['fontcolorhover'] %} -{% endif %} - -{%if mini %} - -{% else %} -
    - -
    - {% if canupdate %} - - - {% endif %} - - {% if look=="list" %} - - {% else %} - - {% endif %} -
    - - - - {% if onheader %} -
    - -
    - {% else %} -
    - {% if entity.icon %} - - {% else %} - - {% endif %} - {{ entity.name }} -
    - -
    - -
    - {% endif %} -
    -{% endif %} - - diff --git a/templates/Pagewidget/viewgalery.html.twig b/templates/Pagewidget/viewgalery.html.twig deleted file mode 100644 index 39514e9..0000000 --- a/templates/Pagewidget/viewgalery.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{% set widgetname="galery" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} - {% if canadd %} - Ajouter des Images - {% endif %} - - -{% endblock %} \ No newline at end of file diff --git a/templates/Pagewidget/viewinfo.html.twig b/templates/Pagewidget/viewinfo.html.twig deleted file mode 100644 index d8a9c25..0000000 --- a/templates/Pagewidget/viewinfo.html.twig +++ /dev/null @@ -1,64 +0,0 @@ -{% set widgetname="info" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetmenu %} -{% endblock %} - -{% block widgetbody %} - {% for group in entity.page.groups %} - {% if entity.page.groups|length > 1 or not widgethaveheader %} -

    {{group.label}}

    - {% endif %} - {% if group.description %} - {{ group.description|nl2br}} -

    - {% endif %} -
    - {% for member in group.users %} -
    -
    -
    - -
    -
    -
    - {% endfor %} - - {%if canupdate %} - - {% endif %} -
    - {% endfor %} - - {% if entity.page.groups|length == 0 and entity.page.user %} -
    - -
    - {% endif %} -{% endblock %} diff --git a/templates/Pagewidget/viewitem.html.twig b/templates/Pagewidget/viewitem.html.twig deleted file mode 100644 index 3d88bb5..0000000 --- a/templates/Pagewidget/viewitem.html.twig +++ /dev/null @@ -1,174 +0,0 @@ -{% set widgetname="item" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} - {% set havemenu=false %} - {% set havebookmark=false %} - - {% if menu and withbookmark!= 2 and (canadd or bookmarks is not empty or itemcategorys|length > 1) %} - {% set havemenu=true %} -
    - {% if menuall %} -
    Tout
    - {% endif %} - - {% if bookmarks is not empty or canadd %} -
    - {% endif %} - - {% for itemcategory in itemcategorys %} -
    {{itemcategory.label}}
    - {% endfor %} -
    - {% endif %} - - {% if search %} - {% set havemenu=true %} -
    -
    -   -
    - -
    - {% endif %} - - {% if (bookmarks is not empty or canadd ) and (withbookmark==0 or withbookmark==2) %} - {% if withbookmark==0 or itemcategorys|length > 1 %} -

    Favoris

    - {% endif %} -
    - {% for bookmark in bookmarks %} - {% set havebookmark=true %} - {% if bookmark.item %} - {% set bookmarktitle = bookmark.item.title %} - {% set bookmarksubtitle = bookmark.item.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.item.color ? bookmark.item.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.item.target %} - {% set bookmarkurl = ( bookmark.item.protected and not app.user ? path("app_login") : bookmark.item.url|replace({'#login#': username}) ) %} - {% set bookmarkcontent = bookmark.item.content %} - {% set bookmarkicon = (bookmark.item.icon ? bookmark.item.icon.label : "icon/icon_pin.png") %} - {% else %} - {% set bookmarktitle = bookmark.title %} - {% set bookmarksubtitle = bookmark.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.target %} - {% set bookmarkurl = bookmark.url|replace({'#login#': username}) %} - {% set bookmarkcontent = null %} - {% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %} - {% endif %} - -
    -
    -
    - {% if bookmarktarget == 'frame' %} - - {% else %} - - {% endif %} - - -
    -

    {{ bookmarktitle }}

    -
    {{ bookmarksubtitle|nl2br }}
    -
    -
    - -
    - {% if canadd %} - {% if bookmark.item %} - - {% else %} - - - {% endif %} - {% endif %} - - {% if bookmarkcontent %} - - {% endif %} -
    -
    - -
    {{ bookmarkcontent|raw }}
    -
    -
    - {% endfor %} - - {% if (canadd) %} - - {% endif %} -
    - {% endif %} - - {% for itemcategory in itemcategorys %} - {% if itemcategorys|length > 1 or havebookmark or canadd %}

    {{itemcategory.label}}

    {% endif %} -
    - {% for item in items %} - {% if item.itemcategory==itemcategory %} -
    -
    -
    - {% set url=item.url|replace({'#login#': username}) %} - {% if item.protected and not app.user %} - {% set url=path('app_login') %} - {% endif %} - - {% if item.target == 'frame' %} - - {% else %} - - {% endif %} - - {% if item.icon %} - - {% else %} - - {% endif %} - -
    -

    {{ item.title }}

    -
    {{ item.subtitle|nl2br }}
    -
    -
    - -
    - {% if canadd %} - - {% endif %} - - {% if item.content %} - - {% endif %} -
    -
    - -
    {{ item.content|raw }}
    -
    -
    - {% endif %} - {% endfor %} -
    - {% endfor %} -{% endblock %} - - diff --git a/templates/Pagewidget/viewitemessential.html.twig b/templates/Pagewidget/viewitemessential.html.twig deleted file mode 100644 index 25c615d..0000000 --- a/templates/Pagewidget/viewitemessential.html.twig +++ /dev/null @@ -1,131 +0,0 @@ -{% set widgetname="itemessential" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - - -{% block widgetbody %} -
    - {% for bookmark in bookmarks %} - {% set havebookmark=true %} - {% if bookmark.item %} - {% set bookmarktitle = bookmark.item.title %} - {% set bookmarksubtitle = bookmark.item.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.item.color ? bookmark.item.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.item.target %} - {% set bookmarkurl = ( bookmark.item.protected and not app.user ? path("app_login") : bookmark.item.url|replace({'#login#': username}) ) %} - {% set bookmarkcontent = bookmark.item.content %} - {% set bookmarkicon = (bookmark.item.icon ? bookmark.item.icon.label : "icon/icon_pin.png") %} - {% else %} - {% set bookmarktitle = bookmark.title %} - {% set bookmarksubtitle = bookmark.subtitle %} - {% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %} - {% set bookmarktarget = bookmark.target %} - {% set bookmarkurl = bookmark.url|replace({'#login#': username}) %} - {% set bookmarkcontent = null %} - {% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %} - {% endif %} - -
    -
    -
    - {% if bookmarktarget == 'frame' %} - - {% else %} - - {% endif %} - - -
    -

    {{ bookmarktitle }}

    -
    {{ bookmarksubtitle|nl2br }}
    -
    -
    - -
    - {% if canadd %} - {% if bookmark.item %} - - {% else %} - - - {% endif %} - {% endif %} - - {% if bookmarkcontent %} - - {% endif %} -
    -
    - -
    {{ bookmarkcontent|raw }}
    -
    -
    - {% endfor %} - - {% for item in items %} -
    -
    -
    - {% set url=item.url|replace({'#login#': username}) %} - {% if item.protected and not app.user %} - {% set url=path('app_login') %} - {% endif %} - - {% if item.target == 'frame' %} - - {% else %} - - {% endif %} - - {% if item.icon %} - - {% else %} - - {% endif %} - -
    -

    {{ item.title }}

    -
    {{ item.subtitle|nl2br }}
    -
    -
    - -
    - {% if canadd %} - - {% endif %} - - {% if item.content %} - - {% endif %} -
    -
    - -
    {{ item.content|raw }}
    -
    -
    - {% endfor %} - - -
    -{% endblock %} - - diff --git a/templates/Pagewidget/viewlink.html.twig b/templates/Pagewidget/viewlink.html.twig deleted file mode 100644 index 7001240..0000000 --- a/templates/Pagewidget/viewlink.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{% set widgetname="link" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetbody %} - {% set url=url|replace({'#login#': username}) %} - {% if target == 'frame' %} - - {% else %} - - {% endif %} - - {% if entity.icon %} - - {% else %} - - {% endif %} - - -
    {{ entity.name }}
    -
    -{% endblock %} - - diff --git a/templates/Pagewidget/viewproject.html.twig b/templates/Pagewidget/viewproject.html.twig deleted file mode 100644 index 7e9d80c..0000000 --- a/templates/Pagewidget/viewproject.html.twig +++ /dev/null @@ -1,133 +0,0 @@ -{% import "Pagewidget/constants.twig" as constants %} - -{% set stylewidget = constants.mystylewidget(entity) %} -{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} -{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} -{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} -{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} - - - -{%if mini %} - -{% else %} -
    -
    - {% if canupdate %} - - - {% endif %} - - {% if access=="config" %} - - {% elseif app.user %} - {% set idproject = "" %} - {% set urladd= path('app_user_projecttask_submit') %} - {% set urlview= path('app_user_project_view') %} - {% if usage=="group" and firstproject is defined %} - {% set urladd= path('app_user_projecttask_submit',{idproject:firstproject,page:entity.page.id}) %} - {% set urlview= path('app_user_project_view',{id:firstproject}) %} - {% endif %} - - - {% endif %} - - {% if look=="list" %} - - {% else %} - - {% endif %} -
    - -
    - {% if entity.icon %} - - {% else %} - - {% endif %} - {{ entity.name }} -
    - - {% if projecttasks|length >= 1 %} - - {% endif %} -
    -{% endif %} - - - diff --git a/templates/Pagewidget/viewslide.html.twig b/templates/Pagewidget/viewslide.html.twig deleted file mode 100644 index af73412..0000000 --- a/templates/Pagewidget/viewslide.html.twig +++ /dev/null @@ -1,52 +0,0 @@ -{% set widgetname="slide" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetaction %} - {% if canadd %} - - {% endif %} -{% endblock %} - -{% block widgetbody %} -{% set intervalmilli = interval * 1000 %} - -
    - {% if slides is empty and canadd %} -
    -
    - Gérer le Carrousel -
    - {% endif %} - - {% for slide in slides %} - {% if slide.url is not empty %} - {% set url=slide.url|replace({'#login#': username}) %} - {% if slide.target == 'frame' %} - - {% else %} - - {% endif %} - {% endif %} -
    -
    - {% if slide.title is not empty %} -

    {{slide.title}}

    - {% endif %} - - {% if slide.subtitle is not empty %} - {{slide.subtitle}} - {% endif %} -
    -
    - - {% if slide.url is not empty %} -
    - {% endif %} - {% endfor %} -
    - -{% endblock %} - - - - diff --git a/templates/Pagewidget/viewurl.html.twig b/templates/Pagewidget/viewurl.html.twig deleted file mode 100644 index 2001de5..0000000 --- a/templates/Pagewidget/viewurl.html.twig +++ /dev/null @@ -1,11 +0,0 @@ -{% set widgetname="url" %} -{% extends 'Pagewidget/widget.twig' %} - -{% block widgetbody %} - {% if imagemedia %} - - {% else %} - - {% endif %} -{% endblock %} - diff --git a/templates/Pagewidget/widget.twig b/templates/Pagewidget/widget.twig deleted file mode 100644 index 023cb52..0000000 --- a/templates/Pagewidget/widget.twig +++ /dev/null @@ -1,101 +0,0 @@ -{% set widgethaveheader=entity.viewheader %} - -{% if widgetname=="alert" and canupdate and alerts|length ==0 %} - {% set widgethaveheader=true %} -{% endif %} -{% if widgetname=="item" and canupdate and items|length==0 and withbookmark==1 %} - {% set widgethaveheader=true %} -{% endif %} -{% if widgetname=="bookmark" and canadd and bookmarks|length==0 %} - {% set widgethaveheader=true %} -{% endif %} -{% if widgetname=="editor" and canadd and html is empty %} - {% set widgethaveheader=true %} -{% endif %} - - -{% set viewwidget=true %} -{% if not widgethaveheader and widgetname=="alert" and not canupdate and alerts|length ==0 %} - {% set viewwidget=false %} -{% endif %} -{% if not widgethaveheader and widgetname=="item" and not canupdate and items|length ==0 and withbookmark==1 %} - {% set viewwidget=false %} -{% endif %} -{% if not widgethaveheader and widgetname=="bookmark" and not canadd and bookmarks|length ==0 %} - {% set viewwidget=false %} -{% endif %} -{% if not widgethaveheader and widgetname=="editor" and not canadd and html is empty %} - {% set viewwidget=false %} -{% endif %} - - - - -{%if widgethaveheader %} -{% set widgetstyle=(entity.colorheaderback ? "border-color:"~entity.colorheaderback~";" : "border-color:var(--colorbgbodydark);") %} -{% set widgetstylemenu=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %} -{%else%} -{% set widgetstyle=(viewwidget ? "display:block;" : "display:none;")~(entity.colorbodyback ? "border-color:"~entity.colorbodyback~";" : "border-color:var(--colorbgbodydark);") %} -{% set widgetstylemenu="margin:-26px 0px 0px 0px; padding: 1px 10px; background-color:var(--colorbgbodydark); color: var(--colorfttitledark); border-radius: 5px;" %} -{%endif%} - -{% set widgetstyleheader=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %} -{% set widgetstylebody=(entity.colorbodyback ? "background-color:"~entity.colorbodyback~";" : "background-color:var(--colorbgbodylight);")~(entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);")~(entity.isopened ? "display:block;" : "display:none;")~(widgetname=="url" ? "padding:0px;" : "")~(not widgethaveheader and not entity.border ? "padding-top: 0px;" : "")~(entity.autoajust ? "" : "height:"~entity.height~"px;") %} -{% set widgeicon= entity.icon ? path('app_minio_image',{file:entity.icon.label}) : path('app_minio_image',{file:"icon/icon_pin.png"}) %} - -{% if modedesktop is defined %} - {% if modedesktop==0 %} - {% set itemsize="item-verysmall" %} - {% elseif modedesktop==1 %} - {% set itemsize="item-small" %} - {% elseif modedesktop==2 %} - {% set itemsize="item-medium" %} - {% elseif modedesktop==3 %} - {% set itemsize="item-large" %} - {% elseif modedesktop==4 %} - {% set itemsize="item-list" %} - {% endif %} -{% endif %} - -{% if app.user %} - {% set username = app.user.username %} -{% else %} - {% set username = "" %} -{% endif %} - -{% set colorbodyfont = "color: var(--colorfttitlelight)" %} -{% if entity.colorbodyfont is not null %} - {% set colorbodyfont = "color: " ~ entity.colorbodyfont %} -{% endif %} - - -
    -
    - {% if canupdate and not widgethaveheader %} - - {% endif %} - - {% block widgetaction %} - {% endblock %} - - {% if canupdate %} - - - {% endif %} -
    - - {%if widgethaveheader %} -
    - - {{ entity.name }} -
    - {%endif%} - -
    - {% block widgetbody %} - {% endblock %} -
    -
    - - - diff --git a/templates/Pagewidgetslide/edit.html.twig b/templates/Pagewidgetslide/edit.html.twig deleted file mode 100755 index 111e1e8..0000000 --- a/templates/Pagewidgetslide/edit.html.twig +++ /dev/null @@ -1,67 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -{{ form_start(form) }} -

    - {% if mode=="update" %} - Modification Carrousel - {% elseif mode=="submit" %} - Création Carrousel - {% endif %} -

    - - {{ form_widget(form.submit) }} - Annuler - - {% if mode=="update" %} - - Supprimer - - {% endif %} - -

    - - {% if app.session.flashbag.has('error') %} -
    - Erreur
    - {% for flashMessage in app.session.flashbag.get('error') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - {% if app.session.flashbag.has('notice') %} -
    - Information
    - {% for flashMessage in app.session.flashbag.get('notice') %} - {{ flashMessage }}
    - {% endfor %} -
    - {% endif %} - - -
    -
    - {{ form_row(form.title) }} - {{ form_row(form.subtitle) }} - -
    - - Modifier -
    -
    - - -
    - {{ form_row(form.roworder) }} - {{ form_row(form.url) }} - le mot clé #login# sera remplacé par le login de l'utilisateur

    - {{ form_row(form.target) }} -
    -
    -{{ form_end(form) }} -{% endblock %} - diff --git a/templates/Pagewidgetslide/list.html.twig b/templates/Pagewidgetslide/list.html.twig deleted file mode 100644 index 643da46..0000000 --- a/templates/Pagewidgetslide/list.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{% extends 'base.html.twig' %} - -{% block body %} -

    Gestion des Carrousels

    - -

    - Ajouter - Retour -

    - - - {% for pagewidgetslide in pagewidgetslides %} - - - - {% endfor %} -{% endblock %} - diff --git a/templates/Pin/edit.html.twig b/templates/Pin/edit.html.twig new file mode 100644 index 0000000..8363047 --- /dev/null +++ b/templates/Pin/edit.html.twig @@ -0,0 +1,71 @@ + +{% extends 'base.html.twig' %} + +{% block body %} +{{ form_start(form) }} +

    + {% if mode=="submit" %} + Création pin + {% else %} + Modification pin + {% endif %} +

    + + {{ form_widget(form.submit) }} + + Annuler + + {% if mode=="update" %} + + Supprimer + + {% endif %} + +

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    + {% set image= "noimage.png" %} + {% if pin.image %} + {% set image= pin.image %} + {% endif %} + + {{ form_widget(form.image) }} + Modifier +
    + +
    +
    + Informations +
    + +
    + {{ form_row(form.name) }} + {{ form_row(form.subname) }} + {{ form_row(form.description) }} +
    +
    +{{ form_end(form) }} +{% endblock %} + + diff --git a/templates/Pin/list.html.twig b/templates/Pin/list.html.twig new file mode 100644 index 0000000..a11377a --- /dev/null +++ b/templates/Pin/list.html.twig @@ -0,0 +1,55 @@ +{% extends "base.html.twig" %} + +{% block body %} +

    + pins +

    + +

    Ajouter

    + +
    +
    + Liste des pins +
    + +
    +
    + + + + + + + + + + {% for pin in pins %} + + + + + + {% endfor %} + +
    ActionIDNom
    + + {{pin.id}}{{pin.name}}
    +
    +
    +
    +{% endblock %} + +{% block localscript %} + + +{% endblock %} + diff --git a/templates/Pin/view.html.twig b/templates/Pin/view.html.twig new file mode 100644 index 0000000..f7a0f99 --- /dev/null +++ b/templates/Pin/view.html.twig @@ -0,0 +1,13 @@ +{% extends "base.html.twig" %} + +{% block body %} + {% set image= "noimage.png" %} + {% if image %} + {% set image= pin.image %} + {% endif %} + + + {% if pin.subname %}{{ pin.subname }}{%endif%}

    + {{pin.description|raw}} +{% endblock %} + diff --git a/templates/Pagetemplate/submit.html.twig b/templates/Tag/edit.html.twig similarity index 61% rename from templates/Pagetemplate/submit.html.twig rename to templates/Tag/edit.html.twig index 88c71b5..d0e30eb 100644 --- a/templates/Pagetemplate/submit.html.twig +++ b/templates/Tag/edit.html.twig @@ -1,15 +1,30 @@ + {% extends 'base.html.twig' %} {% block body %} {{ form_start(form) }}

    - Nouveau Modèle de Page + {% if mode=="submit" %} + Création tag + {% else %} + Modification tag + {% endif %}

    + + {{ form_widget(form.submit) }} -

    - {{ form_widget(form.submit) }} - Annuler -

    + Annuler + + {% if mode=="update" %} + + Supprimer + + {% endif %} + +

    {% if app.session.flashbag.has('error') %}
    @@ -35,11 +50,13 @@
    - {{ form_row(form.name) }} - {{ form_row(form.parentfor) }} - {{ form_row(form.roworder) }} - {{ form_row(form.maxwidth) }} + {{ form_row(form.id) }} + {{ form_row(form.childs) }}
    {{ form_end(form) }} {% endblock %} + + + + diff --git a/templates/Tag/list.html.twig b/templates/Tag/list.html.twig new file mode 100644 index 0000000..2a66fbc --- /dev/null +++ b/templates/Tag/list.html.twig @@ -0,0 +1,52 @@ +{% extends "base.html.twig" %} + +{% block body %} +

    + tags +

    + +

    Ajouter

    + +
    +
    + Liste des tags +
    + +
    +
    + + + + + + + + + {% for tag in tags %} + + + + + {% endfor %} + +
    ActionID
    + + {{tag.id}}
    +
    +
    +
    +{% endblock %} + +{% block localscript %} + +{% endblock %} + diff --git a/templates/base.html.twig b/templates/base.html.twig index a3b15e8..716f2cf 100755 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -83,16 +83,50 @@ {% endif %}
    {% endif %} + {% block beforebody %} + {% endblock %} +
    {% if usesidebar is defined and usesidebar %} {% if is_granted('ROLE_ADMIN') %} @@ -183,8 +224,62 @@
    + + {% block localscript %}{% endblock %}