-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_data.php
executable file
·103 lines (100 loc) · 3.95 KB
/
get_data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
$student_data = array();
$dataFiles = scandir('data');
foreach ($dataFiles as $filename){
if ($filename == '.' or $filename == '..')
continue;
if ($filename == 'phd.json'){
$jsonString = file_get_contents('data/phd.json');
$data = json_decode($jsonString);
foreach ($data as $row){
if($row->b == '' || $row->c =='')
continue;
$student_row=[$row->b, $row->c, 'Ph.D', 0, 0];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'mba.json'){
$jsonString = file_get_contents('data/mba.json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'MBA', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'ipgmba.json'){
$jsonString = file_get_contents('data/ipgmba.json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'IPG-MBA', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'mtech(an).json'){
$jsonString = file_get_contents('data/mtech(an).json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'M.Tech(AN)', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'mtech(dc).json'){
$jsonString = file_get_contents('data/mtech(dc).json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'M.Tech(DC)', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'mtech(is).json'){
$jsonString = file_get_contents('data/mtech(is).json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'M.Tech(IS)', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'mtech(vlsi).json'){
$jsonString = file_get_contents('data/mtech(vlsi).json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'M.Tech(VLSI)', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
elseif ($filename == 'ipgmtech.json'){
$jsonString = file_get_contents('data/ipgmtech.json');
$data = json_decode($jsonString);
$start_year = $data->start_year;
$end_year = $data->end_year;
foreach ($data->data as $row){
if($row->b == '' || $row->c =='') continue;
$student_row=[$row->b, $row->c, 'IPG-M.Tech', $start_year, $end_year];
array_push($student_data, $student_row);
}
}
}
$courses = array('Ph.D', 'MBA', 'IPG-MBA', 'M.Tech(AN)','M.Tech(IS)','M.Tech(DC)','M.Tech(VLSI)', 'IPG-M.Tech');
$data = array(
'student_data'=>$student_data,
'courses'=>$courses
);
echo json_encode($data);