From 800945e44b5470a6d06c11790eedd3d56714c873 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 23 Jan 2023 09:46:34 +0100 Subject: [PATCH] ninegate --- .env | 4 +- assets/app.js | 4 + assets/js/app.js | 57 +- assets/styles/app.css | 177 ++- config/routes.yaml | 220 ++- docker-compose.yml | 2 +- migrations/Version20221002124137.php | 156 --- migrations/Version20230105192629.php | 193 --- migrations/Version20230111095833.php | 64 - migrations/Version20230112085854.php | 34 - migrations/Version20230123084600.php | 298 ++++ package.json | 1 + src/Command/InitCommand.php | 198 ++- src/Controller/AlertController.php | 21 - src/Controller/BookmarkController.php | 263 ++-- src/Controller/GroupController.php | 60 +- src/Controller/HomeController.php | 38 +- src/Controller/ItemController.php | 21 - src/Controller/PageController.php | 548 ++++++++ src/Controller/PagetemplateController.php | 60 +- src/Controller/PagewidgetController.php | 1208 ++++++----------- src/Entity/Alert.php | 2 +- src/Entity/Group.php | 33 + src/Entity/User.php | 33 + src/Form/BookmarkType.php | 64 + src/Form/GroupType.php | 14 + src/Form/ItemType.php | 3 +- src/Form/PageSubmitType.php | 148 ++ src/Form/PageUpdateWidgetType.php | 11 +- src/Form/Type/FaChoiceType.php | 1 - src/Repository/AlertRepository.php | 57 +- src/Repository/ItemRepository.php | 5 +- src/Repository/PageRepository.php | 414 +++++- templates/Bookmark/edit.html.twig | 126 ++ templates/Group/edit.html.twig | 20 +- templates/Group/users.html.twig | 9 +- templates/Home/page.html.twig | 50 - templates/Include/sidebaradmin.html.twig | 8 +- templates/Item/edit.html.twig | 1 - templates/Item/list.html.twig | 13 +- templates/Page/list.html.twig | 9 +- templates/Page/menugroupe.html.twig | 42 +- templates/Page/noportal.html.twig | 334 ----- templates/Page/pages.html.twig | 708 ++++------ templates/Page/share.html.twig | 46 - templates/Page/submit.html.twig | 34 +- templates/Page/updatewidget.html.twig | 75 +- templates/Page/viewwidget.html.twig | 90 +- templates/Pagetemplate/list.html.twig | 4 +- templates/Pagetemplate/submit.html.twig | 2 +- templates/Pagewidget/constants.twig | 238 ---- templates/Pagewidget/edit.html.twig | 21 +- templates/Pagewidget/viewalert.html.twig | 166 +-- .../Pagewidget/viewappexternal.html.twig | 112 -- templates/Pagewidget/viewbookmark.html.twig | 194 ++- templates/Pagewidget/viewgroup.html.twig | 116 -- templates/Pagewidget/viewinfo.html.twig | 96 +- templates/Pagewidget/viewitem.html.twig | 371 ++--- .../Pagewidget/viewitemessential.html.twig | 346 ++--- templates/Pagewidget/viewlink.html.twig | 29 +- templates/Pagewidget/viewonlydoc.html.twig | 76 -- templates/Pagewidget/viewurl.html.twig | 93 +- templates/Pagewidget/widget.twig | 69 + templates/Pagewidget/widgetheader.html.twig | 91 -- templates/Pagewidget/widgetmini.html.twig | 13 - templates/base.html.twig | 61 +- yarn.lock | 5 + 67 files changed, 3792 insertions(+), 4288 deletions(-) delete mode 100755 migrations/Version20221002124137.php delete mode 100644 migrations/Version20230105192629.php delete mode 100644 migrations/Version20230111095833.php delete mode 100644 migrations/Version20230112085854.php create mode 100644 migrations/Version20230123084600.php create mode 100644 src/Controller/PageController.php create mode 100755 src/Form/BookmarkType.php create mode 100644 src/Form/PageSubmitType.php create mode 100755 templates/Bookmark/edit.html.twig delete mode 100644 templates/Home/page.html.twig delete mode 100644 templates/Page/noportal.html.twig delete mode 100644 templates/Page/share.html.twig delete mode 100644 templates/Pagewidget/constants.twig delete mode 100644 templates/Pagewidget/viewappexternal.html.twig delete mode 100644 templates/Pagewidget/viewgroup.html.twig delete mode 100644 templates/Pagewidget/viewonlydoc.html.twig create mode 100644 templates/Pagewidget/widget.twig delete mode 100644 templates/Pagewidget/widgetheader.html.twig delete mode 100644 templates/Pagewidget/widgetmini.html.twig diff --git a/.env b/.env index edd3f53..3eee9f8 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/app?serverVersion=13&charset=utf8" +DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8" # Redis Session REDIS_HOST=127.0.0.1 @@ -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/app?serverVersion=13&charset=utf8" +LOCK_DSN="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8" # Sentry SENTRY_DSN= diff --git a/assets/app.js b/assets/app.js index 59b3656..4c36e06 100755 --- a/assets/app.js +++ b/assets/app.js @@ -41,6 +41,10 @@ require('spectrum-colorpicker2/dist/spectrum.min.css'); require('crop-select-js/crop-select-js.min.css'); window.CropSelectJs = require('crop-select-js/crop-select-js.min.js'); +// iframe-resizer +require('iframe-resizer/js/iframeResizer.min.js'); +require('iframe-resizer/js/iframeResizer.contentWindow.min.js'); + // Start the Stimulus application import './bootstrap'; diff --git a/assets/js/app.js b/assets/js/app.js index 901a68b..0b761ff 100755 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -2,13 +2,16 @@ $(document).ready(function() { // Color $(".pick-a-color").spectrum( { - type: "text", - showAlpha: false + preferredFormat: "hex", + type: "string", + showPalette: true, + allowEmpty: true, + showAlpha: false, } ); $(".pick-a-color").attr("autocomplete","off"); - // method confirm + // Method confirm var doit = true; $("a[data-method]").on('click',function(){ if($(this).data('confirm')){ @@ -57,33 +60,45 @@ $(document).ready(function() { } }); - // Resize - resize(); + // select2-icon + function iformat(icon) { + return $(' ' + icon.text + ''); + } + $('.select2-icon').select2({ + width: "100%", + placeholder: 'choisir un icône', + allowClear: true, + templateSelection: iformat, + templateResult: iformat, + formatResult: iformat, + allowHtml: true, + escapeMarkup: function(m) { + return m; + } + }) + + // Menu + $(".dropdown-toggle").click(function(){ + $(this).parent().find(".dropdown-menu").toggle(); + }) + $(".nav-toogle").click(function(){ + $("#selmenu").modal("toggle"); + }) + + + + // Forcer le resize des objects + Resize(); // Focus $("#page").focus(); }); $( window ).resize(function() { - resize(); + Resize(); }); -function resize() { - if($("#header").is(":visible")){ - $(".navbar-logo").hide(); - $("#menulink").hide(); - $("#header").hide(); - } - else { - $(".navbar-logo").show(); - $("#menulink").show(); - $("#header").show(); - } - $("main").css("height",$(window).height()-$(".header").height()); - $("#page").css("height",$(window).height()-$(".header").height()); - $("#sidebar").css("min-height",$("body").height()-$(".header").height()); -} diff --git a/assets/styles/app.css b/assets/styles/app.css index e696e6c..91b60f1 100755 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -114,52 +114,111 @@ border-width: 1px; padding: 0 0 0 0.5rem !important; } .navbar-logo img{ - height:20px; + height:30px; } -.navbar i { - font-size: 20px; - min-width: 30px; - height:20px; +#menulink { + zoom:150%; } /* MENU */ #menu { - height:50px; + min-height:44px; padding: 0px 0px 0px 10px !important; + justify-content: space-around; } #menu .navbar-logo { margin-right: 10px; } +#menuapp { + background-color: var(--colorbgbodydark); +} + +#menuuser { + min-width: 100px; + display:flex; + justify-content: end; +} + +.nav-item { + padding:10px 10px; +} + + +.nav-item.active { + background-color: var(--colorbgbodydark-darker); +} + +.menupage a { + display: flex; + align-items: center; +} + +.menupage a i{ + margin-right: 5px; +} + +.dropdown-menu { + background-color: var(--colorbgbodydark); + margin-top: 15px; +} + +.dropdown-item:hover, .dropdown-item:focus { + background-color: var(--colorbgbodydark-darker); + color: var(--colorftbodydark); +} + + @media (max-width: 991px) { #menu { display:flex !important; - height: auto; padding: 0px !important; } + #menuapp { + position: absolute; + top:50px; + left:0px; + width:100%; + overflow-y: auto; + height:500px; + display:none; + } + + #menuapp .nav { + flex-direction: column; + } + + #menuapp .navbar-nav { + flex-direction: column; + padding:15px; + } + + #menu .nav-toogle { + display:block !important; + } + + #pagesportal { + display:block !important; + } + + #pagesuser { + display:block !important; + } + .navbar-logo { padding: 10px 5px 10px 10px !important; } - .navbar-logo img { - height:40px; - } - - .navbar i { - font-size: 20px; - min-width: 30px; - height:20px; - } - #switchHeader { display:none; } -} +} + /* SIDEBAR */ #sidebar { @@ -230,6 +289,10 @@ border-width: 1px; display: none !important; } +.card-body .form-group:first-child { + margin-top: 0px !important; +} + /* ITEM */ .itemframe { @@ -239,6 +302,7 @@ border-width: 1px; .items-list { display:flex; flex-wrap: wrap; + margin-bottom: 5px; } .item { @@ -247,7 +311,7 @@ border-width: 1px; text-align: center; justify-content: center; margin-right:5px; - margin-top:5px; + margin-bottom:5px; flex-wrap: wrap; color: var(--colorftbodydark) !important; } @@ -287,7 +351,7 @@ border-width: 1px; } .item-subtitle { - font-size: 12px; + font-size: 10px; margin:0px; color: var(--colorftbodydark); } @@ -295,9 +359,16 @@ border-width: 1px; .item-description { color: var(--colorftbodydark); text-align: left; - padding: 0px 10px; + 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; @@ -433,3 +504,67 @@ border-width: 1px; .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; +} + +.cat-list { + color: var(--colorfttitledark); + background-color: var(--colorbgbodydark); + padding: 5px 10px; + display: inline-block; + cursor: pointer; +} + diff --git a/config/routes.yaml b/config/routes.yaml index 18e917b..30664a9 100755 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -913,11 +913,6 @@ app_admin_alert_order: controller: App\Controller\AlertController::order defaults: { access: admin } -app_admin_ajax_alert_seleclist: - path: /admin/alert/ajax/selectlist - controller: App\Controller\AlertController::seleclist - defaults: { access: admin } - #-- Access all app_all_alert_read: path: /all/alert/read @@ -970,11 +965,6 @@ app_admin_item_order: controller: App\Controller\ItemController::order defaults: { access: admin } -app_admin_item_selectlist: - path: /admin/item/selectlist - controller: App\Controller\ItemController::seleclist - defaults: { access: admin } - #== ITEM CATEGORY ======================================================================================================================================== @@ -1004,17 +994,22 @@ app_admin_itemcategory_order: #-- Access config app_admin_bookmark_submit: path: /admin/bookmark/submit/{idpage}/{idwidget}/{touser} - controller: App\Controller\BookmarkController::order + controller: App\Controller\BookmarkController::submit defaults: { access: admin } app_admin_bookmark_update: - path: /admin/bookmark/update/{idpage}/{id} + path: /admin/bookmark/update/{id}/{idpage}/{idwidget}/{touser} controller: App\Controller\BookmarkController::update defaults: { access: admin } app_admin_bookmark_delete: - path: /admin/bookmark/delete/{idpage}/{id} + 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 @@ -1024,12 +1019,12 @@ app_all_bookmark_submit: defaults: { access: all } app_all_bookmark_update: - path: /all/bookmark/update/{idpage}/{id} + path: /all/bookmark/update/{id}/{idpage}/{idwidget}/{touser} controller: App\Controller\BookmarkController::update defaults: { access: all } app_all_bookmark_delete: - path: /all/bookmark/delete/{idpage}/{id} + path: /all/bookmark/delete/{id}/{idpage}/{idwidget}/{touser} controller: App\Controller\BookmarkController::delete defaults: { access: all } @@ -1233,148 +1228,149 @@ app_all_message_see: #== PAGE TEMPLATE ======================================================================================================================================== #-- Access admin -app_admin_pagetemplate: +app_admin_page_template: path: /admin/template controller: App\Controller\PagetemplateController::list - defaults: { access: admin } + defaults: { access: admin, usage: template } -app_admin_pagetemplate_tablelist: +app_admin_page_template_tablelist: path: /admin/template/tablelist controller: App\Controller\PagetemplateController::tablelist - defaults: { access: admin } + defaults: { access: admin, usage: template } -app_admin_pagetemplate_submit: +app_admin_template_submit: path: /admin/template/submit controller: App\Controller\PagetemplateController::submit - defaults: { access: admin } + defaults: { access: admin, usage: template } -app_admin_pagetemplate_update: +app_admin_page_template_update: path: /admin/template/update/{id} controller: App\Controller\PagetemplateController::update - defaults: { access: admin } + defaults: { access: admin, usage: template } -app_admin_pagetemplate_delete: +app_admin_page_template_delete: path: /admin/template/delete/{id} controller: App\Controller\PagetemplateController::delete - defaults: { access: admin } + defaults: { access: admin, usage: template } -app_admin_pagetemplate_view: +app_admin_page_template_view: path: /admin/template/view/{id} controller: App\Controller\PagetemplateController::view - defaults: { access: admin } + defaults: { access: admin, usage: template } #-- Access all -app_all_pagetemplate_selectlist: +app_all_page_template_selectlist: path: /all/template/selectlist controller: App\Controller\PagetemplateController::selectlist - defaults: { access: admin } + defaults: { access: admin, usage: template } #== PAGE ================================================================================================================================================= #-- Access admin -app_admin_page: +app_admin_page_portal: path: /admin/page/ controller: App\Controller\PageController::list - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_ajax_list: - path: /admin/page/ajax/list +app_admin_page_portal_tablelist: + path: /admin/page/tablelist controller: App\Controller\PageController::tablelist - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_ajax_page_seleclist: - path: /admin/page//ajax/selectlist - controller: App\Controller\PageController::selectlist - defaults: { access: admin } - -app_admin_page_submit: +app_admin_page_portal_submit: path: /admin/page/submit controller: App\Controller\PageController::submit - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_update: +app_admin_page_portal_update: path: /admin/page/update/{id} controller: App\Controller\PageController::update - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_delete: +app_admin_page_portal_delete: path: /admin/page/delete/{id} controller: App\Controller\PageController::delete - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_view: +app_admin_page_portal_view: path: /admin/page/view/{id} controller: App\Controller\PageController::view - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_order: +app_admin_page_portal_order: path: /admin/page/order controller: App\Controller\PageController::order - defaults: { access: admin } + defaults: { access: admin, usage: portal } -app_admin_page_upload: - path: /admin/page/upload - controller: App\Controller\PageController::upload - defaults: { access: admin } - -app_admin_page_upload_direct: - path: /admin/page//upload&responseType=json - controller: App\Controller\PageController::upload - defaults: { access: admin } - -#-- Access all -app_all_page_submit: - path: /all/page/submit +#-- Access all +# usage=user +app_all_page_user_submit: + path: /all/page/user/submit controller: App\Controller\PageController::submit - defaults: { access: all } + defaults: { access: all, usage: user } -app_all_page_update: - path: /all/page/update/{id} +app_all_page_user_update: + path: /all/page/user/update/{id} controller: App\Controller\PageController::update - defaults: { access: all } + defaults: { access: all, usage: user } -app_all_page_delete: - path: /all/page/delete/{id} +app_all_page_user_delete: + path: /all/page/user/delete/{id} controller: App\Controller\PageController::delete - defaults: { access: all } + defaults: { access: all, usage: user } -app_all_page_share: - path: /all/page/share/{id} - controller: App\Controller\PageController::share - defaults: { access: all } - -app_all_page_view: - path: /page/view/{id} - controller: App\Controller\PageController::view - defaults: { access: all } - -app_all_page_order: - path: /all/page/order +app_all_page_user_order: + path: /all/page/user/order controller: App\Controller\PageController::order - defaults: { access: all } + defaults: { access: all, usage: user } -app_all_page_upload: - path: /all/page/upload - controller: App\Controller\PageController::selectlist - defaults: { access: all } +# usage=group +app_all_page_group_submit: + path: /all/page/group/submit + controller: App\Controller\PageController::submit + defaults: { access: all, usage: group } -app_all_page_upload_direct: - path: /all/page/upload&responseType=json - controller: App\Controller\PageController::upload - defaults: { access: all } +app_all_page_group_update: + path: /all/page/group/update/{id} + controller: App\Controller\PageController::update + defaults: { access: all, usage: group } -# Page spécifique +app_all_page_group_delete: + path: /all/page/group/delete/{id} + controller: App\Controller\PageController::delete + defaults: { access: all, usage: group } + +app_all_page_group_order: + path: /all/page/group/order + controller: App\Controller\PageController::order + defaults: { access: all, usage: group } + +#-- Access visitor +# usage=portal +app_all_page_portal_view: + path: /page/portal/view/{id} + controller: App\Controller\PageController::view + defaults: { access: all, usage: portal } + +# usage=user +app_all_page_user_view: + path: /page/user/view/{id} + controller: App\Controller\PageController::view + defaults: { access: all, usage: user } + +# usage=group +app_all_page_group_view: + path: /page/group/view/{id} + controller: App\Controller\PageController::view + defaults: { access: all, usage: group } + +#-- Page spécifique app_all_page_application: path: /page/application controller: App\Controller\PageController::application defaults: { access: all } -app_all_page_ajax_msgcounter: - path: /page/msgcounter - controller: App\Controller\PageController::msgcounter - defaults: { access: all } - #== PAGE WIDGET ========================================================================================================================================== @@ -1397,22 +1393,12 @@ app_admin_pagewidget_delete: app_admin_pagewidget_order: path: /admin/pagewidget/order - controller: App\Controller\PageController::order - defaults: { access: admin } - -app_admin_pagewidget_upload: - path: /admin/pagewidget/upload - controller: App\Controller\PagewidgetController::upload - defaults: { access: admin } - -app_admin_pagewidget_upload_direct: - path: /admin/pagewidget/upload&responseType=json - controller: App\Controller\PagewidgetController::upload + controller: App\Controller\PagewidgetController::order defaults: { access: admin } app_admin_pagewidget_view_url: path: /admin/pagewidget/view/url/{id} - controller: App\Controller\PageController::viewurl + controller: App\Controller\PagewidgetController::viewurl defaults: { access: admin } app_admin_pagewidget_view_urlfixe: @@ -1512,35 +1498,25 @@ app_admin_pagewidget_view_groupmessage: #-- Access all app_all_pagewidget_widget_sumbit: - path: /user/pagewidget/submit/{idpage}/{idwidgettype} + path: /all/pagewidget/submit/{idpage}/{idwidgettype} controller: App\Controller\PagewidgetController::submit defaults: { access: all } app_all_pagewidget_widget_update: - path: /user/pagewidget/update/{idpage}/{idwidget} + path: /all/pagewidget/update/{idpage}/{idwidget} controller: App\Controller\PagewidgetController::update defaults: { access: all } app_all_pagewidget_delete: - path: /user/pagewidget/delete/{idwidget} + path: /all/pagewidget/delete/{idwidget} controller: App\Controller\PagewidgetController::delete defaults: { access: all } app_all_pagewidget_order: - path: /user/pagewidget/order + path: /all/pagewidget/order controller: App\Controller\PagewidgetController::order defaults: { access: all } -app_all_pagewidget_upload: - path: /user/pagewidget/upload - controller: App\Controller\PagewidgetController::upload - defaults: { access: all } - -app_all_pagewidget_upload_direct: - path: /user/pagewidget/upload&responseType=json - controller: App\Controller\PagewidgetController::upload - defaults: { access: all } - app_all_pagewidget_view_url: path: /pagewidget/view/url/{id} controller: App\Controller\PagewidgetController::viewurl diff --git a/docker-compose.yml b/docker-compose.yml index d49f388..98aaa0e 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -31,7 +31,7 @@ services: container_name: nineskeletor-postgresql hostname: nineskeletor-postgresql environment: - POSTGRES_MULTIPLE_DATABASES: app,hydra + POSTGRES_MULTIPLE_DATABASES: ninegate,hydra POSTGRES_PASSWORD: ChangeMe POSTGRES_USER: symfony ports: diff --git a/migrations/Version20221002124137.php b/migrations/Version20221002124137.php deleted file mode 100755 index 96fa01e..0000000 --- a/migrations/Version20221002124137.php +++ /dev/null @@ -1,156 +0,0 @@ -addSql('CREATE SEQUENCE audit_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 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 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 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 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 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 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 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 groupe ADD CONSTRAINT FK_4B98C217E3C61F9 FOREIGN KEY (owner_id) REFERENCES useraccount (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 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 audit_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE cron_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE groupe_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 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 groupe DROP CONSTRAINT FK_4B98C217E3C61F9'); - $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 audit'); - $this->addSql('DROP TABLE config'); - $this->addSql('DROP TABLE cron'); - $this->addSql('DROP TABLE groupe'); - $this->addSql('DROP TABLE niveau01'); - $this->addSql('DROP TABLE niveau02'); - $this->addSql('DROP TABLE niveau03'); - $this->addSql('DROP TABLE niveau04'); - $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 messenger_messages'); - } -} diff --git a/migrations/Version20230105192629.php b/migrations/Version20230105192629.php deleted file mode 100644 index fa0cc43..0000000 --- a/migrations/Version20230105192629.php +++ /dev/null @@ -1,193 +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 bookmark_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 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 slide_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 alertniveau01 (alert INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(alert, niveau01))'); - $this->addSql('CREATE INDEX IDX_87E7389C17FD46C1 ON alertniveau01 (alert)'); - $this->addSql('CREATE INDEX IDX_87E7389C6DFC7E23 ON alertniveau01 (niveau01)'); - $this->addSql('CREATE TABLE alertuserread (alert INT NOT NULL, "user" INT NOT NULL, PRIMARY KEY(alert, "user"))'); - $this->addSql('CREATE INDEX IDX_D4317FA917FD46C1 ON alertuserread (alert)'); - $this->addSql('CREATE INDEX IDX_D4317FA98D93D649 ON alertuserread ("user")'); - $this->addSql('CREATE TABLE alertitem (alert INT NOT NULL, item INT NOT NULL, PRIMARY KEY(alert, item))'); - $this->addSql('CREATE INDEX IDX_873C473817FD46C1 ON alertitem (alert)'); - $this->addSql('CREATE INDEX IDX_873C47381F1B251E ON alertitem (item)'); - $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 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 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, badgeurl VARCHAR(250) DEFAULT NULL, roles TEXT DEFAULT NULL, ssoitem VARCHAR(255) 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 itemniveau01 (item INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(item, niveau01))'); - $this->addSql('CREATE INDEX IDX_12E9B90A1F1B251E ON itemniveau01 (item)'); - $this->addSql('CREATE INDEX IDX_12E9B90A6DFC7E23 ON itemniveau01 (niveau01)'); - $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 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, 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 slide (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_72EFEE6255B7C7A2 ON slide (pagewidget_id)'); - $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, 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('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 alertniveau01 ADD CONSTRAINT FK_87E7389C17FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertniveau01 ADD CONSTRAINT FK_87E7389C6DFC7E23 FOREIGN KEY (niveau01) REFERENCES niveau01 (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_D4317FA98D93D649 FOREIGN KEY ("user") REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertitem ADD CONSTRAINT FK_873C473817FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertitem ADD CONSTRAINT FK_873C47381F1B251E FOREIGN KEY (item) REFERENCES item (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 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 itemniveau01 ADD CONSTRAINT FK_12E9B90A1F1B251E FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE itemniveau01 ADD CONSTRAINT FK_12E9B90A6DFC7E23 FOREIGN KEY (niveau01) REFERENCES niveau01 (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 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 slide ADD CONSTRAINT FK_72EFEE6255B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (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 bookmark_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 page_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE pagecategory_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE pagewidget_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE slide_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 alertniveau01 DROP CONSTRAINT FK_87E7389C17FD46C1'); - $this->addSql('ALTER TABLE alertniveau01 DROP CONSTRAINT FK_87E7389C6DFC7E23'); - $this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA917FD46C1'); - $this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA98D93D649'); - $this->addSql('ALTER TABLE alertitem DROP CONSTRAINT FK_873C473817FD46C1'); - $this->addSql('ALTER TABLE alertitem DROP CONSTRAINT FK_873C47381F1B251E'); - $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 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 itemniveau01 DROP CONSTRAINT FK_12E9B90A1F1B251E'); - $this->addSql('ALTER TABLE itemniveau01 DROP CONSTRAINT FK_12E9B90A6DFC7E23'); - $this->addSql('ALTER TABLE itemcategory DROP CONSTRAINT FK_7959DEE854B9D732'); - $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 slide DROP CONSTRAINT FK_72EFEE6255B7C7A2'); - $this->addSql('ALTER TABLE widget DROP CONSTRAINT FK_85F91ED054B9D732'); - $this->addSql('DROP TABLE alert'); - $this->addSql('DROP TABLE alertgroupe'); - $this->addSql('DROP TABLE alertniveau01'); - $this->addSql('DROP TABLE alertuserread'); - $this->addSql('DROP TABLE alertitem'); - $this->addSql('DROP TABLE alertcategory'); - $this->addSql('DROP TABLE bookmark'); - $this->addSql('DROP TABLE icon'); - $this->addSql('DROP TABLE item'); - $this->addSql('DROP TABLE itemgroupe'); - $this->addSql('DROP TABLE itemniveau01'); - $this->addSql('DROP TABLE itemcategory'); - $this->addSql('DROP TABLE page'); - $this->addSql('DROP TABLE pagegroupe'); - $this->addSql('DROP TABLE pagecategory'); - $this->addSql('DROP TABLE pagewidget'); - $this->addSql('DROP TABLE slide'); - $this->addSql('DROP TABLE widget'); - } -} diff --git a/migrations/Version20230111095833.php b/migrations/Version20230111095833.php deleted file mode 100644 index 4d20f6f..0000000 --- a/migrations/Version20230111095833.php +++ /dev/null @@ -1,64 +0,0 @@ -addSql('ALTER TABLE alertniveau01 DROP CONSTRAINT fk_87e7389c17fd46c1'); - $this->addSql('ALTER TABLE alertniveau01 DROP CONSTRAINT fk_87e7389c6dfc7e23'); - $this->addSql('ALTER TABLE itemniveau01 DROP CONSTRAINT fk_12e9b90a1f1b251e'); - $this->addSql('ALTER TABLE itemniveau01 DROP CONSTRAINT fk_12e9b90a6dfc7e23'); - $this->addSql('ALTER TABLE alertitem DROP CONSTRAINT fk_873c473817fd46c1'); - $this->addSql('ALTER TABLE alertitem DROP CONSTRAINT fk_873c47381f1b251e'); - $this->addSql('DROP TABLE alertniveau01'); - $this->addSql('DROP TABLE itemniveau01'); - $this->addSql('DROP TABLE alertitem'); - $this->addSql('ALTER TABLE groupe ADD pagetemplate_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C216D71CE5E FOREIGN KEY (pagetemplate_id) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('CREATE INDEX IDX_4B98C216D71CE5E ON groupe (pagetemplate_id)'); - $this->addSql('ALTER TABLE item DROP badgeurl'); - $this->addSql('ALTER TABLE item DROP ssoitem'); - } - - 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('CREATE TABLE alertniveau01 (alert INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(alert, niveau01))'); - $this->addSql('CREATE INDEX idx_87e7389c6dfc7e23 ON alertniveau01 (niveau01)'); - $this->addSql('CREATE INDEX idx_87e7389c17fd46c1 ON alertniveau01 (alert)'); - $this->addSql('CREATE TABLE itemniveau01 (item INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(item, niveau01))'); - $this->addSql('CREATE INDEX idx_12e9b90a6dfc7e23 ON itemniveau01 (niveau01)'); - $this->addSql('CREATE INDEX idx_12e9b90a1f1b251e ON itemniveau01 (item)'); - $this->addSql('CREATE TABLE alertitem (alert INT NOT NULL, item INT NOT NULL, PRIMARY KEY(alert, item))'); - $this->addSql('CREATE INDEX idx_873c47381f1b251e ON alertitem (item)'); - $this->addSql('CREATE INDEX idx_873c473817fd46c1 ON alertitem (alert)'); - $this->addSql('ALTER TABLE alertniveau01 ADD CONSTRAINT fk_87e7389c17fd46c1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertniveau01 ADD CONSTRAINT fk_87e7389c6dfc7e23 FOREIGN KEY (niveau01) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE itemniveau01 ADD CONSTRAINT fk_12e9b90a1f1b251e FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE itemniveau01 ADD CONSTRAINT fk_12e9b90a6dfc7e23 FOREIGN KEY (niveau01) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertitem ADD CONSTRAINT fk_873c473817fd46c1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE alertitem ADD CONSTRAINT fk_873c47381f1b251e FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE groupe DROP CONSTRAINT FK_4B98C216D71CE5E'); - $this->addSql('DROP INDEX IDX_4B98C216D71CE5E'); - $this->addSql('ALTER TABLE groupe DROP pagetemplate_id'); - $this->addSql('ALTER TABLE item ADD badgeurl VARCHAR(250) DEFAULT NULL'); - $this->addSql('ALTER TABLE item ADD ssoitem VARCHAR(255) DEFAULT NULL'); - } -} diff --git a/migrations/Version20230112085854.php b/migrations/Version20230112085854.php deleted file mode 100644 index f9ae911..0000000 --- a/migrations/Version20230112085854.php +++ /dev/null @@ -1,34 +0,0 @@ -addSql('ALTER TABLE pagewidget ADD viewheader BOOLEAN DEFAULT true NOT NULL'); - $this->addSql('ALTER TABLE widget ADD viewheader BOOLEAN DEFAULT true 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 widget DROP viewheader'); - $this->addSql('ALTER TABLE pagewidget DROP viewheader'); - } -} diff --git a/migrations/Version20230123084600.php b/migrations/Version20230123084600.php new file mode 100644 index 0000000..23553ee --- /dev/null +++ b/migrations/Version20230123084600.php @@ -0,0 +1,298 @@ +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 registration_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE slide_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 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 slide (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_72EFEE6255B7C7A2 ON slide (pagewidget_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 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 slide ADD CONSTRAINT FK_72EFEE6255B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (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 registration_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE slide_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 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 slide DROP CONSTRAINT FK_72EFEE6255B7C7A2'); + $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 registration'); + $this->addSql('DROP TABLE slide'); + $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/package.json b/package.json index 1e5f674..fa9a44c 100755 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "datatables.net-bs4": "^1.12.1", "dropzone": "^6.0.0-beta.2", "file-loader": "^6.2.0", + "iframe-resizer": "^4.3.2", "jquery": "^3.6.0", "jquery-ui": "^1.13.1", "jqueryui": "^1.11.1", diff --git a/src/Command/InitCommand.php b/src/Command/InitCommand.php index 30b0f5c..1e2d090 100755 --- a/src/Command/InitCommand.php +++ b/src/Command/InitCommand.php @@ -7,7 +7,9 @@ use App\Entity\Cron; use App\Entity\Group; use App\Entity\Icon; 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; @@ -68,10 +70,18 @@ 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->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); @@ -573,6 +583,72 @@ class InitCommand extends Command $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(true); + $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) { @@ -589,14 +665,134 @@ class InitCommand extends Command $entityWidget->setAutoajust(true); $entityWidget->setBorder(false); $entityWidget->setOpened(true); - $entityWidget->setViewheader(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); + $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(''); return Command::SUCCESS; diff --git a/src/Controller/AlertController.php b/src/Controller/AlertController.php index 82329c7..57753fd 100644 --- a/src/Controller/AlertController.php +++ b/src/Controller/AlertController.php @@ -35,27 +35,6 @@ class AlertController extends AbstractController ]); } - 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.title LIKE :value') - ->setParameter('value', '%'.$q.'%') - ->orderBy('table.title'); - - $datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult(); - foreach ($datas as $data) { - array_push($output, ['id' => $data->getId(), 'text' => $data->getLabel()]); - } - $ret_string['results'] = $output; - - return new JsonResponse($ret_string); - } - public function submit($access, Request $request, ManagerRegistry $em): Response { // Initialisation de l'enregistrement diff --git a/src/Controller/BookmarkController.php b/src/Controller/BookmarkController.php index 14e495f..b8a2208 100644 --- a/src/Controller/BookmarkController.php +++ b/src/Controller/BookmarkController.php @@ -14,39 +14,42 @@ class BookmarkController extends AbstractController { private $data = 'bookmark'; private $entity = "App\Entity\Bookmark"; - private $twig = 'bookmark/'; + private $twig = 'Bookmark/'; private $route = 'app_admin_bookmark'; - public function submitAction(Request $request, $idpage, $idwidget, $touser, $access = 'config') + public function submit($access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response { $usage = $request->query->get('usage'); - $group = $request->query->get('group'); // Initialisation de l'enregistrement - $em = $this->getDoctrine()->getManager(); $data = new Bookmark(); // On s'assure que le widget existe $pagewidget = null; if ('false' == $touser) { - $pagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find($idwidget); + $pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget); if (!$pagewidget) { throw $this->createNotFoundException('Unable to find entity.'); } - } - // Vérifier que cet enregistrement est modifiable - if ('user' == $access) { - if ('user' == $usage) { - $user = $pagewidget->getPage()->getUser(); - if ($user != $this->getUser()) { - throw $this->createNotFoundException('Permission denied'); - } - } elseif ('group' == $usage) { - $groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group); - $usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]); - if (!$usergroup or $usergroup->getRolegroup() < 50) { - throw $this->createNotFoundException('Permission denied'); + // Vérifier que cet enregistrement est modifiable + if ('all' == $access) { + if ('user' == $usage) { + $user = $pagewidget->getPage()->getUser(); + if ($user != $this->getUser()) { + throw $this->createNotFoundException('Permission denied'); + } + } elseif ('group' == $usage) { + $canadd = false; + foreach ($pagewidget->getPage()->getGroups() as $group) { + $usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]); + if (!$usergroup or $usergroup->getRolegroup() >= 50) { + $canadd = true; + } + } + if (!$canadd) { + throw $this->createNotFoundException('Permission denied'); + } } } } @@ -57,9 +60,6 @@ class BookmarkController extends AbstractController // 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(); @@ -73,83 +73,76 @@ class BookmarkController extends AbstractController // Icon $idicon = $form->get('idicon')->getData(); - $icon = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findoneby(['id' => $idicon]); + $icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]); $data->setIcon($icon); // Sauvegarde - $em->persist($data); - $em->flush(); - - if ($pagewidget) { - foreach ($pagewidget->getPage()->getGroups() as $groupchat) { - if ($groupchat->getFgcanshare()) { - $message = "Création favoris
".$data->getTitle().''; - $usergroup = $em->getRepository('CadolesCoreBundle:Usergroup')->findOneBy(['group' => $groupchat, 'user' => $this->getUser()]); - if ($usergroup) { - $key = $usergroup->getKeyvalue(); - $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key, $this->getUser()->getId(), $groupchat->getId(), $message); - } - } - } - } + $em->getManager()->persist($data); + $em->getManager()->flush(); // Retour à la page - return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage])); } - $icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]); + $icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]); $iconsuser = null; - if ('user' == $access) { - $iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]); + if ('all' == $access) { + $iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]); } - return $this->render($this->labelentity.':edit.html.twig', [ - 'useheader' => ('config' == $access), + return $this->render($this->twig.'edit.html.twig', [ + 'useheader' => ('admin' == $access), 'usemenu' => false, - 'usesidebar' => ('config' == $access), + 'usesidebar' => ('admin' == $access), 'entity' => $data, 'icons' => $icons, 'iconsuser' => $iconsuser, 'mode' => 'submit', 'access' => $access, 'idpage' => $idpage, + 'idwidget' => $idwidget, + 'touser' => $touser, 'form' => $form->createView(), 'usage' => $usage, - 'group' => $group, ]); } - public function updateAction(Request $request, $idpage, $id, $access = 'config') + public function update($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response { $usage = $request->query->get('usage'); - $group = $request->query->get('group'); // Récupération de l'enregistrement courant - $em = $this->getDoctrine()->getManager(); - $data = $this->getData($id); + $data = $em->getRepository($this->entity)->find($id); if (!$data) { throw $this->createNotFoundException('Unable to find entity.'); } - // Vérifier que cet enregistrement est modifiable - $user = $data->getUser(); - if ($user) { - if ('user' == $usage) { - if ($user != $this->getUser()) { - throw $this->createNotFoundException('Permission denied'); - } + // On s'assure que le widget existe + $pagewidget = null; + if ('false' == $touser) { + $pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget); + if (!$pagewidget) { + throw $this->createNotFoundException('Unable to find entity.'); } - } elseif ('user' == $access) { - if ('user' == $usage) { - $user = $data->getPagewidget()->getPage()->getUser(); - if ($user != $this->getUser()) { - throw $this->createNotFoundException('Permission denied'); - } - } else { - $groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group); - $usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]); - if (!$usergroup or $usergroup->getRolegroup() < 50) { - throw $this->createNotFoundException('Permission denied'); + + // Vérifier que cet enregistrement est modifiable + if ('all' == $access) { + if ('user' == $usage) { + $user = $pagewidget->getPage()->getUser(); + if ($user != $this->getUser()) { + throw $this->createNotFoundException('Permission denied'); + } + } elseif ('group' == $usage) { + $canadd = false; + foreach ($pagewidget->getPage()->getGroups() as $group) { + $usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]); + if (!$usergroup or $usergroup->getRolegroup() >= 50) { + $canadd = true; + } + } + if (!$canadd) { + throw $this->createNotFoundException('Permission denied'); + } } } } @@ -163,103 +156,92 @@ class BookmarkController extends AbstractController // Récupération des data du formulaire $form->handleRequest($request); - // Sur erreur - $this->getErrorForm($id, $form, $request, $data, 'update'); - // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); // Icon $idicon = $form->get('idicon')->getData(); - $icon = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findoneby(['id' => $idicon]); + $icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]); $data->setIcon($icon); // Sauvegarde - $em->persist($data); - $em->flush(); - - $pagewidget = $data->getPagewidget(); - if ($pagewidget) { - foreach ($pagewidget->getPage()->getGroups() as $groupchat) { - if ($groupchat->getFgcanshare()) { - $message = "Modification favoris
".$data->getTitle().''; - $usergroup = $em->getRepository('CadolesCoreBundle:Usergroup')->findOneBy(['group' => $groupchat, 'user' => $this->getUser()]); - if ($usergroup) { - $key = $usergroup->getKeyvalue(); - $websocket = $this->container->get('cadoles.websocket.pushmessage')->send($key, $this->getUser()->getId(), $groupchat->getId(), $message); - } - } - } - } + $em->getManager()->flush(); // Retour à la page - return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage])); } - $icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]); + $icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]); $iconsuser = null; - if ('user' == $access) { - $iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]); + if ('all' == $access) { + $iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]); } // Affichage du formulaire - return $this->render($this->labelentity.':edit.html.twig', [ - 'useheader' => ('config' == $access), + return $this->render($this->twig.'edit.html.twig', [ + 'useheader' => ('admin' == $access), 'usemenu' => false, - 'usesidebar' => ('config' == $access), + 'usesidebar' => ('admin' == $access), 'entity' => $data, 'icons' => $icons, 'iconsuser' => $iconsuser, 'mode' => 'update', 'access' => $access, 'idpage' => $idpage, + 'idwidget' => $idwidget, + 'touser' => $touser, 'form' => $form->createView(), 'usage' => $usage, - 'group' => $group, ]); } - public function deleteAction(Request $request, $idpage, $id, $access = 'config') + public function delete($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response { $usage = $request->query->get('usage'); - $group = $request->query->get('group'); // Récupération de l'enregistrement courant - $em = $this->getDoctrine()->getManager(); - $data = $this->getData($id); + $data = $em->getRepository($this->entity)->find($id); if (!$data) { throw $this->createNotFoundException('Unable to find entity.'); } - // Vérifier que cet enregistrement est supprimable - $user = $data->getUser(); - if ($user) { - if ($user != $this->getUser()) { - throw $this->createNotFoundException('Permission denied'); + // On s'assure que le widget existe + $pagewidget = null; + if ('false' == $touser) { + $pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget); + if (!$pagewidget) { + throw $this->createNotFoundException('Unable to find entity.'); } - } elseif ('user' == $access) { - if ('user' == $usage) { - $user = $data->getPagewidget()->getPage()->getUser(); - if ($user != $this->getUser()) { - throw $this->createNotFoundException('Permission denied'); - } - } else { - $groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group); - $usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]); - if (!$usergroup or $usergroup->getRolegroup() < 50) { - throw $this->createNotFoundException('Permission denied'); + + // Vérifier que cet enregistrement est modifiable + if ('all' == $access) { + if ('user' == $usage) { + $user = $pagewidget->getPage()->getUser(); + if ($user != $this->getUser()) { + throw $this->createNotFoundException('Permission denied'); + } + } elseif ('group' == $usage) { + $canadd = false; + foreach ($pagewidget->getPage()->getGroups() as $group) { + $usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]); + if (!$usergroup or $usergroup->getRolegroup() >= 50) { + $canadd = true; + } + } + if (!$canadd) { + throw $this->createNotFoundException('Permission denied'); + } } } } // Supprimer la donnée - $em = $this->getDoctrine()->getManager(); - $em->remove($data); - $em->flush(); + $em->getManager()->remove($data); + $em->getManager()->flush(); // Retour à la page - return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage])); } public function heart(Request $request, ManagerRegistry $em): Response @@ -295,47 +277,4 @@ class BookmarkController extends AbstractController return new JsonResponse($output); } - - protected function getDatas() - { - $em = $this->getDoctrine()->getManager(); - $datas = $em->getRepository($this->labelentity)->findAll(); - - return $datas; - } - - protected function getData($id) - { - $em = $this->getDoctrine()->getManager(); - $data = $em->getRepository($this->labelentity)->find($id); - - if (!$data) { - throw $this->createNotFoundException('Unable to find '.$this->labeldata); - } - - return $data; - } - - 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(); - $validator = $this->get('validator'); - $errors = $validator->validate($data); - foreach ($errors as $error) { - $request->getSession()->getFlashBag()->add('error', $error->getMessage()); - } - - $errors = $form->getErrors(); - foreach ($errors as $error) { - $request->getSession()->getFlashBag()->add('error', $error->getMessage()); - } - } - } } diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php index 34dba55..75b3f87 100755 --- a/src/Controller/GroupController.php +++ b/src/Controller/GroupController.php @@ -8,6 +8,7 @@ use App\Form\GroupType as Form; use Doctrine\Persistence\ManagerRegistry; use Ramsey\Uuid\Uuid; 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; @@ -237,10 +238,17 @@ class GroupController extends AbstractController // Récupération des data du formulaire $form->handleRequest($request); - // Sur validation + // Controle if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); + if ($data->isIsworkgroup() && is_null($data->getPagetemplate())) { + $form->addError(new FormError('Un groupe de travail doit avoir un modèle de page')); + $request->getSession()->getFlashBag()->add('error', 'Un groupe de travail doit avoir un modèle de page'); + } + } + // Sur validation + if ($form->get('submit')->isClicked() && $form->isValid()) { // Les groupes opé ne sont pas ouvert if (!$data->isIsworkgroup()) { $data->setIsopen(false); @@ -250,6 +258,9 @@ class GroupController extends AbstractController $em->getManager()->persist($data); $em->getManager()->flush(); + // S'assurer que le groupe de travail a les elements portail associé + $this->ctrlWorkgroup($em, $data, $access); + // Retour à la liste return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route)); } @@ -288,6 +299,15 @@ class GroupController extends AbstractController // Récupération des data du formulaire $form->handleRequest($request); + // Controle + if ($form->get('submit')->isClicked() && $form->isValid()) { + $data = $form->getData(); + if ($data->isIsworkgroup() && is_null($data->getPagetemplate())) { + $form->addError(new FormError('Un groupe de travail doit avoir un modèle de page')); + $request->getSession()->getFlashBag()->add('error', 'Un groupe de travail doit avoir un modèle de page'); + } + } + // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); @@ -299,6 +319,9 @@ class GroupController extends AbstractController $em->getManager()->flush(); + // S'assurer que le groupe de travail a les elements portail associé + $this->ctrlWorkgroup($em, $data, $access); + // Retour à la liste return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route)); } @@ -342,6 +365,9 @@ class GroupController extends AbstractController public function users($id, $access, Request $request, ManagerRegistry $em) { + $idpage = $request->query->get('idpage'); + $usage = $request->query->get('usage'); + // Récupération de l'enregistrement courant $data = $em->getRepository($this->entity)->find($id); if (!$data) { @@ -358,6 +384,8 @@ class GroupController extends AbstractController 'usesidebar' => ('all' != $access), 'access' => $access, $this->data => $data, + 'idpage' => $idpage, + 'usage' => $usage, ]); } @@ -953,4 +981,34 @@ class GroupController extends AbstractController return $toreturn; } + + protected function ctrlWorkgroup($em, $group, $access) + { + if ($group->isIsworkgroup()) { + // On regarde s'il a au moins une page + if ($group->getPages()->isEmpty()) { + $page = $em->getRepository("App\Entity\Page")->clonePage(null, $group->getPagetemplate()); + $group->addPage($page); + $page->setName($group->getLabel()); + if ('all' == $access) { + $page->setUser($this->getUser()); + } + + $em->getManager()->persist($page); + $em->getManager()->persist($group); + $em->getManager()->flush(); + } + $pages = $group->getPages(); + if ($pages[0]->getName() != $group->getLabel()) { + $pages[0]->setName($group->getLabel()); + $em->getManager()->persist($pages[0]); + $em->getManager()->flush(); + } + foreach ($pages as $page) { + $page->setUser($group->getOwner()); + $em->getManager()->persist($page); + $em->getManager()->flush(); + } + } + } } diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 513170c..b56deea 100755 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -15,17 +15,29 @@ class HomeController extends AbstractController return $this->redirectToRoute('app_login'); } - $em->getRepository("App\Entity\Item")->getUserItems($this->getUser(), $bookmarks, $items, $itemscategorys); + // Récupération de la page encours + $id = $request->query->get('id'); - return $this->render('Home/page.html.twig', [ - 'useheader' => true, - 'usemenu' => false, - 'usesidebar' => false, - 'maxsize' => 1000, - 'bookmarks' => $bookmarks, - 'items' => $items, - 'itemcategorys' => $itemscategorys, - ]); + // Calcul des pages de l'utilisateur + $em->getRepository("App\Entity\Page")->getPagesUser($this->getUser(), $id, $pagecurrent, $pagesportal, $pagesuser, $groups); + dump($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', [ @@ -58,21 +70,19 @@ class HomeController extends AbstractController public function homeuser($access): Response { - return $this->render('Home/home.html.twig', [ + return $this->render('Page/default.html.twig', [ 'useheader' => true, 'usemenu' => false, 'usesidebar' => false, - 'maxsize' => 1000, ]); } public function homemaster($access): Response { - return $this->render('Home/home.html.twig', [ + return $this->render('Page/default.html.twig', [ 'useheader' => true, 'usemenu' => false, 'usesidebar' => false, - 'maxsize' => 1000, ]); } diff --git a/src/Controller/ItemController.php b/src/Controller/ItemController.php index ecf31ca..4e71526 100644 --- a/src/Controller/ItemController.php +++ b/src/Controller/ItemController.php @@ -32,27 +32,6 @@ class ItemController extends AbstractController ]); } - 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.title LIKE :value') - ->setParameter('value', '%'.$q.'%') - ->orderBy('table.title'); - - $datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult(); - foreach ($datas as $data) { - array_push($output, ['id' => $data->getId(), 'text' => $data->getLabel()]); - } - $ret_string['results'] = $output; - - return new JsonResponse($ret_string); - } - public function submit($access, Request $request, ManagerRegistry $em): Response { // Initialisation de l'enregistrement diff --git a/src/Controller/PageController.php b/src/Controller/PageController.php new file mode 100644 index 0000000..db25c13 --- /dev/null +++ b/src/Controller/PageController.php @@ -0,0 +1,548 @@ +render($this->twig.'list.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + 'access' => $access, + 'usage' => $usage, + 'istemplate' => false, + ]); + } + + public function tablelist($access, $usage, 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']; + $alluser = $query['alluser']; + + // On sauvegarde en session le flag alluser + $request->getSession()->set('alluserpage', $alluser); + + // 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); + $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 validation + if ($form->get('submit')->isClicked() && $form->isValid()) { + if ('all' == $access) { + $entity->setUser($this->getUser()); + } + + // 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); + + 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()])); + } + } + + return $this->render($this->twig.'submit.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => ('admin' == $access), + 'maxwidth' => ('user' == $access), + $this->data => $entity, + 'mode' => 'submit', + 'usage' => $usage, + 'access' => $access, + 'form' => $form->createView(), + ]); + } + + public function update($id, $access, $usage, Request $request, ManagerRegistry $em): Response + { + $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->createNotFoundException('Permission denied'); + } + } + + // Création du formulaire + $form = $this->entityForm($entity, $access, $em); + $form->handleRequest($request); + + if ($form->get('submit')->isClicked() && $form->isValid()) { + $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])); + } else { + return $this->redirect($this->generateUrl('app_home', ['id' => $id])); + } + } + + // 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(), + ]); + } + } + + public function delete($id, $access, $usage, 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, $canadd); + if (!$canupdate) { + throw $this->createNotFoundException('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]); + } + + // 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')); + } + } + + public function order($access, Request $request, ManagerRegistry $em): Response + { + $output = []; + $id = $request->request->get('id'); + $order = $request->request->get('order'); + + $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->createNotFoundException('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, + ]); + } + + protected function getPreference($user, $key, $id, $default) + { + $preference = $user->getPreference(); + $return = $default; + + if (is_array($preference)) { + if (array_key_exists($key, $preference)) { + if (array_key_exists($id, $preference[$key])) { + $return = $preference[$key][$id]; + } + } + } + + return $return; + } + + protected function setPreference($user, $key, $id, $value) + { + $preference = $user->getPreference(); + $toupdate = false; + if (!array_key_exists($key, $preference)) { + $toupdate = true; + $preference[$key] = []; + } + if (!array_key_exists($id, $preference[$key])) { + $toupdate = true; + $preference[$key][$id] = $value; + } + if ($value && $preference[$key][$id] != $value) { + $toupdate = true; + $preference[$key][$id] = $value; + } + + // Mise à jour des préferences + if ($toupdate) { + $em = $this->getDoctrine()->getManager(); + $user->setPreference($preference); + $em->persist($this->getUser()); + $em->flush(); + } + } +} diff --git a/src/Controller/PagetemplateController.php b/src/Controller/PagetemplateController.php index ed8aab1..2765668 100644 --- a/src/Controller/PagetemplateController.php +++ b/src/Controller/PagetemplateController.php @@ -8,6 +8,7 @@ use App\Form\PageUpdateWidgetType; use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormError; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -16,7 +17,7 @@ class PagetemplateController extends AbstractController private $data = 'page'; private $entity = "App\Entity\Page"; private $twig = 'Pagetemplate/'; - private $route = 'app_admin_pagetemplate'; + private $route = 'app_admin_page_template'; public function list($access): Response { @@ -166,6 +167,7 @@ class PagetemplateController extends AbstractController $this->data => $data, 'mode' => 'submit', 'access' => $access, + 'usage' => 'template', 'form' => $form->createView(), ]); } @@ -194,7 +196,8 @@ class PagetemplateController extends AbstractController 'usesidebar' => true, $this->data => $data, 'access' => $access, - 'mode' => 'updatetemplate', + 'mode' => 'update', + 'usage' => 'template', 'form' => $form->createView(), ]); } @@ -220,7 +223,6 @@ class PagetemplateController extends AbstractController 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'); } @@ -237,36 +239,26 @@ class PagetemplateController extends AbstractController return $this->redirect($this->generateUrl($this->route)); } - public function seleclist(Request $request) + public function selectlist($access, Request $request, ManagerRegistry $em): Response { - // 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'); - $usage = $request->query->get('usage'); - $qb = $em->createQueryBuilder(); - $qb->select('table')->from('App:Page', 'table') + $qb = $em->getManager()->createQueryBuilder(); + $qb->select('table')->from($this->entity, 'table') ->where('table.name LIKE :value') - ->andWhere('table.parentfor=:usage') + ->andWhere('table.parentfor is not null') ->setParameter('value', '%'.$q.'%') - ->setParameter('usage', $usage) ->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; - $response = new Response(json_encode($output)); - $response->headers->set('Content-Type', 'application/json'); - - return $response; + return new JsonResponse($ret_string); } public function view($id, $access, Request $request, ManagerRegistry $em): Response @@ -279,8 +271,6 @@ class PagetemplateController extends AbstractController // Permissions $canupdate = true; - dump($em->getRepository("App\Entity\Widget")->getWidgetAccess($access)); - return $this->render('Page\viewwidget.html.twig', [ 'useheader' => true, 'usemenu' => true, @@ -288,35 +278,9 @@ class PagetemplateController extends AbstractController $this->data => $data, 'access' => $access, 'canupdate' => $canupdate, - 'mode' => 'viewtemplate', + 'usage' => 'template', 'widgets' => $em->getRepository("App\Entity\Widget")->getWidgetAccess($access), - 'usage' => 'config', 'group' => '', - 'look' => 'view', - 'selwidget' => null, ]); } - - 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(); - $validator = $this->get('validator'); - $errors = $validator->validate($data); - foreach ($errors as $error) { - $request->getSession()->getFlashBag()->add('error', $error->getMessage()); - } - - $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 index 0829c4f..599fd4c 100644 --- a/src/Controller/PagewidgetController.php +++ b/src/Controller/PagewidgetController.php @@ -9,7 +9,6 @@ use GuzzleHttp\Exception\RequestException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Finder\Finder; -use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -28,9 +27,6 @@ class PagewidgetController extends AbstractController private $page; private $id; private $access; - private $look; - private $mini; - private $selwidget; private $usage; private $group; @@ -55,7 +51,7 @@ class PagewidgetController extends AbstractController return $results; } - private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access = 'config', $by = 'view') + private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access) { if ($em->getManager()->contains($entity)) { $widgettype = $em->getRepository('App\Entity\Pagewidget')->find($id)->getWidget(); @@ -90,12 +86,13 @@ class PagewidgetController extends AbstractController $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' => ('view' == $by ? 'submit' : 'submittemplate'), + 'mode' => 'submit', 'access' => $access, 'idicon' => $widgettype->getIcon()->getId(), 'method' => 'POST', @@ -105,9 +102,10 @@ class PagewidgetController extends AbstractController public function submit($access, $idpage, $idwidgettype, Request $request, ManagerRegistry $em): Response { - $by = $request->query->get('by'); + $usage = $request->query->get('usage'); + $entity = new Pagewidget(); - $form = $this->entityForm($em, $entity, $idpage, $idwidgettype, $access, $by); + $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 @@ -119,9 +117,6 @@ class PagewidgetController extends AbstractController throw $this->createNotFoundException('Permission denied'); } - // Sur erreur - $this->getErrorForm(null, $form, $request, $idwidgettype, $page, $entity, 'submit'); - // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $idicon = $form->get('idicon')->getData(); @@ -154,24 +149,7 @@ class PagewidgetController extends AbstractController $em->persist($entity); $em->flush(); - // Notification création widget - $groups = $page->getGroups(); - if ($groups[0]) { - if ($groups[0]->getFgcanshare()) { - $message = 'Création Widget '.$entity->getName(); - $this->wss->addMessage($this->getuser()->getApikey(), $groups[0]->getId(), $message); - } - } - - if ('admin' == $access) { - if ('view' == $by) { - return $this->redirect($this->generateUrl('app_admin_page_view', ['id' => $idpage])); - } else { - return $this->redirect($this->generateUrl('app_admin_pagetemplate_view', ['id' => $idpage])); - } - } else { - return $this->redirect($this->generateUrl('app_home', ['id' => $idpage])); - } + return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage])); } $icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]); @@ -181,14 +159,14 @@ class PagewidgetController extends AbstractController } return $this->render($this->twig.'edit.html.twig', [ - 'useheader' => true, + 'useheader' => ('admin' == $access), 'usemenu' => false, - 'usesidebar' => ('config' == $access), - 'maxwidth' => ('user' == $access), + 'usesidebar' => ('admin' == $access), 'entity' => $entity, 'icons' => $icons, 'iconsuser' => $iconsuser, - 'mode' => ('view' == $by ? 'submit' : 'submittemplate'), + 'mode' => 'submit', + 'usage' => $usage, 'access' => $access, 'idpage' => $idpage, 'form' => $form->createView(), @@ -197,7 +175,6 @@ class PagewidgetController extends AbstractController public function update($access, $idpage, $idwidget, Request $request, ManagerRegistry $em): Response { - $by = $request->query->get('by'); $usage = $request->query->get('usage'); $group = $request->query->get('group'); @@ -216,7 +193,7 @@ class PagewidgetController extends AbstractController } // Création du formulaire - $form = $this->entityForm($em, $entity, $idpage, $idwidget, $access, $by); + $form = $this->entityForm($em, $entity, $idpage, $idwidget, $access); $form->handleRequest($request); // Validation @@ -250,28 +227,27 @@ class PagewidgetController extends AbstractController } // Retour - if ('view' == $by) { - return $this->redirect($this->generateUrl('app_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + if ($group) { + return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage, 'group' => $group])); } else { - return $this->redirect($this->generateUrl('app_'.$access.'_pagetemplate_view', ['id' => $idpage])); + 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 = $this->getDoctrine()->getRepository('App:Icon')->findBy(['user' => $this->getUser()]); + $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), - 'maxwidth' => ('all' == $access), 'entity' => $entity, 'icons' => $icons, 'iconsuser' => $iconsuser, - 'mode' => ('view' == $by ? 'update' : 'updatetemplate'), + 'mode' => 'update', 'access' => $access, 'idpage' => $idpage, 'form' => $form->createView(), @@ -311,19 +287,12 @@ class PagewidgetController extends AbstractController return new JsonResponse($output); } - public function order(Request $request) + public function order($access, Request $request, ManagerRegistry $em): Response { - // S'assurer que c'est un appel ajax - if (!$request->isXmlHttpRequest()) { - return new JsonResponse(['message' => 'Interdit'], 400); - } - - $output = []; $idwidget = $request->request->get('idwidget'); $order = $request->request->get('order'); $idloc = $request->request->get('idloc'); - $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository($this->labelentity)->find($idwidget); if (!$entity) { throw $this->createNotFoundException('Unable to find entity.'); @@ -331,69 +300,9 @@ class PagewidgetController extends AbstractController $entity->setRoworder($order); $entity->setLoc($idloc); - $em->persist($entity); - $em->flush(); + $em->getManager()->flush(); - $response = new Response(json_encode($output)); - $response->headers->set('Content-Type', 'application/json'); - - return $response; - } - - public function upload(Request $request, $access = null) - { - // Fichier temporaire uploadé - $tmpfile = $request->files->get('upload'); - $extention = $tmpfile->getClientOriginalExtension(); - - // Répertoire de Destination - $fs = new Filesystem(); - $rootdir = $this->get('kernel')->getRootDir().'/../web'; - $fs->mkdir($rootdir.'/uploads/ckeditor'); - - // Fichier cible - $targetName = uniqid().'.'.$extention; - $targetFile = $rootdir.'/uploads/ckeditor/'.$targetName; - $targetUrl = '/'.$this->getParameter('alias').'/uploads/ckeditor/'.$targetName; - $message = ''; - - move_uploaded_file($tmpfile, $targetFile); - - $output['uploaded'] = 1; - $output['fileName'] = $targetName; - $output['url'] = $targetUrl; - - return new Response(json_encode($output)); - } - - protected function getErrorForm($id, $form, $request, $idwidgettype, $page, $data, $mode) - { - if ($form->get('submit')->isClicked() && 'delete' == $mode) { - } - - if ($form->get('submit')->isClicked() && ('submit' == $mode || 'update' == $mode)) { - // Interdire l'insertion de 2 chat dans la meme page - if (-1840 == $idwidgettype) { - $pagewidget = $this->getDoctrine()->getRepository('App\Entity\Pagewidget')->findoneby(['page' => $page, 'widget' => -1840]); - if ($pagewidget) { - $form->addError(new FormError('Vous ne pouvez pas insérer deux widgets de type Chat dans la même page')); - } - } - } - - if ($form->get('submit')->isClicked() && !$form->isValid()) { - $this->get('session')->getFlashBag()->clear(); - $validator = $this->get('validator'); - $errors = $validator->validate($data); - foreach ($errors as $error) { - $request->getSession()->getFlashBag()->add('error', $error->getMessage()); - } - - $errors = $form->getErrors(); - foreach ($errors as $error) { - $request->getSession()->getFlashBag()->add('error', $error->getMessage()); - } - } + return new JsonResponse([]); } protected function setRequest($em, $request, $id, $access) @@ -402,8 +311,6 @@ class PagewidgetController extends AbstractController $this->user = $this->getUser(); $this->id = $id; $this->access = $access; - $this->look = $request->query->get('look'); - $this->selwidget = $request->query->get('selwidget'); $this->usage = $request->query->get('usage'); $this->group = $request->query->get('group'); @@ -416,6 +323,7 @@ class PagewidgetController extends AbstractController // 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(); @@ -425,27 +333,18 @@ class PagewidgetController extends AbstractController } } - // Affichage miniature ? - $this->mini = ('list' == $this->look && $this->entity->getId() != $this->selwidget); - - // Préference utilisateur - if (!$this->mini) { - $this->getPreference($this->entity); - } + $this->getPreference($this->entity); } protected function getPreference(&$entity) { $user = $this->getUser(); if ($user) { - $preference = $user->getPreference(); - $id = $entity->getId(); + if ($entity->isViewheader()) { + $preference = $user->getPreference(); + $id = $entity->getId(); - // Preference widgetshowhide - if ('list' == $this->look) { - $entity->setOpened(true); - $entity->setBorder(false); - } else { + // Preference widgetshowhide if (is_array($preference)) { if (array_key_exists('widgetshowhide', $preference)) { if (array_key_exists($id, $preference['widgetshowhide'])) { @@ -489,8 +388,6 @@ class PagewidgetController extends AbstractController 'entity' => $this->entity, 'canupdate' => $this->canupdate, 'access' => $this->access, - 'look' => $this->look, - 'mini' => $this->mini, ]; // Parametres spéficiques @@ -500,51 +397,48 @@ class PagewidgetController extends AbstractController return $this->render($this->twig.'\\'.$view, $params); } - public function viewurl($id, $access, Request $request) + public function viewurl($access, $id, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $url = ''; $imagemedia = false; - // Datas associées au widget - if (!$this->mini) { - // Récupération des paramétres du widget - foreach ($this->entity->getParameter()['fields'] as $parameter) { - if ('url' == $parameter['id']) { - $url = $parameter['value']; - } + // 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); + // 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); + // 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; - } - } - // Si url classique on igonore l'usage de la sonde dnma - else { - if (false === stripos($url, '?')) { - $url .= '?notsondednma=true'; - } else { - $url .= '¬sondednma=true'; - } - } - - // Spécifique Deviant Art - if (false !== strpos($url, 'images-wixmp')) { + // Type image + if (array_key_exists('extension', $pathinfo)) { + if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) { $imagemedia = true; } } + // Si url classique on igonore l'usage de la sonde dnma + else { + if (false === stripos($url, '?')) { + $url .= '?notsondednma=true'; + } else { + $url .= '¬sondednma=true'; + } + } + + // Spécifique Deviant Art + if (false !== strpos($url, 'images-wixmp')) { + $imagemedia = true; + } return $this->getRender('viewurl.html.twig', [ 'url' => $url, @@ -552,48 +446,45 @@ class PagewidgetController extends AbstractController ]); } - public function viewurlfixe(Request $request, $id, $access = 'config') + public function viewurlfixe($access, $id, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $url = ''; $imagemedia = false; - // Datas associées au widget - if (!$this->mini) { - // 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; - } + // 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); + // 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); + // 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')) { + // 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, @@ -615,45 +506,42 @@ class PagewidgetController extends AbstractController $itemsordered = null; $itemcategorys = null; - // Datas associées au widget - if (!$this->mini) { - // 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; + // 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 'withbookmark': + $withbookmark = $parameter['value']; + break; - case 'itemcategory': - $iditemcategory = $parameter['value']; - break; + case 'itemcategory': + $iditemcategory = $parameter['value']; + break; - case 'search': - $search = (1 == $parameter['value']); - break; + case 'search': + $search = (1 == $parameter['value']); + break; - case 'menu': - $menu = (1 == $parameter['value']); - break; + case 'menu': + $menu = (1 == $parameter['value']); + break; - case 'menuall': - $menuall = (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); } + // 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, @@ -668,71 +556,65 @@ class PagewidgetController extends AbstractController ]); } - public function viewitemessential(Request $request, $id, $access = 'config') + public function viewitemessential($access, $id, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $modedesktop = 0; $itemsordered = null; $bookmarks = null; - // Datas associées au widget - if (!$this->mini) { - // Récupération des paramétres du widget - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'modedesktop': - $modedesktop = $parameter['value']; - break; - } + // 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 - $itemsordered = $this->em->getRepository('App:Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, null, $this->get('session')->get('ssoitems'), 0, true); } + // 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' => $itemsordered, + 'items' => $items, 'bookmarks' => $bookmarks, ]); } - public function viewalert(Request $request, $id, $access = 'config') + public function viewalert($id, $access, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $alertsordered = null; - // Datas associées au widget - if (!$this->mini) { - // 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; - } + // 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:Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter, $this->get('session')->get('ssoitems')); } + // Profilage + $alertsordered = $this->em->getRepository('App\Entity\Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter); + // Render return $this->getRender('viewalert.html.twig', [ 'alerts' => $alertsordered, @@ -742,261 +624,44 @@ class PagewidgetController extends AbstractController public function viewflux(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $modelist = 0; $fluxsordered = null; $feeds = null; - // Datas associées au widget - if (!$this->mini) { - // Récupération des paramétres du widget - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'modelist': - $modelist = $parameter['value']; - break; - } + // Récupération des paramétres du widget + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'modelist': + $modelist = $parameter['value']; + break; } - - // Profilage - $fluxs = $this->em->getRepository('App:Flux')->getUserFluxs($this->user); - - $feeds = []; - $filesystem = new Filesystem(); - - // Généraltion du cache associés aux flux - foreach ($fluxs as $keyflux => $flux) { - // On regarde si le flux a été lu il y a peu - $toregen = true; - $url = $flux->getUrl(); - - // Feed lié à un user interne - $filecache = 'uploads/flux/flux-'.$flux->getId().'.txt'; - if (false !== stripos($url, '##userid##')) { - if ($user) { - $url = str_replace('##userid##', $user->getId(), $url); - $filecache = $filecache = 'uploads/flux/flux-'.$user->getId().'-'.$flux->getId().'.txt'; - } - } - - // Si le fichie cache existe - if ($filesystem->exists($filecache)) { - // On récupère la date de modification du fichier - $timestampfile = filemtime($filecache); - $datetimeFormat = 'Y-m-d H:i:s'; - $datefile = new \DateTime(); - $datefile->setTimestamp($timestampfile); - - // On ajoute 30mn - $datefile->add(new \DateInterval('PT30M')); - - // Si la date est inférieur à maintenant on regénère le flux - $now = new \DateTime(); - if ($datefile >= $now) { - $toregen = false; - $backup = unserialize(file_get_contents($filecache)); - $feeds = array_merge($feeds, $backup); - if (empty($backup)) { - unset($fluxs[$keyflux]); - } - } - } - - // Si le fichier est trop ancien on relit le flus - if ($toregen) { - $PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue(); - $weburl = $this->getParameter('weburl'); - - if (0 == stripos($url, '/')) { - $url = 'https://'.$weburl.$url; - $PROXYactivate = false; - } - if (0 === stripos($url, 'https://'.$weburl)) { - $PROXYactivate = false; - } - if (0 === stripos($url, 'http://'.$weburl)) { - $PROXYactivate = false; - } - - if ($PROXYactivate) { - $PROXYserver = $this->em->getRepository('App:Config')->find('PROXYserver')->getValue(); - $PROXYport = $this->em->getRepository('App:Config')->find('PROXYport')->getValue(); - $clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false, 'proxy' => ['http' => 'http://'.$PROXYserver.':'.$PROXYport, 'https' => 'http://'.$PROXYserver.':'.$PROXYport]]); - } else { - $clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false]); - } - - try { - $clientguzzle->request('GET', $url); - } catch (RequestException $e) { - if ($e->hasResponse()) { - continue; - } - } - - // On lit le flux rss - $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle); - $logger = new \Psr\Log\NullLogger(); - $feedIo = new \FeedIo\FeedIo($client, $logger); - - try { - $result = $feedIo->read($url); - } catch (\Exception $e) { - $result = null; - } - - if ($result) { - $feedtitle = $result->getFeed()->getTitle(); - - $backup = []; - - // Pour chaque articles - $nbflux = 0; - foreach ($result->getFeed() as $item) { - $title = $item->getTitle(); - $link = $item->getLink(); - $description = substr(strip_tags($item->getDescription()), 0, 250); - $description = str_replace('¶', '', $description); - $date = $item->getLastModified(); - $dateformat = ($date ? $item->getLastModified()->format('d/m/Y H:i:s') : ''); - $content = $item->getDescription(); - $media = $item->getMedias(); - $mediaurl = ''; - - foreach ($item->getMedias() as $itemMedia) { - if ('image/jpeg' == $itemMedia->getType()) { - $mediaurl = $itemMedia->getUrl(); - } - } - - foreach ($item->getAllElements() as $element) { - if ('content:encoded' == $element->getName()) { - $content = $element->getValue(); - } - } - - if ('' != $mediaurl) { - $imgurl = $mediaurl; - } else { - // Récupérer la première image du contenu - $imgcontent = ''; - $imgurl = ''; - $imgstart = stripos($content, '', $imgstart); - $imgcontent = substr($content, $imgstart, $imgend - $imgstart + 1); - - $imgstart = stripos($imgcontent, 'src='); - $imgurl = substr($imgcontent, $imgstart + 5); - $imgend = stripos($imgurl, '"'); - - if (false === $imgend) { - $imgend = stripos($imgurl, "'"); - } - $imgurl = substr($imgurl, 0, $imgend); - } - } - - // Garder le flux - $tmp = [ - 'feedtitle' => $feedtitle, - 'title' => $title, - 'link' => $link, - 'description' => $description, - 'date' => $date, - 'dateformat' => $dateformat, - 'content' => $content, - 'image' => $imgurl, - 'color' => $flux->getColor(), - 'fluxid' => $flux->getId(), - 'fluxtitle' => $flux->getTitle(), - ]; - - array_push($feeds, $tmp); - array_push($backup, $tmp); - - ++$nbflux; - if ($nbflux >= $flux->getMaxread() && $flux->getMaxread() > 0) { - break; - } - } - - if (0 == $nbflux) { - unset($fluxs[$keyflux]); - } - - // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn - $filesystem->dumpFile($filecache, serialize($backup)); - } - } - } - - // Trie des fluxs - $fluxsordered = $fluxs->getIterator(); - $fluxsordered->uasort(function ($first, $second) { - return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1; - }); - - // Trie des feeds - $libelle = []; - foreach ($feeds as $key => $valeur) { - $libelle[$key] = $valeur['date']; - } - array_multisort($libelle, SORT_DESC, $feeds); } - // Render - return $this->getRender('viewflux.html.twig', [ - 'modelist' => $modelist, - 'fluxs' => $fluxsordered, - 'feeds' => $feeds, - ]); - } + // Profilage + $fluxs = $this->em->getRepository('App:Flux')->getUserFluxs($this->user); - public function viewrss(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Valeur par défaut - $modelist = 0; - $fluxs = ['id' => 0]; - $feeds = null; - - // Datas associées au widget - if (!$this->mini) { - // Récupération des paramétres du widget - $url = ''; - $nbarticle = '_blank'; - $modelist = 0; - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'url': - $url = $parameter['value']; - break; - case 'nbarticle': - $nbarticle = $parameter['value']; - break; - case 'modelist': - $modelist = $parameter['value']; - break; - } - } + $feeds = []; + $filesystem = new Filesystem(); + // Généraltion du cache associés aux flux + foreach ($fluxs as $keyflux => $flux) { // On regarde si le flux a été lu il y a peu $toregen = true; - $filecache = $filecache = 'uploads/flux/widget-'.$id.'.txt'; - $user = $this->getUser(); + $url = $flux->getUrl(); + + // Feed lié à un user interne + $filecache = 'uploads/flux/flux-'.$flux->getId().'.txt'; if (false !== stripos($url, '##userid##')) { if ($user) { $url = str_replace('##userid##', $user->getId(), $url); - $filecache = $filecache = 'uploads/flux/widget-'.$user->getId().'-'.$id.'.txt'; + $filecache = $filecache = 'uploads/flux/flux-'.$user->getId().'-'.$flux->getId().'.txt'; } } - $filesystem = new Filesystem(); + // Si le fichie cache existe if ($filesystem->exists($filecache)) { // On récupère la date de modification du fichier $timestampfile = filemtime($filecache); @@ -1011,15 +676,19 @@ class PagewidgetController extends AbstractController $now = new \DateTime(); if ($datefile >= $now) { $toregen = false; - $feeds = unserialize(file_get_contents($filecache)); + $backup = unserialize(file_get_contents($filecache)); + $feeds = array_merge($feeds, $backup); + if (empty($backup)) { + unset($fluxs[$keyflux]); + } } } // Si le fichier est trop ancien on relit le flus if ($toregen) { - // Connexion au client $PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue(); $weburl = $this->getParameter('weburl'); + if (0 == stripos($url, '/')) { $url = 'https://'.$weburl.$url; $PROXYactivate = false; @@ -1043,24 +712,15 @@ class PagewidgetController extends AbstractController $clientguzzle->request('GET', $url); } catch (RequestException $e) { if ($e->hasResponse()) { - // Render - $feeds = []; - - return $this->getRender('viewflux.html.twig', [ - 'fluxs' => $fluxs, - 'feeds' => $feeds, - 'modelist' => $modelist, - ]); + continue; } } + // On lit le flux rss $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle); $logger = new \Psr\Log\NullLogger(); $feedIo = new \FeedIo\FeedIo($client, $logger); - $feeds = []; - - // On lit le flux rss try { $result = $feedIo->read($url); } catch (\Exception $e) { @@ -1070,6 +730,8 @@ class PagewidgetController extends AbstractController if ($result) { $feedtitle = $result->getFeed()->getTitle(); + $backup = []; + // Pour chaque articles $nbflux = 0; foreach ($result->getFeed() as $item) { @@ -1118,7 +780,7 @@ class PagewidgetController extends AbstractController } // Garder le flux - array_push($feeds, [ + $tmp = [ 'feedtitle' => $feedtitle, 'title' => $title, 'link' => $link, @@ -1127,29 +789,243 @@ class PagewidgetController extends AbstractController 'dateformat' => $dateformat, 'content' => $content, 'image' => $imgurl, - // "color" => $flux->getColor(), - 'fluxid' => 0, - 'fluxtitle' => $this->entity->getName(), - ]); + 'color' => $flux->getColor(), + 'fluxid' => $flux->getId(), + 'fluxtitle' => $flux->getTitle(), + ]; + + array_push($feeds, $tmp); + array_push($backup, $tmp); ++$nbflux; - if ($nbflux >= $nbarticle && $nbarticle > 0) { + if ($nbflux >= $flux->getMaxread() && $flux->getMaxread() > 0) { break; } } - $libelle = []; - foreach ($feeds as $key => $valeur) { - $libelle[$key] = $valeur['date']; + if (0 == $nbflux) { + unset($fluxs[$keyflux]); } - array_multisort($libelle, SORT_DESC, $feeds); // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn - $filesystem->dumpFile($filecache, serialize($feeds)); + $filesystem->dumpFile($filecache, serialize($backup)); } } } + // Trie des fluxs + $fluxsordered = $fluxs->getIterator(); + $fluxsordered->uasort(function ($first, $second) { + return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1; + }); + + // Trie des feeds + $libelle = []; + foreach ($feeds as $key => $valeur) { + $libelle[$key] = $valeur['date']; + } + array_multisort($libelle, SORT_DESC, $feeds); + + // Render + return $this->getRender('viewflux.html.twig', [ + 'modelist' => $modelist, + 'fluxs' => $fluxsordered, + 'feeds' => $feeds, + ]); + } + + public function viewrss(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($em, $request, $id, $access); + + // Valeur par défaut + $modelist = 0; + $fluxs = ['id' => 0]; + $feeds = null; + + // Récupération des paramétres du widget + $url = ''; + $nbarticle = '_blank'; + $modelist = 0; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'url': + $url = $parameter['value']; + break; + case 'nbarticle': + $nbarticle = $parameter['value']; + break; + case 'modelist': + $modelist = $parameter['value']; + break; + } + } + + // On regarde si le flux a été lu il y a peu + $toregen = true; + $filecache = $filecache = 'uploads/flux/widget-'.$id.'.txt'; + $user = $this->getUser(); + if (false !== stripos($url, '##userid##')) { + if ($user) { + $url = str_replace('##userid##', $user->getId(), $url); + $filecache = $filecache = 'uploads/flux/widget-'.$user->getId().'-'.$id.'.txt'; + } + } + + $filesystem = new Filesystem(); + if ($filesystem->exists($filecache)) { + // On récupère la date de modification du fichier + $timestampfile = filemtime($filecache); + $datetimeFormat = 'Y-m-d H:i:s'; + $datefile = new \DateTime(); + $datefile->setTimestamp($timestampfile); + + // On ajoute 30mn + $datefile->add(new \DateInterval('PT30M')); + + // Si la date est inférieur à maintenant on regénère le flux + $now = new \DateTime(); + if ($datefile >= $now) { + $toregen = false; + $feeds = unserialize(file_get_contents($filecache)); + } + } + + // Si le fichier est trop ancien on relit le flus + if ($toregen) { + // Connexion au client + $PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue(); + $weburl = $this->getParameter('weburl'); + if (0 == stripos($url, '/')) { + $url = 'https://'.$weburl.$url; + $PROXYactivate = false; + } + if (0 === stripos($url, 'https://'.$weburl)) { + $PROXYactivate = false; + } + if (0 === stripos($url, 'http://'.$weburl)) { + $PROXYactivate = false; + } + + if ($PROXYactivate) { + $PROXYserver = $this->em->getRepository('App:Config')->find('PROXYserver')->getValue(); + $PROXYport = $this->em->getRepository('App:Config')->find('PROXYport')->getValue(); + $clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false, 'proxy' => ['http' => 'http://'.$PROXYserver.':'.$PROXYport, 'https' => 'http://'.$PROXYserver.':'.$PROXYport]]); + } else { + $clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false]); + } + + try { + $clientguzzle->request('GET', $url); + } catch (RequestException $e) { + if ($e->hasResponse()) { + // Render + $feeds = []; + + return $this->getRender('viewflux.html.twig', [ + 'fluxs' => $fluxs, + 'feeds' => $feeds, + 'modelist' => $modelist, + ]); + } + } + + $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle); + $logger = new \Psr\Log\NullLogger(); + $feedIo = new \FeedIo\FeedIo($client, $logger); + + $feeds = []; + + // On lit le flux rss + try { + $result = $feedIo->read($url); + } catch (\Exception $e) { + $result = null; + } + + if ($result) { + $feedtitle = $result->getFeed()->getTitle(); + + // Pour chaque articles + $nbflux = 0; + foreach ($result->getFeed() as $item) { + $title = $item->getTitle(); + $link = $item->getLink(); + $description = substr(strip_tags($item->getDescription()), 0, 250); + $description = str_replace('¶', '', $description); + $date = $item->getLastModified(); + $dateformat = ($date ? $item->getLastModified()->format('d/m/Y H:i:s') : ''); + $content = $item->getDescription(); + $media = $item->getMedias(); + $mediaurl = ''; + + foreach ($item->getMedias() as $itemMedia) { + if ('image/jpeg' == $itemMedia->getType()) { + $mediaurl = $itemMedia->getUrl(); + } + } + + foreach ($item->getAllElements() as $element) { + if ('content:encoded' == $element->getName()) { + $content = $element->getValue(); + } + } + + if ('' != $mediaurl) { + $imgurl = $mediaurl; + } else { + // Récupérer la première image du contenu + $imgcontent = ''; + $imgurl = ''; + $imgstart = stripos($content, '', $imgstart); + $imgcontent = substr($content, $imgstart, $imgend - $imgstart + 1); + + $imgstart = stripos($imgcontent, 'src='); + $imgurl = substr($imgcontent, $imgstart + 5); + $imgend = stripos($imgurl, '"'); + + if (false === $imgend) { + $imgend = stripos($imgurl, "'"); + } + $imgurl = substr($imgurl, 0, $imgend); + } + } + + // Garder le flux + array_push($feeds, [ + 'feedtitle' => $feedtitle, + 'title' => $title, + 'link' => $link, + 'description' => $description, + 'date' => $date, + 'dateformat' => $dateformat, + 'content' => $content, + 'image' => $imgurl, + // "color" => $flux->getColor(), + 'fluxid' => 0, + 'fluxtitle' => $this->entity->getName(), + ]); + + ++$nbflux; + if ($nbflux >= $nbarticle && $nbarticle > 0) { + break; + } + } + + $libelle = []; + foreach ($feeds as $key => $valeur) { + $libelle[$key] = $valeur['date']; + } + array_multisort($libelle, SORT_DESC, $feeds); + + // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn + $filesystem->dumpFile($filecache, serialize($feeds)); + } + } + // Render return $this->getRender('viewflux.html.twig', [ 'fluxs' => $fluxs, @@ -1158,30 +1034,30 @@ class PagewidgetController extends AbstractController ]); } - public function viewbookmark(Request $request, $id, $access = 'config') + public function viewbookmark($id, $access, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Valeur par défaut $modedesktop = 0; $bookmarks = null; - // Datas associées au widget - if (!$this->mini) { - // Récupération des paramétres du widget - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'modedesktop': - $modedesktop = $parameter['value']; - break; - } + // 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 = $this->em->getRepository('App:Bookmark')->findBy(['pagewidget' => $this->entity]); } + // 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, @@ -1190,10 +1066,10 @@ class PagewidgetController extends AbstractController ]); } - public function viewlink(Request $request, $id, $access = 'config') + public function viewlink($id, $access, Request $request, ManagerRegistry $em) { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $url = ''; @@ -1211,16 +1087,36 @@ class PagewidgetController extends AbstractController // Render return $this->getRender('viewlink.html.twig', [ - 'canadd' => false, + 'canadd' => $this->canadd, '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', [ + 'canadd' => $this->canupdate, + 'usage' => $this->usage, + 'id' => $id, + 'idpage' => $this->entity->getPage()->getId(), + ]); + } + public function vieweditor(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $html = ''; @@ -1242,7 +1138,7 @@ class PagewidgetController extends AbstractController public function viewslide(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $interval = '2'; @@ -1268,7 +1164,7 @@ class PagewidgetController extends AbstractController public function viewfile(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $view = 'small'; @@ -1291,7 +1187,7 @@ class PagewidgetController extends AbstractController public function viewgalery(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); $directory = $this->get('kernel')->getRootDir().'/../uploads/file/widget-'.$id; $files = []; @@ -1329,7 +1225,7 @@ class PagewidgetController extends AbstractController public function viewcalendar(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $nbday = '0'; @@ -1358,7 +1254,7 @@ class PagewidgetController extends AbstractController public function viewblog(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $nbarticle = 10; @@ -1398,7 +1294,7 @@ class PagewidgetController extends AbstractController public function viewproject(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Parametres $nbarticle = 10; @@ -1456,212 +1352,10 @@ class PagewidgetController extends AbstractController ]); } - public function viewseparator(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Parametres - $seetitle = false; - $seeicon = false; - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'seetitle': - $seetitle = boolval($parameter['value']); - break; - case 'seeicon': - $seeicon = boolval($parameter['value']); - break; - } - } - - // Render - return $this->getRender('viewseparator.html.twig', [ - 'canadd' => $this->canupdate, - 'seetitle' => $seetitle, - 'seeicon' => $seeicon, - ]); - } - - public function viewclock(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Parametres - $clock = '0'; - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'clock': - $clock = $parameter['value']; - break; - } - } - - // Render - return $this->getRender('viewframe.html.twig', [ - 'canadd' => $this->canupdate, - 'onheader' => true, - 'tool' => (0 == $clock ? 'app_user_tool_clockanalogique' : 'app_user_tool_clocknumerique'), - ]); - } - - public function viewcalculator(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Render - return $this->getRender('viewframe.html.twig', [ - 'canadd' => $this->canupdate, - 'onheader' => true, - 'tool' => 'app_user_tool_calculator', - ]); - } - - public function viewappexternal(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Récupération des paramétres du widget - $idappexternal = null; - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'appexternal': - $idappexternal = $parameter['value']; - break; - case 'modedesktop': - $modedesktop = $parameter['value']; - break; - } - } - - $user = $this->getUser(); - $items = []; - $itemcategorys = []; - if ($user) { - if ($idappexternal) { - $appextenals = $this->em->getRepository('App:Appexternal')->findBy(['id' => $idappexternal]); - } else { - $appextenals = $this->em->getRepository('App:Appexternal')->findAll(); - } - foreach ($appextenals as $appexternal) { - switch ($appexternal->getName()) { - case 'Limesurvey': - $category = ['id' => 0, 'label' => 'Limesurvey']; - array_push($itemcategorys, $category); - - $directory = $this->get('kernel')->getRootDir().'/../uploads/limesurvey/'.$user->getId(); - $files = []; - $fs = new Filesystem(); - - if ($fs->exists($directory.'/invitation.json')) { - $file = file_get_contents($directory.'/invitation.json'); - $json = substr($file, 0, -2); // sup dernier , - $surveys = json_decode('{'.$json.'}', true); - if (is_array($surveys)) { - foreach ($surveys as $id => $survey) { - array_push($items, ['id' => $id, 'title' => $survey['title'], 'subtitle' => 'Sondage', 'url' => $survey['url'], 'itemcategory' => $category, 'color' => '328637', 'icon' => 'icon_limesurvey.png']); - } - } - } - - break; - - case 'Moodle': - $category = ['id' => 1, 'label' => 'Moodle']; - array_push($itemcategorys, $category); - - $directory = $this->get('kernel')->getRootDir().'/../uploads/moodle/'.$user->getId(); - $files = []; - $fs = new Filesystem(); - - if ($fs->exists($directory.'/invitation.json')) { - $file = file_get_contents($directory.'/invitation.json'); - $json = substr($file, 0, -2); // sup dernier , - $courses = json_decode('{'.$json.'}', true); - if (is_array($courses)) { - foreach ($courses as $id => $course) { - array_push($items, ['id' => $id, 'title' => $course['title'], 'subtitle' => 'Cours', 'url' => $course['url'], 'itemcategory' => $category, 'color' => 'f77f11', 'icon' => 'icon_moodle.png']); - } - } - } - - break; - } - } - } - - // Trier les item par title - $title = array_column($items, 'title'); - array_multisort($title, SORT_ASC, $items); - - // Render - return $this->getRender('viewappexternal.html.twig', [ - 'canadd' => $user, - 'modedesktop' => $modedesktop, - 'items' => $items, - 'itemcategorys' => $itemcategorys, - ]); - } - - public function viewinfo(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - $icon = null; - $title = null; - $description = null; - $members = []; - if ('group' == $this->usage) { - $groupentity = $this->em->getRepository('App:Group')->find($this->group); - if ($groupentity) { - $title = $this->entity->getPage()->getName(); - $id = $groupentity->getId(); - if ($groupentity->getDescription()) { - $description = 'Description
'.$groupentity->getDescription(); - } - if ($groupentity->getIcon()) { - $icon = '/'.$groupentity->getIcon()->getLabel(); - } else { - $icon = '/uploads/icon/icon_users.png'; - } - - foreach ($groupentity->getUsers() as $usergroup) { - array_push($members, $usergroup); - } - } - } else { - $title = $this->entity->getPage()->getName(); - $proprio = $this->entity->getPage()->getUser(); - $id = 0; - if ($proprio) { - $description = 'Propriétaire de la page
'.$proprio->getLastname().' '.$proprio->getLastname(); - $icon = '/uploads/avatar/'.$proprio->getAvatar(); - } else { - $icon = '/uploads/avatar/noavatar.png'; - } - } - - // Render - return $this->getRender('viewinfo.html.twig', [ - 'canadd' => $this->canupdate, - 'usage' => $this->usage, - 'icon' => $icon, - 'title' => $title, - 'description' => $description, - 'members' => $members, - 'id' => $id, - 'idpage' => $this->entity->getPage()->getId(), - ]); - } - public function viewchat(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); $group = $this->group; if ('group' != $this->usage || !$group) { @@ -1681,7 +1375,7 @@ class PagewidgetController extends AbstractController public function viewgroup(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); $user = $this->getUser(); $mygroups = []; @@ -1711,7 +1405,7 @@ class PagewidgetController extends AbstractController public function viewgroupmessage(Request $request, $id, $access = 'config') { // Récupération de la requete - $this->setRequest($request, $id, $access); + $this->setRequest($em, $request, $id, $access); // Récupération des paramétres du widget $modelist = 1; @@ -1770,30 +1464,4 @@ class PagewidgetController extends AbstractController 'nbarticle' => $nbarticle, ]); } - - public function viewOnlydoc(Request $request, $id, $access = 'config') - { - // Récupération de la requete - $this->setRequest($request, $id, $access); - - // Récupération des paramétres du widget - $apponly = 0; - $view = 'small'; - foreach ($this->entity->getParameter()['fields'] as $parameter) { - switch ($parameter['id']) { - case 'apponly': - $apponly = $parameter['value']; - break; - case 'modelist': - $view = (0 == $parameter['value'] ? 'small' : 'list'); - break; - } - } - - return $this->getRender('viewonlydoc.html.twig', [ - 'canadd' => $this->canupdate, - 'directory' => $id, - 'view' => $view, - ]); - } } diff --git a/src/Entity/Alert.php b/src/Entity/Alert.php index 5d2189d..67a06c9 100755 --- a/src/Entity/Alert.php +++ b/src/Entity/Alert.php @@ -87,7 +87,7 @@ class Alert * @ORM\ManyToMany(targetEntity="User", inversedBy="alertreaders", cascade={"persist"}) * @ORM\JoinTable(name="alertuserread", * joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")}, - * inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")} + * inverseJoinColumns={@ORM\JoinColumn(name="useraccount", referencedColumnName="id")} * ) */ protected $readers; diff --git a/src/Entity/Group.php b/src/Entity/Group.php index 16d1266..3238587 100755 --- a/src/Entity/Group.php +++ b/src/Entity/Group.php @@ -103,11 +103,17 @@ class Group */ 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 @@ -339,4 +345,31 @@ class Group 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/User.php b/src/Entity/User.php index 815b35a..1f5c732 100755 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -191,11 +191,17 @@ 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 @@ -677,4 +683,31 @@ 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/Form/BookmarkType.php b/src/Form/BookmarkType.php new file mode 100755 index 0000000..9ecc749 --- /dev/null +++ b/src/Form/BookmarkType.php @@ -0,0 +1,64 @@ +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/GroupType.php b/src/Form/GroupType.php index 3107bb9..834db3c 100755 --- a/src/Form/GroupType.php +++ b/src/Form/GroupType.php @@ -2,6 +2,8 @@ namespace App\Form; +use Doctrine\ORM\EntityRepository; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\Extension\Core\Type\EmailType; @@ -32,6 +34,18 @@ class GroupType extends AbstractType ); } + $builder->add('pagetemplate', + EntityType::class, [ + 'class' => "App\Entity\Page", + 'label' => "Modèle de Page pour l'accueil du groupe", + 'required' => false, + 'choice_label' => 'name', + 'query_builder' => function (EntityRepository $er) { + return $er->createQueryBuilder('page')->where('page.parentfor=:parentfor')->setParameter('parentfor', 'group'); + }, + ] + ); + if ('admin' == $options['access'] || 'update' == $options['mode']) { $builder->add('owner', Select2EntityType::class, [ diff --git a/src/Form/ItemType.php b/src/Form/ItemType.php index 48a5ec9..144a96a 100644 --- a/src/Form/ItemType.php +++ b/src/Form/ItemType.php @@ -58,7 +58,8 @@ class ItemType extends AbstractType 'choices' => [ 'Visiteur' => 'ROLE_ANONYME', 'Utilisateur' => 'ROLE_USER', - 'Animateur de Groupe' => 'ROLE_ANIM', + 'Manager' => 'ROLE_MANAGER', + 'Master' => 'ROLE_MASTER', 'Modérateur' => 'ROLE_MODO', 'Administateur' => 'ROLE_ADMIN', ], diff --git a/src/Form/PageSubmitType.php b/src/Form/PageSubmitType.php new file mode 100644 index 0000000..c224d1b --- /dev/null +++ b/src/Form/PageSubmitType.php @@ -0,0 +1,148 @@ +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/PageUpdateWidgetType.php b/src/Form/PageUpdateWidgetType.php index 93fb64e..5af684f 100644 --- a/src/Form/PageUpdateWidgetType.php +++ b/src/Form/PageUpdateWidgetType.php @@ -45,14 +45,15 @@ class PageUpdateWidgetType extends AbstractType 'required' => false, ]); - if ('config' == $options['access'] && 'group' != $options['for']) { + 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', - 'Animateur de Groupe' => 'ROLE_ANIM', + 'Manager' => 'ROLE_MANAGER', + 'Master' => 'ROLE_MASTER', 'Modérateur' => 'ROLE_MODO', 'Administateur' => 'ROLE_ADMIN', ], @@ -63,10 +64,10 @@ class PageUpdateWidgetType extends AbstractType ->add('groups', Select2EntityType::class, [ 'label' => 'Visible pour les Groupes', - 'class' => 'App:Group', + 'class' => 'App\Entity\Group', 'text_property' => 'label', 'multiple' => true, - 'remote_route' => 'app_ajax_group_list', + 'remote_route' => 'app_admin_group_selectlist', 'primary_key' => 'id', 'text_property' => 'label', 'minimum_input_length' => 0, @@ -84,7 +85,7 @@ class PageUpdateWidgetType extends AbstractType 'disabled' => ('delete' == $options['mode'] ? true : false), 'required' => false, 'multiple' => false, - 'remote_route' => 'app_config_user_ajax_selectlist', + 'remote_route' => 'app_admin_user_selectlist', 'class' => 'App\Entity\User', 'primary_key' => 'id', 'text_property' => 'username', diff --git a/src/Form/Type/FaChoiceType.php b/src/Form/Type/FaChoiceType.php index abac307..24e0d18 100644 --- a/src/Form/Type/FaChoiceType.php +++ b/src/Form/Type/FaChoiceType.php @@ -40,7 +40,6 @@ class FaChoiceType extends AbstractType 'attr' => [ // It's the key of the solution and can be done in many ways. // Now, the rendered @@ -37,7 +37,8 @@ {% endblock %} -{% block localjavascript %} +{% block localscript %} + {% endblock %} diff --git a/templates/Page/menugroupe.html.twig b/templates/Page/menugroupe.html.twig index 4538fdd..fc04186 100644 --- a/templates/Page/menugroupe.html.twig +++ b/templates/Page/menugroupe.html.twig @@ -1,47 +1,7 @@ {% if not inmenu %} - {% else %} - {% for groupshared in groupsshared %} + {% for groupshared in groups %} {% if groupshared.pagesshared|length == 1 %} {% set page = groupshared.pagesshared[0] %} {% set forcereload=true %} diff --git a/templates/Page/noportal.html.twig b/templates/Page/noportal.html.twig deleted file mode 100644 index c8657b6..0000000 --- a/templates/Page/noportal.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/pages.html.twig b/templates/Page/pages.html.twig index 274c035..7cbab6f 100644 --- a/templates/Page/pages.html.twig +++ b/templates/Page/pages.html.twig @@ -1,292 +1,308 @@ -{% extends '@CadolesCore/base.html.twig' %} +{% extends 'base.html.twig' %} {% block localstyle %} - body{overflow-y:hidden} + {% endblock %} -{% block appmenu %} - - - - -