This commit is contained in:
afornerot 2019-06-06 16:37:34 +02:00
parent 782c8bf88e
commit 80c2207a07
20 changed files with 1221 additions and 401 deletions

View File

@ -27,6 +27,8 @@
<variable name="activer_moodle" type="oui/non" description="Activer Moodle" hidden='True' exists='False'> <variable name="activer_moodle" type="oui/non" description="Activer Moodle" hidden='True' exists='False'>
<value>non</value> <value>non</value>
</variable> </variable>
<variable name='moodle_apikey' type='string' description="API Key pour accéder au webservice Moodle" hidden='True' exists='False' />
<variable name="activer_wordpress" type="oui/non" description="Activer Wordpress" hidden='True' exists='False'> <variable name="activer_wordpress" type="oui/non" description="Activer Wordpress" hidden='True' exists='False'>
<value>non</value> <value>non</value>
</variable> </variable>

View File

@ -384,6 +384,69 @@ class SynchroCommand extends Command
if(!$simulate) $ldap->addGroupUser($data); if(!$simulate) $ldap->addGroupUser($data);
} }
$this->writeln('');
$this->writeln('== USER NIVEAU01 =======================================');
$baseniveau01 = $this->container->getParameter('ldap_baseniveau01');
$datas = $this->em
->createQueryBuilder()
->select('table')
->from('CadolesCoreBundle:Niveau01','table')
->getQuery()
->getResult();
foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau01;
$results = $ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes
if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau01DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername());
}
if(!$simulate) $ldap->ldapModify($dn, $attrs);
}
}
$this->writeln('');
$this->writeln('== USER NIVEAU02 =======================================');
$baseniveau02 = $this->container->getParameter('ldap_baseniveau02');
$datas = $this->em
->createQueryBuilder()
->select('table')
->from('CadolesCoreBundle:Niveau02','table')
->getQuery()
->getResult();
foreach($datas as $data) {
$criteria = '(cn='.$data->getLabel().')';
$subbranch=$baseniveau02;
$results = $ldap->search($criteria, array('cn'), $subbranch);
// Mise à jour des membres du groupes
if(count($results) > 0) {
$this->writeln(' - '.$data->getLabel());
$dn=$ldap->getNiveau02DN($data->getLabel());
$attrs["memberuid"]=array();
$attrs["cadolesMember"]=array();
foreach($data->getUsers() as $userniveau01) {
array_push($attrs["memberuid"],$userniveau01->getUsername());
array_push($attrs["cadolesMember"],$ldap->getUserDN($userniveau01));
$this->writeln(' > '.$userniveau01->getUsername());
}
if(!$simulate) $ldap->ldapModify($dn, $attrs);
}
}
$this->writeln(''); $this->writeln('');
$this->writeln('== USER GROUP ======================================='); $this->writeln('== USER GROUP =======================================');
$baseGroup = $this->container->getParameter('ldap_basegroup'); $baseGroup = $this->container->getParameter('ldap_basegroup');

View File

@ -8,8 +8,8 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
(-100, 'DRAAF', '130007107'); (-100, 'DRAAF', '130007107');
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}7o+kc3a8dmiDmMuVU1ti+CXx30Pt9fWd (-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}m0Uhk7yyXr8ha3c/7sugfU5RJVTQ1nYp
', 'admin@transnum.cadol.es', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
@ -72,6 +72,6 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'), ('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'), ('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'), ('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'), ('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy'); ('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port du Proxy');

View File

@ -397,6 +397,7 @@ a.item-heart {
.grid .grid-preview { .grid .grid-preview {
width:19.2%; width:19.2%;
min-width:220px;
height:auto; height:auto;
margin-bottom: 10px; margin-bottom: 10px;
text-align: left; text-align: left;
@ -408,8 +409,9 @@ a.item-heart {
.grid .grid-preview .grid-preview-title { .grid .grid-preview .grid-preview-title {
margin:0px; margin:0px;
font-size:25px; font-size:20px;
text-align:left; text-align:left;
word-wrap: break-word;
} }
.grid .grid-preview .caption { padding: 9px } .grid .grid-preview .caption { padding: 9px }
@ -527,23 +529,10 @@ a.item-heart {
padding: 8px; padding: 8px;
margin-top: 10px; margin-top: 10px;
margin-right: 5px; margin-right: 5px;
margin-bottom: 10px;
cursor:pointer; cursor:pointer;
} }
.feed{
height:200px;
padding: 10px;
overflow: hidden;
}
.feed h1 {
margin:0px;
font-size: 20px;
color: #fff;
background-color: rgba(0, 0, 0, 0.6);
padding:10px;
}
.feed .description { .feed .description {
width: 70%; width: 70%;
float: right; float: right;

View File

@ -59,6 +59,12 @@ class InitDataCommand extends ContainerAwareCommand
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
} }
// afin de forcer les ID sur certaines entités
$metadata = $this->entityManager->getClassMetaData(get_class($entity));
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
// Job synchronisation des comptes utilisateur // Job synchronisation des comptes utilisateur
// Toute les 24h à 3h00 // Toute les 24h à 3h00
$entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(100); $entity = $this->entityManager->getRepository('CadolesCronBundle:Cron')->find(100);
@ -130,7 +136,7 @@ class InitDataCommand extends ContainerAwareCommand
$entity->setNextexecdate($entity->getSubmitdate()); $entity->setNextexecdate($entity->getSubmitdate());
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
} }
elseif($entity) { elseif($entity&&!($portal_activate||$calendar_activate)) {
$this->entityManager->remove($entity); $this->entityManager->remove($entity);
} }
@ -152,14 +158,10 @@ class InitDataCommand extends ContainerAwareCommand
$entity->setNextexecdate($nextdate); $entity->setNextexecdate($nextdate);
$this->entityManager->persist($entity); $this->entityManager->persist($entity);
} }
elseif($entity) { elseif($entity&&!$activate_widlimesurvey) {
$this->entityManager->remove($entity); $this->entityManager->remove($entity);
} }
// afin de forcer les ID sur certaines entités
$metadata = $this->entityManager->getClassMetaData(get_class($entity));
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$this->entityManager->flush(); $this->entityManager->flush();
} }

View File

@ -354,7 +354,7 @@ class GetLimesurveyCommand extends Command
$this->em = $this->container->get('doctrine')->getEntityManager(); $this->em = $this->container->get('doctrine')->getEntityManager();
$this->output = $output; $this->output = $output;
$this->filesystem = new Filesystem(); $this->filesystem = new Filesystem();
$this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; $this->rootfile = $this->container->get('kernel')->getRootDir()."/../uploads/limesurvey";
$alias = $this->container->getParameter('alias'); $alias = $this->container->getParameter('alias');
$activate_widlimesurvey = $this->container->getParameter('activate_widlimesurvey'); $activate_widlimesurvey = $this->container->getParameter('activate_widlimesurvey');
@ -388,7 +388,13 @@ class GetLimesurveyCommand extends Command
// Connection Limesurvey // Connection Limesurvey
$sessionKey= $myJSONRPCClient->get_session_key( $widlimesurvey_apiuser, $widlimesurvey_apikey ); $sessionKey= $myJSONRPCClient->get_session_key( $widlimesurvey_apiuser, $widlimesurvey_apikey );
// list de l'ensemble des sondages // Filesystem
$fs = new Filesystem();
// On supprime les potentiels yml.new restant
$fs->remove($this->rootfile.'-new');
// list de l'ensemble des sondages invité
$surveys= $myJSONRPCClient->list_surveys($sessionKey); $surveys= $myJSONRPCClient->list_surveys($sessionKey);
foreach($surveys as $survey) { foreach($surveys as $survey) {
// Si le sondage est actif // Si le sondage est actif
@ -401,32 +407,78 @@ class GetLimesurveyCommand extends Command
foreach($users as $user) { foreach($users as $user) {
if(isset($user["participant_info"]["email"]) && $user["participant_info"]["email"]!="") { if(isset($user["participant_info"]["email"]) && $user["participant_info"]["email"]!="") {
$q = "SELECT * FROM ".$config["dbprefixe"]."user WHERE user_email=?"; $entity = $this->em->getRepository('CadolesCoreBundle:User')->findOneBy(["email"=>$user["participant_info"]["email"]]);
$query=$bdd01->prepare($q); if($entity) {
if(isset($user["participant_info"]["email"])) { $surveypropconf = $myJSONRPCClient->get_survey_properties($sessionKey,$survey["sid"],["datecreated"]);
$query->execute(array($user["participant_info"]["email"])); $surveyproplang = $myJSONRPCClient->get_language_properties($sessionKey,$survey["sid"],["surveyls_welcometext"]);
if($row=$query->fetch()){ $surveydescription = $surveyproplang["surveyls_welcometext"];
/* $surveydescription=str_replace("\r","",str_replace("\n","",$surveydescription));
$myfile = fopen($config['localdirectory']."/local/limesurvey/".$row["user_id"].".html", "a");
$token=$user["token"]; $token=$user["token"];
$url=$widlimesurvey_url."/".$survey_id; $url=$widlimesurvey_url."/".$survey_id;
if($token!="") if($token!="")
$url.="?token=".$token; $url.="?token=".$token;
fwrite($myfile,"<a href='".$url."' target='blank'>".$survey["surveyls_title"]."</a><br>"); $string ='"'.$survey["sid"].'": {';
fclose($myfile); $string.='"title": "'.$survey["surveyls_title"].'",';
*/ $string.='"url": "'.$url.'",';
} $string.='"date": "'.$surveypropconf["datecreated"].'",';
$string.='"description": "'.$surveydescription.'"';
$string.='},';
$this->filesystem->appendToFile($this->rootfile.'-new/'.$entity->getId().'/invitation.json', $string."\n");
} }
} }
} }
} }
} }
// Pour chaque user on remonte les sondages dont ils sont propriétaires
$userlimesurveys=$myJSONRPCClient->list_users($sessionKey);
foreach($userlimesurveys as $userlimesurvey) {
$user = $this->em->getRepository('CadolesCoreBundle:User')->findOneBy(["username"=>$userlimesurvey["users_name"]]);
if($user) {
$surveys = $myJSONRPCClient->list_surveys($sessionKey, $user->getUserName());
foreach($surveys as $survey) {
if(is_array($survey)) {
if($survey["active"]=="Y") {
$surveypropconf = $myJSONRPCClient->get_survey_properties($sessionKey,$survey["sid"],["datecreated"]);
$surveyproplang = $myJSONRPCClient->get_language_properties($sessionKey,$survey["sid"],["surveyls_welcometext"]);
$surveydescription = $surveyproplang["surveyls_welcometext"];
$surveydescription=str_replace("\r","",str_replace("\n","",$surveydescription));
$url=$widlimesurvey_url."/admin/survey/sa/view/surveyid/".$survey["sid"];
$string ='"'.$survey["sid"].'": {';
$string.='"title": "'.$survey["surveyls_title"].'",';
$string.='"url": "'.$url.'",';
$string.='"date": "'.$surveypropconf["datecreated"].'",';
$string.='"description": "'.$surveydescription.'"';
$string.='},';
$this->filesystem->appendToFile($this->rootfile.'-new/'.$user->getId().'/survey.json', $string."\n");
}
}
}
}
}
// On supprime les encours pour le remplacer le new
$fs->remove($this->rootfile);
$fs->rename($this->rootfile.'-new',$this->rootfile);
// release the session key // release the session key
$myJSONRPCClient->release_session_key( $sessionKey ); $myJSONRPCClient->release_session_key( $sessionKey );
// essai
/*
$essai=file_get_contents($this->rootfile.'/-100/survey.json');
$json = substr($essai, 0, -2); // sup dernier ,
$decodedArray = json_decode("{".$json."}", true);
dump($decodedArray);
*/
$this->writeln(''); $this->writeln('');
return 1; return 1;
} }

View File

@ -15,6 +15,8 @@ use Doctrine\ORM\Id\AssignedGenerator;
use Cadoles\PortalBundle\Entity\Icon; use Cadoles\PortalBundle\Entity\Icon;
use Cadoles\PortalBundle\Entity\Pagecategory; use Cadoles\PortalBundle\Entity\Pagecategory;
use Cadoles\PortalBundle\Entity\Widget; use Cadoles\PortalBundle\Entity\Widget;
use Cadoles\PortalBundle\Entity\Appexternal;
use Cadoles\PortalBundle\Entity\Flux;
class InitDataCommand extends ContainerAwareCommand class InitDataCommand extends ContainerAwareCommand
{ {
@ -30,10 +32,37 @@ class InitDataCommand extends ContainerAwareCommand
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$em = $this->getContainer()->get('doctrine')->getEntityManager(); $em = $this->getContainer()->get('doctrine')->getEntityManager();
$alias =$this->getContainer()->getParameter('alias');
$activate_widlimesurvey =$this->getContainer()->getParameter('activate_widlimesurvey');
$output->writeln('PORTAL = Default Data'); $output->writeln('PORTAL = Default Data');
// afin de forcer les ID sur certaines entités
$metadata = $em->getClassMetaData('CadolesPortalBundle:Flux');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData('CadolesPortalBundle:Pagecategory');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData('CadolesPortalBundle:Widget');
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
// Création appexternal
$entity = $em->getRepository('CadolesPortalBundle:Appexternal')->findoneby(["name"=>"Limesurvey"]);
if(!$entity&&$activate_widlimesurvey) {
$entity=new Appexternal;
$entity->setName("Limesurvey");
$em->persist($entity);
$em->flush();
}
elseif($entity&&!$activate_widlimesurvey) {
$em->remove($entity);
$em->flush();
}
// Creation des icons // Creation des icons
$output->writeln(' > Creation Icons'); $output->writeln(' > Creation Icons');
$finder = new Finder(); $finder = new Finder();
@ -50,6 +79,27 @@ class InitDataCommand extends ContainerAwareCommand
} }
$em->flush(); $em->flush();
// Création des Flux
$entityFlux = $em->getRepository('CadolesPortalBundle:Flux')->find(-2000);
if(!$entityFlux&&($activate_widlimesurvey)) {
$entityFlux = new Flux();
$entityFlux->setRowOrder(0);
$entityFlux->setColor("328637");
}
elseif($entityFlux&&!($activate_widlimesurvey)) {
$em->remove($entityFlux);
$em->flush();
$entityWidget=null;
}
if($entityFlux) {
$entityFlux->setId(-2000);
$entityFlux->setTitle("Limesurvey");
$entityFlux->setUrl("/".$alias."/feed/limesurvey/##userid##");
$entityFlux->setMaxread(0);
$em->persist($entityFlux);
$em->flush();
}
// Creation des pagecategory // Creation des pagecategory
$output->writeln(' > Creation Pagecategory'); $output->writeln(' > Creation Pagecategory');
$entityPagecategory = $em->getRepository('CadolesPortalBundle:Pagecategory')->find(-100); $entityPagecategory = $em->getRepository('CadolesPortalBundle:Pagecategory')->find(-100);
@ -90,13 +140,13 @@ class InitDataCommand extends ContainerAwareCommand
$em->persist($entityPagecategory); $em->persist($entityPagecategory);
} }
// Widget URL // Widget URL
$output->writeln(' > Creation Widget'); $output->writeln(' > Creation Widget');
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-2000); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-2000);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_ribbon.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_ribbon.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-2000); $entityWidget->setId(-2000);
$entityWidget->setRoworder(1); $entityWidget->setRoworder(1);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -106,19 +156,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL", "value": "", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Bureau // Widget Bureau
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1990); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1990);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_computer.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_computer.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1990); $entityWidget->setId(-1990);
$entityWidget->setRoworder(2); $entityWidget->setRoworder(2);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -128,19 +174,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "withbookmark", "loc": "col1", "type": "withbookmark", "label": "Avec Favoris", "value": "0", "mandatory": "true"},{"id": "itemcategory", "loc": "col1", "type": "itemcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Annonce // Widget Annonce
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1980); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1980);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_megaphone.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1980); $entityWidget->setId(-1980);
$entityWidget->setRoworder(3); $entityWidget->setRoworder(3);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -150,19 +192,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "alertcategory", "loc": "col1", "type": "alertcategory", "label": "Catégorie Affichée", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Flux // Widget Flux
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1970); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1970);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1970); $entityWidget->setId(-1970);
$entityWidget->setRoworder(4); $entityWidget->setRoworder(4);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -172,19 +210,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Favoris // Widget Favoris
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1960); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1960);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_star.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_star.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1960); $entityWidget->setId(-1960);
$entityWidget->setRoworder(5); $entityWidget->setRoworder(5);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -194,19 +228,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Liens // Widget Liens
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1950); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1950);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_bolt.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_bolt.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1950); $entityWidget->setId(-1950);
$entityWidget->setRoworder(6); $entityWidget->setRoworder(6);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -216,19 +246,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("200"); $entityWidget->setHeight("200");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"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"}]}'); $parameter = json_decode('{"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); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Editor // Widget Editor
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1940); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1940);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1940); $entityWidget->setId(-1940);
$entityWidget->setRoworder(7); $entityWidget->setRoworder(7);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -238,19 +264,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "html", "loc": "col5", "type": "ckeditor", "label": "Texte", "value": "", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "html", "loc": "col5", "type": "ckeditor", "label": "Texte", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Carrousel // Widget Carrousel
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1930); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1930);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_easel.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_easel.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1930); $entityWidget->setId(-1930);
$entityWidget->setRoworder(8); $entityWidget->setRoworder(8);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -260,19 +282,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("400"); $entityWidget->setHeight("400");
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$parameter = json_decode('{"fields": [{"id": "interval", "loc": "col1", "type": "integer", "label": "Interval en seconde entre 2 images", "value": "5", "mandatory": "false"}]}'); $parameter = json_decode('{"fields": [{"id": "interval", "loc": "col1", "type": "integer", "label": "Interval en seconde entre 2 images", "value": "5", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget File // Widget File
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1920); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1920);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_folder.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_folder.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1920); $entityWidget->setId(-1920);
$entityWidget->setRoworder(9); $entityWidget->setRoworder(9);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -282,19 +300,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Galery // Widget Galery
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1910); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1910);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_image.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_image.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1910); $entityWidget->setId(-1910);
$entityWidget->setRoworder(10); $entityWidget->setRoworder(10);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -304,19 +318,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Calendrier // Widget Calendrier
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1900); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1900);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calendar.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calendar.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1900); $entityWidget->setId(-1900);
$entityWidget->setRoworder(11); $entityWidget->setRoworder(11);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -326,19 +336,14 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "nbday", "loc": "col1", "type": "integer", "label": "Nombre de jours affichés", "value": "15", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Blog // Widget Blog
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1890); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1890);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rocket.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rocket.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1890); $entityWidget->setId(-1890);
$entityWidget->setRoworder(12); $entityWidget->setRoworder(12);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -348,19 +353,15 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget RSS // Widget RSS
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1880); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1880);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_rss.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1880); $entityWidget->setId(-1880);
$entityWidget->setRoworder(13); $entityWidget->setRoworder(13);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -370,19 +371,45 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("630"); $entityWidget->setHeight("630");
$entityWidget->setAutoajust(true); $entityWidget->setAutoajust(true);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés (0 pour tout)", "value": "10", "mandatory": "true"}]}');
$parameter = json_decode('{"fields": [{"id": "url", "loc": "col1", "type": "string", "label": "URL du Flux RSS", "value": "", "mandatory": "true"},{"id": "nbarticle", "loc": "col1", "type": "integer", "label": "Nombre d\'articles affichés", "value": "10", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget);
// Widget Applications Externe
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1870);
if(!$entityWidget&&($activate_widlimesurvey)) $entityWidget = new Widget();
elseif($entityWidget&&!($activate_widlimesurvey)) {
$pagewidgets=$entityWidget->getPagewidgets();
foreach($pagewidgets as $pagewidget) {
$em->remove($pagewidget);
$em->flush();
}
$em->remove($entityWidget);
$em->flush();
$entityWidget=null;
}
if($entityWidget) {
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_frames.png"]);
$entityWidget->setId(-1870);
$entityWidget->setRoworder(14);
$entityWidget->setIcon($entityicon);
$entityWidget->setName('Applications Externe');
$entityWidget->setDescription("Afficher des informations provenant de vos applications");
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_appexternal");
$entityWidget->setHeight("630");
$entityWidget->setAutoajust(true);
$entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "modedesktop", "loc": "col1", "type": "desktopmode", "label": "Mode Affichage", "value": "0", "mandatory": "true"},{"id": "Applications", "loc": "col1", "type": "appexternal", "label": "Applications à affichier", "value": "", "mandatory": "false"}]}');
$entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
} }
// Widget Séparateur // Widget Séparateur
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_roadblock.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_roadblock.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1600); $entityWidget->setId(-1600);
$entityWidget->setRoworder(100); $entityWidget->setRoworder(100);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -393,19 +420,14 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(false); $entityWidget->setBorder(false);
$entityWidget->setColorbodyback("ffffff"); $entityWidget->setColorbodyback("ffffff");
$parameter = json_decode('{"fields": [{"id": "seetitle", "loc": "col1", "type": "boolean", "label": "Afficher le titre", "value": "0", "mandatory": "true"},{"id": "seeicon", "loc": "col1", "type": "boolean", "label": "Afficher l\'icone", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "seetitle", "loc": "col1", "type": "boolean", "label": "Afficher le titre", "value": "0", "mandatory": "true"},{"id": "seeicon", "loc": "col1", "type": "boolean", "label": "Afficher l\'icone", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Horloge // Widget Horloge
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1500); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1500);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_clock.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_clock.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1500); $entityWidget->setId(-1500);
$entityWidget->setRoworder(100); $entityWidget->setRoworder(100);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -415,19 +437,14 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("200"); $entityWidget->setHeight("200");
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": [{"id": "clock", "loc": "col1", "type": "clock", "label": "Mode d\'affichage", "value": "0", "mandatory": "true"}]}'); $parameter = json_decode('{"fields": [{"id": "clock", "loc": "col1", "type": "clock", "label": "Mode d\'affichage", "value": "0", "mandatory": "true"}]}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// Widget Calculatrice // Widget Calculatrice
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1490); $entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1490);
if(!$entityWidget) { if(!$entityWidget) $entityWidget = new Widget();
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calculator.png"]); $entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_calculator.png"]);
$entityWidget = new Widget();
$entityWidget->setId(-1490); $entityWidget->setId(-1490);
$entityWidget->setRoworder(110); $entityWidget->setRoworder(110);
$entityWidget->setIcon($entityicon); $entityWidget->setIcon($entityicon);
@ -437,21 +454,13 @@ class InitDataCommand extends ContainerAwareCommand
$entityWidget->setHeight("400"); $entityWidget->setHeight("400");
$entityWidget->setAutoajust(false); $entityWidget->setAutoajust(false);
$entityWidget->setBorder(true); $entityWidget->setBorder(true);
$parameter = json_decode('{"fields": []}'); $parameter = json_decode('{"fields": []}');
$entityWidget->setParameter($parameter); $entityWidget->setParameter($parameter);
$em->persist($entityWidget); $em->persist($entityWidget);
}
// afin de forcer les ID sur certaines entités
$metadata = $em->getClassMetaData(get_class($entityWidget));
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$metadata = $em->getClassMetaData(get_class($entityPagecategory));
$metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
$metadata->setIdGenerator(new AssignedGenerator());
$em->flush(); $em->flush();
$output->writeln(''); $output->writeln('');

View File

@ -0,0 +1,291 @@
<?php
namespace Cadoles\PortalBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Filesystem\Filesystem;
class FeedController extends Controller
{
public function limesurveyAction($id)
{
$directory=$this->get('kernel')->getRootDir()."/../uploads/limesurvey/".$id;
$feeds=[];
$fs = new Filesystem();
$file=file_get_contents($directory."/invitation.json");
$json = substr($file, 0, -2); // sup dernier ,
$surveys = json_decode("{".$json."}", true);
foreach($surveys as $id => $survey) {
array_push($feeds,[
"id"=>$id,
"title"=>$survey["title"],
"url"=>$survey["url"],
"date"=>$survey["date"],
"description"=>$survey["description"],
"category"=>"limesurvey"]);
}
$response = new Response($this->renderView('CadolesPortalBundle:Feed:index.xml.twig',array(
"feeds" => $feeds,
)));
$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

@ -12,6 +12,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\File;
use GuzzleHttp\Exception\RequestException;
use Cadoles\PortalBundle\Entity\Pagewidget; use Cadoles\PortalBundle\Entity\Pagewidget;
use Cadoles\PortalBundle\Form\PagewidgetType; use Cadoles\PortalBundle\Form\PagewidgetType;
@ -645,32 +646,27 @@ class PagewidgetController extends Controller
return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1; return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1;
}); });
// Connexion au client
$PROXYactivate = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
if($PROXYactivate) {
$PROXYserver = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue();
$PROXYport = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue();
$clientguzzle = new \GuzzleHttp\Client(array('proxy' => ['http' => 'tcp://'.$PROXYserver.':'.$PROXYport,'https' => 'tcp://'.$PROXYserver.':'.$PROXYport]));
}
else
$clientguzzle = new \GuzzleHttp\Client();
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
$feeds=array(); $feeds=array();
$filesystem = new Filesystem(); $filesystem = new Filesystem();
foreach($fluxsordered as $flux) { foreach($fluxsordered as $flux) {
// On regarde si le flux a été lu il y a peu // On regarde si le flux a été lu il y a peu
$toregen=true; $toregen=true;
$url=$flux->getUrl();
if($filesystem->exists('uploads/flux/flux-'.$flux->getId().'.txt')) { // Feed lié à un user interne
$filecache='uploads/flux/flux-'.$flux->getId().'.txt';
if(stripos($url,"##userid##")!==false) {
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 // On récupère la date de modification du fichier
$timestampfile = filemtime('uploads/flux/flux-'.$flux->getId().'.txt'); $timestampfile = filemtime($filecache);
$datetimeFormat = 'Y-m-d H:i:s'; $datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime(); $datefile = new \DateTime();
$datefile->setTimestamp($timestampfile); $datefile->setTimestamp($timestampfile);
@ -682,15 +678,45 @@ class PagewidgetController extends Controller
$now = new \DateTime(); $now = new \DateTime();
if($datefile>=$now) { if($datefile>=$now) {
$toregen=false; $toregen=false;
$backup = unserialize(file_get_contents('uploads/flux/flux-'.$flux->getId().'.txt')); $backup = unserialize(file_get_contents($filecache));
$feeds=array_merge($feeds,$backup); $feeds=array_merge($feeds,$backup);
} }
} }
// Si le fichier est trop ancien on relit le flus // Si le fichier est trop ancien on relit le flus
if($toregen) { if($toregen) {
$PROXYactivate = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
$weburl=$this->getParameter('weburl');
if(stripos($url,"/")==0) {
$url="https://".$weburl.$url;
$PROXYactivate=false;
}
if(stripos($url,"https://".$weburl)===0) $PROXYactivate=false;
if(stripos($url,"http://".$weburl)===0) $PROXYactivate=false;
if($PROXYactivate) {
$PROXYserver = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue();
$PROXYport = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue();
$clientguzzle = new \GuzzleHttp\Client(array('timeout' => 3,'proxy' => ['http' => 'tcp://'.$PROXYserver.':'.$PROXYport,'https' => 'tcp://'.$PROXYserver.':'.$PROXYport]));
}
else
$clientguzzle = new \GuzzleHttp\Client(array('timeout' => 3));
try {
$clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
continue;
}
}
// On lit le flux rss // On lit le flux rss
$result = $feedIo->read($flux->getUrl()); $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger();
$feedIo = new \FeedIo\FeedIo($client, $logger);
$result = $feedIo->read($url);
$feedtitle = $result->getFeed()->getTitle(); $feedtitle = $result->getFeed()->getTitle();
@ -760,11 +786,11 @@ class PagewidgetController extends Controller
array_push($backup,$tmp); array_push($backup,$tmp);
$nbflux++; $nbflux++;
if($nbflux>=$flux->getMaxread()) break; if($nbflux>=$flux->getMaxread()&&$flux->getMaxread()>0) break;
} }
// On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile('uploads/flux/flux-'.$flux->getId().'.txt', serialize($backup)); $filesystem->dumpFile($filecache, serialize($backup));
} }
} }
@ -817,11 +843,19 @@ class PagewidgetController extends Controller
// On regarde si le flux a été lu il y a peu // On regarde si le flux a été lu il y a peu
$toregen=true; $toregen=true;
$filecache=$filecache='uploads/flux/widget-'.$id.'.txt';
$user=$this->getUser();
if(stripos($url,"##userid##")!==false) {
if($user) {
$url=str_replace("##userid##",$user->getId(),$url);
$filecache=$filecache='uploads/flux/widget-'.$user->getId()."-".$id.'.txt';
}
}
$filesystem = new Filesystem(); $filesystem = new Filesystem();
if($filesystem->exists('uploads/flux/widget-'.$id.'.txt')) { if($filesystem->exists($filecache)) {
// On récupère la date de modification du fichier // On récupère la date de modification du fichier
$timestampfile = filemtime('uploads/flux/widget-'.$id.'.txt'); $timestampfile = filemtime($filecache);
$datetimeFormat = 'Y-m-d H:i:s'; $datetimeFormat = 'Y-m-d H:i:s';
$datefile = new \DateTime(); $datefile = new \DateTime();
$datefile->setTimestamp($timestampfile); $datefile->setTimestamp($timestampfile);
@ -833,7 +867,7 @@ class PagewidgetController extends Controller
$now = new \DateTime(); $now = new \DateTime();
if($datefile>=$now) { if($datefile>=$now) {
$toregen=false; $toregen=false;
$feeds = unserialize(file_get_contents('uploads/flux/widget-'.$id.'.txt')); $feeds = unserialize(file_get_contents($filecache));
} }
} }
@ -841,14 +875,36 @@ class PagewidgetController extends Controller
if($toregen) { if($toregen) {
// Connexion au client // Connexion au client
$PROXYactivate = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue(); $PROXYactivate = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
$weburl=$this->getParameter('weburl');
if(stripos($url,"/")==0) {
$url="https://".$weburl.$url;
$PROXYactivate=false;
}
if(stripos($url,"https://".$weburl)===0) $PROXYactivate=false;
if(stripos($url,"http://".$weburl)===0) $PROXYactivate=false;
if($PROXYactivate) { if($PROXYactivate) {
$PROXYserver = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue(); $PROXYserver = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue();
$PROXYport = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue(); $PROXYport = $em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue();
$clientguzzle = new \GuzzleHttp\Client(array('proxy' => ['http' => 'tcp://'.$PROXYserver.':'.$PROXYport,'https' => 'tcp://'.$PROXYserver.':'.$PROXYport])); $clientguzzle = new \GuzzleHttp\Client(array('timeout' => 3,'proxy' => ['http' => 'tcp://'.$PROXYserver.':'.$PROXYport,'https' => 'tcp://'.$PROXYserver.':'.$PROXYport]));
} }
else else
$clientguzzle = new \GuzzleHttp\Client(); $clientguzzle = new \GuzzleHttp\Client(array('timeout' => 3));
try {
$clientguzzle->request('GET', $url);
} catch (RequestException $e) {
if ($e->hasResponse()) {
// Render
$feeds=[];
return $this->render($this->labelentity.':viewflux.html.twig', [
'entity' => $entity,
'canupdate' => $canupdate,
'access' => $access,
'feeds' => $feeds,
]);
}
}
$client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle); $client = new \FeedIo\Adapter\Guzzle\Client($clientguzzle);
$logger = new \Psr\Log\NullLogger(); $logger = new \Psr\Log\NullLogger();
@ -856,12 +912,11 @@ class PagewidgetController extends Controller
$feeds=array(); $feeds=array();
// On lit le flux rss // On lit le flux rss
$result = $feedIo->read($url); $result = $feedIo->read($url);
$feedtitle = $result->getFeed()->getTitle(); $feedtitle = $result->getFeed()->getTitle();
// Pour chaque articles // Pour chaque articles
$nbflux=0; $nbflux=0;
foreach ($result->getFeed() as $item) { foreach ($result->getFeed() as $item) {
@ -921,7 +976,7 @@ class PagewidgetController extends Controller
)); ));
$nbflux++; $nbflux++;
if($nbflux>=$nbarticle) break; if($nbflux>=$nbarticle&&$nbarticle>0) break;
} }
@ -932,7 +987,7 @@ class PagewidgetController extends Controller
array_multisort($libelle, SORT_DESC, $feeds); 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 // On sauvegarde le résultat en fichier on rechargera son contenu que s'il n'a pas été lu depuis 30mn
$filesystem->dumpFile('uploads/flux/widget-'.$id.'.txt', serialize($feeds)); $filesystem->dumpFile($filecache, serialize($feeds));
} }
// Render // Render
@ -1429,4 +1484,74 @@ class PagewidgetController extends Controller
'access' => $access, 'access' => $access,
]); ]);
} }
public function viewappexternalAction($id,$access="config") {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// Permissions
if($access=="config") {
$canupdate = true;
}
else {
// On s'assure que l'utilisateur à la permission de voir
$page=$entity->getPage();
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
if(!$cansee) throw $this->createNotFoundException('Permission denied');
}
// Récupération des paramétres du widget
$idappexternal=null;
foreach($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=$em->getRepository("CadolesPortalBundle:Appexternal")->findBy(["id"=>$idappexternal]);
else $appextenals=$em->getRepository("CadolesPortalBundle: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();
$file=file_get_contents($directory."/survey.json");
$json = substr($file, 0, -2); // sup dernier ,
$surveys = json_decode("{".$json."}", true);
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;
}
}
}
// Render
return $this->render($this->labelentity.':viewappexternal.html.twig', [
'entity' => $entity,
'canadd' => ($user),
'canupdate' => $canupdate,
'modedesktop' => $modedesktop,
'items' => $items,
'itemcategorys' => $itemcategorys,
'access' => $access,
]);
}
} }

View File

@ -0,0 +1,71 @@
<?php
namespace Cadoles\PortalBundle\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;
/**
* Widget
*
* @ORM\Entity
* @ORM\Table(name="appexternal")
* @ORM\HasLifecycleCallbacks
*/
class Appexternal
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=100)
*/
private $name;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Appexternal
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
}

View File

@ -76,6 +76,13 @@ class Flux
protected $groups; protected $groups;
// A garder pour forcer l'id en init
public function setId($id)
{
$this->id = $id;
return $this;
}
/** /**
* Constructor * Constructor

View File

@ -34,7 +34,7 @@ class FluxType extends AbstractType
]) ])
->add('maxread', IntegerType::class, [ ->add('maxread', IntegerType::class, [
'label' => "Nombre d'Articles affiché" 'label' => "Nombre d'Articles affiché (0 pour tout)"
]) ])
->add('color', TextType::class, [ ->add('color', TextType::class, [

View File

@ -170,6 +170,26 @@ class PagewidgetType extends AbstractType
]) ; ]) ;
} }
elseif($field->type=="appexternal") {
$id = $field->value;
$appexternals= $this->container->get('doctrine.orm.entity_manager')->getRepository("CadolesPortalBundle:Appexternal")->findAll();
$choices=array();
foreach($appexternals as $appexternal) {
$choices[$appexternal->getName()]=$appexternal->getId();
}
$builder
->add($field->id, ChoiceType::class, [
'label' => $field->label,
'mapped'=> false,
'label_attr' => ['loc' => $field->loc],
'data' => $id,
'required' => ($field->mandatory=="true"),
'choices' => $choices,
'placeholder' => '-- Sélectionnez une application --',
]) ;
}
elseif($field->type=="target") { elseif($field->type=="target") {
$builder $builder
->add($field->id, ChoiceType::class, [ ->add($field->id, ChoiceType::class, [

View File

@ -556,6 +556,14 @@ cadoles_portal_user_calendarevent_share:
#== FEED =================================================================================================================================================
cadoles_portal_user_feed_limesurvey:
path: /feed/limesurvey/{id}
defaults: { _controller: CadolesPortalBundle:Feed:limesurvey }
#== TOOL ================================================================================================================================================= #== TOOL =================================================================================================================================================
@ -661,6 +669,9 @@ cadoles_portal_config_panelwidget_view_calculator:
path: config/pagewidget/view/calculator/{id} path: config/pagewidget/view/calculator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: config } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: config }
cadoles_portal_config_panelwidget_view_appexternal:
path: config/pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: config }
#-- Access user #-- Access user
cadoles_portal_user_pagewidget_widget_sumbit: cadoles_portal_user_pagewidget_widget_sumbit:
@ -746,3 +757,7 @@ cadoles_portal_user_panelwidget_view_clock:
cadoles_portal_user_panelwidget_view_calculator: cadoles_portal_user_panelwidget_view_calculator:
path: /pagewidget/view/calculator/{id} path: /pagewidget/view/calculator/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: user } defaults: { _controller: CadolesPortalBundle:Pagewidget:viewcalculator, access: user }
cadoles_portal_user_panelwidget_view_appexternal:
path: /pagewidget/view/appexternal/{id}
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewappexternal, access: user }

View File

@ -0,0 +1,37 @@
{% autoescape %}
{% set sessionconfigs = app.session.get('configs') %}
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>{{ app.session.get('appname') }}</title>
<link>{{ absolute_url(path("cadoles_core_home")) }}</link>
<description>{{ app.session.get('subappname') }}</description>
{% for feed in feeds %}
<item>
{% if feed.url is defined %}
<guid><![CDATA[{{feed.url}}]]></guid>
{% endif %}
{% if feed.title is defined %}
<title>{{feed.title}}</title>
{% endif %}
{% if feed.author is defined %}
<author>{{feed.author}}</author>
{% endif %}
{% if feed.category is defined %}
<categories>{{ feed.category }}</categories>
{% endif %}
{% if feed.date is defined %}
<pubDate>{{feed.date|date('D, d M Y H:i:s O')}}</pubDate>
{% endif %}
{% if feed.url is defined %}
<link><![CDATA[{{feed.url}}]]></link>
{% endif %}
{% if feed.description is defined %}
<description><![CDATA[{% autoescape 'html' %}{{feed.description|raw }}{% endautoescape %}]]></description>
{% endif %}
</item>
{% endfor %}
</channel>
</rss>
{% endautoescape %}

View File

@ -196,7 +196,9 @@
// Création des grilles d'items // Création des grilles d'items
var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'}; var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid); var grid = $('.grid').masonry(optiongrid);
});
// Preview item de bureau // Preview item de bureau
$( ".grid .item-preview" ).click(function() { $( ".grid .item-preview" ).click(function() {
@ -409,10 +411,15 @@
// Affichage d'un Flux // Affichage d'un Flux
function showFlux(idwidget, id) { function showFlux(idwidget, id) {
console.log(idwidget); if(id=="all")
$(".widget[data-id="+idwidget+"]").find(".feed").show();
else {
$(".widget[data-id="+idwidget+"]").find(".feed").hide(); $(".widget[data-id="+idwidget+"]").find(".feed").hide();
$(".widget[data-id="+idwidget+"]").find(".flux-"+id).show(); $(".widget[data-id="+idwidget+"]").find(".flux-"+id).show();
} }
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'};
var grid = $('.grid').masonry(optiongrid);
}
{% endblock %} {% endblock %}

View File

@ -0,0 +1,95 @@
{% set theme = app.session.get('theme') %}
{% if theme is not empty %}
{{ include('@Theme/'~theme~'/function.html.twig') }}
{% endif %}
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
{% set 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" %}
{% endif %}
{% set colorbodyfont = "" %}
{% if entity.colorbodyfont is not null %}
{% set colorbodyfont = "color: #" ~ entity.colorbodyfont %}
{% endif %}
<div class="widget {%if entity.border %} widget-bordered {%endif%}" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
{% if canupdate or canadd %}
<div class="widgetmenu">
{% if canupdate %}
<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 canadd %}
<i class="fa fa-plus fa-fw" onClick="addBookmark({{ entity.id }},true)" style="{{ stylewidgetmenu }}"></i>
{% endif %}
</div>
{% endif %}
<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 %}
<h3 class="grid-title" style="{{ colorbodyfont }}" data-idcategory="{{ itemcategory.id }}">{{ itemcategory.label }}</h3>
<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 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>

View File

@ -11,6 +11,25 @@
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %} {% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
{% set color = app.session.get('color') %} {% set color = app.session.get('color') %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% set colorbodyback = entity.colorbodyback %}
{% if colorbodyback is null %}
{% set colorbodyback = color['main'] %}
{% endif %}
{% set colorbodyfont = entity.colorbodyfont %}
{% if colorbodyfont is null %}
{% if colorbodyback==color['fontcolorhover'] %}
{% set colorbodyfont = color['main'] %}
{% else %}
{% set colorbodyfont = color['fontcolorhover'] %}
{% endif %}
{% endif %}
<style> <style>
@ -39,23 +58,28 @@
<div class="widgetbody" style="{{ stylewidgetbody }}"> <div class="widgetbody" style="{{ stylewidgetbody }}">
{% if fluxs is defined %} {% if fluxs is defined %}
{% for flux in fluxs %} {% if fluxs|length > 1 %}
{% if loop.first %} <div class="cat-list-feed" onClick="showFlux({{ entity.id}},'all')" style="background-color: #{{ color['main'] }}">Tout</div>
{% set firstflux = flux.id %}
{% endif %}
{% for flux in fluxs %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if flux.color is not null %} {% if flux.color is not null %}
{% set stylefeed = "background-color: #" ~ flux.color ~ ";" %} {% set stylefeed = "background-color: #" ~ flux.color ~ ";" %}
{% endif %} {% endif %}
{% if fluxs|length > 1 %}
<div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }}">{{ flux.title }}</div> <div class="cat-list-feed" onClick="showFlux({{ entity.id}},{{ flux.id }})" style="{{ stylefeed }}">{{ flux.title }}</div>
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endif %}
<div class="grid clearfix">
{% for feed in feeds %} {% for feed in feeds %}
{% if loop.index==1 %}
<div class="grid-sizer grid-preview"></div>
<div class="grid-gutter-sizer grid-gutter-sizer-preview"></div>
{% endif %}
{% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %} {% set stylefeed = "background-color: #" ~ color['main'] ~ ";" %}
{% if feed.color is defined and feed.color is not null %} {% if feed.color is defined and feed.color is not null %}
{% set stylefeed = "background-color: #" ~ feed.color ~ ";" %} {% set stylefeed = "background-color: #" ~ feed.color ~ ";" %}
@ -64,15 +88,22 @@
{% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %} {% set stylefeed = stylefeed ~ "background: url(" ~ feed.image ~ ") no-repeat center; background-size: cover;" %}
{% endif %} {% endif %}
<div class="grid-item grid-preview feed flux-{{ feed.fluxid }}">
<a href="{{ feed.link }}" target="_blank"> <a href="{{ feed.link }}" target="_blank">
<div class="panel list-item feed flux-{{ feed.fluxid }}" style="{{ stylefeed }}; {% if feed.fluxid!=firstflux %} display:none; {% endif %}"> {% if feed.image is not empty %}
<h1>{{ feed.title }}</h1> <img src="{{feed.image}}" width="100%">
<div class="description">{{ feed.description | nl2br }}</div> {% endif %}
<div class="caption" style="background-color: #{{ colorbodyfont }}; color: #{{ colorbodyback }};">
<h1 class="grid-preview-title" style="color: #{{ colorbodyback }};">{{ feed.title }}</h1>
<small>le {{ feed.date|date("d/m/Y à H:i") }}</small><br>
{{ feed.description | nl2br }}
</div> </div>
</a> </a>
</div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div>

View File

@ -16,6 +16,10 @@ class DefaultController extends BaseController
public function discoveryAction() public function discoveryAction()
{ {
$masteridentity=$this->getParameter("masteridentity");
if($masteridentity!="SAML")
return;
$request = $this->container->get('request_stack')->getCurrentRequest(); $request = $this->container->get('request_stack')->getCurrentRequest();
$parties = $this->get('lightsaml.container.build')->getPartyContainer()->getIdpEntityDescriptorStore()->all(); $parties = $this->get('lightsaml.container.build')->getPartyContainer()->getIdpEntityDescriptorStore()->all();

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB