From cdf7c5a24c7f2d2cdc5daea1a70c3eaa01018442 Mon Sep 17 00:00:00 2001 From: afornerot Date: Thu, 12 Jan 2023 16:14:31 +0100 Subject: [PATCH] ninegate --- assets/js/app.js | 2 +- assets/styles/app.css | 7 +- config/routes.yaml | 645 +++++- config/services.yaml | 10 +- migrations/Version20230111095833.php | 64 + migrations/Version20230112085854.php | 34 + public/medias/icon/icon_add.png | Bin 0 -> 2432 bytes public/medias/icons-fa5.json | 1 + src/Command/InitCommand.php | 132 +- src/Controller/BookmarkController.php | 341 ++++ src/Controller/HomeController.php | 9 +- src/Controller/ItemController.php | 16 +- src/Controller/ItemcategoryController.php | 42 +- src/Controller/PagetemplateController.php | 322 +++ src/Controller/PagewidgetController.php | 1799 +++++++++++++++++ src/Entity/Group.php | 17 + src/Entity/Pagewidget.php | 621 ++---- src/Entity/Widget.php | 541 ++--- src/Form/ItemType.php | 160 +- src/Form/ItemcategoryType.php | 21 +- src/Form/PageUpdateWidgetType.php | 113 ++ src/Form/PagetemplateSubmitType.php | 53 + src/Form/PagewidgetType.php | 248 +++ src/Form/Type/FaChoiceType.php | 75 + src/Repository/ItemRepository.php | 177 +- src/Repository/WidgetRepository.php | 31 +- templates/Form/fields.html.twig | 2 +- templates/Icon/select.html.twig | 2 +- templates/Include/sidebaradmin.html.twig | 14 +- templates/Page/application.html.twig | 334 +++ templates/Page/default.html.twig | 141 ++ templates/Page/list.html.twig | 89 + templates/Page/menugroupe.html.twig | 109 + templates/Page/noportal.html.twig | 334 +++ templates/Page/pages.html.twig | 571 ++++++ templates/Page/share.html.twig | 46 + templates/Page/submit.html.twig | 86 + templates/Page/updateeditor.html.twig | 72 + templates/Page/updatetool.html.twig | 66 + templates/Page/updateurl.html.twig | 76 + templates/Page/updatewidget.html.twig | 543 +++++ templates/Page/vieweditor.html.twig | 23 + templates/Page/viewurl.html.twig | 59 + templates/Page/viewwidget.html.twig | 563 ++++++ templates/Pagetemplate/list.html.twig | 58 + templates/Pagetemplate/submit.html.twig | 45 + templates/Pagewidget/constants.twig | 238 +++ templates/Pagewidget/edit.html.twig | 183 ++ templates/Pagewidget/viewalert.html.twig | 140 ++ .../Pagewidget/viewappexternal.html.twig | 112 + templates/Pagewidget/viewblog.html.twig | 101 + templates/Pagewidget/viewbookmark.html.twig | 132 ++ templates/Pagewidget/viewcalendar.html.twig | 100 + templates/Pagewidget/viewchat.html.twig | 76 + templates/Pagewidget/vieweditor.html.twig | 56 + templates/Pagewidget/viewfile.html.twig | 67 + templates/Pagewidget/viewflux.html.twig | 141 ++ templates/Pagewidget/viewframe.html.twig | 77 + templates/Pagewidget/viewgalery.html.twig | 123 ++ templates/Pagewidget/viewgroup.html.twig | 116 ++ .../Pagewidget/viewgroupmessage.html.twig | 121 ++ templates/Pagewidget/viewinfo.html.twig | 60 + templates/Pagewidget/viewitem.html.twig | 263 +++ .../Pagewidget/viewitemessential.html.twig | 249 +++ templates/Pagewidget/viewlink.html.twig | 22 + templates/Pagewidget/viewonlydoc.html.twig | 76 + templates/Pagewidget/viewproject.html.twig | 133 ++ templates/Pagewidget/viewseparator.html.twig | 63 + templates/Pagewidget/viewslide.html.twig | 95 + templates/Pagewidget/viewurl.html.twig | 86 + templates/Pagewidget/widgetheader.html.twig | 91 + templates/Pagewidget/widgetmini.html.twig | 13 + 72 files changed, 10635 insertions(+), 1013 deletions(-) create mode 100644 migrations/Version20230111095833.php create mode 100644 migrations/Version20230112085854.php create mode 100644 public/medias/icon/icon_add.png create mode 100644 public/medias/icons-fa5.json create mode 100644 src/Controller/BookmarkController.php create mode 100644 src/Controller/PagetemplateController.php create mode 100644 src/Controller/PagewidgetController.php create mode 100644 src/Form/PageUpdateWidgetType.php create mode 100644 src/Form/PagetemplateSubmitType.php create mode 100644 src/Form/PagewidgetType.php create mode 100644 src/Form/Type/FaChoiceType.php create mode 100644 templates/Page/application.html.twig create mode 100644 templates/Page/default.html.twig create mode 100644 templates/Page/list.html.twig create mode 100644 templates/Page/menugroupe.html.twig create mode 100644 templates/Page/noportal.html.twig create mode 100644 templates/Page/pages.html.twig create mode 100644 templates/Page/share.html.twig create mode 100644 templates/Page/submit.html.twig create mode 100644 templates/Page/updateeditor.html.twig create mode 100644 templates/Page/updatetool.html.twig create mode 100644 templates/Page/updateurl.html.twig create mode 100644 templates/Page/updatewidget.html.twig create mode 100644 templates/Page/vieweditor.html.twig create mode 100644 templates/Page/viewurl.html.twig create mode 100644 templates/Page/viewwidget.html.twig create mode 100644 templates/Pagetemplate/list.html.twig create mode 100644 templates/Pagetemplate/submit.html.twig create mode 100644 templates/Pagewidget/constants.twig create mode 100644 templates/Pagewidget/edit.html.twig create mode 100644 templates/Pagewidget/viewalert.html.twig create mode 100644 templates/Pagewidget/viewappexternal.html.twig create mode 100644 templates/Pagewidget/viewblog.html.twig create mode 100644 templates/Pagewidget/viewbookmark.html.twig create mode 100644 templates/Pagewidget/viewcalendar.html.twig create mode 100644 templates/Pagewidget/viewchat.html.twig create mode 100644 templates/Pagewidget/vieweditor.html.twig create mode 100644 templates/Pagewidget/viewfile.html.twig create mode 100644 templates/Pagewidget/viewflux.html.twig create mode 100644 templates/Pagewidget/viewframe.html.twig create mode 100644 templates/Pagewidget/viewgalery.html.twig create mode 100644 templates/Pagewidget/viewgroup.html.twig create mode 100644 templates/Pagewidget/viewgroupmessage.html.twig create mode 100644 templates/Pagewidget/viewinfo.html.twig create mode 100644 templates/Pagewidget/viewitem.html.twig create mode 100644 templates/Pagewidget/viewitemessential.html.twig create mode 100644 templates/Pagewidget/viewlink.html.twig create mode 100644 templates/Pagewidget/viewonlydoc.html.twig create mode 100644 templates/Pagewidget/viewproject.html.twig create mode 100644 templates/Pagewidget/viewseparator.html.twig create mode 100644 templates/Pagewidget/viewslide.html.twig create mode 100644 templates/Pagewidget/viewurl.html.twig create mode 100644 templates/Pagewidget/widgetheader.html.twig create mode 100644 templates/Pagewidget/widgetmini.html.twig diff --git a/assets/js/app.js b/assets/js/app.js index a88512f..901a68b 100755 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -84,6 +84,6 @@ function resize() { $("main").css("height",$(window).height()-$(".header").height()); $("#page").css("height",$(window).height()-$(".header").height()); - $("#sidebar").css("min-height",$("body").height()-$(".header").height()); + $("#sidebar").css("min-height",$("body").height()-$(".header").height()); } diff --git a/assets/styles/app.css b/assets/styles/app.css index f9c2120..e696e6c 100755 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -232,6 +232,10 @@ border-width: 1px; /* ITEM */ +.itemframe { + width: 100% +} + .items-list { display:flex; flex-wrap: wrap; @@ -243,7 +247,7 @@ border-width: 1px; text-align: center; justify-content: center; margin-right:5px; - margin-bottom:5px; + margin-top:5px; flex-wrap: wrap; color: var(--colorftbodydark) !important; } @@ -395,6 +399,7 @@ border-width: 1px; .item-list { width:100%; justify-content: left; + margin-right: 0px; } .item-list .item-container { diff --git a/config/routes.yaml b/config/routes.yaml index 0aec843..18e917b 100755 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -997,4 +997,647 @@ app_admin_itemcategory_delete: app_admin_itemcategory_order: path: /admin/itemcategory/order controller: App\Controller\ItemcategoryController::order - defaults: { access: admin } \ No newline at end of file + defaults: { access: admin } + +#== BOOKMARK ============================================================================================================================================= + +#-- Access config +app_admin_bookmark_submit: + path: /admin/bookmark/submit/{idpage}/{idwidget}/{touser} + controller: App\Controller\BookmarkController::order + defaults: { access: admin } + +app_admin_bookmark_update: + path: /admin/bookmark/update/{idpage}/{id} + controller: App\Controller\BookmarkController::update + defaults: { access: admin } + +app_admin_bookmark_delete: + path: /admin/bookmark/delete/{idpage}/{id} + controller: App\Controller\BookmarkController::delete + defaults: { access: admin } + +#-- Access all +app_all_bookmark_submit: + path: /all/bookmark/submit/{idpage}/{idwidget}/{touser} + controller: App\Controller\BookmarkController::submit + defaults: { access: all } + +app_all_bookmark_update: + path: /all/bookmark/update/{idpage}/{id} + controller: App\Controller\BookmarkController::update + defaults: { access: all } + +app_all_bookmark_delete: + path: /all/bookmark/delete/{idpage}/{id} + controller: App\Controller\BookmarkController::delete + defaults: { access: all } + +app_all_bookmark_heart: + path: /all/bookmark/heart + controller: App\Controller\BookmarkController::heart + defaults: { access: all } + + +#== FILE ================================================================================================================= + +#-- Access admin +app_admin_file_list: + path: /admin/file/list/{directory} + controller: App\Controller\FileController::list + defaults: { access: admin } + +app_admin_file_upload: + path: /admin/file/upload/{id}/{type} + controller: App\Controller\FileController::upload + defaults: { access: admin } + +app_admin_file_subdirectory: + path: /admin/file/subdirectory/{id}/{type} + controller: App\Controller\FileController::subdirectory + defaults: { access: admin } + +app_admin_file_rename: + path: /admin/file/rename/{id}/{oldname} + controller: App\Controller\FileController::rename + defaults: { access: admin } + +app_admin_file_trash: + path: /admin/file/trash/ + controller: App\Controller\FileController::trash + defaults: { access: admin } + +app_admin_file_restaure: + path: /admin/file/restaure/ + controller: App\Controller\FileController::restaure + defaults: { access: admin } + +app_admin_file_purgetrash: + path: /admin/file/purgetrash/{directory} + controller: App\Controller\FileController::purgetrash + defaults: { access: admin } + +app_admin_file_delete: + path: /admin/file/delete/ + controller: App\Controller\FileController::delete + defaults: { access: admin } + +app_admin_file_move: + path: /admin/file/move/ + controller: App\Controller\FileController::move + defaults: { access: admin } + +app_admin_file_view: + path: /admin/file/view/{directory}/{filename} + controller: App\Controller\FileController::view + defaults: { access: admin } + +app_admin_file_show: + path: /admin/file/show/{directory}/{filename} + controller: App\Controller\FileController::show + defaults: { access: admin } + +app_admin_file_download: + path: /admin/file/download/{directory}/{filename} + controller: App\Controller\FileController::download + defaults: { access: admin } + +#-- Access all +app_all_file_list: + path: /all/file/list/{directory} + controller: App\Controller\FileController::list + defaults: { access: all } + +app_all_file_upload: + path: /all/file/upload/{id}/{type} + controller: App\Controller\FileController::upload + defaults: { access: all } + +app_all_file_subdirectory: + path: /all/file/subdirectory/{id}/{type} + controller: App\Controller\FileController::subdirectory + defaults: { access: all } + +app_all_file_rename: + path: /all/file/rename/{id}/{oldname} + controller: App\Controller\FileController::rename + defaults: { access: all } + +app_all_file_trash: + path: /all/file/trash/ + controller: App\Controller\FileController::trash + defaults: { access: all } + +app_all_file_restaure: + path: /all/file/restaure/ + controller: App\Controller\FileController::restaure + defaults: { access: all } + +app_all_file_purgetrash: + path: /all/file/purgetrash/{directory} + controller: App\Controller\FileController::purgetrash + defaults: { access: all } + +app_all_file_delete: + path: /all/file/delete + controller: App\Controller\FileController::delete + +app_all_file_move: + path: /all/file/move/ + controller: App\Controller\FileController::move + defaults: { access: all } + +app_all_file_view: + path: /all/file/view/{directory}/{filename} + controller: App\Controller\FileController::view + defaults: { access: all } + +app_all_file_download: + path: /all/file/download/{directory}/{filename} + controller: App\Controller\FileController::download + defaults: { access: all } + +app_all_file_show: + path: /all/file/show/{directory}/{filename} + controller: App\Controller\FileController::show + defaults: { access: all } + +#== SLIDE ================================================================================================================================================ + +#-- Access admin +app_admin_slide_list: + path: /config/slide/{idpage}/{idwidget} + controller: App\Controller\SlideController::list + defaults: { access: admin } + +app_admin_slide_submit: + path: /config/slide/submit/{idpage}/{idwidget} + controller: App\Controller\SlideController::submit + defaults: { access: admin } + +app_admin_slide_update: + path: /config/slide/update/{idpage}/{id} + controller: App\Controller\SlideController::update + defaults: { access: admin } + +app_admin_slide_delete: + path: /config/slide/delete/{idpage}/{id} + controller: App\Controller\SlideController::delete + defaults: { access: admin } + +app_admin_slide_upload: + path: /config/slide/upload + controller: App\Controller\SlideController::upload + defaults: { access: admin } + +#-- Access all +app_all_slide_list: + path: /user/slide/{idpage}/{idwidget} + controller: App\Controller\SlideController::list + defaults: { access: all } + +app_all_slide_submit: + path: /user/slide/submit/{idpage}/{idwidget} + controller: App\Controller\SlideController::submit + defaults: { access: all } + +app_all_slide_update: + path: /user/slide/update/{idpage}/{id} + controller: App\Controller\SlideController::update + defaults: { access: all } + +app_all_slide_delete: + path: /user/slide/delete/{idpage}/{id} + controller: App\Controller\SlideController::delete + defaults: { access: all } + +app_all_slide_upload: + path: /user/slide/upload + controller: App\Controller\SlideController::upload + defaults: { access: all } + +#== MESSAGE ================================================================================================================== + +# Access all +app_all_message_chat: + path: /all/message/chat/{id} + controller: App\Controller\WebsocketController::chat + defaults: { access: all } + +app_all_message_see: + path: /all/message/see + controller: App\Controller\WebsocketController::see + defaults: { access: all } + + +#== PAGE TEMPLATE ======================================================================================================================================== + +#-- Access admin +app_admin_pagetemplate: + path: /admin/template + controller: App\Controller\PagetemplateController::list + defaults: { access: admin } + +app_admin_pagetemplate_tablelist: + path: /admin/template/tablelist + controller: App\Controller\PagetemplateController::tablelist + defaults: { access: admin } + +app_admin_pagetemplate_submit: + path: /admin/template/submit + controller: App\Controller\PagetemplateController::submit + defaults: { access: admin } + +app_admin_pagetemplate_update: + path: /admin/template/update/{id} + controller: App\Controller\PagetemplateController::update + defaults: { access: admin } + +app_admin_pagetemplate_delete: + path: /admin/template/delete/{id} + controller: App\Controller\PagetemplateController::delete + defaults: { access: admin } + +app_admin_pagetemplate_view: + path: /admin/template/view/{id} + controller: App\Controller\PagetemplateController::view + defaults: { access: admin } + +#-- Access all +app_all_pagetemplate_selectlist: + path: /all/template/selectlist + controller: App\Controller\PagetemplateController::selectlist + defaults: { access: admin } + + +#== PAGE ================================================================================================================================================= + +#-- Access admin +app_admin_page: + path: /admin/page/ + controller: App\Controller\PageController::list + defaults: { access: admin } + +app_admin_page_ajax_list: + path: /admin/page/ajax/list + controller: App\Controller\PageController::tablelist + defaults: { access: admin } + +app_admin_ajax_page_seleclist: + path: /admin/page//ajax/selectlist + controller: App\Controller\PageController::selectlist + defaults: { access: admin } + +app_admin_page_submit: + path: /admin/page/submit + controller: App\Controller\PageController::submit + defaults: { access: admin } + +app_admin_page_update: + path: /admin/page/update/{id} + controller: App\Controller\PageController::update + defaults: { access: admin } + +app_admin_page_delete: + path: /admin/page/delete/{id} + controller: App\Controller\PageController::delete + defaults: { access: admin } + +app_admin_page_view: + path: /admin/page/view/{id} + controller: App\Controller\PageController::view + defaults: { access: admin } + +app_admin_page_order: + path: /admin/page/order + controller: App\Controller\PageController::order + defaults: { access: admin } + +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 + controller: App\Controller\PageController::submit + defaults: { access: all } + +app_all_page_update: + path: /all/page/update/{id} + controller: App\Controller\PageController::update + defaults: { access: all } + +app_all_page_delete: + path: /all/page/delete/{id} + controller: App\Controller\PageController::delete + defaults: { access: all } + +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 + controller: App\Controller\PageController::order + defaults: { access: all } + +app_all_page_upload: + path: /all/page/upload + controller: App\Controller\PageController::selectlist + defaults: { access: all } + +app_all_page_upload_direct: + path: /all/page/upload&responseType=json + controller: App\Controller\PageController::upload + defaults: { access: all } + +# 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 ========================================================================================================================================== + +#-- Access admin +app_admin_pagewidget_widget_sumbit: + path: /admin/pagewidget/submit/{idpage}/{idwidgettype} + controller: App\Controller\PagewidgetController::submit + defaults: { access: admin } + +app_admin_pagewidget_widget_update: + path: /admin/pagewidget/update/{idpage}/{idwidget} + controller: App\Controller\PagewidgetController::update + defaults: { access: admin } + +app_admin_pagewidget_delete: + path: /admin/pagewidget/delete/{idwidget} + controller: App\Controller\PagewidgetController::delete + defaults: { access: admin } + +app_admin_pagewidget_order: + path: /admin/pagewidget/order + controller: App\Controller\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 + defaults: { access: admin } + +app_admin_pagewidget_view_url: + path: /admin/pagewidget/view/url/{id} + controller: App\Controller\PageController::viewurl + defaults: { access: admin } + +app_admin_pagewidget_view_urlfixe: + path: /admin/pagewidget/view/urlfixe/{id} + controller: App\Controller\PagewidgetController::viewurlfixe + defaults: { access: admin } + +app_admin_pagewidget_view_item: + path: /admin/pagewidget/view/item/{id} + controller: App\Controller\PagewidgetController::viewitem + defaults: { access: admin } + +app_admin_pagewidget_view_itemessential: + path: /admin/pagewidget/view/itemessential/{id} + controller: App\Controller\PagewidgetController::viewitemessential + defaults: { access: admin } + +app_admin_pagewidget_view_alert: + path: /admin/pagewidget/view/alert/{id} + controller: App\Controller\PagewidgetController::viewalert + defaults: { access: admin } + +app_admin_pagewidget_view_flux: + path: /admin/pagewidget/view/flux/{id} + controller: App\Controller\PagewidgetController::viewflux + defaults: { access: admin } + +app_admin_pagewidget_view_rss: + path: /admin/pagewidget/view/rss/{id} + controller: App\Controller\PagewidgetController::viewrss + defaults: { access: admin } + +app_admin_pagewidget_view_bookmark: + path: /admin/pagewidget/view/bookmark/{id} + controller: App\Controller\PagewidgetController::viewbookmark + defaults: { access: admin } + +app_admin_pagewidget_view_link: + path: /admin/pagewidget/view/link/{id} + controller: App\Controller\PagewidgetController::viewlink + defaults: { access: admin } + +app_admin_pagewidget_view_editor: + path: /admin/pagewidget/view/editor/{id} + controller: App\Controller\PagewidgetController::vieweditor + defaults: { access: admin } + +app_admin_pagewidget_view_slide: + path: /admin/pagewidget/view/slide/{id} + controller: App\Controller\PagewidgetController::viewslide + defaults: { access: admin } + +app_admin_pagewidget_view_file: + path: /admin/pagewidget/view/file/{id} + controller: App\Controller\PagewidgetController::viewfile + defaults: { access: admin } + +app_admin_pagewidget_view_galery: + path: /admin/pagewidget/view/galery/{id} + controller: App\Controller\PagewidgetController::viewgalery + defaults: { access: admin } + +app_admin_pagewidget_view_calendar: + path: /admin/pagewidget/view/calendar/{id} + controller: App\Controller\PagewidgetController::viewcalendar + defaults: { access: admin } + +app_admin_pagewidget_view_blog: + path: /admin/pagewidget/view/blog/{id} + controller: App\Controller\PagewidgetController::viewblog + defaults: { access: admin } + +app_admin_pagewidget_view_project: + path: /admin/pagewidget/view/project/{id} + controller: App\Controller\PagewidgetController::viewproject + defaults: { access: admin } + +app_admin_pagewidget_view_info: + path: /admin/pagewidget/view/info/{id} + controller: App\Controller\PagewidgetController::viewinfo + defaults: { access: admin } + +app_admin_pagewidget_view_chat: + path: /admin/pagewidget/view/chat/{id} + controller: App\Controller\PagewidgetController::viewchat + defaults: { access: admin } + +app_admin_pagewidget_view_group: + path: /admin/pagewidget/view/group/{id} + controller: App\Controller\PagewidgetController::viewgroup + defaults: { access: admin } + +app_admin_pagewidget_view_groupmessage: + path: /admin/pagewidget/view/groupmessage/{id} + controller: App\Controller\PagewidgetController::viewgroupmessage + defaults: { access: admin } + +#-- Access all +app_all_pagewidget_widget_sumbit: + path: /user/pagewidget/submit/{idpage}/{idwidgettype} + controller: App\Controller\PagewidgetController::submit + defaults: { access: all } + +app_all_pagewidget_widget_update: + path: /user/pagewidget/update/{idpage}/{idwidget} + controller: App\Controller\PagewidgetController::update + defaults: { access: all } + +app_all_pagewidget_delete: + path: /user/pagewidget/delete/{idwidget} + controller: App\Controller\PagewidgetController::delete + defaults: { access: all } + +app_all_pagewidget_order: + path: /user/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 + defaults: { access: all } + +app_all_pagewidget_view_urlfixe: + path: /pagewidget/view/urlfixe/{id} + controller: App\Controller\PagewidgetController::viewurlfixe + defaults: { access: all } + +app_all_pagewidget_view_item: + path: /pagewidget/view/item/{id} + controller: App\Controller\PagewidgetController::viewitem + defaults: { access: all } + +app_all_pagewidget_view_itemessential: + path: /pagewidget/view/itemessential/{id} + controller: App\Controller\PagewidgetController::viewitemessential + defaults: { access: all } + +app_all_pagewidget_view_alert: + path: /pagewidget/view/alert/{id} + controller: App\Controller\PagewidgetController::viewalert + defaults: { access: all } + +app_all_pagewidget_view_flux: + path: /pagewidget/view/flux/{id} + controller: App\Controller\PagewidgetController::viewflux + defaults: { access: all } + +app_all_pagewidget_view_rss: + path: /pagewidget/view/rss/{id} + controller: App\Controller\PagewidgetController::viewrss + defaults: { access: all } + +app_all_pagewidget_view_bookmark: + path: /pagewidget/view/bookmark/{id} + controller: App\Controller\PagewidgetController::viewbookmark + defaults: { access: all } + +app_all_pagewidget_view_link: + path: /pagewidget/view/link/{id} + controller: App\Controller\PagewidgetController::viewlink + defaults: { access: all } + +app_all_pagewidget_view_editor: + path: /pagewidget/view/editor/{id} + controller: App\Controller\PagewidgetController::vieweditor + defaults: { access: all } + +app_all_pagewidget_view_slide: + path: /pagewidget/view/slide/{id} + controller: App\Controller\PagewidgetController::viewslide + defaults: { access: all } + +app_all_pagewidget_view_file: + path: /pagewidget/view/file/{id} + controller: App\Controller\PagewidgetController::viewfile + defaults: { access: all } + +app_all_pagewidget_view_galery: + path: /pagewidget/view/galery/{id} + controller: App\Controller\PagewidgetController::viewgalery + defaults: { access: all } + +app_all_pagewidget_view_calendar: + path: /pagewidget/view/calendar/{id} + controller: App\Controller\PagewidgetController::viewcalendar + defaults: { access: all } + +app_all_pagewidget_view_blog: + path: /pagewidget/view/blog/{id} + controller: App\Controller\PagewidgetController::viewblog + defaults: { access: all } + +app_all_pagewidget_view_project: + path: /pagewidget/view/project/{id} + controller: App\Controller\PagewidgetController::viewproject + defaults: { access: all } + +app_all_pagewidget_view_info: + path: /pagewidget/view/info/{id} + controller: App\Controller\PagewidgetController::viewinfo + defaults: { access: all } + +app_all_pagewidget_view_chat: + path: /pagewidget/view/chat/{id} + controller: App\Controller\PagewidgetController::viewchat + defaults: { access: all } + +app_all_pagewidget_view_group: + path: /pagewidget/view/group/{id} + controller: App\Controller\PagewidgetController::viewgroup + defaults: { access: all } + +app_all_pagewidget_view_groupmessage: + path: /pagewidget/view/groupmessage/{id} + controller: App\Controller\PagewidgetController::viewgroupmessage + defaults: { access: all } + \ No newline at end of file diff --git a/config/services.yaml b/config/services.yaml index e3e41c4..f6bde1a 100755 --- a/config/services.yaml +++ b/config/services.yaml @@ -266,4 +266,12 @@ services: arguments: ["%kernel.project_dir%","%minioUrl%","%minioKey%","%minioSecret%","%minioBucket%","%minioRoot%","%minioPathstyle%","%minioSecure%","%kernel.environment%"] App\Controller\RestController: - public: true \ No newline at end of file + public: true + + App\Form\PagewidgetType: + arguments: ["@service_container"] + + App\Form\Type\FaChoiceType: + arguments: ["%kernel.project_dir%/public/medias/icons-fa5.json"] + tags: + - { name: form.type } \ No newline at end of file diff --git a/migrations/Version20230111095833.php b/migrations/Version20230111095833.php new file mode 100644 index 0000000..4d20f6f --- /dev/null +++ b/migrations/Version20230111095833.php @@ -0,0 +1,64 @@ +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 new file mode 100644 index 0000000..f9ae911 --- /dev/null +++ b/migrations/Version20230112085854.php @@ -0,0 +1,34 @@ +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/public/medias/icon/icon_add.png b/public/medias/icon/icon_add.png new file mode 100644 index 0000000000000000000000000000000000000000..a66eca6a1830a7f8465a880a75eafb38965a85b7 GIT binary patch literal 2432 zcmV-`34iv9P)1RCt{2U0G~YRTv&{1B1jw1;vf9gvd5`ra*X5n;;4ZNR*(_ z7oRaf6BFZOc~AmKJLgOrl0IkyKBz!M|0Q2KZKu=!{NH!aJ@>4MMAXpJGh$9_!=$tl%TkV9V>zNerNp+BBR+@k zJ1s~42;X<7l)MPv_h{m4_?iA4yr=lyoc>$*jHI1iil2#}OZFZ2oPG4*FFu@_zoONmvfeB%V_^2ZLfEiI!`wp@&Y15cU~yKE|X0?d#}JDEjO zcF3Ek^Akx-&(+AozMn>UnB$ zE2tUHV=a|zYnVZu$Izihi3j0+z8&tjSIC9*gkleTUCxcjp#aHA=f#t7<$O&qm>Ghp zk3vIo1sh=iER|gX$vHwTkZ(p%;xINEsq;>bS^3N~s2<;^7KDsS?3`_jnbbP?j+*x7 zo3WDxs>6TCMWC(?9Pu~gVZ;1f{b*`ke1VnEE`;j-Tk6CIjbMV)X*;`sS|4M;4jlbR z=g7;{$qp>xsRu5OW~?Ep_3{*{HZdDo_g&-(4hi8x>4;4K0krU+?KkkkEYAdvyaYyg zo?5?(u_~9l4*STd6B&9cxhYXsHpLW7wu$lB-ASITh!T5CXWN^{QR`e1NhdQApJl0&6a${ZTvO}a z4^~dzffFMFkepZ$+E-`h=9=!L)?EYdOI+;}m_W&6P!rrrDn7RMA(&67lM!1&!;o$o z8a$gq5IOQB#GOhy*yrNA{@lqE9O7uAzv4UMIqE{YVORJ09=GW1K1UvR*~CF4oN43- za9{_n{y)hJ?ShqpI&L?Fi}L3=&Zc{fieDVk?Vv6!8(baZ&!YosnD8(=sS zi1lW~&u15gb((gZ3{Y$j)Osp@aSq=Z^1`tJ$~D1pPj3aqRkHL2V*`}Uq{_bHiTEj% zc>rgwQWuB~;Ewu9t+na?sto|*e@I;zHb8|`Vq10MtLzf;La+g$iQg)whPBI=4KS1e#FZK)Cl7A`B{z@<%LXuH0{Qxo;$#0YRR8D517!mk zA!H9;=!wbN4`xSARE9em1rp`esQ)>U^ii819)Ws`72K6zqb0< z+ph*7KsJDJVn0ub`#t1<0!(jGfxEfl44^N9c=a&~Fj@mBu`6ME8+S%^Fj@mBc`Q*pFP9AvP?)U&Oj~4WCmEBNGq|7IuJGh5pk*boYsa( zRF{Rb0S0H^v~ayLNQu4F0kHx6Hh}!<>XpHQIv_TH&%AnxINSnOkq5*E@Rhg~@c%VH zzHtI|Kx_bidCl3wDMy^74vG!n6P4^LwL?f`+W~BVfd&w7Tw{Q=lUYO_7#qMRmN-NL zPoXwFIfM-m01mcIT%kWeZXpkl4PcaTk-u3|d_>aDE~O5T4Pcf@B_A8q0JXd8t~b3> zhz&r;VK<9L;Mud(fwBRN8Q`@c#nM6Oj|||5$6Xr$k#fXA z>fqS`Rr65a%pbRi%J@K>4S?;rip1}$1tRc75LW}hZT#J;#McHWY$f{_bz#^5uEoEA z=Rj0#07TdilZ>MQpyqzr6Y&xAbM>Ra1gFUh#Re!>{H|g9{M|x#4u!OfIA#X8?7GvZ zT%818)FYJjtba8m*DLb3r$(sIOp&#V4{NVYZ10GC~)E-V{hfcQ%OG|QIv z7!|)4xTqjZ?SV=*sW81cgQr9-@|h=m5x*C>w1~Xm%p%1)U&Ys`s~d?uP4tD2H!VlL zgIf4+001^Pzyu#rCn2tcM&D=HFeeee7t`_^ZUGk_p-x8JXen`cdah{+21rc*q<89a(5r8B`l34A}wl|NX z)_F+aeTf@}2E>O3-@F}iEVaI60T&&Tw-y?~X^E`%q9^W@148L@A_;@P}G0}fK)wq(>v4G+aZe5#_>%~RmYV<_BO;AQ#* z2b6^>Um73Mr36%MwWd!i4I|+Zufy0(o}fYRL!iV^ucA|(>KJ#$2dlALK$UNGagk@)w zcxy0ys;Mu;mc0@?;q`LryoL^VpaCTARj3udBNx&oakDMlZ>dJf$<%oaJ#-&}Ef>R; z)PfrwQj0sp)!q$eeG6ArW6acfizM_wlPwwriteln('APP = Default Data'); - // On s'assure que le groupe tout le monde existe $metadata = $this->em->getClassMetaData('App\Entity\Group'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $this->em->getClassMetaData('App\Entity\Niveau01'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $this->em->getClassMetaData('App\Entity\User'); + $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\Widget'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + // == ORGANISATION ======================================================================================================================================== + + // On s'assure que le groupe tout le monde existe $group = $this->em->getRepository('App\Entity\Group')->findOneBy(['id' => '-1']); if (!$group) { $group = new Group(); @@ -71,9 +92,6 @@ class InitCommand extends Command } // On s'assure qu'il exite un niveau01 - $metadata = $this->em->getClassMetaData('App\Entity\Niveau01'); - $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); - $metadata->setIdGenerator(new AssignedGenerator()); $niveau01 = $this->em->getRepository('App\Entity\Niveau01')->findOneBy(['id' => '-1']); if (!$niveau01) { $niveau01 = new Niveau01(); @@ -85,9 +103,6 @@ class InitCommand extends Command } // On s'assure que le user admin existe - $metadata = $this->em->getClassMetaData('App\Entity\User'); - $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); - $metadata->setIdGenerator(new AssignedGenerator()); $user = $this->em->getRepository('App\Entity\User')->findOneBy(['id' => '-1']); if (!$user) { $user = new User(); @@ -116,6 +131,7 @@ class InitCommand extends Command } } + // == CONFIG ============================================================================================================================================== // colorbgbody = Couleur des fonds de page $this->insertConfig( 1, // order @@ -437,7 +453,8 @@ class InitCommand extends Command '', // grouped 'Image de fond de la bannière' ); - $output->writeln(''); + + // == CRON ================================================================================================================================================ // Job synchronisation des comptes utilisateur // Toute les 24h à 3h00 @@ -469,6 +486,8 @@ class InitCommand extends Command $this->em->flush(); + // == ICON ================================================================================================================================================ + $finder = new Finder(); $finder->in('public/medias/icon/'); $finder->name('icon_*'); @@ -483,11 +502,108 @@ class InitCommand extends Command } $this->em->flush(); + // == PAGECATEGORY ======================================================================================================================================== + + $entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(1); + if (!$entityPagecategory) { + $entityPagecategory = new Pagecategory(); + $entityPagecategory->setId(1); + $entityPagecategory->setName('URL'); + $this->em->persist($entityPagecategory); + } + + $entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2); + if (!$entityPagecategory) { + $entityPagecategory = new Pagecategory(); + $entityPagecategory->setId(2); + $entityPagecategory->setName('Widget'); + $this->em->persist($entityPagecategory); + } + + $entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(3); + if (!$entityPagecategory) { + $entityPagecategory = new Pagecategory(); + $entityPagecategory->setId(3); + $entityPagecategory->setName('Editeur'); + $this->em->persist($entityPagecategory); + } + + // == WIDGET ============================================================================================================================================== + // Widget Page web + $entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-2000); + if (!$entityWidget) { + $entityWidget = new Widget(); + } + $entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_ribbon.png']); + $entityWidget->setId(-2000); + $entityWidget->setRoworder(0); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Page web'); + $entityWidget->setDescription("Affiche le contenu d'une page web"); + $entityWidget->setRouteview('app_admin_pagewidget_view_url'); + $entityWidget->setHeight('630'); + $entityWidget->setAutoajust(false); + $entityWidget->setBorder(true); + $entityWidget->setOpened(true); + $entityWidget->setViewheader(true); + $entityWidget->setAccess(['admin', 'all', 'group']); + $parameter = ['fields' => [['id' => 'url', 'loc' => 'col1', 'type' => 'string', 'label' => 'URL', 'value' => '', 'mandatory' => 'true']]]; + $entityWidget->setParameter($parameter); + $this->em->persist($entityWidget); + + // Widget Bureau + $entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1990); + if (!$entityWidget) { + $entityWidget = new Widget(); + } + $entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_computer.png']); + $entityWidget->setId(-1990); + $entityWidget->setRoworder(0); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Bureau'); + $entityWidget->setDescription('Affiche vos items de bureau'); + $entityWidget->setRouteview('app_admin_pagewidget_view_item'); + $entityWidget->setHeight('630'); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(false); + $entityWidget->setOpened(true); + $entityWidget->setViewheader(true); + $entityWidget->setAccess(['admin', 'all', 'group']); + $parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true'], ['id' => 'withbookmark', 'loc' => 'col1', 'type' => 'withbookmark', 'label' => 'Avec Favoris', 'value' => '0', 'mandatory' => 'true'], ['id' => 'itemcategory', 'loc' => 'col1', 'type' => 'itemcategory', 'label' => 'Catégorie Affichée', 'value' => '', 'mandatory' => 'false'], ['id' => 'search', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Zone de Recherche', 'value' => '0', 'mandatory' => 'true'], ['id' => 'menu', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Menu des Catégories', 'value' => '0', 'mandatory' => 'true'], ['id' => 'menuall', 'loc' => 'col4', 'type' => 'boolean', 'label' => 'Menu toutes les Catégories', 'value' => '1', 'mandatory' => 'true']]]; + $entityWidget->setParameter($parameter); + $this->em->persist($entityWidget); + + // Widget Annonce + $entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1980); + if (!$entityWidget) { + $entityWidget = new Widget(); + } + $entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_megaphone.png']); + $entityWidget->setId(-1980); + $entityWidget->setRoworder(0); + $entityWidget->setIcon($entityicon); + $entityWidget->setName('Annonces'); + $entityWidget->setDescription('Affiche vos annonces'); + $entityWidget->setRouteview('app_admin_pagewidget_view_alert'); + $entityWidget->setHeight('630'); + $entityWidget->setAutoajust(true); + $entityWidget->setBorder(false); + $entityWidget->setOpened(true); + $entityWidget->setViewheader(true); + $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); + + $this->em->flush(); + $output->writeln(''); return Command::SUCCESS; } + // == FUNCTIONS =========================================================================================================================================== + private function insertConfig($order, $category, $id, $title, $value, $default, $type, $visible, $changeable, $required, $grouped, $help) { $entity = $this->em->getRepository("App\Entity\Config")->find($id); diff --git a/src/Controller/BookmarkController.php b/src/Controller/BookmarkController.php new file mode 100644 index 0000000..14e495f --- /dev/null +++ b/src/Controller/BookmarkController.php @@ -0,0 +1,341 @@ +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); + 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'); + } + } + } + + // Création du formulaire + $form = $this->createForm(BookmarkType::class, $data, ['mode' => 'submit']); + + // Récupération des data du formulaire + $form->handleRequest($request); + + // Sur erreur + $this->getErrorForm(null, $form, $request, $data, 'submit'); + + // Sur validation + if ($form->get('submit')->isClicked() && $form->isValid()) { + $data = $form->getData(); + + // Bookmark widget ou desktop + if ('true' == $touser) { + $data->setUser($this->getUser()); + } else { + $data->setPagewidget($pagewidget); + } + + // Icon + $idicon = $form->get('idicon')->getData(); + $icon = $this->getDoctrine()->getRepository('CadolesPortalBundle: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); + } + } + } + } + + // Retour à la page + return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + } + + $icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]); + $iconsuser = null; + if ('user' == $access) { + $iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]); + } + + return $this->render($this->labelentity.':edit.html.twig', [ + 'useheader' => ('config' == $access), + 'usemenu' => false, + 'usesidebar' => ('config' == $access), + 'entity' => $data, + 'icons' => $icons, + 'iconsuser' => $iconsuser, + 'mode' => 'submit', + 'access' => $access, + 'idpage' => $idpage, + 'form' => $form->createView(), + 'usage' => $usage, + 'group' => $group, + ]); + } + + public function updateAction(Request $request, $idpage, $id, $access = 'config') + { + $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); + 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'); + } + } + } 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'); + } + } + } + + // Création du formulaire + $form = $this->createForm(BookmarkType::class, $data, [ + 'mode' => 'update', + 'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null), + ]); + + // Récupération des data du formulaire + $form->handleRequest($request); + + // Sur 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]); + $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); + } + } + } + } + + // Retour à la page + return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + } + + $icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]); + $iconsuser = null; + if ('user' == $access) { + $iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]); + } + + // Affichage du formulaire + return $this->render($this->labelentity.':edit.html.twig', [ + 'useheader' => ('config' == $access), + 'usemenu' => false, + 'usesidebar' => ('config' == $access), + 'entity' => $data, + 'icons' => $icons, + 'iconsuser' => $iconsuser, + 'mode' => 'update', + 'access' => $access, + 'idpage' => $idpage, + 'form' => $form->createView(), + 'usage' => $usage, + 'group' => $group, + ]); + } + + public function deleteAction(Request $request, $idpage, $id, $access = 'config') + { + $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); + 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'); + } + } 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'); + } + } + } + + // Supprimer la donnée + $em = $this->getDoctrine()->getManager(); + $em->remove($data); + $em->flush(); + + // Retour à la page + return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + } + + public function heart(Request $request, ManagerRegistry $em): Response + { + $output = []; + $iditem = $request->request->get('iditem'); + + // On s'assure que l'item existe + $item = $em->getRepository("App\Entity\Item")->find($iditem); + if (!$item) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // On s'assure que l'item n'existe pas déjà dans les bookmark de l'utilisateur + $user = $this->getUser(); + $bookmark = $em->getRepository($this->entity)->findOneBy(['user' => $user, 'item' => $item]); + if (!$bookmark) { + $bookmark = new Bookmark(); + $bookmark->setTitle($item->getTitle()); + $bookmark->setSubtitle($item->getSubtitle()); + $bookmark->setUrl($item->getUrl()); + $bookmark->setIcon($item->getIcon()); + $bookmark->setColor($item->getColor()); + $bookmark->setTarget($item->getTarget()); + $bookmark->setItem($item); + $bookmark->setUser($user); + + $em->getManager()->persist($bookmark); + $em->getManager()->flush(); + } + + $output = $bookmark->getId(); + + return new JsonResponse($output); + } + + 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/HomeController.php b/src/Controller/HomeController.php index d244598..513170c 100755 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -2,22 +2,21 @@ namespace App\Controller; +use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Doctrine\Persistence\ManagerRegistry; class HomeController extends AbstractController { - public function home(Request $request,ManagerRegistry $em) + public function home(Request $request, ManagerRegistry $em) { if ($request->getSession()->get('fgforceconnect') && !$this->getUser()) { return $this->redirectToRoute('app_login'); } - $em->getRepository("App\Entity\Item")->getUserItems($this->getUser(),$bookmarks,$items,$itemscategorys); - dump($items); - dump($itemscategorys); + $em->getRepository("App\Entity\Item")->getUserItems($this->getUser(), $bookmarks, $items, $itemscategorys); + return $this->render('Home/page.html.twig', [ 'useheader' => true, 'usemenu' => false, diff --git a/src/Controller/ItemController.php b/src/Controller/ItemController.php index f52939f..ecf31ca 100644 --- a/src/Controller/ItemController.php +++ b/src/Controller/ItemController.php @@ -59,7 +59,7 @@ class ItemController extends AbstractController $data = new Item(); // Création du formulaire - $form = $this->createForm(ItemType::class, $data, ['mode' => 'submit','access'=>$access]); + $form = $this->createForm(ItemType::class, $data, ['mode' => 'submit', 'access' => $access]); // Récupération des data du formulaire $form->handleRequest($request); @@ -102,7 +102,7 @@ class ItemController extends AbstractController } // Création du formulaire - $form = $this->createForm(ItemType::class, $data, ['mode' => 'update', 'access' => $access,'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null)]); + $form = $this->createForm(ItemType::class, $data, ['mode' => 'update', 'access' => $access, 'idicon' => ($data->getIcon() ? $data->getIcon()->getId() : null)]); // Récupération des data du formulaire $form->handleRequest($request); @@ -169,11 +169,13 @@ class ItemController extends AbstractController } $data->setRoworder($order); - $itemcategory=$em->getRepository("App\Entity\Itemcategory")->find($categoryid); - if($itemcategory) $data->setItemcategory($itemcategory); - + $itemcategory = $em->getRepository("App\Entity\Itemcategory")->find($categoryid); + if ($itemcategory) { + $data->setItemcategory($itemcategory); + } + $em->getManager()->flush(); - return new JsonResponse($output); - } + return new JsonResponse($output); + } } diff --git a/src/Controller/ItemcategoryController.php b/src/Controller/ItemcategoryController.php index 0e5e5ad..91342db 100644 --- a/src/Controller/ItemcategoryController.php +++ b/src/Controller/ItemcategoryController.php @@ -2,14 +2,13 @@ namespace App\Controller; -use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\JsonResponse; -use Doctrine\Persistence\ManagerRegistry; - use App\Entity\Itemcategory; use App\Form\ItemcategoryType; +use Doctrine\Persistence\ManagerRegistry; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; class ItemcategoryController extends AbstractController { @@ -60,34 +59,33 @@ class ItemcategoryController extends AbstractController if (!$data) { throw $this->createNotFoundException('Unable to find entity.'); } - + // Création du formulaire - $form = $this->createForm(ItemcategoryType::class,$data,array("mode"=>"update")); + $form = $this->createForm(ItemcategoryType::class, $data, ['mode' => 'update']); // Récupération des data du formulaire $form->handleRequest($request); - + // Sur validation if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); - + // Sauvegarde $em->getManager()->flush(); // Retour à la liste return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item')); } - - + // Affichage du formulaire return $this->render($this->twig.'edit.html.twig', [ - 'useheader' => true, - 'usemenu' => false, - 'usesidebar' => true, - 'access' => $access, - $this->data => $data, - 'mode' => 'update', - 'form' => $form->createView() + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + 'access' => $access, + $this->data => $data, + 'mode' => 'update', + 'form' => $form->createView(), ]); } @@ -108,7 +106,7 @@ class ItemcategoryController extends AbstractController return $this->redirectToRoute($this->route.'_update', ['id' => $id]); } - + return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item')); } @@ -126,6 +124,6 @@ class ItemcategoryController extends AbstractController $data->setRoworder($order); $em->getManager()->flush(); - return new JsonResponse($output); - } + return new JsonResponse($output); + } } diff --git a/src/Controller/PagetemplateController.php b/src/Controller/PagetemplateController.php new file mode 100644 index 0000000..ed8aab1 --- /dev/null +++ b/src/Controller/PagetemplateController.php @@ -0,0 +1,322 @@ +render($this->twig.'list.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + 'access' => $access, + ]); + } + + public function tablelist($access, Request $request, ManagerRegistry $em): Response + { + $query = $request->query->all(); + $start = $query['start']; + $length = $query['length']; + $search = $query['search']; + $draw = $query['draw']; + $ordercolumn = $query['order'][0]['column']; + $orderdir = $query['order'][0]['dir']; + + // Query de base + $qbase = $em->getManager()->createQueryBuilder()->from($this->entity, 'table'); + $qsearch = $em->getManager()->createQueryBuilder()->from($this->entity, 'table'); + + $qbase->where('table.user is null'); + $qbase->andWhere('table.parentfor is not null'); + $qsearch->where('table.user is null'); + $qsearch->andWhere('table.parentfor is not null'); + $qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value OR table.parentfor LIKE :value'); + $qsearch->setParameter('value', '%'.$search['value'].'%'); + + // Nombre total d'enregistrement + $total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult(); + + // Nombre d'enregistrement filtré + if ('' == $search['value']) { + $totalf = $total; + } else { + $totalf = $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult(); + } + + // Parcours des Enregistrement + if ('' == $search['value']) { + $qb = $qbase->select('table'); + } else { + $qb = $qsearch->select('table'); + } + + // Order + if ($ordercolumn) { + switch ($ordercolumn) { + case 1: + $qb->orderBy('table.roworder', $orderdir); + break; + case 2: + $qb->orderBy('table.name', $orderdir); + break; + case 3: + $qb->orderBy('table.parentfor', $orderdir); + break; + } + } + + // Execution de la requete d'affichage + $datas = $qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult(); + + // Construction du tableau de retour + $output = [ + 'draw' => $draw, + 'recordsFiltered' => $totalf, + 'recordsTotal' => $total, + 'data' => [], + ]; + foreach ($datas as $data) { + $route = str_replace('_admin_', '_'.$access.'_', $this->route); + $action = ''; + $action .= " $data->getId()])."'>"; + $action .= " $data->getId()])."'>"; + + array_push($output['data'], [ + $action, + $data->getRoworder(), + $data->getName(), + $data->getParentfor(), + ]); + } + + // Retour + return new Response(json_encode($output), 200); + } + + private function entityForm(Page $entity, $access, $em) + { + $route = str_replace('_admin_', '_'.$access.'_', $this->route); + + if ($em->getManager()->contains($entity)) { + return $this->createForm(PageUpdateWidgetType::class, $entity, [ + 'mode' => 'update', + 'access' => $access, + 'for' => $entity->getParentfor(), + ]); + } else { + return $this->createForm(PagetemplateSubmitType::class, $entity, [ + 'mode' => 'update', + 'access' => $access, + ]); + } + } + + public function submit($access, Request $request, ManagerRegistry $em): Response + { + $pagecategory = $em->getRepository("App\Entity\Pagecategory")->find(2); + $data = new Page(); + $data->setMaxwidth(0); + $data->setRoworder(0); + $data->setParentfor('user'); + $data->setPagecategory($pagecategory); + + $form = $this->entityForm($data, $access, $em); + $form->handleRequest($request); + + // Sur erreur + if ('app' == $data->getParentfor()) { + $tmp = $em->getRepository($this->entity)->findOneBy(['parentfor' => 'app']); + if ($tmp) { + $form->addError(new FormError("Il ne peut avoir qu'un seul template de type Application")); + } + } + + $data = $form->getData(); + + if ($form->get('submit')->isClicked() && $form->isValid()) { + // Sauvegarde + $em->getManager()->persist($data); + $em->getManager()->flush(); + + $route = str_replace('_admin_', '_'.$access.'_', $this->route); + + return $this->redirect($this->generateUrl($route.'_update', ['id' => $data->getId()])); + } + + return $this->render('Pagetemplate\submit.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + $this->data => $data, + 'mode' => 'submit', + 'access' => $access, + 'form' => $form->createView(), + ]); + } + + public function update($id, $access, Request $request, ManagerRegistry $em): Response + { + $data = $em->getRepository($this->entity)->find($id); + if (!$data) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // Création du formulaire + $form = $this->entityForm($data, $access, $em); + $form->handleRequest($request); + + if ($form->get('submit')->isClicked() && $form->isValid()) { + $em->getManager()->flush(); + $route = str_replace('_admin_', '_'.$access.'_', $this->route); + + return $this->redirect($this->generateUrl($route.'_view', ['id' => $id])); + } + + return $this->render('Page\updatewidget.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + $this->data => $data, + 'access' => $access, + 'mode' => 'updatetemplate', + 'form' => $form->createView(), + ]); + } + + public function delete($id, $access, Request $request, ManagerRegistry $em): Response + { + $data = $em->getRepository($this->entity)->find($id); + if (!$data) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // On s'assure que l'utilisateur à la permission de supprimer + if ('all' == $access) { + $em->getRepository($this->entity)->getPermission($this->getUser(), $data, $cansee, $canupdate); + if (!$canupdate) { + throw $this->createNotFoundException('Permission denied'); + } + } + + // Tentative de suppression + try { + $group = $em->getRepository("App\Entity\Group")->findOneBy(['pagetemplate' => $data]); + if ($group) { + throw new \Exception('Impossible de supprimer ce modèle, il est utilisé par au moins un groupe'); + } + + if ('app' == $data->getParentfor()) { + throw new \Exception('Vous ne pouvez pas supprimer un template de type Application'); + } + + $em->getManager()->remove($data); + $em->getManager()->flush(); + } catch (\Exception $e) { + $request->getSession()->getFlashBag()->add('error', $e->getMessage()); + + return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $id]); + } + + // Retour + return $this->redirect($this->generateUrl($this->route)); + } + + public function seleclist(Request $request) + { + // S'assurer que c'est un appel ajax + if (!$request->isXmlHttpRequest()) { + return new JsonResponse(['message' => 'Interdit'], 400); + } + + $output = []; + $em = $this->getDoctrine()->getManager(); + $page_limit = $request->query->get('page_limit'); + $q = $request->query->get('q'); + $usage = $request->query->get('usage'); + + $qb = $em->createQueryBuilder(); + $qb->select('table')->from('App:Page', 'table') + ->where('table.name LIKE :value') + ->andWhere('table.parentfor=:usage') + ->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()]); + } + + $response = new Response(json_encode($output)); + $response->headers->set('Content-Type', 'application/json'); + + return $response; + } + + public function view($id, $access, Request $request, ManagerRegistry $em): Response + { + $data = $em->getRepository($this->entity)->find($id); + if (!$data) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // Permissions + $canupdate = true; + + dump($em->getRepository("App\Entity\Widget")->getWidgetAccess($access)); + + return $this->render('Page\viewwidget.html.twig', [ + 'useheader' => true, + 'usemenu' => true, + 'usesidebar' => true, + $this->data => $data, + 'access' => $access, + 'canupdate' => $canupdate, + 'mode' => 'viewtemplate', + '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 new file mode 100644 index 0000000..0829c4f --- /dev/null +++ b/src/Controller/PagewidgetController.php @@ -0,0 +1,1799 @@ +searchArray($subarray, $key, $value)); + } + } + + return $results; + } + + private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access = 'config', $by = 'view') + { + if ($em->getManager()->contains($entity)) { + $widgettype = $em->getRepository('App\Entity\Pagewidget')->find($id)->getWidget(); + $params = $widgettype->getParameter(); + $values = $entity->getParameter(); + + foreach ($params['fields'] as $key => $param) { + $tmp = $this->searchArray($values, 'id', $param['id']); + if (is_array($tmp) && !empty($tmp)) { + $params['fields'][$key]['value'] = $tmp[0]['value']; + } else { + $params['fields'][$key]['value'] = $param['value']; + } + } + + return $this->createForm(PagewidgetType::class, $entity, [ + 'param' => $params, + 'mode' => 'update', + 'access' => $access, + 'idicon' => ($entity->getIcon() ? $entity->getIcon()->getId() : $widgettype->getIcon()->getId()), + 'method' => 'POST', + ]); + } else { + $widgettype = $em->getManager()->getRepository("App\Entity\Widget")->find($id); + $entity->setName($widgettype->getName()); + $entity->setHeight($widgettype->getHeight()); + $entity->setAutoajust($widgettype->isAutoajust()); + $entity->setBorder($widgettype->isBorder()); + $entity->setViewheader($widgettype->isViewheader()); + $entity->setColorheaderback($widgettype->getColorheaderback()); + $entity->setColorheaderfont($widgettype->getColorheaderfont()); + $entity->setColorbodyback($widgettype->getColorbodyback()); + $entity->setColorbodyfont($widgettype->getColorbodyfont()); + $entity->setIcon($widgettype->getIcon()); + + $param = $widgettype->getParameter(); + + return $this->createForm(PagewidgetType::class, $entity, [ + 'param' => $param, + 'mode' => ('view' == $by ? 'submit' : 'submittemplate'), + 'access' => $access, + 'idicon' => $widgettype->getIcon()->getId(), + 'method' => 'POST', + ]); + } + } + + public function submit($access, $idpage, $idwidgettype, Request $request, ManagerRegistry $em): Response + { + $by = $request->query->get('by'); + $entity = new Pagewidget(); + $form = $this->entityForm($em, $entity, $idpage, $idwidgettype, $access, $by); + $form->handleRequest($request); + + // On s'assure que la page où l'on souhaite insérer un widget est bien du bon type + $page = $em->getRepository("App\Entity\Page")->findoneby(['id' => $idpage]); + if (!$page) { + throw $this->createNotFoundException('Unable to find entity.'); + } + if (2 != $page->getPagecategory()->getId()) { + throw $this->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(); + $icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]); + $widgettype = $em->getRepository('App\Entity\Widget')->findoneby(['id' => $idwidgettype]); + + // Localisation par défaut en R1C1 + $entity->setLoc('R1C1'); + $entity->setRoworder('1'); + + // Rattachement icon / panel / widgettype + $entity->setIcon($icon); + $entity->setPage($page); + $entity->setWidget($widgettype); + + // Récupération des paramétres + $jsons = $widgettype->getParameter(); + $param = []; + $param['fields'] = []; + foreach ($jsons['fields'] as $field) { + $tmp = []; + $tmp['id'] = $field['id']; + $tmp['value'] = ('hidden' != $field['type'] ? $form->get($field['id'])->getData() : ''); + array_push($param['fields'], $tmp); + } + + $entity->setParameter($param); + + $em = $em->getManager(); + $em->persist($entity); + $em->flush(); + + // 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])); + } + } + + $icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]); + $iconsuser = null; + if ('all' == $access) { + $iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]); + } + + return $this->render($this->twig.'edit.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => ('config' == $access), + 'maxwidth' => ('user' == $access), + 'entity' => $entity, + 'icons' => $icons, + 'iconsuser' => $iconsuser, + 'mode' => ('view' == $by ? 'submit' : 'submittemplate'), + 'access' => $access, + 'idpage' => $idpage, + 'form' => $form->createView(), + ]); + } + + 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'); + + // Recherche du pagewidget + $entity = $em->getRepository($this->labelentity)->find($idwidget); + if (!$entity) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // On s'assure que l'utilisateur à la permission de modifier + if ('all' == $access) { + $em->getRepository('App\Entity\Page')->getPermission($this->getUser(), $entity->getPage(), $cansee, $canupdate, $canadd); + if (!$canupdate) { + throw $this->createNotFoundException('Permission denied'); + } + } + + // Création du formulaire + $form = $this->entityForm($em, $entity, $idpage, $idwidget, $access, $by); + $form->handleRequest($request); + + // Validation + if ($form->get('submit')->isClicked() && $form->isValid()) { + $idicon = $form->get('idicon')->getData(); + $icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]); + $entity->setIcon($icon); + + // Récupération des paramétres + $widgettype = $entity->getWidget(); + $jsons = $widgettype->getParameter(); + $param = []; + $param['fields'] = []; + foreach ($jsons['fields'] as $field) { + $tmp = []; + $tmp['id'] = $field['id']; + + $tmp['value'] = ('hidden' != $field['type'] ? $form->get($field['id'])->getData() : ''); + array_push($param['fields'], $tmp); + } + + $entity->setParameter($param); + + $em->getManager()->flush(); + + // Si widget RSS On supprime le potentiel cache de ce flux + if (-1880 == $entity->getWidget()->getId()) { + $dir = $this->container->getParameter('kernel.root_dir').'/../web/uploads/flux/'; + $mask = $dir.'widget-'.$entity->getId().'.*'; + array_map('unlink', glob($mask)); + } + + // Retour + if ('view' == $by) { + return $this->redirect($this->generateUrl('app_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group])); + } else { + return $this->redirect($this->generateUrl('app_'.$access.'_pagetemplate_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()]); + } + + 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'), + 'access' => $access, + 'idpage' => $idpage, + 'form' => $form->createView(), + 'usage' => $usage, + 'group' => $group, + ]); + } + + public function delete($access, $idwidget, Request $request, ManagerRegistry $em): Response + { + // Récupération des parametres + $output = []; + + // Recherche du pagetwidget + $entity = $em->getRepository($this->labelentity)->find($idwidget); + if (!$entity) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // On s'assure que l'utilisateur à la permission de supprimer + if ('all' == $access) { + $em->getRepository('App\Entity\Page')->getPermission($this->getUser(), $entity->getPage(), $cansee, $canupdate, $canadd); + if (!$canupdate) { + throw $this->createNotFoundException('Permission denied'); + } + } + + // Tentative de suppression + try { + $em->getManager()->remove($entity); + $em->getManager()->flush(); + } catch (\Exception $e) { + $request->getSession()->getFlashBag()->add('error', $e->getMessage()); + throw $this->createNotFoundException('Permission denied'); + } + + return new JsonResponse($output); + } + + public function order(Request $request) + { + // 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.'); + } + + $entity->setRoworder($order); + $entity->setLoc($idloc); + $em->persist($entity); + $em->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()); + } + } + } + + protected function setRequest($em, $request, $id, $access) + { + $this->em = $em; + $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'); + + // Le widget existe-t-il ? + $this->entity = $this->em->getRepository($this->labelentity)->find($this->id); + if (!$this->entity) { + throw $this->createNotFoundException('Unable to find entity.'); + } + + // Permissions + if ('admin' == $this->access) { + $this->canupdate = true; + } else { + // On s'assure que l'utilisateur à la permission de voir + $this->page = $this->entity->getPage(); + $this->em->getRepository('App\Entity\Page')->getPermission($this->user, $this->page, $this->cansee, $this->canupdate, $this->canadd); + if (!$this->cansee) { + throw $this->createNotFoundException('Permission denied'); + } + } + + // Affichage miniature ? + $this->mini = ('list' == $this->look && $this->entity->getId() != $this->selwidget); + + // Préference utilisateur + if (!$this->mini) { + $this->getPreference($this->entity); + } + } + + protected function getPreference(&$entity) + { + $user = $this->getUser(); + if ($user) { + $preference = $user->getPreference(); + $id = $entity->getId(); + + // Preference widgetshowhide + if ('list' == $this->look) { + $entity->setOpened(true); + $entity->setBorder(false); + } else { + if (is_array($preference)) { + if (array_key_exists('widgetshowhide', $preference)) { + if (array_key_exists($id, $preference['widgetshowhide'])) { + $entity->setOpened('true' == $preference['widgetshowhide'][$id]); + } + } + } + } + } + } + + protected function getKeyPreference(&$entity, $key, $value) + { + $user = $this->getUser(); + if (!$user) { + return $value; + } + + $preference = $user->getPreference(); + $id = $entity->getId(); + + if (!is_array($preference)) { + return $value; + } + + if (!array_key_exists($key, $preference)) { + return $value; + } + + if (!array_key_exists($id, $preference[$key])) { + return $value; + } + + return $preference[$key][$id]; + } + + protected function getRender($view, $params) + { + // Paramétres toujours présent dans un rendu de widget + $allways = [ + 'entity' => $this->entity, + 'canupdate' => $this->canupdate, + 'access' => $this->access, + 'look' => $this->look, + 'mini' => $this->mini, + ]; + + // Parametres spéficiques + $params = array_merge($allways, $params); + + // Rendu + return $this->render($this->twig.'\\'.$view, $params); + } + + public function viewurl($id, $access, Request $request) + { + // Récupération de la requete + $this->setRequest($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']; + } + } + + // Gestion des url youtuve + $url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url); + $url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url); + + // Detecter le type de lien + $pathinfo = pathinfo($url); + + // Type image + if (array_key_exists('extension', $pathinfo)) { + if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) { + $imagemedia = true; + } + } + // 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, + 'imagemedia' => $imagemedia, + ]); + } + + public function viewurlfixe(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($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; + } + } + + // Gestion des url youtuve + $url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url); + $url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url); + + // Detecter le type de lien + $pathinfo = pathinfo($url); + + // Type image + if (array_key_exists('extension', $pathinfo)) { + if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) { + $imagemedia = true; + } + } + + // Spécifique Deviant Art + if (false !== strpos($url, 'images-wixmp')) { + $imagemedia = true; + } + } + + return $this->getRender('viewurl.html.twig', [ + 'url' => $url, + 'imagemedia' => $imagemedia, + ]); + } + + public function viewitem($access, $id, Request $request, ManagerRegistry $em) + { + // Récupération de la requete + $this->setRequest($em, $request, $id, $access); + + // Valeur par défaut + $modedesktop = 0; + $menu = false; + $menuall = true; + $search = false; + $withbookmark = true; + $bookmarks = null; + $itemsordered = null; + $itemcategorys = null; + + // 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; + + case 'withbookmark': + $withbookmark = $parameter['value']; + break; + + case 'itemcategory': + $iditemcategory = $parameter['value']; + break; + + case 'search': + $search = (1 == $parameter['value']); + break; + + case 'menu': + $menu = (1 == $parameter['value']); + break; + + case 'menuall': + $menuall = (1 == $parameter['value']); + break; + } + } + + // Préference utilisateur + $modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop); + + // Profilage + $this->em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, $iditemcategory, $withbookmark, false); + } + + // Render + return $this->getRender('viewitem.html.twig', [ + 'canadd' => $this->user, + 'modedesktop' => $modedesktop, + 'search' => $search, + 'menu' => $menu, + 'menuall' => $menuall, + 'withbookmark' => $withbookmark, + 'bookmarks' => $bookmarks, + 'items' => $items, + 'itemcategorys' => $itemcategorys, + ]); + } + + public function viewitemessential(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($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; + } + } + + // 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); + } + + // Render + return $this->getRender('viewitemessential.html.twig', [ + 'canadd' => $this->user, + 'modedesktop' => $modedesktop, + 'items' => $itemsordered, + 'bookmarks' => $bookmarks, + ]); + } + + public function viewalert(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($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; + } + } + + // Profilage + $alertsordered = $this->em->getRepository('App:Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter, $this->get('session')->get('ssoitems')); + } + + // Render + return $this->getRender('viewalert.html.twig', [ + 'alerts' => $alertsordered, + ]); + } + + public function viewflux(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($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; + } + } + + // 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, + ]); + } + + 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; + } + } + + // 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, + 'feeds' => $feeds, + 'modelist' => $modelist, + ]); + } + + public function viewbookmark(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($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; + } + } + + // Bookmark du widget + $bookmarks = $this->em->getRepository('App:Bookmark')->findBy(['pagewidget' => $this->entity]); + } + + // Render + return $this->getRender('viewbookmark.html.twig', [ + 'canadd' => $this->canadd, + 'modedesktop' => $modedesktop, + 'bookmarks' => $bookmarks, + ]); + } + + public function viewlink(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $url = ''; + $target = '_blank'; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'url': + $url = $parameter['value']; + break; + case 'target': + $target = $parameter['value']; + break; + } + } + + // Render + return $this->getRender('viewlink.html.twig', [ + 'canadd' => false, + 'url' => $url, + 'target' => $target, + ]); + } + + public function vieweditor(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $html = ''; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'html': + $html = $parameter['value']; + break; + } + } + + // Render + return $this->getRender('vieweditor.html.twig', [ + 'canadd' => false, + 'html' => $html, + ]); + } + + public function viewslide(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $interval = '2'; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'interval': + $interval = $parameter['value']; + break; + } + } + + // Récupération des slides + $slides = $this->em->getRepository('App:Slide')->findBy(['pagewidget' => $this->entity], ['roworder' => 'ASC', 'title' => 'ASC']); + + // Render + return $this->getRender('viewslide.html.twig', [ + 'canadd' => $this->canadd, + 'slides' => $slides, + 'interval' => $interval, + ]); + } + + public function viewfile(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $view = 'small'; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'modelist': + $view = (0 == $parameter['value'] ? 'small' : 'list'); + break; + } + } + + // Render + return $this->getRender('viewfile.html.twig', [ + 'canadd' => $this->canadd, + 'directory' => 'widget-'.$id, + 'view' => $view, + ]); + } + + public function viewgalery(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + $directory = $this->get('kernel')->getRootDir().'/../uploads/file/widget-'.$id; + $files = []; + $fs = new Filesystem(); + + if ($fs->exists($directory)) { + $finder = new Finder(); + $finder->sortByName()->in($directory)->exclude('thumb')->exclude('thumbmini'); + + foreach ($finder as $file) { + $tmp = []; + $tmp['name'] = $file->getRelativePathname(); + $tmp['extension'] = $file->getExtension(); + $fileinfo = new file($file->getPathname()); + $tmp['minetype'] = $fileinfo->getMimeType(); + $tmp['minefamily'] = explode('/', $tmp['minetype'])[0]; + + $tmp['thumb'] = ''; + if ($fs->exists($directory.'/thumb/'.$tmp['name'])) { + $data = file_get_contents($directory.'/thumb/'.$tmp['name']); + $tmp['thumb'] = 'data:image/'.$tmp['extension'].';base64,'.base64_encode($data); + } + + array_push($files, $tmp); + } + } + + // Render + return $this->getRender('viewgalery.html.twig', [ + 'canadd' => $this->canadd, + 'files' => $files, + ]); + } + + public function viewcalendar(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $nbday = '0'; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'nbday': + $nbday = $parameter['value']; + break; + } + } + + // Récupérer les events de l'utilisateur + $user = $this->getUser(); + $events = $this->em->getRepository('App:Calendarevent')->getUserCalendarevents($user, $this->get('session')->get('color')['main'], $this->usage, $this->group, $firstcalendar); + + // Render + return $this->getRender('viewcalendar.html.twig', [ + 'canadd' => $this->canadd, + 'events' => $events, + 'nbday' => $nbday, + 'firstcalendar' => $firstcalendar, + 'usage' => $this->usage, + ]); + } + + public function viewblog(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $nbarticle = 10; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'nbarticle': + $nbarticle = $parameter['value']; + break; + } + } + + // On récupère soit les blogs du group en cours soit l'ensemble des blogs de l'utilisateur + if ('group' == $this->usage) { + $blogs = $this->em->getRepository('App:Blog')->getBlogsGroup($this->getUser(), $this->group); + if ($blogs) { + $firstblog = $blogs[0]->getId(); + } + } else { + $this->em->getRepository('App:Blog')->getBlogsUser($this->getUser(), $blogsuser, $blogsadmin, $blogsshared); + $blogs = array_merge($blogsuser, $blogsadmin->toArray(), $blogsshared); + $firstblog = 'all'; + } + + // On récupère les nbarticle de ses blogs + $this->em->getRepository('App:Blogarticle')->getBlogsArticles($blogs, 0, $nbarticle, $count, $blogarticles); + + // Render + return $this->getRender('viewblog.html.twig', [ + 'canadd' => $this->canadd, + 'blogarticles' => $blogarticles, + 'nbarticle' => $nbarticle, + 'firstblog' => $firstblog, + 'usage' => $this->usage, + ]); + } + + public function viewproject(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Parametres + $nbarticle = 10; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'nbarticle': + $nbarticle = $parameter['value']; + break; + } + } + + // On récupère soit les projects du group en cours soit l'ensemble des projects de l'utilisateur + $user = $this->getUser(); + if ('group' == $this->usage) { + $projects = $this->em->getRepository('App:Project')->getProjectsGroup($this->getUser(), $this->group); + if ($projects) { + $firstproject = $projects[0]->getId(); + } + } else { + $this->em->getRepository('App:Project')->getProjectsUser($user, $projectsuser, $projectsadmin, $projectsshared); + $projects = array_merge($projectsuser, $projectsadmin->toArray(), $projectsshared); + $firstproject = 'all'; + } + + // On récupère les nbarticle de ses projects + $this->em->getRepository('App:Projecttask')->getProjectsTasks($projects, 0, $nbarticle, $count, $projecttasks); + + foreach ($projecttasks as $key => $projecttask) { + if (100 == $projecttask->getPercentage()) { + unset($projecttasks[$key]); + } + } + + if ('group' != $this->usage) { + foreach ($projecttasks as $key => $projecttask) { + if (!$user) { + unset($projecttasks[$key]); + } else { + if ($projecttask->getUser() && $projecttask->getUser() != $user) { + unset($projecttasks[$key]); + } elseif (!$projecttask->getUser() && $projecttask->getOwner() && $projecttask->getOwner() != $user) { + unset($projecttasks[$key]); + } + } + } + } + + // Render + return $this->getRender('viewproject.html.twig', [ + 'canadd' => $this->canupdate, + 'projecttasks' => $projecttasks, + 'nbarticle' => $nbarticle, + 'firstproject' => $firstproject, + 'usage' => $this->usage, + ]); + } + + 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); + + $group = $this->group; + if ('group' != $this->usage || !$group) { + $group = $this->em->getRepository('App:Group')->findOneBy(['fgall' => true])->getId(); + } + + // Render + return $this->getRender('viewchat.html.twig', [ + 'canadd' => $this->canupdate, + 'onheader' => false, + 'tool' => 'app_websocket_chat', + 'usage' => $this->usage, + 'group' => $group, + ]); + } + + public function viewgroup(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + $user = $this->getUser(); + $mygroups = []; + $this->getDoctrine()->getRepository('App\Entity\Page')->getPagesUser($user, null, $default, $pagesuser, $pagesadmin, $groupsshared); + if (is_array($groupsshared)) { + foreach ($groupsshared as $groupshared) { + $title = $groupshared->getLabel(); + $idpage = $groupshared->pagesshared[0]->getId(); + $color = $groupshared->getColor(); + $icon = null; + if ($groupshared->getIcon()) { + $icon = '/'.$groupshared->getIcon()->getLabel(); + } + + array_push($mygroups, ['title' => $title, 'icon' => $icon, 'id' => $idpage, 'color' => $color]); + } + } + + // Render + return $this->getRender('viewgroup.html.twig', [ + 'canadd' => $user, + 'usage' => $this->usage, + 'groups' => $mygroups, + ]); + } + + public function viewgroupmessage(Request $request, $id, $access = 'config') + { + // Récupération de la requete + $this->setRequest($request, $id, $access); + + // Récupération des paramétres du widget + $modelist = 1; + $nbarticle = 5; + foreach ($this->entity->getParameter()['fields'] as $parameter) { + switch ($parameter['id']) { + case 'modelist': + $modelist = $parameter['value']; + break; + case 'nbarticle': + $nbarticle = $parameter['value']; + break; + } + } + + $mymsg = []; + $user = $this->getUser(); + $this->getDoctrine()->getRepository('App\Entity\Page')->getPagesUser($user, null, $default, $pagesuser, $pagesadmin, $groupsshared); + if (is_array($groupsshared)) { + foreach ($groupsshared as $groupshared) { + // On récupère les info du groupe + $title = $groupshared->getLabel(); + $idpage = $groupshared->pagesshared[0]->getId(); + $color = $groupshared->getColor(); + + // On récupère l'ensemble des messages du groupes + $messages = $this->getDoctrine()->getRepository('CadolesWebsocketBundle:Message')->findBy(['group' => $groupshared]); + foreach ($messages as $key => $message) { + // persistante collection à revoir + if ($message->getSees()->count() > 0) { + if ($message->getSees()->contains($user)) { + unset($messages[$key]); + } + } + } + + foreach ($messages as $key => $message) { + $tmp = ['id' => $message->getId(), 'user' => $message->getUser(), 'date' => $message->getSubmitdate(), 'topic' => $message->getTopic(), 'pageid' => $idpage, 'pagetitle' => $title, 'color' => $color]; + array_push($mymsg, $tmp); + } + } + + $ord = []; + foreach ($mymsg as $key => $value) { + $ord[] = $value['date']; + } + array_multisort($ord, SORT_DESC, $mymsg); + } + + // Render + return $this->getRender('viewgroupmessage.html.twig', [ + 'canadd' => $user, + 'usage' => $this->usage, + 'modelist' => $modelist, + 'messages' => $mymsg, + '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/Group.php b/src/Entity/Group.php index f2d2460..16d1266 100755 --- a/src/Entity/Group.php +++ b/src/Entity/Group.php @@ -80,6 +80,11 @@ class Group */ private $owner; + /** + * @ORM\ManyToOne(targetEntity="Page", inversedBy="templategroups") + */ + private $pagetemplate; + /** * @var ArrayCollection * @var UserGroup @@ -322,4 +327,16 @@ class Group return $this; } + + public function getPagetemplate(): ?Page + { + return $this->pagetemplate; + } + + public function setPagetemplate(?Page $pagetemplate): self + { + $this->pagetemplate = $pagetemplate; + + return $this; + } } diff --git a/src/Entity/Pagewidget.php b/src/Entity/Pagewidget.php index a55b170..e0cb6df 100755 --- a/src/Entity/Pagewidget.php +++ b/src/Entity/Pagewidget.php @@ -3,6 +3,7 @@ namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** @@ -71,6 +72,13 @@ class Pagewidget */ protected $opened; + /** + * @var bool + * + * @ORM\Column(name="viewheader", type="boolean", options={"default":true}) + */ + protected $viewheader; + /** * @var string * @@ -138,6 +146,12 @@ class Pagewidget */ private $slides; + public function __construct() + { + $this->bookmarks = new ArrayCollection(); + $this->slides = new ArrayCollection(); + } + // A garder pour forcer l'id en init public function setId($id) { @@ -146,457 +160,260 @@ class Pagewidget return $this; } - /** - * Constructor. - */ - public function __construct() - { - $this->bookmarks = new \Doctrine\Common\Collections\ArrayCollection(); - $this->slides = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } - /** - * Set name. - * - * @param string $name - * - * @return Pagewidget - */ - public function setName($name) + public function getName(): ?string + { + return $this->name; + } + + public function setName(string $name): self { $this->name = $name; return $this; } - /** - * Get name. - * - * @return string - */ - public function getName() + public function getLoc(): ?string { - return $this->name; + return $this->loc; } - /** - * Set loc. - * - * @param string $loc - * - * @return Pagewidget - */ - public function setLoc($loc) + public function setLoc(string $loc): self { $this->loc = $loc; return $this; } - /** - * Get loc. - * - * @return string - */ - public function getLoc() + public function getRoworder(): ?int { - return $this->loc; + return $this->roworder; } - /** - * Set roworder. - * - * @param int $roworder - * - * @return Pagewidget - */ - public function setRoworder($roworder) + public function setRoworder(int $roworder): self { $this->roworder = $roworder; return $this; } - /** - * Get roworder. - * - * @return int - */ - public function getRoworder() - { - return $this->roworder; - } - - /** - * Set height. - * - * @param int $height - * - * @return Pagewidget - */ - public function setHeight($height) - { - $this->height = $height; - - return $this; - } - - /** - * Get height. - * - * @return int - */ - public function getHeight() + public function getHeight(): ?int { return $this->height; } - /** - * Set autoajust. - * - * @param bool $autoajust - * - * @return Pagewidget - */ - public function setAutoajust($autoajust) + public function setHeight(int $height): self { - $this->autoajust = $autoajust; + $this->height = $height; return $this; } - /** - * Get autoajust. - * - * @return bool - */ - public function getAutoajust() - { - return $this->autoajust; - } - - /** - * Set border. - * - * @param bool $border - * - * @return Pagewidget - */ - public function setBorder($border) - { - $this->border = $border; - - return $this; - } - - /** - * Get border. - * - * @return bool - */ - public function getBorder() - { - return $this->border; - } - - /** - * Set opened. - * - * @param bool $opened - * - * @return Pagewidget - */ - public function setOpened($opened) - { - $this->opened = $opened; - - return $this; - } - - /** - * Get opened. - * - * @return bool - */ - public function getOpened() - { - return $this->opened; - } - - /** - * Set colorheaderback. - * - * @param string $colorheaderback - * - * @return Pagewidget - */ - public function setColorheaderback($colorheaderback) - { - $this->colorheaderback = $colorheaderback; - - return $this; - } - - /** - * Get colorheaderback. - * - * @return string - */ - public function getColorheaderback() - { - return $this->colorheaderback; - } - - /** - * Set colorheaderfont. - * - * @param string $colorheaderfont - * - * @return Pagewidget - */ - public function setColorheaderfont($colorheaderfont) - { - $this->colorheaderfont = $colorheaderfont; - - return $this; - } - - /** - * Get colorheaderfont. - * - * @return string - */ - public function getColorheaderfont() - { - return $this->colorheaderfont; - } - - /** - * Set colorbodyback. - * - * @param string $colorbodyback - * - * @return Pagewidget - */ - public function setColorbodyback($colorbodyback) - { - $this->colorbodyback = $colorbodyback; - - return $this; - } - - /** - * Get colorbodyback. - * - * @return string - */ - public function getColorbodyback() - { - return $this->colorbodyback; - } - - /** - * Set colorbodyfont. - * - * @param string $colorbodyfont - * - * @return Pagewidget - */ - public function setColorbodyfont($colorbodyfont) - { - $this->colorbodyfont = $colorbodyfont; - - return $this; - } - - /** - * Get colorbodyfont. - * - * @return string - */ - public function getColorbodyfont() - { - return $this->colorbodyfont; - } - - /** - * Set parameter. - * - * @param array $parameter - * - * @return Pagewidget - */ - public function setParameter($parameter) - { - $this->parameter = $parameter; - - return $this; - } - - /** - * Get parameter. - * - * @return array - */ - public function getParameter() - { - return $this->parameter; - } - - /** - * Set page. - * - * @param Page $page - * - * @return Pagewidget - */ - public function setPage(Page $page = null) - { - $this->page = $page; - - return $this; - } - - /** - * Get page. - * - * @return Page - */ - public function getPage() - { - return $this->page; - } - - /** - * Set widget. - * - * @param Widget $widget - * - * @return Pagewidget - */ - public function setWidget(Widget $widget = null) - { - $this->widget = $widget; - - return $this; - } - - /** - * Get widget. - * - * @return Widget - */ - public function getWidget() - { - return $this->widget; - } - - /** - * Set icon. - * - * @param Icon $icon - * - * @return Pagewidget - */ - public function setIcon(Icon $icon = null) - { - $this->icon = $icon; - - return $this; - } - - /** - * Get icon. - * - * @return Icon - */ - public function getIcon() - { - return $this->icon; - } - - /** - * Add bookmark. - * - * @return Pagewidget - */ - public function addBookmark(Bookmark $bookmark) - { - $this->bookmarks[] = $bookmark; - - return $this; - } - - /** - * Remove bookmark. - */ - public function removeBookmark(Bookmark $bookmark) - { - $this->bookmarks->removeElement($bookmark); - } - - /** - * Get bookmarks. - * - * @return \Doctrine\Common\Collections\Collection - */ - public function getBookmarks() - { - return $this->bookmarks; - } - - /** - * Add slide. - * - * @return Pagewidget - */ - public function addSlide(Slide $slide) - { - $this->slides[] = $slide; - - return $this; - } - - /** - * Remove slide. - */ - public function removeSlide(Slide $slide) - { - $this->slides->removeElement($slide); - } - - /** - * Get slides. - * - * @return \Doctrine\Common\Collections\Collection - */ - public function getSlides() - { - return $this->slides; - } - public function isAutoajust(): ?bool { return $this->autoajust; } + public function setAutoajust(bool $autoajust): self + { + $this->autoajust = $autoajust; + + return $this; + } + public function isBorder(): ?bool { return $this->border; } + public function setBorder(bool $border): self + { + $this->border = $border; + + return $this; + } + public function isOpened(): ?bool { return $this->opened; } + + public function setOpened(bool $opened): self + { + $this->opened = $opened; + + return $this; + } + + public function isViewheader(): ?bool + { + return $this->viewheader; + } + + public function setViewheader(bool $viewheader): self + { + $this->viewheader = $viewheader; + + return $this; + } + + public function getColorheaderback(): ?string + { + return $this->colorheaderback; + } + + public function setColorheaderback(?string $colorheaderback): self + { + $this->colorheaderback = $colorheaderback; + + return $this; + } + + public function getColorheaderfont(): ?string + { + return $this->colorheaderfont; + } + + public function setColorheaderfont(?string $colorheaderfont): self + { + $this->colorheaderfont = $colorheaderfont; + + return $this; + } + + public function getColorbodyback(): ?string + { + return $this->colorbodyback; + } + + public function setColorbodyback(?string $colorbodyback): self + { + $this->colorbodyback = $colorbodyback; + + return $this; + } + + public function getColorbodyfont(): ?string + { + return $this->colorbodyfont; + } + + public function setColorbodyfont(?string $colorbodyfont): self + { + $this->colorbodyfont = $colorbodyfont; + + return $this; + } + + public function getParameter(): array + { + return $this->parameter; + } + + public function setParameter(?array $parameter): self + { + $this->parameter = $parameter; + + return $this; + } + + public function getPage(): ?Page + { + return $this->page; + } + + public function setPage(?Page $page): self + { + $this->page = $page; + + return $this; + } + + public function getWidget(): ?Widget + { + return $this->widget; + } + + public function setWidget(?Widget $widget): self + { + $this->widget = $widget; + + return $this; + } + + public function getIcon(): ?Icon + { + return $this->icon; + } + + public function setIcon(?Icon $icon): self + { + $this->icon = $icon; + + return $this; + } + + /** + * @return Collection + */ + public function getBookmarks(): Collection + { + return $this->bookmarks; + } + + public function addBookmark(Bookmark $bookmark): self + { + if (!$this->bookmarks->contains($bookmark)) { + $this->bookmarks->add($bookmark); + $bookmark->setPagewidget($this); + } + + return $this; + } + + public function removeBookmark(Bookmark $bookmark): self + { + if ($this->bookmarks->removeElement($bookmark)) { + // set the owning side to null (unless already changed) + if ($bookmark->getPagewidget() === $this) { + $bookmark->setPagewidget(null); + } + } + + return $this; + } + + /** + * @return Collection + */ + public function getSlides(): Collection + { + return $this->slides; + } + + public function addSlide(Slide $slide): self + { + if (!$this->slides->contains($slide)) { + $this->slides->add($slide); + $slide->setPagewidget($this); + } + + return $this; + } + + public function removeSlide(Slide $slide): self + { + if ($this->slides->removeElement($slide)) { + // set the owning side to null (unless already changed) + if ($slide->getPagewidget() === $this) { + $slide->setPagewidget(null); + } + } + + return $this; + } } diff --git a/src/Entity/Widget.php b/src/Entity/Widget.php index cc5c82a..de1f2d5 100755 --- a/src/Entity/Widget.php +++ b/src/Entity/Widget.php @@ -3,6 +3,7 @@ namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; /** @@ -79,6 +80,13 @@ class Widget */ protected $opened; + /** + * @var bool + * + * @ORM\Column(name="viewheader", type="boolean", options={"default":true}) + */ + protected $viewheader; + /** * @var string * @@ -135,6 +143,11 @@ class Widget */ private $pagewidgets; + public function __construct() + { + $this->pagewidgets = new ArrayCollection(); + } + // A garder pour forcer l'id en init public function setId($id) { @@ -143,426 +156,230 @@ class Widget return $this; } - /** - * Constructor. - */ - public function __construct() - { - $this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection(); - } - - /** - * Get id. - * - * @return int - */ - public function getId() + public function getId(): ?int { return $this->id; } - /** - * Set roworder. - * - * @param int $roworder - * - * @return Widget - */ - public function setRoworder($roworder) + public function getRoworder(): ?int + { + return $this->roworder; + } + + public function setRoworder(int $roworder): self { $this->roworder = $roworder; return $this; } - /** - * Get roworder. - * - * @return int - */ - public function getRoworder() + public function getName(): ?string { - return $this->roworder; + return $this->name; } - /** - * Set name. - * - * @param string $name - * - * @return Widget - */ - public function setName($name) + public function setName(string $name): self { $this->name = $name; return $this; } - /** - * Get name. - * - * @return string - */ - public function getName() + public function getDescription(): ?string { - return $this->name; + return $this->description; } - /** - * Set description. - * - * @param string $description - * - * @return Widget - */ - public function setDescription($description) + public function setDescription(?string $description): self { $this->description = $description; return $this; } - /** - * Get description. - * - * @return string - */ - public function getDescription() + public function getRouteview(): ?string { - return $this->description; + return $this->routeview; } - /** - * Set routeview. - * - * @param string $routeview - * - * @return Widget - */ - public function setRouteview($routeview) + public function setRouteview(string $routeview): self { $this->routeview = $routeview; return $this; } - /** - * Get routeview. - * - * @return string - */ - public function getRouteview() - { - return $this->routeview; - } - - /** - * Set height. - * - * @param int $height - * - * @return Widget - */ - public function setHeight($height) - { - $this->height = $height; - - return $this; - } - - /** - * Get height. - * - * @return int - */ - public function getHeight() + public function getHeight(): ?int { return $this->height; } - /** - * Set autoajust. - * - * @param bool $autoajust - * - * @return Widget - */ - public function setAutoajust($autoajust) + public function setHeight(int $height): self { - $this->autoajust = $autoajust; + $this->height = $height; return $this; } - /** - * Get autoajust. - * - * @return bool - */ - public function getAutoajust() - { - return $this->autoajust; - } - - /** - * Set border. - * - * @param bool $border - * - * @return Widget - */ - public function setBorder($border) - { - $this->border = $border; - - return $this; - } - - /** - * Get border. - * - * @return bool - */ - public function getBorder() - { - return $this->border; - } - - /** - * Set opened. - * - * @param bool $opened - * - * @return Widget - */ - public function setOpened($opened) - { - $this->opened = $opened; - - return $this; - } - - /** - * Get opened. - * - * @return bool - */ - public function getOpened() - { - return $this->opened; - } - - /** - * Set colorheaderback. - * - * @param string $colorheaderback - * - * @return Widget - */ - public function setColorheaderback($colorheaderback) - { - $this->colorheaderback = $colorheaderback; - - return $this; - } - - /** - * Get colorheaderback. - * - * @return string - */ - public function getColorheaderback() - { - return $this->colorheaderback; - } - - /** - * Set colorheaderfont. - * - * @param string $colorheaderfont - * - * @return Widget - */ - public function setColorheaderfont($colorheaderfont) - { - $this->colorheaderfont = $colorheaderfont; - - return $this; - } - - /** - * Get colorheaderfont. - * - * @return string - */ - public function getColorheaderfont() - { - return $this->colorheaderfont; - } - - /** - * Set colorbodyback. - * - * @param string $colorbodyback - * - * @return Widget - */ - public function setColorbodyback($colorbodyback) - { - $this->colorbodyback = $colorbodyback; - - return $this; - } - - /** - * Get colorbodyback. - * - * @return string - */ - public function getColorbodyback() - { - return $this->colorbodyback; - } - - /** - * Set colorbodyfont. - * - * @param string $colorbodyfont - * - * @return Widget - */ - public function setColorbodyfont($colorbodyfont) - { - $this->colorbodyfont = $colorbodyfont; - - return $this; - } - - /** - * Get colorbodyfont. - * - * @return string - */ - public function getColorbodyfont() - { - return $this->colorbodyfont; - } - - /** - * Set access. - * - * @param string $access - * - * @return Widget - */ - public function setAccess($access) - { - $this->access = $access; - - return $this; - } - - /** - * Get access. - * - * @return string - */ - public function getAccess() - { - return $this->access; - } - - /** - * Set parameter. - * - * @param array $parameter - * - * @return Widget - */ - public function setParameter($parameter) - { - $this->parameter = $parameter; - - return $this; - } - - /** - * Get parameter. - * - * @return array - */ - public function getParameter() - { - return $this->parameter; - } - - /** - * Set icon. - * - * @param Icon $icon - * - * @return Widget - */ - public function setIcon(Icon $icon = null) - { - $this->icon = $icon; - - return $this; - } - - /** - * Get icon. - * - * @return Icon - */ - public function getIcon() - { - return $this->icon; - } - - /** - * Add pagewidget. - * - * @return Widget - */ - public function addPagewidget(Pagewidget $pagewidget) - { - $this->pagewidgets[] = $pagewidget; - - return $this; - } - - /** - * Remove pagewidget. - */ - public function removePagewidget(Pagewidget $pagewidget) - { - $this->pagewidgets->removeElement($pagewidget); - } - - /** - * Get pagewidgets. - * - * @return \Doctrine\Common\Collections\Collection - */ - public function getPagewidgets() - { - return $this->pagewidgets; - } - public function isAutoajust(): ?bool { return $this->autoajust; } + public function setAutoajust(bool $autoajust): self + { + $this->autoajust = $autoajust; + + return $this; + } + public function isBorder(): ?bool { return $this->border; } + public function setBorder(bool $border): self + { + $this->border = $border; + + return $this; + } + public function isOpened(): ?bool { return $this->opened; } + + public function setOpened(bool $opened): self + { + $this->opened = $opened; + + return $this; + } + + public function isViewheader(): ?bool + { + return $this->viewheader; + } + + public function setViewheader(bool $viewheader): self + { + $this->viewheader = $viewheader; + + return $this; + } + + public function getColorheaderback(): ?string + { + return $this->colorheaderback; + } + + public function setColorheaderback(?string $colorheaderback): self + { + $this->colorheaderback = $colorheaderback; + + return $this; + } + + public function getColorheaderfont(): ?string + { + return $this->colorheaderfont; + } + + public function setColorheaderfont(?string $colorheaderfont): self + { + $this->colorheaderfont = $colorheaderfont; + + return $this; + } + + public function getColorbodyback(): ?string + { + return $this->colorbodyback; + } + + public function setColorbodyback(?string $colorbodyback): self + { + $this->colorbodyback = $colorbodyback; + + return $this; + } + + public function getColorbodyfont(): ?string + { + return $this->colorbodyfont; + } + + public function setColorbodyfont(?string $colorbodyfont): self + { + $this->colorbodyfont = $colorbodyfont; + + return $this; + } + + public function getAccess(): array + { + return $this->access; + } + + public function setAccess(?array $access): self + { + $this->access = $access; + + return $this; + } + + public function getParameter(): array + { + return $this->parameter; + } + + public function setParameter(?array $parameter): self + { + $this->parameter = $parameter; + + return $this; + } + + public function getIcon(): ?Icon + { + return $this->icon; + } + + public function setIcon(?Icon $icon): self + { + $this->icon = $icon; + + return $this; + } + + /** + * @return Collection + */ + public function getPagewidgets(): Collection + { + return $this->pagewidgets; + } + + public function addPagewidget(Pagewidget $pagewidget): self + { + if (!$this->pagewidgets->contains($pagewidget)) { + $this->pagewidgets->add($pagewidget); + $pagewidget->setWidget($this); + } + + return $this; + } + + public function removePagewidget(Pagewidget $pagewidget): self + { + if ($this->pagewidgets->removeElement($pagewidget)) { + // set the owning side to null (unless already changed) + if ($pagewidget->getWidget() === $this) { + $pagewidget->setWidget(null); + } + } + + return $this; + } } diff --git a/src/Form/ItemType.php b/src/Form/ItemType.php index 7aed9f4..48a5ec9 100644 --- a/src/Form/ItemType.php +++ b/src/Form/ItemType.php @@ -2,125 +2,125 @@ namespace App\Form; -use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; -use Symfony\Component\Form\Extension\Core\Type\CheckboxType; -use Symfony\Component\Form\Extension\Core\Type\TextType; -use Symfony\Component\Form\Extension\Core\Type\TextareaType; -use Symfony\Component\Form\Extension\Core\Type\HiddenType; -use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType; use FOS\CKEditorBundle\Form\Type\CKEditorType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\CheckboxType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\HiddenType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\Form\Extension\Core\Type\TextType; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType; class ItemType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add("submit", SubmitType::class, [ - "label" => ($options["mode"]=="delete"?"Confirmer la Suppression":"Valider"), - "attr" => ($options["mode"]=="delete"?array("class" => "btn btn-danger"):array("class" => "btn btn-success")) + ->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" => ($options["mode"]=="delete"?true:false), + ->add('title', TextType::class, [ + 'label' => 'Titre', + 'disabled' => ('delete' == $options['mode'] ? true : false), ]) - ->add("subtitle", TextareaType::class, [ - "label" => 'Sous Titre', - "required" => false, - "disabled" => ($options["mode"]=="delete"?true:false), - "attr" => array("rows" => '4') - ]) - - ->add("content",CKEditorType::class,[ - "config_name" => 'full_config', - "label" => 'Description', - "required" => false, - "disabled" => ($options["mode"]=="delete"?true:false), - "config" => array("height" => "500px",'filebrowserUploadRoute' => 'app_ckeditor_upload') + ->add('subtitle', TextareaType::class, [ + 'label' => 'Sous Titre', + 'required' => false, + 'disabled' => ('delete' == $options['mode'] ? true : false), + 'attr' => ['rows' => '4'], ]) - ->add("itemcategory", EntityType::class, [ - "label" => 'Catégorie', - "class" => 'App\Entity\Itemcategory', - "choice_label" => 'label', - "placeholder" => '-- Sélectionnez une Catégorie --', - "disabled" => ($options["mode"]=="delete"?true:false), + ->add('content', CKEditorType::class, [ + 'config_name' => 'full_config', + 'label' => 'Description', + 'required' => false, + 'disabled' => ('delete' == $options['mode'] ? true : false), + 'config' => ['height' => '500px', 'filebrowserUploadRoute' => 'app_ckeditor_upload'], + ]) + + ->add('itemcategory', EntityType::class, [ + 'label' => 'Catégorie', + 'class' => 'App\Entity\Itemcategory', + 'choice_label' => 'label', + 'placeholder' => '-- Sélectionnez une Catégorie --', + 'disabled' => ('delete' == $options['mode'] ? true : false), ]) ->add('roles', ChoiceType::class, [ - "label" => 'Visible pour les Rôles', - "choices" => [ - "Visiteur" => 'ROLE_ANONYME', - "Utilisateur" => 'ROLE_USER', - "Animateur de Groupe" => 'ROLE_ANIM', - "Modérateur" => 'ROLE_MODO', - "Administateur" => 'ROLE_ADMIN', - ], - "multiple" => true, - "expanded" => true, - "disabled" => ($options["mode"]=="delete"?true:false), + 'label' => 'Visible pour les Rôles', + 'choices' => [ + 'Visiteur' => 'ROLE_ANONYME', + 'Utilisateur' => 'ROLE_USER', + 'Animateur de Groupe' => 'ROLE_ANIM', + 'Modérateur' => 'ROLE_MODO', + 'Administateur' => 'ROLE_ADMIN', + ], + 'multiple' => true, + 'expanded' => true, + 'disabled' => ('delete' == $options['mode'] ? true : false), ]) ->add('groups', Select2EntityType::class, [ - 'label' => 'Visible pour les Groupes', - 'class' => 'App\Entity\Group', - 'text_property' => 'label', - 'multiple' => true, - 'remote_route' => 'app_'.$options['access'].'_group_selectlist', - 'primary_key' => 'id', - 'text_property' => 'label', - 'minimum_input_length' => 0, - 'page_limit' => 100, - 'allow_clear' => true, - 'delay' => 250, - 'cache' => false, - 'cache_timeout' => 60000, - 'language' => 'fr', - 'placeholder' => 'Selectionner des groupes', + 'label' => 'Visible pour les Groupes', + 'class' => 'App\Entity\Group', + 'text_property' => 'label', + 'multiple' => true, + 'remote_route' => 'app_'.$options['access'].'_group_selectlist', + 'primary_key' => 'id', + 'text_property' => 'label', + 'minimum_input_length' => 0, + 'page_limit' => 100, + 'allow_clear' => true, + 'delay' => 250, + 'cache' => false, + 'cache_timeout' => 60000, + 'language' => 'fr', + 'placeholder' => 'Selectionner des groupes', ]) ->add('color', TextType::class, [ - 'label' => "Couleur", - 'required' => false, - 'attr' => array("class" => "pick-a-color") - ]) + 'label' => 'Couleur', + 'required' => false, + 'attr' => ['class' => 'pick-a-color'], + ]) ->add('url') ->add('protected', CheckboxType::class, [ - "label" => "Force l'authentification de l'utilisateur ?", - "required" => false + 'label' => "Force l'authentification de l'utilisateur ?", + 'required' => false, ]) - + ->add('essential', CheckboxType::class, [ - "label" => "Item essentiel ?", - "required" => false + 'label' => 'Item essentiel ?', + 'required' => false, ]) ->add('target', ChoiceType::class, [ - "label" => 'Ouvrir le lien dans', - "choices" => [ - "Nouvel onglet/fenêtre" => '_blank', - "iFrame" => 'frame', - "Onglet courant" => '_self', - ] + 'label' => 'Ouvrir le lien dans', + 'choices' => [ + 'Nouvel onglet/fenêtre' => '_blank', + 'iFrame' => 'frame', + 'Onglet courant' => '_top', + ], ]) - ->add('idicon', HiddenType::class,['mapped'=> false,'data' => $options["idicon"]]); + ->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]); } public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults([ 'data_class' => 'App\Entity\Item', - 'mode' => "string", - 'access' => "string", + 'mode' => 'string', + 'access' => 'string', 'idicon' => null, ]); } diff --git a/src/Form/ItemcategoryType.php b/src/Form/ItemcategoryType.php index 53871ab..5439656 100644 --- a/src/Form/ItemcategoryType.php +++ b/src/Form/ItemcategoryType.php @@ -1,21 +1,12 @@ setDefaults(array( + $resolver->setDefaults([ 'data_class' => 'App\Entity\Itemcategory', - 'mode' => "string", + 'mode' => 'string', 'access' => 'string', - )); + ]); } } diff --git a/src/Form/PageUpdateWidgetType.php b/src/Form/PageUpdateWidgetType.php new file mode 100644 index 0000000..93fb64e --- /dev/null +++ b/src/Form/PageUpdateWidgetType.php @@ -0,0 +1,113 @@ +add('submit', SubmitType::class, [ + 'label' => 'Valider', + 'attr' => ['class' => 'btn btn-success'], + ]) + + ->add('name', TextType::class, [ + 'label' => 'Nom', + ]) + + ->add('roworder', IntegerType::class, [ + 'label' => 'Ordre', + ]) + + ->add('fonticon', FaChoiceType::class, [ + 'label' => 'Icône', + 'required' => false, + ]) + + ->add('maxwidth', IntegerType::class, [ + 'label' => "Largeur maximum (0 pour largeur de l'écran)", + ]) + + ->add('template', HiddenType::class, [ + 'label' => 'Template', + 'required' => false, + ]); + + if ('config' == $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', + 'Modérateur' => 'ROLE_MODO', + 'Administateur' => 'ROLE_ADMIN', + ], + 'multiple' => true, + 'expanded' => true, + 'disabled' => ('delete' == $options['mode'] ? true : false), + ]) + + ->add('groups', Select2EntityType::class, [ + 'label' => 'Visible pour les Groupes', + 'class' => 'App:Group', + 'text_property' => 'label', + 'multiple' => true, + 'remote_route' => 'app_ajax_group_list', + 'primary_key' => 'id', + 'text_property' => 'label', + 'minimum_input_length' => 0, + 'page_limit' => 100, + 'allow_clear' => true, + 'delay' => 250, + 'cache' => false, + 'cache_timeout' => 60000, + 'language' => 'fr', + 'placeholder' => 'Selectionner un groupe', + ]) + + ->add('user', Select2EntityType::class, [ + 'label' => 'Propriétaire', + 'disabled' => ('delete' == $options['mode'] ? true : false), + 'required' => false, + 'multiple' => false, + 'remote_route' => 'app_config_user_ajax_selectlist', + 'class' => 'App\Entity\User', + 'primary_key' => 'id', + 'text_property' => 'username', + 'minimum_input_length' => 2, + 'page_limit' => 10, + 'allow_clear' => true, + 'delay' => 250, + 'cache' => false, + 'cache_timeout' => 60000, // if 'cache' is true + 'language' => 'fr', + 'placeholder' => 'Selectionner un propriétaire', + 'attr' => ['class' => 'form-control', 'style' => 'margin-bottom:15px'], + ]); + } + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => 'App\Entity\Page', + 'access' => 'string', + 'mode' => 'string', + 'for' => 'string', + ]); + } +} diff --git a/src/Form/PagetemplateSubmitType.php b/src/Form/PagetemplateSubmitType.php new file mode 100644 index 0000000..11c972a --- /dev/null +++ b/src/Form/PagetemplateSubmitType.php @@ -0,0 +1,53 @@ +add('submit', SubmitType::class, [ + 'label' => 'Valider', + 'attr' => ['class' => 'btn btn-success'], + ]) + + ->add('name', TextType::class, [ + 'label' => 'Nom', + ]) + + ->add('parentfor', ChoiceType::class, [ + 'label' => 'Modèle pour les', + 'choices' => [ + 'Utilisateurs' => 'user', + 'Groupes' => 'group', + 'Application' => 'app', + ], + ]) + + ->add('roworder', IntegerType::class, [ + 'label' => 'Ordre', + ]) + + ->add('maxwidth', IntegerType::class, [ + 'label' => "Largeur maximum (0 pour largeur de l'écran)", + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => 'App\Entity\Page', + 'mode' => 'string', + 'access' => 'string', + ]); + } +} diff --git a/src/Form/PagewidgetType.php b/src/Form/PagewidgetType.php new file mode 100644 index 0000000..1269cc6 --- /dev/null +++ b/src/Form/PagewidgetType.php @@ -0,0 +1,248 @@ +container = $container; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + // Ajout des champs commun à tout les widgets + $builder + ->add('submit', SubmitType::class, [ + 'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'), + 'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']), + ]) + + ->add('name', TextType::class, [ + 'label' => 'Nom', + ]) + ->add('height', IntegerType::class, [ + 'label' => 'Hauteur du Widget', + ]) + ->add('border', ChoiceType::class, [ + 'label' => 'Afficher les Bords', + 'choices' => ['oui' => '1', 'non' => '0'], + ]) + ->add('autoajust', ChoiceType::class, [ + 'label' => 'Ajuster la Hauteur au Contenu', + 'choices' => ['oui' => '1', 'non' => '0'], + ]) + ->add('opened', ChoiceType::class, [ + 'label' => "Afficher le corps du widget à l'ouverture", + 'choices' => ['oui' => '1', 'non' => '0'], + ]) + ->add('viewheader', ChoiceType::class, [ + 'label' => "Afficher l'Entête", + 'choices' => ['oui' => '1', 'non' => '0'], + ]) + ->add('colorheaderback', TextType::class, [ + 'label' => "Couleur de Fond de l'Entête", + 'required' => false, + 'attr' => ['class' => 'pick-a-color'], + ]) + ->add('colorheaderfont', TextType::class, [ + 'label' => "Couleur du Texte de l'Entête", + 'required' => false, + 'attr' => ['class' => 'pick-a-color'], + ]) + ->add('colorbodyback', TextType::class, [ + 'label' => 'Couleur de Fond du Corps', + 'required' => false, + 'attr' => ['class' => 'pick-a-color'], + ]) + ->add('colorbodyfont', TextType::class, [ + 'label' => 'Couleur du Texte du Corps', + 'required' => false, + 'attr' => ['class' => 'pick-a-color'], + ]) + + ->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]); + + foreach ($options['param']['fields'] as $field) { + dump($field); + if ('string' == $field['type']) { + $builder + ->add($field['id'], TextType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + ]); + } elseif ('integer' == $field['type']) { + $builder + ->add($field['id'], IntegerType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + ]); + } elseif ('boolean' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Non' => 0, 'Oui' => 1], + ]); + } elseif ('desktopmode' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Très Petit' => '0', 'Petit' => '1', 'Moyen' => '2', 'Grand' => '3', 'Liste' => '4'], + ]); + } elseif ('modelist' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Pavet' => '0', 'Liste' => '1'], + ]); + } elseif ('withbookmark' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Favoris + Items' => '0', 'Items uniquement' => '1', 'Favoris uniquement' => '2'], + ]); + } elseif ('itemcategory' == $field['type']) { + $id = $field['value']; + $categorys = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Itemcategory")->findAll(); + $choices = []; + foreach ($categorys as $category) { + $choices[$category->getLabel()] = $category->getId(); + } + + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $id, + 'required' => ('true' == $field['mandatory']), + 'choices' => $choices, + 'placeholder' => '-- Sélectionnez une catégorie --', + ]); + } elseif ('alertcategory' == $field['type']) { + $id = $field['value']; + $categorys = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Alertcategory")->findAll(); + $choices = []; + foreach ($categorys as $category) { + $choices[$category->getLabel()] = $category->getId(); + } + + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $id, + 'required' => ('true' == $field['mandatory']), + 'choices' => $choices, + 'placeholder' => '-- Sélectionnez une catégorie --', + ]); + } elseif ('appexternal' == $field['type']) { + $id = $field['value']; + $appexternals = $this->container->get('doctrine.orm.entity_manager')->getRepository("App\Entity\Appexternal")->findAll(); + $choices = []; + foreach ($appexternals as $appexternal) { + $choices[$appexternal->getName()] = $appexternal->getId(); + } + + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $id, + 'required' => ('true' == $field['mandatory']), + 'choices' => $choices, + 'placeholder' => '-- Sélectionnez une application --', + ]); + } elseif ('apponly' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Documents + Tâches' => '0', 'Documents uniquement' => '1', 'Tâches uniquement' => '2'], + ]); + } elseif ('target' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Nouvel onglet/fenêtre' => '_blank', 'iFrame' => 'frame', 'Onglet courant' => '_self'], + ]); + } elseif ('ckeditor' == $field['type']) { + $builder + ->add($field['id'], CKEditorType::class, [ + 'config_name' => 'full_config', + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'config' => ['filebrowserUploadRoute' => 'app_'.$options['access'].'_pagewidget_upload'], + ]); + } elseif ('clock' == $field['type']) { + $builder + ->add($field['id'], ChoiceType::class, [ + 'label' => $field['label'], + 'mapped' => false, + 'label_attr' => ['loc' => $field['loc']], + 'data' => $field['value'], + 'required' => ('true' == $field['mandatory']), + 'choices' => ['Analogique' => '0', 'Numérique' => '1'], + ]); + } + } + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => 'App\Entity\Pagewidget', + 'param' => [], + 'mode' => 'string', + 'access' => 'string', + 'idicon' => 'string', + ]); + } +} diff --git a/src/Form/Type/FaChoiceType.php b/src/Form/Type/FaChoiceType.php new file mode 100644 index 0000000..abac307 --- /dev/null +++ b/src/Form/Type/FaChoiceType.php @@ -0,0 +1,75 @@ +fontawesomeIconsFile = $fontawesomeIconsFile; + } + + public function buildView(FormView $view, FormInterface $form, array $options) + { + // Pass this flag is necessary to render the label as raw. + // See below the twig field template for more details. + $view->vars['raw_label'] = true; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'attr' => [ + // It's the key of the solution and can be done in many ways. + // Now, the rendered + + +

+ +
+
+ Liste des Pages +
+ +
+
+ + + + + + + + + + +
ActionOrdreNomCatégoriePropriétaire
+
+
+
+{% endblock %} + +{% block localjavascript %} + $(document).ready(function() { + {% if not app.session.get('alluserpage') is empty %} + var state={{ app.session.get('alluserpage') }}; + if(state) { + $("#labelalluser").html("Afficher les pages non liées à un utilisateur"); + $("#alluser").attr('checked', true); + } + {% endif %} + + table = $('#dataTables').DataTable({ + columnDefs: [ { "targets": 'no-sort', "orderable": false } ], + responsive: true, + iDisplayLength: 100, + order: [[ 1, "asc" ]], + processing: true, + serverSide: true, + ajax: { + "url": "{{ path('app_config_page_ajax_list') }}", + "data": function ( d ) { + return $.extend( {}, d, { + "alluser": $('#alluser').is(':checked') + }); + } + }, + + drawCallback: function(settings) { + $("a[data-method='delete']").click(function(){ + if( !confirm('Êtes-vous sûr de vouloir supprimer cette page ?')) { + return false; + } + }); + } + }); + }); + + $('#alluser').change(function() { + if (typeof table !== 'undefined') { + table.ajax.reload(); + } + + var check = $('#alluser').is(':checked'); + if(check) + $("#labelalluser").html("Afficher les pages non liées à un utilisateur"); + else + $("#labelalluser").html("Afficher les pages créées par des utilisateurs"); + + }); + +{% endblock %} diff --git a/templates/Page/menugroupe.html.twig b/templates/Page/menugroupe.html.twig new file mode 100644 index 0000000..4538fdd --- /dev/null +++ b/templates/Page/menugroupe.html.twig @@ -0,0 +1,109 @@ + {% if not inmenu %} + + {% else %} + {% for groupshared in groupsshared %} + {% if groupshared.pagesshared|length == 1 %} + {% set page = groupshared.pagesshared[0] %} + {% set forcereload=true %} + {% if page.pagecategory.id==1 %} + {% set forcereload=page.toreload %} + {% endif %} + + {% set isactive="" %} + {% if entity.id is defined and page.id==entity.id %} + {% set isactive="class='active'" %} + {% endif %} + + + {% else %} + + {% endif %} + {% endfor %} + {% endif %} \ No newline at end of file diff --git a/templates/Page/noportal.html.twig b/templates/Page/noportal.html.twig new file mode 100644 index 0000000..c8657b6 --- /dev/null +++ b/templates/Page/noportal.html.twig @@ -0,0 +1,334 @@ + +{% 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 new file mode 100644 index 0000000..274c035 --- /dev/null +++ b/templates/Page/pages.html.twig @@ -0,0 +1,571 @@ + +{% extends '@CadolesCore/base.html.twig' %} + +{% block localstyle %} + body{overflow-y:hidden} +{% endblock %} + +{% block appmenu %} + + + + + + + + + + + + + + + +{% endblock %} + +{% block pagewrapper %} +
+ + + {% if activate_widonlyoffice %} + + {% endif %} + + {% set nbgroupregrouped=5 %} + {% if groupsshared|length > nbgroupregrouped %} + + {%endif%} + + + + + + {%if app.user %} + + {% endif %} + +{% endblock %} + +{% block localexternalscript %} + {% if app.user %} + + + {% endif %} +{% endblock %} + +{% block localjavascript %} + var idpage; + pagebookmark="{{app.session.get("pagebookmark")}}"; + + $('document').ready(function(){ + {% if gotoroute is empty %} + {% for page in pagesadmin %} + {% if page.id==entity.id %} + {% set usage="portal" %} + {% if loop.first %} {% set usage="accueil" %} {%endif %} + showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','{{usage}}',false,null,'{{page.name}}'); + {% endif %} + {% endfor %} + + {% for page in pagesuser %} + {% if page.id==entity.id %} + showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','user',false,null,'{{page.name}}'); + {% endif %} + {% endfor %} + + {% for groupshared in groupsshared %} + {% for page in groupshared.pagesshared %} + {% if page.id==entity.id %} + showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}},'{{page.name}}'); + {% endif %} + {% endfor %} + {% endfor %} + {% else %} + var url="{{ path(gotoroute,{id:gotoid}) }}"; + showGoto(url); + {% endif %} + + // Rendre les pages user déplacable + $("#pagesuser").sortable({ + axis: "x", + forcePlaceholderSize: true, + placeholder: "placeholder", + update: function( event, ui ) { + $('#pagesuser li').each(function(order) { + var idpage=$(this).attr('id').replace("menupage-",""); + $.ajax({ + method: "POST", + url: "{{ path('cadoles_portal_'~access~'_page_order') }}", + data: { + id:idpage, + order:order + } + }); + }); + } + }); + + // Initialisation du tableau des widgets selectionnable à la création + $('.table').DataTable({ + columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ], + responsive: true, + iDisplayLength: 10, + order: [[ 1, "asc" ]], + }); + + {% if app.user and app.session.get("timerefreshnotif") > 0%} + setInterval(function(){ + loadmsgCounter() + }, {{(app.session.get("timerefreshnotif")*1000)}}); + {% endif %} + }); + + $(window).resize(function() { + resizeFrame(); + }); + + function resizeFrame() { + var iFrame = document.getElementById('frameContent'); + + var heightbody = $('html').height(); + + if($('.header').length) + var heightheader = $('.header').height(); + else + var heightheader = $('.navbarsmall').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); + }); + } + + + // Affichage des frames associés aux items de bureau + function showFrameitem(id,url,forcereload) { + $(".pageframereload").remove(); + $(".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 { + var myclass=""; + if(forcereload) myclass="pageframereload"; + $("#pagecontainer").append(""); + } + + resizeFrame(); + } + + // Affichages des pages + function showPage(id,catid,canupdate,usage,forcereload,groupid,pagename) { + // Sauvegarder la page en cours + idpage=id; + + // Cacher toutes les pages + $(".pageframereload").remove(); + $(".pageframe").hide(); + + // Rendre actif le page en cours dans le menu + $(".navbar-top-links li").removeClass("active"); + $(".dropdown-toggle").removeClass("dropdownactive"); + + $("#menupage-"+id).addClass("active"); + $('a[data-group="'+groupid+'"][data-toggle="dropdown"]').addClass("dropdownactive");; + + var url="{{ path('cadoles_portal_user_page_view',{id:'xx',usage:'yy','group':'zz'}) }}"; + url=url.replace('xx',id); + url=url.replace('yy',usage); + url=url.replace('zz',groupid); + + passurl="{{ path('cadoles_core_home',{id:'xx'}) }}"; + passurl=passurl.replace('xx',id); + history.pushState('data to be passed', 'Title of the page', passurl); + + // Si force le rechargement et frame existante on la détruit + if(forcereload&&$("#page-"+id).length) + $("#page-"+id).remove(); + + // Si la frame en cours existe déjà on l'affiche + if($("#page-"+id).length) + $("#page-"+id).show(); + // Sinon on la génère + else { + var myclass=""; + if(forcereload) myclass="pageframereload"; + $("#pagecontainer").append(""); + } + + // Détruire le badge associé car normalement de fait on a lu les notif + if(usage=="group") { + $("#badge-"+groupid).remove() + } + + // Nom de la page + console.log(pagename); + $("#menuname").html(pagename); + + // Cacher les actions possibles sur la page + $("#menuupdate").hide(); + $("#menushare").hide(); + $("#menudelete").hide(); + $("#menubookmark").hide(); + $("#menuwidgetuser").hide(); + $("#menuwidgetgroup").hide(); + + if(canupdate) { + $("#menuupdate").show(); + $("#menushare").show(); + $("#menudelete").show(); + } + + {% if app.user %} + + if(id==pagebookmark) { + $("#menubookmark").css("color","red"); + $("#menubookmark").attr("title","Ne plus faire de cette page votre page d'accueil") + } + else { + $("#menubookmark").css("color",""); + $("#menubookmark").attr("title","Faire de cette page votre page d'accueil") + } + + $("#menubookmark").show(); + {% endif %} + + // Si page de type widget on affiche la selection des widgets à insérer + if($("#page-"+id).data('category')==2&&canupdate) { + if(usage=="user") $("#menuwidgetuser").show(); + if(usage=="group") $("#menuwidgetgroup").show(); + + } + + // On resize les frame + resizeFrame(); + + // Mettre le focus dans la frame + //$("#page-"+id).contentWindow.focus(); + } + + // Affichages des pages + function showGoto(url) { + $("#pagecontainer").append(""); + + // On resize les frame + resizeFrame(); + } + + + function submitPage() { + var url="{{ path('cadoles_portal_'~access~'_page_submit') }}"; + $(location).attr('href',url); + } + + function updatePage() { + if($("#page-"+idpage).length) { + var url="{{ path('cadoles_portal_'~access~'_page_update',{id:'xx'}) }}"; + url=url.replace('xx',idpage); + + $(location).attr('href',url); + } + } + + function sharePage() { + if($("#page-"+idpage).length) { + var url="{{ path('cadoles_portal_'~access~'_page_share',{id:'xx'}) }}"; + url=url.replace('xx',idpage); + + $(location).attr('href',url); + } + } + + function deletePage() { + if($("#page-"+idpage).length) { + if (confirm('Êtes-vous sûr de vouloir supprimer ?')) { + var url="{{ path('cadoles_portal_'~access~'_page_delete',{id:'xx'}) }}"; + url=url.replace('xx',idpage); + + $(location).attr('href',url); + } + } + } + + function bookmarkPage() { + {% if app.user %} + if($("#page-"+idpage).length) { + if(pagebookmark==idpage) + confirmtext="Votre page d'accueil redevient l'accueil général de {{ app.session.get("appname") }}."; + else + confirmtext="Cette page sera votre page d'acueil à l'ouverture de {{ app.session.get("appname") }}, vous pourrez à tout moment changer de page d'accueil."; + + if (confirm(confirmtext)) { + $.ajax({ + method: "POST", + url: "{{ path('cadoles_core_user_preference') }}", + data: { + id:0, + key:'pagebookmark', + value: idpage + }, + success: function() { + if(pagebookmark==idpage) { + pagebookmark=""; + $("#menubookmark").css("color",""); + $("#menubookmark").attr("title","Faire de cette page votre page d'accueil") + } + else { + pagebookmark=idpage; + $("#menubookmark").css("color","red"); + $("#menubookmark").attr("title","Ne plus faire de cette page votre page d'accueil") + } + } + }); + } + } + {% endif %} + } + + // Création d'un widget selectionné + function selWidget(idwidgettype) { + var url="{{ path('cadoles_portal_user_pagewidget_widget_sumbit',{idpage:'yy',idwidgettype:'xx'})}}"; + url=url.replace('xx',idwidgettype); + url=url.replace('yy',idpage); + + $(location).attr('href', url); + }; + + function loadmsgCounter() { + + $.ajax({ + method: "POST", + url: "{{ path('cadoles_portal_user_page_ajax_msgcounter') }}", + success: function(data) { + $.each(data, function(group, counter) { + menu=$("a[data-group='"+group+"']"); + if(menu.length) { + if(menu.children(".badge").length) { + if(counter==0) + menu.remove(); + else + menu.children(".badge").html(counter); + } + else if(counter>0) + menu.append(""+counter+" + Partage Page + + +

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

+ + {% if app.session.flashbag.has('error') %} +
+ Erreur
+ {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + + {% if app.session.flashbag.has('notice') %} +
+ Information
+ {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + +
+
+ Informations +
+ +
+ {{ form_row(form.groups) }} +
+
+{{ form_end(form) }} +{% endblock %} diff --git a/templates/Page/submit.html.twig b/templates/Page/submit.html.twig new file mode 100644 index 0000000..383b2c3 --- /dev/null +++ b/templates/Page/submit.html.twig @@ -0,0 +1,86 @@ +{% extends '@CadolesCore/base.html.twig' %} + +{% block pagewrapper %} +{{ form_start(form) }} +

+ Nouvelle Page +

+ +

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

+ + {% if app.session.flashbag.has('error') %} +
+ Erreur
+ {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + + {% if app.session.flashbag.has('notice') %} +
+ Information
+ {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + +
+
+ Informations +
+ +
+ {{ form_row(form.name) }} + {{ form_row(form.pagecategory) }} + {{ form_row(form.usage) }} + {% if form.user is defined %} + {{ form_row(form.user) }} + {% endif %} + +
{{ form_row(form.page) }}
+
{{ form_row(form.groups) }}
+ {{ form_row(form.roworder) }} + {{ form_row(form.fonticon) }} + {{ form_row(form.maxwidth) }} +
+
+{{ form_end(form) }} +{% endblock %} + +{% block localjavascript %} + $('document').ready(function(){ + hideshow(); + }); + + $(document.body).on("change","#page_submit_pagecategory",function(){ + hideshow(); + }); + + $(document.body).on("change","#page_submit_usage",function(){ + hideshow(); + }); + + function hideshow() { + if($("#page_submit_pagecategory").val()==2) + $("#pagegroup").show(); + else { + $("#pagegroup").hide(); + } + + if($("#page_submit_usage").val()=="group") + $("#groupworkgroup").show(); + else { + $("#groupworkgroup").hide(); + } + } + +{% endblock %} \ No newline at end of file diff --git a/templates/Page/updateeditor.html.twig b/templates/Page/updateeditor.html.twig new file mode 100644 index 0000000..3d8f89b --- /dev/null +++ b/templates/Page/updateeditor.html.twig @@ -0,0 +1,72 @@ +{% extends '@CadolesCore/base.html.twig' %} + +{% block pagewrapper %} +{{ form_start(form) }} +

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

+ +

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

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

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

+ +

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

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

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

+ +

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

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

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

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

+ +

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

+ + {% if app.session.flashbag.has('error') %} +
+ Erreur
+ {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + + {% if app.session.flashbag.has('notice') %} +
+ Information
+ {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
+ {% endfor %} +
+ {% endif %} + +
+ {% if form.roles is defined %} +
+ {% else %} +
+ {% endif %} + + {{ form_row(form.name) }} + {{ form_row(form.roworder) }} + {{ form_row(form.fonticon) }} + {{ form_row(form.maxwidth) }} + {{ form_row(form.template) }} +
+ + {% if form.roles is defined %} +
+ {{ form_row(form.user) }} + {{ form_row(form.roles) }} + {{ form_row(form.groups) }} +
+ {% endif %} +
+ +

Template de Mise en Page

+
+
+{{ form_end(form) }} +{% endblock %} + + +{% block localscript %} + + +{% endblock %} \ No newline at end of file diff --git a/templates/Page/vieweditor.html.twig b/templates/Page/vieweditor.html.twig new file mode 100644 index 0000000..f974bd5 --- /dev/null +++ b/templates/Page/vieweditor.html.twig @@ -0,0 +1,23 @@ + +{% extends '@CadolesCore/base.html.twig' %} + +{% block pagewrapper %} + {% if access=="config" %} + + {% endif %} + +
+ {{ entity.html | raw }} +
+{% endblock %} + +{% block localjavascript %} + $('document').ready(function(){ + }); + +{% endblock %} diff --git a/templates/Page/viewurl.html.twig b/templates/Page/viewurl.html.twig new file mode 100644 index 0000000..a9c887d --- /dev/null +++ b/templates/Page/viewurl.html.twig @@ -0,0 +1,59 @@ + +{% extends '@CadolesCore/base.html.twig' %} + +{% block localstyle %} + #pageiframe { margin: 0px -30px;} +{% endblock %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + +{% block pagewrapper %} + {% if access=="config" %} + + {% endif %} + +
+ +
+{% endblock %} + + +{% block localjavascript %} + $(window).resize(function() { + resizeFrame(); + }); + + $('document').ready(function(){ + resizeFrame(); + }); + + function resizeFrame() { + $("body").css("overflow-y","hidden"); + $(".col-md-10").css("padding","0"); + + var iFrame = document.getElementById('frameContent'); + + var heightbody = $('html').height(); + var heightheader = $('.header').height(); + if($('.pagemenu').css("display")=="none") + var heightmenu = 0; + else + var heightmenu = $('.pagemenu').height(); + + + var heightframe = heightbody-heightheader-heightmenu; + + if($("#frameContent").length>0) { + $("#frameContent").height(heightframe); + } + } +{% endblock %} diff --git a/templates/Page/viewwidget.html.twig b/templates/Page/viewwidget.html.twig new file mode 100644 index 0000000..a82d485 --- /dev/null +++ b/templates/Page/viewwidget.html.twig @@ -0,0 +1,563 @@ + +{% extends 'base.html.twig' %} + +{% block localstyle %} + {% if look=="list" %} + #R1C1:first-child { + margin-top: 30px; + } + + .widget-mini .logo { + background-color: {{app.session.get('colorbgbodydark')}}; + padding: 3px; + border-radius: 100%; + } + {% endif %} +{% endblock %} + +{% block menuuser %} + {% if access=="admin" %} + {% set template="" %} + {% if mode=="viewtemplate" %} + {% set template="template" %} + {% endif %} + +
  • {{ page.name }}
  • +
  • +
  • +
  • + {% endif %} +{% endblock %} + +{% block body %} +
    + +
    + + + + + {% if access!="all" %} + + {% endif %} + + + +{% endblock %} + +{% block localscript %} + +{% endblock %} diff --git a/templates/Pagetemplate/list.html.twig b/templates/Pagetemplate/list.html.twig new file mode 100644 index 0000000..1d72b2b --- /dev/null +++ b/templates/Pagetemplate/list.html.twig @@ -0,0 +1,58 @@ +{% extends 'base.html.twig' %} + + +{% block body %} +

    + Gestion des Modèles de Page +

    + +

    + Ajouter un Modèle +

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

    + Nouveau Modèle de Page +

    + +

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

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    +
    + Informations +
    + +
    + {{ form_row(form.name) }} + {{ form_row(form.parentfor) }} + {{ form_row(form.roworder) }} + {{ form_row(form.maxwidth) }} +
    +
    +{{ form_end(form) }} +{% endblock %} diff --git a/templates/Pagewidget/constants.twig b/templates/Pagewidget/constants.twig new file mode 100644 index 0000000..70230e3 --- /dev/null +++ b/templates/Pagewidget/constants.twig @@ -0,0 +1,238 @@ +{% macro libmonth(month) %} + {% if month==1 %} Janvier + {% elseif month==2 %} Février + {% elseif month==3 %} Mars + {% elseif month==4 %} Avril + {% elseif month==5 %} Mai + {% elseif month==6 %} Juin + {% elseif month==7 %} Juillet + {% elseif month==8 %} Août + {% elseif month==9 %} Septembre + {% elseif month==10 %} Octobre + {% elseif month==11 %} Novembre + {% elseif month==12 %} Décembre + {%endif%} +{% endmacro %} + +{% macro libday(day) %} + {% if day==1 %} Lundi + {% elseif day==2 %} Mardi + {% elseif day==3 %} Mercredi + {% elseif day==4 %} Jeudi + {% elseif day==5 %} Vendredi + {% elseif day==6 %} Samedi + {% elseif day==7 %} Dimanche + {%endif%} +{% endmacro %} + +{% macro mycolormain() %} +{% set color = app.session.get('color') %}{% set colormain = app.session.get('colorbgbodydark') %}{{ colormain }} +{% endmacro %}` + +{% macro mystylewidget(entity) %} + {% set colorheaderback = entity.colorheaderback %} + {% if colorheaderback is null %} + {% set colorheaderback = "var(--colorfttitledark)" %} + {% endif %} + + {% set stylewidget = "" %} + {% if not entity.autoajust %} + {% set stylewidget = stylewidget ~ "height: " ~ entity.height ~ "px; " %} + {% endif %} + + {% if entity.border %} + {% set stylewidget = stylewidget ~ "border:1px solid " ~ colorheaderback ~ "; " %} + {% endif %} + + {{ stylewidget }} +{% endmacro %}` + + +{% macro mystylewidgetmenu(entity) %} + {% set color = app.session.get('color') %} + + {% set colorheaderfont = entity.colorheaderfont %} + {% if colorheaderfont is null %} + {% set colorheaderfont = "var(--colorfttitledark)" %} + {% endif %} + + {% set stylewidgetmenu = "" %} + {% set stylewidgetmenu = stylewidgetmenu ~ "color: " ~ colorheaderfont ~ "; " %} + {% set stylewidgetmenu = stylewidgetmenu ~ "cursor: pointer; " %} + + {{ stylewidgetmenu }} +{% endmacro %}` + + + +{% macro mystylewidgetheader(entity) %} + + {% set colorheaderback = entity.colorheaderback %} + {% if colorheaderback is null %} + {% set colorheaderback = "var(--colorbgbodydark)" %} + {% endif %} + + {% set colorheaderfont = entity.colorheaderfont %} + {% if colorheaderfont is null %} + {% set colorheaderfont = "var(--colorfttitledark)" %} + {% endif %} + + {% set stylewidgetheader = "" %} + {% set stylewidgetheader = stylewidgetheader ~ "background-color: " ~ colorheaderback ~ "; " %} + {% set stylewidgetheader = stylewidgetheader ~ "color: " ~ colorheaderfont ~ "; " %} + + {{ stylewidgetheader }} +{% endmacro %}` + + + + +{% macro mystylewidgetbody(entity) %} + {% set colorbodyback = entity.colorbodyback %} + {% if colorbodyback is null %} + {% set colorbodyback = "var(--colorbgbodydark)" %} + {% endif %} + + {% set colorbodyfont = entity.colorbodyfont %} + {% if colorbodyfont is null %} + {% set colorbodyfont = "var(--colorfttitledark)" %} + {% endif %} + + {% if not entity.border %} + {% set colorbodyback = "var(--colorbgbodylight)" %} + {% endif %} + + {% set stylewidgetbody = "" %} + {% set stylewidgetbody = stylewidgetbody ~ "background-color: " ~ colorbodyback ~ "; " %} + {% set stylewidgetbody = stylewidgetbody ~ "color: " ~ colorbodyfont ~ "; " %} + {% if not entity.autoajust %} + {% set stylewidgetbody = stylewidgetbody ~ "height: " ~ (entity.height-50-2) ~ "px; overflow-y: auto;" %} + {% endif %} + + {% if entity.border %} + {% set stylewidgetbody = stylewidgetbody ~ "padding:10px;" %} + {% endif %} + + {% if not entity.opened %} + {% set stylewidgetbody = stylewidgetbody ~ "display:none;" %} + {% endif %} + + {{ stylewidgetbody }} + +{% endmacro %}` + +{% macro mystylewidgetbodyreverse(entity) %} + {% set color = app.session.get('color') %} + + {% set colorbodyback = entity.colorbodyback %} + {% if colorbodyback is null %} + {% set colorbodyback = app.session.get('colorbgbodydark') %} + {% endif %} + + {% set colorbodyfont = entity.colorbodyfont %} + {% if colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorfttitledark') %} + {% endif %} + + {% if colorbodyfont == colorbodyback %} + {% if colorbodyfont == app.session.get('colorbgbodydark') %} + {% set colorbodyfont=app.session.get('colorfttitledark') %} + {% else %} + {% set colorbodyfont=app.session.get('colorbgbodydark') %} + {% endif %} + {% endif %} + + + {% set stylewidgetbody = "" %} + {% set stylewidgetbody = stylewidgetbody ~ "background-color: " ~ colorbodyback ~ "; " %} + {% set stylewidgetbody = stylewidgetbody ~ "color: " ~ colorbodyfont ~ "; " %} + + + {{ stylewidgetbody }} + +{% endmacro %}` + + + +{% macro mystylewidgetbodyframe(entity) %} + {% set color = app.session.get('color') %} + + {% set colorheaderback = entity.colorheaderback %} + {% if colorheaderback is null %} + {% set colorheaderback = app.session.get('colorbgbodydark') %} + {% endif %} + + {% set colorheaderfont = entity.colorheaderfont %} + {% if colorheaderfont is null %} + {% set colorheaderfont = app.session.get('colorfttitledark') %} + {% endif %} + + {% set colorbodyback = entity.colorbodyback %} + {% if colorbodyback is null %} + {% set colorbodyback = app.session.get('colorbgbodydark') %} + {% endif %} + + {% set colorbodyfont = entity.colorbodyfont %} + {% if colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorfttitledark') %} + {% endif %} + + {% if not entity.border %} + {% set colorbodyback = app.session.get('colorbgbodylight') %} + {% endif %} + + {% if colorbodyfont == colorbodyback %} + {% if colorbodyfont == app.session.get('colorbgbodydark') %} + {% set colorbodyfont=app.session.get('colorfttitledark') %} + {% else %} + {% set colorbodyfont=app.session.get('colorbgbodydark') %} + {% endif %} + {% endif %} + + {% set stylewidgetbodyframe = "" %} + {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "background-color: " ~ colorbodyback ~ "; " %} + {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "color: " ~ colorbodyfont ~ "; " %} + {% if not entity.autoajust %} + {% set stylewidgetbodyframe = stylewidgetbodyframe ~ "height: " ~ (entity.height-50-2) ~ "px;" %} + {% endif %} + + {{ stylewidgetbodyframe }} + +{% endmacro %}` + + + + + +{% macro mystylewidgetbodyimage(entity) %} + {% set color = app.session.get('color') %} + + {% set colorheaderback = entity.colorheaderback %} + {% if colorheaderback is null %} + {% set colorheaderback = app.session.get('colorbgbodydark') %} + {% endif %} + + {% set colorheaderfont = entity.colorheaderfont %} + {% if colorheaderfont is null %} + {% set colorheaderfont = app.session.get('colorfttitledark') %} + {% endif %} + + {% set colorbodyback = entity.colorbodyback %} + {% if colorbodyback is null %} + {% set colorbodyback = app.session.get('colorbgbodydark') %} + {% endif %} + + {% set colorbodyfont = entity.colorbodyfont %} + {% if colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorfttitledark') %} + {% endif %} + + {% set stylewidgetbodyimage = "" %} + {% set stylewidgetbodyimage = stylewidgetbodyimage ~ "background-color: " ~ colorbodyback ~ "; " %} + {% set stylewidgetbodyimage = stylewidgetbodyimage ~ "color: " ~ colorbodyfont ~ "; " %} + {% if not entity.autoajust %} + {% set stylewidgetbodyimage = stylewidgetbodyimage ~ "height: " ~ (entity.height-2) ~ "px; " %} + {% endif %} + + {{ stylewidgetbodyimage }} +{% endmacro %}` \ No newline at end of file diff --git a/templates/Pagewidget/edit.html.twig b/templates/Pagewidget/edit.html.twig new file mode 100644 index 0000000..a7df078 --- /dev/null +++ b/templates/Pagewidget/edit.html.twig @@ -0,0 +1,183 @@ +{% extends 'base.html.twig' %} + +{% block body %} +{{ form_start(form) }} +

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

    + +

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

    + + {% if app.session.flashbag.has('error') %} +
    + Erreur
    + {% for flashMessage in app.session.flashbag.get('error') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + + {% if app.session.flashbag.has('notice') %} +
    + Information
    + {% for flashMessage in app.session.flashbag.get('notice') %} + {{ flashMessage }}
    + {% endfor %} +
    + {% endif %} + +
    +
    +
    +
    Informations
    +
    + {{ form_row(form.name) }} +
    +
    +
    + +
    +
    +
    Informations
    +
    +
    + {% if entity.icon.label %} + + {% endif %} +
    + +
    + {{ form_row(form.idicon) }} + Selectionner un Icône + Détacher l'Icône +
    +
    +
    +
    +
    +
    +
    Informations
    +
    +
    +
    + {{ form_row(form.autoajust) }} + {{ form_row(form.height) }} + {{ form_row(form.border) }} + {{ form_row(form.opened) }} +
    + +
    + {{ form_row(form.viewheader) }} + {{ form_row(form.colorheaderback) }} + {{ form_row(form.colorheaderfont) }} + {{ form_row(form.colorbodyback) }} + {{ form_row(form.colorbodyfont) }} +
    + +
    + +
    + +
    + {{ form_widget(form) }} +
    +
    +
    +
    +
    +
    + +{{ form_end(form) }} +{% endblock %} + +{% block localscript %} + +{% endblock %} \ No newline at end of file diff --git a/templates/Pagewidget/viewalert.html.twig b/templates/Pagewidget/viewalert.html.twig new file mode 100644 index 0000000..be11157 --- /dev/null +++ b/templates/Pagewidget/viewalert.html.twig @@ -0,0 +1,140 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set colormain = constants.mycolormain() %} +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + +{%if mini %} + +{% else %} + {% if canupdate or alerts|length>0 %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + {% for alert in alerts %} +
    + + +
    +
    {{ alert.content|raw }}
    + + {% if not alert.items is empty %} + {% if app.user %} + {% set username = app.user.username %} + {% else %} + {% set username = "" %} + {% endif %} + + + {% endif %} +
    + +
    + + {% endfor %} +
    +
    + {% endif %} +{% endif %} + + diff --git a/templates/Pagewidget/viewappexternal.html.twig b/templates/Pagewidget/viewappexternal.html.twig new file mode 100644 index 0000000..22f2023 --- /dev/null +++ b/templates/Pagewidget/viewappexternal.html.twig @@ -0,0 +1,112 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set colormain = constants.mycolormain() %} +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + +{% if modedesktop==0 %} + {% set stylegrid="" %} +{% elseif modedesktop==1 %} + {% set stylegrid="grid-medium" %} +{% elseif modedesktop==2 %} + {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} +{% endif %} + +{% set colorbodyfont = "" %} +{% if entity.colorbodyfont is not null %} + {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} +{% endif %} + + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + {% for itemcategory in itemcategorys %} + {% set haveitem=false %} + + {% for item in items if item.itemcategory==itemcategory %} + + {% if loop.index ==1 %} + {% set haveitem=true %} + + {% if itemcategorys|length > 1 %} +

    {{ itemcategory.label }}

    + {% endif %} + +
    +
    +
    + {% endif %} + + + {% endfor %} + {% if haveitem %} +
    + {% endif %} + {% endfor %} +
    +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewblog.html.twig b/templates/Pagewidget/viewblog.html.twig new file mode 100644 index 0000000..181d573 --- /dev/null +++ b/templates/Pagewidget/viewblog.html.twig @@ -0,0 +1,101 @@ + +{% import "Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if access=="config" %} + + {% else %} + {% if canadd %} + {% set idblog = "" %} + {% set url= path('app_user_blogarticle_submit') %} + {% if usage=="group" and firstblog is defined %} + {% set url= path('app_user_blogarticle_submit',{idblog:firstblog,page:entity.page.id}) %} + {% endif %} + + + {% endif %} + + {% set url= path('app_user_blog_view') %} + {% if usage=="group" and firstblog is defined %} + {% set url= path('app_user_blog_view',{id:firstblog}) %} + {% endif %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% if blogarticles|length >= 1 %} + + {% endif %} +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewbookmark.html.twig b/templates/Pagewidget/viewbookmark.html.twig new file mode 100644 index 0000000..f3e0481 --- /dev/null +++ b/templates/Pagewidget/viewbookmark.html.twig @@ -0,0 +1,132 @@ +{% import "Pagewidget/constants.twig" as constants %} + + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + +{% if modedesktop==0 %} + {% set stylegrid="" %} +{% elseif modedesktop==1 %} + {% set stylegrid="grid-medium" %} +{% elseif modedesktop==2 %} + {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} +{% endif %} + +{% set colorbodyfont = "" %} +{% if entity.colorbodyfont is not null %} + {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} +{% endif %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if canadd %} + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% if bookmarks is not empty or canadd %} +
    +
    +
    +
    +
    + {% for bookmark in bookmarks %} + + {% endfor %} + + {% if canadd %} +
    +
    + +
    +
    + {% endif %} +
    +
    +
    + {% endif %} +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewcalendar.html.twig b/templates/Pagewidget/viewcalendar.html.twig new file mode 100644 index 0000000..531a6a6 --- /dev/null +++ b/templates/Pagewidget/viewcalendar.html.twig @@ -0,0 +1,100 @@ +{% import "Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + {% if access=="config" %} + + {% else %} + {% set url= path('app_'~access~'_calendar_view') %} + {% if usage=="group" and firstcalendar is defined %} + {% set url= path('app_'~access~'_calendar_view',{id:firstcalendar}) %} + {% endif %} + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% set firstflux="" %} + + {% if events|length >= 1 %} +
    + {% set monthsel = "" %} + {% for i in 0..(nbday-1) %} + {% set dateeventstart = 'now'|date_modify("+"~i~" day midnight") %} + {% set dateeventend = 'now'|date_modify("+"~(i+1)~" day midnight") %} + + {% set fgaffday=false %} + {% for event in events %} + {% if event.start< dateeventend and event.end>=dateeventstart %} + + {% if monthsel == "" or dateeventstart|date("Y-m")!=monthsel %} + {% set monthsel = dateeventstart|date("Y-m") %} + {% set libmonth = constants.libmonth(dateeventstart|date("m")) %} +

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

    + {% endif %} + + {% if not fgaffday %} + {% set fgaffday=true %} + {% set libday = constants.libday(dateeventstart|date("N")) %} +
    {{ libday ~ " " ~ dateeventstart|date("d/m/Y") }}
    + {% endif %} + +
    + {{ event.name }} = + {% if not event.allDay %} + {{ event.start | date("H:i") }} - + {%endif%} + {{ event.title }} +
    + {% endif %} + + {% endfor %} + + {% endfor %} + + {% if url is defined %} + + {% endif %} +
    + {% endif %} +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewchat.html.twig b/templates/Pagewidget/viewchat.html.twig new file mode 100644 index 0000000..e66f81b --- /dev/null +++ b/templates/Pagewidget/viewchat.html.twig @@ -0,0 +1,76 @@ +{% import "Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} +{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = app.session.get('colorbgbodydark') %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorfttitledark') %} +{% endif %} +{% set colorbody = app.session.get('colorbgbodylight') %} +{% set colormain = app.session.get('colorbgbodydark') %} + +{% if app.user %} + + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + + + {% if onheader %} +
    + +
    + {% else %} +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + {% if group is not null %} + {{ render(url('app_message_chat',{'id':group,'framed':true,'border':entity.border,'colorbodybacklight':colorbodyback, 'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain})) }} + {% endif %} +
    + {% endif %} +
    +{% endif %} + +{%endif%} \ No newline at end of file diff --git a/templates/Pagewidget/vieweditor.html.twig b/templates/Pagewidget/vieweditor.html.twig new file mode 100644 index 0000000..8379538 --- /dev/null +++ b/templates/Pagewidget/vieweditor.html.twig @@ -0,0 +1,56 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + {{ html | raw }} +
    +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewfile.html.twig b/templates/Pagewidget/viewfile.html.twig new file mode 100644 index 0000000..8d57522 --- /dev/null +++ b/templates/Pagewidget/viewfile.html.twig @@ -0,0 +1,67 @@ +{% import "Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = app.session.get('colorbgbodydark') %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if entity.border and colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorfttitledark') %} +{% endif %} + +{% if colorbodyfont is null %} + {% set colorbodyfont = app.session.get('colorbgbodydark') %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + +
    +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewflux.html.twig b/templates/Pagewidget/viewflux.html.twig new file mode 100644 index 0000000..ae4cefd --- /dev/null +++ b/templates/Pagewidget/viewflux.html.twig @@ -0,0 +1,141 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set color = app.session.get('color') %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% if colorbodyback==color['fontcolorhover'] %} + {% set colorbodyfont = color['main'] %} + {% else %} + {% set colorbodyfont = color['fontcolorhover'] %} + {% endif %} +{% endif %} + +{% if modelist==0 %} + {% set stylegrid="grid-preview" %} +{% elseif modelist==1 %} + {% set stylegrid="grid-list" %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% set firstflux="" %} + +
    + {% if fluxs is defined %} + {% if fluxs|length > 1 %} +
    Tout
    + + {% for flux in fluxs %} + {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} + {% if flux.color is not null %} + {% set stylefeed = "background-color: #" ~ flux.color ~ ";" %} + {% endif %} + +
    {{ flux.title }}
    + {% endfor %} + {% endif %} + {% endif %} + +
    + {% for feed in feeds %} + {% if loop.index==1 %} +
    +
    + {% endif %} + + + {% set stylecolor = "background-color: #" ~ color['main'] ~ ";" %} + {% if feed.color is defined and feed.color is not null %} + {% set stylecolor = "background-color: #" ~ feed.color ~ ";" %} + {% endif %} + {% set stylefeed = "" %} + {% if feed.image is not null and feed.image != ""%} + {% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %} + {% endif %} + + + + {% endfor %} +
    +
    +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewframe.html.twig b/templates/Pagewidget/viewframe.html.twig new file mode 100644 index 0000000..18c8661 --- /dev/null +++ b/templates/Pagewidget/viewframe.html.twig @@ -0,0 +1,77 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} +{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} + +{% set color = app.session.get('color') %} +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} + +{%if mini %} + +{% else %} +
    + +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + + + {% if onheader %} +
    + +
    + {% else %} +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + +
    + {% endif %} +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewgalery.html.twig b/templates/Pagewidget/viewgalery.html.twig new file mode 100644 index 0000000..62029c3 --- /dev/null +++ b/templates/Pagewidget/viewgalery.html.twig @@ -0,0 +1,123 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} + +{% set color = app.session.get('color') %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if canadd %} + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% if files|length>0 or canadd %} +
    +
    + {% if canadd %} +
    +
    + {% endif %} + + {% for file in files|sort %} + {% if loop.index==1 and not canadd %} +
    +
    + {% endif %} + +
    +
    + {% if canadd %} + + {% endif %} + + + + + +
    +
    + {% endfor %} + + {% if canadd %} + + {% endif %} +
    +
    + {% endif %} +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewgroup.html.twig b/templates/Pagewidget/viewgroup.html.twig new file mode 100644 index 0000000..e03dcf9 --- /dev/null +++ b/templates/Pagewidget/viewgroup.html.twig @@ -0,0 +1,116 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set colormain = constants.mycolormain() %} +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} + +{% set permgroup = app.session.get('permgroup') %} +{% set canadd = false %} +{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permgroup=="ROLE_MODO" or permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %} + {% set canadd = true %} +{% endif %} + +{% if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if canadd %} + + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} + + +
    + +
    +
    +
    +
    + {% for group in groups %} + + {% endfor %} + + {% if canadd %} + + {% endif %} +
    +
    +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewgroupmessage.html.twig b/templates/Pagewidget/viewgroupmessage.html.twig new file mode 100644 index 0000000..7b9ccc3 --- /dev/null +++ b/templates/Pagewidget/viewgroupmessage.html.twig @@ -0,0 +1,121 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set colormain = constants.mycolormain() %} +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} +{% set color = app.session.get('color') %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% if colorbodyback==color['fontcolorhover'] %} + {% set colorbodyfont = color['main'] %} + {% else %} + {% set colorbodyfont = color['fontcolorhover'] %} + {% endif %} +{% endif %} + +{% if modelist==0 %} + {% set stylegrid="grid-preview" %} +{% elseif modelist==1 %} + {% set stylegrid="grid-list" %} +{% endif %} + +{%if mini %} + +{% else %} +
    + +
    + {% if canupdate %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + + {% if messages is not empty %} +
    +
    +
    +
    + {% set nbaff=0 %} + {% for message in messages %} + {% set nbaff=nbaff+1 %} + {% set class="" %} + {% set style="" %} + {% if nbaff > nbarticle %} + {% set class="msg-hidden" %} + {% set style="display:none" %} + {% endif %} + +
    +
    + +
    +
    + {% endfor %} +
    +
    + {% endif %} +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewinfo.html.twig b/templates/Pagewidget/viewinfo.html.twig new file mode 100644 index 0000000..a3e2323 --- /dev/null +++ b/templates/Pagewidget/viewinfo.html.twig @@ -0,0 +1,60 @@ +{% extends 'widget.html.twig' %} + +{% block widgetmenu %} +{% endblock %} + +{% block widgetbody %} +
    + {{ description | raw }} +
    + + {%if usage=="group" %} +
    +
    +
    + + {% if canadd==true %} + + {% endif %} + + {% for member in members %} +
    +
    + +
    +
    + {% endfor %} +
    + {% endif %} +{% endblock %} diff --git a/templates/Pagewidget/viewitem.html.twig b/templates/Pagewidget/viewitem.html.twig new file mode 100644 index 0000000..aa6fa7c --- /dev/null +++ b/templates/Pagewidget/viewitem.html.twig @@ -0,0 +1,263 @@ + + +{% set widgethaveheader=entity.viewheader %} +{% set widgetname="item" %} +{%if widgethaveheader %} +{% set widgetstyle=(entity.colorheaderback ? "border-color:"~entity.colorheaderback~";" : "border-color:var(--colorbgbodydark);") %} +{% set widgetstylemenu=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %} +{%else%} +{% set widgetstyle=(entity.colorbodyback ? "border-color:"~entity.colorbodyback~";" : "border-color:var(--colorbgbodydark);") %} +{% set widgetstylemenu="background-color:var(--colorbgbodydark); color: var(--colorfttitledark); padding:10px; border-radius: 5px;" %} +{%endif%} + +{% set widgetstyleheader=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %} +{% set widgetstylebody=(entity.colorbodyback ? "background-color:"~entity.colorbodyback~";" : "background-color:var(--colorbgbodylight);")~(entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);") %} +{% set widgeicon= entity.icon ? path('app_minio_image',{file:entity.icon.label}) : path('app_minio_image',{file:"icon/icon_pin.png"}) %} + +{% if modedesktop==0 %} + {% set itemsize="item-verysmall" %} +{% elseif modedesktop==1 %} + {% set itemsize="item-small" %} +{% elseif modedesktop==2 %} + {% set itemsize="item-medium" %} +{% elseif modedesktop==3 %} + {% set itemsize="item-large" %} +{% elseif modedesktop==4 %} + {% set itemsize="item-list" %} +{% endif %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + + +{% set colorbodyfont = "" %} +{% if entity.colorbodyfont is not null %} + {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} +{% endif %} + + +
    +
    + {% if canadd %} + + {% endif %} + + {% if canupdate %} + + + {% endif %} + + {% if canadd and access!="admin"%} + + {% endif %} +
    + + {%if widgethaveheader %} +
    + + {{ entity.name }} +
    + {%endif%} + +
    + {% set havemenu=false %} + {% set havebookmark=false %} + + {% if menu and withbookmark!= 2 and bookmarks is not empty and itemcategorys|length > 1 %} + {% set havemenu=true %} +
    + {% if menuall %} +
    Tout
    + {% endif %} + + {% if bookmarks is not empty %} +
    + {% endif %} + + {% for itemcategory in itemcategorys %} +
    {{itemcategory.label}}
    + {% endfor %} +
    + {% endif %} + + {% if search %} + {% set havemenu=true %} +
    +
    +   +
    + +
    + {% endif %} + + {% if (bookmarks is not empty or canadd ) and (withbookmark==0 or withbookmark==2) %} + {% if withbookmark==0 and itemcategorys|length > 1 %} +

    Favoris

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

    {{ bookmarktitle }}

    +
    {{ bookmarksubtitle|nl2br }}
    +
    +
    + +
    + {% if bookmarkcontent %} + + {% endif %} +
    +
    + +
    {{ bookmarkcontent|raw }}
    +
    +
    + {% endfor %} + + {% if (canadd) %} + + {% endif %} +
    + {% endif %} + + {% for itemcategory in itemcategorys %} + {% if itemcategorys|length > 1 or havebookmark %}

    {{itemcategory.label}}

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

    {{ item.title }}

    +
    {{ item.subtitle|nl2br }}
    +
    +
    + +
    + {% if canadd %} + + {% endif %} + + {% if item.content %} + + {% endif %} +
    +
    + +
    {{ item.content|raw }}
    +
    +
    + {% endif %} + {% endfor %} +
    + {% endfor %} + + + +
    +
    + + diff --git a/templates/Pagewidget/viewitemessential.html.twig b/templates/Pagewidget/viewitemessential.html.twig new file mode 100644 index 0000000..85c7a5d --- /dev/null +++ b/templates/Pagewidget/viewitemessential.html.twig @@ -0,0 +1,249 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set colormain = constants.mycolormain() %} +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} + + +{% if modedesktop==0 %} + {% set stylegrid="" %} +{% elseif modedesktop==1 %} + {% set stylegrid="grid-medium" %} +{% elseif modedesktop==2 %} + {% set stylegrid="grid-small" %} +{% elseif modedesktop==3 %} + {% set stylegrid="grid-list" %} +{% endif %} + +{% set colorbodyfont = "" %} +{% if entity.colorbodyfont is not null %} + {% set colorbodyfont = "color: #" ~ entity.colorbodyfont %} +{% endif %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canadd %} + + {% endif %} + + {% if canupdate %} + + + {% endif %} + + {% if canadd and access!="config"%} + + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% if canadd or bookmarks is not empty or items is not empty %} +
    +
    +
    +
    + + {% for bookmark in bookmarks %} + {% if bookmark.item %} + + {%else%} + + {%endif%} + {% endfor %} + + + {% for item in items %} + + {% endfor %} + + {% if canadd %} + + {% endif %} +
    +
    + {% endif %} +
    +{% endif %} + + diff --git a/templates/Pagewidget/viewlink.html.twig b/templates/Pagewidget/viewlink.html.twig new file mode 100644 index 0000000..fc2903f --- /dev/null +++ b/templates/Pagewidget/viewlink.html.twig @@ -0,0 +1,22 @@ +{% set onlyheader=true %} +{% extends 'widget.html.twig' %} + +{% block widgetheader %} + {% if target == 'frame' %} + + {% elseif target == "_self" %} + + {% else %} + + {% endif %} + {% if entity.icon %} + + {% else %} + + {% endif %} + +
    {{ entity.name }}
    +
    +{% endblock %} + + diff --git a/templates/Pagewidget/viewonlydoc.html.twig b/templates/Pagewidget/viewonlydoc.html.twig new file mode 100644 index 0000000..47a4993 --- /dev/null +++ b/templates/Pagewidget/viewonlydoc.html.twig @@ -0,0 +1,76 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} + +{% set color = app.session.get('color') %} + +{% set colorbodyback = entity.colorbodyback %} +{% if colorbodyback is null %} + {% set colorbodyback = color['main'] %} +{% endif %} + + +{% set colorbodyfont = entity.colorbodyfont %} +{% if entity.border and colorbodyfont is null %} + {% set colorbodyfont = color['fontcolorhover'] %} +{% endif %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['main'] %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + + + +
    +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewproject.html.twig b/templates/Pagewidget/viewproject.html.twig new file mode 100644 index 0000000..7e9d80c --- /dev/null +++ b/templates/Pagewidget/viewproject.html.twig @@ -0,0 +1,133 @@ +{% import "Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %} + + + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if access=="config" %} + + {% elseif app.user %} + {% set idproject = "" %} + {% set urladd= path('app_user_projecttask_submit') %} + {% set urlview= path('app_user_project_view') %} + {% if usage=="group" and firstproject is defined %} + {% set urladd= path('app_user_projecttask_submit',{idproject:firstproject,page:entity.page.id}) %} + {% set urlview= path('app_user_project_view',{id:firstproject}) %} + {% endif %} + + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + + {% if projecttasks|length >= 1 %} + + {% endif %} +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewseparator.html.twig b/templates/Pagewidget/viewseparator.html.twig new file mode 100644 index 0000000..8f30d55 --- /dev/null +++ b/templates/Pagewidget/viewseparator.html.twig @@ -0,0 +1,63 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} +{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} + +{% set color = app.session.get('color') %} +{% set colorbodyfont = entity.colorbodyfont %} +{% if colorbodyfont is null %} + {% set colorbodyfont = color['main'] %} +{% endif %} + +{%if not mini %} +
    + {% if canupdate %} +
    + + +
    + {% endif %} + + +
    + {% if seeicon %} + {% if entity.icon %} + + {% else %} + + {% endif %} + {% endif %} + + {% if seetitle %} + {{ entity.name }} + {% else %} + +
    + {% endif %} +
    +
    +{% endif %} + + + diff --git a/templates/Pagewidget/viewslide.html.twig b/templates/Pagewidget/viewslide.html.twig new file mode 100644 index 0000000..e73952c --- /dev/null +++ b/templates/Pagewidget/viewslide.html.twig @@ -0,0 +1,95 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} +{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} + +{% set color = app.session.get('color') %} +{% set stylelink = "color:#" ~ entity.colorheaderfont ~ ";" %} +{% if entity.colorheaderfont is null %} + {% set stylelink = "color:#" ~ color['fontcolorhover'] ~ ";" %} +{% endif %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + + {% if canadd %} + + {% endif %} + + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + +
    + {% set intervalmilli = interval * 1000 %} +
    + {% for slide in slides %} +
    + + {% if slide.title is not empty %} +

    {{slide.title}}

    + {% endif %} + + {% if slide.url is not empty %} + {% if slide.target == 'frame' %} + + {% elseif slide.target == "_self" %} + + {% else %} + + {% endif %} + + + {% endif %} + + {% if slide.subtitle is not empty %} + {{slide.subtitle}} + {% endif %} + + + +
    + + {% endfor %} +
    +
    +
    +{% endif %} + + + + diff --git a/templates/Pagewidget/viewurl.html.twig b/templates/Pagewidget/viewurl.html.twig new file mode 100644 index 0000000..53e31ea --- /dev/null +++ b/templates/Pagewidget/viewurl.html.twig @@ -0,0 +1,86 @@ +{% set theme = app.session.get('theme') %} +{% if theme is not empty %} + {{ include('@Theme/'~theme~'/function.html.twig') }} +{% endif %} + +{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %} + +{% set stylewidget = constants.mystylewidget(entity) %} +{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %} +{% set stylewidgetheader = constants.mystylewidgetheader(entity) %} +{% set stylewidgetbodyframe = constants.mystylewidgetbodyframe(entity) %} +{% set stylewidgetbodyimage = constants.mystylewidgetbodyimage(entity) %} + +{% if app.user %} + {% set username = app.user.username %} +{% else %} + {% set username = "" %} +{% endif %} + +{%if mini %} + +{% else %} +
    +
    + {% if canupdate %} + + + {% endif %} + {% if look=="list" %} + + {% else %} + + {% endif %} +
    + + + {% if imagemedia %} + {% if entity.autoajust %} +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    +
    + +
    + {% else %} +
    + {% endif %} + {% else %} +
    + {% if entity.icon %} + + {% else %} + + {% endif %} + {{ entity.name }} +
    + +
    + {% set minheight="" %} + {%if look=="list" %} + {% set minheight="min-height:1300px;" %} + {% endif %} + +
    + {% endif %} +
    +{% endif %} + + diff --git a/templates/Pagewidget/widgetheader.html.twig b/templates/Pagewidget/widgetheader.html.twig new file mode 100644 index 0000000..8188c93 --- /dev/null +++ b/templates/Pagewidget/widgetheader.html.twig @@ -0,0 +1,91 @@ +{%if not mini %} + {# Récupération des couleurs #} + {% set colorheaderback = entity.colorheaderback %} + {% if colorheaderback is null %} + {% set colorheaderback = "var(--colorbgbodydark)" %} + {% endif %} + + {% set colorheaderfont = entity.colorheaderfont %} + {% if colorheaderfont is null %} + {% set colorheaderfont = "var(--colorftbodydark)" %} + {% endif %} + + {% set colorbodyback = entity.colorbodyback %} + {% if colorbodyback is null %} + {% set colorbodyback = "var(--colorbgbodydark)" %} + {% endif %} + + {% set colorbodyfont = entity.colorbodyfont %} + {% if colorbodyfont is null %} + {% set colorbodyfont = "var(--colorftbodydark)" %} + {% endif %} + + {% if not entity.border %} + {% set colorbodyback = "var(--colorbgbodylight)" %} + {% set colorbodyfont = "var(--colorftbodylight)" %} + {% endif %} + + + {# Definition style widget #} + {% set widgetheight = "" %} + {% if not entity.autoajust %} + {% set widgetheight = "height: " ~ entity.height ~ "px; " %} + {% endif %} + + {# Definition style widgetheader #} + {% set widgetheaderback = "background-color:"~colorheaderback~";" %} + {% set widgetheaderfont = "color:"~colorheaderfont~";" %} + + {% set widgetheaderborder = "" %} + {% if entity.border %} + {% set widgetheaderborder = "border:1px solid " ~ colorheaderback ~ "; " %} + {% endif %} + + {# Definition style widgetbody #} + {% set widgetbodyback = "background-color:"~colorbodyback~";" %} + {% set widgetbodyfont = "color:"~colorbodyfont~";" %} + + {% set widgetbodyborder = "" %} + {% if entity.border %} + {% set widgetbodyborder = "border:1px solid " ~ colorbodyback ~ "; " %} + {% endif %} + + {% set widgetbodypadding = "" %} + {% if entity.border %} + {% set widgetbodypadding = "padding:10px;" %} + {% endif %} + + {% set widgetbodydisplay = "" %} + {% if not entity.opened %} + {% set widgetbodydisplay = "display:none;" %} + {% endif %} + + {% set stylewidgetbodyreverse = widgetheaderback~widgetheaderfont %} + + +
    +
    + {{ widgetmenu|raw }} +
    + +
    + {% if icon %} + + {% else %} + + {% endif %} + {{ title }} +
    + +
    +{% endif %} \ No newline at end of file diff --git a/templates/Pagewidget/widgetmini.html.twig b/templates/Pagewidget/widgetmini.html.twig new file mode 100644 index 0000000..dcdfb2e --- /dev/null +++ b/templates/Pagewidget/widgetmini.html.twig @@ -0,0 +1,13 @@ +{%if mini %} + +{% endif %} \ No newline at end of file