Méthode pour charger les rôles.
547109
public function getRoles() {

        if (empty($this->roles)) {

            // On initialise les variables
            $refs  = array();
            $roles = array();
            $usergroups = $this->getUserGroups();

            // On construit l'arbre des rôles.
            foreach ($usergroups as $usergroup) {

                $thisref = &$refs[$usergroup->id];
                $thisref = new Role($usergroup->id);
                $thisref->title = $usergroup->title;

                if ($usergroup->parent_id > 0) {
                    $refs[$usergroup->parent_id]->addChild($thisref);
                }

                // On stocke les rôles dans un tableau pour leur associer les règles plus tard.
                $roles[$usergroup->id] = &$thisref;

            }

            $this->roles = $roles;
        }

        return $this->roles;

    }
805530
protected function init()
    {
        $this->setLevel(ConfigQuery::read(self::VAR_LEVEL, self::DEFAULT_LEVEL));

        $this->dir_destinations = array(
                __DIR__.DS.'Destination',
                THELIA_LOCAL_DIR.'tlog'.DS.'destinations'
        );

        $this->setPrefix(ConfigQuery::read(self::VAR_PREFIXE, self::DEFAUT_PREFIXE));
        $this->setFiles(ConfigQuery::read(self::VAR_FILES, self::DEFAUT_FILES));
        $this->setIp(ConfigQuery::read(self::VAR_IP, self::DEFAUT_IP));
        $this->setDestinations(ConfigQuery::read(self::VAR_DESTINATIONS, self::DEFAUT_DESTINATIONS));
        $this->setShowRedirect(ConfigQuery::read(self::VAR_SHOW_REDIRECT, self::DEFAUT_SHOW_REDIRECT));

        // Au cas ou il y aurait un exit() quelque part dans le code.
        register_shutdown_function(array($this, 'writeOnExit'));
    }
762548
protected function _setRoles()
    {
        $this->loadModel('Block.Blocks');
        $roles = $this->Blocks->Roles->find('list');
        $this->set('roles', $roles);
    }
1079460
public void setRoles(java.util.Collection<Role> roles) {
        if (roles == null) {
            this.roles = null;
            return;
        }

        this.roles = new com.amazonaws.internal.SdkInternalList<Role>(roles);
    }
602850
public static void main(String[] args) throws IOException {

		
		// TODO : le pcm mutate est bien différent du pcm de base, mais les changements ne sont pas pris en compte. A travailler !
		
		// inputpath = args[0];
		inputpath = "off_output/pcms/test_paget/input";
		outputpath = "off_output/pcms/test_paget/output";

		try {


			Stream<Path> paths = Files.walk(Paths.get(inputpath));

			paths.forEach(filePath -> {
				
				if (Files.isRegularFile(filePath) && filePath.toString().endsWith(".pcm")) {
					System.out.println("> PCM read from " + filePath);
				     
					//File pcmFile = new File(filePath.toString());

					PCMContainer pcmC = null ;
					//PCMContainer pcmC = JSONtoPCM.JSONFormatToPCM(JSONReader.importJSON(filePath.toString())) ;
					//PCMLoader loader = new KMFJSONLoader();
					//List<PCMContainer> pcmContainers = null;
					try {
						pcmC = JSONtoPCM.JSONFormatToPCM(JSONReader.importJSON(filePath.toString())) ;
					} catch (Exception e) {
						e.printStackTrace();
					}

//					for (PCMContainer pcmContainer : pcmContainers) {
//						// Get the PCM
						
						PCMInfoContainerMuted pcmic = null;
						
						try {
							System.out.println(pcmic.toString());
							pcmic = new PCMInfoContainerMuted(pcmC);
						} catch (Exception e) {
							e.printStackTrace();
						}
						if (pcmic != null) {
							if (pcmic.isSameSizePcm()) {
								System.out.println("> PCM muted is the same");
							} else {
								pcmC.setPcm(pcmic.getMutedPcm().getPcm());
								KMFJSONExporter pcmExporter = new KMFJSONExporter();
								String pcmString = pcmExporter.export(pcmC);
								
								Path p = Paths.get(outputpath + "muted_" ) ;//filePath.getFileName());
								try {
									Files.write(p, pcmString.getBytes());
								} catch (Exception e) {
									e.printStackTrace();
								}
								System.out.println("> PCM exported to " + p);
							}
						}
						else {
							System.out.println("> PCM corrompu");
						}

				}

			});
			// mongoClient.close();
			paths.close();

		} catch (Exception e) {
			// mongoClient.close();
			e.printStackTrace();
		}
	}
809070
public function run()
    {
        DB::table('roles')->truncate();

        $locale = env('REACTOR_LOCALE', 'en');

        $roles = $this->roles[$locale];

        foreach($roles as $role)
        {
            Role::create($role);
        }
    }
1156437
public function ajouterNouveauDossier()
    {
        $mail = new mailObject();
        // ******************************************************
        // en premier lieu on ajoute l'adresse
        // ******************************************************
        $arrayNewAdresses = array();
        
        $longitude='0';
        $latitude='0';
        if (isset($this->variablesPost['idUnique']) && count($this->variablesPost['idUnique'])>0) {
            if (isset($this->variablesPost['latitude']) && isset($this->variablesPost['longitude']) && $this->variablesPost['latitude']!='' && $this->variablesPost['longitude']!='') {
                $longitude = $this->variablesPost['longitude'];
                $latitude = $this->variablesPost['latitude'];
            }
            
            foreach ($this->variablesPost['idUnique'] as $indice => $valueIdUnique) {
                if ($this->variablesPost['rue'][$valueIdUnique]!='' && $this->variablesPost['rue'][$valueIdUnique]!='0') {
                    $arrayNewAdresses[] = $this->ajouterAdresseFromArray(
                        array(
                            'idPays'=>1, 
                            'idVille'=>$this->variablesPost['ville'], 
                            'idQuartier' => $this->variablesPost['quartiers'], 
                            'idSousQuartier'=>$this->variablesPost['sousQuartiers'], 
                            'numero'=>$this->variablesPost['numero'][$valueIdUnique], 
                            'indicatif'=>$this->variablesPost['indicatif'][$valueIdUnique], 
                            'idRue'=>$this->variablesPost['rue'][$valueIdUnique], 
                            'longitude'=>$this->variablesPost['longitude'][$valueIdUnique], 
                            'latitude'=>$this->variablesPost['latitude'][$valueIdUnique]
                        )
                    );
                } else {
                    $arrayNewAdresses[] = $this->ajouterAdresseFromArray(
                        array(
                            'idPays'=>1, 
                            'idVille'=>$this->variablesPost['ville'], 
                            'idQuartier' => $this->variablesPost['quartiers'], 
                            'idSousQuartier'=>$this->variablesPost['sousQuartiers'], 
                            'numero'=>0, 
                            'indicatif'=>0, 
                            'idRue'=>0, 
                            'longitude'=>'', 
                            'latitude'=>''
                        )
                    );
                }
            }
            
            
            $sql = "SELECT ha1.idAdresse as idAdresse
				FROM historiqueAdresse ha1, historiqueAdresse ha2
				WHERE ha2.idAdresse = ha1.idAdresse
				AND ha1.idRue='".$tabForm['rue']['value']."'
				AND ha1.idSousQuartier='".$tabForm['sousQuartier']['value']."'
				AND ha1.idQuartier='".$tabForm['quartier']['value']."'
				AND ha1.idVille='".$tabForm['ville']['value']."'
				AND ha1.idPays='".$tabForm['pays']['value']."'
				AND ha1.numero = '".$tabForm['numero']['value']."'
				AND ha1.date='".$tabForm['date']['value']."'
				AND ha1.idIndicatif='".$tabForm['indicatif']['value']."'
				GROUP BY ha1.idAdresse, ha1.idHistoriqueAdresse
				HAVING ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)";
            $resDouble = $this->connexionBdd->requete($sql);
            $arrayDouble = mysql_fetch_assoc($resDouble);
            
			$this->addEvent("adresse",  $arrayNewAdresses);
            
            // enfin on regenere les caches
            //$cache = new cacheObject();
            //$cache->refreshCache();
        } else if (isset($_POST["metier"]) && !empty($_POST["nom"])) {
            $this->ajouter();
            $newPerson=array(
            		array(
            				"idAdresse"=>mysql_insert_id(),
            				'newAdresse'=>true
            		)
            );
            $this->addEvent("personne",  $newPerson);
        } else {
            $this->erreurs->ajouter("Aucune fiche n'a pu être ajoutée. Vérifiez la saisie du champ.");
        }
    }
211377
def create_role(self, **kwargs):
        """"""

        role = self.role_model(**kwargs)
        return self.put(role)
241590
protected function job(): void
    {
        $roles = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($roles->isCachedLoad()) return;

        collect($roles)->each(function ($role) {

            collect($this->types)->each(function ($type) use ($role) {

                if (! property_exists($role, $type))
                    return;

                collect($role->{$type})->each(function ($name) use ($role, $type) {

                    CorporationRole::firstOrCreate([
                        'corporation_id' => $this->getCorporationId(),
                        'character_id'   => $role->character_id,
                        'type'           => $type,
                        'role'           => $name,
                    ]);

                });

                CorporationRole::where('corporation_id', $this->getCorporationId())
                    ->where('character_id', $role->character_id)
                    ->where('type', $type)
                    ->whereNotIn('role', collect($role->{$type})->flatten()->all())
                    ->delete();
            });
        });
    }
575980
public function afficheSelectPays($params = array())
    {
        $html="";
        $t=new Template('modules/archi/templates/');
        $t->set_filenames((array('listePays'=>'listePaysSelect.tpl')));



        $a = new archiAuthentification();
        $u = new archiUtilisateur();

        $sqlWhereVillesModerees = "";
        if ($a->getIdProfil()==3) { // l'utilisateur est un moderateur , on affiche que les quartiers qu'il peut moderer suivant les villes qu'il peut moderer
            $arrayIdVilles = $u->getArrayVillesModereesPar($a->getIdUtilisateur());
            $arrayIdPays = array();
            // recuperation des pays concernés par les villes qu'administre le moderateur
            $reqPaysModeres = "SELECT distinct idPays FROM ville WHERE idVille IN (".implode(",", $arrayIdVilles).") ";
            $resPaysModeres = $this->connexionBdd->requete($reqPaysModeres);
            if (mysql_num_rows($resPaysModeres)>0) {
                while ($fetchPaysModeres = mysql_fetch_assoc($resPaysModeres)) {
                    $arrayIdPays[] = $fetchPaysModeres['idPays'];
                }

                $sqlWhereVillesModerees = " AND idPays IN (".implode(",", $arrayIdPays).") ";
            } else {
                $sqlWhereVillesModerees = " AND idPays = 0 "; // si le moderateur ne gere aucune ville , on rajoute ce critere pour ne pas afficher toutes les villes
            }
        }



        $reqPays = "SELECT nom, idPays FROM pays WHERE 1=1 ".$sqlWhereVillesModerees;
        $resPays = $this->connexionBdd->requete($reqPays);

        $javascriptVille="";
        if (!isset($params['noVille']) || $params['noVille']!=true) {
            $javascriptVille = "
                            document.getElementById('ville').innerHTML='<option value=0>Aucun</option>';
                            document.getElementById('ville').selectedIndex=0;
                            appelAjax('?archiAffichage=afficheSelectVille&noHeaderNoFooter=1&idPays='+document.getElementById('pays').value,'champVille');
                            ";
        }

        $javascriptQuartier="";
        if (!isset($params['noQuartier']) || $params['noQuartier']!=true) {
            $javascriptQuartier="
                            document.getElementById('quartiers').innerHTML='<option value=0>Aucun</option>';
                            document.getElementById('quartiers').selectedIndex=0;
            ";
        }

        $javascriptSousQuartier="";
        if (!isset($params['noSousQuartier']) || $params['noSousQuartier']!=true) {
            $javascriptSousQuartier="
                            document.getElementById('sousQuartiers').innerHTML='<option value=0>Aucun</option>';
                            document.getElementById('sousQuartiers').selectedIndex=0;
            ";
        }


        $t->assign_vars(array('javascript'=>"
                        function onChangeListePays()
                        {
                            ".$javascriptSousQuartier."
                            ".$javascriptQuartier."
                            ".$javascriptVille."
                        }
                        "));


        // assignation du javascript pour l'ajax
        $t->assign_vars(array('onChangeListePays'=>"onChangeListePays();"));

        while ($fetchPays = mysql_fetch_assoc($resPays)) {
            $selected="";
            if (isset($params['idPays']) && $params['idPays']!='' && $params['idPays'] == $fetchPays['idPays']) {
                $selected=" selected ";
            }
            $t->assign_block_vars('pays', array(
                                                    'id'=>$fetchPays['idPays'],
                                                    'nom'=>$fetchPays['nom'],
                                                    'selected'=>$selected
                                                ));
        }

        ob_start();
        $t->pparse('listePays');
        $html=ob_get_contents();
        ob_end_clean();

        return $html;
    }
502308
def ajContractions(self):
        
        for lin in lignesFichier(self.path("contractions.la")):
            ass1, ass2 = tuple(lin.split(':'))
            self.lemmatiseur._contractions[ass1] = ass2
1136373
private static PCM clear_ligne(PCM pcm, PCM pcm_return){
		List<Product> pdts = pcm.getProducts();
		List<Cell> cells = new ArrayList<Cell>() ;
		

		
		for (Product pr : pdts) {
			float nbCellsEmpty = 0 ;
			// On ajoute les cellules du product dans une liste
			cells = pr.getCells();
			// On traite les infos des cellules
			for(Cell c : cells){
				if(c.getContent().isEmpty()){
					nbCellsEmpty ++ ;
				}
			}
			if(cells.size() != 0){
				System.out.println("Dans les lignes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size());
				System.out.println("Valeur du if : " + nbCellsEmpty/cells.size());
				if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){
					System.out.println("on ajoute la ligne !");
					pcm_return.addProduct(pr);
				}
			}			
		}
		
		return pcm_return;
	}
1280114
def standardize_role(role):
    """"""
    role = role.lower()
    if any(c in role for c in {'synthesis', 'give', 'yield', 'afford', 'product', 'preparation of'}):
        return 'product'
    return role
705545
public Object invoke(String methodName, Object...parameters) {
		
		// Si le nom de la methode est vide
		if(methodName == null || methodName.trim().length() == 0) return null;
		
		// Obtention de la methode
		Method method = methods.get(methodName.trim());
		
		// Si la methode n'existe pas
		if(method == null) return null;
		
		try {
			
			// Apel
			Object result = method.invoke(this, parameters);
			
			// On retourne le resultat
			return result;
			
		} catch (Exception e) {
			
			// On retourne null
			return null;
		}
	}
60296
public function postAction()
    {
        $postId = $this->getEvent()->getRouteMatch()->getParam('post');
        $voted = false;
        $statusMail = false;
        $mailService = $this->getServiceLocator()->get('playgroundgame_message');
        $to = '';
        $skinUrl = $this->getGameService()->getServiceManager()->get('ViewRenderer')->url(
            'frontend',
            array(),
            array('force_canonical' => true)
        );
        $config = $this->getGameService()->getServiceManager()->get('config');
        if (isset($config['moderation']['email'])) {
            $to = $config['moderation']['email'];
        }

        if (! $postId) {
            return $this->notFoundAction();
        }

        // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu.
        $post = $this->getGameService()->getPostVotePostMapper()->findById($postId);

        if (! $post || $post->getStatus() === 9) {
            return $this->redirect()->toUrl(
                $this->frontendUrl()->fromRoute(
                    'postvote',
                    array('id' => $this->game->getIdentifier())
                )
            );
        }

        $formModeration = new Form();
        $formModeration->setAttribute('method', 'post');

        $formModeration->add(array(
            'name' => 'moderation',
            'attributes' => array(
                'type' => 'hidden',
                'value' => '1'
            ),
        ));

        $form = new \PlaygroundGame\Form\Frontend\PostVoteVote(
            $this->frontendUrl()->fromRoute(
                'postvote/post/captcha',
                array(
                    'id' => $this->game->getIdentifier(),
                    'post' => $postId,
                )
            )
        );

        if ($this->user) {
            $form->remove('captcha');
            if (count($this->getGameService()->getPostvoteVoteMapper()->findBy(array('user' => $this->user, 'post' =>$post))) > 0) {
                $voted = true;
            }
        }

        $alreadyVoted = '';
        $reportId = '';

        $request = $this->getRequest();
        if ($request->isPost()) {
            $data = $request->getPost()->toArray();
            if (isset($data['moderation'])) {
                $formModeration->setData($data);
                if ($formModeration->isValid()) {
                    $from = $to;
                    $subject= 'Moderation Post and Vote';
                    $result = $mailService->createHtmlMessage(
                        $from,
                        $to,
                        $subject,
                        'playground-game/email/moderation',
                        array('data' => $data, 'skinUrl' => $skinUrl)
                    );
                    $mailService->send($result);
                    if ($result) {
                        $statusMail = true;
                        $reportId = $data['reportid'];
                    }
                }
            } else {
                $form->setData($request->getPost());
                if ($form->isValid()) {
                    if ($this->getGameService()->addVote(
                        $this->user,
                        $this->getRequest()->getServer('REMOTE_ADDR'),
                        $post
                    )) {
                        $voted = true;
                    } else {
                        $alreadyVoted = 'Vous avez déjà voté!';
                    }
                }
            }
        }

        $viewModel = $this->buildView($this->game);
        $viewModel->setVariables(
            array(
                'post'  => $post,
                'voted' => $voted,
                'form'  => $form,
                'formModeration' => $formModeration,
                'statusMail' => $statusMail,
                'alreadyVoted' => $alreadyVoted,
                'reportId' => $reportId,
            )
        );

        return $viewModel;
    }
541756
function addEventListeners() {
			ctrl.ngelt.on('wheel', wheelOnElt);
			ctrl.ngelt.on('computegrabbersizes', ctrl.updateSize);
//			ctrl.elt.addEventListener("wheel", function (event) {
//				boxesScrollServices.execAndApplyIfScrollable($scope, this, wheel, [event]);
//			}, {passive: true, capture: true});
			ctrl.ngsb.on("mouseout", mouseoutOnSb);
			ctrl.ngsb.on("mousedown", mousedownOnSb); // sur le mousedown, si dans le grabber, on init le mode drag, sinon on inc/dec les pages tant que l'on est appuyé
			ctrl.ngsb.on("mouseup", mouseup);  // on stop l'inc/dec des pages
			ctrl.ngsb.on("click", boxesScrollServices.stopEvent); // desactive la propagation entre autrepour eviter la fermeture des popup
			ctrl.ngelt.on("mousemove", mousemoveOnElt); // on définit la couleur du grabber
			if (!ctrl.ngelt.css('display') !== 'none') { // si c'est une popup, le resize de l'ecran ne joue pas
				ng.element($window).on("resize", updateSize);
			}
			$document.on("mousedown", mousedownOnDoc);
			$document.on("keydown", keydownOnOnDoc);
			$document.on("scroll", invalidSizes);
		}
1117067
public function displayMyInterest(){
		$auth = new archiAuthentification();
		if($auth->estConnecte()){
			
		
			$html ="";
			$formulaire = new formGenerator();
			$utils = new archiUtils();
			$ajax = new ajaxObject();
			$html.=$ajax->getAjaxFunctions();
	
			$t = new Template($this->getCheminPhysique().$this->cheminTemplates."interest/");
			$t->set_filenames(array('myinterests'=>'myinterests.tpl'));
	
	
			$a = new archiAdresse();
	
			//Generate address form
			$formParam = array(
					'afficheNombreResultat' => 1,
					'modeAffichage_rue'=>1,
					'modeAffichage_sousQuartier'=>1,
					'modeAffichage_quartier'=>1,
					'modeAffichage_ville'=>1,
					'modeAffichage_pays='>1
			);
			
			$formAddressAddInterest=$a->afficheChoixAdresse(array('afficheNombreResultat' => 1,'affichageInteret'=>1));
			$paramsFields= array();
			$paramsFields[] = array('table' => 'pays' ,'value' => 'idPays','title'=>'nom');
			$paramsFields[] = array('table' => 'ville' ,'value' => 'idVille','title'=>'nom');
			$paramsFields[] = array('table' => 'quartier' ,'value' => 'idQuartier','title'=>'nom');
			$paramsFields[] = array('table' => 'sousQuartier' ,'value' => 'idSousQuartier','title'=>'nom');
			$paramsFields[] = array('table' => 'rue' ,'value' => 'idRue','title'=>'nom');
	
	
	
			$formActionUrl = $this->creerUrl('','saveInterest',array());
	
			foreach ($paramsFields as $params){
				$options[] = $this->getAllField($params);
			}
	
	
			$paramsRequest[]=array('table'=> '_interetRue','field' =>'idRue' , 'associateTable' => 'rue');
			$paramsRequest[]=array('table'=> '_interetSousQuartier','field' =>'idSousQuartier', 'associateTable' => 'sousQuartier');
			$paramsRequest[]=array('table'=> '_interetQuartier','field' =>'idQuartier', 'associateTable' => 'quartier');
			$paramsRequest[]=array('table'=> '_interetVille','field' =>'idVille', 'associateTable' => 'ville');
			$paramsRequest[]=array('table'=> '_interetPays','field' =>'idPays', 'associateTable' => 'pays');
	
			$userInterest = $this->getAllInterest($paramsRequest);
			/*
			 * Array of EVERY interest  by categories : street country address etc..
			 */
			foreach ($userInterest as $interestByCat){
				if(!isset($interestByCat[0]['vide'])){
					$t->assign_block_vars('interestList',array('title'=>'Liste des '.$interestByCat[0]['titre'].' dans les centres d\'intérêt','CSSclass'=>'interestList'));
					/*
					 * Interest of each category
					 */
					foreach ($interestByCat as $interest){
						/*
						 * Process fields for delete link
						 */
						$table = $interest['table'];
						$fieldId = $interest['field'];
						$userId = $interest['idUtilisateur'];
						$interestId = $interest[$fieldId];
						
						
						$paramsDelete = array(
							$table,
							$fieldId,
							$userId,
							$interestId
						);
						
						$deleteUrl = $this->creerUrl('', 'deleteInterest', array('params' => $paramsDelete));
						switch ($interest['associateTable']){
							case 'personne':
								$t->assign_block_vars('interestList.interests',array(
								'name'=>$interest['nom']." ".$interest['prenom'],
								'deleteUrl' => $deleteUrl
								));
								break;
							default:
								$t->assign_block_vars('interestList.interests',array(
								'name'=>$interest['nom'],
								'deleteUrl' => $deleteUrl
								));
						}
					}
				}
				else{
					$t->assign_block_vars('interestList',array('vide'=>'Aucun résultat','title'=>'Liste des '.$interestByCat[0]['titre'].' dans les centres d\'intérêt','CSSclass'=>'interestList'));
				}
					
			}
	
			$t->assign_vars(array(
					'formAddInterest' => $formAddressAddInterest,
					'formActionUrl' => $formActionUrl,
					'nameForm'=>'saveInterest'
			));
	
			ob_start();
			$t->pparse('myinterests');
			$html .= ob_get_contents();
			ob_end_clean();
		return $html;
		}
		else{
			$this->messages->addError("Veuillez vous connecter pour personnaliser votre flux");
			$this->messages->display();
			$auth = new ArchiAuthentification();
			return $auth->afficheFormulaireAuthentification();
		}
	}