예제 #1
0
 function getSettings($f3)
 {
     $db = $f3->get('db');
     $dbResults = DbWrapper::getAllEinstellungen($db);
     $settings = array();
     foreach ($dbResults as $setting) {
         $settings[$setting['name']] = $setting['wert'];
     }
     $f3->set('settings', $settings);
 }
예제 #2
0
 public static function exportToExcel2007($db, $exportFileName)
 {
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("Lechner Michael");
     $objPHPExcel->getProperties()->setLastModifiedBy("Lechner Michael");
     $objPHPExcel->getProperties()->setTitle("Datenbankexport " . date('d.m.Y H:hi:m'));
     $objPHPExcel->getProperties()->setSubject("Datenbankexport");
     $objPHPExcel->getProperties()->setDescription("Datenbankexport");
     $objPHPExcel->setActiveSheetIndex(0);
     $activeSheet = $objPHPExcel->getActiveSheet();
     $activeSheet->setTitle('LEHRER');
     $activeSheet->SetCellValue('A1', 'lehrer_id');
     $activeSheet->SetCellValue('B1', 'name');
     $activeSheet->SetCellValue('C1', 'raum');
     $activeSheet->SetCellValue('D1', 'klassen');
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $activeSheet->getColumnDimension('C')->setAutoSize(true);
     $activeSheet->getColumnDimension('D')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllLehrer($db) as $lehrer) {
         $activeSheet->SetCellValue('A' . $rowCounter, $lehrer['lehrer_id']);
         $activeSheet->SetCellValue('B' . $rowCounter, $lehrer['name']);
         $activeSheet->SetCellValue('C' . $rowCounter, $lehrer['raum']);
         $activeSheet->SetCellValue('D' . $rowCounter, $lehrer['klassen']);
         // $objPHPExcel->getActiveSheet()->SetCellValue('D'.$rowCounter, json_encode($lehrer));
         $rowCounter = $rowCounter + 1;
     }
     $activeSheet = $objPHPExcel->createSheet();
     $activeSheet->setTitle('SCHUELER');
     $activeSheet->SetCellValue('A1', 'schueler_id');
     $activeSheet->SetCellValue('B1', 'name');
     $activeSheet->SetCellValue('C1', 'klasse');
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $activeSheet->getColumnDimension('C')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllSchueler($db) as $schueler) {
         $activeSheet->SetCellValue('A' . $rowCounter, $schueler['schueler_id']);
         $activeSheet->SetCellValue('B' . $rowCounter, $schueler['name']);
         $activeSheet->SetCellValue('C' . $rowCounter, $schueler['klasse']);
         $rowCounter = $rowCounter + 1;
     }
     $activeSheet = $objPHPExcel->createSheet();
     $activeSheet->setTitle('ZEITEN');
     $activeSheet->SetCellValue('A1', 'zeit_id');
     $activeSheet->SetCellValue('B1', 'zeit');
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllZeiten($db) as $zeit) {
         $activeSheet->SetCellValue('A' . $rowCounter, $zeit['zeit_id']);
         $activeSheet->SetCellValue('B' . $rowCounter, $zeit['zeit']);
         $rowCounter = $rowCounter + 1;
     }
     $activeSheet = $objPHPExcel->createSheet();
     $activeSheet->setTitle('EINSTELLUNGEN');
     $activeSheet->SetCellValue('A1', 'name');
     $activeSheet->SetCellValue('B1', 'wert');
     $activeSheet->getColumnDimension('A')->setAutoSize(true);
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllEinstellungen($db) as $einstellung) {
         $activeSheet->SetCellValue('A' . $rowCounter, $einstellung['name']);
         $activeSheet->SetCellValue('B' . $rowCounter, $einstellung['wert']);
         $rowCounter = $rowCounter + 1;
     }
     $activeSheet = $objPHPExcel->createSheet();
     $activeSheet->setTitle('SPERRUNGEN');
     $activeSheet->SetCellValue('A1', 'lehrer_id');
     $activeSheet->SetCellValue('B1', 'zeit_id');
     $activeSheet->getColumnDimension('A')->setAutoSize(true);
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllSperrungen($db) as $sperrung) {
         $activeSheet->SetCellValue('A' . $rowCounter, $sperrung['lehrer_id']);
         $activeSheet->SetCellValue('B' . $rowCounter, $sperrung['zeit_id']);
         $rowCounter = $rowCounter + 1;
     }
     $activeSheet = $objPHPExcel->createSheet();
     $activeSheet->setTitle('RESERVIERUNGEN');
     $activeSheet->SetCellValue('A1', 'lehrer_id');
     $activeSheet->SetCellValue('B1', 'zeit_id');
     $activeSheet->SetCellValue('C1', 'schueler_id');
     $activeSheet->getColumnDimension('A')->setAutoSize(true);
     $activeSheet->getColumnDimension('B')->setAutoSize(true);
     $activeSheet->getColumnDimension('C')->setAutoSize(true);
     $rowCounter = 2;
     foreach (DbWrapper::getAllReservierungen($db) as $reservierung) {
         $activeSheet->SetCellValue('A' . $rowCounter, $reservierung['lehrer_id']);
         $activeSheet->SetCellValue('B' . $rowCounter, $reservierung['zeit_id']);
         $activeSheet->SetCellValue('C' . $rowCounter, $reservierung['schueler_id']);
         $rowCounter = $rowCounter + 1;
     }
     $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
     $objWriter->save($exportFileName);
 }