-
Notifications
You must be signed in to change notification settings - Fork 7
/
exp_monitoring_user.php
70 lines (60 loc) · 2.21 KB
/
exp_monitoring_user.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
<?php
session_start();
error_reporting(E_ALL);
require_once '../plugins/excel/PHPExcel.php';
require_once '../config/config.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
if (isset($_SESSION['login']) and $_SESSION['login']==1) {
$user=$_SESSION['user'];
$x=mysql_query("select * from guru where username='$user'");
$y=mysql_fetch_array($x);
$id_guru=$y['id_guru'];
}
$query="select * from view_monitoring where id_guru='$id_guru' order by id_monitoring";
$hasil=mysql_query($query);
// Set properties
$objPHPExcel->getProperties()->setCreator("Muhammad Khoirul Umam")
->setLastModifiedBy("Muhammad Khoirul Umam")
->setTitle("Backup Data Monitoring")
->setSubject("Backup Data Monitoring")
->setDescription("Data Monitoring")
->setKeywords("Data Monitoring")
->setCategory("Monitoring");
// Add some data
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'No.')
->setCellValue('B1', 'Tanggal')
->setCellValue('C1', 'ID Guru')
->setCellValue('D1', 'Nama DU/DI')
->setCellValue('E1', 'Alamat')
->setCellValue('F1', 'Jenis Kegiatan')
->setCellValue('G1', 'Krtik & Saran');
$baris=2;
$no=0;
$nomer=1;
while($row=mysql_fetch_array($hasil)){
$no=$no 1;
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue("A$baris", $nomer)
->setCellValue("B$baris", $row['tgl'])
->setCellValue("C$baris", $row['id_guru'])
->setCellValue("D$baris", $row['nama_dudi'])
->setCellValue("E$baris", $row['alamat'])
->setCellValue("F$baris", $row['jns_keg'])
->setCellValue("G$baris", $row['kritik_saran']);
$baris = $baris 1;
$nomer ;
}
// Rename sheet
$objPHPExcel->getActiveSheet()->setTitle('Monitoring');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="Data Monitoring Perguru.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>