view_career_unit.php 2.25 KB
Newer Older
Thomas Fradet's avatar
Thomas Fradet committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

$careerId = required_param("career", PARAM_INT);
global $DB;
$requete = $DB->get_record_sql('SELECT * FROM {block_career} WHERE id = ?', array($careerId));

$percent = 70;
$nb_pers = 5;
$titre = $requete->name;
$presence = "En présence";
$date = "24 nov";
$intro = $requete->description;
$img = '';
$titre_module = "Introduction";

$elements = $requete->ressources;
$elements = explode(',', $elements);
$sections = array();
$ressources = array();
$i = 0;
foreach ($elements as $value) {
Thomas Fradet's avatar
Thomas Fradet committed
22
23
24
25
26
	$ressource = new block_career_ressource();
	$ressource->get_ressource_by_id($value);
	$sections[$i] = $ressource->section;
	$ressources[$i] = $ressource;
	$i++;
Thomas Fradet's avatar
Thomas Fradet committed
27
28
29
30
31
}
//var_dump($sections);
//Supprime les doublons
for($i = 0; $i < count($sections);$i++)
{
Thomas Fradet's avatar
Thomas Fradet committed
32
33
	$temp = $i;
	$temp++;
Thomas Fradet's avatar
Thomas Fradet committed
34

Thomas Fradet's avatar
Thomas Fradet committed
35
36
37
38
39
40
41
	if ($temp != count($sections))
	{
		if ($sections[$i]->id == $sections[$temp]->id)
		{
			unset($sections[$i]);
		}
	}
Thomas Fradet's avatar
Thomas Fradet committed
42
43
44
45
46
47
}

//Met dans l'orde
$keys = array();
$i = 0;
foreach ($sections as $value){
Thomas Fradet's avatar
Thomas Fradet committed
48
49
	$keys[$i] = $value->orde;
	$i++;
Thomas Fradet's avatar
Thomas Fradet committed
50
51
52
53
54
55
56
57
58
}
$sections = array_combine($keys,$sections);
ksort($sections);


?>


<section class="section">
Thomas Fradet's avatar
Thomas Fradet committed
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	<h2 class="display-3"><?=$titre;?></h2>
	<div class="iena-carrer-path-descr wrapper">
		<?php echo $intro; ?>
	</div>
	<?php foreach ($sections as $section) : ?>
		<div style="margin-bottom: 0rem; margin-top: 1rem;">
			<div class="career-section-title">
				<h3><?php echo $section->name; ?></h3>
			</div>
			<div class="iena-career-description wrapper">
				<?php echo $section->intro; ?>
			</div>
			<div class="list-group">
				<?php foreach ($ressources as $value) : ?>
					<?php if($value->section->id == $section->id) : ?>
						<a href="<?php echo "$value->link&career=$careerId" ?>" class="list-group-item list-group-item-action flex-column align-items-start">
							<div class="d-flex w-100 justify-content-between">
								<h5 class="mb-1">
									<?php echo $value->name;?>
								</h5>
								<img class="" alt="" src="<?php echo $CFG->wwwroot ?>/theme/image.php/boost/<?php echo $value->type ?>/1/icon>">
							</div>
							<!-- <div><?php echo $value->descrition;?></div> -->
						</a>
					<?php endif;?>
				<?php endforeach;?>
			</div>
		</div>
	<?php endforeach;?>
Thomas Fradet's avatar
Thomas Fradet committed
88

Thomas Fradet's avatar
Thomas Fradet committed
89
</section>