This commit is contained in:
afornerot 2019-06-17 17:09:00 +02:00
parent cbc5056bbb
commit fdbccaed08
17 changed files with 370 additions and 313 deletions

View File

@ -21,9 +21,11 @@
<variable name="activer_eportail" type="oui/non" description="Activer ePortail" hidden='True' exists='False'>
<value>non</value>
</variable>
<variable name="activer_limesurvey" type="oui/non" description="Activer Limesurvey" hidden='True' exists='False'>
<value>non</value>
</variable>
<variable name="activer_moodle" type="oui/non" description="Activer Moodle" hidden='True' exists='False'>
<value>non</value>
</variable>
@ -135,6 +137,15 @@
<!-- WORDPRESS -->
<variable type="oui/non" name='ninegate_activate_widwordpress' description='Activer le widget Wordpress' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widwordpress_url' description='URL complète de votre Wordpress' mandatory='True' />
<variable type='string' name='ninegate_widwordpress_syncenvole' description='URL Posh-Profil pour synchronisation Wordpress' mandatory='True' />
<!-- EMAIL -->
<variable type='string' name='ninegate_noreply' description='Adresse mail utilisé pour le noreply' mandatory='True' />
<variable type='string' name='ninegate_smtphost' description='Host du serveur SMTP' />
@ -299,8 +310,9 @@
<condition name='hidden_if_in' source='ninegate_activate_portal'>
<param>non</param>
<target type='variable'>ninegate_activate_widmoodle</target>
<target type='variable'>ninegate_activate_widlimesurvey</target>
<target type='variable'>ninegate_activate_widmoodle</target>
<target type='variable'>ninegate_activate_widwordpress</target>
</condition>
<condition name='hidden_if_in' source='ninegate_activate_portal'>
@ -321,8 +333,9 @@
<condition name='hidden_if_in' source='ninegate_activate_syncenvole'>
<param>non</param>
<target type='variable'>ninegate_widmoodle_syncenvole</target>
<target type='variable'>ninegate_widlimesurvey_syncenvole</target>
<target type='variable'>ninegate_widmoodle_syncenvole</target>
<target type='variable'>ninegate_widwordpress_syncenvole</target>
</condition>
@ -415,6 +428,39 @@
<!-- AFFICHAGE EN FONCTION DU WIDGET WORDPRESS -->
<fill name='calc_multi_condition' target='ninegate_activate_widwordpress'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_wordpress</param>
<param name='match'>oui</param>
<param name='mismatch'>non</param>
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widwordpress'>
<param>non</param>
<target type='variable'>ninegate_widwordpress_url</target>
<target type='variable'>ninegate_widwordpress_syncenvole</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widwordpress_url'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_wordpress</param>
<param name='match'>/wordpress</param>
<param name='default_mismatch'>None</param>
</fill>
<fill name='calc_multi_condition' target='ninegate_widwordpress_syncenvole'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_wordpress</param>
<param name='match'>/posh-profil</param>
<param name='default_mismatch'>None</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU MODE DE BDD -->
<condition name='hidden_if_in' source='ninegate_db_mode'>
<param>local</param>

View File

@ -37,6 +37,7 @@ framework:
# https://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
name: ninegate
fragments: ~
http_method_override: true
templating:

View File

@ -42,18 +42,5 @@ security:
access_control:
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_USER] }
- { path: ^/config/home, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/niveau02, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/group, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/registration, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/user, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/icon, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/item, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/alert, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/page, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/calendar, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/notice, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/blog, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config/flux, roles: [ROLE_ADMIN, ROLE_MODO] }
- { path: ^/config, roles: [ROLE_ADMIN] }
- { path: ^/config, roles: [ROLE_ADMIN, ROLE_MODO] }

View File

@ -8,19 +8,21 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}cRMoKJrH0IA1SxjJjoTxm1QwdgncEh2g
', 'afornerot@cadoles.com', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}9d5GfmZGEHAUq0E4rrULoubrbYBrUL0F
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
TRUNCATE TABLE sidebar;
INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `fonticon`, `permission`, `appactivate`) VALUES
(1000, NULL, 1000, 'CONFIGURATION', '', 'fa-gear', 'ROLE_ADMIN', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN', ''),
(1000, NULL, 1000, 'CONFIGURATION', NULL, 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''),
(1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''),
(1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN', ''),
(1220, 1200, 1220, 'Niveau 01', 'cadoles_core_config_niveau01', 'fa-building', 'ROLE_ADMIN', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''),
(1220, 1200, 1220, 'Niveau 01', 'cadoles_core_config_niveau01', 'fa-building', 'ROLE_ADMIN,ROLE_MODO', ''),
(1230, 1200, 1230, 'Niveau 02', 'cadoles_core_config_niveau02', 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1240, 1200, 1240, 'Groupes', 'cadoles_core_config_group', 'fa-users', 'ROLE_ADMIN,ROLE_MODO', ''),
(1250, 1200, 1250, 'Inscriptions', 'cadoles_core_config_registration', 'fa-pencil-square-o', 'ROLE_ADMIN,ROLE_MODO', ''),
@ -47,11 +49,14 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(2580, 2500, 2580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(3000, NULL, 3000, 'SYNCHRONISATION', NULL, 'fa-exchange', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3001, 3000, 3001, 'Délégation', 'cadoles_portal_config_syncdelegation', 'fa-balance-scale', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3120, 3000, 3120, 'Limesurvey', 'cadoles_portal_config_synclimesurvey', 'fa-question', 'ROLE_ADMIN,ROLE_MODO', 'activate_widlimesurvey'),
(3130, 3000, 3130, 'Moodle', 'cadoles_portal_config_syncmoodle', 'fa-graduation-cap', 'ROLE_ADMIN,ROLE_MODO', 'activate_widmoodle'),
(3230, 3000, 3230, 'Wordpress', 'cadoles_portal_config_syncwordpress', 'fa-wordpress', 'ROLE_ADMIN,ROLE_MODO', 'activate_widwordpress'),
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN', 'cron_activate'),
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN', 'cron_activate'),
(7020, 7000, 7020, 'Logs', 'cadoles_cron_config_log', 'fa-list-alt', 'ROLE_ADMIN', 'cron_activate');
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
(7020, 7000, 7020, 'Logs', 'cadoles_cron_config_log', 'fa-list-alt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate');
@ -75,6 +80,30 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'),
('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy');
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port du Proxy');
INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_commun',0),
('cadoles_core_config_theme',0),
('cadoles_core_config_whitelist',0),
('cadoles_core_config_niveau01',0),
('cadoles_core_config_niveau02',1),
('cadoles_core_config_group',1),
('cadoles_core_config_registration',1),
('cadoles_core_config_user',1),
('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1),
('cadoles_portal_config_calendar',1),
('cadoles_portal_config_blog',1),
('cadoles_portal_config_flux',1),
('cadoles_portal_config_notice',1),
('cadoles_portal_config_icon',1),
('cadoles_portal_config_synclimesurvey',0),
('cadoles_portal_config_syncmoodle',0),
('cadoles_portal_config_syncwordpress',0),
('cadoles_cron_config',0),
('cadoles_cron_config_log',0);

View File

@ -0,0 +1,93 @@
<?php
namespace Cadoles\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity
* @ORM\Table(name="permmodo")
* @ORM\HasLifecycleCallbacks()
*
*/
class PermModo
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=50, unique=true)
*/
private $route;
/**
* @ORM\Column(name="visible", type="boolean")
*/
private $visible;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set route
*
* @param string $route
*
* @return PermModo
*/
public function setRoute($route)
{
$this->route = $route;
return $this;
}
/**
* Get route
*
* @return string
*/
public function getRoute()
{
return $this->route;
}
/**
* Set visible
*
* @param boolean $visible
*
* @return PermModo
*/
public function setVisible($visible)
{
$this->visible = $visible;
return $this;
}
/**
* Get visible
*
* @return boolean
*/
public function getVisible()
{
return $this->visible;
}
}

View File

@ -21,18 +21,26 @@
$this->token_storage = $token_storage;
}
public function haveRole($roles,$tohave) {
public function haveRole($roles,$tohave,$route) {
$haverole=false;
if($roles=="") {
if(empty($tohave)) return true;
if(empty($tohave)) $haverole=true;
}
else {
foreach($roles as $role) {
if(in_array($role,$tohave))
return true;
$haverole=true;
}
}
return false;
if($route!=null) {
if($haverole&&in_array("ROLE_MODO",$roles)) {
$permmodo=$this->em->getRepository("CadolesCoreBundle:PermModo")->findOneBy(["route"=>$route,"visible"=>true]);
if(!$permmodo) $haverole=false;
}
}
return $haverole;
}
public function onDomainParse(Event $event) {
@ -56,7 +64,7 @@
$curentuser=$token->getUser();
// Roles actif
if($curentuser=="anon.") $roles="";
if($curentuser=="anon.") $roles=[];
else $roles=$curentuser->getRoles();
// App activate
@ -73,7 +81,8 @@
$app["notice_activate"] =$this->container->getParameter('notice_activate');
$app["syncenvole_activate"] =$this->container->getParameter('syncenvole_activate');
$app["activate_widlimesurvey"] =$this->container->getParameter('activate_widlimesurvey');
$app["activate_widmoodle"] =$this->container->getParameter('activate_widmoodle');
$app["activate_widwordpress"] =$this->container->getParameter('activate_widwordpress');
// Masteridentity
$masteridentity =$this->container->getParameter('masteridentity');
@ -99,11 +108,42 @@
$moderegistration =$this->container->getParameter('moderegistration');
if($masteridentity!="SQL") $moderegistration="none";
if(in_array("ROLE_MODO",$roles)) {
$request = $event->getRequest();
$route = $request->attributes->get('_route');
if($route!="cadoles_core_config"&&stripos($route,"_config")!==false) {
error_log($route);
if(stripos($route,"cadoles_core_config_logo")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_core_config_header")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_portal_config_panelwidget")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_portal_config_pagewidget")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_portal_config_bookmark")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_portal_config_slide")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_core_config_file")!==false) $route="cadoles_portal_config_page";
if(stripos($route,"cadoles_portal_config_itemcategory")!==false) $route="cadoles_portal_config_item";
if(stripos($route,"cadoles_portal_config_alertcategory")!==false) $route="cadoles_portal_config_alert";
if(stripos($route,"cadoles_portal_config_calendarevent")!==false) $route="cadoles_portal_config_calendar";
if(stripos($route,"cadoles_cron_config")!==false) $route="cadoles_cron_config";
$tbroute=explode("_",$route);
$route =(isset($tbroute[0])?$tbroute[0]:"");
$route.=(isset($tbroute[1])?"_".$tbroute[1]:"");
$route.=(isset($tbroute[2])?"_".$tbroute[2]:"");
$route.=(isset($tbroute[3])?"_".$tbroute[3]:"");
error_log($route);
$permmodo = $this->em->getRepository("CadolesCoreBundle:PermModo")->findOneBy(['route'=> $route, "visible"=>true]);
if(!$permmodo) die('Permission denied');
}
}
$sidebar=array();
$nvs1 = $this->em->getRepository("CadolesCoreBundle:Sidebar")->findBy(array('parent'=> NULL), array('roworder' => 'ASC'));
foreach($nvs1 as $nv1) {
if($this->haveRole($roles,$nv1->getPermission())) {
if($this->haveRole($roles,$nv1->getPermission(),$nv1->getPath())) {
$sidebar[$nv1->getRoworder()] = array(
"fonticon" => $nv1->getFonticon(),
"label" => $nv1->getLabel(),
@ -133,7 +173,8 @@
}
foreach($nv1->getChilds() as $nv2) {
if($this->haveRole($roles,$nv2->getPermission())) {
if($this->haveRole($roles,$nv2->getPermission(),$nv2->getPath())) {
$sidebar[$nv1->getRoworder()]["childs"][$nv2->getRoworder()] = array (
"fonticon" => $nv2->getFonticon(),
"label" => $nv2->getLabel(),
@ -168,7 +209,7 @@
}
foreach($nv2->getChilds() as $nv3) {
if($this->haveRole($roles,$nv3->getPermission())) {
if($this->haveRole($roles,$nv3->getPermission(),$nv3->getPath())) {
$sidebar[$nv1->getRoworder()]["childs"][$nv2->getRoworder()]["childs"][$nv3->getRoworder()] = array (
"fonticon" => $nv3->getFonticon(),
"label" => $nv3->getLabel(),
@ -200,7 +241,10 @@
}
}
}
}
if(is_null($sidebar[$nv1->getRoworder()]["path"])&&!isset($sidebar[$nv1->getRoworder()]["childs"]))
unset($sidebar[$nv1->getRoworder()]);
}
}
$session->set('sidebar', $sidebar);

View File

@ -15,11 +15,12 @@ class uploadListener
* @var ObjectManager
*/
private $om;
private $session;
public function __construct(ObjectManager $om, TokenStorageInterface $token_storage)
public function __construct(ObjectManager $om, TokenStorageInterface $token_storage, Session $session)
{
$this->om = $om;
$this->token_storage = $token_storage;
$this->session = $session;
}
protected function getHeight($image) {
@ -87,8 +88,7 @@ class uploadListener
case "avatar":
$file=$event->getFile();
$filename=$file->getFilename();
$session = new Session();
$session->set('uploadavatar', $filename);
$this->session->set('uploadavatar', $filename);
break;
case "file":
$file=$event->getFile();

View File

@ -3,6 +3,8 @@ cadoles_core_home:
path: /
defaults: { _controller: CadolesCoreBundle:Core:home }
#== Theme ================================================================================================================
cadoles_core_theme_setconfig:
@ -16,6 +18,7 @@ cadoles_core_config_theme:
cadoles_core_config_theme_selec:
path: /config/theme/select/{name}
defaults: { _controller: CadolesCoreBundle:Theme:select, name:"" }
#== Security Auth ========================================================================================================
cadoles_core_login:
@ -146,6 +149,10 @@ cadoles_core_config_header:
path: /config/commun/header
defaults: { _controller: CadolesCoreBundle:Config:header }
cadoles_core_config_permmodo:
path: /config/commun/permmodo
defaults: { _controller: CadolesCoreBundle:Config:permmodo }
#== Registration =========================================================================================================
#-- Access config
cadoles_core_config_registration:

View File

@ -7,7 +7,7 @@ services:
cadoles.core.upload.listener:
class: Cadoles\CoreBundle\EventListener\uploadListener
arguments: ["@doctrine.orm.entity_manager","@security.token_storage"]
arguments: ["@doctrine.orm.entity_manager","@security.token_storage","@session"]
tags:
- { name: kernel.event_listener, event: oneup_uploader.post_persist, method: onUpload }

View File

@ -39,255 +39,4 @@ class FeedController extends Controller
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
public function userAction($login,$nb)
{
$session = new Session();
$illustrations=$this->getIllustrations($login,$nb);
$webzines=$this->getWebzines($login,$nb);
$feeds=array_merge($illustrations,$webzines);
$indice=array();
foreach ($feeds as $key => $rowd) {
$indice[$key] = $rowd["feed_timestamp"];
}
array_multisort($indice, SORT_DESC, $feeds);
$feeds = array_slice($feeds, 0, $nb);
$response = new Response($this->renderView('MyAppWebzineBundle:Feed:home.xml.twig',array(
"feeds" => $feeds,
)));
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
public function illustrationAction($nb)
{
$session = new Session();
$illustrations=$this->getIllustrations("all",$nb);
$feeds=$illustrations;
$response = new Response($this->renderView('MyAppWebzineBundle:Feed:home.xml.twig',array(
"feeds" => $feeds,
)));
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
public function webzineAction($nb)
{
$session = new Session();
$webzines=$this->getWebzines("all",$nb);
$feeds=$webzines;
$response = new Response($this->renderView('MyAppWebzineBundle:Feed:home.xml.twig',array(
"feeds" => $feeds,
)));
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
public function albumAction($nb)
{
$session = new Session();
$albums=$this->getAlbums("all",$nb);
$feeds=$albums;
$response = new Response($this->renderView('MyAppWebzineBundle:Feed:home.xml.twig',array(
"feeds" => $feeds,
)));
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
public function kadavreskyAction($nb)
{
$session = new Session();
$kadavreskys=$this->getKadavreskys("all",$nb);
$feeds=$kadavreskys;
$response = new Response($this->renderView('MyAppWebzineBundle:Feed:home.xml.twig',array(
"feeds" => $feeds,
)));
$response->headers->set('Content-Type', 'application/xml; charset=utf-8');
return $response;
}
protected function getIllustrations($login,$nbmax)
{
$em = $this->getDoctrine()->getManager();
if($login=="all") {
$datas = $em->createQueryBuilder()
->select('feed','user')
->from("MyAppWebzineBundle:Illustration", 'feed')
->from("MyAppConfigBundle:User", 'user')
->where("feed.user=user.id")
->orderBY('feed.id','DESC')
->setMaxResults($nbmax)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
}
else {
$datas = $em->createQueryBuilder()
->select('feed','user')
->from("MyAppWebzineBundle:Illustration", 'feed')
->from("MyAppConfigBundle:User", 'user')
->where("feed.user=user.id")
->andWhere("user.username=:login")
->orderBY('feed.id','DESC')
->setMaxResults($nbmax)
->setParameter("login", $login)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
}
foreach($datas as $key=>$feed)
{
$datas[$key]["feed_type"]="illustration";
$datas[$key]["feed_url"]=$datas[$key]["feed_illustration"];
$datas[$key]["feed_timestamp"]=$datas[$key]["feed_submittime"]->getTimestamp();
}
return $datas;
}
protected function getWebzines($login,$nbmax)
{
$em = $this->getDoctrine()->getManager();
if($login=="all") {
$datas = $em->createQueryBuilder()
->select('feed','user')
->from("MyAppWebzineBundle:Webzine", 'feed')
->from("MyAppConfigBundle:User", 'user')
->where("feed.user=user.id")
->orderBY('feed.updatetime','DESC')
->setMaxResults($nbmax)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
}
else {
$datas = $em->createQueryBuilder()
->select('feed','user')
->from("MyAppWebzineBundle:Webzine", 'feed')
->from("MyAppConfigBundle:User", 'user')
->where("feed.user=user.id")
->andWhere("user.username=:login")
->orderBY('feed.updatetime','DESC')
->setMaxResults($nbmax)
->setParameter("login", $login)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
}
foreach($datas as $key=>$feed)
{
$datas[$key]["feed_type"]="webzine";
$datas[$key]["feed_submittime"]=$datas[$key]["feed_updatetime"];
$pages=$this->getPage($feed["feed_id"],$feed["feed_updatetime"]);
$datas[$key]["feed_url"]=$pages[0]["page_page"];
$datas[$key]["feed_id2"]=$pages[0]["page_id"];
$datas[$key]["feed_timestamp"]=$datas[$key]["feed_submittime"]->getTimestamp();
}
return $datas;
}
protected function getPage($idwebzine,$updatetime)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->createQueryBuilder()
->select('page')
->from("MyAppWebzineBundle:Page", 'page')
->where("page.webzine=:idwebzine")
->andWhere("page.submittime=:submittime")
->orderBY('page.roworder','ASC')
->setMaxResults(1)
->setParameter("idwebzine", $idwebzine)
->setParameter("submittime", $updatetime)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
//->getResult();
return $datas;
}
protected function getAlbums($login,$nbmax)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->createQueryBuilder()
->select('feed','user')
->from("MyAppWebzineBundle:Album", 'feed')
->from("MyAppConfigBundle:User", 'user')
->where("feed.user=user.id")
->orderBY('feed.updatetime','DESC')
->setMaxResults($nbmax)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
//->getResult();
foreach($datas as $key=>$feed)
{
$datas[$key]["feed_type"]="album";
$datas[$key]["feed_submittime"]=$datas[$key]["feed_updatetime"];
$photos=$this->getPhoto($feed["feed_id"],$feed["feed_updatetime"]);
$datas[$key]["feed_url"]=$photos[0]["photo_photo"];
$datas[$key]["feed_id2"]=$photos[0]["photo_id"];
$datas[$key]["feed_timestamp"]=$datas[$key]["feed_submittime"]->getTimestamp();
}
return $datas;
}
protected function getPhoto($idalbum,$updatetime)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->createQueryBuilder()
->select('photo')
->from("MyAppWebzineBundle:Photo", 'photo')
->where("photo.album=:idalbum")
->andWhere("photo.submittime=:submittime")
->orderBY('photo.roworder','ASC')
->setMaxResults(1)
->setParameter("idalbum", $idalbum)
->setParameter("submittime", $updatetime)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
//->getResult();
return $datas;
}
protected function getKadavreskys($login,$nbmax)
{
$em = $this->getDoctrine()->getManager();
$datas = $em->createQueryBuilder()
->select('feed')
->from("MyAppWebzineBundle:Kadavresky", 'feed')
->orderBY('feed.submittime','DESC')
->setMaxResults($nbmax)
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR);
//->getResult();
foreach($datas as $key=>$feed)
{
$datas[$key]["feed_type"]="kadavresky";
$datas[$key]["feed_url"]=$datas[$key]["feed_kadavresky"];
$datas[$key]["feed_timestamp"]=$datas[$key]["feed_submittime"]->getTimestamp();
}
return $datas;
}
}

View File

@ -11,6 +11,20 @@ use Symfony\Component\Form\FormError;
class SyncenvoleController extends Controller
{
public function delegationAction()
{
$url="/posh-profil";
$color=$this->get('session')->get('colormain');
$themename=$this->get('session')->get("theme");
return $this->render('CadolesPortalBundle:Tool:frame.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'url' => $url."/admin-delegation.php?color=#color#"
]);
}
public function limesurveyAction()
{
$url=$this->getParameter("widlimesurvey_syncenvole");
@ -25,4 +39,32 @@ class SyncenvoleController extends Controller
]);
}
public function moodleAction()
{
$url=$this->getParameter("widmoodle_syncenvole");
$color=$this->get('session')->get('colormain');
$themename=$this->get('session')->get("theme");
return $this->render('CadolesPortalBundle:Tool:frame.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'url' => $url."/synchro.php?app=moodle&color=#color#"
]);
}
public function wordpressAction()
{
$url=$this->getParameter("widwordpress_syncenvole");
$color=$this->get('session')->get('colormain');
$themename=$this->get('session')->get("theme");
return $this->render('CadolesPortalBundle:Tool:frame.html.twig', [
'useheader' => true,
'usemenu' => false,
'usesidebar' => true,
'url' => $url."/synchro.php?app=wordpress&color=#color#"
]);
}
}

View File

@ -1,10 +1,23 @@
#== SYNCENVOLE ============================================================================================================
cadoles_portal_config_syncdelegation:
path: /config/syncenvole/delegation
defaults: { _controller: CadolesPortalBundle:Syncenvole:delegation }
cadoles_portal_config_synclimesurvey:
path: /config/syncenvole/limesurvey
defaults: { _controller: CadolesPortalBundle:Syncenvole:limesurvey }
cadoles_portal_config_syncmoodle:
path: /config/syncenvole/moodle
defaults: { _controller: CadolesPortalBundle:Syncenvole:moodle }
cadoles_portal_config_syncwordpress:
path: /config/syncenvole/wordpress
defaults: { _controller: CadolesPortalBundle:Syncenvole:wordpress }
#== ICON =================================================================================================================================================
cadoles_portal_config_icon:
path: /config/icon

View File

@ -43,7 +43,11 @@
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
<a onClick="showFrameitem('blog','{{ path('cadoles_portal_'~access~'_blog_view') }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% if access=="config" %}
<a href='{{ path('cadoles_portal_config_blog') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% else %}
<a onClick="showFrameitem('blog','{{ path('cadoles_portal_user_blog_view') }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">

View File

@ -23,7 +23,11 @@
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a href='{{ path('cadoles_portal_config_calendar') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-paper-plane fa-fw"></i></a>
{% else %}
<a onClick="showFrameitem('calendar','{{ path('cadoles_portal_'~access~'_calendar_view') }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-calendar fa-fw"></i></a>
{% endif %}
</div>
<div class="widgetheader" style="{{ stylewidgetheader }}">

View File

@ -32,7 +32,7 @@
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if canadd %}
{% if canadd and access!="config"%}
<i class="fa fa-plus fa-fw" onClick="addBookmark({{ entity.id }},true)" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>

View File

@ -24,12 +24,14 @@ INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastna
TRUNCATE TABLE sidebar;
INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `fonticon`, `permission`, `appactivate`) VALUES
(1000, NULL, 1000, 'CONFIGURATION', '', 'fa-gear', 'ROLE_ADMIN', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN', ''),
(1000, NULL, 1000, 'CONFIGURATION', NULL, 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''),
(1010, 1000, 1010, 'Générale', 'cadoles_core_config_commun', 'fa-table', 'ROLE_ADMIN,ROLE_MODO', ''),
(1020, 1000, 1020, 'Thème', 'cadoles_core_config_theme', 'fa-paint-brush', 'ROLE_ADMIN,ROLE_MODO', ''),
(1030, 1000, 1030, 'Modération', 'cadoles_core_config_permmodo', 'fa-balance-scale', 'ROLE_ADMIN', ''),
(1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN', ''),
(1220, 1200, 1220, 'Niveau 01', 'cadoles_core_config_niveau01', 'fa-building', 'ROLE_ADMIN', ''),
(1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''),
(1220, 1200, 1220, 'Niveau 01', 'cadoles_core_config_niveau01', 'fa-building', 'ROLE_ADMIN,ROLE_MODO', ''),
%if %%getVar("ninegate_niveau02view", 'non') == "oui"
(1230, 1200, 1230, 'Niveau 02', 'cadoles_core_config_niveau02', 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''),
%end if
@ -58,11 +60,14 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f
(2580, 2500, 2580, 'Icônes', 'cadoles_portal_config_icon', 'fa-bug', 'ROLE_ADMIN,ROLE_MODO', 'module_activate'),
(3000, NULL, 3000, 'SYNCHRONISATION', NULL, 'fa-exchange', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3001, 3000, 3001, 'Délégation', 'cadoles_portal_config_syncdelegation', 'fa-balance-scale', 'ROLE_ADMIN,ROLE_MODO', 'syncenvole_activate'),
(3120, 3000, 3120, 'Limesurvey', 'cadoles_portal_config_synclimesurvey', 'fa-question', 'ROLE_ADMIN,ROLE_MODO', 'activate_widlimesurvey'),
(3130, 3000, 3130, 'Moodle', 'cadoles_portal_config_syncmoodle', 'fa-graduation-cap', 'ROLE_ADMIN,ROLE_MODO', 'activate_widmoodle'),
(3230, 3000, 3230, 'Wordpress', 'cadoles_portal_config_syncwordpress', 'fa-wordpress', 'ROLE_ADMIN,ROLE_MODO', 'activate_widwordpress'),
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN', 'cron_activate'),
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN', 'cron_activate'),
(7020, 7000, 7020, 'Logs', 'cadoles_cron_config_log', 'fa-list-alt', 'ROLE_ADMIN', 'cron_activate');
(7000, NULL, 7000, 'CRON', NULL, 'fa-bolt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
(7010, 7000, 7010, 'Jobs', 'cadoles_cron_config', 'fa-bullseye', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate'),
(7020, 7000, 7020, 'Logs', 'cadoles_cron_config_log', 'fa-list-alt', 'ROLE_ADMIN,ROLE_MODO', 'cron_activate');
@ -94,4 +99,28 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy');
%end if
%end if
INSERT IGNORE permmodo (`route`, `visible`) VALUES
('cadoles_core_config_commun',0),
('cadoles_core_config_theme',0),
('cadoles_core_config_whitelist',0),
('cadoles_core_config_niveau01',0),
('cadoles_core_config_niveau02',1),
('cadoles_core_config_group',1),
('cadoles_core_config_registration',1),
('cadoles_core_config_user',1),
('cadoles_portal_config_page',1),
('cadoles_portal_config_item',1),
('cadoles_portal_config_alert',1),
('cadoles_portal_config_calendar',1),
('cadoles_portal_config_blog',1),
('cadoles_portal_config_flux',1),
('cadoles_portal_config_notice',1),
('cadoles_portal_config_icon',1),
('cadoles_portal_config_synclimesurvey',0),
('cadoles_portal_config_syncmoodle',0),
('cadoles_portal_config_syncwordpress',0),
('cadoles_cron_config',0),
('cadoles_cron_config_log',0);

View File

@ -165,14 +165,6 @@ parameters:
ldap_usersadmin: [admin,prof.6a]
# Activation Widget
%if %%getVar("ninegate_activate_widmoodle", 'non') == "oui"
activate_widmoodle: true
widmoodle_url: %%ninegate_widmoodle_url
widmoodle_apikey: %%ninegate_widmoodle_apikey
%else
activate_widmoodle: false
%end if
%if %%getVar("ninegate_activate_widlimesurvey", 'non') == "oui"
activate_widlimesurvey: true
widlimesurvey_url: %%ninegate_widlimesurvey_url
@ -183,6 +175,23 @@ parameters:
activate_widlimesurvey: false
%end if
%if %%getVar("ninegate_activate_widmoodle", 'non') == "oui"
activate_widmoodle: true
widmoodle_url: %%ninegate_widmoodle_url
widmoodle_apikey: %%ninegate_widmoodle_apikey
widmoodle_syncenvole: %%ninegate_widmoodle_syncenvole
%else
activate_widmoodle: false
%end if
%if %%getVar("ninegate_activate_widwordpress", 'non') == "oui"
activate_widwordpress: true
widwordpress_url: %%ninegate_widwordpress_url
widwordpress_syncenvole: %%ninegate_widwordpress_syncenvole
%else
activate_widwordpress: false
%end if
# Synchrinisation eportail
%if %%getVar("ninegate_synceportail", 'non') == "oui"
eportail_sync: true