Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 215 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 215 Rev 231
1
<?php
1
<?php
2
class Ressources {
2
class Ressources {
3
 
3
 
4
	private $ressources = array();
4
	private $ressources = array();
5
 
5
 
6
	public function __construct(Array $ressources) {
6
	public function __construct(Array $ressources) {
7
		$this->ressources = $ressources;
7
		$this->ressources = $ressources;
8
	}
8
	}
9
 
9
 
10
	public function getParPosition($position) {
10
	public function getParPosition($position) {
11
		$valeur = '';
11
		$valeur = '';
12
		if (array_key_exists($position, $this->ressources)) {
12
		if (array_key_exists($position, $this->ressources)) {
13
			$valeur = $this->ressources[$position];
13
			$valeur = $this->ressources[$position];
14
		}
14
		}
15
		return $valeur;
15
		return $valeur;
16
	}
16
	}
17
 
17
 
18
	public function getNombre() {
18
	public function getNombre() {
19
		return count($this->ressources);
19
		return count($this->ressources);
20
	}
20
	}
21
 
21
 
22
	public function getProjetNom() {
22
	public function getProjetNom() {
23
		return $this->getParPosition(0);
23
		return $this->getParPosition(0);
24
	}
24
	}
25
 
25
 
26
	public function getServiceNom() {
26
	public function getServiceNom() {
27
		return $this->getParPosition(1);
27
		return $this->getParPosition(1);
28
	}
28
	}
29
 
29
 
30
	public function getDetailsId() {
30
	public function getDetailsId() {
31
		return (int) $this->getParPosition(2);
31
		return (int) $this->getParPosition(2);
32
	}
32
	}
33
 
33
 
34
	public function etreId($aTester) {
34
	public function etreId($aTester) {
35
		$etreId = is_numeric($aTester) ? true : false;
35
		$etreId = is_numeric($aTester) ? true : false;
36
		return $etreId;
36
		return $etreId;
37
	}
37
	}
38
 
38
 
39
	public function etreStats($aTester) {
39
	public function etreStats($aTester) {
40
		$etreStats = $aTester == 'stats' ? true : false;
40
		$etreStats = $aTester == 'stats' ? true : false;
41
		return $etreStats;
41
		return $etreStats;
42
	}
42
	}
43
 
43
 
44
	public function etreTypeDeStats($aTester) {
44
	public function etreTypeDeStats($aTester) {
45
		$typesStats = array('annees', 'rangs', 'initiales');
45
		$typesStats = array('annees', 'rangs', 'initiales');
46
		$etreStatsType = in_array($aTester, $typesStats) ? true : false;
46
		$etreStatsType = in_array($aTester, $typesStats) ? true : false;
47
		return $etreStatsType;
47
		return $etreStatsType;
48
	}
48
	}
49
 
49
 
50
	public function etreRelations($aTester) {
50
	public function etreRelations($aTester) {
51
		$etreRelations = $aTester == 'relations' ? true : false;
51
		$etreRelations = $aTester == 'relations' ? true : false;
52
		return $etreRelations;
52
		return $etreRelations;
53
	}
53
	}
54
 
54
 
55
	public function etreTypeDeRelations($aTester) {
55
	public function etreTypeDeRelations($aTester) {
56
		$typesRelations = array('synonymie', 'homonymie', 'flores');
56
		$typesRelations = array('synonymie', 'homonymie', 'flores');
57
		$etreRelationsType = in_array($aTester, $typesRelations) ? true : false;
57
		$etreRelationsType = in_array($aTester, $typesRelations) ? true : false;
58
		return $etreRelationsType;
58
		return $etreRelationsType;
59
	}
59
	}
60
 
60
 
61
	public function getServiceClasse() {
61
	public function getServiceClasse() {
62
		$classeNom = '';
62
		$classeNom = '';
63
		if ($this->getNombre() == 2) {
63
		if ($this->getNombre() == 2) {
64
			if ($this->getServiceNom() == 'noms') {
64
			if ($this->getServiceNom() == 'noms') {
65
				$classeNom = 'NomsListe';
65
				$classeNom = 'NomsListe';
66
			} else if ($this->getServiceNom() == 'taxons') {
66
			} else if ($this->getServiceNom() == 'taxons') {
67
				$classeNom = 'TaxonsListe';
67
				$classeNom = 'TaxonsListe';
-
 
68
			} else if ($this->getServiceNom() == 'ontologies') {
-
 
69
				$classeNom = 'OntologiesListe';
68
			}
70
			}
69
 
71
 
70
		} else if ($this->getNombre() == 3) {
72
		} else if ($this->getNombre() == 3) {
71
			$position3 = $this->getParPosition(2);
73
			$position3 = $this->getParPosition(2);
72
			if ($this->etreId($position3)) {
74
			if ($this->etreId($position3)) {
73
				if ($this->getServiceNom() == 'noms') {
75
				if ($this->getServiceNom() == 'noms') {
74
					$classeNom = 'NomDetails';
76
					$classeNom = 'NomDetails';
75
				} else if ($this->getServiceNom() == 'taxons') {
77
				} else if ($this->getServiceNom() == 'taxons') {
76
					$classeNom = 'TaxonDetails';
78
					$classeNom = 'TaxonDetails';
77
				}
79
				}
78
			}
80
			}
79
		} else if ($this->getNombre() == 4) {
81
		} else if ($this->getNombre() == 4) {
80
			$position3 = $this->getParPosition(2);
82
			$position3 = $this->getParPosition(2);
81
			$position4 = $this->getParPosition(3);
83
			$position4 = $this->getParPosition(3);
82
			if ($this->etreStats($position3)) {
84
			if ($this->etreStats($position3)) {
83
				if ($this->etreTypeDeStats($position4)) {
85
				if ($this->etreTypeDeStats($position4)) {
84
					$classeNom = 'NomsStats'.ucfirst($position4);
86
					$classeNom = 'NomsStats'.ucfirst($position4);
85
				}
87
				}
86
			} else if ($this->etreId($position3)) {
88
			} else if ($this->etreId($position3)) {
87
				if ($this->etreRelations($position4)) {
89
				if ($this->etreRelations($position4)) {
88
					$classeNom = 'NomRelations';
90
					$classeNom = 'NomRelations';
89
				}
91
				}
90
			}
92
			}
91
		} else if ($this->getNombre() == 5) {
93
		} else if ($this->getNombre() == 5) {
92
			$position3 = $this->getParPosition(2);
94
			$position3 = $this->getParPosition(2);
93
			$position4 = $this->getParPosition(3);
95
			$position4 = $this->getParPosition(3);
94
			$position5 = $this->getParPosition(4);
96
			$position5 = $this->getParPosition(4);
95
			if ($this->etreId($position3)) {
97
			if ($this->etreId($position3)) {
96
				if ($this->etreRelations($position4)) {
98
				if ($this->etreRelations($position4)) {
97
					if ($this->etreTypeDeRelations($position5)) {
99
					if ($this->etreTypeDeRelations($position5)) {
98
						$classeNom = 'NomRelations'.ucfirst($position5);
100
						$classeNom = 'NomRelations'.ucfirst($position5);
99
					}
101
					}
100
				}
102
				}
101
			}
103
			}
102
		}
104
		}
103
		return $classeNom;
105
		return $classeNom;
104
	}
106
	}
105
}
107
}
106
?>
108
?>