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

This commit is contained in:
afornerot 2023-01-12 16:14:31 +01:00
parent f5d1995040
commit cdf7c5a24c
72 changed files with 10635 additions and 1013 deletions

View File

@ -84,6 +84,6 @@ function resize() {
$("main").css("height",$(window).height()-$(".header").height()); $("main").css("height",$(window).height()-$(".header").height());
$("#page").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());
} }

View File

@ -232,6 +232,10 @@ border-width: 1px;
/* ITEM */ /* ITEM */
.itemframe {
width: 100%
}
.items-list { .items-list {
display:flex; display:flex;
flex-wrap: wrap; flex-wrap: wrap;
@ -243,7 +247,7 @@ border-width: 1px;
text-align: center; text-align: center;
justify-content: center; justify-content: center;
margin-right:5px; margin-right:5px;
margin-bottom:5px; margin-top:5px;
flex-wrap: wrap; flex-wrap: wrap;
color: var(--colorftbodydark) !important; color: var(--colorftbodydark) !important;
} }
@ -395,6 +399,7 @@ border-width: 1px;
.item-list { .item-list {
width:100%; width:100%;
justify-content: left; justify-content: left;
margin-right: 0px;
} }
.item-list .item-container { .item-list .item-container {

View File

@ -997,4 +997,647 @@ app_admin_itemcategory_delete:
app_admin_itemcategory_order: app_admin_itemcategory_order:
path: /admin/itemcategory/order path: /admin/itemcategory/order
controller: App\Controller\ItemcategoryController::order controller: App\Controller\ItemcategoryController::order
defaults: { access: admin } 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 }

View File

@ -266,4 +266,12 @@ services:
arguments: ["%kernel.project_dir%","%minioUrl%","%minioKey%","%minioSecret%","%minioBucket%","%minioRoot%","%minioPathstyle%","%minioSecure%","%kernel.environment%"] arguments: ["%kernel.project_dir%","%minioUrl%","%minioKey%","%minioSecret%","%minioBucket%","%minioRoot%","%minioPathstyle%","%minioSecure%","%kernel.environment%"]
App\Controller\RestController: App\Controller\RestController:
public: true 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 }

View File

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230111095833 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE 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');
}
}

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230112085854 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE 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');
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,9 @@ use App\Entity\Cron;
use App\Entity\Group; use App\Entity\Group;
use App\Entity\Icon; use App\Entity\Icon;
use App\Entity\Niveau01; use App\Entity\Niveau01;
use App\Entity\Pagecategory;
use App\Entity\User; use App\Entity\User;
use App\Entity\Widget;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Id\AssignedGenerator; use Doctrine\ORM\Id\AssignedGenerator;
use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\ClassMetadata;
@ -54,10 +56,29 @@ class InitCommand extends Command
$this->writeln('APP = Default Data'); $this->writeln('APP = Default Data');
// On s'assure que le groupe tout le monde existe
$metadata = $this->em->getClassMetaData('App\Entity\Group'); $metadata = $this->em->getClassMetaData('App\Entity\Group');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator()); $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']); $group = $this->em->getRepository('App\Entity\Group')->findOneBy(['id' => '-1']);
if (!$group) { if (!$group) {
$group = new Group(); $group = new Group();
@ -71,9 +92,6 @@ class InitCommand extends Command
} }
// On s'assure qu'il exite un niveau01 // 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']); $niveau01 = $this->em->getRepository('App\Entity\Niveau01')->findOneBy(['id' => '-1']);
if (!$niveau01) { if (!$niveau01) {
$niveau01 = new Niveau01(); $niveau01 = new Niveau01();
@ -85,9 +103,6 @@ class InitCommand extends Command
} }
// On s'assure que le user admin existe // 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']); $user = $this->em->getRepository('App\Entity\User')->findOneBy(['id' => '-1']);
if (!$user) { if (!$user) {
$user = new User(); $user = new User();
@ -116,6 +131,7 @@ class InitCommand extends Command
} }
} }
// == CONFIG ==============================================================================================================================================
// colorbgbody = Couleur des fonds de page // colorbgbody = Couleur des fonds de page
$this->insertConfig( $this->insertConfig(
1, // order 1, // order
@ -437,7 +453,8 @@ class InitCommand extends Command
'', // grouped '', // grouped
'Image de fond de la bannière' 'Image de fond de la bannière'
); );
$output->writeln('');
// == CRON ================================================================================================================================================
// Job synchronisation des comptes utilisateur // Job synchronisation des comptes utilisateur
// Toute les 24h à 3h00 // Toute les 24h à 3h00
@ -469,6 +486,8 @@ class InitCommand extends Command
$this->em->flush(); $this->em->flush();
// == ICON ================================================================================================================================================
$finder = new Finder(); $finder = new Finder();
$finder->in('public/medias/icon/'); $finder->in('public/medias/icon/');
$finder->name('icon_*'); $finder->name('icon_*');
@ -483,11 +502,108 @@ class InitCommand extends Command
} }
$this->em->flush(); $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(''); $output->writeln('');
return Command::SUCCESS; return Command::SUCCESS;
} }
// == FUNCTIONS ===========================================================================================================================================
private function insertConfig($order, $category, $id, $title, $value, $default, $type, $visible, $changeable, $required, $grouped, $help) private function insertConfig($order, $category, $id, $title, $value, $default, $type, $visible, $changeable, $required, $grouped, $help)
{ {
$entity = $this->em->getRepository("App\Entity\Config")->find($id); $entity = $this->em->getRepository("App\Entity\Config")->find($id);

View File

@ -0,0 +1,341 @@
<?php
namespace App\Controller;
use App\Entity\Bookmark;
use App\Form\BookmarkType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class BookmarkController extends AbstractController
{
private $data = 'bookmark';
private $entity = "App\Entity\Bookmark";
private $twig = 'bookmark/';
private $route = 'app_admin_bookmark';
public function submitAction(Request $request, $idpage, $idwidget, $touser, $access = 'config')
{
$usage = $request->query->get('usage');
$group = $request->query->get('group');
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Bookmark();
// On s'assure que le widget existe
$pagewidget = null;
if ('false' == $touser) {
$pagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find($idwidget);
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<br><a href='".$data->getUrl()."' target='_blank'>".$data->getTitle().'</a>';
$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<br><a href='".$data->getUrl()."' target='_blank'>".$data->getTitle().'</a>';
$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());
}
}
}
}

View File

@ -2,22 +2,21 @@
namespace App\Controller; namespace App\Controller;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Doctrine\Persistence\ManagerRegistry;
class HomeController extends AbstractController 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()) { if ($request->getSession()->get('fgforceconnect') && !$this->getUser()) {
return $this->redirectToRoute('app_login'); return $this->redirectToRoute('app_login');
} }
$em->getRepository("App\Entity\Item")->getUserItems($this->getUser(),$bookmarks,$items,$itemscategorys); $em->getRepository("App\Entity\Item")->getUserItems($this->getUser(), $bookmarks, $items, $itemscategorys);
dump($items);
dump($itemscategorys);
return $this->render('Home/page.html.twig', [ return $this->render('Home/page.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,

View File

@ -59,7 +59,7 @@ class ItemController extends AbstractController
$data = new Item(); $data = new Item();
// Création du formulaire // 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 // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -102,7 +102,7 @@ class ItemController extends AbstractController
} }
// Création du formulaire // 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 // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
@ -169,11 +169,13 @@ class ItemController extends AbstractController
} }
$data->setRoworder($order); $data->setRoworder($order);
$itemcategory=$em->getRepository("App\Entity\Itemcategory")->find($categoryid); $itemcategory = $em->getRepository("App\Entity\Itemcategory")->find($categoryid);
if($itemcategory) $data->setItemcategory($itemcategory); if ($itemcategory) {
$data->setItemcategory($itemcategory);
}
$em->getManager()->flush(); $em->getManager()->flush();
return new JsonResponse($output); return new JsonResponse($output);
} }
} }

View File

@ -2,14 +2,13 @@
namespace App\Controller; 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\Entity\Itemcategory;
use App\Form\ItemcategoryType; 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 class ItemcategoryController extends AbstractController
{ {
@ -60,34 +59,33 @@ class ItemcategoryController extends AbstractController
if (!$data) { if (!$data) {
throw $this->createNotFoundException('Unable to find entity.'); throw $this->createNotFoundException('Unable to find entity.');
} }
// Création du formulaire // 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 // Récupération des data du formulaire
$form->handleRequest($request); $form->handleRequest($request);
// Sur validation // Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
// Sauvegarde // Sauvegarde
$em->getManager()->flush(); $em->getManager()->flush();
// Retour à la liste // Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item')); return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item'));
} }
// Affichage du formulaire // Affichage du formulaire
return $this->render($this->twig.'edit.html.twig', [ return $this->render($this->twig.'edit.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => true, 'usesidebar' => true,
'access' => $access, 'access' => $access,
$this->data => $data, $this->data => $data,
'mode' => 'update', 'mode' => 'update',
'form' => $form->createView() 'form' => $form->createView(),
]); ]);
} }
@ -108,7 +106,7 @@ class ItemcategoryController extends AbstractController
return $this->redirectToRoute($this->route.'_update', ['id' => $id]); return $this->redirectToRoute($this->route.'_update', ['id' => $id]);
} }
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item')); return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', 'app_admin_item'));
} }
@ -126,6 +124,6 @@ class ItemcategoryController extends AbstractController
$data->setRoworder($order); $data->setRoworder($order);
$em->getManager()->flush(); $em->getManager()->flush();
return new JsonResponse($output); return new JsonResponse($output);
} }
} }

View File

@ -0,0 +1,322 @@
<?php
namespace App\Controller;
use App\Entity\Page;
use App\Form\PagetemplateSubmitType;
use App\Form\PageUpdateWidgetType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PagetemplateController extends AbstractController
{
private $data = 'page';
private $entity = "App\Entity\Page";
private $twig = 'Pagetemplate/';
private $route = 'app_admin_pagetemplate';
public function list($access): Response
{
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'access' => $access,
]);
}
public function tablelist($access, Request $request, ManagerRegistry $em): Response
{
$query = $request->query->all();
$start = $query['start'];
$length = $query['length'];
$search = $query['search'];
$draw = $query['draw'];
$ordercolumn = $query['order'][0]['column'];
$orderdir = $query['order'][0]['dir'];
// Query de base
$qbase = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
$qsearch = $em->getManager()->createQueryBuilder()->from($this->entity, 'table');
$qbase->where('table.user is null');
$qbase->andWhere('table.parentfor is not null');
$qsearch->where('table.user is null');
$qsearch->andWhere('table.parentfor is not null');
$qsearch->andwhere('table.id LIKE :value OR table.name LIKE :value OR table.parentfor LIKE :value');
$qsearch->setParameter('value', '%'.$search['value'].'%');
// Nombre total d'enregistrement
$total = $qbase->select('COUNT(table)')->getQuery()->getSingleScalarResult();
// Nombre d'enregistrement filtré
if ('' == $search['value']) {
$totalf = $total;
} else {
$totalf = $qsearch->select('COUNT(table)')->getQuery()->getSingleScalarResult();
}
// Parcours des Enregistrement
if ('' == $search['value']) {
$qb = $qbase->select('table');
} else {
$qb = $qsearch->select('table');
}
// Order
if ($ordercolumn) {
switch ($ordercolumn) {
case 1:
$qb->orderBy('table.roworder', $orderdir);
break;
case 2:
$qb->orderBy('table.name', $orderdir);
break;
case 3:
$qb->orderBy('table.parentfor', $orderdir);
break;
}
}
// Execution de la requete d'affichage
$datas = $qb->setFirstResult($start)->setMaxResults($length)->getQuery()->getResult();
// Construction du tableau de retour
$output = [
'draw' => $draw,
'recordsFiltered' => $totalf,
'recordsTotal' => $total,
'data' => [],
];
foreach ($datas as $data) {
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
$action = '';
$action .= "<a href='".$this->generateUrl($route.'_update', ['id' => $data->getId()])."'><i class='fa fa-cog fa-fw fa-2x'></i></a>";
$action .= "<a href='".$this->generateUrl($route.'_view', ['id' => $data->getId()])."'><i class='fa fa-eye fa-fw fa-2x'></i></a>";
array_push($output['data'], [
$action,
$data->getRoworder(),
$data->getName(),
$data->getParentfor(),
]);
}
// Retour
return new Response(json_encode($output), 200);
}
private function entityForm(Page $entity, $access, $em)
{
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
if ($em->getManager()->contains($entity)) {
return $this->createForm(PageUpdateWidgetType::class, $entity, [
'mode' => 'update',
'access' => $access,
'for' => $entity->getParentfor(),
]);
} else {
return $this->createForm(PagetemplateSubmitType::class, $entity, [
'mode' => 'update',
'access' => $access,
]);
}
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
$pagecategory = $em->getRepository("App\Entity\Pagecategory")->find(2);
$data = new Page();
$data->setMaxwidth(0);
$data->setRoworder(0);
$data->setParentfor('user');
$data->setPagecategory($pagecategory);
$form = $this->entityForm($data, $access, $em);
$form->handleRequest($request);
// Sur erreur
if ('app' == $data->getParentfor()) {
$tmp = $em->getRepository($this->entity)->findOneBy(['parentfor' => 'app']);
if ($tmp) {
$form->addError(new FormError("Il ne peut avoir qu'un seul template de type Application"));
}
}
$data = $form->getData();
if ($form->get('submit')->isClicked() && $form->isValid()) {
// Sauvegarde
$em->getManager()->persist($data);
$em->getManager()->flush();
$route = str_replace('_admin_', '_'.$access.'_', $this->route);
return $this->redirect($this->generateUrl($route.'_update', ['id' => $data->getId()]));
}
return $this->render('Pagetemplate\submit.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
$this->data => $data,
'mode' => 'submit',
'access' => $access,
'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());
}
}
}
}

View File

@ -0,0 +1,1799 @@
<?php
namespace App\Controller;
use App\Entity\Pagewidget;
use App\Form\PagewidgetType;
use Doctrine\Persistence\ManagerRegistry;
use GuzzleHttp\Exception\RequestException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class PagewidgetController extends AbstractController
{
private $data = 'pagewidget';
private $labelentity = "App\Entity\Pagewidget";
private $twig = 'Pagewidget/';
private $route = 'app_admin_pagewidget';
private $em;
private $user;
private $entity;
private $page;
private $id;
private $access;
private $look;
private $mini;
private $selwidget;
private $usage;
private $group;
private $cansee;
private $canupdate;
private $canadd;
private function searchArray($array, $key, $value)
{
$results = [];
if (is_array($array)) {
if (isset($array[$key]) && $array[$key] == $value) {
$results[] = $array;
}
foreach ($array as $subarray) {
$results = array_merge($results, $this->searchArray($subarray, $key, $value));
}
}
return $results;
}
private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access = '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 .= '&notsondednma=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('&para;', '', $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, '<img');
if (false !== $imgstart) {
$imgend = 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('&para;', '', $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, '<img');
if (false !== $imgstart) {
$imgend = 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 = '<strong>Description</strong><br>'.$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<br>'.$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,
]);
}
}

View File

@ -80,6 +80,11 @@ class Group
*/ */
private $owner; private $owner;
/**
* @ORM\ManyToOne(targetEntity="Page", inversedBy="templategroups")
*/
private $pagetemplate;
/** /**
* @var ArrayCollection * @var ArrayCollection
* @var UserGroup * @var UserGroup
@ -322,4 +327,16 @@ class Group
return $this; return $this;
} }
public function getPagetemplate(): ?Page
{
return $this->pagetemplate;
}
public function setPagetemplate(?Page $pagetemplate): self
{
$this->pagetemplate = $pagetemplate;
return $this;
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -71,6 +72,13 @@ class Pagewidget
*/ */
protected $opened; protected $opened;
/**
* @var bool
*
* @ORM\Column(name="viewheader", type="boolean", options={"default":true})
*/
protected $viewheader;
/** /**
* @var string * @var string
* *
@ -138,6 +146,12 @@ class Pagewidget
*/ */
private $slides; private $slides;
public function __construct()
{
$this->bookmarks = new ArrayCollection();
$this->slides = new ArrayCollection();
}
// A garder pour forcer l'id en init // A garder pour forcer l'id en init
public function setId($id) public function setId($id)
{ {
@ -146,457 +160,260 @@ class Pagewidget
return $this; return $this;
} }
/** public function getId(): ?int
* 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()
{ {
return $this->id; return $this->id;
} }
/** public function getName(): ?string
* Set name. {
* return $this->name;
* @param string $name }
*
* @return Pagewidget public function setName(string $name): self
*/
public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
/** public function getLoc(): ?string
* Get name.
*
* @return string
*/
public function getName()
{ {
return $this->name; return $this->loc;
} }
/** public function setLoc(string $loc): self
* Set loc.
*
* @param string $loc
*
* @return Pagewidget
*/
public function setLoc($loc)
{ {
$this->loc = $loc; $this->loc = $loc;
return $this; return $this;
} }
/** public function getRoworder(): ?int
* Get loc.
*
* @return string
*/
public function getLoc()
{ {
return $this->loc; return $this->roworder;
} }
/** public function setRoworder(int $roworder): self
* Set roworder.
*
* @param int $roworder
*
* @return Pagewidget
*/
public function setRoworder($roworder)
{ {
$this->roworder = $roworder; $this->roworder = $roworder;
return $this; return $this;
} }
/** public function getHeight(): ?int
* 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()
{ {
return $this->height; return $this->height;
} }
/** public function setHeight(int $height): self
* Set autoajust.
*
* @param bool $autoajust
*
* @return Pagewidget
*/
public function setAutoajust($autoajust)
{ {
$this->autoajust = $autoajust; $this->height = $height;
return $this; 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 public function isAutoajust(): ?bool
{ {
return $this->autoajust; return $this->autoajust;
} }
public function setAutoajust(bool $autoajust): self
{
$this->autoajust = $autoajust;
return $this;
}
public function isBorder(): ?bool public function isBorder(): ?bool
{ {
return $this->border; return $this->border;
} }
public function setBorder(bool $border): self
{
$this->border = $border;
return $this;
}
public function isOpened(): ?bool public function isOpened(): ?bool
{ {
return $this->opened; return $this->opened;
} }
public function setOpened(bool $opened): self
{
$this->opened = $opened;
return $this;
}
public function isViewheader(): ?bool
{
return $this->viewheader;
}
public function setViewheader(bool $viewheader): self
{
$this->viewheader = $viewheader;
return $this;
}
public function getColorheaderback(): ?string
{
return $this->colorheaderback;
}
public function setColorheaderback(?string $colorheaderback): self
{
$this->colorheaderback = $colorheaderback;
return $this;
}
public function getColorheaderfont(): ?string
{
return $this->colorheaderfont;
}
public function setColorheaderfont(?string $colorheaderfont): self
{
$this->colorheaderfont = $colorheaderfont;
return $this;
}
public function getColorbodyback(): ?string
{
return $this->colorbodyback;
}
public function setColorbodyback(?string $colorbodyback): self
{
$this->colorbodyback = $colorbodyback;
return $this;
}
public function getColorbodyfont(): ?string
{
return $this->colorbodyfont;
}
public function setColorbodyfont(?string $colorbodyfont): self
{
$this->colorbodyfont = $colorbodyfont;
return $this;
}
public function getParameter(): array
{
return $this->parameter;
}
public function setParameter(?array $parameter): self
{
$this->parameter = $parameter;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
$this->page = $page;
return $this;
}
public function getWidget(): ?Widget
{
return $this->widget;
}
public function setWidget(?Widget $widget): self
{
$this->widget = $widget;
return $this;
}
public function getIcon(): ?Icon
{
return $this->icon;
}
public function setIcon(?Icon $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Bookmark>
*/
public function getBookmarks(): Collection
{
return $this->bookmarks;
}
public function addBookmark(Bookmark $bookmark): self
{
if (!$this->bookmarks->contains($bookmark)) {
$this->bookmarks->add($bookmark);
$bookmark->setPagewidget($this);
}
return $this;
}
public function removeBookmark(Bookmark $bookmark): self
{
if ($this->bookmarks->removeElement($bookmark)) {
// set the owning side to null (unless already changed)
if ($bookmark->getPagewidget() === $this) {
$bookmark->setPagewidget(null);
}
}
return $this;
}
/**
* @return Collection<int, Slide>
*/
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;
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -79,6 +80,13 @@ class Widget
*/ */
protected $opened; protected $opened;
/**
* @var bool
*
* @ORM\Column(name="viewheader", type="boolean", options={"default":true})
*/
protected $viewheader;
/** /**
* @var string * @var string
* *
@ -135,6 +143,11 @@ class Widget
*/ */
private $pagewidgets; private $pagewidgets;
public function __construct()
{
$this->pagewidgets = new ArrayCollection();
}
// A garder pour forcer l'id en init // A garder pour forcer l'id en init
public function setId($id) public function setId($id)
{ {
@ -143,426 +156,230 @@ class Widget
return $this; return $this;
} }
/** public function getId(): ?int
* Constructor.
*/
public function __construct()
{
$this->pagewidgets = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Get id.
*
* @return int
*/
public function getId()
{ {
return $this->id; return $this->id;
} }
/** public function getRoworder(): ?int
* Set roworder. {
* return $this->roworder;
* @param int $roworder }
*
* @return Widget public function setRoworder(int $roworder): self
*/
public function setRoworder($roworder)
{ {
$this->roworder = $roworder; $this->roworder = $roworder;
return $this; return $this;
} }
/** public function getName(): ?string
* Get roworder.
*
* @return int
*/
public function getRoworder()
{ {
return $this->roworder; return $this->name;
} }
/** public function setName(string $name): self
* Set name.
*
* @param string $name
*
* @return Widget
*/
public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
/** public function getDescription(): ?string
* Get name.
*
* @return string
*/
public function getName()
{ {
return $this->name; return $this->description;
} }
/** public function setDescription(?string $description): self
* Set description.
*
* @param string $description
*
* @return Widget
*/
public function setDescription($description)
{ {
$this->description = $description; $this->description = $description;
return $this; return $this;
} }
/** public function getRouteview(): ?string
* Get description.
*
* @return string
*/
public function getDescription()
{ {
return $this->description; return $this->routeview;
} }
/** public function setRouteview(string $routeview): self
* Set routeview.
*
* @param string $routeview
*
* @return Widget
*/
public function setRouteview($routeview)
{ {
$this->routeview = $routeview; $this->routeview = $routeview;
return $this; return $this;
} }
/** public function getHeight(): ?int
* 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()
{ {
return $this->height; return $this->height;
} }
/** public function setHeight(int $height): self
* Set autoajust.
*
* @param bool $autoajust
*
* @return Widget
*/
public function setAutoajust($autoajust)
{ {
$this->autoajust = $autoajust; $this->height = $height;
return $this; 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 public function isAutoajust(): ?bool
{ {
return $this->autoajust; return $this->autoajust;
} }
public function setAutoajust(bool $autoajust): self
{
$this->autoajust = $autoajust;
return $this;
}
public function isBorder(): ?bool public function isBorder(): ?bool
{ {
return $this->border; return $this->border;
} }
public function setBorder(bool $border): self
{
$this->border = $border;
return $this;
}
public function isOpened(): ?bool public function isOpened(): ?bool
{ {
return $this->opened; return $this->opened;
} }
public function setOpened(bool $opened): self
{
$this->opened = $opened;
return $this;
}
public function isViewheader(): ?bool
{
return $this->viewheader;
}
public function setViewheader(bool $viewheader): self
{
$this->viewheader = $viewheader;
return $this;
}
public function getColorheaderback(): ?string
{
return $this->colorheaderback;
}
public function setColorheaderback(?string $colorheaderback): self
{
$this->colorheaderback = $colorheaderback;
return $this;
}
public function getColorheaderfont(): ?string
{
return $this->colorheaderfont;
}
public function setColorheaderfont(?string $colorheaderfont): self
{
$this->colorheaderfont = $colorheaderfont;
return $this;
}
public function getColorbodyback(): ?string
{
return $this->colorbodyback;
}
public function setColorbodyback(?string $colorbodyback): self
{
$this->colorbodyback = $colorbodyback;
return $this;
}
public function getColorbodyfont(): ?string
{
return $this->colorbodyfont;
}
public function setColorbodyfont(?string $colorbodyfont): self
{
$this->colorbodyfont = $colorbodyfont;
return $this;
}
public function getAccess(): array
{
return $this->access;
}
public function setAccess(?array $access): self
{
$this->access = $access;
return $this;
}
public function getParameter(): array
{
return $this->parameter;
}
public function setParameter(?array $parameter): self
{
$this->parameter = $parameter;
return $this;
}
public function getIcon(): ?Icon
{
return $this->icon;
}
public function setIcon(?Icon $icon): self
{
$this->icon = $icon;
return $this;
}
/**
* @return Collection<int, Pagewidget>
*/
public function getPagewidgets(): Collection
{
return $this->pagewidgets;
}
public function addPagewidget(Pagewidget $pagewidget): self
{
if (!$this->pagewidgets->contains($pagewidget)) {
$this->pagewidgets->add($pagewidget);
$pagewidget->setWidget($this);
}
return $this;
}
public function removePagewidget(Pagewidget $pagewidget): self
{
if ($this->pagewidgets->removeElement($pagewidget)) {
// set the owning side to null (unless already changed)
if ($pagewidget->getWidget() === $this) {
$pagewidget->setWidget(null);
}
}
return $this;
}
} }

View File

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

View File

@ -1,21 +1,12 @@
<?php <?php
namespace App\Form; namespace App\Form;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ItemcategoryType extends AbstractType class ItemcategoryType extends AbstractType
{ {
@ -37,10 +28,10 @@ class ItemcategoryType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'App\Entity\Itemcategory', 'data_class' => 'App\Entity\Itemcategory',
'mode' => "string", 'mode' => 'string',
'access' => 'string', 'access' => 'string',
)); ]);
} }
} }

View File

@ -0,0 +1,113 @@
<?php
namespace App\Form;
use App\Form\Type\FaChoiceType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
class PageUpdateWidgetType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('roworder', IntegerType::class, [
'label' => 'Ordre',
])
->add('fonticon', FaChoiceType::class, [
'label' => 'Icône',
'required' => false,
])
->add('maxwidth', IntegerType::class, [
'label' => "Largeur maximum (0 pour largeur de l'écran)",
])
->add('template', HiddenType::class, [
'label' => 'Template',
'required' => false,
]);
if ('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',
]);
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagetemplateSubmitType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('submit', SubmitType::class, [
'label' => 'Valider',
'attr' => ['class' => 'btn btn-success'],
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('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',
]);
}
}

248
src/Form/PagewidgetType.php Normal file
View File

@ -0,0 +1,248 @@
<?php
namespace App\Form;
use Ivory\CKEditorBundle\Form\Type\CKEditorType;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class PagewidgetType extends AbstractType
{
public $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function buildForm(FormBuilderInterface $builder, array $options)
{
// Ajout des champs commun à tout les widgets
$builder
->add('submit', SubmitType::class, [
'label' => ('delete' == $options['mode'] ? 'Confirmer la Suppression' : 'Valider'),
'attr' => ('delete' == $options['mode'] ? ['class' => 'btn btn-danger'] : ['class' => 'btn btn-success']),
])
->add('name', TextType::class, [
'label' => 'Nom',
])
->add('height', IntegerType::class, [
'label' => 'Hauteur du Widget',
])
->add('border', ChoiceType::class, [
'label' => 'Afficher les Bords',
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('autoajust', ChoiceType::class, [
'label' => 'Ajuster la Hauteur au Contenu',
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('opened', ChoiceType::class, [
'label' => "Afficher le corps du widget à l'ouverture",
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('viewheader', ChoiceType::class, [
'label' => "Afficher l'Entête",
'choices' => ['oui' => '1', 'non' => '0'],
])
->add('colorheaderback', TextType::class, [
'label' => "Couleur de Fond de l'Entête",
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorheaderfont', TextType::class, [
'label' => "Couleur du Texte de l'Entête",
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorbodyback', TextType::class, [
'label' => 'Couleur de Fond du Corps',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('colorbodyfont', TextType::class, [
'label' => 'Couleur du Texte du Corps',
'required' => false,
'attr' => ['class' => 'pick-a-color'],
])
->add('idicon', HiddenType::class, ['mapped' => false, 'data' => $options['idicon']]);
foreach ($options['param']['fields'] as $field) {
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',
]);
}
}

View File

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

View File

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

View File

@ -39,28 +39,13 @@ class WidgetRepository extends ServiceEntityRepository
} }
} }
// /** // getWidgetAccess
// * @return Widget[] Returns an array of Widget objects public function getWidgetAccess($access)
// */ {
// public function findByExampleField($value): array $qb = $this->createQueryBuilder('widget');
// { $qb->where($qb->expr()->like('widget.access', $qb->expr()->literal("%$access%")));
// return $this->createQueryBuilder('w') $widgets = $qb->getQuery()->getResult();
// ->andWhere('w.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('w.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Widget return $widgets;
// { }
// return $this->createQueryBuilder('w')
// ->andWhere('w.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
} }

View File

@ -5,7 +5,7 @@
{# On commence par simplement ajouter le form-group au row de nos formulaires #} {# On commence par simplement ajouter le form-group au row de nos formulaires #}
{% block form_row -%} {% block form_row -%}
{% set attr = attr|merge({'help': (attr.help|default(true)) }) %} {% set attr = attr|merge({'help': (attr.help|default(true)) }) %}
<div class="form-group {{ errors|length > 0 ? 'has-error' : '' }} mt-3"> <div id="groupfield_{{id}}" class="form-group {{ errors|length > 0 ? 'has-error' : '' }} mt-3">
{{- form_label(form) }} {{- form_label(form) }}
{{- form_widget(form) }} {{- form_widget(form) }}
{{ form_errors(form) }} {{ form_errors(form) }}

View File

@ -3,7 +3,7 @@
{% block body %} {% block body %}
<div class="row"> <div class="row">
<div class="col-md-12" style="margin-bottom:15px"> <div class="col-md-12" style="margin-bottom:15px">
<a onclick="window.parent.$('#mymodal').modal('hide');" class="btn btn-secondary">Fermer</a> <a onclick="window.parent.$('#mymodallarge').modal('hide');" class="btn btn-secondary">Fermer</a>
<a href="{{ path('app_'~access~'_icon',{'inframe':true}) }}" class="btn btn-secondary">Gérer les Icônes</a> <a href="{{ path('app_'~access~'_icon',{'inframe':true}) }}" class="btn btn-secondary">Gérer les Icônes</a>
</div> </div>

View File

@ -70,14 +70,20 @@
'name' : 'PORTAIL', 'name' : 'PORTAIL',
'items' : [ 'items' : [
{ {
icon: 'fa fa-bell', icon: 'fa fa-copy fa-fw',
route: 'app_admin_alert', route: 'app_admin_pagetemplate',
name: 'Annonces', name: 'Modèles de Page',
}, },
{ {
icon: 'fa fa-desktop', icon: 'fa fa-desktop',
route: 'app_admin_item', route: 'app_admin_item',
name: 'Items', name: 'Items',
},
{
icon: 'fa fa-bell',
route: 'app_admin_alert',
name: 'Annonces',
}, },
{ {
icon: 'fa fa-bug', icon: 'fa fa-bug',

View File

@ -0,0 +1,334 @@
{% extends '@CadolesCore/base.html.twig' %}
{% set color = app.session.get('color') %}
{% set colormain = color['main'] %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="gridtemplate" style="max-width:1500px; margin:auto; margin-bottom:30px">
<div class="col-md-3">qsdfqsdfqsd</div>
<div class="col-md-9">
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark"">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% 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 %}
<h3 class="grid-title" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% 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('<i style="color: #FFF" class="fa fa-minus" title="Informations sur ce service"></i>');
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('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(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("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>");
resizeFrame();
}
{% endblock %}

View File

@ -0,0 +1,141 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
.thumbnail {
text-align:center;
}
.thumbnail img {
width:200px;
border: 5px solid #fff;
border-radius: 10px;
}
.caption p {
text-align:justify;
font-size:14px;
word-wrap: break-word;
}
.caption ul {
margin-top:-10px;
padding-left: 20px;
}
.caption li {
text-align:left;
font-size:14px;
word-wrap: break-word;
font-style: italic;
}
h3 {
margin-top:10px;
}
{% endblock %}
{% block body %}
<div style="width: 400px;margin: auto;text-align: center;margin-top: 10px;">
<a href="{{ path("app_home") }}">
<img src="/{{ appAlias }}/uploads/logo/{{app.session.get("logolight")}}" style="max-width: 100%; max-height:200px;">
<h1 style="text-transform:uppercase; padding-top:0px">{{ app.session.get('appname') }}</h1>
</a>
<br>
{% if not app.user and moderegistration!="none" and appMasteridentity=="SQL"%}
<a href="{{ path("app_resetpwd01") }}">Mot de passe oublié ?</a>
{% endif %}
</div>
<div class="container row m-auto">
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-01.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Profilé</h3>
<p>Tous les éléments du portail peuvent être distribués en fonction du profil de l'utilisateur.</p>
<p>Il est possible de définir le profil de l'utilisateur en fonction :
<ul>
<li>De son groupe d'appartenance</li>
<li>D'attributs Annuaire</li>
<li>D'attributs SSO</li>
</ul>
</p>
<p>En fonction du profil de l'utilisateur, il est possible de distribuer :
<ul>
<li>Des pages en onglet</li>
<li>Des Flux RSS</li>
<li>Des Annonces</li>
<li>Des Applications Web</li>
<li>Des Calendriers</li>
</ul>
</p>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-02.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Personnalisable</h3>
<p>En fonction de la configuration et de leur profil, les utilisateurs du portail sont libres de créer leur propre page.</p>
<p>Les pages de l'utilisateur pouvant prendre plusieurs formes :
<ul>
<li>Une page pointant sur l'adresse d'un autre site</li>
<li>Une page construite par l'utilisateur via l'utilisation d'un éditeur riche</li>
<li>Une page constituée de widgets qu'il dispose selon son libre choix</li>
</ul>
</p>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-03.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail<br>Evolutif</h3>
<p>Ninegate est évolutif dans le sens où, vous disposerez d'une large bibliothèque de widgets qui composeront vos pages.</p>
<p>Voici quelques exemples :
<ul>
<li>Widget URL</li>
<li>Widget Flux RSS</li>
<li>Widget Editeur de texte</li>
<li>Widget Gestionnaire de tâches</li>
<li>Widget Calendriers</li>
<li>Widget Favoris</li>
<li>Widget Dépôt de Fichiers</li>
<li>Et bien d'autres encore</li>
</ul>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="thumbnail" style="margin-top:10px; border:none; background-color:transparent">
<img class="imgreflect" src="/{{ appAlias }}/images/thumb-04.jpg"/>
<div class="caption">
<h3 style="text-align:center">Portail</br>Open Source</h3>
<p>Ce projet est opensource
<ul>
<li>Vous pouvez à tout moment modifier le code de votre portail</li>
<li>Distribuer {{ app.session.get('appname') }}</li>
</ul>
</p>
<p>Ninegate est développé dans le cadre du projet <a href='https://envole.ac-dijon.fr/ninegate/' target='_blank'>Envole</a>. Vous pourrez trouver le code source de Ninegate sur la <a href='https://dev-eole.ac-dijon.fr/projects/eole-eportail' target='_blank'>forge du projet</a></p>
<p>Ninegate est propulsé par la société <a href='https://cadoles.com' target='_blank'>Cadoles</a></p>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,89 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1 class="page-header">
Gestion des Pages
</h1>
<a href="{{ path('app_config_page_submit') }}" class="btn btn-success">Ajouter une Page</a>
<div class="custom-control custom-switch float-right">
<input id="alluser" type="checkbox" class="custom-control-input">
<label id="labelalluser" class="custom-control-label" for="alluser">Afficher les pages créées par des utilisateurs</label>
</div>
<br><br>
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Pages
</div>
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="140px" class="no-sort">Action</th>
<th>Ordre</th>
<th>Nom</th>
<th class="no-sort">Catégorie</th>
<th>Propriétaire</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% 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 %}

View File

@ -0,0 +1,109 @@
{% if not inmenu %}
<ul class="list-group" id="listgrouppage">
{% for groupshared in groupsshared %}
{% for page in groupshared.pagesshared %}
{% 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="active" %}
{% endif %}
<li id="menupage-{{page.id}}" {{ isactive }} class="list-group-item {{isactive}}" onClick="$('#listgrouppage li').removeClass('active'); $(this).addClass('active') " style="cursor:pointer">
<a data-group="{{groupshared.id}}" onClick="$('#selgrouppages').modal('hide'); showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-users fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
{% if loop.first and page.counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{page.counterread}}</span>
{% endif %}
</a>
{% if loop.first and groupshared.pagesshared|length > 1 %}
<ul class="list-group" style="margin-top:15px">
{% endif %}
{% if groupshared.pagesshared|length > 1 and loop.last %}
</ul>
{% endif %}
{% if loop.last %}
</li>
{% endif %}
{% endfor %}
{% endfor %}
</ul>
{% 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 %}
<li id="menupage-{{page.id}}" {{ isactive }} style="cursor:pointer">
<a data-group="{{groupshared.id}}" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-users fa-fw"></i>
{% endif %}
&nbsp;{{ groupshared.label }}
{% if page.counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{page.counterread}}</span>
{% endif %}
</a>
</li>
{% else %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li class="dropdown">
<a data-group="{{groupshared.id}}" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-users fa-fw"></i>
&nbsp;{{ groupshared.label }}
<span class="caret"></span>
{% if groupshared.pagesshared[0].counterread > 0 %}
<span id="badge-{{groupshared.id}}" class="badge">{{groupshared.pagesshared[0].counterread}}</span>
{% endif %}
</a>
<ul class="dropdown-menu">
{% for page in groupshared.pagesshared %}
{% 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 %}
<li id="menupage-{{page.id}}" {{isactive}} style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{forcereload}}','{{groupshared.id}}','{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% endif %}
{{ page.name }}
</a>
</li>
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
{% endfor %}
{% endif %}

View File

@ -0,0 +1,334 @@
{% extends '@CadolesCore/base.html.twig' %}
{% set color = app.session.get('color') %}
{% set colormain = color['main'] %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
<div id="gridtemplate" style="max-width:1500px; margin:auto; margin-bottom:30px">
<div class="col-md-3">qsdfqsdfqsd</div>
<div class="col-md-9">
{% if bookmarks is not empty %}
<div class="bookmark-container">
{% if items is not empty %}
<h3 class="grid-title" data-idcategory="bookmark" style="{{ colorbodyfont }}">Favoris</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% else %}
<div class="bookmark-container" style="display:none">
<h3 class="grid-title" data-idcategory="bookmark"">Favoris</h3>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
</div>
</div>
{% 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 %}
<h3 class="grid-title" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% else %}
<p></p>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-small" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% 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('<i style="color: #FFF" class="fa fa-minus" title="Informations sur ce service"></i>');
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('<i style="color: #FFF" class="fa fa-plus" title="Informations sur ce service"></i>');
$(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("<iframe id='frameitem-"+id+"' class='pageframe' src='"+url+"' style='border:none; width:100%'></iframe>");
resizeFrame();
}
{% endblock %}

View File

@ -0,0 +1,571 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
body{overflow-y:hidden}
{% endblock %}
{% block appmenu %}
<ul class="nav navbar-top-links navbar-left">
{% for page in pagesadmin %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% set usage="portal" %}
{% if loop.first %} {% set usage="accueil" %} {%endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','{{usage}}','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>&nbsp;
{% endif %}
{{ page.name }}
</a>
</li>
{% else %}
<li id="menupage-{{page.id}}">
<a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>&nbsp;
{% endif %}
{{ page.name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<ul id="pagesuser" class="nav navbar-top-links navbar-left">
{% for page in pagesuser %}
{% set forcereload=true %}
{% if page.pagecategory.id==1 %}
{% set forcereload=page.toreload %}
{% endif %}
{% if entity.id is defined and page.id==entity.id %}
<li id="menupage-{{page.id}}" class="active" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-user fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
</a>
</li>
{% else %}
<li id="menupage-{{page.id}}">
<a style="cursor:pointer" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{forcereload}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-faw"></i>
{% else %}
<i class="fa fa-user fa-fw"></i>
{% endif %}
&nbsp;{{ page.name }}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
<ul id="pagesgroup" class="nav navbar-top-links navbar-left">
<!-- On regroupe l'ensemble des pages si plus de x groupes -->
{% set nbgroupregrouped=5 %}
{% if groupsshared|length > nbgroupregrouped %}
<ul id="pagesshared" class="nav navbar-top-links navbar-left">
<li>
<a id="menugrouppages" style='cursor:pointer' data-toggle='modal' data-target='#selgrouppages'>
<i class="fa fa-users fa-fw"></i>&nbsp;Mes Groupes
<span class="caret"></span>
</a>
</li>
</ul>
{%else%}
{% set inmenu=true %}
{{ include('@CadolesPortal/Page/menugroupe.html.twig') }}
{% endif %}
</ul>
<div id="menupageaction">
<a id="menuname" style="cursor:pointer;font-size:80%" href=""></a>
{% if canadd %}
<a id="menusubmit" style="cursor:pointer" onclick="submitPage()" title='Ajouter une page'><i class='fa fa-plus fa-fw'></i></a>
{% endif %}
<a id="menuupdate" style="cursor:pointer;display:none" onclick="updatePage()" title='Modifier une page'><i class='fa fa-file fa-fw'></i></a>
<a id="menushare" style="cursor:pointer;display:none" onclick="sharePage()" title='Partager une page'><i class='fa fa-share-alt fa-fw'></i></a>
<a id="menudelete" style="cursor:pointer;display:none" onclick="deletePage()" title='Supprimer une page'><i class='fa fa-trash fa-fw'></i></a>
<a id="menubookmark" style="cursor:pointer;display:none" onclick="bookmarkPage()" title="Faire de cette page votre page d'accueil"><i class='fa fa-heart fa-fw'></i></a>
<a id="menuwidgetuser" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetuser' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
<a id="menuwidgetgroup" style='cursor:pointer;display:none' data-toggle='modal' data-target='#selwidgetgroup' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a>
</div>
{% endblock %}
{% block pagewrapper %}
<div id="pagecontainer" style="margin: 0px -30px;"></div>
{% if activate_widonlyoffice %}
<iframe src="{{ widonlyoffice_url }}/sso/login" style="display:none"></iframe>
{% endif %}
{% set nbgroupregrouped=5 %}
{% if groupsshared|length > nbgroupregrouped %}
<div id="selgrouppages" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">MES GROUPES</h4>
</div>
<div class="modal-body">
<a onclick="$('#selgrouppages').modal('hide');" class="btn btn-default" style="margin-bottom:15px">
Annuler
</a>
{% set inmenu=false %}
{{ include('@CadolesPortal/Page/menugroupe.html.twig') }}
</div>
</div>
</div>
</div>
{%endif%}
<div id="selwidgetuser" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidgetuser').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="dataTable_wrapper col-md-12">
<table id="dataTables" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgetsuser %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ widget.icon.label }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="selwidgetgroup" class="modal fade bs-item-modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
</div>
<div class="modal-body">
<div class="form-group row clearfix">
<div class="col-md-12" style="margin-bottom:15px">
<a onclick="$('#selwidgetgroup').modal('hide');" class="btn btn-default">
Annuler
</a>
</div>
<div class="dataTable_wrapper col-md-12">
<table id="dataTables" class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgetsgroup %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="/{{ alias }}/{{ widget.icon.label }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
{%if app.user %}
<a id="refreshcounter" data-event=""></a>
{% endif %}
{% endblock %}
{% block localexternalscript %}
{% if app.user %}
<script src="/{{alias}}/bundles/goswebsocket/js/vendor/autobahn.min.js"></script>
<script src="/{{alias}}/bundles/goswebsocket/js/gos_web_socket_client.js"></script>
{% 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("<iframe onload='this.contentWindow.focus()' id='frameitem-"+id+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
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("<iframe onload='this.contentWindow.focus()' id='page-"+id+"' data-category='"+catid+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
// 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("<iframe onload='this.contentWindow.focus()' id='goto' class='pageframe pageframereload' src='"+url+"' style='border:none; width:100%'></iframe>");
// 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("<span id='badge-"+group+"' class='badge'>"+counter+"</span");
}
});
}
});
}
{% endblock %}

View File

@ -0,0 +1,46 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Partage Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.groups) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,86 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1>
Nouvelle Page
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page') }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home') }}">Annuler</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
{{ form_row(form.name) }}
{{ form_row(form.pagecategory) }}
{{ form_row(form.usage) }}
{% if form.user is defined %}
{{ form_row(form.user) }}
{% endif %}
<div id="pagegroup">{{ form_row(form.page) }}</div>
<div id="groupworkgroup">{{ form_row(form.groups) }}</div>
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
</div>
</div>
{{ 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 %}

View File

@ -0,0 +1,72 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Page Editeur = {{entity.name}}
{% elseif mode=="submit" %}
Création Page Editeur
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.html) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,66 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
Modification Page {{ entity.pagecategory.name}} = {{entity.name}}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,76 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification Page URL = {{entity.name}}
{% elseif mode=="submit" %}
Création Page URL
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page_view',{id:entity.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home',{id:entity.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('cadoles_portal_'~access~'_page_delete',{'id':entity.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.url) }}
<em>le mot clé #login# sera remplacé par le login de l'utilisateur</em><br>
<em>Attention certains sites n'acceptent pas d'être encapsulés dans une frame.<br><br></em>
{{ form_row(form.toreload) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -0,0 +1,543 @@
{% extends 'base.html.twig' %}
{% block localstyle %}
<style>
#gridtemplate {
border: 1px solid #cdcdcd;
padding:20px;
margin: 0px;
}
#gridtemplate .row {
height: 500px;
border: 1px solid #cdcdcd;
margin: 0px 0px 20px 0px;
background-color: #c8f7c5;
}
#gridtemplate .rowcontainer {
float:left;
width:90%;
height:80%;
}
#gridtemplate .rowcontainer .row {height:33.333333333333333%; margin:0px}
#gridtemplate .rowcontainer .maxright, #gridtemplate .rowcontainer .maxleft {height:90% !important; width:20% !important; }
#gridtemplate .rowcontainer .rowcontainer {width:60% !important;}
#gridtemplate .rowcontainer .addRow {display:none;}
#gridtemplate .rowcontainer .colcontainer {padding:5px;}
#gridtemplate .addRow {
width: 100%;
height: 10%;
padding: 2px;
max-height: 30px
}
#gridtemplate .delRow {
height:100%;
width: 5%;
background-color: #e74c3c;
color: #fff;
text-align:center;
float: left;
cursor: pointer;
}
#gridtemplate .delRow i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer {
width:90%;
height:100% !important;
float:left;
padding:15px;
}
#gridtemplate .colcontainer .col {
border: 1px solid #cdcdcd;
height:100%;
padding: 0px;
background-color:#fff;
}
#gridtemplate .addCol {
height:100%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .addCol i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .delCol {
height:10%;
width: 100%;
background-color: #e74c3c;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .colcontainer .col .delCol i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .maxleft {
height:80%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: left;
cursor: pointer;
}
#gridtemplate .colcontainer .col .maxleft i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#gridtemplate .colcontainer .col .maxright {
height:80%;
width: 5%;
background-color: #2c3e50;
color: #fff;
text-align:center;
float: right;
cursor: pointer;
}
#gridtemplate .colcontainer .col .maxright i {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
</style>
{% endblock %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% 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 %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
{% if mode=="updatetemplate" %}
<a class="btn btn-secondary" href="{{ path('app_config_pagetemplate_view',{id:page.id}) }}">Annuler</a>
{% else %}
<a class="btn btn-secondary" href="{{ path('app_config_page_view',{id:page.id}) }}">Annuler</a>
{% endif %}
{% else %}
<a class="btn btn-secondary" href="{{ path('app_home',{id:page.id}) }}">Annuler</a>
{% endif %}
{% if mode=="update" %}
<a href={{ path('app_'~access~'_page_delete',{'id':page.id}) }}
class="btn btn-danger float-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
</a>
{% endif %}
{% if mode=="updatetemplate" %}
<a href={{ path('app_'~access~'_pagetemplate_delete',{'id':page.id}) }}
class="btn btn-danger pull-right"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce modèle ?">
Supprimer
</a>
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
{% else %}
<div class="col-md-12">
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.template) }}
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
{% endif %}
</div>
<h3>Template de Mise en Page</h3>
<div id="gridtemplate">
</div>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
var defcol = [];
defcol[1] = ["col-12"];
defcol[2] = ["col-6","col-6"];
defcol[3] = ["col-4","col-4","col-4"];
defcol[4] = ["col-3","col-3","col-3","col-3"];
defcol[5] = ["col-4","col-2","col-2","col-2","col-2"];
defcol[6] = ["col-2","col-2","col-2","col-2","col-2","col-2"];
var defaultcol = ""
defaultcol+="<div class='delCol'>";
defaultcol+="<i class='fa fa-trash'></i>";
defaultcol+="</div>";
defaultcol+="<div class='maxleft'>";
defaultcol+="<i class='fa fa-chevron-left'></i>";
defaultcol+="</div>";
defaultcol+="<div class='rowcontainer'>";
defaultcol+="</div>";
defaultcol+="<div class='maxright'>";
defaultcol+="<i class='fa fa-chevron-right'></i>";
defaultcol+="</div>";
defaultcol+="<a class='addRow btn btn-info'>Ajouter une Ligne</a>";
$('document').ready(function(){
// Template de base
if($(page_update_widget_template).val()=="") {
myrow ="<div class='row'>";
myrow+="<div class='delRow'><i class='fa fa-trash'></i></div>";
myrow+="<div class='row colcontainer'>";
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="</div>"
myrow+="<div class='addCol'><i class='fa fa-plus'></i></div>";
myrow+="</div>"
$("#gridtemplate").append(myrow);
}
// Interprétation du template sauvegardé
else {
var json = jQuery.parseJSON($(page_update_widget_template).val());
var mygrid="";
$.each(json.rows, function( index, rownv01 ) {
mygrid+="<div class='row'>";
mygrid+="<div class='delRow'><i class='fa fa-trash'></i></div>";
mygrid+="<div class='row colcontainer'>";
$.each(rownv01.cols, function( index, colnv01 ) {
mygrid+="<div class='col col-"+colnv01.size+"'>";
mygrid+="<div class='delCol'>";
mygrid+="<i class='fa fa-trash'></i>";
mygrid+="</div>";
mygrid+="<div class='maxleft'>";
mygrid+="<i class='fa fa-chevron-left'></i>";
mygrid+="</div>";
mygrid+="<div class='rowcontainer'>";
$.each(colnv01.rows, function( index, rownv02 ) {
mygrid+="<div class='row'>";
mygrid+="<div class='delRow'><i class='fa fa-trash'></i></div>";
mygrid+="<div class='row colcontainer'>";
$.each(rownv02.cols, function( index, colnv02 ) {
mygrid+="<div class='col col-"+colnv02.size+"'>"+defaultcol+"</div>";
});
mygrid+="</div>";
mygrid+="<div class='addCol'><i class='fa fa-plus'></i></div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="<div class='maxright'>";
mygrid+="<i class='fa fa-chevron-right'></i>";
mygrid+="</div>";
mygrid+="<a class='addRow btn btn-info'>Ajouter une Ligne</a>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="<div class='addCol'><i class='fa fa-plus'></i></div>";
mygrid+="</div>";
});
$("#gridtemplate").append(mygrid);
}
$("#gridtemplate").append("<a class='addRow btn btn-info'>Ajouter une Ligne</a>");
// Ajout d'une ligne
$(document).on('click','.addRow', function(event){
lastrow=$(this).parent().children('.row').last();
parentid=$(this).parent().attr("id");
if(parentid=="gridtemplate") {
nbrow=$(this).parent().children('.row').length;
nbmax=5;
}
else {
nbrow=$(this).parent().children(".rowcontainer").children('.row').length;
nbmax=4;
}
nbrow++;
if(nbrow==nbmax)
alert("Vous ne pouvez pas insérer plus de "+(nbmax-1)+" lignes");
else {
myrow ="<div class='row'>";
myrow+="<div class='delRow'><i class='fa fa-trash'></i></div>";
myrow+="<div class='row colcontainer'>";
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="<div class='col col-4'>"+defaultcol+"</div>"
myrow+="</div>"
myrow+="<div class='addCol'><i class='fa fa-plus'></i></div>";
myrow+="</div>"
if(lastrow.length)
lastrow.after(myrow);
else
$(this).parent().children(".rowcontainer").append(myrow);
}
});
// Suppression d'une ligne
$(document).on('click','.delRow', function(event){
// On compte le nombre de row de ce niveau et on bloque s'il en reste plus qu'une et que l'on est sur le premier niveau de ligne
if($( this ).parent().parent().children(".row").length==1 && $( this ).parent().parent().attr("id")=="gridtemplate")
{
alert("Votre page doit avoir au minimum une ligne");
}
// Si ce n'est pas le cas on la supprime
else {
$( this ).parent().remove();
}
});
// Ajout d'une Colonne
$(document).on('click','.addCol', function(event){
// On récupère la ligne
row=$( this ).parent();
colcontainer=row.children(".colcontainer");
// On compte le nombre de colonne
nbcol=colcontainer.children(".col").length;
nbcol++;
if(nbcol>6) {
alert("Votre page ne peut avoir plus de 6 colonnes");
}
else {
// Pour chaque colonne on applique la répartition de taille en fonction du nombre de colonne total
colcontainer.children('.col').each(function( index ) {
$(this).removeClass();
$(this).attr("class","col "+defcol[nbcol][index]);
});
// On ajoute une colonne après la derniere colonne de la ligne
lastcol=colcontainer.children('.col').last();
lastcol.after("<div class='col "+defcol[nbcol][nbcol-1]+"'>"+defaultcol+"</div>");
}
});
// Suppression d'une Colonne
$(document).on('click','.delCol', function(event){
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On compte le nombre de colonne
nbcol=colcontainer.children(".col").length;
nbcol--;
if(nbcol<1) {
alert("Au minimum 1 colonne");
}
else {
// On détruit la colonne
col.remove();
// Pour chaque colonne on applique la répartition de taille en fonction du nombre de colonne total
colcontainer.children('.col').each(function( index ) {
$(this).removeClass();
$(this).attr("class","col "+defcol[nbcol][index]);
});
}
});
// Agrandissement colonne sur la droite
$(document).on('click','.maxright', function(event){
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On recherche la colonne suivante
colnext=col.next();
if(colnext.length) {
// uniquement si taille de la colonne suivant n'est pas col-1
if(colnext.attr("class")!="col col-1") {
// On récupére la taille de la colonne suivante et en cours
taillenext=parseInt(colnext.attr("class").replace("col-","").replace("col ",""));
taille=parseInt(col.attr("class").replace("col-","").replace("col ",""));
// On applique la nouvelle taille à la colonne en cours
col.removeClass();
col.attr("class","col col-"+(taille+1));
// On applique la nouvelle taille à la colonne suivante
colnext.removeClass();
colnext.attr("class","col col-"+(taillenext-1));
}
}
});
// Agrandissement colonne sur la gauche
$(document).on('click','.maxleft', function(event){
console.log("here");
// On récupère la colonne
col=$( this ).parent();
colcontainer=col.parent();
// On recherche la colonne suivante
colprev=col.prev();
if(colprev.length) {
// uniquement si taille de la colonne précédente n'est pas col-1
if(colprev.attr("class")!="col col-1") {
console.log(colprev.attr("class"));
// On récupére la taille de la colonne précédente et en cours
tailleprev=parseInt(colprev.attr("class").replace("col-","").replace("col ",""));
taille=parseInt(col.attr("class").replace("col-","").replace("col ",""));
console.log(taille);
// On applique la nouvelle taille à la colonne en cours
col.removeClass();
col.attr("class","col col-"+(taille+1));
// On applique la nouvelle taille à la colonne suivante
colprev.removeClass();
colprev.attr("class","col col-"+(tailleprev-1));
}
}
});
// Sur validation formulaire
$( "form" ).submit(function( event ) {
//event.preventDefault();
template='{"rows":[';
// Pour chaque ligne de niveau 01 de la grille
nbrownv01=$("#gridtemplate").children('.row').length;
$("#gridtemplate").children('.row').each(function( index ) {
template+='{';
template+='"id":'+index+',';
// Pour chaque colonne de la ligne de niveau 01
nbcolnv01=$(this).children('.colcontainer').children('.col').length;
template+='"cols":[';
$(this).children('.colcontainer').children('.col').each(function( index ) {
template+='{';
template+='"id":'+index+',';
template+='"size": '+parseInt($(this).attr("class").replace("col-","").replace("col ",""))+',';
// Pour chaque ligne de niveau 02
template+='"rows":[';
nbrownv02=$(this).children('.rowcontainer').children('.row').length;
$(this).children('.rowcontainer').children('.row').each(function( index ) {
template+='{';
template+='"id":'+index+',';
nbcolnv02=$(this).children('.colcontainer').children('.col').length;
template+='"cols":[';
$(this).children('.colcontainer').children('.col').each(function( index ) {
template+='{';
template+='"id":'+index+',';
template+='"size": '+parseInt($(this).attr("class").replace("col-","").replace("col ",""));
template+='}';
if(index+1<nbcolnv02) template+=',';
});
template+=']';
template+='}';
if(index+1<nbrownv02) template+=',';
});
template+=']';
template+='}';
if(index+1<nbcolnv01) template+=',';
});
template+=']';
template+='}';
if(index+1<nbrownv01) template+=',';
});
template+=']}';
$("#page_update_widget_template").val(template);
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends '@CadolesCore/base.html.twig' %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div style="{% if entity.maxwidth>0%} max-width:{{ entity.maxwidth }}px; margin:auto; {% else %} margin: 30px 0px; {% endif %}">
{{ entity.html | raw }}
</div>
{% endblock %}
{% block localjavascript %}
$('document').ready(function(){
});
{% endblock %}

View File

@ -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" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_page_view', {id:entity.id})}}">{{ entity.name }}</a>
<a href='{{ path('cadoles_portal_config_page_update', {id:entity.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a>
<a href='{{ path('cadoles_portal_config_page_delete', { id: entity.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a>
</div>
{% endif %}
<div id="pageiframe" style="{% if entity.maxwidth>0%} max-width:{{ entity.maxwidth }}px; margin:auto; {% endif %}">
<iframe onload='this.contentWindow.focus()' src="{{entity.url|replace({'#login#': username})}}" id="frameContent" style="border:none;" width="100%" height="100%"></iframe>
</div>
{% 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 %}

View File

@ -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 %}
<li><a href="{{ path('app_'~access~'_page'~template~'_view', {id:page.id})}}">{{ page.name }}</a></li>
<li><a href='{{ path('app_'~access~'_page'~template~'_update', {id:page.id}) }}' title='Modifier la page'><i class='fa fa-cog fa-fw'></i></a></li>
<li><a href='{{ path('app_'~access~'_page'~template~'_delete', { id: page.id }) }}' data-method='delete' data-confirm='Êtes-vous sûr de vouloir supprimer ?' title='Supprimer la page'><i class='fa fa-trash fa-fw'></i></a></li>
<li><a class="btn-modal" style='cursor:pointer' data-modalid='selwidget' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a></li>
{% endif %}
{% endblock %}
{% block body %}
<div id="widget-container" style="{% if page.maxwidth>0%} max-width:{{ page.maxwidth }}px; margin:auto; {% endif %}">
</div>
<div id="tolocalize" style="display:none">
{% for pagewidget in page.pagewidgets %}
<a href="{{ url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,by:mode,usage:usage,group:group,look:look,selwidget:selwidget}) }}"></a>
{{ render(url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,by:mode,usage:usage,group:group,look:look,selwidget:selwidget})) }}
{% endfor %}
</div>
{% if access!="all" %}
<div id="selwidget" class="modal fade" role="dialog">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div id="mymodalheader" class="modal-header">
<h4 class="modal-title">SELECTIONNER UN WIDGET</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<a onclick="$('#selwidget').modal('hide');" class="btn btn-secondary mb-3">
Annuler
</a>
<table id="dataTables" class="table table-striped table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th class="no-sort" width="80px"></th>
<th width="100px">Nom</th>
<th class="no-sort" width="500px">Description</th>
</tr>
</thead>
<tbody>
{% for widget in widgets %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }})" style="cursor:pointer;">
<img id="widgettype-{{ widget.id }}" class="grid-item-img" height="40" src="{{path('app_minio_image',{file:widget.icon.label}) }}" style="padding:2px">
</a>
</td>
<td>{{ widget.name }}</td>
<td>{{ widget.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}
{% block localscript %}
<script>
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('document').ready(function(){
// Initialisation du tableau des widgets selectionnable à la création
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false }, { "targets": 0, "className": "text-center" } ],
iDisplayLength: 10,
order: [[ 1, "asc" ]],
//responsive: false,
scrollX: false,
});
// Ajustement des frames
$(window).resize(function() {
AjustFrame();
});
// Création de la grille des widgets
var template = '{{ page.template | raw }}';
// Template de base
if(template=="") {
myrow ="<div>";
myrow+="<div class='row colcontainer no-gutters'>";
myrow+="<div id='R1C1' class='col col-lg-4'></div>"
myrow+="<div id='R1C2' class='col col-lg-4'></div>"
myrow+="<div id='R1C3' class='col col-lg-4'></div>"
myrow+="</div>"
$("#widget-container").append(myrow);
}
// Interprétation du template sauvegardé
else {
var json = jQuery.parseJSON(template);
var mygrid="";
var row01=0;
$.each(json.rows, function( index, rownv01 ) {
row01++;
col01=0;
mygrid+="<div>";
mygrid+="<div class='row colcontainer no-gutters'>";
$.each(rownv01.cols, function( index, colnv01 ) {
col01++;
var row02=0;
mygrid+="<div id='R"+row01+"C"+col01+"' class='mycol col-lg-"+colnv01.size+"'>";
mygrid+="<div class='rowcontainer'>";
$.each(colnv01.rows, function( index, rownv02 ) {
row02++;
col02=0;
mygrid+="<div>";
mygrid+="<div class='row colcontainer no-gutters'>";
$.each(rownv02.cols, function( index, colnv02 ) {
col02++;
mygrid+="<div id='R"+row01+"C"+col01+"R"+row02+"C"+col02+"' class='mycol col-lg-"+colnv02.size+"'></div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
mygrid+="</div>";
mygrid+="</div>";
});
$("#widget-container").append(mygrid);
}
// On déplace les widgets à leur emplacement
$("#tolocalize").children(".widget").each(function( element ) {
if($('#'+$(this).attr("loc")).length)
$(this).appendTo('#'+$(this).attr("loc"));
else
$(this).appendTo('#R1C1');
});
// On ajoute un widget vide à chaque colonne
$("#widget-container .col").each(function(element) {
$("<div class='widgetempty'>&nbsp;</div>").appendTo($(this));
});
{% if canupdate %}
// Mettre une taille mini de colonne sinon on ne pourra pas déplacer le widget dans la colonne
$(".colcontainer .col").css("min-height","80px");
// Cursor move sur les widgets header
//$(".widgetheader").css("cursor","move");
// Rendre les widgets déplacable
$("#widget-container .mycol").sortable({
connectWith: "#widget-container .mycol",
handle: '.widgetheader',
placeholder: "widget widgetplacehorder",
tolerance: "pointer",
cursor: "move",
opacity: 0.6,
start: function( event, ui ) {
ui.placeholder.css("height",ui.item.height());
$(".widgetbody").hide();
$(".colcontainer .mycol").css("border","1px solid #cdcdcd");
$(".colcontainer .mycol").css("padding-bottom","15px");
},
stop: function( event, ui ) {
$(".widgetbody").show();
$(".colcontainer .mycol").css("border","none");
$(".colcontainer .mycol").css("padding-bottom","");
// Création des grilles d'items
var grid = $('.grid').masonry(optiongrid);
},
update: updateLocalisation
});
{% endif %}
// Création des slick
//slick();
// Sur le click des titres de widgets ouvrir / fermer le widget
$( ".widgetheader .title" ).click(function() {
showhideWidget(this);
});
$( ".widgetheader .logo" ).click(function() {
showhideWidget(this);
});
// balise h des widget editor
$(".widget-editor .widgetbody :header").css("color",$(".widgetbody").css("color"));
// cacher le loader
$("#loader").hide();
});
// function slick
function slick() {
$('.slick').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
//autoplaySpeed: ($(this).data("interval")*1000),
dots: false,
touchMove: false,
pauseOnHover: false,
fade: true,
cssEase: 'linear',
prevArrow: '<button type="button" class="slick-prev"></button>',
nextArrow: '<button type="button" class="slick-next"></button>',
});
}
// Cacher afficher le menu des widgets
$(".widget").hover(function() {
if($(this).find(".widget-menu").length) {
$(this).find(".widget-menu").show();
}
});
$( ".widget" ).mouseleave(function() {
$(this).find(".widget-menu").hide();
});
function showhideWidget(elem) {
widget=$(elem).parent().parent();
idwidget= widget.data("id");
if(widget.children(".widgetbody").css("display")=='block')
value=false;
else
value=true;
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:idwidget,
key:'widgetshowhide',
value:value
},
success: function(idbookmark) {
// on récupère le parent widget conteneur
widget=$(elem).parent().parent();
//console.log(widget.children(".widgetbody").css("display"));
widget.children(".widgetbody" ).toggle();
// On recalcule les grilles
var grid = $('.grid').masonry(optiongrid);
}
});
{% endif %}
}
// Modification de la localisation d'un widget
function updateLocalisation() {
$('.colcontainer .mycol').each(function(index) {
var idloc=$(this).attr('id');
$(this).children(".widget").each(function(order){
var idwidget=$(this).data('id');
$.ajax({
method: "POST",
url: "{{ path('app_'~access~'_pagewidget_order') }}",
data: {
idwidget:idwidget,
order:order,
idloc:idloc
}
});
});
});
}
// Création d'un widget selectionné
function selWidget(idwidgettype) {
var url="{{ path('app_'~access~'_pagewidget_widget_sumbit',{idpage:page.id,idwidgettype:'xx','by':mode})}}";
url=url.replace('xx',idwidgettype);
$(location).attr('href', url);
};
// Modifciation d'un widget
function modWidget(idwidget) {
var url="{{ path('app_'~access~'_pagewidget_widget_update',{idpage:page.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Suppression d'un widget
function delWidget(idwidget) {
var txt;
var r = confirm("ATTENTION\nConfirmez-vous la suppression de ce widget ?\n\nL'ensemble du contenu sera définitivement perdu !!");
if (r == true) {
url="{{ path('app_'~access~'_pagewidget_delete',{idwidget:'xx'}) }}";
url=url.replace('xx',idwidget);
$.ajax({
method: "POST",
url: url,
});
$(".widget[data-id="+idwidget+"]").remove();
}
}
// Changer widget
function changeWidget(idwidget,key,value) {
{% if app.user %}
if(key=="modedesktop") {
value=value+1;
if(value==5) value=0;
}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:idwidget,
key:key,
value:value
},
success: function() {
location.reload();
}
});
{% endif %}
}
// Ajout d'un bookmark
function addBookmark(idwidget,touser) {
var url="{{ path('app_'~access~'_bookmark_submit',{idpage:page.id,idwidget:'xx',touser:'yy',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace('yy',touser);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Modifciation d'un bookmark
function modBookmark(idbookmark) {
var url="{{ path('app_'~access~'_bookmark_update',{idpage:page.id,id:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idbookmark);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Ajouter un item aux bookmark
function heartBookmark(iditem) {
var idbookmark;
$.ajax({
method: "POST",
url: "{{ path('app_all_bookmark_heart') }}",
data: {
iditem:iditem
},
success: function(idbookmark) {
location.reload();
}
});
}
// Supprimer un bookmark
function delBookmark(idbookmark) {
if (confirm('Êtes-vous sûr de vouloir supprimer cet item ?')) {
var url="{{ path('app_'~access~'_bookmark_delete',{idpage:page.id,id:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idbookmark);
url=url.replace(/&amp;/g,"&");
$.ajax({
method: "POST",
url: url,
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('app_'~access~'_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
// Liste des slides
function listSlide(idwidget) {
var url="{{ path('app_'~access~'_slide_list',{idpage:page.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
}
// Ajustement des frames
function AjustFrame() {
if($(".itemframe").length>0) {
$(".itemframe").css("height",$(window).height()-$(".header").height());
}
}
// Affichage des frames associés aux items de bureau
function showItemframe(id,url,forcereload) {
{% if access=="all" %}
window.parent.showItemframe(id,url,forcereload);
{% else %}
$("#page").hide();
$("body").css("overflow-y","hidden");
if($("#itemframe-"+id).length) {
if(forcereload) {
$("#itemframe-"+id).attr("src",url);
}
$("#itemframe-"+id).show();
}
else {
$("#page").before("<iframe id='itemframe-"+id+"' class='itemframe' src='"+url+"'></iframe>");
}
AjustFrame();
{% endif %}
}
// Affichage des items d'une catégorie
function showItemCat(idwidget, id) {
$(".widget[data-id="+idwidget+"]").find("#itemsearch").val("");
$(".widget[data-id="+idwidget+"]").find(".item").hide();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").hide();
if(id=="all") {
$(".widget[data-id="+idwidget+"]").find(".item").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").show();
}
else if(id=="fav") {
$(".widget[data-id="+idwidget+"]").find(".item[data-idcategory="+id+"]").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+id+"]").show();
}
else {
$(".widget[data-id="+idwidget+"]").find(".item[data-idcategory="+id+"]").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+id+"]").show();
}
}
// Affichage des items d'une catégorie
function searchItem(idwidget, label) {
$(".widget[data-id="+idwidget+"]").find(".bookmark-container").show();
$(".widget[data-id="+idwidget+"]").find(".itemcategory-container").show();
if(label=="") {
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").show();
$(".widget[data-id="+idwidget+"]").find(".item").show();
}
else {
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title").hide();
$(".widget[data-id="+idwidget+"]").find(".item").hide();
items=$(".widget[data-id="+idwidget+"]").find(".item[data-title*='"+label.toLowerCase()+"']");
if(items.length) {
items.show();
items.each(function() {
category=$(this).data("idcategory");
$(".widget[data-id="+idwidget+"]").find(".itemcategory-title[data-idcategory="+category+"]").show();
});
}
}
}
// Place un message en lu
function hideMessage(id) {
$.ajax({
method: "POST",
url: "{{ path('app_all_message_see') }}",
data: {
id:id
},
success: function() {
$(".msg-"+id).remove();
var ele = $(".msg-hidden").first();
ele.show();
ele.removeClass("msg-hidden");
var grid = $('.grid').masonry(optiongrid);
}
});
}
// Place un message en lu
function hideAlert(id) {
$.ajax({
method: "POST",
url: "{{ path('app_all_alert_read') }}",
data: {
id:id
},
success: function() {
$("#alert-"+id).remove();
var grid = $('.grid').masonry(optiongrid);
}
});
}
</script>
{% endblock %}

View File

@ -0,0 +1,58 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1 class="page-header">
Gestion des Modèles de Page
</h1>
<p>
<a href="{{ path('app_'~access~'_pagetemplate_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Modèles
</div>
<div class="card-body">
<div class="dataTable_wrapper">
<table class="table table-striped table-bordered table-hover" id="dataTables" style="width:100%">
<thead>
<tr>
<th width="140px" class="no-sort">Action</th>
<th>Ordre</th>
<th>Nom</th>
<th>Pour</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
{% endblock %}
{% block localscript %}
<script>
$(document).ready(function() {
$('#dataTables').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('app_'~access~'_pagetemplate_tablelist') }}",
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,45 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
Nouveau Modèle de Page
</h1>
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href="{{ path('app_'~access~'_pagetemplate') }}">Annuler</a>
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.name) }}
{{ form_row(form.parentfor) }}
{{ form_row(form.roworder) }}
{{ form_row(form.maxwidth) }}
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -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 %}`

View File

@ -0,0 +1,183 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" or mode=="updatetemplate" %}
Modification Widget
{% elseif mode=="submit" or mode=="submittemplate" %}
Création Widget
{% endif %}
</h1>
<p>
{{ form_widget(form.submit) }}
{% if access=="admin" %}
{% if mode=="update" %}
<a class="btn btn-secondary" href="{{ path('app_admin_page_view',{id:idpage}) }}">Annuler</a>
{% else %}
<a class="btn btn-secondary" href="{{ path('app_admin_pagetemplate_view',{id:idpage}) }}">Annuler</a>
{% endif %}
{% else %}
{% if mode=="update" %}
<a class="btn btn-secondary" href="{{ path('app_user_page_view',{id:idpage,usage:usage,group:group}) }}">Annuler</a>
{% else %}
<a class="btn btn-secondary" href="{{ path('app_home',{id:idpage}) }}">Annuler</a>
{% endif %}
{% endif %}
</p>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
<div class="row">
<div class="col col-8">
<div class="card">
<div class="card-header"><i class="fas fa-pencil-alt fa-fw"></i> Informations</div>
<div id="col1" class="card-body">
{{ form_row(form.name) }}
</div>
</div>
</div>
<div class="col col-4">
<div class="card">
<div class="card-header"><i class="fas fa-pencil-alt fa-fw"></i> Informations</div>
<div class="card-body">
<div id="diviconsel" class="col-md-12 text-center mb-1 mt-1" style="height:140px; padding:20px; background-color: {{ entity.colorheaderback ? entity.colorheaderback : 'var(--colorbgbodydark)' }};">
{% if entity.icon.label %}
<img src="{{ path('app_minio_image',{file:entity.icon.label}) }}" height="100" />
{% endif %}
</div>
<div class="col-md-12" style="text-align:center;padding:0px">
{{ form_row(form.idicon) }}
<a class="btn btn-success btn-modal" data-modalid="mymodallarge" data-modaltitle="Icône" data-modalurl="{{ path('app_all_icon_select') }}" title='Selectionner un Icône'>Selectionner un Icône</a>
<a class="btn btn-danger" onClick="delIcon()" title='Détacher'>Détacher l'Icône</a>
</div>
</div>
</div>
</div>
<div class="col col-12 mt-3">
<div class="card">
<div class="card-header"><i class="fas fa-pencil-alt fa-fw"></i> Informations</div>
<div class="card-body">
<div class="row">
<div id="col2" class="col col-4">
{{ form_row(form.autoajust) }}
{{ form_row(form.height) }}
{{ form_row(form.border) }}
{{ form_row(form.opened) }}
</div>
<div id="col3" class="col col-4">
{{ form_row(form.viewheader) }}
{{ form_row(form.colorheaderback) }}
{{ form_row(form.colorheaderfont) }}
{{ form_row(form.colorbodyback) }}
{{ form_row(form.colorbodyfont) }}
</div>
<div id="col4" class="col col-4">
</div>
<div id="col5" class="col col-md-12" style="clear:both">
{{ form_widget(form) }}
</div>
</div>
</div>
</div>
</div>
</div>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
$(document).ready(function() {
$(".control-label").each(function( element ) {
var loc = $(this).attr('loc');
if (typeof loc !== typeof undefined && loc !== false) {
$(this).parent().appendTo("#"+loc);
}
});
$("#col2").children(".form-group").each(function( element ) {
$(this).css("zoom","80%");
});
$("#col3").children(".form-group").each(function( element ) {
$(this).css("zoom","80%");
});
$("#col4").children(".form-group").each(function( element ) {
$(this).css("zoom","80%");
});
showhide();
});
$("#pagewidget_colorheaderback").bind("change paste keyup", function() {
$("#diviconsel").css("background-color",$(this).val());
});
$("#pagewidget_autoajust").change(function() {
showhide();
});
$("#pagewidget_viewheader").change(function() {
showhide();
});
function selIcon(idicon,url) {
$("#pagewidget_idicon").val(idicon);
$("#diviconsel img").remove();
$("#diviconsel").append("<img src='"+url+"'>");
$("#diviconsel img").attr("height","100px");
$("#mymodallarge").modal("hide");
}
function delIcon() {
$("#diviconsel img").remove();
$("#diviconsel").append("<img src='{{ path("app_minio_image",{file:entity.widget.icon.label}) }}'>");
$("#pagewidget_idicon").val(null);
}
function showhide() {
if($("#pagewidget_autoajust").val()==1) {
$("#groupfield_pagewidget_height").hide();
}
else {
$("#groupfield_pagewidget_height").show();
}
if($("#pagewidget_viewheader").val()==1) {
$("#groupfield_pagewidget_colorheaderback").show();
$("#groupfield_pagewidget_colorheaderfont").show();
}
else {
$("#groupfield_pagewidget_colorheaderback").hide();
$("#groupfield_pagewidget_colorheaderfont").hide();
}
}
</script>
{% endblock %}

View File

@ -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 %}
<div class="widget widget-mini widget-projalertect" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
{% if canupdate or alerts|length>0 %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-alert" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% for alert in alerts %}
<div id="alert-{{ alert.id }}" class="panel list-item" style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~colormain }};">
<div class="panel-heading" role="tab">
{% if alert.alertcategory.icon %}
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
{% else %}
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
{% endif %}
{{ alert.title }}
{% if alert.fghideable and app.user %}
&nbsp;<a onClick="hideAlert({{alert.id}})" style="cursor:pointer;" title="Ne plus afficher"><i class="fa fa-eye-slash"></i></a>
{%endif%}
</div>
<div class="panel-body">
<div class="widget-ckeditor">{{ alert.content|raw }}</div>
{% if not alert.items is empty %}
{% if app.user %}
{% set username = app.user.username %}
{% else %}
{% set username = "" %}
{% endif %}
<div class="grid clearfix fitWidth" style="width:auto; margin: 0 auto;">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for item in alert.items %}
<div class="grid-item grid-list">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url|replace({'#login#': username}) }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo" title="{{ item.subtitle|nl2br }}">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-appexternal" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-appexternal" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% 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 %}
<h3 class="grid-title" style="{{ colorbodyfont }}" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
{% endif %}
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
<a class="linktosonde" data-sonde="{{ item.itemcategory.label }}" href="{{ item.url }}" target="_blank">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/{{ item.icon }}">
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
{% if haveitem %}
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-blog" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-blog" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a title="Gérer mes Blogs" href='{{ path('app_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-th fa-fw"></i></a>
{% 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 %}
<a title="Créer un Article" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% 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 %}
<a title="Voir mes Blogs" onClick="showFrameitem('blog','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-th fa-fw"></i></a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if blogarticles|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for blogarticle in blogarticles %}
{% if loop.index==1 %}
<div class="grid-sizer grid-preview"></div>
<div class="grid-gutter-sizer grid-preview-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-preview" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<a href onClick="showFrameitem('blog','{{ path('app_'~access~'_blogarticle_view',{'id':blogarticle.id}) }}',true)">
{% if blogarticle.image is not empty %}
<div class="grid-item-logo">
<img class="grid-item-vignette" src="/{{appAlias}}/{{blogarticle.image|replace({"/blogarticle/":"/blogarticle/thumb-"})}}" width="100%">
</div>
{% endif %}
<div class="caption" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-title" style="{{ stylewidgetbodyreverse }};">
<h2>{{blogarticle.name }}</h2>
<small>publié par {{ blogarticle.user.username }} le {{ blogarticle.submit|date("d/m/Y à H:i") }}<br>dans le blog {{blogarticle.blog.name }}</small>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-bookmark" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-bookmark" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd %}
<i class="fa fa-plus fa-fw" title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},false)" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if bookmarks is not empty or canadd %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="bookmark-container">
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : app.session.get('colorbgbodydark') }};">
{% if canadd %}
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
{% endif %}
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url|replace({'#login#': username}) }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url|replace({'#login#': username}) }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo" title="{{ bookmark.subtitle|nl2br }}">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ appAlias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ appAlias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
{% if canadd %}
<div class="grid-item {{ stylegrid }}">
<div title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},false)" class="grid-item-content" style="background-color: app.session.get('colorbgbodydark')}};cursor:pointer;">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ appAlias }}/uploads/icon/icon_add.png">
</div>
<div class="grid-item-title">
<h2>Ajouter</h2>
</div>
</div>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-calendar" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-calendar" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a title="Gérer mes Calendriers" href='{{ path('app_config_calendar') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% 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 %}
<a title="Ajouter / Modifier un Evènement" onClick="showFrameitem('calendar','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
{% if events|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
{% 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")) %}
<h3>{{ libmonth ~ " " ~ dateeventstart|date("Y") }}</h3>
{% endif %}
{% if not fgaffday %}
{% set fgaffday=true %}
{% set libday = constants.libday(dateeventstart|date("N")) %}
<div style="margin-top:15px; font-weight:bold; font-size:18px;">{{ libday ~ " " ~ dateeventstart|date("d/m/Y") }}</div>
{% endif %}
<div class="widget-event" style="background-color:{{ event.color }}; color: #FFF; padding:2px;" title="{{ event.description }}">
{{ event.name }} =
{% if not event.allDay %}
{{ event.start | date("H:i") }} -
{%endif%}
{{ event.title }}
</div>
{% endif %}
{% endfor %}
{% endfor %}
{% if url is defined %}
<div style="cursor:pointer; text-align: right; margin-top:20px;"><a onClick="showFrameitem('calendar','{{url }}',true)" style="{{ stylewidgetbody }}">Voir mes Agendas</a></div>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<style>.msgtopic a { color: #{{colorbodyfont}}; font-weight: bold; }</style>
{%if mini %}
<div class="widget widget-mini widget-chat" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-chat" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
{% if onheader %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
<iframe src="{{ path(tool,{'id':group,'framed':true,'border':entity.border,'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont,'colorbody':colorbody,'colormain':colormain}) }}" style="margin-top:30px" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div>
{% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}; overflow-y:auto; {%if entity.border %} padding-left: 10px; {%endif%}">
{% 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 %}
</div>
{% endif %}
</div>
{% endif %}
{%endif%}

View File

@ -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 %}
<div class="widget widget-mini widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-editor" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}; overflow-x:hidden; ">
{{ html | raw }}
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-file" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-file" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<iframe id="frame-{{directory}}" src="{{ path("app_"~access~"_file_list",{'directory':directory,'defaultview':view}) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe>
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-flux" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-flux" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% set firstflux="" %}
<div class="widgetbody" style="{{ stylewidgetbody }} ">
{% if fluxs is defined %}
{% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="color:#{{ color['fontcolorhover'] }}; background-color: #{{ color['main'] }}">Tout</div>
{% for flux in fluxs %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if flux.color is not null %}
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% endif %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }} color:#{{ color['fontcolorhover'] }};">{{ flux.title }}</div>
{% endfor %}
{% endif %}
{% endif %}
<div class="grid clearfix">
{% for feed in feeds %}
{% if loop.index==1 %}
<div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
{% 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 %}
<div class="grid-item {{ stylegrid }} feed flux-{{ feed.fluxid }}">
<div class="grid-item-content" style="{{ stylecolor }};">
<a class="linktosonde" data-sonde="Flux = {{ feed.fluxtitle }}" href="{{ feed.link }}" target="_blank">
<div class="item-link clearfix">
{% if feed.image is not empty %}
<div class="grid-item-logo">
<img class="grid-item-img" src="{{feed.image}}" width="100%">
</div>
{% endif %}
<div class="caption" style="{{ stylecolor }};">
<div class="grid-item-title">
<h2>{{ feed.title }}</h2>
{% if modelist==0 %}
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br>
{{ feed.description | nl2br }}
{% endif %}
</div>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-frame" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-frame" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
{% if onheader %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
<iframe src="{{ path(tool,{'colorbodyback':colorbodyback,'colorbodyfont':colorbodyfont}) }}" style="margin-top:30px; {{ stylewidgetbodyframe }}" class="{% if entity.autoajust %}frameajust {% endif %}"></iframe>
</div>
{% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<iframe id="frame-{{directory}}" src="{{ path(tool) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-galery" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-galery" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd %}
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'image'}) }}');" title='Ajouter des Images'><i class="fa fa-plus fa-fw"></i></a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if files|length>0 or canadd %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% if canadd %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
{% for file in files|sort %}
{% if loop.index==1 and not canadd %}
<div class="grid-sizer grid-image"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-image"></div>
{% endif %}
<div class="grid-item grid-image">
<div class="grid-item-content">
{% if canadd %}
<a style="cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name|e('js')|raw}}')" class="item-delete"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le fichier"></i></a>
{% endif %}
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name,'navigation':true }) }}',true)">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
</div>
</div>
</a>
</div>
</div>
{% endfor %}
{% if canadd %}
<div class="grid-item grid-list" style="{{ stylewidgetbodyreverse }};">
<div class="grid-item-content">
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'image'}) }}');" title='Ajouter des Images'>
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2 style="{{ stylewidgetbodyreverse }}">Ajouter des Images</h2>
</div>
</div>
</a>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-group" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-group" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd %}
<a title="Ajouter un Groupe" href="{{ path('cadoles_core_user_group_submit') }}" target="_top">
<i class="fa fa-plus fa-fw" style="{{ stylewidgetmenu }}"></i>
</a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}; overflow-x:hidden; ">
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for group in groups %}
<div class="grid-item grid-small" >
<div class="grid-item-content" style="background-color:{{ group.color ? "#"~group.color : '#'~colormain }}">
<a href="{{path('cadoles_core_home',{id:group.id})}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if group.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}{{ group.icon }}" />
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_users.png" />
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ group.title }}</h2>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
{% if canadd %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="{{ stylewidgetbodyreverse }};">
<a title="Ajouter un Groupe" href="{{path('cadoles_core_user_group_submit')}}" target="_top" style="{{ stylewidgetbodyreverse }};">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ alias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2>Ajouter un Groupe</h2>
</div>
</div>
</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-groupmessage" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-groupmessage" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if messages is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }} ">
<div class="grid clearfix">
<div class="grid-sizer {{stylegrid}}"></div>
<div class="grid-gutter-sizer {{stylegrid}}-gutter-sizer"></div>
{% 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 %}
<div class="grid-item {{ stylegrid }} msg-{{ message.id }} {{class}}" style="{{ stylewidgetbodyreverse }}; {{style}};">
<div class="grid-item-content" style="background-color:{{ message.color ? "#"~message.color : '#'~colormain }}">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img style='cursor:pointer' onClick="seeUser({{message.user.id}})" class="grid-item-img avatar" src="/{{alias}}/uploads/avatar/{{message.user.avatar}}" width="100%">
<a onClick="hideMessage({{message.id}})" style="cursor:pointer;" title="Ne plus afficher"><i class="fa fa-eye-slash"></i></a>
</div>
<div class="caption">
<div class="grid-item-title" style="position:inherit; width:85%">
{{message.user.lastname}} {{message.user.firstname}}<br>
<small>{{message.date|date('d/m/Y H:i')}} dans le groupe <u><a href="{{path('cadoles_core_home',{id:message.pageid})}}" target="_top">{{ message.pagetitle }}</a></u></small><br><br>
{{ message.topic | raw }}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -0,0 +1,60 @@
{% extends 'widget.html.twig' %}
{% block widgetmenu %}
{% endblock %}
{% block widgetbody %}
<div style="text-align: center;">
{{ description | raw }}
</div>
{%if usage=="group" %}
<div class="grid clearfix">
<div class="grid-sizer grid-verysmall"></div>
<div class="grid-gutter-sizer"></div>
{% if canadd==true %}
<div class="grid-item grid-verysmall" style="{{stylewidgetitem}}">
<div class="grid-item-content">
<a href="{{path('app_user_group_users',{'id':id,'idreturn':idpage})}}" target="_top">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ appAlias }}/uploads/icon/icon_add.png" />
</div>
<div class="grid-item-title">
<h2>Ajouter un membre</h2>
</div>
</div>
</a>
</div>
</div>
{% endif %}
{% for member in members %}
<div class="grid-item grid-verysmall" style="{{stylewidgetitem}}">
<div class="grid-item-content">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img onclick="seeUser({{member.user.id}})" src="/{{ appAlias }}/uploads/avatar/{{ member.user.avatar}}" class="grid-item-img avatar" height="110" style="cursor:pointer;">
</div>
<div class="grid-item-title">
<h2>
{{ member.user.lastname }} {{ member.user.firstname }}
{% if member.rolegroup==100 %}
<br><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>
{% elseif member.rolegroup==90 %}
<br><i class="fa fa-star"></i><i class="fa fa-star"></i>
{% elseif member.rolegroup==50 %}
<br><i class="fa fa-star"></i>
{% endif %}
</h2>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,263 @@
<style>
.widget{
margin-bottom:30px;
}
.widget-bordered {
border:1px solid;
}
.widget-menu {
float: right;
color: #fff;
margin: 10px 5px 0px 0px;
display:none;
}
.widget-menu i {
cursor:pointer;
}
.widget-header {
padding:10px;
font-family: var(--fonttitle);
}
.widget-logo {
height:30px;
margin-right:5px;
}
.widget-body {
padding: 5px 0px 0px 0px;
}
.widget-bordered .widget-body {
padding: 5px;
}
.cat-list {
color: var(--colorfttitledark);
background-color: var(--colorbgbodydark);
padding: 5px 10px;
display: inline-block;
cursor: pointer;
}
</style>
{% 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 %}
<div class="widget widget-{{widgetname}} {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} " data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ widgetstyle }}" height="{{ entity.height }}px">
<div class="widget-menu" style="{{ widgetstylemenu }}">
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" ></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})"></i>
{% endif %}
{% if canadd and access!="admin"%}
<i class="fa fa-plus fa-fw" title="Ajouter un Favori" onClick="addBookmark({{ entity.id }},true)" ></i>
{% endif %}
</div>
{%if widgethaveheader %}
<div class="widget-header" style="{{ widgetstyleheader }}">
<img class="widget-logo" src="{{widgeicon}}" />
<span class="widget-title">{{ entity.name }}</span>
</div>
{%endif%}
<div class="widget-body" style="{{ widgetstylebody }};">
{% set havemenu=false %}
{% set havebookmark=false %}
{% if menu and withbookmark!= 2 and bookmarks is not empty and itemcategorys|length > 1 %}
{% set havemenu=true %}
<div style="margin-bottom: 5px;">
{% if menuall %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},'all')">Tout</div>
{% endif %}
{% if bookmarks is not empty %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},'fav')"><i class="fa fa-heart"></i></div>
{% endif %}
{% for itemcategory in itemcategorys %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},{{itemcategory.id}})">{{itemcategory.label}}</div>
{% endfor %}
</div>
{% endif %}
{% if search %}
{% set havemenu=true %}
<div class="input-group" style="margin-bottom: 5px;">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-search"></i>&nbsp;</span>
</div>
<input id="itemsearch" onKeyup="searchItem({{ entity.id}},$(this).val());" type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
{% endif %}
{% if (bookmarks is not empty or canadd ) and (withbookmark==0 or withbookmark==2) %}
{% if withbookmark==0 and itemcategorys|length > 1 %}
<h3 class="itemcategory-title {{not havemenu ? "mt-1" : "mt-3"}} mb-0" style="{{ entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);"}}" data-idcategory="bookmark">Favoris</h3>
{% endif %}
<div class="items-list" style="margin-top:-5px">
{% 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 %}
<div class="item {{itemsize}}" style="background-color: {{ bookmarkbackgroundcolor }};" data-idcategory="bookmark" data-title="{{bookmarktitle|lower}}">
<div class="item-container">
<div class="item-content">
{% if bookmarktarget == 'frame' %}
<a class="item-link" onClick="showItemframe('bookmark{{ bookmark.id }}','{{ bookmarkurl }}')">
{% else %}
<a class="item-link" href="{{ bookmarkurl }}" target="{{bookmarktarget }}">
{% endif %}
<img height="35" src="{{ path('app_minio_image',{file:bookmarkicon}) }}">
<div class="item-title">
<h3 >{{ bookmarktitle }}</h3>
<div class="item-subtitle">{{ bookmarksubtitle|nl2br }}</div>
</div>
</a>
<div class="item-action">
{% if bookmarkcontent %}
<a style="display:none"><i class="item-info fas fa-circle-info"></i></a>
{% endif %}
</div>
</div>
<div class="item-description hide">{{ bookmarkcontent|raw }}</div>
</div>
</div>
{% endfor %}
{% if (canadd) %}
<div class="item {{ itemsize }}" style="background-color: var(--colorbgbodydark);" data-idcategory="bookmark">
<div class="item-container">
<div class="item-content">
<a class="item-link" onClick="addBookmark({{ entity.id }},true)">
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_add.png"}) }}">
<div class="item-title">
<h3 >Ajouter</h3>
<div class="item-subtitle">Ajouter un Favoris</div>
</div>
</a>
<div class="item-action">
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
{% for itemcategory in itemcategorys %}
{% if itemcategorys|length > 1 or havebookmark %} <h3 class="itemcategory-title {{loop.first and not havemenu ? "mt-1" : "mt-3"}} mb-0" style="{{ entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);"}}" data-idcategory="{{itemcategory.id}}">{{itemcategory.label}}</h3> {% endif %}
<div class="items-list" style="margin-top:-5px">
{% for item in items %}
{% if item.itemcategory==itemcategory %}
<div class="item {{itemsize}}" style="background-color: {{ item.color ? item.color : "var(--colorbgbodydark)" }};" data-idcategory="{{item.itemcategory.id}}" data-title="{{item.title|lower}}">
<div class="item-container">
<div class="item-content">
{% set url=item.url|replace({'#login#': username}) %}
{% if item.protected and not app.user %}
{% set url=path('app_login') %}
{% endif %}
{% if item.target == 'frame' %}
<a class="item-link" onClick="showItemframe({{ item.id }},'{{ url }}')">
{% else %}
<a class="item-link" href="{{ url }}" target="{{ item.target }}">
{% endif %}
{% if item.icon %}
<img height="35" src="{{ path('app_minio_image',{file:item.icon.label}) }}">
{% else %}
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_pin.png"}) }}">
{% endif %}
<div class="item-title">
<h3 >{{ item.title }}</h3>
<div class="item-subtitle">{{ item.subtitle|nl2br }}</div>
</div>
</a>
<div class="item-action">
{% if canadd %}
<a style="display:none" onClick="heartBookmark({{ item.id }})"><i class="item-heart fa fa-heart"></i></a></a>
{% endif %}
{% if item.content %}
<a style="display:none"><i class="item-info fas fa-circle-info"></i></a>
{% endif %}
</div>
</div>
<div class="item-description hide">{{ item.content|raw }}</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</div>

View File

@ -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 %}
<div class="widget widget-mini widget-itemessential" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-itemessential" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd and access!="config"%}
<a title="Ajouter une Application" href="{{ path('cadoles_portal_user_page_application') }}">
<i class="fa fa-plus fa-fw" style="{{ stylewidgetmenu }}"></i>
</a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if canadd or bookmarks is not empty or items is not empty %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
<div class="grid-sizer {{ stylegrid }}"></div>
<div class="grid-gutter-sizer"></div>
{% for bookmark in bookmarks %}
{% if bookmark.item %}
<div class="grid-item {{ stylegrid }}" data-idcategory="bookmark" data-title="{{ bookmark.item.title|lower }}">
<div class="grid-item-content" style="background-color: {{ bookmark.item.color ? "#"~bookmark.item.color : '#'~colormain }};">
{% if bookmark.item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if canadd %}
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer des favoris"></i></a>
{% endif %}
{% if bookmark.item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.item.id }}','{{ bookmark.item.url|replace({'#login#': username}) }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.item.title }}" href="{{ bookmark.item.url|replace({'#login#': username}) }}" target="{{ bookmark.item.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo" title="{{ bookmark.item.subtitle|nl2br }}">
{% if bookmark.item.icon %}
<img class="grid-item-img" src="/{{ alias }}/{{ bookmark.item.icon.label }}">
{% else %}
<img class="grid-item-img" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
<span>{{ bookmark.item.subtitle|nl2br }}</span>
{% if not bookmark.item.badgeurl is empty %}
<div style="margin-top:5px;text-align:center;{% if stylegrid == "grid-list"%} float: right;position: absolute;top: 10px;right: -50px; {%endif%}">
<div class="itembadgeurl badge badge-pill" data-url="{{bookmark.item.badgeurl}}" style="background-color: #ffffff; color: {{ bookmark.item.color ? "#"~bookmark.item.color : '#'~colormain }};"></div>
</div>
{% endif %}
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ bookmark.item.content|raw }}
</div>
</div>
</div>
{%else%}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: {{ bookmark.color ? "#"~bookmark.color : '#'~colormain }};">
<a style="cursor:pointer" onClick="modBookmark({{ bookmark.id }})" class="item-update"><i style="color: #FFF" class="fa fa-file" title="Modifier le favori"></i></a>
<a style="cursor:pointer" onClick="delBookmark({{ bookmark.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-trash" title="Supprimer le favori"></i></a>
{% if bookmark.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" style="cursor:pointer" onClick="showFrameitem('bookmark{{ bookmark.id }}','{{ bookmark.url|replace({'#login#': username}) }}')">
{% elseif bookmark.target == "_self" %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ bookmark.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ bookmark.title }}" href="{{ bookmark.url|replace({'#login#': username}) }}" target="{{ bookmark.target }}">
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo" title="{{ bookmark.subtitle|nl2br }}">
{% if bookmark.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ bookmark.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ bookmark.title }}</h2>
<span>{{ bookmark.subtitle|nl2br }}</<span>
</div>
</div>
</a>
</div>
</div>
{%endif%}
{% endfor %}
{% for item in items %}
<div class="grid-item {{ stylegrid }}" data-idcategory="{{ item.itemcategory.id }}" data-iditem="{{ item.id }}">
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
{% if item.content %}
<a style="cursor:pointer" class="item-preview"><i style="color: #FFF" class="fa fa-info" title="Informations sur ce service"></i></a>
{% endif %}
{% if canadd %}
<a style="cursor:pointer" onClick="heartBookmark({{ item.id }})" class="item-heart"><i style="color: #FFF" class="fa fa-heart" title="Ajouter aux favoris"></i></a>
{% endif %}
{% if item.protected and not app.user %}
{% if mode_auth == "SAML" %}
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "CAS" %}
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% elseif mode_auth == "MYSQL" %}
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
{% endif %}
{% else %}
{% if item.target == 'frame' %}
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url|replace({'#login#': username}) }}')">
{% elseif item.target == "_self" %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{{ item.target }}">
{% endif %}
{% endif %}
<div class="item-link clearfix">
<div class="grid-item-logo" title="{{ item.subtitle|nl2br }}">
{% if item.icon %}
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
<span>{{ item.subtitle|nl2br }}</span>
{% if not item.badgeurl is empty %}
<div style="margin-top:5px;text-align:center;{% if stylegrid == "grid-list"%} float: right;position: absolute;top: 10px;right: -50px; {%endif%}">
<div class="itembadgeurl badge badge-pill" data-url="{{item.badgeurl}}" style="background-color: #ffffff; color: {{ item.color ? "#"~item.color : '#'~colormain }};"></div>
</div>
{% endif %}
</div>
</div>
</a>
<div class="grid-item-body" style="display:none">
{{ item.content|raw }}
</div>
</div>
</div>
{% endfor %}
{% if canadd %}
<div class="grid-item {{ stylegrid }}">
<div class="grid-item-content" style="background-color: #{{colormain}};cursor:pointer;">
<a title="Ajouter une Application" href="{{ path('cadoles_portal_user_page_application') }}">
<div class="item-link clearfix">
<div class="grid-item-logo">
<img class="grid-item-img imageshadow" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">
</div>
<div class="grid-item-title">
<h2>Ajouter</h2>
<span>Ajouter une Application</<span>
</div>
</div>
</a>
</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -0,0 +1,22 @@
{% set onlyheader=true %}
{% extends 'widget.html.twig' %}
{% block widgetheader %}
{% if target == 'frame' %}
<a class="linktosonde" data-sonde="{{ entity.name }}" style="{{stylewidgetitem}}; font-family: var(--fonttitle); cursor:pointer;" onClick="showFrameitem('link{{ entity.id }}','{{ url|replace({'#login#': username}) }}')">
{% elseif target == "_self" %}
<a class="linktosonde" data-sonde="{{ entity.name }}" style="{{stylewidgetitem}}; font-family: var(--fonttitle); cursor:pointer;" href="{{ url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ target }}{% endif %}">
{% else %}
<a class="linktosonde" data-sonde="{{ entity.name }}" style="{{stylewidgetitem}}; font-family: var(--fonttitle); cursor:pointer;" href="{{ url|replace({'#login#': username}) }}" target="{{ target }}">
{% endif %}
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" style="max-height: 100%; width: auto; display: block; margin: auto; padding-top: 10px;" />
{% endif %}
<div style="text-align: center;">{{ entity.name }}</div>
</a>
{% endblock %}

View File

@ -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 %}
<div class="widget widget-mini widget-onlydoc" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-onlydoc" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbody }}">
<iframe id="frame-{{directory}}" src="{{ path("cadoles_portal_"~access~"_frame_only",{'directory':directory,'defaultview':view}) }}" data-color="#{{colorbodyfont}}" style="{{ stylewidgetbodyframe }}" class="{% if not entity.autoajust %}notframeajust {% endif %}"></iframe>
</div>
</div>
{% endif %}

View File

@ -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) %}
<style>
</style>
{%if mini %}
<div class="widget widget-mini widget-project" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-project" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a href='{{ path('app_config_project') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% 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 %}
<a onClick="showFrameitem('project','{{ urladd }}',true)" style="{{ stylewidgetmenu }}" title="Ajouter une Tâche"><i class="fa fa-plus fa-fw"></i></a>
<a onClick="showFrameitem('project','{{ urlview }}',true)" style="{{ stylewidgetmenu }}" title="Gérer mes Tâches"><i class="fa fa-th fa-fw"></i></a>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ appAlias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ appAlias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
{% if projecttasks|length >= 1 %}
<div class="widgetbody" style="{{ stylewidgetbody }}">
<div class="grid clearfix">
{% for projecttask in projecttasks %}
{% if loop.index==1 %}
<div class="grid-sizer grid-list"></div>
<div class="grid-gutter-sizer"></div>
{% endif %}
<div class="grid-item grid-list">
{% set colortask = color['main'] %}
{% if projecttask.projecttasktag %}
{% set colortask = projecttask.projecttasktag.color %}
{% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}; {%if not entity.border%}padding:5px;{%endif%}">
<a title="Voir la Tâche" href="{{ path('app_'~access~'_projecttask_view',{'id':projecttask.id,page:entity.page.id}) }}">
<div class="item-link clearfix">
<div class="grid-item-logo" style="width:10%; margin:0px; text-align: center;">
{% if projecttask.user is empty %}
<img class='grid-item-img avatar' src="/{{ appAlias }}/uploads/avatar/{{ projecttask.owner.avatar }}" style="width:55px; height:auto">
{% else %}
<img class='grid-item-img avatar' src="/{{ appAlias }}/uploads/avatar/{{ projecttask.user.avatar }}" style="width:55px; height:auto">
{% endif %}
</div>
<div class="grid-item-title" style="width:90%; position:initial; display: inline-block; padding:0px">
<h2 style="line-height:18px;height:auto;padding-left:5px;">{{projecttask.name}}</h2>
<div style="font-size:9px; display:inline-block; width:40%;padding-left:5px;">Affectée à
{% if projecttask.user is empty %}
{{ projecttask.owner.username }}
{% else %}
{{ projecttask.user.username }}
{% endif %}
<br>Crée le {{ projecttask.submit|date("d/m/Y à H:i") }}
<br>Dans le projet {{projecttask.project.name }}
</div>
<div style="text-align: right; font-size:9px; display:inline-block; width:35%;">
Priorité = {{ projecttask.priority }}</br>
Avant le = {{ projecttask.end|date("d/m/Y") }}</br>
{% if projecttask.projecttasktag %}
Type = {{ projecttask.projecttasktag.name }}<br>
{% endif %}
{% if projecttask.projecttaskstatus %}
Statut = {{ projecttask.projecttaskstatus.name }}<br>
{% endif %}
</div>
<div style="margin-top:-5px; text-align: right; display:inline-block; width:20%;">
<div style="font-size:35px; line-height:30px">
{{ projecttask.percentage }}<i style="font-size:12px">%</i>
</div>
</div>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endif %}

View File

@ -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 %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-separator" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate %}
<div class="widgetmenu">
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
</div>
{% endif %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
{% if seeicon %}
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
{% endif %}
{% if seetitle %}
<span class="title">{{ entity.name }}</span>
{% else %}
<style>
div.separator {
width: 100%;
height: 5px;
margin-left: auto;
margin-right: auto;
background-color:#{{colorbodyfont}};
float:left;
position: relative;
top: 20px;
}
</style>
<div class="separator"></div>
{% endif %}
</div>
</div>
{% endif %}
<script>
</script>

View File

@ -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 %}
<div class="widget widget-mini widget-slide" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-slide" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd %}
<i title="Gérer le Carrousel" class="fa fa-th fa-fw" onClick="listSlide({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetbodyimage }}">
{% set intervalmilli = interval * 1000 %}
<div class="slick" data-slick='{"autoplaySpeed": {{ intervalmilli }} }'>
{% for slide in slides %}
<div style="background-image:url(/{{ alias }}/{{ slide.image }}); ">
{% if slide.title is not empty %}
<h1 class="slicktitle" style="{{ stylelink }}">{{slide.title}}</h1>
{% endif %}
{% if slide.url is not empty %}
{% if slide.target == 'frame' %}
<a class="slicklink" style="{{ stylelink }} cursor:pointer" onClick="showFrameitem('slide{{ slide.id }}','{{ slide.url|replace({'#login#': username}) }}')">
{% elseif slide.target == "_self" %}
<a class="slicklink" style="{{ stylelink }}" href="{{ slide.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ slide.target }}{% endif %}">
{% else %}
<a class="slicklink" style="{{ stylelink }}" href="{{ slide.url|replace({'#login#': username}) }}" target="{{ slide.target }}">
{% endif %}
<i class="fa fa-link"></i></a>
{% endif %}
{% if slide.subtitle is not empty %}
<span class="slicksubtitle" style="{{ stylelink }}">{{slide.subtitle}}</span>
{% endif %}
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}

View File

@ -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 %}
<div class="widget widget-mini widget-project" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo" title="{{ entity.name }}"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo" title="{{ entity.name }}"/>
{% endif %}
</a>
</div>
</div>
{% else %}
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-url" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if look=="list" %}
<i class="glyphicon glyphicon-resize-small" title="Réduire le Widget" onClick="smallWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% else %}
<i class="glyphicon glyphicon-resize-full" title="Agrandir le Widget" onClick="bigWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
{% if imagemedia %}
{% if entity.autoajust %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}">
<img src="{{ url|replace({'#login#': username}) }}" width="100%" >
</div>
{% else %}
<div class="widgetheader" style="{{ stylewidgetbodyimage }} width:100%; background-image: url({{ url|replace({'#login#': username}) }}); background-size:cover; background-position:center;")></div>
{% endif %}
{% else %}
<div class="widgetheader" style="{{ stylewidgetheader }}">
{% if entity.icon %}
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
{% else %}
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
{% endif %}
<span class="title">{{ entity.name }}</span>
</div>
<div class="widgetbody" style="{{ stylewidgetbodyframe }}">
{% set minheight="" %}
{%if look=="list" %}
{% set minheight="min-height:1300px;" %}
{% endif %}
<iframe src="{{ url|replace({'#login#': username}) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="{{ stylewidgetbodyframe }} {{minheight}}"></iframe>
</div>
{% endif %}
</div>
{% endif %}
<script>
</script>

View File

@ -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 %}
<div
class="widget widget-info"
data-id="{{ entity.id }}"
loc="{{ entity.loc }}"
style="{{ widgetheight }}">
<div
class="widgetmenu"
style="{{widgetheaderback}}{{widgetheaderfont}}">
{{ widgetmenu|raw }}
</div>
<div
class="widgetheader"
style="{{widgetheaderback}}{{widgetheaderfont}}{{widgetheaderborder}}">
{% if icon %}
<img src="/{{ appAlias }}{{ icon }}" class="logo" style="border-radius:100%"/>
{% else %}
<img src="{{icondefault}}" class="logo"/>
{% endif %}
<span class="title">{{ title }}</span>
</div>
<div
class="widgetbody"
style="{{widgetbodyback}}{{widgetbodyfont}}{{widgetbodyborder}}{{widgetbodypadding}}{{widgetbodydisplay}}">
{% endif %}

View File

@ -0,0 +1,13 @@
{%if mini %}
<div class="widget widget-mini widget-info" data-id="{{ entity.id }}" loc="{{ entity.loc }}">
<div class="widgetheader">
<a style="cursor:pointer" onClick="bigWidget({{entity.id}})">
{% if icon %}
<img src="/{{ appAlias }}{{ icon }}" class="logo" title="{{ title }}"/>
{% else %}
<img src="{{icondefault}}" class="logo" title="{{ title }}"/>
{% endif %}
</a>
</div>
</div>
{% endif %}