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

This commit is contained in:
afornerot 2023-01-23 09:46:34 +01:00
parent 46c3f9ca12
commit 800945e44b
67 changed files with 3792 additions and 4288 deletions

4
.env
View File

@ -7,7 +7,7 @@ APP_SESSIONTIME=1440
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
# Database
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8"
# Redis Session
REDIS_HOST=127.0.0.1
@ -169,7 +169,7 @@ HYDRA_CONSENTCHALLENGE="http://127.0.0.1:4445/oauth2/auth/requests/consent?conse
HYDRA_CONSENTCHALLENGEACCEPT="http://127.0.0.1:4445/oauth2/auth/requests/consent/accept?consent_challenge="
# Lock
LOCK_DSN="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8"
LOCK_DSN="postgresql://symfony:ChangeMe@127.0.0.1:5432/ninegate?serverVersion=13&charset=utf8"
# Sentry
SENTRY_DSN=

View File

@ -41,6 +41,10 @@ require('spectrum-colorpicker2/dist/spectrum.min.css');
require('crop-select-js/crop-select-js.min.css');
window.CropSelectJs = require('crop-select-js/crop-select-js.min.js');
// iframe-resizer
require('iframe-resizer/js/iframeResizer.min.js');
require('iframe-resizer/js/iframeResizer.contentWindow.min.js');
// Start the Stimulus application
import './bootstrap';

View File

@ -2,13 +2,16 @@ $(document).ready(function() {
// Color
$(".pick-a-color").spectrum(
{
type: "text",
showAlpha: false
preferredFormat: "hex",
type: "string",
showPalette: true,
allowEmpty: true,
showAlpha: false,
}
);
$(".pick-a-color").attr("autocomplete","off");
// method confirm
// Method confirm
var doit = true;
$("a[data-method]").on('click',function(){
if($(this).data('confirm')){
@ -57,33 +60,45 @@ $(document).ready(function() {
}
});
// Resize
resize();
// select2-icon
function iformat(icon) {
return $('<span><i class="' + icon.id + '"></i> ' + icon.text + '</span>');
}
$('.select2-icon').select2({
width: "100%",
placeholder: 'choisir un icône',
allowClear: true,
templateSelection: iformat,
templateResult: iformat,
formatResult: iformat,
allowHtml: true,
escapeMarkup: function(m) {
return m;
}
})
// Menu
$(".dropdown-toggle").click(function(){
$(this).parent().find(".dropdown-menu").toggle();
})
$(".nav-toogle").click(function(){
$("#selmenu").modal("toggle");
})
// Forcer le resize des objects
Resize();
// Focus
$("#page").focus();
});
$( window ).resize(function() {
resize();
Resize();
});
function resize() {
if($("#header").is(":visible")){
$(".navbar-logo").hide();
$("#menulink").hide();
$("#header").hide();
}
else {
$(".navbar-logo").show();
$("#menulink").show();
$("#header").show();
}
$("main").css("height",$(window).height()-$(".header").height());
$("#page").css("height",$(window).height()-$(".header").height());
$("#sidebar").css("min-height",$("body").height()-$(".header").height());
}

View File

@ -114,52 +114,111 @@ border-width: 1px;
padding: 0 0 0 0.5rem !important;
}
.navbar-logo img{
height:20px;
height:30px;
}
.navbar i {
font-size: 20px;
min-width: 30px;
height:20px;
#menulink {
zoom:150%;
}
/* MENU */
#menu {
height:50px;
min-height:44px;
padding: 0px 0px 0px 10px !important;
justify-content: space-around;
}
#menu .navbar-logo {
margin-right: 10px;
}
#menuapp {
background-color: var(--colorbgbodydark);
}
#menuuser {
min-width: 100px;
display:flex;
justify-content: end;
}
.nav-item {
padding:10px 10px;
}
.nav-item.active {
background-color: var(--colorbgbodydark-darker);
}
.menupage a {
display: flex;
align-items: center;
}
.menupage a i{
margin-right: 5px;
}
.dropdown-menu {
background-color: var(--colorbgbodydark);
margin-top: 15px;
}
.dropdown-item:hover, .dropdown-item:focus {
background-color: var(--colorbgbodydark-darker);
color: var(--colorftbodydark);
}
@media (max-width: 991px) {
#menu {
display:flex !important;
height: auto;
padding: 0px !important;
}
#menuapp {
position: absolute;
top:50px;
left:0px;
width:100%;
overflow-y: auto;
height:500px;
display:none;
}
#menuapp .nav {
flex-direction: column;
}
#menuapp .navbar-nav {
flex-direction: column;
padding:15px;
}
#menu .nav-toogle {
display:block !important;
}
#pagesportal {
display:block !important;
}
#pagesuser {
display:block !important;
}
.navbar-logo {
padding: 10px 5px 10px 10px !important;
}
.navbar-logo img {
height:40px;
}
.navbar i {
font-size: 20px;
min-width: 30px;
height:20px;
}
#switchHeader {
display:none;
}
}
}
/* SIDEBAR */
#sidebar {
@ -230,6 +289,10 @@ border-width: 1px;
display: none !important;
}
.card-body .form-group:first-child {
margin-top: 0px !important;
}
/* ITEM */
.itemframe {
@ -239,6 +302,7 @@ border-width: 1px;
.items-list {
display:flex;
flex-wrap: wrap;
margin-bottom: 5px;
}
.item {
@ -247,7 +311,7 @@ border-width: 1px;
text-align: center;
justify-content: center;
margin-right:5px;
margin-top:5px;
margin-bottom:5px;
flex-wrap: wrap;
color: var(--colorftbodydark) !important;
}
@ -287,7 +351,7 @@ border-width: 1px;
}
.item-subtitle {
font-size: 12px;
font-size: 10px;
margin:0px;
color: var(--colorftbodydark);
}
@ -295,9 +359,16 @@ border-width: 1px;
.item-description {
color: var(--colorftbodydark);
text-align: left;
padding: 0px 10px;
padding: 0px 5px;
}
.item-description img {
max-width: 100% !important;
height: auto !important;
}
.item-description p:last-child {
margin-bottom: 0px;
}
.item-verysmall {
width: 80px;
@ -433,3 +504,67 @@ border-width: 1px;
.item-list .item-action {
width:auto;
}
.item-list .item-description {
padding:10px 0px 5px 0px;
}
/* WIDGET */
.widget{
margin-bottom:30px;
}
.widget-bordered {
border:1px solid;
}
.widget-menu {
float: right;
color: #fff;
margin: 10px 5px 0px 0px;
display:none;
}
.widget-menu i {
cursor:pointer;
}
.widget-header {
padding:10px 10px 5px 10px;
font-family: var(--fonttitle);
font-size: 25px;
}
.widget-logo {
height:40px;
margin-right:5px;
margin-top:-5px;
cursor: pointer;
}
.widget-title {
cursor: pointer;
}
.widget-body {
padding: 5px 0px 0px 0px;
}
.widget-bordered .widget-body {
padding: 5px;
}
.widget-body .items-list {
margin-bottom: 5px;
}
.widget-body .item-list:first-child {
margin-top: 0px;
}
.widget-body .items-list:last-child {
margin-bottom: -5px;
}
.widget-body .item-description {
padding:10px 0px 0px 0px;
}
.cat-list {
color: var(--colorfttitledark);
background-color: var(--colorbgbodydark);
padding: 5px 10px;
display: inline-block;
cursor: pointer;
}

View File

@ -913,11 +913,6 @@ app_admin_alert_order:
controller: App\Controller\AlertController::order
defaults: { access: admin }
app_admin_ajax_alert_seleclist:
path: /admin/alert/ajax/selectlist
controller: App\Controller\AlertController::seleclist
defaults: { access: admin }
#-- Access all
app_all_alert_read:
path: /all/alert/read
@ -970,11 +965,6 @@ app_admin_item_order:
controller: App\Controller\ItemController::order
defaults: { access: admin }
app_admin_item_selectlist:
path: /admin/item/selectlist
controller: App\Controller\ItemController::seleclist
defaults: { access: admin }
#== ITEM CATEGORY ========================================================================================================================================
@ -1004,17 +994,22 @@ app_admin_itemcategory_order:
#-- Access config
app_admin_bookmark_submit:
path: /admin/bookmark/submit/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::order
controller: App\Controller\BookmarkController::submit
defaults: { access: admin }
app_admin_bookmark_update:
path: /admin/bookmark/update/{idpage}/{id}
path: /admin/bookmark/update/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::update
defaults: { access: admin }
app_admin_bookmark_delete:
path: /admin/bookmark/delete/{idpage}/{id}
path: /admin/bookmark/delete/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::delete
defaults: { access: admin }
app_admin_bookmark_heart:
path: /admin/bookmark/heart
controller: App\Controller\BookmarkController::heart
defaults: { access: admin }
#-- Access all
@ -1024,12 +1019,12 @@ app_all_bookmark_submit:
defaults: { access: all }
app_all_bookmark_update:
path: /all/bookmark/update/{idpage}/{id}
path: /all/bookmark/update/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::update
defaults: { access: all }
app_all_bookmark_delete:
path: /all/bookmark/delete/{idpage}/{id}
path: /all/bookmark/delete/{id}/{idpage}/{idwidget}/{touser}
controller: App\Controller\BookmarkController::delete
defaults: { access: all }
@ -1233,148 +1228,149 @@ app_all_message_see:
#== PAGE TEMPLATE ========================================================================================================================================
#-- Access admin
app_admin_pagetemplate:
app_admin_page_template:
path: /admin/template
controller: App\Controller\PagetemplateController::list
defaults: { access: admin }
defaults: { access: admin, usage: template }
app_admin_pagetemplate_tablelist:
app_admin_page_template_tablelist:
path: /admin/template/tablelist
controller: App\Controller\PagetemplateController::tablelist
defaults: { access: admin }
defaults: { access: admin, usage: template }
app_admin_pagetemplate_submit:
app_admin_template_submit:
path: /admin/template/submit
controller: App\Controller\PagetemplateController::submit
defaults: { access: admin }
defaults: { access: admin, usage: template }
app_admin_pagetemplate_update:
app_admin_page_template_update:
path: /admin/template/update/{id}
controller: App\Controller\PagetemplateController::update
defaults: { access: admin }
defaults: { access: admin, usage: template }
app_admin_pagetemplate_delete:
app_admin_page_template_delete:
path: /admin/template/delete/{id}
controller: App\Controller\PagetemplateController::delete
defaults: { access: admin }
defaults: { access: admin, usage: template }
app_admin_pagetemplate_view:
app_admin_page_template_view:
path: /admin/template/view/{id}
controller: App\Controller\PagetemplateController::view
defaults: { access: admin }
defaults: { access: admin, usage: template }
#-- Access all
app_all_pagetemplate_selectlist:
app_all_page_template_selectlist:
path: /all/template/selectlist
controller: App\Controller\PagetemplateController::selectlist
defaults: { access: admin }
defaults: { access: admin, usage: template }
#== PAGE =================================================================================================================================================
#-- Access admin
app_admin_page:
app_admin_page_portal:
path: /admin/page/
controller: App\Controller\PageController::list
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_ajax_list:
path: /admin/page/ajax/list
app_admin_page_portal_tablelist:
path: /admin/page/tablelist
controller: App\Controller\PageController::tablelist
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_ajax_page_seleclist:
path: /admin/page//ajax/selectlist
controller: App\Controller\PageController::selectlist
defaults: { access: admin }
app_admin_page_submit:
app_admin_page_portal_submit:
path: /admin/page/submit
controller: App\Controller\PageController::submit
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_update:
app_admin_page_portal_update:
path: /admin/page/update/{id}
controller: App\Controller\PageController::update
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_delete:
app_admin_page_portal_delete:
path: /admin/page/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_view:
app_admin_page_portal_view:
path: /admin/page/view/{id}
controller: App\Controller\PageController::view
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_order:
app_admin_page_portal_order:
path: /admin/page/order
controller: App\Controller\PageController::order
defaults: { access: admin }
defaults: { access: admin, usage: portal }
app_admin_page_upload:
path: /admin/page/upload
controller: App\Controller\PageController::upload
defaults: { access: admin }
app_admin_page_upload_direct:
path: /admin/page//upload&responseType=json
controller: App\Controller\PageController::upload
defaults: { access: admin }
#-- Access all
app_all_page_submit:
path: /all/page/submit
#-- Access all
# usage=user
app_all_page_user_submit:
path: /all/page/user/submit
controller: App\Controller\PageController::submit
defaults: { access: all }
defaults: { access: all, usage: user }
app_all_page_update:
path: /all/page/update/{id}
app_all_page_user_update:
path: /all/page/user/update/{id}
controller: App\Controller\PageController::update
defaults: { access: all }
defaults: { access: all, usage: user }
app_all_page_delete:
path: /all/page/delete/{id}
app_all_page_user_delete:
path: /all/page/user/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: all }
defaults: { access: all, usage: user }
app_all_page_share:
path: /all/page/share/{id}
controller: App\Controller\PageController::share
defaults: { access: all }
app_all_page_view:
path: /page/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all }
app_all_page_order:
path: /all/page/order
app_all_page_user_order:
path: /all/page/user/order
controller: App\Controller\PageController::order
defaults: { access: all }
defaults: { access: all, usage: user }
app_all_page_upload:
path: /all/page/upload
controller: App\Controller\PageController::selectlist
defaults: { access: all }
# usage=group
app_all_page_group_submit:
path: /all/page/group/submit
controller: App\Controller\PageController::submit
defaults: { access: all, usage: group }
app_all_page_upload_direct:
path: /all/page/upload&responseType=json
controller: App\Controller\PageController::upload
defaults: { access: all }
app_all_page_group_update:
path: /all/page/group/update/{id}
controller: App\Controller\PageController::update
defaults: { access: all, usage: group }
# Page spécifique
app_all_page_group_delete:
path: /all/page/group/delete/{id}
controller: App\Controller\PageController::delete
defaults: { access: all, usage: group }
app_all_page_group_order:
path: /all/page/group/order
controller: App\Controller\PageController::order
defaults: { access: all, usage: group }
#-- Access visitor
# usage=portal
app_all_page_portal_view:
path: /page/portal/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: portal }
# usage=user
app_all_page_user_view:
path: /page/user/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: user }
# usage=group
app_all_page_group_view:
path: /page/group/view/{id}
controller: App\Controller\PageController::view
defaults: { access: all, usage: group }
#-- Page spécifique
app_all_page_application:
path: /page/application
controller: App\Controller\PageController::application
defaults: { access: all }
app_all_page_ajax_msgcounter:
path: /page/msgcounter
controller: App\Controller\PageController::msgcounter
defaults: { access: all }
#== PAGE WIDGET ==========================================================================================================================================
@ -1397,22 +1393,12 @@ app_admin_pagewidget_delete:
app_admin_pagewidget_order:
path: /admin/pagewidget/order
controller: App\Controller\PageController::order
defaults: { access: admin }
app_admin_pagewidget_upload:
path: /admin/pagewidget/upload
controller: App\Controller\PagewidgetController::upload
defaults: { access: admin }
app_admin_pagewidget_upload_direct:
path: /admin/pagewidget/upload&responseType=json
controller: App\Controller\PagewidgetController::upload
controller: App\Controller\PagewidgetController::order
defaults: { access: admin }
app_admin_pagewidget_view_url:
path: /admin/pagewidget/view/url/{id}
controller: App\Controller\PageController::viewurl
controller: App\Controller\PagewidgetController::viewurl
defaults: { access: admin }
app_admin_pagewidget_view_urlfixe:
@ -1512,35 +1498,25 @@ app_admin_pagewidget_view_groupmessage:
#-- Access all
app_all_pagewidget_widget_sumbit:
path: /user/pagewidget/submit/{idpage}/{idwidgettype}
path: /all/pagewidget/submit/{idpage}/{idwidgettype}
controller: App\Controller\PagewidgetController::submit
defaults: { access: all }
app_all_pagewidget_widget_update:
path: /user/pagewidget/update/{idpage}/{idwidget}
path: /all/pagewidget/update/{idpage}/{idwidget}
controller: App\Controller\PagewidgetController::update
defaults: { access: all }
app_all_pagewidget_delete:
path: /user/pagewidget/delete/{idwidget}
path: /all/pagewidget/delete/{idwidget}
controller: App\Controller\PagewidgetController::delete
defaults: { access: all }
app_all_pagewidget_order:
path: /user/pagewidget/order
path: /all/pagewidget/order
controller: App\Controller\PagewidgetController::order
defaults: { access: all }
app_all_pagewidget_upload:
path: /user/pagewidget/upload
controller: App\Controller\PagewidgetController::upload
defaults: { access: all }
app_all_pagewidget_upload_direct:
path: /user/pagewidget/upload&responseType=json
controller: App\Controller\PagewidgetController::upload
defaults: { access: all }
app_all_pagewidget_view_url:
path: /pagewidget/view/url/{id}
controller: App\Controller\PagewidgetController::viewurl

View File

@ -31,7 +31,7 @@ services:
container_name: nineskeletor-postgresql
hostname: nineskeletor-postgresql
environment:
POSTGRES_MULTIPLE_DATABASES: app,hydra
POSTGRES_MULTIPLE_DATABASES: ninegate,hydra
POSTGRES_PASSWORD: ChangeMe
POSTGRES_USER: symfony
ports:

View File

@ -1,156 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221002124137 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE audit_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE cron_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE groupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau01_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau02_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau03_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE niveau04_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE registration_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE useraccount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usergroupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usermodo_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE whitelist_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE audit (id INT NOT NULL, entityname VARCHAR(250) NOT NULL, entityid VARCHAR(250) NOT NULL, datesubmit TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, username VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, detail TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX search_idx ON audit (entityname, entityid, datesubmit)');
$this->addSql('COMMENT ON COLUMN audit.detail IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE config (id VARCHAR(255) NOT NULL, title VARCHAR(250) NOT NULL, value TEXT DEFAULT NULL, defaultvalue TEXT NOT NULL, roworder VARCHAR(255) NOT NULL, visible BOOLEAN NOT NULL, changeable BOOLEAN NOT NULL, required BOOLEAN NOT NULL, type VARCHAR(255) NOT NULL, grouped VARCHAR(255) NOT NULL, category VARCHAR(255) NOT NULL, help TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cron (id INT NOT NULL, command VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, statut INT DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, startexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, endexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, nextexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, repeatinterval INT DEFAULT NULL, jsonargument TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE groupe (id INT NOT NULL, owner_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, email VARCHAR(250) DEFAULT NULL, isopen BOOLEAN DEFAULT false NOT NULL, isworkgroup BOOLEAN DEFAULT false NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)');
$this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6DFC7E23EA750E8 ON niveau01 (label)');
$this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)');
$this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
$this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
$this->addSql('CREATE TABLE registration (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, email VARCHAR(128) NOT NULL, isvisible BOOLEAN NOT NULL, postaladress VARCHAR(250) DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, statut INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7F85E0677 ON registration (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7E7927C74 ON registration (email)');
$this->addSql('CREATE INDEX IDX_62A8A7A759FDD7AB ON registration (niveau01_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A74B487845 ON registration (niveau02_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A7F3F41F20 ON registration (niveau03_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A76E232799 ON registration (niveau04_id)');
$this->addSql('CREATE TABLE useraccount (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, apikey VARCHAR(255) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, roles TEXT NOT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, isactive BOOLEAN NOT NULL, email VARCHAR(128) NOT NULL, avatar VARCHAR(250) DEFAULT \'0\', isvisible BOOLEAN NOT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, preference TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AF85E0677 ON useraccount (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AE7927C74 ON useraccount (email)');
$this->addSql('CREATE INDEX IDX_E157AA1A59FDD7AB ON useraccount (niveau01_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A4B487845 ON useraccount (niveau02_id)');
$this->addSql('CREATE INDEX IDX_E157AA1AF3F41F20 ON useraccount (niveau03_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A6E232799 ON useraccount (niveau04_id)');
$this->addSql('COMMENT ON COLUMN useraccount.roles IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN useraccount.preference IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE usergroupe (id INT NOT NULL, user_id INT DEFAULT NULL, group_id INT DEFAULT NULL, rolegroup INT NOT NULL, apikey VARCHAR(60) NOT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6C439BE5A76ED395 ON usergroupe (user_id)');
$this->addSql('CREATE INDEX IDX_6C439BE5FE54D947 ON usergroupe (group_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6C439BE5A76ED395FE54D947 ON usergroupe (user_id, group_id)');
$this->addSql('CREATE TABLE usermodo (id INT NOT NULL, user_id INT NOT NULL, niveau01_id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D162D6C4A76ED395 ON usermodo (user_id)');
$this->addSql('CREATE INDEX IDX_D162D6C459FDD7AB ON usermodo (niveau01_id)');
$this->addSql('CREATE TABLE whitelist (id INT NOT NULL, label VARCHAR(250) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CB069864EA750E8 ON whitelist (label)');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C217E3C61F9 FOREIGN KEY (owner_id) REFERENCES useraccount (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau02 ADD CONSTRAINT FK_F4F52F9959FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau03 ADD CONSTRAINT FK_83F21F0F4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE niveau04 ADD CONSTRAINT FK_1D968AACF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A759FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A74B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A7F3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE registration ADD CONSTRAINT FK_62A8A7A76E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A59FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A4B487845 FOREIGN KEY (niveau02_id) REFERENCES niveau02 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1AF3F41F20 FOREIGN KEY (niveau03_id) REFERENCES niveau03 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE useraccount ADD CONSTRAINT FK_E157AA1A6E232799 FOREIGN KEY (niveau04_id) REFERENCES niveau04 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usergroupe ADD CONSTRAINT FK_6C439BE5FE54D947 FOREIGN KEY (group_id) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C4A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE usermodo ADD CONSTRAINT FK_D162D6C459FDD7AB FOREIGN KEY (niveau01_id) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE audit_id_seq CASCADE');
$this->addSql('DROP SEQUENCE cron_id_seq CASCADE');
$this->addSql('DROP SEQUENCE groupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau01_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau02_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau03_id_seq CASCADE');
$this->addSql('DROP SEQUENCE niveau04_id_seq CASCADE');
$this->addSql('DROP SEQUENCE registration_id_seq CASCADE');
$this->addSql('DROP SEQUENCE useraccount_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usergroupe_id_seq CASCADE');
$this->addSql('DROP SEQUENCE usermodo_id_seq CASCADE');
$this->addSql('DROP SEQUENCE whitelist_id_seq CASCADE');
$this->addSql('ALTER TABLE groupe DROP CONSTRAINT FK_4B98C217E3C61F9');
$this->addSql('ALTER TABLE niveau02 DROP CONSTRAINT FK_F4F52F9959FDD7AB');
$this->addSql('ALTER TABLE niveau03 DROP CONSTRAINT FK_83F21F0F4B487845');
$this->addSql('ALTER TABLE niveau04 DROP CONSTRAINT FK_1D968AACF3F41F20');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A759FDD7AB');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A74B487845');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A7F3F41F20');
$this->addSql('ALTER TABLE registration DROP CONSTRAINT FK_62A8A7A76E232799');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A59FDD7AB');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A4B487845');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1AF3F41F20');
$this->addSql('ALTER TABLE useraccount DROP CONSTRAINT FK_E157AA1A6E232799');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5A76ED395');
$this->addSql('ALTER TABLE usergroupe DROP CONSTRAINT FK_6C439BE5FE54D947');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C4A76ED395');
$this->addSql('ALTER TABLE usermodo DROP CONSTRAINT FK_D162D6C459FDD7AB');
$this->addSql('DROP TABLE audit');
$this->addSql('DROP TABLE config');
$this->addSql('DROP TABLE cron');
$this->addSql('DROP TABLE groupe');
$this->addSql('DROP TABLE niveau01');
$this->addSql('DROP TABLE niveau02');
$this->addSql('DROP TABLE niveau03');
$this->addSql('DROP TABLE niveau04');
$this->addSql('DROP TABLE registration');
$this->addSql('DROP TABLE useraccount');
$this->addSql('DROP TABLE usergroupe');
$this->addSql('DROP TABLE usermodo');
$this->addSql('DROP TABLE whitelist');
$this->addSql('DROP TABLE messenger_messages');
}
}

View File

@ -1,193 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230105192629 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SEQUENCE alert_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE alertcategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE bookmark_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE icon_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE item_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE itemcategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE page_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagecategory_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE pagewidget_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE slide_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE widget_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE alert (id INT NOT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, publishedat DATE NOT NULL, unpublishedat DATE DEFAULT NULL, fghideable BOOLEAN NOT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_17FD46C164C19C1 ON alert (category)');
$this->addSql('COMMENT ON COLUMN alert.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE alertgroupe (alert INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(alert, groupe))');
$this->addSql('CREATE INDEX IDX_64DB975617FD46C1 ON alertgroupe (alert)');
$this->addSql('CREATE INDEX IDX_64DB97564B98C21 ON alertgroupe (groupe)');
$this->addSql('CREATE TABLE alertniveau01 (alert INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(alert, niveau01))');
$this->addSql('CREATE INDEX IDX_87E7389C17FD46C1 ON alertniveau01 (alert)');
$this->addSql('CREATE INDEX IDX_87E7389C6DFC7E23 ON alertniveau01 (niveau01)');
$this->addSql('CREATE TABLE alertuserread (alert INT NOT NULL, "user" INT NOT NULL, PRIMARY KEY(alert, "user"))');
$this->addSql('CREATE INDEX IDX_D4317FA917FD46C1 ON alertuserread (alert)');
$this->addSql('CREATE INDEX IDX_D4317FA98D93D649 ON alertuserread ("user")');
$this->addSql('CREATE TABLE alertitem (alert INT NOT NULL, item INT NOT NULL, PRIMARY KEY(alert, item))');
$this->addSql('CREATE INDEX IDX_873C473817FD46C1 ON alertitem (alert)');
$this->addSql('CREATE INDEX IDX_873C47381F1B251E ON alertitem (item)');
$this->addSql('CREATE TABLE alertcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_EC575F7E54B9D732 ON alertcategory (icon_id)');
$this->addSql('CREATE TABLE bookmark (id INT NOT NULL, icon_id INT DEFAULT NULL, user_id INT DEFAULT NULL, pagewidget_id INT DEFAULT NULL, item_id INT DEFAULT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, rowOrder INT DEFAULT NULL, color VARCHAR(24) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_DA62921D54B9D732 ON bookmark (icon_id)');
$this->addSql('CREATE INDEX IDX_DA62921DA76ED395 ON bookmark (user_id)');
$this->addSql('CREATE INDEX IDX_DA62921D55B7C7A2 ON bookmark (pagewidget_id)');
$this->addSql('CREATE INDEX IDX_DA62921D126F525E ON bookmark (item_id)');
$this->addSql('CREATE TABLE icon (id INT NOT NULL, user_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, tags VARCHAR(250) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_659429DBEA750E8 ON icon (label)');
$this->addSql('CREATE INDEX IDX_659429DBA76ED395 ON icon (user_id)');
$this->addSql('CREATE TABLE item (id INT NOT NULL, icon_id INT DEFAULT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, slug VARCHAR(128) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, essential BOOLEAN DEFAULT false, protected BOOLEAN DEFAULT false, color VARCHAR(24) DEFAULT NULL, badgeurl VARCHAR(250) DEFAULT NULL, roles TEXT DEFAULT NULL, ssoitem VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1F1B251E989D9B62 ON item (slug)');
$this->addSql('CREATE INDEX IDX_1F1B251E54B9D732 ON item (icon_id)');
$this->addSql('CREATE INDEX IDX_1F1B251E64C19C1 ON item (category)');
$this->addSql('COMMENT ON COLUMN item.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE itemgroupe (item INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(item, groupe))');
$this->addSql('CREATE INDEX IDX_A4267B6D1F1B251E ON itemgroupe (item)');
$this->addSql('CREATE INDEX IDX_A4267B6D4B98C21 ON itemgroupe (groupe)');
$this->addSql('CREATE TABLE itemniveau01 (item INT NOT NULL, niveau01 INT NOT NULL, PRIMARY KEY(item, niveau01))');
$this->addSql('CREATE INDEX IDX_12E9B90A1F1B251E ON itemniveau01 (item)');
$this->addSql('CREATE INDEX IDX_12E9B90A6DFC7E23 ON itemniveau01 (niveau01)');
$this->addSql('CREATE TABLE itemcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(24) DEFAULT NULL, rowOrder INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_7959DEE854B9D732 ON itemcategory (icon_id)');
$this->addSql('CREATE TABLE page (id INT NOT NULL, pagecategory_id INT DEFAULT NULL, user_id INT DEFAULT NULL, page_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, roworder INT NOT NULL, maxwidth INT NOT NULL, fonticon VARCHAR(255) DEFAULT NULL, url TEXT DEFAULT NULL, toreload BOOLEAN DEFAULT NULL, html TEXT DEFAULT NULL, template TEXT DEFAULT NULL, parentfor VARCHAR(255) DEFAULT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_140AB6207AED5C04 ON page (pagecategory_id)');
$this->addSql('CREATE INDEX IDX_140AB620A76ED395 ON page (user_id)');
$this->addSql('CREATE INDEX IDX_140AB620C4663E4 ON page (page_id)');
$this->addSql('COMMENT ON COLUMN page.template IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN page.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE pagegroupe (page INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(page, groupe))');
$this->addSql('CREATE INDEX IDX_E8009F6B140AB620 ON pagegroupe (page)');
$this->addSql('CREATE INDEX IDX_E8009F6B4B98C21 ON pagegroupe (groupe)');
$this->addSql('CREATE TABLE pagecategory (id INT NOT NULL, name VARCHAR(100) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE pagewidget (id INT NOT NULL, page_id INT DEFAULT NULL, widget_id INT DEFAULT NULL, icon_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, loc VARCHAR(255) NOT NULL, roworder INT NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_69400D9AC4663E4 ON pagewidget (page_id)');
$this->addSql('CREATE INDEX IDX_69400D9AFBE885E2 ON pagewidget (widget_id)');
$this->addSql('CREATE INDEX IDX_69400D9A54B9D732 ON pagewidget (icon_id)');
$this->addSql('COMMENT ON COLUMN pagewidget.parameter IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE slide (id INT NOT NULL, pagewidget_id INT DEFAULT NULL, title VARCHAR(100) DEFAULT NULL, subtitle VARCHAR(250) DEFAULT NULL, url VARCHAR(500) DEFAULT NULL, target VARCHAR(32) NOT NULL, roworder INT DEFAULT NULL, image VARCHAR(100) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_72EFEE6255B7C7A2 ON slide (pagewidget_id)');
$this->addSql('CREATE TABLE widget (id INT NOT NULL, icon_id INT DEFAULT NULL, roworder INT NOT NULL, name VARCHAR(100) NOT NULL, description TEXT DEFAULT NULL, routeview VARCHAR(255) NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, access TEXT DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_85F91ED054B9D732 ON widget (icon_id)');
$this->addSql('COMMENT ON COLUMN widget.access IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN widget.parameter IS \'(DC2Type:array)\'');
$this->addSql('ALTER TABLE alert ADD CONSTRAINT FK_17FD46C164C19C1 FOREIGN KEY (category) REFERENCES alertcategory (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertgroupe ADD CONSTRAINT FK_64DB975617FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertgroupe ADD CONSTRAINT FK_64DB97564B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertniveau01 ADD CONSTRAINT FK_87E7389C17FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertniveau01 ADD CONSTRAINT FK_87E7389C6DFC7E23 FOREIGN KEY (niveau01) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertuserread ADD CONSTRAINT FK_D4317FA917FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertuserread ADD CONSTRAINT FK_D4317FA98D93D649 FOREIGN KEY ("user") REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertitem ADD CONSTRAINT FK_873C473817FD46C1 FOREIGN KEY (alert) REFERENCES alert (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertitem ADD CONSTRAINT FK_873C47381F1B251E FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE alertcategory ADD CONSTRAINT FK_EC575F7E54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921DA76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D55B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE bookmark ADD CONSTRAINT FK_DA62921D126F525E FOREIGN KEY (item_id) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE icon ADD CONSTRAINT FK_659429DBA76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251E54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE item ADD CONSTRAINT FK_1F1B251E64C19C1 FOREIGN KEY (category) REFERENCES itemcategory (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemgroupe ADD CONSTRAINT FK_A4267B6D1F1B251E FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemgroupe ADD CONSTRAINT FK_A4267B6D4B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemniveau01 ADD CONSTRAINT FK_12E9B90A1F1B251E FOREIGN KEY (item) REFERENCES item (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemniveau01 ADD CONSTRAINT FK_12E9B90A6DFC7E23 FOREIGN KEY (niveau01) REFERENCES niveau01 (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE itemcategory ADD CONSTRAINT FK_7959DEE854B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB6207AED5C04 FOREIGN KEY (pagecategory_id) REFERENCES pagecategory (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620A76ED395 FOREIGN KEY (user_id) REFERENCES useraccount (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620C4663E4 FOREIGN KEY (page_id) REFERENCES page (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagegroupe ADD CONSTRAINT FK_E8009F6B140AB620 FOREIGN KEY (page) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagegroupe ADD CONSTRAINT FK_E8009F6B4B98C21 FOREIGN KEY (groupe) REFERENCES groupe (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9AC4663E4 FOREIGN KEY (page_id) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9AFBE885E2 FOREIGN KEY (widget_id) REFERENCES widget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE pagewidget ADD CONSTRAINT FK_69400D9A54B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE slide ADD CONSTRAINT FK_72EFEE6255B7C7A2 FOREIGN KEY (pagewidget_id) REFERENCES pagewidget (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE widget ADD CONSTRAINT FK_85F91ED054B9D732 FOREIGN KEY (icon_id) REFERENCES icon (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP SEQUENCE alert_id_seq CASCADE');
$this->addSql('DROP SEQUENCE alertcategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE bookmark_id_seq CASCADE');
$this->addSql('DROP SEQUENCE icon_id_seq CASCADE');
$this->addSql('DROP SEQUENCE item_id_seq CASCADE');
$this->addSql('DROP SEQUENCE itemcategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE page_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagecategory_id_seq CASCADE');
$this->addSql('DROP SEQUENCE pagewidget_id_seq CASCADE');
$this->addSql('DROP SEQUENCE slide_id_seq CASCADE');
$this->addSql('DROP SEQUENCE widget_id_seq CASCADE');
$this->addSql('ALTER TABLE alert DROP CONSTRAINT FK_17FD46C164C19C1');
$this->addSql('ALTER TABLE alertgroupe DROP CONSTRAINT FK_64DB975617FD46C1');
$this->addSql('ALTER TABLE alertgroupe DROP CONSTRAINT FK_64DB97564B98C21');
$this->addSql('ALTER TABLE alertniveau01 DROP CONSTRAINT FK_87E7389C17FD46C1');
$this->addSql('ALTER TABLE alertniveau01 DROP CONSTRAINT FK_87E7389C6DFC7E23');
$this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA917FD46C1');
$this->addSql('ALTER TABLE alertuserread DROP CONSTRAINT FK_D4317FA98D93D649');
$this->addSql('ALTER TABLE alertitem DROP CONSTRAINT FK_873C473817FD46C1');
$this->addSql('ALTER TABLE alertitem DROP CONSTRAINT FK_873C47381F1B251E');
$this->addSql('ALTER TABLE alertcategory DROP CONSTRAINT FK_EC575F7E54B9D732');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D54B9D732');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921DA76ED395');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D55B7C7A2');
$this->addSql('ALTER TABLE bookmark DROP CONSTRAINT FK_DA62921D126F525E');
$this->addSql('ALTER TABLE icon DROP CONSTRAINT FK_659429DBA76ED395');
$this->addSql('ALTER TABLE item DROP CONSTRAINT FK_1F1B251E54B9D732');
$this->addSql('ALTER TABLE item DROP CONSTRAINT FK_1F1B251E64C19C1');
$this->addSql('ALTER TABLE itemgroupe DROP CONSTRAINT FK_A4267B6D1F1B251E');
$this->addSql('ALTER TABLE itemgroupe DROP CONSTRAINT FK_A4267B6D4B98C21');
$this->addSql('ALTER TABLE itemniveau01 DROP CONSTRAINT FK_12E9B90A1F1B251E');
$this->addSql('ALTER TABLE itemniveau01 DROP CONSTRAINT FK_12E9B90A6DFC7E23');
$this->addSql('ALTER TABLE itemcategory DROP CONSTRAINT FK_7959DEE854B9D732');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB6207AED5C04');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB620A76ED395');
$this->addSql('ALTER TABLE page DROP CONSTRAINT FK_140AB620C4663E4');
$this->addSql('ALTER TABLE pagegroupe DROP CONSTRAINT FK_E8009F6B140AB620');
$this->addSql('ALTER TABLE pagegroupe DROP CONSTRAINT FK_E8009F6B4B98C21');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9AC4663E4');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9AFBE885E2');
$this->addSql('ALTER TABLE pagewidget DROP CONSTRAINT FK_69400D9A54B9D732');
$this->addSql('ALTER TABLE slide DROP CONSTRAINT FK_72EFEE6255B7C7A2');
$this->addSql('ALTER TABLE widget DROP CONSTRAINT FK_85F91ED054B9D732');
$this->addSql('DROP TABLE alert');
$this->addSql('DROP TABLE alertgroupe');
$this->addSql('DROP TABLE alertniveau01');
$this->addSql('DROP TABLE alertuserread');
$this->addSql('DROP TABLE alertitem');
$this->addSql('DROP TABLE alertcategory');
$this->addSql('DROP TABLE bookmark');
$this->addSql('DROP TABLE icon');
$this->addSql('DROP TABLE item');
$this->addSql('DROP TABLE itemgroupe');
$this->addSql('DROP TABLE itemniveau01');
$this->addSql('DROP TABLE itemcategory');
$this->addSql('DROP TABLE page');
$this->addSql('DROP TABLE pagegroupe');
$this->addSql('DROP TABLE pagecategory');
$this->addSql('DROP TABLE pagewidget');
$this->addSql('DROP TABLE slide');
$this->addSql('DROP TABLE widget');
}
}

View File

@ -1,64 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class 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

@ -1,34 +0,0 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class 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');
}
}

View File

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

View File

@ -27,6 +27,7 @@
"datatables.net-bs4": "^1.12.1",
"dropzone": "^6.0.0-beta.2",
"file-loader": "^6.2.0",
"iframe-resizer": "^4.3.2",
"jquery": "^3.6.0",
"jquery-ui": "^1.13.1",
"jqueryui": "^1.11.1",

View File

@ -7,7 +7,9 @@ use App\Entity\Cron;
use App\Entity\Group;
use App\Entity\Icon;
use App\Entity\Niveau01;
use App\Entity\Page;
use App\Entity\Pagecategory;
use App\Entity\Pagewidget;
use App\Entity\User;
use App\Entity\Widget;
use Doctrine\ORM\EntityManagerInterface;
@ -68,10 +70,18 @@ class InitCommand extends Command
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Page');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Pagecategory');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Pagewidget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $this->em->getClassMetaData('App\Entity\Widget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
@ -573,6 +583,72 @@ class InitCommand extends Command
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Bureau Essentiel
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1850);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_computer.png']);
$entityWidget->setId(-1850);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Bureau Essentiel');
$entityWidget->setDescription('Affiche les items de bureau essentiel');
$entityWidget->setRouteview('app_admin_pagewidget_view_itemessential');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Liens
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1960);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_star.png']);
$entityWidget->setId(-1960);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Liens');
$entityWidget->setDescription('Bibliothèque de Liens');
$entityWidget->setRouteview('app_admin_pagewidget_view_bookmark');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'modedesktop', 'loc' => 'col1', 'type' => 'desktopmode', 'label' => 'Mode Affichage', 'value' => '2', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Lien
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1950);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_bolt.png']);
$entityWidget->setId(-1950);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Lien');
$entityWidget->setDescription("Création d'un Lien unique");
$entityWidget->setRouteview('app_admin_pagewidget_view_link');
$entityWidget->setHeight('200');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(false);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'url', 'loc' => 'col1', 'type' => 'string', 'label' => 'URL', 'value' => '', 'mandatory' => 'true'], ['id' => 'target', 'loc' => 'col1', 'type' => 'target', 'label' => 'Ouvrir le lien dans', 'value' => '0', 'mandatory' => 'true']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Annonce
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1980);
if (!$entityWidget) {
@ -589,14 +665,134 @@ class InitCommand extends Command
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(false);
$entityWidget->setOpened(true);
$entityWidget->setViewheader(true);
$entityWidget->setViewheader(false);
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => [['id' => 'alertcategory', 'loc' => 'col1', 'type' => 'alertcategory', 'label' => 'Catégorie Affichée', 'value' => '', 'mandatory' => 'false']]];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
// Widget Informations
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1860);
if (!$entityWidget) {
$entityWidget = new Widget();
}
$entityicon = $this->em->getRepository('App\Entity\Icon')->findoneby(['label' => 'icon/icon_info.png']);
$entityWidget->setId(-1860);
$entityWidget->setRoworder(0);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Informations');
$entityWidget->setDescription('Afficher les informations associées à la page');
$entityWidget->setRouteview('app_admin_pagewidget_view_info');
$entityWidget->setHeight('630');
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$entityWidget->setOpened(false);
$entityWidget->setViewheader(true);
$entityWidget->setViewheader(true);
$entityWidget->setColorheaderback('#5b5b5b');
$entityWidget->setColorheaderfont('#ffffff');
$entityWidget->setColorbodyback('#5b5b5b');
$entityWidget->setColorbodyfont('#ffffff');
$entityWidget->setAccess(['admin', 'all', 'group']);
$parameter = ['fields' => []];
$entityWidget->setParameter($parameter);
$this->em->persist($entityWidget);
$this->em->flush();
// == PAGETEMPALTE =======================================================================================================================================
// Template app
$entityPage = $this->em->getRepository('App\Entity\Page')->find(-100);
if (!$entityPage) {
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2);
$entityGroup = $this->em->getRepository("App\Entity\Group")->find(-1);
$entityPage = new Page();
$entityPage->setId(-100);
$entityPage->setRowOrder(0);
$entityPage->setName('Applications');
$entityPage->setParentfor('app');
$entityPage->setMaxwidth(1000);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->addGroup($entityGroup);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 12,"rows":[]}]}]}');
$this->em->persist($entityPage);
$this->em->flush();
$entityPagewidget = $this->em->getRepository('App\Entity\Pagewidget')->find(-110);
if (!$entityPagewidget) {
$entityWidget = $this->em->getRepository('App\Entity\Widget')->find(-1990);
$entityPagewidget = new Pagewidget();
$entityPagewidget->setId(-110);
$entityPagewidget->setLoc('R1C1');
$entityPagewidget->setRoworder(0);
$entityPagewidget->setName('Applications');
$entityPagewidget->setHeight($entityWidget->getHeight());
$entityPagewidget->setAutoajust($entityWidget->isAutoajust());
$entityPagewidget->setBorder($entityWidget->isBorder());
$entityPagewidget->setOpened($entityWidget->isOpened());
$entityPagewidget->setViewheader($entityWidget->isViewheader());
$entityPagewidget->setIcon($entityWidget->getIcon());
$entityPagewidget->setPage($entityPage);
$entityPagewidget->setWidget($entityWidget);
$param['fields'] = ['fields' => [['id' => 'modedesktop', 'value' => 2], ['id' => 'withbookmark', 'value' => 0], ['id' => 'itemcategory', 'value' => null], ['id' => 'menu', 'value' => 1], ['id' => 'search', 'value' => 1], ['id' => 'menuall', 'value' => 1]]];
$entityPagewidget->setParameter($param['fields']);
$this->em->persist($entityPagewidget);
$this->em->flush();
}
}
// Template Group
$entityPage = $this->em->getRepository('App\Entity\Page')->find(-110);
if (!$entityPage) {
$entityPagecategory = $this->em->getRepository('App\Entity\Pagecategory')->find(2);
$entityPage = new Page();
$entityPage->setId(-110);
$entityPage->setRowOrder(0);
$entityPage->setName('Groupe Template');
$entityPage->setParentfor('group');
$entityPage->setMaxwidth(0);
$entityPage->setPagecategory($entityPagecategory);
$entityPage->setTemplate('{"rows":[{"id":0,"cols":[{"id":0,"size": 3,"rows":[]},{"id":1,"size": 6,"rows":[{"id":0,"cols":[{"id":0,"size": 6},{"id":1,"size": 6}]}]},{"id":2,"size": 3,"rows":[]}]}]}');
$this->em->persist($entityPage);
$this->em->flush();
// Widget Nos Liens
$fields = ['fields' => [['id' => 'modedesktop', 'value' => 2]]];
$this->addWidget(-120, $entityPage, -1960, 'R1C2R1C1', 0, 'Nos Liens', true, $fields);
// Widget Nos Fichiers
/*
$fields=["fields"=>[]];
$this->addWidget(-130,$entityPage,-1920,"R1C2R1C2",0,"Nos Fichiers",true,$fields);
// Widget Info Page
$fields=["fields"=>[]];
$this->addWidget(-140,$entityPage,-1860,"R1C1",0,"Information Page",true,$fields);
// Widget Tâche
$fields=["fields"=>[]];
$this->addWidget(-145,$entityPage,-1800,"R1C1",1,"Taches du groupe",true,$fields);
// Widget Notre Blog
$fields=["fields"=>[["id"=>"nbarticle","value"=>5]]];
$this->addWidget(-150,$entityPage,-1890,"R1C2",0,"Notre Blog",false,$fields);
// Widget Notre Calendrier
$fields=["fields"=>[["id"=>"nbday","value"=>30]]];
$this->addWidget(-160,$entityPage,-1900,"R1C2R1C1",1,"Notre Calendrier",true,$fields);
// Chat
$fields=["fields"=>[]];
$this->addWidget(-170,$entityPage,-1840,"R1C3",0,"Chat",false,$fields);
*/
}
$output->writeln('');
return Command::SUCCESS;

View File

@ -35,27 +35,6 @@ class AlertController extends AbstractController
]);
}
public function selectlist($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.title LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.title');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getLabel()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement

View File

@ -14,39 +14,42 @@ class BookmarkController extends AbstractController
{
private $data = 'bookmark';
private $entity = "App\Entity\Bookmark";
private $twig = 'bookmark/';
private $twig = 'Bookmark/';
private $route = 'app_admin_bookmark';
public function submitAction(Request $request, $idpage, $idwidget, $touser, $access = 'config')
public function submit($access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$group = $request->query->get('group');
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data = new Bookmark();
// On s'assure que le widget existe
$pagewidget = null;
if ('false' == $touser) {
$pagewidget = $em->getRepository('CadolesPortalBundle:Pagewidget')->find($idwidget);
$pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
}
// Vérifier que cet enregistrement est modifiable
if ('user' == $access) {
if ('user' == $usage) {
$user = $pagewidget->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} elseif ('group' == $usage) {
$groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group);
$usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]);
if (!$usergroup or $usergroup->getRolegroup() < 50) {
throw $this->createNotFoundException('Permission denied');
// Vérifier que cet enregistrement est modifiable
if ('all' == $access) {
if ('user' == $usage) {
$user = $pagewidget->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} elseif ('group' == $usage) {
$canadd = false;
foreach ($pagewidget->getPage()->getGroups() as $group) {
$usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]);
if (!$usergroup or $usergroup->getRolegroup() >= 50) {
$canadd = true;
}
}
if (!$canadd) {
throw $this->createNotFoundException('Permission denied');
}
}
}
}
@ -57,9 +60,6 @@ class BookmarkController extends AbstractController
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null, $form, $request, $data, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
@ -73,83 +73,76 @@ class BookmarkController extends AbstractController
// Icon
$idicon = $form->get('idicon')->getData();
$icon = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findoneby(['id' => $idicon]);
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->persist($data);
$em->flush();
if ($pagewidget) {
foreach ($pagewidget->getPage()->getGroups() as $groupchat) {
if ($groupchat->getFgcanshare()) {
$message = "Création favoris<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);
}
}
}
}
$em->getManager()->persist($data);
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group]));
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]);
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('user' == $access) {
$iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]);
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ('config' == $access),
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('config' == $access),
'usesidebar' => ('admin' == $access),
'entity' => $data,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'submit',
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'touser' => $touser,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group,
]);
}
public function updateAction(Request $request, $idpage, $id, $access = 'config')
public function update($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$group = $request->query->get('group');
// Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$data = $this->getData($id);
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que cet enregistrement est modifiable
$user = $data->getUser();
if ($user) {
if ('user' == $usage) {
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
// On s'assure que le widget existe
$pagewidget = null;
if ('false' == $touser) {
$pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
} elseif ('user' == $access) {
if ('user' == $usage) {
$user = $data->getPagewidget()->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} else {
$groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group);
$usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]);
if (!$usergroup or $usergroup->getRolegroup() < 50) {
throw $this->createNotFoundException('Permission denied');
// Vérifier que cet enregistrement est modifiable
if ('all' == $access) {
if ('user' == $usage) {
$user = $pagewidget->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} elseif ('group' == $usage) {
$canadd = false;
foreach ($pagewidget->getPage()->getGroups() as $group) {
$usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]);
if (!$usergroup or $usergroup->getRolegroup() >= 50) {
$canadd = true;
}
}
if (!$canadd) {
throw $this->createNotFoundException('Permission denied');
}
}
}
}
@ -163,103 +156,92 @@ class BookmarkController extends AbstractController
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm($id, $form, $request, $data, 'update');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
// Icon
$idicon = $form->get('idicon')->getData();
$icon = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findoneby(['id' => $idicon]);
$icon = $em->getRepository('App\Entity\Icon')->findoneby(['id' => $idicon]);
$data->setIcon($icon);
// Sauvegarde
$em->persist($data);
$em->flush();
$pagewidget = $data->getPagewidget();
if ($pagewidget) {
foreach ($pagewidget->getPage()->getGroups() as $groupchat) {
if ($groupchat->getFgcanshare()) {
$message = "Modification favoris<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);
}
}
}
}
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group]));
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => null]);
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('user' == $access) {
$iconsuser = $this->getDoctrine()->getRepository('CadolesPortalBundle:Icon')->findBy(['user' => $this->getUser()]);
if ('all' == $access) {
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
// Affichage du formulaire
return $this->render($this->labelentity.':edit.html.twig', [
'useheader' => ('config' == $access),
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('config' == $access),
'usesidebar' => ('admin' == $access),
'entity' => $data,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => 'update',
'access' => $access,
'idpage' => $idpage,
'idwidget' => $idwidget,
'touser' => $touser,
'form' => $form->createView(),
'usage' => $usage,
'group' => $group,
]);
}
public function deleteAction(Request $request, $idpage, $id, $access = 'config')
public function delete($id, $access, $idpage, $idwidget, $touser, Request $request, ManagerRegistry $em): Response
{
$usage = $request->query->get('usage');
$group = $request->query->get('group');
// Récupération de l'enregistrement courant
$em = $this->getDoctrine()->getManager();
$data = $this->getData($id);
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find entity.');
}
// Vérifier que cet enregistrement est supprimable
$user = $data->getUser();
if ($user) {
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
// On s'assure que le widget existe
$pagewidget = null;
if ('false' == $touser) {
$pagewidget = $em->getRepository('App\Entity\Pagewidget')->find($idwidget);
if (!$pagewidget) {
throw $this->createNotFoundException('Unable to find entity.');
}
} elseif ('user' == $access) {
if ('user' == $usage) {
$user = $data->getPagewidget()->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} else {
$groupentity = $this->getDoctrine()->getRepository('CadolesCoreBundle:Group')->find($group);
$usergroup = $this->getDoctrine()->getRepository('CadolesCoreBundle:UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $groupentity]);
if (!$usergroup or $usergroup->getRolegroup() < 50) {
throw $this->createNotFoundException('Permission denied');
// Vérifier que cet enregistrement est modifiable
if ('all' == $access) {
if ('user' == $usage) {
$user = $pagewidget->getPage()->getUser();
if ($user != $this->getUser()) {
throw $this->createNotFoundException('Permission denied');
}
} elseif ('group' == $usage) {
$canadd = false;
foreach ($pagewidget->getPage()->getGroups() as $group) {
$usergroup = $em->getRepository('App\Entity\UserGroup')->findoneby(['user' => $this->getUser(), 'group' => $group]);
if (!$usergroup or $usergroup->getRolegroup() >= 50) {
$canadd = true;
}
}
if (!$canadd) {
throw $this->createNotFoundException('Permission denied');
}
}
}
}
// Supprimer la donnée
$em = $this->getDoctrine()->getManager();
$em->remove($data);
$em->flush();
$em->getManager()->remove($data);
$em->getManager()->flush();
// Retour à la page
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group]));
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
public function heart(Request $request, ManagerRegistry $em): Response
@ -295,47 +277,4 @@ class BookmarkController extends AbstractController
return new JsonResponse($output);
}
protected function getDatas()
{
$em = $this->getDoctrine()->getManager();
$datas = $em->getRepository($this->labelentity)->findAll();
return $datas;
}
protected function getData($id)
{
$em = $this->getDoctrine()->getManager();
$data = $em->getRepository($this->labelentity)->find($id);
if (!$data) {
throw $this->createNotFoundException('Unable to find '.$this->labeldata);
}
return $data;
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && 'submit' == $mode) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$validator = $this->get('validator');
$errors = $validator->validate($data);
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -8,6 +8,7 @@ use App\Form\GroupType as Form;
use Doctrine\Persistence\ManagerRegistry;
use Ramsey\Uuid\Uuid;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -237,10 +238,17 @@ class GroupController extends AbstractController
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur validation
// Controle
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
if ($data->isIsworkgroup() && is_null($data->getPagetemplate())) {
$form->addError(new FormError('Un groupe de travail doit avoir un modèle de page'));
$request->getSession()->getFlashBag()->add('error', 'Un groupe de travail doit avoir un modèle de page');
}
}
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
// Les groupes opé ne sont pas ouvert
if (!$data->isIsworkgroup()) {
$data->setIsopen(false);
@ -250,6 +258,9 @@ class GroupController extends AbstractController
$em->getManager()->persist($data);
$em->getManager()->flush();
// S'assurer que le groupe de travail a les elements portail associé
$this->ctrlWorkgroup($em, $data, $access);
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
@ -288,6 +299,15 @@ class GroupController extends AbstractController
// Récupération des data du formulaire
$form->handleRequest($request);
// Controle
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
if ($data->isIsworkgroup() && is_null($data->getPagetemplate())) {
$form->addError(new FormError('Un groupe de travail doit avoir un modèle de page'));
$request->getSession()->getFlashBag()->add('error', 'Un groupe de travail doit avoir un modèle de page');
}
}
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
@ -299,6 +319,9 @@ class GroupController extends AbstractController
$em->getManager()->flush();
// S'assurer que le groupe de travail a les elements portail associé
$this->ctrlWorkgroup($em, $data, $access);
// Retour à la liste
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
}
@ -342,6 +365,9 @@ class GroupController extends AbstractController
public function users($id, $access, Request $request, ManagerRegistry $em)
{
$idpage = $request->query->get('idpage');
$usage = $request->query->get('usage');
// Récupération de l'enregistrement courant
$data = $em->getRepository($this->entity)->find($id);
if (!$data) {
@ -358,6 +384,8 @@ class GroupController extends AbstractController
'usesidebar' => ('all' != $access),
'access' => $access,
$this->data => $data,
'idpage' => $idpage,
'usage' => $usage,
]);
}
@ -953,4 +981,34 @@ class GroupController extends AbstractController
return $toreturn;
}
protected function ctrlWorkgroup($em, $group, $access)
{
if ($group->isIsworkgroup()) {
// On regarde s'il a au moins une page
if ($group->getPages()->isEmpty()) {
$page = $em->getRepository("App\Entity\Page")->clonePage(null, $group->getPagetemplate());
$group->addPage($page);
$page->setName($group->getLabel());
if ('all' == $access) {
$page->setUser($this->getUser());
}
$em->getManager()->persist($page);
$em->getManager()->persist($group);
$em->getManager()->flush();
}
$pages = $group->getPages();
if ($pages[0]->getName() != $group->getLabel()) {
$pages[0]->setName($group->getLabel());
$em->getManager()->persist($pages[0]);
$em->getManager()->flush();
}
foreach ($pages as $page) {
$page->setUser($group->getOwner());
$em->getManager()->persist($page);
$em->getManager()->flush();
}
}
}
}

View File

@ -15,17 +15,29 @@ class HomeController extends AbstractController
return $this->redirectToRoute('app_login');
}
$em->getRepository("App\Entity\Item")->getUserItems($this->getUser(), $bookmarks, $items, $itemscategorys);
// Récupération de la page encours
$id = $request->query->get('id');
return $this->render('Home/page.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'maxsize' => 1000,
'bookmarks' => $bookmarks,
'items' => $items,
'itemcategorys' => $itemscategorys,
]);
// Calcul des pages de l'utilisateur
$em->getRepository("App\Entity\Page")->getPagesUser($this->getUser(), $id, $pagecurrent, $pagesportal, $pagesuser, $groups);
dump($groups);
// si aucune page = page par défaut
if ($pagecurrent) {
return $this->render('Page/pages.html.twig', [
'useheader' => true,
'usemenu' => true,
'usesidebar' => false,
'entity' => $pagecurrent,
'access' => 'all',
'pagesportal' => $pagesportal,
'pagesuser' => $pagesuser,
'groups' => $groups,
'canadd' => true,
'widgetsuser' => $em->getRepository("App\Entity\Widget")->getWidgetAccess('all'),
'widgetsgroup' => $em->getRepository("App\Entity\Widget")->getWidgetAccess('group'),
]);
}
if (!$this->getUser()) {
return $this->render('Home/home.html.twig', [
@ -58,21 +70,19 @@ class HomeController extends AbstractController
public function homeuser($access): Response
{
return $this->render('Home/home.html.twig', [
return $this->render('Page/default.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'maxsize' => 1000,
]);
}
public function homemaster($access): Response
{
return $this->render('Home/home.html.twig', [
return $this->render('Page/default.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => false,
'maxsize' => 1000,
]);
}

View File

@ -32,27 +32,6 @@ class ItemController extends AbstractController
]);
}
public function selectlist($access, Request $request, ManagerRegistry $em): Response
{
$output = [];
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.title LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('table.title');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getLabel()]);
}
$ret_string['results'] = $output;
return new JsonResponse($ret_string);
}
public function submit($access, Request $request, ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement

View File

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

View File

@ -8,6 +8,7 @@ use App\Form\PageUpdateWidgetType;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@ -16,7 +17,7 @@ class PagetemplateController extends AbstractController
private $data = 'page';
private $entity = "App\Entity\Page";
private $twig = 'Pagetemplate/';
private $route = 'app_admin_pagetemplate';
private $route = 'app_admin_page_template';
public function list($access): Response
{
@ -166,6 +167,7 @@ class PagetemplateController extends AbstractController
$this->data => $data,
'mode' => 'submit',
'access' => $access,
'usage' => 'template',
'form' => $form->createView(),
]);
}
@ -194,7 +196,8 @@ class PagetemplateController extends AbstractController
'usesidebar' => true,
$this->data => $data,
'access' => $access,
'mode' => 'updatetemplate',
'mode' => 'update',
'usage' => 'template',
'form' => $form->createView(),
]);
}
@ -220,7 +223,6 @@ class PagetemplateController extends AbstractController
if ($group) {
throw new \Exception('Impossible de supprimer ce modèle, il est utilisé par au moins un groupe');
}
if ('app' == $data->getParentfor()) {
throw new \Exception('Vous ne pouvez pas supprimer un template de type Application');
}
@ -237,36 +239,26 @@ class PagetemplateController extends AbstractController
return $this->redirect($this->generateUrl($this->route));
}
public function seleclist(Request $request)
public function selectlist($access, Request $request, ManagerRegistry $em): Response
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$output = [];
$em = $this->getDoctrine()->getManager();
$page_limit = $request->query->get('page_limit');
$q = $request->query->get('q');
$usage = $request->query->get('usage');
$qb = $em->createQueryBuilder();
$qb->select('table')->from('App:Page', 'table')
$qb = $em->getManager()->createQueryBuilder();
$qb->select('table')->from($this->entity, 'table')
->where('table.name LIKE :value')
->andWhere('table.parentfor=:usage')
->andWhere('table.parentfor is not null')
->setParameter('value', '%'.$q.'%')
->setParameter('usage', $usage)
->orderBy('table.name');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
array_push($output, ['id' => $data->getId(), 'text' => $data->getName()]);
}
$ret_string['results'] = $output;
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
return new JsonResponse($ret_string);
}
public function view($id, $access, Request $request, ManagerRegistry $em): Response
@ -279,8 +271,6 @@ class PagetemplateController extends AbstractController
// Permissions
$canupdate = true;
dump($em->getRepository("App\Entity\Widget")->getWidgetAccess($access));
return $this->render('Page\viewwidget.html.twig', [
'useheader' => true,
'usemenu' => true,
@ -288,35 +278,9 @@ class PagetemplateController extends AbstractController
$this->data => $data,
'access' => $access,
'canupdate' => $canupdate,
'mode' => 'viewtemplate',
'usage' => 'template',
'widgets' => $em->getRepository("App\Entity\Widget")->getWidgetAccess($access),
'usage' => 'config',
'group' => '',
'look' => 'view',
'selwidget' => null,
]);
}
protected function getErrorForm($id, $form, $request, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && ('submit' == $mode)) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$validator = $this->get('validator');
$errors = $validator->validate($data);
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
}
}

View File

@ -9,7 +9,6 @@ use GuzzleHttp\Exception\RequestException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Form\FormError;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@ -28,9 +27,6 @@ class PagewidgetController extends AbstractController
private $page;
private $id;
private $access;
private $look;
private $mini;
private $selwidget;
private $usage;
private $group;
@ -55,7 +51,7 @@ class PagewidgetController extends AbstractController
return $results;
}
private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access = 'config', $by = 'view')
private function entityForm(ManagerRegistry $em, Pagewidget $entity, $idpage, $id, $access)
{
if ($em->getManager()->contains($entity)) {
$widgettype = $em->getRepository('App\Entity\Pagewidget')->find($id)->getWidget();
@ -90,12 +86,13 @@ class PagewidgetController extends AbstractController
$entity->setColorbodyback($widgettype->getColorbodyback());
$entity->setColorbodyfont($widgettype->getColorbodyfont());
$entity->setIcon($widgettype->getIcon());
$entity->setWidget($widgettype);
$param = $widgettype->getParameter();
return $this->createForm(PagewidgetType::class, $entity, [
'param' => $param,
'mode' => ('view' == $by ? 'submit' : 'submittemplate'),
'mode' => 'submit',
'access' => $access,
'idicon' => $widgettype->getIcon()->getId(),
'method' => 'POST',
@ -105,9 +102,10 @@ class PagewidgetController extends AbstractController
public function submit($access, $idpage, $idwidgettype, Request $request, ManagerRegistry $em): Response
{
$by = $request->query->get('by');
$usage = $request->query->get('usage');
$entity = new Pagewidget();
$form = $this->entityForm($em, $entity, $idpage, $idwidgettype, $access, $by);
$form = $this->entityForm($em, $entity, $idpage, $idwidgettype, $access, $usage);
$form->handleRequest($request);
// On s'assure que la page où l'on souhaite insérer un widget est bien du bon type
@ -119,9 +117,6 @@ class PagewidgetController extends AbstractController
throw $this->createNotFoundException('Permission denied');
}
// Sur erreur
$this->getErrorForm(null, $form, $request, $idwidgettype, $page, $entity, 'submit');
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$idicon = $form->get('idicon')->getData();
@ -154,24 +149,7 @@ class PagewidgetController extends AbstractController
$em->persist($entity);
$em->flush();
// Notification création widget
$groups = $page->getGroups();
if ($groups[0]) {
if ($groups[0]->getFgcanshare()) {
$message = 'Création Widget '.$entity->getName();
$this->wss->addMessage($this->getuser()->getApikey(), $groups[0]->getId(), $message);
}
}
if ('admin' == $access) {
if ('view' == $by) {
return $this->redirect($this->generateUrl('app_admin_page_view', ['id' => $idpage]));
} else {
return $this->redirect($this->generateUrl('app_admin_pagetemplate_view', ['id' => $idpage]));
}
} else {
return $this->redirect($this->generateUrl('app_home', ['id' => $idpage]));
}
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
@ -181,14 +159,14 @@ class PagewidgetController extends AbstractController
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => true,
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('config' == $access),
'maxwidth' => ('user' == $access),
'usesidebar' => ('admin' == $access),
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => ('view' == $by ? 'submit' : 'submittemplate'),
'mode' => 'submit',
'usage' => $usage,
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
@ -197,7 +175,6 @@ class PagewidgetController extends AbstractController
public function update($access, $idpage, $idwidget, Request $request, ManagerRegistry $em): Response
{
$by = $request->query->get('by');
$usage = $request->query->get('usage');
$group = $request->query->get('group');
@ -216,7 +193,7 @@ class PagewidgetController extends AbstractController
}
// Création du formulaire
$form = $this->entityForm($em, $entity, $idpage, $idwidget, $access, $by);
$form = $this->entityForm($em, $entity, $idpage, $idwidget, $access);
$form->handleRequest($request);
// Validation
@ -250,28 +227,27 @@ class PagewidgetController extends AbstractController
}
// Retour
if ('view' == $by) {
return $this->redirect($this->generateUrl('app_'.$access.'_page_view', ['id' => $idpage, 'usage' => $usage, 'group' => $group]));
if ($group) {
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage, 'group' => $group]));
} else {
return $this->redirect($this->generateUrl('app_'.$access.'_pagetemplate_view', ['id' => $idpage]));
return $this->redirect($this->generateUrl('app_'.$access.'_page_'.$usage.'_view', ['id' => $idpage]));
}
}
$icons = $em->getRepository('App\Entity\Icon')->findBy(['user' => null]);
$iconsuser = null;
if ('all' == $access) {
$iconsuser = $this->getDoctrine()->getRepository('App:Icon')->findBy(['user' => $this->getUser()]);
$iconsuser = $em->getRepository('App\Entity\Icon')->findBy(['user' => $this->getUser()]);
}
return $this->render($this->twig.'edit.html.twig', [
'useheader' => ('admin' == $access),
'usemenu' => false,
'usesidebar' => ('admin' == $access),
'maxwidth' => ('all' == $access),
'entity' => $entity,
'icons' => $icons,
'iconsuser' => $iconsuser,
'mode' => ('view' == $by ? 'update' : 'updatetemplate'),
'mode' => 'update',
'access' => $access,
'idpage' => $idpage,
'form' => $form->createView(),
@ -311,19 +287,12 @@ class PagewidgetController extends AbstractController
return new JsonResponse($output);
}
public function order(Request $request)
public function order($access, Request $request, ManagerRegistry $em): Response
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(['message' => 'Interdit'], 400);
}
$output = [];
$idwidget = $request->request->get('idwidget');
$order = $request->request->get('order');
$idloc = $request->request->get('idloc');
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($idwidget);
if (!$entity) {
throw $this->createNotFoundException('Unable to find entity.');
@ -331,69 +300,9 @@ class PagewidgetController extends AbstractController
$entity->setRoworder($order);
$entity->setLoc($idloc);
$em->persist($entity);
$em->flush();
$em->getManager()->flush();
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function upload(Request $request, $access = null)
{
// Fichier temporaire uploadé
$tmpfile = $request->files->get('upload');
$extention = $tmpfile->getClientOriginalExtension();
// Répertoire de Destination
$fs = new Filesystem();
$rootdir = $this->get('kernel')->getRootDir().'/../web';
$fs->mkdir($rootdir.'/uploads/ckeditor');
// Fichier cible
$targetName = uniqid().'.'.$extention;
$targetFile = $rootdir.'/uploads/ckeditor/'.$targetName;
$targetUrl = '/'.$this->getParameter('alias').'/uploads/ckeditor/'.$targetName;
$message = '';
move_uploaded_file($tmpfile, $targetFile);
$output['uploaded'] = 1;
$output['fileName'] = $targetName;
$output['url'] = $targetUrl;
return new Response(json_encode($output));
}
protected function getErrorForm($id, $form, $request, $idwidgettype, $page, $data, $mode)
{
if ($form->get('submit')->isClicked() && 'delete' == $mode) {
}
if ($form->get('submit')->isClicked() && ('submit' == $mode || 'update' == $mode)) {
// Interdire l'insertion de 2 chat dans la meme page
if (-1840 == $idwidgettype) {
$pagewidget = $this->getDoctrine()->getRepository('App\Entity\Pagewidget')->findoneby(['page' => $page, 'widget' => -1840]);
if ($pagewidget) {
$form->addError(new FormError('Vous ne pouvez pas insérer deux widgets de type Chat dans la même page'));
}
}
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$validator = $this->get('validator');
$errors = $validator->validate($data);
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
$errors = $form->getErrors();
foreach ($errors as $error) {
$request->getSession()->getFlashBag()->add('error', $error->getMessage());
}
}
return new JsonResponse([]);
}
protected function setRequest($em, $request, $id, $access)
@ -402,8 +311,6 @@ class PagewidgetController extends AbstractController
$this->user = $this->getUser();
$this->id = $id;
$this->access = $access;
$this->look = $request->query->get('look');
$this->selwidget = $request->query->get('selwidget');
$this->usage = $request->query->get('usage');
$this->group = $request->query->get('group');
@ -416,6 +323,7 @@ class PagewidgetController extends AbstractController
// Permissions
if ('admin' == $this->access) {
$this->canupdate = true;
$this->canadd = true;
} else {
// On s'assure que l'utilisateur à la permission de voir
$this->page = $this->entity->getPage();
@ -425,27 +333,18 @@ class PagewidgetController extends AbstractController
}
}
// Affichage miniature ?
$this->mini = ('list' == $this->look && $this->entity->getId() != $this->selwidget);
// Préference utilisateur
if (!$this->mini) {
$this->getPreference($this->entity);
}
$this->getPreference($this->entity);
}
protected function getPreference(&$entity)
{
$user = $this->getUser();
if ($user) {
$preference = $user->getPreference();
$id = $entity->getId();
if ($entity->isViewheader()) {
$preference = $user->getPreference();
$id = $entity->getId();
// Preference widgetshowhide
if ('list' == $this->look) {
$entity->setOpened(true);
$entity->setBorder(false);
} else {
// Preference widgetshowhide
if (is_array($preference)) {
if (array_key_exists('widgetshowhide', $preference)) {
if (array_key_exists($id, $preference['widgetshowhide'])) {
@ -489,8 +388,6 @@ class PagewidgetController extends AbstractController
'entity' => $this->entity,
'canupdate' => $this->canupdate,
'access' => $this->access,
'look' => $this->look,
'mini' => $this->mini,
];
// Parametres spéficiques
@ -500,51 +397,48 @@ class PagewidgetController extends AbstractController
return $this->render($this->twig.'\\'.$view, $params);
}
public function viewurl($id, $access, Request $request)
public function viewurl($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$url = '';
$imagemedia = false;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
if ('url' == $parameter['id']) {
$url = $parameter['value'];
}
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
if ('url' == $parameter['id']) {
$url = $parameter['value'];
}
}
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Si url classique on igonore l'usage de la sonde dnma
else {
if (false === stripos($url, '?')) {
$url .= '?notsondednma=true';
} else {
$url .= '&notsondednma=true';
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Si url classique on igonore l'usage de la sonde dnma
else {
if (false === stripos($url, '?')) {
$url .= '?notsondednma=true';
} else {
$url .= '&notsondednma=true';
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
$imagemedia = true;
}
return $this->getRender('viewurl.html.twig', [
'url' => $url,
@ -552,48 +446,45 @@ class PagewidgetController extends AbstractController
]);
}
public function viewurlfixe(Request $request, $id, $access = 'config')
public function viewurlfixe($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$url = '';
$imagemedia = false;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
$widgettype = $this->entity->getWidget();
$jsons = $widgettype->getParameter();
$param = [];
$param['fields'] = [];
foreach ($jsons->fields as $field) {
if ('url' == $field->id) {
$url = $field->value;
}
// Récupération des paramétres du widget
$widgettype = $this->entity->getWidget();
$jsons = $widgettype->getParameter();
$param = [];
$param['fields'] = [];
foreach ($jsons->fields as $field) {
if ('url' == $field->id) {
$url = $field->value;
}
}
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Gestion des url youtuve
$url = str_replace('http://www.youtube.com', 'https://www.youtube.com', $url);
$url = str_replace('https://www.youtube.com/watch?v=', 'https://www.youtube.com/embed/', $url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Detecter le type de lien
$pathinfo = pathinfo($url);
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
// Type image
if (array_key_exists('extension', $pathinfo)) {
if ('jpg' == $pathinfo['extension'] || 'gif' == $pathinfo['extension'] || 'png' == $pathinfo['extension']) {
$imagemedia = true;
}
}
// Spécifique Deviant Art
if (false !== strpos($url, 'images-wixmp')) {
$imagemedia = true;
}
return $this->getRender('viewurl.html.twig', [
'url' => $url,
'imagemedia' => $imagemedia,
@ -615,45 +506,42 @@ class PagewidgetController extends AbstractController
$itemsordered = null;
$itemcategorys = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
$iditemcategory = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
// Récupération des paramétres du widget
$iditemcategory = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
case 'withbookmark':
$withbookmark = $parameter['value'];
break;
case 'withbookmark':
$withbookmark = $parameter['value'];
break;
case 'itemcategory':
$iditemcategory = $parameter['value'];
break;
case 'itemcategory':
$iditemcategory = $parameter['value'];
break;
case 'search':
$search = (1 == $parameter['value']);
break;
case 'search':
$search = (1 == $parameter['value']);
break;
case 'menu':
$menu = (1 == $parameter['value']);
break;
case 'menu':
$menu = (1 == $parameter['value']);
break;
case 'menuall':
$menuall = (1 == $parameter['value']);
break;
}
case 'menuall':
$menuall = (1 == $parameter['value']);
break;
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$this->em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, $iditemcategory, $withbookmark, false);
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$this->em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, $iditemcategory, $withbookmark, false);
// Render
return $this->getRender('viewitem.html.twig', [
'canadd' => $this->user,
@ -668,71 +556,65 @@ class PagewidgetController extends AbstractController
]);
}
public function viewitemessential(Request $request, $id, $access = 'config')
public function viewitemessential($access, $id, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modedesktop = 0;
$itemsordered = null;
$bookmarks = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$itemsordered = $this->em->getRepository('App:Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, null, $this->get('session')->get('ssoitems'), 0, true);
}
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Profilage
$em->getRepository('App\Entity\Item')->getUserItems($this->user, $bookmarks, $items, $itemcategorys, null, 0, true);
// Render
return $this->getRender('viewitemessential.html.twig', [
'canadd' => $this->user,
'modedesktop' => $modedesktop,
'items' => $itemsordered,
'items' => $items,
'bookmarks' => $bookmarks,
]);
}
public function viewalert(Request $request, $id, $access = 'config')
public function viewalert($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$alertsordered = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
$idalertcategory = null;
$alertcategoryfilter = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'alertcategory':
$idalertcategory = $parameter['value'];
if ($idalertcategory) {
$alertcategoryfilter = $this->em->getRepository('App:Alertcategory')->find($idalertcategory);
}
break;
}
// Récupération des paramétres du widget
$idalertcategory = null;
$alertcategoryfilter = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'alertcategory':
$idalertcategory = $parameter['value'];
if ($idalertcategory) {
$alertcategoryfilter = $this->em->getRepository('App:Alertcategory')->find($idalertcategory);
}
break;
}
// Profilage
$alertsordered = $this->em->getRepository('App:Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter, $this->get('session')->get('ssoitems'));
}
// Profilage
$alertsordered = $this->em->getRepository('App\Entity\Alert')->getUserAlerts($this->user, $idalertcategory, $alertcategoryfilter);
// Render
return $this->getRender('viewalert.html.twig', [
'alerts' => $alertsordered,
@ -742,261 +624,44 @@ class PagewidgetController extends AbstractController
public function viewflux(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modelist = 0;
$fluxsordered = null;
$feeds = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modelist':
$modelist = $parameter['value'];
break;
}
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modelist':
$modelist = $parameter['value'];
break;
}
// Profilage
$fluxs = $this->em->getRepository('App:Flux')->getUserFluxs($this->user);
$feeds = [];
$filesystem = new Filesystem();
// Généraltion du cache associés aux flux
foreach ($fluxs as $keyflux => $flux) {
// On regarde si le flux a été lu il y a peu
$toregen = true;
$url = $flux->getUrl();
// Feed lié à un user interne
$filecache = 'uploads/flux/flux-'.$flux->getId().'.txt';
if (false !== stripos($url, '##userid##')) {
if ($user) {
$url = str_replace('##userid##', $user->getId(), $url);
$filecache = $filecache = 'uploads/flux/flux-'.$user->getId().'-'.$flux->getId().'.txt';
}
}
// Si le fichie cache existe
if ($filesystem->exists($filecache)) {
// On récupère la date de modification du fichier
$timestampfile = filemtime($filecache);
$datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime();
$datefile->setTimestamp($timestampfile);
// On ajoute 30mn
$datefile->add(new \DateInterval('PT30M'));
// Si la date est inférieur à maintenant on regénère le flux
$now = new \DateTime();
if ($datefile >= $now) {
$toregen = false;
$backup = unserialize(file_get_contents($filecache));
$feeds = array_merge($feeds, $backup);
if (empty($backup)) {
unset($fluxs[$keyflux]);
}
}
}
// Si le fichier est trop ancien on relit le flus
if ($toregen) {
$PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue();
$weburl = $this->getParameter('weburl');
if (0 == stripos($url, '/')) {
$url = 'https://'.$weburl.$url;
$PROXYactivate = false;
}
if (0 === stripos($url, 'https://'.$weburl)) {
$PROXYactivate = false;
}
if (0 === stripos($url, 'http://'.$weburl)) {
$PROXYactivate = false;
}
if ($PROXYactivate) {
$PROXYserver = $this->em->getRepository('App:Config')->find('PROXYserver')->getValue();
$PROXYport = $this->em->getRepository('App:Config')->find('PROXYport')->getValue();
$clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false, 'proxy' => ['http' => 'http://'.$PROXYserver.':'.$PROXYport, 'https' => 'http://'.$PROXYserver.':'.$PROXYport]]);
} else {
$clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false]);
}
try {
$clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
continue;
}
}
// On lit le flux rss
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
try {
$result = $feedIo->read($url);
} catch (\Exception $e) {
$result = null;
}
if ($result) {
$feedtitle = $result->getFeed()->getTitle();
$backup = [];
// Pour chaque articles
$nbflux = 0;
foreach ($result->getFeed() as $item) {
$title = $item->getTitle();
$link = $item->getLink();
$description = substr(strip_tags($item->getDescription()), 0, 250);
$description = str_replace('&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,
]);
}
// Profilage
$fluxs = $this->em->getRepository('App:Flux')->getUserFluxs($this->user);
public function viewrss(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Valeur par défaut
$modelist = 0;
$fluxs = ['id' => 0];
$feeds = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
$url = '';
$nbarticle = '_blank';
$modelist = 0;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'url':
$url = $parameter['value'];
break;
case 'nbarticle':
$nbarticle = $parameter['value'];
break;
case 'modelist':
$modelist = $parameter['value'];
break;
}
}
$feeds = [];
$filesystem = new Filesystem();
// Généraltion du cache associés aux flux
foreach ($fluxs as $keyflux => $flux) {
// On regarde si le flux a été lu il y a peu
$toregen = true;
$filecache = $filecache = 'uploads/flux/widget-'.$id.'.txt';
$user = $this->getUser();
$url = $flux->getUrl();
// Feed lié à un user interne
$filecache = 'uploads/flux/flux-'.$flux->getId().'.txt';
if (false !== stripos($url, '##userid##')) {
if ($user) {
$url = str_replace('##userid##', $user->getId(), $url);
$filecache = $filecache = 'uploads/flux/widget-'.$user->getId().'-'.$id.'.txt';
$filecache = $filecache = 'uploads/flux/flux-'.$user->getId().'-'.$flux->getId().'.txt';
}
}
$filesystem = new Filesystem();
// Si le fichie cache existe
if ($filesystem->exists($filecache)) {
// On récupère la date de modification du fichier
$timestampfile = filemtime($filecache);
@ -1011,15 +676,19 @@ class PagewidgetController extends AbstractController
$now = new \DateTime();
if ($datefile >= $now) {
$toregen = false;
$feeds = unserialize(file_get_contents($filecache));
$backup = unserialize(file_get_contents($filecache));
$feeds = array_merge($feeds, $backup);
if (empty($backup)) {
unset($fluxs[$keyflux]);
}
}
}
// Si le fichier est trop ancien on relit le flus
if ($toregen) {
// Connexion au client
$PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue();
$weburl = $this->getParameter('weburl');
if (0 == stripos($url, '/')) {
$url = 'https://'.$weburl.$url;
$PROXYactivate = false;
@ -1043,24 +712,15 @@ class PagewidgetController extends AbstractController
$clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
// Render
$feeds = [];
return $this->getRender('viewflux.html.twig', [
'fluxs' => $fluxs,
'feeds' => $feeds,
'modelist' => $modelist,
]);
continue;
}
}
// On lit le flux rss
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
$feeds = [];
// On lit le flux rss
try {
$result = $feedIo->read($url);
} catch (\Exception $e) {
@ -1070,6 +730,8 @@ class PagewidgetController extends AbstractController
if ($result) {
$feedtitle = $result->getFeed()->getTitle();
$backup = [];
// Pour chaque articles
$nbflux = 0;
foreach ($result->getFeed() as $item) {
@ -1118,7 +780,7 @@ class PagewidgetController extends AbstractController
}
// Garder le flux
array_push($feeds, [
$tmp = [
'feedtitle' => $feedtitle,
'title' => $title,
'link' => $link,
@ -1127,29 +789,243 @@ class PagewidgetController extends AbstractController
'dateformat' => $dateformat,
'content' => $content,
'image' => $imgurl,
// "color" => $flux->getColor(),
'fluxid' => 0,
'fluxtitle' => $this->entity->getName(),
]);
'color' => $flux->getColor(),
'fluxid' => $flux->getId(),
'fluxtitle' => $flux->getTitle(),
];
array_push($feeds, $tmp);
array_push($backup, $tmp);
++$nbflux;
if ($nbflux >= $nbarticle && $nbarticle > 0) {
if ($nbflux >= $flux->getMaxread() && $flux->getMaxread() > 0) {
break;
}
}
$libelle = [];
foreach ($feeds as $key => $valeur) {
$libelle[$key] = $valeur['date'];
if (0 == $nbflux) {
unset($fluxs[$keyflux]);
}
array_multisort($libelle, SORT_DESC, $feeds);
// On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile($filecache, serialize($feeds));
$filesystem->dumpFile($filecache, serialize($backup));
}
}
}
// Trie des fluxs
$fluxsordered = $fluxs->getIterator();
$fluxsordered->uasort(function ($first, $second) {
return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1;
});
// Trie des feeds
$libelle = [];
foreach ($feeds as $key => $valeur) {
$libelle[$key] = $valeur['date'];
}
array_multisort($libelle, SORT_DESC, $feeds);
// Render
return $this->getRender('viewflux.html.twig', [
'modelist' => $modelist,
'fluxs' => $fluxsordered,
'feeds' => $feeds,
]);
}
public function viewrss(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modelist = 0;
$fluxs = ['id' => 0];
$feeds = null;
// Récupération des paramétres du widget
$url = '';
$nbarticle = '_blank';
$modelist = 0;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'url':
$url = $parameter['value'];
break;
case 'nbarticle':
$nbarticle = $parameter['value'];
break;
case 'modelist':
$modelist = $parameter['value'];
break;
}
}
// On regarde si le flux a été lu il y a peu
$toregen = true;
$filecache = $filecache = 'uploads/flux/widget-'.$id.'.txt';
$user = $this->getUser();
if (false !== stripos($url, '##userid##')) {
if ($user) {
$url = str_replace('##userid##', $user->getId(), $url);
$filecache = $filecache = 'uploads/flux/widget-'.$user->getId().'-'.$id.'.txt';
}
}
$filesystem = new Filesystem();
if ($filesystem->exists($filecache)) {
// On récupère la date de modification du fichier
$timestampfile = filemtime($filecache);
$datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime();
$datefile->setTimestamp($timestampfile);
// On ajoute 30mn
$datefile->add(new \DateInterval('PT30M'));
// Si la date est inférieur à maintenant on regénère le flux
$now = new \DateTime();
if ($datefile >= $now) {
$toregen = false;
$feeds = unserialize(file_get_contents($filecache));
}
}
// Si le fichier est trop ancien on relit le flus
if ($toregen) {
// Connexion au client
$PROXYactivate = $this->em->getRepository('App:Config')->find('PROXYactivate')->getValue();
$weburl = $this->getParameter('weburl');
if (0 == stripos($url, '/')) {
$url = 'https://'.$weburl.$url;
$PROXYactivate = false;
}
if (0 === stripos($url, 'https://'.$weburl)) {
$PROXYactivate = false;
}
if (0 === stripos($url, 'http://'.$weburl)) {
$PROXYactivate = false;
}
if ($PROXYactivate) {
$PROXYserver = $this->em->getRepository('App:Config')->find('PROXYserver')->getValue();
$PROXYport = $this->em->getRepository('App:Config')->find('PROXYport')->getValue();
$clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false, 'proxy' => ['http' => 'http://'.$PROXYserver.':'.$PROXYport, 'https' => 'http://'.$PROXYserver.':'.$PROXYport]]);
} else {
$clientguzzle = new \GuzzleHttp\Client(['timeout' => 3, 'verify' => false]);
}
try {
$clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
// Render
$feeds = [];
return $this->getRender('viewflux.html.twig', [
'fluxs' => $fluxs,
'feeds' => $feeds,
'modelist' => $modelist,
]);
}
}
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
$feeds = [];
// On lit le flux rss
try {
$result = $feedIo->read($url);
} catch (\Exception $e) {
$result = null;
}
if ($result) {
$feedtitle = $result->getFeed()->getTitle();
// Pour chaque articles
$nbflux = 0;
foreach ($result->getFeed() as $item) {
$title = $item->getTitle();
$link = $item->getLink();
$description = substr(strip_tags($item->getDescription()), 0, 250);
$description = str_replace('&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,
@ -1158,30 +1034,30 @@ class PagewidgetController extends AbstractController
]);
}
public function viewbookmark(Request $request, $id, $access = 'config')
public function viewbookmark($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Valeur par défaut
$modedesktop = 0;
$bookmarks = null;
// Datas associées au widget
if (!$this->mini) {
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
// Récupération des paramétres du widget
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
// Bookmark du widget
$bookmarks = $this->em->getRepository('App:Bookmark')->findBy(['pagewidget' => $this->entity]);
}
// Bookmark du widget
$bookmarks = $em->getRepository('App\Entity\Bookmark')->findBy(['pagewidget' => $this->entity]);
// Préference utilisateur
$modedesktop = $this->getKeyPreference($this->entity, 'modedesktop', $modedesktop);
// Render
return $this->getRender('viewbookmark.html.twig', [
'canadd' => $this->canadd,
@ -1190,10 +1066,10 @@ class PagewidgetController extends AbstractController
]);
}
public function viewlink(Request $request, $id, $access = 'config')
public function viewlink($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$url = '';
@ -1211,16 +1087,36 @@ class PagewidgetController extends AbstractController
// Render
return $this->getRender('viewlink.html.twig', [
'canadd' => false,
'canadd' => $this->canadd,
'url' => $url,
'target' => $target,
]);
}
public function viewinfo($id, $access, Request $request, ManagerRegistry $em)
{
// Récupération de la requete
$this->setRequest($em, $request, $id, $access);
if (1 == $this->entity->getPage()->getGroups()->count()) {
$this->entity->setName($this->entity->getPage()->getGroups()[0]->getLabel());
} elseif (0 == $this->entity->getPage()->getGroups()->count() && $this->entity->getPage()->getUser()) {
$this->entity->setName($this->entity->getPage()->getName());
}
// Render
return $this->getRender('viewinfo.html.twig', [
'canadd' => $this->canupdate,
'usage' => $this->usage,
'id' => $id,
'idpage' => $this->entity->getPage()->getId(),
]);
}
public function vieweditor(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$html = '';
@ -1242,7 +1138,7 @@ class PagewidgetController extends AbstractController
public function viewslide(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$interval = '2';
@ -1268,7 +1164,7 @@ class PagewidgetController extends AbstractController
public function viewfile(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$view = 'small';
@ -1291,7 +1187,7 @@ class PagewidgetController extends AbstractController
public function viewgalery(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
$directory = $this->get('kernel')->getRootDir().'/../uploads/file/widget-'.$id;
$files = [];
@ -1329,7 +1225,7 @@ class PagewidgetController extends AbstractController
public function viewcalendar(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$nbday = '0';
@ -1358,7 +1254,7 @@ class PagewidgetController extends AbstractController
public function viewblog(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$nbarticle = 10;
@ -1398,7 +1294,7 @@ class PagewidgetController extends AbstractController
public function viewproject(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Parametres
$nbarticle = 10;
@ -1456,212 +1352,10 @@ class PagewidgetController extends AbstractController
]);
}
public function viewseparator(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Parametres
$seetitle = false;
$seeicon = false;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'seetitle':
$seetitle = boolval($parameter['value']);
break;
case 'seeicon':
$seeicon = boolval($parameter['value']);
break;
}
}
// Render
return $this->getRender('viewseparator.html.twig', [
'canadd' => $this->canupdate,
'seetitle' => $seetitle,
'seeicon' => $seeicon,
]);
}
public function viewclock(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Parametres
$clock = '0';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'clock':
$clock = $parameter['value'];
break;
}
}
// Render
return $this->getRender('viewframe.html.twig', [
'canadd' => $this->canupdate,
'onheader' => true,
'tool' => (0 == $clock ? 'app_user_tool_clockanalogique' : 'app_user_tool_clocknumerique'),
]);
}
public function viewcalculator(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Render
return $this->getRender('viewframe.html.twig', [
'canadd' => $this->canupdate,
'onheader' => true,
'tool' => 'app_user_tool_calculator',
]);
}
public function viewappexternal(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Récupération des paramétres du widget
$idappexternal = null;
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'appexternal':
$idappexternal = $parameter['value'];
break;
case 'modedesktop':
$modedesktop = $parameter['value'];
break;
}
}
$user = $this->getUser();
$items = [];
$itemcategorys = [];
if ($user) {
if ($idappexternal) {
$appextenals = $this->em->getRepository('App:Appexternal')->findBy(['id' => $idappexternal]);
} else {
$appextenals = $this->em->getRepository('App:Appexternal')->findAll();
}
foreach ($appextenals as $appexternal) {
switch ($appexternal->getName()) {
case 'Limesurvey':
$category = ['id' => 0, 'label' => 'Limesurvey'];
array_push($itemcategorys, $category);
$directory = $this->get('kernel')->getRootDir().'/../uploads/limesurvey/'.$user->getId();
$files = [];
$fs = new Filesystem();
if ($fs->exists($directory.'/invitation.json')) {
$file = file_get_contents($directory.'/invitation.json');
$json = substr($file, 0, -2); // sup dernier ,
$surveys = json_decode('{'.$json.'}', true);
if (is_array($surveys)) {
foreach ($surveys as $id => $survey) {
array_push($items, ['id' => $id, 'title' => $survey['title'], 'subtitle' => 'Sondage', 'url' => $survey['url'], 'itemcategory' => $category, 'color' => '328637', 'icon' => 'icon_limesurvey.png']);
}
}
}
break;
case 'Moodle':
$category = ['id' => 1, 'label' => 'Moodle'];
array_push($itemcategorys, $category);
$directory = $this->get('kernel')->getRootDir().'/../uploads/moodle/'.$user->getId();
$files = [];
$fs = new Filesystem();
if ($fs->exists($directory.'/invitation.json')) {
$file = file_get_contents($directory.'/invitation.json');
$json = substr($file, 0, -2); // sup dernier ,
$courses = json_decode('{'.$json.'}', true);
if (is_array($courses)) {
foreach ($courses as $id => $course) {
array_push($items, ['id' => $id, 'title' => $course['title'], 'subtitle' => 'Cours', 'url' => $course['url'], 'itemcategory' => $category, 'color' => 'f77f11', 'icon' => 'icon_moodle.png']);
}
}
}
break;
}
}
}
// Trier les item par title
$title = array_column($items, 'title');
array_multisort($title, SORT_ASC, $items);
// Render
return $this->getRender('viewappexternal.html.twig', [
'canadd' => $user,
'modedesktop' => $modedesktop,
'items' => $items,
'itemcategorys' => $itemcategorys,
]);
}
public function viewinfo(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$icon = null;
$title = null;
$description = null;
$members = [];
if ('group' == $this->usage) {
$groupentity = $this->em->getRepository('App:Group')->find($this->group);
if ($groupentity) {
$title = $this->entity->getPage()->getName();
$id = $groupentity->getId();
if ($groupentity->getDescription()) {
$description = '<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);
$this->setRequest($em, $request, $id, $access);
$group = $this->group;
if ('group' != $this->usage || !$group) {
@ -1681,7 +1375,7 @@ class PagewidgetController extends AbstractController
public function viewgroup(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
$user = $this->getUser();
$mygroups = [];
@ -1711,7 +1405,7 @@ class PagewidgetController extends AbstractController
public function viewgroupmessage(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
$this->setRequest($em, $request, $id, $access);
// Récupération des paramétres du widget
$modelist = 1;
@ -1770,30 +1464,4 @@ class PagewidgetController extends AbstractController
'nbarticle' => $nbarticle,
]);
}
public function viewOnlydoc(Request $request, $id, $access = 'config')
{
// Récupération de la requete
$this->setRequest($request, $id, $access);
// Récupération des paramétres du widget
$apponly = 0;
$view = 'small';
foreach ($this->entity->getParameter()['fields'] as $parameter) {
switch ($parameter['id']) {
case 'apponly':
$apponly = $parameter['value'];
break;
case 'modelist':
$view = (0 == $parameter['value'] ? 'small' : 'list');
break;
}
}
return $this->getRender('viewonlydoc.html.twig', [
'canadd' => $this->canupdate,
'directory' => $id,
'view' => $view,
]);
}
}

View File

@ -87,7 +87,7 @@ class Alert
* @ORM\ManyToMany(targetEntity="User", inversedBy="alertreaders", cascade={"persist"})
* @ORM\JoinTable(name="alertuserread",
* joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="user", referencedColumnName="id")}
* inverseJoinColumns={@ORM\JoinColumn(name="useraccount", referencedColumnName="id")}
* )
*/
protected $readers;

View File

@ -103,11 +103,17 @@ class Group
*/
protected $items;
/**
* @ORM\ManyToMany(targetEntity="Page", mappedBy="groups")
*/
protected $pages;
public function __construct()
{
$this->users = new ArrayCollection();
$this->alerts = new ArrayCollection();
$this->items = new ArrayCollection();
$this->pages = new ArrayCollection();
}
// == CODE A NE PAS REGENERER
@ -339,4 +345,31 @@ class Group
return $this;
}
/**
* @return Collection<int, Page>
*/
public function getPages(): Collection
{
return $this->pages;
}
public function addPage(Page $page): self
{
if (!$this->pages->contains($page)) {
$this->pages->add($page);
$page->addGroup($this);
}
return $this;
}
public function removePage(Page $page): self
{
if ($this->pages->removeElement($page)) {
$page->removeGroup($this);
}
return $this;
}
}

View File

@ -191,11 +191,17 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
*/
private $modos;
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Alert", mappedBy="readers")
*/
protected $alertreaders;
public function __construct()
{
$this->groups = new ArrayCollection();
$this->ownergroups = new ArrayCollection();
$this->modos = new ArrayCollection();
$this->alertreaders = new ArrayCollection();
}
// == CODE A NE PAS REGENERER
@ -677,4 +683,31 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
return $this;
}
/**
* @return Collection<int, Alert>
*/
public function getAlertreaders(): Collection
{
return $this->alertreaders;
}
public function addAlertreader(Alert $alertreader): self
{
if (!$this->alertreaders->contains($alertreader)) {
$this->alertreaders->add($alertreader);
$alertreader->addReader($this);
}
return $this;
}
public function removeAlertreader(Alert $alertreader): self
{
if ($this->alertreaders->removeElement($alertreader)) {
$alertreader->removeReader($this);
}
return $this;
}
}

64
src/Form/BookmarkType.php Executable file
View File

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

View File

@ -2,6 +2,8 @@
namespace App\Form;
use Doctrine\ORM\EntityRepository;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
@ -32,6 +34,18 @@ class GroupType extends AbstractType
);
}
$builder->add('pagetemplate',
EntityType::class, [
'class' => "App\Entity\Page",
'label' => "Modèle de Page pour l'accueil du groupe",
'required' => false,
'choice_label' => 'name',
'query_builder' => function (EntityRepository $er) {
return $er->createQueryBuilder('page')->where('page.parentfor=:parentfor')->setParameter('parentfor', 'group');
},
]
);
if ('admin' == $options['access'] || 'update' == $options['mode']) {
$builder->add('owner',
Select2EntityType::class, [

View File

@ -58,7 +58,8 @@ class ItemType extends AbstractType
'choices' => [
'Visiteur' => 'ROLE_ANONYME',
'Utilisateur' => 'ROLE_USER',
'Animateur de Groupe' => 'ROLE_ANIM',
'Manager' => 'ROLE_MANAGER',
'Master' => 'ROLE_MASTER',
'Modérateur' => 'ROLE_MODO',
'Administateur' => 'ROLE_ADMIN',
],

148
src/Form/PageSubmitType.php Normal file
View File

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

View File

@ -45,14 +45,15 @@ class PageUpdateWidgetType extends AbstractType
'required' => false,
]);
if ('config' == $options['access'] && 'group' != $options['for']) {
if ('admin' == $options['access'] && 'group' != $options['for']) {
$builder
->add('roles', ChoiceType::class, [
'label' => 'Visible pour les Rôles',
'choices' => [
'Visiteur' => 'ROLE_ANONYME',
'Utilisateur' => 'ROLE_USER',
'Animateur de Groupe' => 'ROLE_ANIM',
'Manager' => 'ROLE_MANAGER',
'Master' => 'ROLE_MASTER',
'Modérateur' => 'ROLE_MODO',
'Administateur' => 'ROLE_ADMIN',
],
@ -63,10 +64,10 @@ class PageUpdateWidgetType extends AbstractType
->add('groups', Select2EntityType::class, [
'label' => 'Visible pour les Groupes',
'class' => 'App:Group',
'class' => 'App\Entity\Group',
'text_property' => 'label',
'multiple' => true,
'remote_route' => 'app_ajax_group_list',
'remote_route' => 'app_admin_group_selectlist',
'primary_key' => 'id',
'text_property' => 'label',
'minimum_input_length' => 0,
@ -84,7 +85,7 @@ class PageUpdateWidgetType extends AbstractType
'disabled' => ('delete' == $options['mode'] ? true : false),
'required' => false,
'multiple' => false,
'remote_route' => 'app_config_user_ajax_selectlist',
'remote_route' => 'app_admin_user_selectlist',
'class' => 'App\Entity\User',
'primary_key' => 'id',
'text_property' => 'username',

View File

@ -40,7 +40,6 @@ class FaChoiceType extends AbstractType
'attr' => [
// It's the key of the solution and can be done in many ways.
// Now, the rendered <select> element will have a new font.
'style' => "font-family: 'FontAwesome';",
'class' => 'select2-icon',
],
'choices' => $this->getFontAwesomeIconChoices(),

View File

@ -40,11 +40,10 @@ class AlertRepository extends EntityRepository
;
}
public function getUserAlerts($user, $idalertcategory, $alertcategoryfilter, $ssoitems)
public function getUserAlerts($user, $idalertcategory, $alertcategoryfilter)
{
// Profilage
$roles = ($user ? $user->getRoles() : ['ROLE_ANONYME']);
$niveau01 = ($user ? $user->getNiveau01() : null);
$groups = ($user ? $user->getGroups() : []);
$userreads = ($user ? $user->getAlertreaders() : new ArrayCollection());
@ -78,30 +77,6 @@ class AlertRepository extends EntityRepository
}
}
// Récupération par Niveau01
$qb = $this->createQueryBuilder('a');
$qb->select('alert')
->from('App:Alert', 'alert')
->where(':niveau01 MEMBER OF alert.niveau01s')
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter('niveau01', $niveau01)
->setParameter('today', date('Y-m-d'));
if ($idalertcategory && $alertcategoryfilter) {
$qb->andWhere('alert.alertcategory=:alertcategory')
->setParameter('alertcategory', $alertcategoryfilter);
}
$alertsniveau01s = $qb->getQuery()->getResult();
foreach ($alertsniveau01s as $alertniveau01) {
if (!$alerts->contains($alertniveau01) && !$userreads->contains($alertniveau01)) {
$alerts->add($alertniveau01);
}
}
// Récupération des alerts par group
foreach ($groups as $group) {
$qb = $this->createQueryBuilder('a');
@ -128,36 +103,6 @@ class AlertRepository extends EntityRepository
}
}
// Récupération des alerts par item
$bookmarks = null;
$items = null;
$itemcategorys = null;
$this->getEntityManager()->getRepository('App:Item')->getUserItems($user, $bookmarks, $items, $itemcategorys, null, $ssoitems, 4);
foreach ($items as $item) {
$qb = $this->createQueryBuilder('a');
$qb->select('alert')
->from('App:Alert', 'alert')
->where(':item MEMBER OF alert.items')
->andWhere('alert.publishedat <= :today')
->andWhere($qb->expr()->orX(
$qb->expr()->gt('alert.unpublishedat', ':today'),
$qb->expr()->isNull('alert.unpublishedat')
))
->setParameter('item', $item)
->setParameter('today', date('Y-m-d'));
if ($idalertcategory && $alertcategoryfilter) {
$qb->andWhere('alert.alertcategory=:alertcategory')
->setParameter('alertcategory', $alertcategoryfilter);
}
$alertsitems = $qb->getQuery()->getResult();
foreach ($alertsitems as $alertitem) {
if (!$alerts->contains($alertitem) && !$userreads->contains($alertitem)) {
$alerts->add($alertitem);
}
}
}
// Trie des alerts
$alertsordered = $alerts->getIterator();
$alertsordered->uasort(function ($first, $second) {

View File

@ -87,7 +87,7 @@ class ItemRepository extends ServiceEntityRepository
$itemsroles = $qb->getQuery()->getResult();
foreach ($itemsroles as $itemrole) {
if (!$bookmarksitems->contains($itemrole) && !$items->contains($itemrole)) {
if (!$fgessential || ($fgessential && $itemrole->getEssential())) {
if (!$fgessential || ($fgessential && $itemrole->isEssential())) {
$items->add($itemrole);
}
}
@ -115,7 +115,7 @@ class ItemRepository extends ServiceEntityRepository
$itemsgroups = $qb->getQuery()->getResult();
foreach ($itemsgroups as $itemgroup) {
if (!$bookmarksitems->contains($itemgroup) && !$items->contains($itemgroup)) {
if (!$fgessential || ($fgessential && $itemgroup->getEssential())) {
if (!$fgessential || ($fgessential && $itemgroup->isEssential())) {
$items->add($itemgroup);
}
}
@ -166,7 +166,6 @@ class ItemRepository extends ServiceEntityRepository
}
// Catégories affichées
dump($itemsordered);
$itemcategorys = new ArrayCollection();
if ($iditemcategory && $itemcategoryfilter) {
$itemcategorys = $itemcategoryfilter;

View File

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

126
templates/Bookmark/edit.html.twig Executable file
View File

@ -0,0 +1,126 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
<h1 class="page-header">
{% if mode=="update" %}
Modification {{ (touser=='false' ? "Lien" : "Favori") }}
{% elseif mode=="submit" %}
Création {{ (touser=='false' ? "Lien" : "Favori") }}
{% endif %}
</h1>
{{ form_widget(form.submit) }}
<a class="btn btn-secondary" href="{{ path('app_'~access~'_page_'~usage~'_view',{id:idpage}) }}">Annuler</a>
{% if mode=="update" %}
<a href={{ path('app_'~access~'_bookmark_delete',{'id':entity.id,'idpage':idpage,'idwidget':idwidget,'touser':touser,usage:usage}) }}
class="btn btn-danger float-end"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer ce favoris ?">
Supprimer
</a>
{% endif %}
<br><br>
{% 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 clearfix">
<div class="col-md-8">
<div class="card">
<div class="card-header">
<i class="fas fa-pencil-alt fa-fw"></i> Informations
</div>
<div class="card-body">
{{ form_row(form.title) }}
{{ form_row(form.subtitle) }}
{{ form_row(form.url) }}
<em>le mot clé #login# sera remplacé par le login de l'utilisateur</em><br>
{{ form_row(form.target) }}
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<div class="card-header">
<i class="fas fa-glasses fa-fw"></i> Appararence
</div>
<div class="card-body">
{{ form_row(form.color) }}
<div id="diviconsel" class="col-md-12 text-center mb-1 mt-1" style="height:140px; padding:20px; background-color: {{ entity.color ? entity.color : 'var(--colorbgbodydark)' }};">
{% if entity.icon %}
<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>
{{ form_end(form) }}
{% endblock %}
{% block localscript %}
<script>
$('document').ready(function(){
showhide();
});
$("#bookmark_color").bind("change paste keyup", function() {
$("#diviconsel").css("background-color",$(this).val());
});
function selIcon(idicon,url) {
$("#bookmark_idicon").val(idicon);
$("#diviconsel img").remove();
$("#diviconsel").append("<img src='"+url+"'>");
$("#diviconsel img").attr("height","100px");
$("#mymodallarge").modal("hide");
}
function delIcon() {
$("#diviconsel img").remove();
$("#bookmark_idicon").val(null);
}
function showhide() {
$("#divhelp").hide();
if($("#bookmark_target").val()=="frame") {
$("#divhelp").show();
}
}
</script>
{% endblock %}

View File

@ -52,10 +52,12 @@
{% if form.isworkgroup is defined %}
{{ form_row(form.isworkgroup) }}
{% endif %}
<div id="blockisopen">
{% if form.pagetemplate is defined %}
{{ form_row(form.pagetemplate) }}
{% endif %}
{{ form_row(form.isopen) }}
</div>
{{ form_row(form.description) }}
@ -95,8 +97,16 @@
});
function showhide() {
if($("#group_isworkgroup").val()==0) $("#blockisopen").hide();
else $("#blockisopen").show();
if($("#group_isworkgroup").val()==0) {
$("#groupfield_group_isopen").hide();
$("#groupfield_group_pagetemplate").hide();
}
else {
$("#groupfield_group_isopen").show();
$("#groupfield_group_pagetemplate").show();
}
}
</script>

View File

@ -2,8 +2,13 @@
{% block body %}
<h1 class="page-header">Membres du Groupe = {{ group.label }}</h1>
<a class="btn btn-secondary" href={{ path('app_'~access~'_group') }}>Fermer</a>
{% if idpage=="" %}
<a class="btn btn-secondary" href={{ path('app_'~access~'_group') }}>Fermer</a>
{% else %}
<a class="btn btn-secondary" href={{ path('app_home',{id:idpage}) }}>Fermer</a>
{% endif %}
<br><br>
<div class="row">

View File

@ -1,50 +0,0 @@
{% extends "base.html.twig" %}
{% block body %}
{% if app.user %}
{% set username = app.user.username %}
{% else %}
{% set username = "" %}
{% endif %}
{% for bookmark in bookmarks %}
{% endfor %}
{% for itemcategory in itemcategorys %}
{% if itemcategorys|length > 1 %} <h2 {% if not loop.first %} class="mt-3" {% endif %}>{{itemcategory.label}}</h2> {% endif %}
<div class="items-list">
{% for item in items %}
{% if item.itemcategory==itemcategory %}
<div class="item item-large" style="background-color: {{ item.color ? item.color : "var(--colorbgbodydark)" }};">
<div class="item-container">
<div class="item-content">
<a class="item-link" href="{{ item.url|replace({'#login#': username}) }}" target="{{ item.target }}">
{% 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 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 %}
{% endblock %}

View File

@ -71,10 +71,14 @@
'items' : [
{
icon: 'fa fa-copy fa-fw',
route: 'app_admin_pagetemplate',
route: 'app_admin_page_template',
name: 'Modèles de Page',
},
{
icon: 'fa fa-file fa-fw',
route: 'app_admin_page_portal',
name: 'Pages',
},
{
icon: 'fa fa-desktop',
route: 'app_admin_item',

View File

@ -87,7 +87,6 @@
<div class="card-body">
{{ form_row(form.color) }}
<div id="diviconsel" class="col-md-12 text-center mb-1 mt-1" style="height:140px; padding:20px; background-color: {{ item.color ? item.color : 'var(--colorbgbodydark)' }};">
{% if item.icon %}
<img src="{{ path('app_minio_image',{file:item.icon.label}) }}" height="100" />

View File

@ -92,9 +92,15 @@
<span class="badge bg-success float-end"></span>
</a>
<a class="list-group-item" data-role="ROLE_ANIM" style="cursor:pointer">
<a class="list-group-item" data-role="ROLE_MANAGER" style="cursor:pointer">
<i class="fa fa-user"></i>
Animateur de Groupe
Manager
<span class="badge bg-success float-end"></span>
</a>
<a class="list-group-item" data-role="ROLE_MASTER" style="cursor:pointer">
<i class="fa fa-user"></i>
Master
<span class="badge bg-success float-end"></span>
</a>
@ -150,7 +156,8 @@
$("a[data-role='ROLE_ANONYME']").children("span").html($('.group-ROLE_ANONYME').length);
$("a[data-role='ROLE_USER']").children("span").html($('.group-ROLE_USER').length);
$("a[data-role='ROLE_ANIM']").children("span").html($('.group-ROLE_ANIM').length);
$("a[data-role='ROLE_MANAGER']").children("span").html($('.group-ROLE_MANAGER').length);
$("a[data-role='ROLE_MASTER']").children("span").html($('.group-ROLE_MASTER').length);
$("a[data-role='ROLE_MODO']").children("span").html($('.group-ROLE_MODO').length);
$("a[data-role='ROLE_ADMIN']").children("span").html($('.group-ROLE_ADMIN').length);

View File

@ -6,7 +6,7 @@
Gestion des Pages
</h1>
<a href="{{ path('app_config_page_submit') }}" class="btn btn-success">Ajouter une Page</a>
<a href="{{ path('app_'~access~'_page_'~usage~'_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">
@ -37,7 +37,8 @@
</div>
{% endblock %}
{% block localjavascript %}
{% block localscript %}
<script>
$(document).ready(function() {
{% if not app.session.get('alluserpage') is empty %}
var state={{ app.session.get('alluserpage') }};
@ -55,7 +56,7 @@
processing: true,
serverSide: true,
ajax: {
"url": "{{ path('app_config_page_ajax_list') }}",
"url": "{{ path('app_'~access~'_page_'~usage~'_tablelist') }}",
"data": function ( d ) {
return $.extend( {}, d, {
"alluser": $('#alluser').is(':checked')
@ -85,5 +86,5 @@
$("#labelalluser").html("Afficher les pages créées par des utilisateurs");
});
</script>
{% endblock %}

View File

@ -1,47 +1,7 @@
{% 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 %}
{% for groupshared in groups %}
{% if groupshared.pagesshared|length == 1 %}
{% set page = groupshared.pagesshared[0] %}
{% set forcereload=true %}

View File

@ -1,334 +0,0 @@
{% 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

@ -1,292 +1,308 @@
{% extends '@CadolesCore/base.html.twig' %}
{% extends 'base.html.twig' %}
{% block localstyle %}
body{overflow-y:hidden}
<style>
body{
overflow-y:hidden
}
#page{
padding:0px !important;
overflow-y:hidden;
}
</Style>
{% 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>
{% block menuapp %}
<ul id="menupagesportal" class="navbar-nav">
{% for page in pagesportal %}
<li id="menupage-{{page.id}}" class="menupage nav-item" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal','{{page.pagecategory.id==1?page.toreload:true}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% elseif loop.first %}
<i class="fas fa-home fa-fw"></i>
{% else %}
<i class="fas fa-door-closed fa-fw"></i>
{% endif %}
{{ page.name }}
</a>
</li>
{% endfor %}
</ul>
<ul id="menupagesuser" class="navbar-nav">
{% for page in pagesuser %}
<li id="menupage-{{page.id}}" class="menupage nav-item" style="cursor:pointer">
<a onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{page.pagecategory.id==1?page.toreload:true}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% else %}
<i class="fas fa-user fa-fw"></i>
{% endif %}
{{ page.name }}
</a>
</li>
{% endfor %}
</ul>
{% if groups|length > 0 and groups|length < 10 %}
<ul id="menupagesgroup" class="navbar-nav">
{% for groupshared in groups %}
{% if groupshared.pagesshared|length > 1 %}
<li id="menugroup-{{groupshared.id}}" class="nav-item menupage dropdown">
<a class="dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-users fa-fw"></i>
{{ groupshared.label }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{% endif %}
{% for page in groupshared.pagesshared %}
{% if groupshared.pagesshared|length == 1 %}
<li id="menupage-{{page.id}}" class="menupage nav-item">
{%endif%}
<a id="menupage-{{page.id}}" style="cursor:pointer" class="{{ groupshared.pagesshared|length > 1 ? "menupage dropdown-item" : "" }}" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{page.pagecategory.id==1?page.toreload:true}}',{{groupshared.id}},'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% else %}
<i class="fa fa-users fa-fw"></i>
{% endif %}
{{ page.name }}
</a>
{% if groupshared.pagesshared|length == 1 %}
</li>
{%endif%}
{% endfor %}
{% if groupshared.pagesshared|length > 1 %}
</div>
</li>
{% endif %}
{% endfor %}
</ul>
{% elseif groups|length > 0 %}
<ul id="menupagesgroup" class="navbar-nav">
<li class="nav-item" style="cursor:pointer">
<a onclick="$('#selmenu').modal('show');">
<i class="fa fa-users fa-fw"></i> Mes Groupes
</a>
</li>
</ul>
{%else%}
{% set inmenu=true %}
{{ include('@CadolesPortal/Page/menugroupe.html.twig') }}
{% endif %}
</ul>
{% endblock %}
{% block menuuser %}
{% 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="menuwidgetuser" class="btn-modal" style='cursor:pointer' data-modalid='selwidgetuser' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a></li>
<a id="menuwidgetgroup" class="btn-modal" style='cursor:pointer' data-modalid='selwidgetgroup' title='Ajouter un widget'><i class='fa fa-cubes fa-fw'></i></a></li>
{% endblock %}
<div id="menupageaction">
<a id="menuname" style="cursor:pointer;font-size:80%" href=""></a>
{% block body %}
<div id="pagecontainer"></div>
{% 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 id="selmenu" 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 UNE PAGE</h4>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="pagesportal" style="display:none">
{% for page in pagesportal %}
{%if loop.first %}
<div class="card mb-3">
<div class="card-header">PAGES PORTAIL</div>
<ul class="list-group list-group-flush">
{%endif%}
<a class="list-group-item" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','portal','{{page.pagecategory.id==1?page.toreload:true}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% elseif loop.first %}
<i class="fas fa-home fa-fw"></i>
{% else %}
<i class="fas fa-door-closed fa-fw"></i>
{% endif %}
{{ page.name }}
</a>
{%if loop.last %}
</ul></div>
{%endif%}
{% endfor %}
</div>
<div id="pagesuser" style="display:none">
{% for page in pagesuser %}
{%if loop.first %}
<div class="card mb-3">
<div class="card-header">PAGES PERSONNEL</div>
<ul class="list-group list-group-flush">
{%endif%}
<a class="list-group-item" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','user','{{page.pagecategory.id==1?page.toreload:true}}',null,'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% else %}
<i class="fas fa-user fa-fw"></i>
{% endif %}
{{ page.name }}
</a>
{%if loop.last %}
</ul></div>
{%endif%}
{% endfor %}
</div>
<div id="pagesgroup">
{% for groupshared in groups %}
{%if loop.first %}
<div class="card mb-3">
<div class="card-header">PAGES GROUPE DE TRAVAIL</div>
<ul class="list-group list-group-flush">
{%endif%}
{% for page in groupshared.pagesshared %}
<a class="list-group-item" onClick="showPage({{ page.id }},{{ page.pagecategory.id }},'{{ page.canupdate }}','group','{{page.pagecategory.id==1?page.toreload:true}}',{{groupshared.id}},'{{page.name}}')">
{% if page.fonticon %}
<i class="{{ page.fonticon }} fa-fw"></i>
{% else %}
<i class="fas fa-users fa-fw"></i>
{% endif %}
{{page.name == groupshared.label ? page.name : groupshared.label~" - "~page.name}}
</a>
{% endfor %}
{%if loop.last %}
</ul></div>
{%endif%}
{% endfor %}
</div>
</div>
</div>
</div>
</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 id="selwidgetuser" class="modal fade" role="dialog">
<div class="modal-dialog modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<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">
<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>
<table id="dataTablesuser" class="table table-striped table-bordered table-hover" style="width:100%">
<thead>
<tr>
<th width="100px">#</th>
<th>Nom</th>
<th class="no-sort">Description</th>
<th class="no-sort" width="80px"></th>
<th width="100px">Nom</th>
<th class="no-sort" width="500px">Description</th>
</tr>
</thead>
</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>
<tbody>
{% for widget in widgetsuser %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }},'user')" 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>
{%if app.user %}
<a id="refreshcounter" data-event=""></a>
{% endif %}
<div id="selwidgetgroup" 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">
<table id="dataTablesgroup" 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 widgetsgroup %}
<tr>
<td>
<a onClick="selWidget({{ widget.id }},'group')" 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>
{% 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 %}
{% block localscript %}
<script>
var idpage;
pagebookmark="{{app.session.get("pagebookmark")}}";
$('document').ready(function(){
{% if gotoroute is empty %}
{% for page in pagesadmin %}
// Afficher la page courrante
{% for page in pagesportal %}
{% if page.id==entity.id %}
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','portal',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 groups %}
{% for page in groupshared.pagesshared %}
{% 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}}');
showPage({{ page.id }}, {{ page.pagecategory.id }},'{{ page.canupdate }}','group',true,{{groupshared.id}},'{{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 %}
{% endfor %}
{% endfor %}
// Rendre les pages user déplacable
$("#pagesuser").sortable({
$("#menupagesuser").sortable({
axis: "x",
forcePlaceholderSize: true,
placeholder: "placeholder",
@ -295,7 +311,7 @@
var idpage=$(this).attr('id').replace("menupage-","");
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_page_order') }}",
url: "{{ path('app_'~access~'_page_user_order') }}",
data: {
id:idpage,
order:order
@ -308,47 +324,16 @@
// 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" ]],
scrollX: false,
});
{% 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) {
function showItemframe(id,url,forcereload) {
$(".pageframereload").remove();
$(".pageframe").hide();
@ -366,7 +351,7 @@
$("#pagecontainer").append("<iframe onload='this.contentWindow.focus()' id='frameitem-"+id+"' class='pageframe "+myclass+"' src='"+url+"' style='border:none; width:100%'></iframe>");
}
resizeFrame();
Resize();
}
// Affichages des pages
@ -377,20 +362,26 @@
// Cacher toutes les pages
$(".pageframereload").remove();
$(".pageframe").hide();
$(".dropdown-menu").hide();
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$(".dropdown-toggle").removeClass("dropdownactive");
$(".menupage").removeClass("active");
$(".dropdown-toggle").removeClass("active");
$("#menupage-"+id).addClass("active");
$('a[data-group="'+groupid+'"][data-toggle="dropdown"]').addClass("dropdownactive");;
$("#menugroup-"+groupid).addClass("active");
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'}) }}";
if(usage=="portal")
var url="{{ path('app_all_page_portal_view',{id:'xx'}) }}";
else if(usage=="user")
var url="{{ path('app_all_page_user_view',{id:'xx'}) }}";
else
var url="{{ path('app_all_page_group_view',{id:'xx'}) }}";
url=url.replace('xx',id);
passurl="{{ path('app_home',{id:'xx'}) }}";
passurl=passurl.replace('xx',id);
history.pushState('data to be passed', 'Title of the page', passurl);
@ -408,93 +399,46 @@
$("#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();
Resize();
}
function submitPage() {
var url="{{ path('cadoles_portal_'~access~'_page_submit') }}";
var url="{{ path('app_'~access~'_page_user_submit') }}";
$(location).attr('href',url);
}
function updatePage() {
if($("#page-"+idpage).length) {
var url="{{ path('cadoles_portal_'~access~'_page_update',{id:'xx'}) }}";
var url="{{ path('app_'~access~'_page_user_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'}) }}";
var url="{{ path('app_'~access~'_page_user_delete',{id:'xx'}) }}";
url=url.replace('xx',idpage);
$(location).attr('href',url);
@ -502,70 +446,16 @@
}
}
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'})}}";
function selWidget(idwidgettype,usage) {
var url="{{ path('app_all_pagewidget_widget_sumbit',{idpage:'yy',idwidgettype:'xx',usage:'zz'})}}";
url=url.replace('xx',idwidgettype);
url=url.replace('yy',idpage);
$(location).attr('href', url);
url=url.replace('zz',usage);
$(".modal").modal("hide");
$("#page-"+idpage).attr("src",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");
}
});
}
});
}
</script>
{% endblock %}

View File

@ -1,46 +0,0 @@
{% 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

@ -1,6 +1,6 @@
{% extends '@CadolesCore/base.html.twig' %}
{% extends 'base.html.twig' %}
{% block pagewrapper %}
{% block body %}
{{ form_start(form) }}
<h1>
Nouvelle Page
@ -8,10 +8,10 @@
<p>
{{ form_widget(form.submit) }}
{% if access=="config" %}
<a class="btn btn-default" href="{{ path('cadoles_portal_config_page') }}">Annuler</a>
{% if access=="admin" %}
<a class="btn btn-secondary" href="{{ path('app_admin_page_portal') }}">Annuler</a>
{% else %}
<a class="btn btn-default" href="{{ path('cadoles_core_home') }}">Annuler</a>
<a class="btn btn-secondary" href="{{ path('app_home') }}">Annuler</a>
{% endif %}
</p>
@ -33,12 +33,12 @@
</div>
{% endif %}
<div class="panel panel-primary">
<div class="panel-heading">
<div class="card">
<div class="card-header">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
<div class="panel-body">
<div class="card-body">
{{ form_row(form.name) }}
{{ form_row(form.pagecategory) }}
{{ form_row(form.usage) }}
@ -46,8 +46,9 @@
{{ form_row(form.user) }}
{% endif %}
<div id="pagegroup">{{ form_row(form.page) }}</div>
<div id="groupworkgroup">{{ form_row(form.groups) }}</div>
{{ form_row(form.page) }}
{{ form_row(form.groups) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
@ -56,7 +57,8 @@
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
{% block localscript %}
<script>
$('document').ready(function(){
hideshow();
});
@ -71,16 +73,16 @@
function hideshow() {
if($("#page_submit_pagecategory").val()==2)
$("#pagegroup").show();
$("#groupfield_page_submit_page").show();
else {
$("#pagegroup").hide();
$("#groupfield_page_submit_page").hide();
}
if($("#page_submit_usage").val()=="group")
$("#groupworkgroup").show();
$("#groupfield_page_submit_groups").show();
else {
$("#groupworkgroup").hide();
$("#groupfield_page_submit_groups").hide();
}
}
</script>
{% endblock %}

View File

@ -147,9 +147,11 @@
{{ 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}}
{% if usage=="template" %}
Modification Modèle de Page = {{page.name}}
{% else %}
Modification Page Widget = {{page.name}}
{% endif %}
{% elseif mode=="submit" %}
Création Page Widget
{% endif %}
@ -157,33 +159,21 @@
<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 %}
{% if access=="admin" %}
<a class="btn btn-secondary" href="{{ path('app_'~access~'_page_'~usage~'_view',{id:page.id}) }}">Annuler</a>
{% 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"
<a href={{ path('app_'~access~'_page_'~usage~'_delete',{'id':page.id}) }}
class="btn btn-danger float-end"
data-method="delete" data-csrf="_token:{{ 'csrf' }}"
data-confirm="Êtes-vous sûr de vouloir supprimer cette page ?">
Supprimer
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') %}
@ -206,30 +196,49 @@
<div class="form-group row clearfix">
{% if form.roles is defined %}
<div class="col-md-8">
<div class="col-md-8">
{% else %}
<div class="col-md-12">
<div class="col-md-12">
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-pencil fa-fw"></i> Informations
</div>
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.template) }}
<div class="card-body">
{{ form_row(form.name) }}
{{ form_row(form.roworder) }}
{{ form_row(form.fonticon) }}
{{ form_row(form.maxwidth) }}
{{ form_row(form.template) }}
</div>
</div>
</div>
{% if form.roles is defined %}
<div class="col-md-4">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
<div class="card">
<div class="card-header">
<i class="fa fa-link fa-fw"></i> Affectations
</div>
<div class="card-body">
{{ form_row(form.user) }}
{{ form_row(form.roles) }}
{{ form_row(form.groups) }}
</div>
</div>
</div>
{% endif %}
</div>
<h3>Template de Mise en Page</h3>
<div id="gridtemplate">
</div>
<div class="card mt-3">
<div class="card-header">
<i class="fas fa-table-columns fa-fw"></i> Template de Mise en Page
</div>
<div class="card-body">
<div id="gridtemplate">
</div>
</div>
{{ form_end(form) }}
{% endblock %}

View File

@ -1,30 +1,10 @@
{% 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 href='{{ path('app_'~access~'_page_'~usage~'_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_'~usage~'_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 %}
@ -37,8 +17,8 @@
<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})) }}
<a href="{{ url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,usage:usage}) }}"></a>
{{ render(url(pagewidget.widget.routeview|replace({'_admin_':'_'~access~'_'}),{id:pagewidget.id,usage:usage})) }}
{% endfor %}
</div>
@ -84,9 +64,6 @@
</div>
</div>
{% endif %}
{% endblock %}
{% block localscript %}
@ -191,7 +168,7 @@
// Rendre les widgets déplacable
$("#widget-container .mycol").sortable({
connectWith: "#widget-container .mycol",
handle: '.widgetheader',
handle: '.widget-sortable',
placeholder: "widget widgetplacehorder",
tolerance: "pointer",
cursor: "move",
@ -205,10 +182,7 @@
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);
$(".colcontainer .mycol").css("padding-bottom","");
},
update: updateLocalisation
});
@ -219,19 +193,15 @@
//slick();
// Sur le click des titres de widgets ouvrir / fermer le widget
$( ".widgetheader .title" ).click(function() {
$( ".widget-header .widget-title" ).click(function() {
showhideWidget(this);
});
$( ".widgetheader .logo" ).click(function() {
$( ".widget-header .widget-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
@ -266,7 +236,7 @@
function showhideWidget(elem) {
widget=$(elem).parent().parent();
idwidget= widget.data("id");
if(widget.children(".widgetbody").css("display")=='block')
if(widget.children(".widget-body").css("display")=='block')
value=false;
else
value=true;
@ -283,11 +253,7 @@
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);
widget.find(".widget-body" ).toggle();
}
});
{% endif %}
@ -298,8 +264,10 @@
function updateLocalisation() {
$('.colcontainer .mycol').each(function(index) {
var idloc=$(this).attr('id');
console.log(idloc);
$(this).children(".widget").each(function(order){
var idwidget=$(this).data('id');
console.log(idwidget);
$.ajax({
method: "POST",
url: "{{ path('app_'~access~'_pagewidget_order') }}",
@ -315,7 +283,7 @@
// Création d'un widget selectionné
function selWidget(idwidgettype) {
var url="{{ path('app_'~access~'_pagewidget_widget_sumbit',{idpage:page.id,idwidgettype:'xx','by':mode})}}";
var url="{{ path('app_'~access~'_pagewidget_widget_sumbit',{idpage:page.id,idwidgettype:'xx',usage:usage})}}";
url=url.replace('xx',idwidgettype);
$(location).attr('href', url);
@ -323,8 +291,7 @@
// 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})}}";
var url="{{ path('app_'~access~'_pagewidget_widget_update',{idpage:page.id,idwidget:'xx',usage:usage})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
@ -354,7 +321,7 @@
value=value+1;
if(value==5) value=0;
}
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
@ -372,19 +339,21 @@
// 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);
var url="{{ path('app_'~access~'_bookmark_submit',{idpage:page.id,idwidget:'yy',touser:'zz',usage:usage})}}";
url=url.replace('yy',idwidget);
url=url.replace('zz',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})}}";
function modBookmark(idbookmark,idwidget,touser) {
var url="{{ path('app_'~access~'_bookmark_update',{id:'xx',idpage:page.id,idwidget:'yy',touser:'zz',usage:usage})}}";
url=url.replace('xx',idbookmark);
url=url.replace('yy',idwidget);
url=url.replace('zz',touser);
url=url.replace(/&amp;/g,"&");
$(location).attr('href', url);
@ -396,7 +365,7 @@
$.ajax({
method: "POST",
url: "{{ path('app_all_bookmark_heart') }}",
url: "{{ path('app_'~access~'_bookmark_heart') }}",
data: {
iditem:iditem
},
@ -408,11 +377,13 @@
}
// 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})}}";
function delBookmark(idbookmark,idwidget,touser) {
if (confirm('Êtes-vous sûr de vouloir supprimer ce favoris ?')) {
var url="{{ path('app_'~access~'_bookmark_delete',{id:'xx',idpage:page.id,idwidget:'yy',touser:'zz',usage:usage})}}";
url=url.replace('xx',idbookmark);
url=url.replace('yy',idwidget);
url=url.replace('zz',touser);
url=url.replace(/&amp;/g,"&");
$.ajax({
@ -445,7 +416,7 @@
// Liste des slides
function listSlide(idwidget) {
var url="{{ path('app_'~access~'_slide_list',{idpage:page.id,idwidget:'xx',group:group,usage:usage,by:mode})}}";
var url="{{ path('app_'~access~'_slide_list',{idpage:page.id,idwidget:'xx',usage:usage})}}";
url=url.replace('xx',idwidget);
url=url.replace(/&amp;/g,"&");
@ -463,7 +434,7 @@
// Affichage des frames associés aux items de bureau
function showItemframe(id,url,forcereload) {
{% if access=="all" %}
window.parent.showItemframe(id,url,forcereload);
parent.showItemframe(id,url,forcereload);
{% else %}
$("#page").hide();
$("body").css("overflow-y","hidden");
@ -555,7 +526,6 @@
},
success: function() {
$("#alert-"+id).remove();
var grid = $('.grid').masonry(optiongrid);
}
});
}

View File

@ -7,7 +7,7 @@
</h1>
<p>
<a href="{{ path('app_'~access~'_pagetemplate_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
<a href="{{ path('app_'~access~'_template_submit') }}" class="btn btn-success">Ajouter un Modèle</a>
</p>
{% if app.session.flashbag.has('error') %}
@ -51,7 +51,7 @@
order: [[ 1, "asc" ]],
processing: true,
serverSide: true,
ajax: "{{ path('app_'~access~'_pagetemplate_tablelist') }}",
ajax: "{{ path('app_'~access~'_page_template_tablelist') }}",
});
});
</script>

View File

@ -8,7 +8,7 @@
<p>
{{ form_widget(form.submit) }}
<a class="btn btn-default" href="{{ path('app_'~access~'_pagetemplate') }}">Annuler</a>
<a class="btn btn-secondary" href="{{ path('app_'~access~'_page_template') }}">Annuler</a>
</p>
{% if app.session.flashbag.has('error') %}

View File

@ -1,238 +0,0 @@
{% 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

@ -12,22 +12,7 @@
<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 %}
<a class="btn btn-secondary" href="{{ path('app_'~access~'_page_'~usage~'_view',{id:idpage}) }}">Annuler</a>
</p>
{% if app.session.flashbag.has('error') %}
@ -159,6 +144,7 @@
function delIcon() {
$("#diviconsel img").remove();
$("#diviconsel").append("<img src='{{ path("app_minio_image",{file:entity.widget.icon.label}) }}'>");
$("#diviconsel img").attr("height","100px");
$("#pagewidget_idicon").val(null);
}
@ -173,10 +159,13 @@
if($("#pagewidget_viewheader").val()==1) {
$("#groupfield_pagewidget_colorheaderback").show();
$("#groupfield_pagewidget_colorheaderfont").show();
$("#groupfield_pagewidget_opened").show();
}
else {
$("#groupfield_pagewidget_colorheaderback").hide();
$("#groupfield_pagewidget_colorheaderfont").hide();
$("#groupfield_pagewidget_opened").hide();
$("#pagewidget_opened").val(1);
}
}
</script>

View File

@ -1,140 +1,42 @@
{% 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%}
{% set widgetname="item" %}
{% extends 'Pagewidget/widget.twig' %}
{% block widgetbody %}
{% for alert in alerts %}
{% if loop.first %}
<div class="items-list">
{% endif %}
<div class="item item-list" id="alert-{{alert.id}}" style="color:var(--colorftbodydark); background: {{ alert.alertcategory.color ? alert.alertcategory.color : 'var(--colorbgbodydark)' }};">
<div class="item-container">
<div class="item-content">
<div class="item-link">
{% if alert.alertcategory.icon %}
<img height="35" src="{{ path('app_minio_image',{file:alert.alertcategory.icon.label}) }}">
{% else %}
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_megaphone.png"}) }}">
{% endif %}
<div class="item-title">
<h3 >{{ alert.title }}</h3>
</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 class="item-action">
{% if alert.fghideable and app.user %}
<a onClick="hideAlert({{alert.id}})" style="cursor:pointer;" title="Ne plus afficher"><i class="fa fa-eye-slash"></i></a>
{%endif%}
</div>
</div>
<div class="item-description">
{{ alert.content|raw }}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% if loop.last %}
</div>
{% endif %}
{% endfor %}
{% endblock %}

View File

@ -1,112 +0,0 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set 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

@ -1,132 +1,90 @@
{% import "Pagewidget/constants.twig" as constants %}
{% set widgetname="item" %}
{% extends 'Pagewidget/widget.twig' %}
{% block widgetaction %}
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% endblock %}
{% 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 }}"/>
{% block widgetbody %}
<div class="items-list">
{% 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 %}
<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>
{% set bookmarktitle = bookmark.title %}
{% set bookmarksubtitle = bookmark.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.target %}
{% set bookmarkurl = bookmark.url|replace({'#login#': username}) %}
{% set bookmarkcontent = null %}
{% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %}
{% endif %}
{% if 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>
<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 canadd %}
{% if bookmark.item %}
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-heart fas fa-heart-crack"></i></a>
{% else %}
<a style="display:none" onClick="modBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-mod fas fa-file"></i></a>
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},false)"><i class="item-trash fas fa-trash"></i></a>
{% endif %}
{% endif %}
{% 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 }},false)">
<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 Lien</div>
</div>
</a>
<div class="item-action">
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}

View File

@ -1,116 +0,0 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set 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

@ -1,60 +1,64 @@
{% extends 'widget.html.twig' %}
{% set widgetname="info" %}
{% extends 'Pagewidget/widget.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>
{% for group in entity.page.groups %}
{% if entity.page.groups|length > 1 or not widgethaveheader %}
<h3 style="margin:0px; font-size:25px; {{colorbodyfont}} ">{{group.label}}</h3>
{% endif %}
{% if group.description %}
{{ group.description|nl2br}}
<br><br>
{% endif %}
<div class="items-list">
{% for member in group.users %}
<div class="item item-verysmall" style="background-color: var(--colorbgbodydark);">
<div class="item-container">
<div class="item-content">
<div class="item-link">
<img src="{{ path('app_minio_image',{file:"avatar/"~member.user.avatar}) }}" class="avatar" style="height:40px; width: 40px;">
<div class="item-title">
<h3>{{ member.user.lastname }} {{ member.user.firstname }}</h3>
<div class="item-subtitle" style="display:block !important">
{% if member.rolegroup==100 %}
<i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i>
{% elseif member.rolegroup==90 %}
<i class="fa fa-star"></i><i class="fa fa-star"></i>
{% elseif member.rolegroup==50 %}
<i class="fa fa-star"></i>
{% endif %}
</div>
</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 %}
{%if canadd %}
<div class="item item-verysmall" style="background-color: var(--colorbgbodydark);">
<div class="item-container">
<div class="item-content">
<a class="item-link" href="{{path("app_all_group_users",{id:group.id,idpage:entity.page.id,usage:usage})}}" target="_top">
<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 Utilisateur</div>
</div>
</a>
</div>
</div>
</div>
{% endif %}
</div>
{% endfor %}
{% if entity.page.groups|length == 0 and entity.page.user %}
<center>
<img src="{{ path('app_minio_image',{file:"avatar/"~entity.page.user.avatar}) }}" class="avatar" style="height:128px; width: 128px; margin-bottom:15px">
</center>
{% endif %}
{% endblock %}

View File

@ -1,263 +1,174 @@
<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%}
{% extends 'Pagewidget/widget.twig' %}
{% 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"}) %}
{% block widgetaction %}
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% endblock %}
{% 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 %}
{% block widgetbody %}
{% set havemenu=false %}
{% set havebookmark=false %}
{% 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>
{% if menu and withbookmark!= 2 and (canadd or bookmarks is not empty or 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 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>
{% if bookmarks is not empty or canadd %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},'bookmark')"><i class="fa fa-heart"></i></div>
{% 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>
{% for itemcategory in itemcategorys %}
<div class="cat-list" onClick="showItemCat({{ entity.id}},{{itemcategory.id}})">{{itemcategory.label}}</div>
{% endfor %}
</div>
{% endif %}
{%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 %}
{% 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>
{% endif %}
<input id="itemsearch" onKeyup="searchItem({{ entity.id}},$(this).val());" type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</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>
{% if (bookmarks is not empty or canadd ) and (withbookmark==0 or withbookmark==2) %}
{% if withbookmark==0 or 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">
{% for bookmark in bookmarks %}
{% set havebookmark=true %}
{% if bookmark.item %}
{% set bookmarktitle = bookmark.item.title %}
{% set bookmarksubtitle = bookmark.item.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.item.color ? bookmark.item.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.item.target %}
{% set bookmarkurl = ( bookmark.item.protected and not app.user ? path("app_login") : bookmark.item.url|replace({'#login#': username}) ) %}
{% set bookmarkcontent = bookmark.item.content %}
{% set bookmarkicon = (bookmark.item.icon ? bookmark.item.icon.label : "icon/icon_pin.png") %}
{% else %}
{% set bookmarktitle = bookmark.title %}
{% set bookmarksubtitle = bookmark.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.target %}
{% set bookmarkurl = bookmark.url|replace({'#login#': username}) %}
{% set bookmarkcontent = null %}
{% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %}
{% endif %}
<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 canadd %}
{% if bookmark.item %}
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-heart fas fa-heart-crack"></i></a>
{% else %}
<a style="display:none" onClick="modBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-mod fas fa-file"></i></a>
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-trash fas fa-trash"></i></a>
{% endif %}
{% endif %}
{% 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>
<input id="itemsearch" onKeyup="searchItem({{ entity.id}},$(this).val());" type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
</div>
{% endif %}
{% endfor %}
{% 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>
{% 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 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>
{% endif %}
<div class="item {{itemsize}}" style="background-color: {{ bookmarkbackgroundcolor }};" data-idcategory="bookmark" data-title="{{bookmarktitle|lower}}">
{% for itemcategory in itemcategorys %}
{% if itemcategorys|length > 1 or havebookmark or canadd %} <h3 class="itemcategory-title {{loop.first and not havemenu and not havebookmark ? "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">
{% 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">
{% if bookmarktarget == 'frame' %}
<a class="item-link" onClick="showItemframe('bookmark{{ bookmark.id }}','{{ bookmarkurl }}')">
{% else %}
<a class="item-link" href="{{ bookmarkurl }}" target="{{bookmarktarget }}">
{% set url=item.url|replace({'#login#': username}) %}
{% if item.protected and not app.user %}
{% set url=path('app_login') %}
{% endif %}
<img height="35" src="{{ path('app_minio_image',{file:bookmarkicon}) }}">
{% 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 >{{ bookmarktitle }}</h3>
<div class="item-subtitle">{{ bookmarksubtitle|nl2br }}</div>
<h3 >{{ item.title }}</h3>
<div class="item-subtitle">{{ item.subtitle|nl2br }}</div>
</div>
</a>
<div class="item-action">
{% if bookmarkcontent %}
{% if canadd %}
<a style="display:none" onClick="heartBookmark({{ item.id }})"><i class="item-heart fa fa-heart"></i></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">{{ bookmarkcontent|raw }}</div>
<div class="item-description hide">{{ item.content|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>
{% endif %}
{% endfor %}
</div>
{% endfor %}
{% endblock %}

View File

@ -1,249 +1,131 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% set widgetname="item" %}
{% extends 'Pagewidget/widget.twig' %}
{% 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) %}
{% block widgetaction %}
{% if canadd %}
<i class="fas fa-text-height" title="Changer taille des items" onClick="changeWidget({{ entity.id }},'modedesktop',{{modedesktop}})"></i>
{% endif %}
{% endblock %}
{% 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 }}"/>
{% block widgetbody %}
<div class="items-list">
{% 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 %}
<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>
{% set bookmarktitle = bookmark.title %}
{% set bookmarksubtitle = bookmark.subtitle %}
{% set bookmarkbackgroundcolor = bookmark.color ? bookmark.color : app.session.get('colorbgbodydark')|raw %}
{% set bookmarktarget = bookmark.target %}
{% set bookmarkurl = bookmark.url|replace({'#login#': username}) %}
{% set bookmarkcontent = null %}
{% set bookmarkicon = bookmark.icon ? bookmark.icon.label : "icon/icon_pin.png" %}
{% endif %}
{% if 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 %}
<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>
{% 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 %}
<div class="item-action">
{% 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 }}">
{% if bookmark.item %}
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-heart fas fa-heart-crack"></i></a>
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
<a style="display:none" onClick="modBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-mod fas fa-file"></i></a>
<a style="display:none" onClick="delBookmark({{ bookmark.id }},{{ entity.id }},true)"><i class="item-trash fas fa-trash"></i></a>
{% endif %}
</div>
{% endif %}
<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>
{% if bookmarkcontent %}
<a style="display:none"><i class="item-info fas fa-circle-info"></i></a>
{% endif %}
</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 class="item-description hide">{{ bookmarkcontent|raw }}</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}
{% for item in items %}
<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>
{% 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>
{% endfor %}
<div class="item {{ itemsize }}" style="background-color: var(--colorbgbodydark);" data-idcategory="bookmark">
<div class="item-container">
<div class="item-content">
<a class="item-link" href="{{path("app_all_page_application")}}">
<img height="35" src="{{ path('app_minio_image',{file:"icon/icon_add.png"}) }}">
<div class="item-title">
<h3 >Voir Plus</h3>
<div class="item-subtitle">Voir toutes les Applications</div>
</div>
</a>
<div class="item-action">
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -1,21 +1,22 @@
{% set onlyheader=true %}
{% extends 'widget.html.twig' %}
{% set widgetname="link" %}
{% extends 'Pagewidget/widget.twig' %}
{% block widgetheader %}
{% block widgetbody %}
{% set url=url|replace({'#login#': username}) %}
{% 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 %}">
<a class="item-link" onClick="showItemframe(link{{ entity.id }}','{{ url }}')">
{% 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;" />
<a class="item-link" href="{{ url }}" target="{{ target }}">
{% endif %}
<div style="text-align: center;">{{ entity.name }}</div>
{% if entity.icon %}
<img src="{{ path('app_minio_image',{file:entity.icon.label}) }}" style="max-width: 90%; width:128px; height: auto; display: block; margin: auto; padding-top: 10px;" />
{% else %}
<img src=""{{ path('app_minio_image',{file:"icon/icon_pin.png"}) }}" style="max-width: 90%; width:128px; height: auto; display: block; margin: auto; padding-top: 10px;" />
{% endif %}
<div class="text-center mt-3 pb-1" style="font-size: 22px; font-family: var(--fonttitle); {{colorbodyfont}} !important">{{ entity.name }}</div>
</a>
{% endblock %}

View File

@ -1,76 +0,0 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set stylewidget = constants.mystylewidget(entity) %}
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set 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

@ -1,86 +1,11 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% set widgetname="url" %}
{% extends 'Pagewidget/widget.twig' %}
{% 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>
{% block widgetbody %}
{% if imagemedia %}
<img src="{{ url|replace({'#login#': username}) }}" width="100%" >
{% else %}
<iframe src="{{ url|replace({'#login#': username}) }}" class="{% if entity.autoajust %}frameajust {% endif %}" style="width:100%"></iframe>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,69 @@
{% set widgethaveheader=entity.viewheader %}
{%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="margin:-26px 0px 0px 0px; padding: 1px 10px; background-color:var(--colorbgbodydark); color: var(--colorfttitledark); border-radius: 5px;" %}
{%endif%}
{% set widgetstyleheader=(entity.colorheaderback ? "background-color:"~entity.colorheaderback~";" : "background-color:var(--colorbgbodydark);")~(entity.colorheaderfont ? "color:"~entity.colorheaderfont~";" : "color:var(--colorfttitledark);") %}
{% set widgetstylebody=(entity.colorbodyback ? "background-color:"~entity.colorbodyback~";" : "background-color:var(--colorbgbodylight);")~(entity.colorbodyfont ? "color:"~entity.colorbodyfont~";" : "color:var(--colorfttitlelight);")~(entity.isopened ? "display:block;" : "display:none;")~(widgetname=="url" ? "padding:0px;" : "")~(not widgethaveheader and not entity.border ? "padding-top: 0px" : "")~(entity.autoajust ? "" : "height:"~entity.height~"px;") %}
{% set widgeicon= entity.icon ? path('app_minio_image',{file:entity.icon.label}) : path('app_minio_image',{file:"icon/icon_pin.png"}) %}
{% if modedesktop is defined %}
{% if modedesktop==0 %}
{% set itemsize="item-verysmall" %}
{% elseif modedesktop==1 %}
{% set itemsize="item-small" %}
{% elseif modedesktop==2 %}
{% set itemsize="item-medium" %}
{% elseif modedesktop==3 %}
{% set itemsize="item-large" %}
{% elseif modedesktop==4 %}
{% set itemsize="item-list" %}
{% endif %}
{% endif %}
{% if app.user %}
{% set username = app.user.username %}
{% else %}
{% set username = "" %}
{% endif %}
{% set colorbodyfont = "color: var(--colorfttitlelight)" %}
{% if entity.colorbodyfont is not null %}
{% set colorbodyfont = "color: " ~ entity.colorbodyfont %}
{% endif %}
<div class="widget widget-{{widgetname}} {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} " data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ widgetstyle }}">
<div class="widget-menu" style="{{ widgetstylemenu }}">
{% if canupdate and not widgethaveheader %}
<i class="widget-sortable fas fa-up-down-left-right" title="Déplacer le widget"></i>
{% endif %}
{% block widgetaction %}
{% endblock %}
{% 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 %}
</div>
{%if widgethaveheader %}
<div class="widget-header widget-sortable" style="{{ widgetstyleheader }}">
<img class="widget-logo" src="{{widgeicon}}" />
<span class="widget-title">{{ entity.name }}</span>
</div>
{%endif%}
<div class="widget-body" style="{{ widgetstylebody }};">
{% block widgetbody %}
{% endblock %}
</div>
</div>

View File

@ -1,91 +0,0 @@
{%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

@ -1,13 +0,0 @@
{%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 %}

View File

@ -86,19 +86,17 @@
<a class="nav-link navbar-logo" href="{{ path('app_home')}}" style="display:none">
<img src="{{ path('app_minio_image',{file:"logo/"~app.session.get("logodark")}) }}">
</a>
<a class="nav-link ps-0" href="{{ path('app_home')}}">
{% if not app.session.get("fgheader") %}
{{app.session.get("appname")}}
{% else %}
Accueil
{% endif %}
</a>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<a class="nav-toogle" style="display:none" ><i class="fa-solid fa-bars"></i></a>
<div id="menuapp">
<ul class="nav">
{% block menuapp %}
{% endblock %}
</ul>
</div>
<div class="me-auto">&nbsp;</div>
<ul id="menuuser" class="nav navbar-right pe-3">
{% block menuuser %}
@ -108,7 +106,7 @@
<ul id="menulink" class="nav navbar-right pe-3" style="display:none;">
{% if app.user %}
<a href="{{path("app_all_user")}}">
<img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:25px; height:25px; margin-top:-3px; margin-right:3px;">
<img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:20px; height:20px; margin-top:-3px; margin-right:3px;">
</a>
{% if is_granted('ROLE_ADMIN') %}
@ -202,6 +200,47 @@
});
{% endif %}
}
// Resize
function Resize() {
if($("#header").is(":visible")){
$(".navbar-logo").hide();
$("#menulink").hide();
$("#header").hide();
}
else {
$(".navbar-logo").show();
$("#menulink").show();
$("#header").show();
}
$("main").css("height",$(window).height()-$(".header").height());
$("#page").css("height",$(window).height()-$(".header").height());
$(".pageframe").css("height",$(window).height()-$(".header").height());
$("#sidebar").css("min-height",$("body").height()-$(".header").height());
if($("#menuapp").is(":visible") && $(".nav-toogle").is(":visible")){
$("#menuapp").css("height",$(window).height()-$(".header").height());
}
else {
$("#menuapp").css("height","auto");
}
$(".widget-body").find("iframe").each(function(){
if($(this).hasClass("frameajust")) {
try {
height=this.contentWindow.document.body.scrollHeight;
} catch (error) {
height=0;
}
if(height==0) height=630;
this.style.height = height+"px";
}
else
$(this).height($(this).parent().height());
});
}
</script>
{% block localscript %}{% endblock %}

View File

@ -2998,6 +2998,11 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
iframe-resizer@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/iframe-resizer/-/iframe-resizer-4.3.2.tgz#42dd88345d18b9e377b6044dddb98c664ab0ce6b"
integrity sha512-gOWo2hmdPjMQsQ+zTKbses08mDfDEMh4NneGQNP4qwePYujY1lguqP6gnbeJkf154gojWlBhIltlgnMfYjGHWA==
import-fresh@^3.0.0, import-fresh@^3.2.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"