-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathideas_exporttoexcel.php
236 lines (203 loc) · 6.03 KB
/
ideas_exporttoexcel.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?php
error_reporting(0);
/*
Place code to connect to your DB here.
*/
//include('config.php'); // include your code to connect to DB.
//include('header.php');
//include "header-main.php";
include "check-session.php";
include "connection.php";
$auth=$_SESSION['auth_no'];
if($auth==0)
{
echo "<h1>you are not authorised </h1>";
die;
}
//$filename = "ideagen_ideas"."_".date('Ymd_hi').".xlsx";
$filename = "ideagen_ideas"."_".date('Ymd_hi').".xls";
//header('Content-Transfer-Encoding: none');
header("Content-Type: text/plain");
header("Content-Type: application/vnd.ms-excel"); // This should work for IE & Opera
//header("Content-type: application/x-msexcel"); // This should work for the rest
//header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;"); // This is for saving in .xlsx format
//header("Content-Disposition: attachment; filename=\"$filename\"");
//header("Content-Type: application/vnd.ms-excel;charset=UTF-16LE");
//header("Content-Disposition:inline;filename=$filename;");
header("Content-Disposition:attachment;filename=$filename;");
?>
<head>
<style type="text/css">
p, td
{
font-family:"Calibri";
font-size:13px;
vertical-align: middle;
}
th
{
background-color:#6E6E6E;
border: 1px solid #6E6E6E;
color:#FFFFFF;
font-family:"Calibri";
font-size:14px;
}
#skillview
{
border: 2px solid #BDBDBD;
border-collapse:collapse;
}
#skillview td
{
background-color:#BDBDBD;
border: 1px solid #BDBDBD;
padding:3px 3px 2px 3px;
}
#skillview tr.alt td
{
background-color:#E6E6E6;
}
</style>
</head>
<?php
/* Query on the Asset Tag coming from View Asset Page to get the record */
$skillquery="SELECT * FROM csc_lr_experiment_req order by request_theme";
$result = mysql_query($skillquery) or die("Could not execute query because: ".mysql_error());
// if(mysql_num_rows($result))
// {
// echo "records are present!!!";
// }
// else
// {
// echo "No Record Present !!!";
// }
// $tmpCounter=1;
//while( ($skillrow = mysql_fetch_object($result)) > 0)
//{
?>
<br/><br/>
<table id="skillview">
<tr><th>S.No.</th><th>Request Theme</th><th>Experiment / Project</th><th>Overview</th><th>Category</th><th>Experiment Snapshot Status</th></tr>
<?php
$rowcnt=1;
while($row = mysql_fetch_array($result))
{
$sql="select meta_text from csc_lr_metadata where meta_name = 'CTO' and meta_type = 'request_theme' and meta_code = ".$row['request_theme'];
$request_themes=mysql_query($sql);
$reqtheme;
while($request_theme = mysql_fetch_array($request_themes))
{
$reqtheme = $request_theme['meta_text'];
}
//Use Case retrieval part starts here
/*
$sqluc="select meta_text from skill_metadata where meta_code=".$row['skill_usecase_id'];
$ucqry=mysql_query($sqluc);
$uctext;
while( $ucrow=mysql_fetch_array($ucqry) )
{
$uctext=$ucrow['meta_text'];
}
*/
//Use case retrieval part ends here
// Domain retrieval part starts here
/*
$domsql="select skill_id, domain_id from skill_domain_map where skill_id=".$row['id'];
$domresult=mysql_query($domsql);
$skilldomain=null;
while($skill_domsql = mysql_fetch_array($domresult))
{
$sql="select meta_text from skill_metadata where meta_name = 'CTO' and meta_type = 'skill_domain' and meta_code=".$skill_domsql['domain_id'];
$skill_domains=mysql_query($sql);
while($skill_domain = mysql_fetch_array($skill_domains))
{
if ($skilldomain == "")
{
$skilldomain = $skill_domain['meta_text'];
}
else
{
$skilldomain = $skilldomain . "," . $skill_domain['meta_text'];
}
}
}
*/
// Domain retrieval part ends here
//Skill Category retrieval starts here
$sql="select meta_text from csc_lr_metadata where meta_name = 'CTO' and meta_type = 'experiment_snapshot' and meta_code = ".$row['experiment_current_snapshot'];
$experiment_snapshots=mysql_query($sql);
$expsnapshot;
while($experiment_snapshot = mysql_fetch_array($experiment_snapshots))
{
$expsnapshot = $experiment_snapshot['meta_text'];
}
//Skill Category retrieval ends here
//Skill Status retrieval Starts here
/*$sql="select meta_text from rm_skill_metadata where meta_name = 'CTO' and meta_type = 'skill_status' and meta_code = ".$row['skill_status_id'];
$skill_platforms=mysql_query($sql);
$skillplatform;
while($skill_platform = mysql_fetch_array($skill_platforms))
{
$skillplatform = $skill_platform['meta_text'];
}
//Skill Status retrieval ends here
/*
$sql="select meta_text from skill_metadata where meta_name = 'CTO' and meta_type = 'skill_os' and meta_code = ".$row['skill_osid'];
$skill_oss=mysql_query($sql);
$skillos;
while($skill_os = mysql_fetch_array($skill_oss))
{
$skillos = $skill_os['meta_text'];
}
$sql="select meta_text from skill_metadata where meta_name = 'CTO' and meta_type = 'skill_certificate' and meta_code = ".$row['skill_certification'];
$skill_certificates=mysql_query($sql);
$skillcert;
while($skill_certificate = mysql_fetch_array($skill_certificates))
{
$skillcert = $skill_certificate['meta_text'];
}
*/
if ($rowcnt%2 == 1)
{
?>
<tr>
<td><?php print $rowcnt; ?></td>
<td><?php print $reqtheme; ?></td>
<td><?php print $row['expt_shortname']; ?></td>
<td><?php print $row['overview']; ?></td>
<td><?php print $row['idea_category']; ?></td>
<td><?php print $expsnapshot; ?></td>
</tr>
<?php
}
else
{
?>
<tr class="alt">
<td><?php print $rowcnt; ?></td>
<td><?php print $reqtheme; ?></td>
<td><?php print $row['expt_shortname']; ?></td>
<td><?php print $row['overview']; ?></td>
<td><?php print $row['idea_category']; ?></td>
<td><?php print $expsnapshot; ?></td>
</tr>
<?php
}
$rowcnt++;
}
?>
</table>
<br/><br/>
<?php
//}
?>
<?php
//include('footer.php');
//error handler function
function customError($errno, $errstr)
{
echo "<b>Error:</b> [$errno] $errstr";
}
//set error handler
set_error_handler("customError");
?>