Project

General

Profile

Revision ad6689da

IDad6689dab313422a6e82633e880db45853e85c67
Parent 077e4de7
Child 1be75264

Added by Francois POIROTTE about 7 years ago

Davantage de correction liƩes aux conventions

Change-Id: I7680cf42d0b10ac300d44085d695e15064d33094
Reviewed-on: https://vigilo-dev.si.c-s.fr/review/2369
Tested-by: Build system <>
Reviewed-by: Francois POIROTTE <>

View differences:

src/Vigilo/VigiloLocation.php
8 8

  
9 9
    public function __construct()
10 10
    {
11
        $this->childrenLocation=array();
12
        $this->childrenEntity=array();
13
        $this->childrenManufacturer=array();
11
        $this->childrenLocation     = array();
12
        $this->childrenEntity       = array();
13
        $this->childrenManufacturer = array();
14 14
        $this->selectLocations();
15 15
        $this->selectEntities();
16 16
        $this->selectManufacturers();
......
18 18

  
19 19
    protected function selectManufacturers()
20 20
    {
21
        global $DB;
22
        $manufacturers=new Manufacturer();
23
        $manufacturers=$manufacturers->find();
21
        $manufacturers = new Manufacturer();
22
        $manufacturers = $manufacturers->find();
24 23
        foreach ($manufacturers as $manufacturer) {
25 24
            $this->childrenManufacturer[] = new VigiloGroups($manufacturer["name"]);
26 25
        }
......
28 27

  
29 28
    protected function selectEntities()
30 29
    {
31
        global $DB;
32
        $entities=new Entity();
33
        $entities=$entities->find("", "completename");
34
        $ancestors=array();
30
        $entities   = new Entity();
31
        $entities   = $entities->find("", "completename");
32
        $ancestors  = array();
35 33
        foreach ($entities as $entity) {
36
            $currentLevel=$entity["level"];
37
            if ($currentLevel==1 && isset($ancestors[1])) {
38
                $this->childrenEntity[]=$ancestors[1];
34
            $currentLevel = $entity["level"];
35
            if ($currentLevel == 1 && isset($ancestors[1])) {
36
                $this->childrenEntity[] = $ancestors[1];
39 37
            }
40 38
            $tempEntity = new VigiloGroups($entity["name"]);
41
            $ancestors[$currentLevel]=$tempEntity;
39
            $ancestors[$currentLevel] = $tempEntity;
42 40
            if ($currentLevel != 1) {
43
                $ancestors[$currentLevel-1]->addSubGroup($tempEntity);
41
                $ancestors[$currentLevel - 1]->addSubGroup($tempEntity);
44 42
            }
45 43
        }
46
        $this->childrenEntity[]=$ancestors[1];
44
        $this->childrenEntity[] = $ancestors[1];
47 45
    }
48 46

  
49 47
    protected function selectLocations()
50 48
    {
51
        global $DB;
52
        $locations=new Location();
53
        $locations=$locations->find("", "completename");
54
        $ancestors=array();
49
        $locations = new Location();
50
        $locations = $locations->find("", "completename");
51
        $ancestors = array();
55 52
        foreach ($locations as $location) {
56
            $currentLevel=$location["level"];
57
            if ($currentLevel==1 && isset($ancestors[1])) {
58
                $this->childrenLocation[]=$ancestors[1];
53
            $currentLevel = $location["level"];
54
            if ($currentLevel == 1 && isset($ancestors[1])) {
55
                $this->childrenLocation[] = $ancestors[1];
59 56
            }
60 57
            $tempLocation = new VigiloGroups($location["name"]);
61
            $ancestors[$currentLevel]=$tempLocation;
58
            $ancestors[$currentLevel] = $tempLocation;
62 59
            if ($currentLevel != 1) {
63
                $ancestors[$currentLevel-1]->addSubGroup($tempLocation);
60
                $ancestors[$currentLevel - 1]->addSubGroup($tempLocation);
64 61
            }
65 62
        }
66
        $this->childrenLocation[]=$ancestors[1];
63
        $this->childrenLocation[] = $ancestors[1];
67 64
    }
68 65
  
69 66
    public function __toString()
70 67
    {
71
        $outXML=new DOMdocument();
72
        $outXML->preserveWhiteSpace=false;
73
        $outXML->formatOutput=true;
68
        $outXML = new DOMDocument();
69
        $outXML->preserveWhiteSpace = false;
70
        $outXML->formatOutput       = true;
74 71
        $outXML->loadXML(
75 72
            self::sprintf(
76 73
                '<groups>

Also available in: Unified diff