diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ImportCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ImportCommand.php deleted file mode 100644 index 5e179d7f..00000000 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ImportCommand.php +++ /dev/null @@ -1,503 +0,0 @@ -setName('Core:Import') - - // the short description shown while running "php bin/console list" - ->setDescription("Importation Utilisateur à partir d'un fichier CSV Annuaire") - - // the full command description shown when running the command with - // the "--help" option - ->setHelp('This command Import for Core') - - ->addArgument('simulate', InputArgument::OPTIONAL, 'true to simulate / false to run') - ; - } - - protected function convert($filename, $delimiter = ',', $enclosure = '"') - { - if(!file_exists($filename) || !is_readable($filename)) { - return FALSE; - } - - $header = NULL; - $data = array(); - - if (($handle = fopen($filename, 'r')) !== FALSE) { - while (($row = fgetcsv($handle, 1000, $delimiter, $enclosure)) !== FALSE) { - if(!$header) { - $header = $row; - } else { - $data[] = array_combine($header, $row); - } - } - fclose($handle); - } - return $data; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $kernel = new \AppKernel('dev', true); - $kernel->boot(); - $kernel->loadClassCache(); - $em = $kernel->getContainer()->get('service_container')->get('doctrine.orm.default_entity_manager'); - - $simulate = $input->getArgument('simulate'); - if($simulate=="") $simulate="true"; - - if($simulate!="true"&&$simulate!="false") { - $output->writeln('Paramétre incorrect'); - return; - } - $simulate=($simulate=="true"); - - $output->writeln(''); - if($simulate) $output->writeln('** SIMULATION'); - else $output->writeln('** REEL'); - - $output->writeln(''); - $output->writeln('====================================================='); - $output->writeln('== IMPORT USERS ====================================='); - $output->writeln('====================================================='); - - // Read CSV - $fileName = 'src/Cadoles/CoreBundle/Command/import.csv'; - - // Convert - $datas = $this->convert($fileName); - - foreach($datas as $row) { - if($row["uid"]!="") { - $data = $em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $row["uid"])); - if($data) { - $output->writeln(' - Existe déjà >> '.$row["uid"]); - } - else { - $data = $em->getRepository('CadolesCoreBundle:User')->findBy(array('email' => $row["mail"])); - if($data) { - $output->writeln(' - Existe déjà >> '.$row["uid"]); - } - else { - $output->writeln(' - Création Utilisateur >> '.$row["uid"]); - if(!$simulate) { - $niveau01=$em->getRepository('CadolesCoreBundle:Niveau01')->findOneBy(array("id"=>-100)); - $user = new User(); - $user->setUsername($row["uid"]); - $user->setPasswordDirect($row["userpassword"]); - $user->setSalt("IMPORT-".$row["uid"]); - $user->setNiveau01($niveau01); - $user->setSiren($user->getNiveau01()->getSiren()); - $user->setSiret($user->getNiveau02()!==null?$user->getNiveau02()->getSiret():""); - $user->setAvatar("noavatar.png"); - $user->setVisible(true); - $user->setAuthlevel("simple"); - $user->setRole("ROLE_USER"); - $user->setFirstname($row["givenname"]); - $user->setLastname($row["sn"]); - $user->setEmail($row["mail"]); - - $em->persist($user); - $em->flush(); - } - } - } - } - } - - - return; - - $ldap = $kernel->getContainer()->get('cadoles.core.service.ldap'); - if($ldap->isEnabled()) { - $output->writeln(''); - $output->writeln('====================================================='); - $output->writeln('== SYNCHONISATION BUNDLE TO LDAP ===================='); - $output->writeln('====================================================='); - - $output->writeln(''); - $output->writeln('== NIVEAU01 ========================================='); - $baseNiveau01 = $kernel->getContainer()->getParameter('ldap_baseniveau01'); - - $datas = $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 si elle existe - if(count($results) > 0) { - $output->writeln(' - Modification dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->modifyNiveau01($data,$data->getLabel()); - } - // Sinon création de la fiche - else { - $output->writeln(' - Création dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->addNiveau01($data); - } - } - - $output->writeln(''); - $output->writeln('== NIVEAU02 ========================================='); - $baseNiveau02 = $kernel->getContainer()->getParameter('ldap_baseniveau02'); - - $datas = $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 si elle existe - if(count($results) > 0) { - $output->writeln(' - Modification dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->modifyNiveau02($data,$data->getLabel()); - } - // Sinon création de la fiche - else { - $output->writeln(' - Création dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->addNiveau02($data); - } - } - - $output->writeln(''); - $output->writeln('== GROUP ============================================'); - $baseGroup = $kernel->getContainer()->getParameter('ldap_basegroup'); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Group','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $criteria = '(cn='.$data->getLabel().')'; - $subbranch=$baseGroup; - $results = $ldap->search($criteria, array('cn'), $subbranch); - - // Mise à jour si elle existe - if(count($results) > 0) { - $output->writeln(' - Modification dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->modifyGroup($data,$data->getLabel()); - } - // Sinon création de la fiche - else { - $output->writeln(' - Création dans annuaire >> '.$data->getLabel()); - if(!$simulate) $ldap->addGroup($data); - } - } - - $output->writeln(''); - $output->writeln('== USER ============================================='); - $baseUser = $kernel->getContainer()->getParameter('ldap_baseuser'); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:User','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $criteria = '(uid='.$data->getUsername().')'; - $subbranch=$baseUser; - $results = $ldap->search($criteria, array('uid'), $subbranch); - - // S'assurer que SIREN correspond au Niveau01 - if($data->getNiveau01()->getSiren()!=$data->getSiren()) { - $data->SetSiren($data->getNiveau01()->getSiren()); - $data->flush(); - } - - // S'assurer que SIRET correspond au Niveau02 - if($data->getNiveau02()!==null&&$data->getNiveau01()->getSiren()!=$data->getSiren()) { - $data->SetSiret($data->getNiveau02()->getSiret()); - $data->flush(); - } - - // Mise à jour si elle existe - if(count($results) > 0) { - $output->writeln(' - Modification dans annuaire >> '.$data->getUsername()); - if(!$simulate) $ldap->modifyUser($data); - } - // Sinon création de la fiche - else { - $output->writeln(' - Création dans annuaire >> '.$data->getUsername()); - if(!$simulate) $ldap->addUser($data); - } - - // Rattachement à Niveau01 et Niveau02 - if(!$simulate) $ldap->addGroupUser($data); - } - - $output->writeln(''); - $output->writeln('== USER GROUP ======================================='); - $baseGroup = $kernel->getContainer()->getParameter('ldap_basegroup'); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Group','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $criteria = '(cn='.$data->getLabel().')'; - $subbranch=$baseGroup; - $results = $ldap->search($criteria, array('cn'), $subbranch); - - // Mise à jour des membres du groupes - if(count($results) > 0) { - $output->writeln(' - '.$data->getLabel()); - $dn=$ldap->getGroupDN($data->getLabel()); - $attrs["memberuid"]=array(); - $attrs["cadolesMember"]=array(); - - foreach($data->getUsers() as $usergroupe) { - array_push($attrs["memberuid"],$usergroupe->getUser()->getUsername()); - array_push($attrs["cadolesMember"],$ldap->getUserDN($usergroupe->getUser())); - $output->writeln(' > '.$usergroupe->getUser()->getUsername()); - } - if(!$simulate) $ldap->ldapModify($dn, $attrs); - } - } - - $output->writeln(''); - $output->writeln('====================================================='); - $output->writeln('== SYNCHONISATION LDAP TO BUNDLE ===================='); - $output->writeln('====================================================='); - - - $output->writeln(''); - $output->writeln('== NIVEAU01 ========================================='); - $baseNiveau01 = $kernel->getContainer()->getParameter('ldap_baseniveau01'); - - $criteria = '(cn=*)'; - $subbranch=$baseNiveau01; - $results = $ldap->search($criteria, array('cn'), $subbranch); - foreach($results as $result) { - $data = $em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' => $result["cn"])); - if($data) $output->writeln(' - Existe dans bundle >> '.$result["cn"]); - else { - $output->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); - $dn=$ldap->getNiveau01DN($result["cn"]); - if(!$simulate) $ldap->deleteByDN($dn); - } - } - - $output->writeln(''); - $output->writeln('== NIVEAU02 ========================================='); - $baseNiveau02 = $kernel->getContainer()->getParameter('ldap_baseniveau02'); - - $criteria = '(cn=*)'; - $subbranch=$baseNiveau02; - $results = $ldap->search($criteria, array('cn'), $subbranch); - foreach($results as $result) { - $data = $em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' => $result["cn"])); - if($data) $output->writeln(' - Existe dans bundle >> '.$result["cn"]); - else { - $output->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); - $dn=$ldap->getNiveau02DN($result["cn"]); - if(!$simulate) $ldap->deleteByDN($dn); - } - } - - - $output->writeln(''); - $output->writeln('== GROUP ============================================'); - $baseGroup = $kernel->getContainer()->getParameter('ldap_basegroup'); - - $criteria = '(cn=*)'; - $subbranch=$baseGroup; - $results = $ldap->search($criteria, array('cn'), $subbranch); - foreach($results as $result) { - $data = $em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' => $result["cn"])); - if($data) $output->writeln(' - Existe dans bundle >> '.$result["cn"]); - else { - $output->writeln(' - A supprimer dans annuaire >> '.$result["cn"]); - $dn=$ldap->getGroupDN($result["cn"]); - if(!$simulate) $ldap->deleteByDN($dn); - } - } - - $output->writeln(''); - $output->writeln('== USER ============================================='); - $baseUser = $kernel->getContainer()->getParameter('ldap_baseuser'); - - $criteria = '(uid=*)'; - $subbranch=$baseUser; - $results = $ldap->search($criteria, array('uid'), $subbranch); - foreach($results as $result) { - $data = $em->getRepository('CadolesCoreBundle:User')->findBy(array('username' => $result["uid"])); - if($data) $output->writeln(' - Existe dans bundle >> '.$result["uid"]); - else { - $output->writeln(' - A supprimer dans annuaire >> '.$result["uid"]); - $dn='uid='.$result["uid"].','.$baseUser; - if(!$simulate) $ldap->deleteByDN($dn); - } - } - } - - $output->writeln(''); - $output->writeln('====================================================='); - $output->writeln('== SYNCHONISATION BUNDLE TO EPORTAIL ================'); - $output->writeln('====================================================='); - - - - $eportail = $kernel->getContainer()->get('cadoles.core.service.eportail'); - if(!$eportail->isEnabled()) { - $output->writeln(''); - $output->writeln(' Synchronisation ePortail désactivée'); - } - else { - $output->writeln(''); - $output->writeln('== NIVEAU01 ========================================='); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Niveau01','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $output->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncNiveau01($data,$data->getLabel()); - } - - $output->writeln(''); - $output->writeln('== NIVEAU02 ========================================='); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Niveau02','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $output->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncNiveau02($data,$data->getLabel()); - } - - $output->writeln(''); - $output->writeln('== GROUP ============================================'); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Group','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $output->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncGroup($data,$data->getLabel()); - } - - $output->writeln(''); - $output->writeln('== USER ============================================='); - - $datas = $em ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:User','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $output->writeln(' - Synchronisation eportail >> '.$data->getUsername()); - if(!$simulate) $eportail->syncUser($data); - } - - - $output->writeln(''); - $output->writeln('====================================================='); - $output->writeln('== SYNCHONISATION EPORTAIL TO BUNDLE ================'); - $output->writeln('====================================================='); - $dbeportail= $kernel->getContainer()->get('service_container')->get('doctrine.orm.eportail_entity_manager')->getConnection(); - - $output->writeln(''); - $output->writeln('== GROUP ============================================'); - - $sql = "SELECT * FROM env_group WHERE group_id>0"; - $query = $dbeportail->prepare($sql); - $query->execute(); - while($row=$query->fetch()){ - $fgOK=false; - if (strpos($row["group_name"], $labelniveau01.' = ') === 0) { - $tmp=str_replace("$labelniveau01 = ","",$row["group_name"]); - $data = $em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $output->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if (strpos($row["group_name"], $labelniveau02.' = ') === 0) { - $tmp=str_replace("$labelniveau01 = ","",$row["group_name"]); - $data = $em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $output->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if (strpos($row["group_name"], 'GROUPE = ') === 0) { - $tmp=str_replace("GROUPE = ","",$row["group_name"]); - $data = $em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $output->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if(!$fgOK) { - $output->writeln(' - A supprimer dans eportail >> '.$row["group_name"]); - if(!$simulate) delGroup($row["group_id"]); - } - } - - $output->writeln(''); - $output->writeln('== USER ============================================='); - - $sql = "SELECT * FROM env_user WHERE user_id>0"; - $query = $dbeportail->prepare($sql); - $query->execute(); - while($row=$query->fetch()){ - $data = $em->getRepository('CadolesCoreBundle:User')->findBy(array('username' =>$row["user_login"])); - if($data) $output->writeln(' - Existe dans bundle >> '.$row["user_login"]); - else { - $output->writeln(' - A supprimer dans eportail >> '.$row["user_login"]); - if(!$simulate) delUser($row["user_id"]); - } - } - } - - $output->writeln(''); - $output->writeln(''); - } - - protected static function determineKernelRootDir(Event $event) { - $extra = $event->getComposer()->getPackage()->getExtra(); - $rootdir = rtrim(getcwd(), '/'); - return $rootdir . '/' . trim($extra['symfony-app-dir'], '/'); - } -} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php index 68ea9125..fdd5c85e 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/SynchroCommand.php @@ -608,133 +608,6 @@ class SynchroCommand extends Command } } - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) { - $this->writeln(''); - $this->writeln('====================================================='); - $this->writeln('== SYNCHONISATION BUNDLE TO EPORTAIL ================'); - $this->writeln('====================================================='); - - $this->writeln(''); - $this->writeln('== NIVEAU01 ========================================='); - - $datas = $this->em - ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Niveau01','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $this->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncNiveau01($data,$data->getLabel()); - } - - $this->writeln(''); - $this->writeln('== NIVEAU02 ========================================='); - - $datas = $this->em - ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Niveau02','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $this->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncNiveau02($data,$data->getLabel()); - } - - $this->writeln(''); - $this->writeln('== GROUP ============================================'); - - $datas = $this->em - ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:Group','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $this->writeln(' - Synchronisation eportail >> '.$data->getLabel()); - if(!$simulate) $eportail->syncGroup($data,$data->getLabel()); - } - - $this->writeln(''); - $this->writeln('== USER ============================================='); - - $datas = $this->em - ->createQueryBuilder() - ->select('table') - ->from('CadolesCoreBundle:User','table') - ->getQuery() - ->getResult(); - foreach($datas as $data) { - $this->writeln(' - Synchronisation eportail >> '.$data->getUsername()); - if(!$simulate) $eportail->syncUser($data); - } - - - $this->writeln(''); - $this->writeln('====================================================='); - $this->writeln('== SYNCHONISATION EPORTAIL TO BUNDLE ================'); - $this->writeln('====================================================='); - $dbeportail= $this->container->get('service_container')->get('doctrine.orm.eportail_entity_manager')->getConnection(); - - $this->writeln(''); - $this->writeln('== GROUP ============================================'); - - $sql = "SELECT * FROM env_group WHERE group_id>0"; - $query = $dbeportail->prepare($sql); - $query->execute(); - while($row=$query->fetch()){ - $fgOK=false; - if (strpos($row["group_name"], $labelniveau01.' = ') === 0) { - $tmp=str_replace("$labelniveau01 = ","",$row["group_name"]); - $data = $this->em->getRepository('CadolesCoreBundle:Niveau01')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $this->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if (strpos($row["group_name"], $labelniveau02.' = ') === 0) { - $tmp=str_replace("$labelniveau01 = ","",$row["group_name"]); - $data = $this->em->getRepository('CadolesCoreBundle:Niveau02')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $this->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if (strpos($row["group_name"], 'GROUPE = ') === 0) { - $tmp=str_replace("GROUPE = ","",$row["group_name"]); - $data = $this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('label' =>$tmp)); - if($data) { - $fgOK=true; - $this->writeln(' - Existe dans bundle >> '.$row["group_name"]); - } - } - - if(!$fgOK) { - $this->writeln(' - A supprimer dans eportail >> '.$row["group_name"]); - if(!$simulate) delGroup($row["group_id"]); - } - } - - $this->writeln(''); - $this->writeln('== USER ============================================='); - - $sql = "SELECT * FROM env_user WHERE user_id>0"; - $query = $dbeportail->prepare($sql); - $query->execute(); - while($row=$query->fetch()){ - $data = $this->em->getRepository('CadolesCoreBundle:User')->findBy(array('username' =>$row["user_login"])); - if($data) $this->writeln(' - Existe dans bundle >> '.$row["user_login"]); - else { - $this->writeln(' - A supprimer dans eportail >> '.$row["user_login"]); - if(!$simulate) delUser($row["user_id"]); - } - } - } - $this->writeln(''); return 1; } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index 32bfacf3..8dfd6efd 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -8,7 +8,7 @@ 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}Zk1FeGDztzYdA2Q2EhJOmEuDHs7uyXI2 +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}KYFkIhUXbGQ8luMLxpsdl5OtVq4aZ/GN ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); @@ -20,6 +20,7 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f (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', ''), (1040, 1000, 1040, 'Fiche Utilisateur', 'cadoles_core_config_datauser', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''), +(1050, 1000, 1050, 'Liste Utilisateurs', 'cadoles_core_config_datausers', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''), (1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''), (1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''), @@ -71,6 +72,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type ('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'), ('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'), ('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'), +('007', 0, 1, 0, 'datausers', 'datausers', '', '', 'Parametrage des colonnes visible dans la liste des utilisateurs'), ('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'), @@ -93,6 +95,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES ('cadoles_core_config_commun',0), ('cadoles_core_config_theme',0), ('cadoles_core_config_datauser',0), +('cadoles_core_config_datausers',0), ('cadoles_core_config_whitelist',0), ('cadoles_core_config_niveau01',0), ('cadoles_core_config_niveau02',1), diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ConfigController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ConfigController.php index 57c89706..2f1b7ab1 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ConfigController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/ConfigController.php @@ -5,6 +5,7 @@ namespace Cadoles\CoreBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Form\FormError; use Cadoles\CoreBundle\Entity\Config; use Cadoles\CoreBundle\Form\ConfigType; @@ -242,8 +243,18 @@ class ConfigController extends Controller else { $fields=json_decode($fields, true); } + + if($session->get('viewniveau02')&&!array_key_exists("niveau02",$fields)) + $fields["niveau02"]["perm"]=1; + elseif(!$session->get('viewniveau02')) + unset($fields["niveau02"]); + + if(array_key_exists("niveau02",$fields)) + $fields["niveau02"]["label"]=$session->get('labelniveau02'); - $form = $this->createForm(DatauserType::class,$config,array("fields" => $fields)); + + + $form = $this->createForm(DatauserType::class,$config,array("mode"=>"datauser","fields" => $fields)); // Récupération des data du formulaire $form->handleRequest($request); @@ -266,7 +277,107 @@ class ConfigController extends Controller 'useheader' => true, 'usemenu' => false, 'usesidebar' => true, - 'form' => $form->createView() + 'form' => $form->createView(), + 'mode' => "datauser" + ]); + } + + public function datausersAction(Request $request) + { + $em = $this->getDoctrine()->getManager(); + $session=$this->get('session'); + $config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers"); + $fields=$config->getValue(); + + if($fields=="") { + // Valeur par défaut 0=caché / 3=visible + $fields["avatar"]["perm"]=1; + $fields["avatar"]["label"]="Avatar"; + + $fields["login"]["perm"]=1; + $fields["login"]["label"]="Login"; + + $fields["lastname"]["perm"]=1; + $fields["lastname"]["label"]="Nom"; + + $fields["firstname"]["perm"]=1; + $fields["firstname"]["label"]="Prenom"; + + $fields["email"]["perm"]=1; + $fields["email"]["label"]="Email"; + + $fields["niveau01"]["perm"]=1; + $fields["niveau01"]["label"]="Niveau 01"; + + $fields["niveau02"]["perm"]=1; + $fields["niveau02"]["label"]="Niveau 02"; + + $fields["group"]["perm"]=1; + $fields["group"]["label"]="Groupes"; + + $fields["role"]["perm"]=1; + $fields["role"]["label"]="Rôles"; + } + else { + $fields=json_decode($fields, true); + } + + $fields["niveau01"]["label"]=$session->get('labelniveau01'); + if($session->get('viewniveau02')&&!array_key_exists("niveau02",$fields)) + $fields["niveau02"]["perm"]=1; + elseif(!$session->get('viewniveau02')) + unset($fields["niveau02"]); + + if(array_key_exists("niveau02",$fields)) + $fields["niveau02"]["label"]=$session->get('labelniveau02'); + + + + $form = $this->createForm(DatauserType::class,$config,array("mode"=>"datausers","fields" => $fields)); + + // Récupération des data du formulaire + $form->handleRequest($request); + + if ($form->get('submit')->isClicked()) { + $onevisible=false; + foreach($fields as $key => $value) { + $perm = $form->get($key)->getData(); + $fields[$key]["perm"]=$perm; + if($perm==1) $onevisible=true; + } + + if(!$onevisible) + $form->addError(new FormError('Au moins une colonne doit être visible')); + + if ($form->get('submit')->isClicked() && !$form->isValid()) { + $this->get('session')->getFlashBag()->clear(); + $validator = $this->get('validator'); + $errors = $validator->validate($config); + foreach( $errors as $error ) { + $request->getSession()->getFlashBag()->add("error", $error->getMessage()); + } + + $errors = $form->getErrors(); + foreach( $errors as $error ) { + $request->getSession()->getFlashBag()->add("error", $error->getMessage()); + } + } + } + + if ($form->get('submit')->isClicked() && $form->isValid()) { + $json=json_encode($fields); + $config->setValue($json); + $em->persist($config); + $em->flush(); + } + + + return $this->render('CadolesCoreBundle:Config:datauser.html.twig',[ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => true, + 'form' => $form->createView(), + 'mode' => "datausers" ]); } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php index 543ec9da..f5ee912c 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/CoreController.php @@ -13,22 +13,45 @@ class CoreController extends Controller { public function homeAction(Request $request) { + $em = $this->getDoctrine()->getManager(); + $user=$this->getUser(); + $portal_activate=$this->getParameter("portal_activate"); + if(!$portal_activate) { - return $this->render('CadolesCoreBundle:Core:home.html.twig',[ - 'useheader' => true, - 'usemenu' => false, - 'usesidebar' => false, - ]); + $item_activate=$this->getParameter("item_activate"); + + $bookmarks=null; + $items=null; + $itemcategorys=null; + + if($item_activate) { + $em->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys); + return $this->render('CadolesPortalBundle:Page:noportal.html.twig',[ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => false, + 'item_activate' => $item_activate, + 'bookmarks' => $bookmarks, + 'items' => $items, + 'itemcategorys' => $itemcategorys + ]); + } + else { + return $this->render('CadolesCoreBundle:Core:home.html.twig',[ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => false, + ]); + } } else { - $em = $this->getDoctrine()->getManager(); - + // Récupération de la page encours $id = $request->query->get('id'); // L'utilisateur en cours - $user=$this->getUser(); + // Chargement des chartes à signer if($user) { @@ -43,8 +66,45 @@ class CoreController extends Controller 'notices' => $notices ]); } + + // On s'assure que l'ensemble des champs user obligatoire sont bien renseignés sinon bascule sur le profil + $config=$em->getRepository('CadolesCoreBundle:Config')->find("datauser"); + $fields=$config->getValue(); + $fields=json_decode($fields,true); + $toprofil=false; + if($fields!="") { + foreach($fields as $key => $field) { + // Si champs obligatoire + if($field["perm"]==2) { + switch($key) { + case "firstname": if($user->getFirstname()=="") $toprofil=true; break; + case "visible": if($user->getVisible()=="") $toprofil=true; break; + case "authlevel": if($user->getAuthlevel()=="") $toprofil=true; break; + case "belongingpopulation": if($user->getBelongingpopulation()=="") $toprofil=true; break; + case "job": if($user->getJob()=="") $toprofil=true; break; + case "position": if($user->getPosition()=="") $toprofil=true; break; + case "niveau02": if($user->geNiveau02()=="") $toprofil=true; break; + case "usualname": if($user->getUsualname()=="") $toprofil=true; break; + case "gender": if($user->getGender()=="") $toprofil=true; break; + case "givensname": if($user->getGivensname()=="") $toprofil=true; break; + case "telephonenumber": if($user->getTelephonenumber()=="") $toprofil=true; break; + case "postaladress": if($user->getPostaladress()=="") $toprofil=true; break; + case "birthdate": if($user->getBirthdate()=="") $toprofil=true; break; + case "birthcountry": if($user->getBirthcountry()=="") $toprofil=true; break; + case "birthplace": if($user->getBirthplace()=="") $toprofil=true; break; + } + } + } + } + + if($toprofil) { + return $this->redirect($this->generateUrl('cadoles_core_profil',array("info"=>"Merci de compléter votre profil"))); + } } + + + // Calcul des pages de l'utilisateur $this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,$id,$entity,$pagesuser,$pagesadmin,$pagesshared); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php index 3b22c1cf..52da39e9 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Controller/UserController.php @@ -35,11 +35,17 @@ class UserController extends Controller public function listAction($access) { + $em = $this->getDoctrine()->getManager(); + $config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers"); + $fields=$config->getValue(); + $fields=json_decode($fields,true); + return $this->render('CadolesCoreBundle:User:list.html.twig',[ 'useheader' => true, 'usemenu' => false, 'usesidebar' => ($access=="config"), - 'access' => $access + 'access' => $access, + 'fields' => $fields ]); } @@ -347,6 +353,7 @@ class UserController extends Controller public function updateAction($id,$access,Request $request) { $em = $this->getDoctrine()->getManager(); + $info = $request->query->get('info'); // Récupération de l'enregistrement courant $data=$this->getData($id); @@ -502,7 +509,8 @@ class UserController extends Controller 'access' => $access, 'listgroups' => $this->getListGroups($access), 'listmodos' => $this->getListModos(), - 'form' => $form->createView() + 'form' => $form->createView(), + 'info' => $info, ]); } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php index ef5226ab..90d214c5 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/sessionListener.php @@ -103,7 +103,7 @@ $viewniveau02 =$this->container->getParameter('viewniveau02'); $iconniveau02 =$this->container->getParameter('iconniveau02'); $labelsniveau02 =$this->container->getParameter('labelsniveau02'); - $labelniveau02 =$this->container->getParameter('labelsniveau02'); + $labelniveau02 =$this->container->getParameter('labelniveau02'); $session->set('viewniveau02',$viewniveau02); $session->set('labelniveau02',$labelniveau02); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncGroup.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncGroup.php index 111afd17..0a6b6aee 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncGroup.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncGroup.php @@ -84,11 +84,7 @@ class syncGroup implements EventSubscriber if(count($results)) { $ldap->deleteGroup($group); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->delGroup($group); + } } public function upsertGroup($group, $force = false) @@ -113,11 +109,7 @@ class syncGroup implements EventSubscriber else { $ldap->addGroup($group); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->syncGroup($group,$this->oldid); + } } public function getBaseGroup() { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau01.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau01.php index c3e076be..b6b4b465 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau01.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau01.php @@ -103,11 +103,7 @@ class syncNiveau01 implements EventSubscriber if(count($results)) { $ldap->deleteNiveau01($niveau01); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->delNiveau01($niveau01); + } } public function upsertNiveau01($niveau01, $force = false) @@ -135,10 +131,6 @@ class syncNiveau01 implements EventSubscriber } } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->syncNiveau01($niveau01,$this->oldid); } public function getBaseNiveau01() { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau02.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau02.php index deabb7c9..cd91caf7 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau02.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncNiveau02.php @@ -102,11 +102,7 @@ class syncNiveau02 implements EventSubscriber if(count($results)) { $ldap->deleteNiveau02($niveau02); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->delNiveau02($niveau02); + } } public function upsertNiveau02($niveau02, $force = false) @@ -131,11 +127,7 @@ class syncNiveau02 implements EventSubscriber else { $ldap->addNiveau02($niveau02); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->syncNiveau02($niveau02,$this->oldid); + } } public function getBaseNiveau02() { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUser.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUser.php index d945c86e..fb032587 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUser.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUser.php @@ -113,11 +113,7 @@ class syncUser implements EventSubscriber if(count($results)) { $ldap->deleteUser($user); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->delUser($user); + } } public function upsertUser($user, $force = false) @@ -142,10 +138,6 @@ class syncUser implements EventSubscriber $ldap->addGroupUser($user); } - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->syncUser($user); - // On ajoute l'utilisateur au groupe 'Tout le Monde' quoi qu'il arrive $fgall=$this->em->getRepository('CadolesCoreBundle:Group')->findBy(array('fgall'=>true)); if($fgall) { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUserGroup.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUserGroup.php index a480a6d0..23b97c67 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUserGroup.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/EventListener/syncUserGroup.php @@ -82,11 +82,7 @@ class syncUserGroup implements EventSubscriber if(count($results)) { $ldap->delUserGroup($group); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->delUserGroup($group); + } } public function upsertGroup($group, $force = false) @@ -104,11 +100,7 @@ class syncUserGroup implements EventSubscriber if(count($results) > 0) { $ldap->addUserGroup($group); } - } - - $eportail = $this->container->get('cadoles.core.service.eportail'); - if($eportail->isEnabled()) - $eportail->addUserGroup($group); + } } public function getBaseGroup() { diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/DatauserType.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/DatauserType.php index a35d4134..870120b3 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/DatauserType.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Form/DatauserType.php @@ -34,17 +34,25 @@ class DatauserType extends AbstractType foreach($options["fields"] as $key => $field) { - if($key=="birthplace") - $choices=array( - "Falcultatif" => 1, - "Caché" => 0, - ); - else - $choices=array( - "Obligatoire" => 2, - "Falcultatif" => 1, - "Caché" => 0, - ); + if($options["mode"]=="datauser") { + if($key=="birthplace") + $choices=array( + "Falcultatif" => 1, + "Caché" => 0, + ); + else + $choices=array( + "Obligatoire" => 2, + "Falcultatif" => 1, + "Caché" => 0, + ); + } + else { + $choices=array( + "Visible" => 1, + "Caché" => 0, + ); + } $builder->add($key, ChoiceType::class, array("label" => $field["label"], @@ -63,8 +71,9 @@ class DatauserType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( - 'data_class' => 'Cadoles\CoreBundle\Entity\Config', - 'fields' => "array", + 'data_class' => 'Cadoles\CoreBundle\Entity\Config', + 'mode' => 'string', + 'fields' => "array", )); } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml index 3c1001e1..6512de53 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/routing.yml @@ -161,6 +161,10 @@ cadoles_core_config_datauser: path: /config/commun/datauser defaults: { _controller: CadolesCoreBundle:Config:datauser } +cadoles_core_config_datausers: + path: /config/commun/datausers + defaults: { _controller: CadolesCoreBundle:Config:datausers } + #== Registration ========================================================================================================= #-- Access config cadoles_core_config_registration: diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml index c2c205ff..0638acae 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/config/services.yml @@ -1,23 +1,28 @@ services: cadoles.core.session.listener: + public: true class: Cadoles\CoreBundle\EventListener\sessionListener arguments: ['@service_container','@doctrine.orm.entity_manager',"@security.token_storage"] tags: - { name: kernel.event_listener, event: kernel.request, method: onDomainParse } cadoles.core.upload.listener: + public: true class: Cadoles\CoreBundle\EventListener\uploadListener arguments: ["@doctrine.orm.entity_manager","@security.token_storage","@session"] tags: - { name: kernel.event_listener, event: oneup_uploader.post_persist, method: onUpload } cadoles.core.upload.namer.same: + public: true class: Cadoles\CoreBundle\Service\uploadSameNamer cadoles.core.password.encoder: + public: true class: Cadoles\CoreBundle\Service\passwordEncoder cadoles.core.sync.user: + public: true class: Cadoles\CoreBundle\EventListener\syncUser arguments: - "@service_container" @@ -28,6 +33,7 @@ services: - [setBaseUser, ["%ldap_baseuser%"]] cadoles.core.sync.niveau01: + public: true class: Cadoles\CoreBundle\EventListener\syncNiveau01 arguments: - "@service_container" @@ -38,6 +44,7 @@ services: - [setBaseNiveau01, ["%ldap_baseNiveau01%"]] cadoles.core.sync.niveau02: + public: true class: Cadoles\CoreBundle\EventListener\syncNiveau02 arguments: - "@service_container" @@ -48,6 +55,7 @@ services: - [setBaseNiveau02, ["%ldap_baseniveau02%"]] cadoles.core.sync.group: + public: true class: Cadoles\CoreBundle\EventListener\syncGroup arguments: - "@service_container" @@ -58,6 +66,7 @@ services: - [setBaseGroup, ["%ldap_basegroup%"]] cadoles.core.sync.usergroup: + public: true class: Cadoles\CoreBundle\EventListener\syncUserGroup arguments: - "@service_container" @@ -68,6 +77,7 @@ services: - [setBaseGroup, ["%ldap_basegroup%"]] cadoles.core.service.ldap: + public: true class: Cadoles\CoreBundle\Service\ldapService arguments: - %ldap_host% @@ -82,30 +92,25 @@ services: - [setBaseGroup, ["%ldap_basegroup%"]] - [setLdapSync, ["%ldap_sync%","%masteridentity%"]] - cadoles.core.service.eportail: - class: Cadoles\CoreBundle\Service\eportailService - arguments: - - "@doctrine" - calls: - - [setEportailSync, ["%eportail_sync%","%masteridentity%"]] - - [setLabelniveau01, ["%labelniveau01%"]] - - [setLabelniveau02, ["%labelniveau02%"]] - cadoles.core.service.mail: + public: true class: Cadoles\CoreBundle\Service\mailService arguments: ["@mailer", "@twig"] cadoles.core.service.color: + public: true class: Cadoles\CoreBundle\Service\colorService arguments: ['@service_container'] cadoles.core.icon_choice_type: + public: true class: Cadoles\CoreBundle\Form\IconChoiceType arguments: ["%kernel.root_dir%/../web/bundles/cadolescore/css/font-awesome.css"] tags: - { name: form.type } cadoles.saml_user_mapper: + public: true class: Cadoles\CoreBundle\Service\samlUserMapperService arguments: - "@=service('doctrine').getManager()" @@ -113,6 +118,7 @@ services: - "@session" cadoles.saml_user_creator: + public: true class: Cadoles\CoreBundle\Service\samlUserCreatorService arguments: - "@=service('doctrine').getManager()" @@ -120,4 +126,5 @@ services: - "@session" cadoles.saml_attribute_mapper: + public: true class: Cadoles\CoreBundle\Service\samlAttributeMapperService \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/datauser.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/datauser.html.twig index f7fc5327..91c1f8de 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/datauser.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/Config/datauser.html.twig @@ -3,7 +3,11 @@ {% block pagewrapper %} {{ form_start(form) }}

- Paramétrage de la Fiche Utilisateur + {% if mode=="datauser" %} + Paramétrage de la Fiche Utilisateur + {% else %} + Paramétrage de la Listes des Utilisateurs + {% endif %}

{{ form_widget(form.submit) }} diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig index 15d357d2..efb3ccc5 100755 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/edit.html.twig @@ -30,6 +30,7 @@ {{ flashMessage }}
{% endfor %} +
{% endif %} {% if app.session.flashbag.has('notice') %} @@ -39,8 +40,18 @@ {{ flashMessage }}
{% endfor %} +
{% endif %} + {% if info %} +
+ Information
+ {{ info }}
+
+
+ {% endif %} + +
diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig index 145dbc0a..dcfd2d92 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/views/User/list.html.twig @@ -27,17 +27,17 @@ {% if access=="config" %} Action {% endif %} - Avatar - Login - Nom - Prénom - Email - {{ labelniveau01 }} + Avatar + Login + Nom + Prénom + Email + {{ labelniveau01 }} {% if viewniveau02 %} - {{ labelniveau02 }} + {{ labelniveau02 }} {% endif %} - Groupes - Rôle + Groupes + Rôle @@ -58,7 +58,7 @@ {% endif %} $('#dataTables').DataTable({ - columnDefs: [ { "targets": 'no-sort', "orderable": false } ], + columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ], responsive: true, iDisplayLength: 100, processing: true, diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/eportailService.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/eportailService.php deleted file mode 100644 index f71b9b3b..00000000 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/eportailService.php +++ /dev/null @@ -1,439 +0,0 @@ -doctrine=$doctrine; - } - - public function isEnabled() { - return $this->eportailSync; - } - -//================================================================================================================================================================== -//== Function User================================================================================================================================================== -//================================================================================================================================================================== - - public function syncUser(User $user) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - $sql = "SELECT user_id FROM env_user WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($user->getUsername())); - - // Correspondance profil core = profil eportail - switch($user->getRole()) { - case "ROLE_ADMIN": - $profil=1; - break; - - case "ROLE_MODO": - $profil=2; - break; - - case "ROLE_VALIDATOR": - $profil=50; - break; - - case "ROLE_MANAGER": - $profil=50; - break; - - case "ROLE_USER": - $profil=50; - break; - } - // Si existe modification - if($row=$query->fetch()){ - echo "modif"; - $sql="UPDATE env_user SET user_password=?, user_lastname=?, user_firstname=?, user_pseudo=?, user_email=?, user_avatar=?, user_profil=? WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array( - $user->getPassword(), - $user->getLastname(), - $user->getFirstname(), - $user->getFirstname()." ".$user->getLastname(), - $user->getEmail(), - $user->getAvatar(), - $profil, - $user->getUsername() - )); - } - // Sinon création - else { - $sql="INSERT INTO env_user(user_login, user_password, user_lastname, user_firstname, user_pseudo, user_email, user_avatar, user_profil) VALUES(?,?,?,?,?,?,?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array( - $user->getUsername(), - $user->getPassword(), - $user->getLastname(), - $user->getFirstname(), - $user->getFirstname()." ".$user->getLastname(), - $user->getEmail(), - $user->getAvatar(), - $profil - )); - } - - // Ratacchement utilisateur group - $this->defineGroupUser($user); - - return true; - } - - public function delUser(User $user) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // On recherche l'utilisateur eportail - $sql = "SELECT user_id FROM env_user WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($user->getUsername())); - - // Si existe suppression - if($row=$query->fetch()){ - delUser($row["user_id"]); - } - - return true; - } - -//================================================================================================================================================================== -//== Function Niveau01============================================================================================================================================== -//================================================================================================================================================================== - - public function syncNiveau01(Niveau01 $niveau01, $oldid) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Renommage du précédent groupe - if(isset($oldid)&&$oldid!=$niveau01->getLabel()) { - $sql="UPDATE env_group SET group_name=? WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array( - $this->labelniveau01." = ".$niveau01->getLabel(), - $this->labelniveau01." = ".$oldid)); - } - - // On recherche le groupe à insérer / modifier - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau01." = ".$niveau01->getLabel())); - - // Si existe modification = rien à faire normalement - // Sinon création - if(!$row=$query->fetch()){ - $sql="INSERT INTO env_group(group_name, group_type, group_user) VALUES(?,?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau01." = ".$niveau01->getLabel(),4,-1)); - } - - return true; - } - - public function delNiveau01(Niveau01 $niveau01) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // On recherche le groupe eportail - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau01." = ".$niveau01->getLabel())); - - // Si existe suppression - if($row=$query->fetch()){ - delGroup($row["group_id"]); - } - - return true; - } - - -//================================================================================================================================================================== -//== Function Niveau02============================================================================================================================================== -//================================================================================================================================================================== - -public function syncNiveau02(Niveau02 $niveau02, $oldid) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Renommage du précédent groupe - if(isset($oldid)&&$oldid!=$niveau02->getLabel()) { - $sql="UPDATE env_group SET group_name=? WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array( - $this->labelniveau02." = ".$niveau02->getLabel(), - $this->labelniveau02." = ".$oldid)); - } - - // On recherche le groupe à insérer / modifier - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau02." = ".$niveau02->getLabel())); - - // Si existe modification = rien à faire normalement - // Sinon création - if(!$row=$query->fetch()){ - $sql="INSERT INTO env_group(group_name, group_type, group_user) VALUES(?,?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau02." = ".$niveau02->getLabel(),4,-1)); - } - - return true; -} - -public function delNiveau02(Niveau02 $niveau02) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // On recherche le groupe eportail - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau02." = ".$niveau02->getLabel())); - - // Si existe suppression - if($row=$query->fetch()){ - delGroup($row["group_id"]); - } - - return true; -} - -//================================================================================================================================================================== -//== Function Groupe================================================================================================================================================ -//================================================================================================================================================================== - -public function syncGroup(Group $group, $oldid) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Renommage du précédent groupe - if(isset($oldid)&&$oldid!=$group->getLabel()) { - $sql="UPDATE env_group SET group_name=? WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array( - "GROUPE = ".$group->getLabel(), - "GROUPE = ".$oldid)); - } - - // On recherche le groupe à insérer / modifier - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$group->getLabel())); - - // Si existe modification = rien à faire normalement - // Sinon création - if(!$row=$query->fetch()){ - $sql="INSERT INTO env_group(group_name, group_type, group_user) VALUES(?,?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$group->getLabel(),4,-1)); - } - - return true; -} - -public function delGroup(Group $group) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // On recherche le groupe eportail - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$group->getLabel())); - - - // Si existe suppression - if($row=$query->fetch()){ - delGroup($row["group_id"]); - } - - return true; -} - -//================================================================================================================================================================== -//== Function GroupUser============================================================================================================================================= -//================================================================================================================================================================== - -public function defineGroupUser(User $user) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Recherche de l'utilisateur - $sql = "SELECT user_id FROM env_user WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($user->getUsername())); - - if($row=$query->fetch()){ - $id=$row["user_id"]; - - // On supprime l'ensemble des liens utilisateur / groupe - $q="DELETE FROM env_group_user WHERE group_user_user=?"; - $query=$this->dbeportail->prepare($q); - $query->execute(array($id)); - - // On regènere son rattachement niveau01 - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau01." = ".$user->getNiveau01()->getLabel())); - if($row=$query->fetch()){ - $sql="INSERT INTO env_group_user(group_user_group, group_user_user) VALUES(?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($row["group_id"],$id)); - } - - // On regènere son rattachement etablissement - if($user->getNiveau02()!==null) { - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($this->labelniveau02." = ".$user->getNiveau02()->getLabel())); - if($row=$query->fetch()){ - $sql="INSERT INTO env_group_user(group_user_group, group_user_user) VALUES(?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($row["group_id"],$id)); - } - } - - // On regènere son rattachement aux groupes - $groups=$user->getGroups(); - if($groups) { - foreach($groups as $usergroup) { - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$usergroup->getGroup()->getLabel())); - if($row=$query->fetch()){ - $sql="INSERT INTO env_group_user(group_user_group, group_user_user) VALUES(?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($row["group_id"],$id)); - } - } - } - } -} - -public function delUserGroup(UserGroup $usergroup) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Recherche de l'utilisateur - $sql = "SELECT user_id FROM env_user WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($usergroup->getUser()->getUsername())); - - if($row=$query->fetch()){ - $iduser=$row["user_id"]; - - // Recherche du groupe - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$usergroup->getGroup()->getLabel())); - if($row=$query->fetch()){ - $idgroup=$row["group_id"]; - - // Suppression du rattachement - $sql="DELETE FROM env_group_user WHERE group_user_group=? AND group_user_user=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($idgroup,$iduser)); - } - } -} - -public function addUserGroup(UserGroup $usergroup) { - global $bdd01; - global $config; - $bdd01=$this->dbeportail; - $config["dbprefixe"]="env_"; - - // Recherche de l'utilisateur - $sql = "SELECT user_id FROM env_user WHERE user_login=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($usergroup->getUser()->getUsername())); - - if($row=$query->fetch()){ - $iduser=$row["user_id"]; - - // Recherche du groupe - $sql = "SELECT group_id FROM env_group WHERE group_name=?"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array("GROUPE = ".$usergroup->getGroup()->getLabel())); - if($row=$query->fetch()){ - $idgroup=$row["group_id"]; - - // Création du rattachement - $sql="INSERT INTO env_group_user(group_user_group, group_user_user) VALUES(?,?)"; - $query = $this->dbeportail->prepare($sql); - $query->execute(array($idgroup,$iduser)); - } - } -} - -//================================================================================================================================================================== -//== Init du Service Synfony======================================================================================================================================== -//================================================================================================================================================================== - - public function setEportailSync($eportailSync,$masteridentity) { - $this->eportailSync = ($eportailSync&&($masteridentity=="SQL")); - if($eportailSync) - $this->dbeportail = $this->doctrine->getManager('eportail')->getConnection(); - - return $this; - } - - public function setLabelniveau01($labelniveau01) { - setlocale( LC_CTYPE, 'fr_FR' ); - $this->labelniveau01 = mb_strtoupper($labelniveau01); - return $this; - } - - public function setLabelniveau02($labelniveau02) { - setlocale( LC_CTYPE, 'fr_FR' ); - $this->labelniveau02 = mb_strtoupper($labelniveau02); - return $this; - } - -} diff --git a/src/ninegate-1.0/src/Cadoles/CronBundle/Resources/config/services.yml b/src/ninegate-1.0/src/Cadoles/CronBundle/Resources/config/services.yml index 3d9b22dd..4440e95f 100644 --- a/src/ninegate-1.0/src/Cadoles/CronBundle/Resources/config/services.yml +++ b/src/ninegate-1.0/src/Cadoles/CronBundle/Resources/config/services.yml @@ -1,4 +1,5 @@ services: cadoles.cron.service.mail: + public: true class: Cadoles\CronBundle\Service\mailService arguments: ["@mailer", "@twig"] diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php index 0e1ed54e..3d0849e0 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Entity/Item.php @@ -12,6 +12,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @ORM\Entity * @ORM\Table(name="item") * @ORM\HasLifecycleCallbacks + * @ORM\Entity(repositoryClass="Cadoles\PortalBundle\Repository\ItemRepository") */ class Item { diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php new file mode 100644 index 00000000..a916fd86 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php @@ -0,0 +1,118 @@ +getRoles():["ROLE_ANONYME"]); + $groups=($user?$user->getGroups():[]); + $niveau01=($user?$user->getNiveau01():[]); + + + + // Bookmark de l'utilisateur + $bookmarks = array(); + if($user) + $bookmarks=$this->getEntityManager()->getRepository("CadolesPortalBundle:Bookmark")->findBy(["user"=>$user]); + + // Bookmark lié à un item + $bookmarksitems=new ArrayCollection(); + foreach($bookmarks as $bookmark) { + if($bookmark->getItem()) $bookmarksitems->add($bookmark->getItem()); + } + + // Initialisation du calcul des items + $items=new ArrayCollection(); + + // Récupération des items par rôles + foreach($roles as $role) { + $qb = $this->getEntityManager()->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where($qb->expr()->like('item.roles', $qb->expr()->literal("%$role%"))); + + if($iditemcategory && $itemcategoryfilter) { + $qb->andWhere("item.itemcategory=:itemcategory") + ->setParameter("itemcategory",$itemcategoryfilter); + } + $itemsroles=$qb->getQuery()->getResult(); + foreach($itemsroles as $itemrole) { + if(!$bookmarksitems->contains($itemrole) && !$items->contains($itemrole)) $items->add($itemrole); + } + } + + // Récupération des items par group + foreach($groups as $group) { + $qb = $this->getEntityManager()->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where(":group MEMBER OF item.groups") + ->setParameter("group",$group->getGroup()); + + if($iditemcategory && $itemcategoryfilter) { + $qb->andWhere("item.itemcategory=:itemcategory") + ->setParameter("itemcategory",$itemcategoryfilter); + } + $itemsgroups=$qb->getQuery()->getResult(); + + foreach($itemsgroups as $itemgroup) { + if(!$bookmarksitems->contains($itemgroup) && !$items->contains($itemgroup)) $items->add($itemgroup); + } + } + + + // Récupération des items par niveau01 + if($niveau01) { + $qb = $this->getEntityManager()->createQueryBuilder(); + $qb->select('item') + ->from("CadolesPortalBundle:Item", 'item') + ->where(":niveau01 MEMBER OF item.niveau01s") + ->setParameter("niveau01",$niveau01); + + if($iditemcategory && $itemcategoryfilter) { + $qb->andWhere("item.itemcategory=:itemcategory") + ->setParameter("itemcategory",$itemcategoryfilter); + } + $itemsniveau01s=$qb->getQuery()->getResult(); + foreach($itemsniveau01s as $itemniveau01) { + if(!$bookmarksitems->contains($itemniveau01) && !$items->contains($itemniveau01)) $items->add($itemniveau01); + } + } + + // Trie des items + $itemsordered = $items->getIterator(); + $itemsordered->uasort(function ($first, $second) { + if((int) $first->getRowOrder() > (int) $second->getRowOrder()) + $return=1; + elseif((int) $first->getRowOrder() == (int) $second->getRowOrder()) { + if($first->getTitle() > $second->getTitle()) + $return=1; + else + $return=-1; + } + else + $return=-1; + + return $return; + }); + + // Catégories affichées + $itemcategorys = $this->getEntityManager()->getRepository('CadolesPortalBundle:Itemcategory')->findBy([], ['rowOrder' => 'asc']); + if($iditemcategory && $itemcategoryfilter) $itemcategorys = $itemcategoryfilter; + + switch($withbookmark) { + // items uniquement + case 1: $bookmarks=null; break; + + // bookmarks uniquement + case 2: $itemsordered=null; break; + + } + + } +} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/services.yml b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/services.yml index 39998476..66baa510 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/services.yml +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/config/services.yml @@ -1,5 +1,6 @@ services: Cadoles\PortalBundle\Form\PagewidgetType: + public: true arguments: ['@service_container'] tags: - { name: form.type } \ No newline at end of file diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/noportal.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/noportal.html.twig new file mode 100644 index 00000000..c7a7c0fb --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Page/noportal.html.twig @@ -0,0 +1,334 @@ + +{% extends '@CadolesCore/base.html.twig' %} + +{% set color = app.session.get('color') %} +{% set colormain = color['main'] %} + +{% block pagewrapper %} +
+
+
qsdfqsdfqsd
+ +
+ {% if bookmarks is not empty %} +
+ {% if items is not empty %} +

Favoris

+ {% else %} +

+ {% endif %} + +
+ {% else %} + + {% endif %} + + {% set mycategs = [] %} + {% for itemcategory in itemcategorys %} + {% set haveitem=false %} + + {% for item in items if item.itemcategory==itemcategory %} + + {% if loop.index ==1 %} + {% set mycategs = mycategs|merge({ (loop.index) : itemcategory}) %} + {% endif %} + {% endfor %} + {% endfor %} + + {% for itemcategory in mycategs %} + {% set haveitem=false %} + + {% for item in items if item.itemcategory==itemcategory %} + + {% if loop.index ==1 %} + {% set haveitem=true %} + + {% if mycategs|length > 1 or bookmarks is not empty %} +

{{ itemcategory.label }}

+ {% else %} +

+ {% endif %} + + + {% endif %} + {% endfor %} +
+
+{% endblock %} + +{% block localjavascript %} + $('document').ready(function(){ + // Ajustement des frames + $(window).resize(function() { + AjustFrame(); + }); + + + // Création des grilles d'items + var optiongrid={columnWidth: '.grid-sizer', itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'}; + $('body').imagesLoaded(function() { + var grid = $('.grid').masonry(optiongrid); + }); + + // Preview item de bureau + $( ".grid .item-preview" ).click(function() { + if($(this).parent().children(".grid-item-body").css('display') == 'none') { + $(this).html(''); + heightbody=$(this).parent().children(".grid-item-body").height()+30; + heightitem=$(this).parent().parent().height(); + + + $(this).parent().children(".grid-item-body").show(); + $(this).parent().parent().css("width","100%"); + + $(this).parent().parent().css("height",heightitem+heightbody); + $(this).parent().children(".grid-item-content").css("height",heightitem+heightbody); + $(this).parent().children(".item-preview").css("height",heightitem+heightbody); + + var grid = $('.grid').masonry(optiongrid); + } + else { + $(this).html(''); + + $(this).parent().children(".grid-item-body").hide(); + $(this).parent().parent().css("width",""); + $(this).parent().parent().css("height",""); + $(this).parent().children(".grid-item-content").css("height",""); + $(this).parent().children(".item-preview").css("height",""); + + var grid = $('.grid').masonry(optiongrid); + } + }); + + // Sur click item à sonder + {% if activate_widsonde %} + $( ".linktosonde" ).click(function() { + title=$(this).attr("data-sonde"); + $.getScript( "{{ widsonde_url }}?appli="+title ); + }); + {% endif %} + + }); + + + // Ajout d'un bookmark + function addBookmark(idwidget,touser) { + var url="{{ path('cadoles_portal_user_bookmark_submit',{idpage:0,idwidget:'xx',touser:'yy'})}}"; + url=url.replace('xx',idwidget); + url=url.replace('yy',touser); + + $(location).attr('href', url); + } + + // Modifciation d'un bookmark + function modBookmark(idbookmark) { + var url="{{ path('cadoles_portal_user_bookmark_update',{idpage:0,id:'xx'})}}"; + + url=url.replace('xx',idbookmark); + $(location).attr('href', url); + } + + // Ajouter un item aux bookmark + function heartBookmark(iditem) { + var idbookmark; + + $.ajax({ + method: "POST", + url: "{{ path('cadoles_portal_user_bookmark_heart') }}", + data: { + iditem:iditem + }, + success: function(idbookmark) { + location.reload(); + } + }); + + } + + // Supprimer un fichier + function delFile(directory,filename) { + var r = confirm("Confirmez-vous la suppression de ce fichier ?"); + if (r == true) { + $.ajax({ + method: "POST", + url: "{{ path('cadoles_core_user_file_delete') }}", + data: { + directory:directory, + filename:filename + }, + success: function() { + location.reload(); + } + }); + } + } + + // Ajustement des frames + function AjustFrame() { + $('.frameajust').iframeAutoHeight({ + minHeight: 500, // Sets the iframe height to this value if the calculated value is less + heightOffset: 0, // Optionally add some buffer to the bottom + callback: function(callbackObject) { $(this).parent().css("height",callbackObject.newFrameHeight) ;} + }); + + if($(".frameitem").length>0) { + var heightbody = $('html').height(); + var heightheader = $('.header').height(); + if($('.pagemenu').css("display")=="none") + var heightmenu = 0; + else + var heightmenu = $('.pagemenu').height(); + + var heightframe = heightbody-heightheader-heightmenu; + + $(".frameitem").height(heightframe); + } + + } + + + // Affichage d'un Flux + function showFlux(idwidget, id) { + if(id=="all") + $(".widget[data-id="+idwidget+"]").find(".feed").show(); + else { + $(".widget[data-id="+idwidget+"]").find(".feed").hide(); + $(".widget[data-id="+idwidget+"]").find(".flux-"+id).show(); + } + + var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item'}; + var grid = $('.grid').masonry(optiongrid); + } + + // Affichage des frames associés aux items de bureau + function resizeFrame() { + var iFrame = document.getElementById('frameContent'); + + var heightbody = $('html').height(); + var heightheader = $('.header').height(); + if($('#appmenu').css("display")=="none") + var heightmenu = 0; + else + var heightmenu = $('#appmenu').height(); + + + var heightframe = heightbody-heightheader-heightmenu; + + $(".pageframe").each(function( index ) { + $(this).height(heightframe); + }); + } + + + function showFrameitem(id,url,forcereload) { + $(".pageframe").hide(); + + // Si force le rechargement et frame existante on la détruit + if(forcereload&&$("#frameitem-"+id).length) + $("#frameitem-"+id).remove(); + + // Si la frame en cours existe déjà on l'affiche + if($("#frameitem-"+id).length) + $("#frameitem-"+id).show(); + // Sinon on la génère + else + $("#pagecontainer").append(""); + + + resizeFrame(); + } + +{% endblock %} diff --git a/tmpl/ninegate-init-01.sql b/tmpl/ninegate-init-01.sql index 57e30ab4..581e2a07 100644 --- a/tmpl/ninegate-init-01.sql +++ b/tmpl/ninegate-init-01.sql @@ -29,6 +29,7 @@ INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `f (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', ''), (1040, 1000, 1040, 'Fiche Utilisateur', 'cadoles_core_config_datauser', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''), +(1050, 1000, 1050, 'Liste Utilisateurs', 'cadoles_core_config_datausers', 'fa-gear', 'ROLE_ADMIN,ROLE_MODO', ''), (1200, NULL, 1200, 'ORGANISATION', NULL, 'fa-sitemap', 'ROLE_ADMIN,ROLE_MODO', ''), (1210, 1200, 1210, 'Listes Blanche', 'cadoles_core_config_whitelist', 'fa-tasks', 'ROLE_ADMIN,ROLE_MODO', ''), @@ -82,6 +83,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type ('004', 1, 1, 1, 'logo', 'logo', 'uploads/logo/logo.png', '', 'Le logo de votre site'), ('005', 0, 1, 0, 'theme', 'theme', '', '', 'Le theme de votre site'), ('006', 0, 1, 0, 'datauser', 'datauser', '', '', 'Parametrage des champs utilisateurs : obligatoire / facultatif / caché'), +('007', 0, 1, 0, 'datausers', 'datausers', '', '', 'Parametrage des colonnes visible dans la liste des utilisateurs'), ('010', 1, 1, 1, 'boolean', 'fgforceconnect', '0', '', 'Forcer la connection afin de rendre votre site privé'), @@ -110,6 +112,7 @@ INSERT IGNORE permmodo (`route`, `visible`) VALUES ('cadoles_core_config_commun',0), ('cadoles_core_config_theme',0), ('cadoles_core_config_datauser',0), +('cadoles_core_config_datausers',0), ('cadoles_core_config_whitelist',0), ('cadoles_core_config_niveau01',0), ('cadoles_core_config_niveau02',1),