Completed
Push — master ( 1fd7e7...a2c36e )
by Andrzej
03:49
created
src/WP/Menu.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Menu
4
- *
5
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
- *
8
- * Permission is hereby granted to use or copy this program
9
- * for any purpose, provided the above notices are retained on all copies.
10
- * Permission to modify the code and to distribute modified code is granted,
11
- * provided the above notices are retained, and a notice that the code was
12
- * modified is included with the above copyright notice.
13
- *
14
- * @category  Wp
15
- * @package   Punction
16
- * @author    Andrzej Marcinkowski <[email protected]>
17
- * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
- * @license   MIT http://opensource.org/licenses/MIT
19
- * @version   1.0 $Format:%H$
20
- * @link      http://
21
- * @since     File available since Release 1.0.0
22
- * PHP Version 5
23
- */
3
+     * Menu
4
+     *
5
+     * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
+     * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
+     *
8
+     * Permission is hereby granted to use or copy this program
9
+     * for any purpose, provided the above notices are retained on all copies.
10
+     * Permission to modify the code and to distribute modified code is granted,
11
+     * provided the above notices are retained, and a notice that the code was
12
+     * modified is included with the above copyright notice.
13
+     *
14
+     * @category  Wp
15
+     * @package   Punction
16
+     * @author    Andrzej Marcinkowski <[email protected]>
17
+     * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
+     * @license   MIT http://opensource.org/licenses/MIT
19
+     * @version   1.0 $Format:%H$
20
+     * @link      http://
21
+     * @since     File available since Release 1.0.0
22
+     * PHP Version 5
23
+     */
24 24
 namespace Hospitalplugin\WP;
25 25
 
26 26
 /**
Please login to merge, or discard this patch.
src/WP/ScriptsAndStyles.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * ScriptsAndStyles
4
- *
5
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
- *
8
- * Permission is hereby granted to use or copy this program
9
- * for any purpose, provided the above notices are retained on all copies.
10
- * Permission to modify the code and to distribute modified code is granted,
11
- * provided the above notices are retained, and a notice that the code was
12
- * modified is included with the above copyright notice.
13
- *
14
- * @category  Wp
15
- * @package   Punction
16
- * @author    Andrzej Marcinkowski <[email protected]>
17
- * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
- * @license   MIT http://opensource.org/licenses/MIT
19
- * @version   1.0  $Format:%H$
20
- * @link      http://
21
- * @since     File available since Release 1.0.0
22
- * PHP Version 5
23
- */
3
+     * ScriptsAndStyles
4
+     *
5
+     * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
+     * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
+     *
8
+     * Permission is hereby granted to use or copy this program
9
+     * for any purpose, provided the above notices are retained on all copies.
10
+     * Permission to modify the code and to distribute modified code is granted,
11
+     * provided the above notices are retained, and a notice that the code was
12
+     * modified is included with the above copyright notice.
13
+     *
14
+     * @category  Wp
15
+     * @package   Punction
16
+     * @author    Andrzej Marcinkowski <[email protected]>
17
+     * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
+     * @license   MIT http://opensource.org/licenses/MIT
19
+     * @version   1.0  $Format:%H$
20
+     * @link      http://
21
+     * @since     File available since Release 1.0.0
22
+     * PHP Version 5
23
+     */
24 24
 namespace Hospitalplugin\WP;
25 25
 
26 26
 /**
Please login to merge, or discard this patch.
src/utils/ExcelExport.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -7,119 +7,119 @@
 block discarded – undo
7 7
 
8 8
 class ExcelExport {
9 9
 	
10
-	/**
11
-	 */
12
-	public static function init() {
13
-		add_action ( 'admin_init', array (
14
-				'Hospitalplugin\utils\ExcelExport',
15
-				'excel_export' 
16
-		), 1 );
17
-	}
18
-	/**
19
-	 * 
20
-	 */
21
-	public static function getColumnLetter($num) {
22
-		return chr ( 65 + $num );
23
-	}
24
-	/**
25
-	 */
26
-	static function excel_export() {
27
-		if (! isset ( $_POST ['excel'] )) {
28
-			return;
29
-		} else {
30
-			// dataSetName: Infections, Punction
31
-			$dataSetName = $_POST ['dataSetName'];
32
-			$classname = '\Hospitalplugin\utils\ExcelExport' . $dataSetName;
33
-		}
10
+    /**
11
+     */
12
+    public static function init() {
13
+        add_action ( 'admin_init', array (
14
+                'Hospitalplugin\utils\ExcelExport',
15
+                'excel_export' 
16
+        ), 1 );
17
+    }
18
+    /**
19
+     * 
20
+     */
21
+    public static function getColumnLetter($num) {
22
+        return chr ( 65 + $num );
23
+    }
24
+    /**
25
+     */
26
+    static function excel_export() {
27
+        if (! isset ( $_POST ['excel'] )) {
28
+            return;
29
+        } else {
30
+            // dataSetName: Infections, Punction
31
+            $dataSetName = $_POST ['dataSetName'];
32
+            $classname = '\Hospitalplugin\utils\ExcelExport' . $dataSetName;
33
+        }
34 34
 		
35
-		$objPHPExcel = new \PHPExcel ();
36
-		$classname::fillData ( $objPHPExcel );
35
+        $objPHPExcel = new \PHPExcel ();
36
+        $classname::fillData ( $objPHPExcel );
37 37
 		
38
-		ExcelExport::downloadExcel ( $objPHPExcel, $dataSetName . '.xlsx' );
39
-	}
40
-	/**
41
-	 */
42
-	static function cellColor($objPHPExcel, $cells, $color) {
43
-		$objPHPExcel->getActiveSheet ()->getStyle ( $cells )->getFill ()->applyFromArray ( array (
44
-				'type' => \PHPExcel_Style_Fill::FILL_SOLID,
45
-				'startcolor' => array (
46
-						'rgb' => $color 
47
-				) 
48
-		) );
49
-	}
50
-	/**
51
-	 */
52
-	static function styleActiveSheet($objPHPExcel) {
53
-		$objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getFont ()->setName ( 'Arial' )->setSize ( 8 )->setBold ( false );
54
-		$objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getNumberFormat ()->setFormatCode ( \PHPExcel_Style_NumberFormat::FORMAT_TEXT );
55
-		$objPHPExcel->getActiveSheet ()->freezePane ( 'A3' );
56
-		$style = array (
57
-				'alignment' => array (
58
-						'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
59
-						'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER 
60
-				) 
61
-		);
62
-		$objWorksheet = $objPHPExcel->getActiveSheet ();
63
-		$objWorksheet->getDefaultStyle ()->applyFromArray ( $style );
64
-		$objWorksheet->getStyle ( 'A1:AA2' )->getFont ()->setBold ( true );
65
-		for($col = ord ( 'a' ); $col <= ord ( 'z' ); $col ++) {
66
-			$objWorksheet->getColumnDimension ( chr ( $col ) )->setAutoSize ( true );
67
-		}
68
-		return $objPHPExcel;
69
-	}
70
-	/**
71
-	 *
72
-	 * @param unknown $objPHPExcel        	
73
-	 */
74
-	private static function downloadExcel($objPHPExcel, $filename) {
75
-		ob_end_clean ();
76
-		ob_start ();
77
-		header ( "Content-type: application/vnd.ms-excel; charset=utf-8" );
78
-		header ( "Content-Transfer-Encoding: binary" );
79
-		header ( "Content-Description: File Transfer" );
80
-		header ( "Content-Disposition: attachment; filename=\"" . $filename . "\"" );
81
-		header ( "Cache-Control: max-age=0" );
82
-		header ( "Expires: 0" );
83
-		header ( "Pragma: no-cache" );
38
+        ExcelExport::downloadExcel ( $objPHPExcel, $dataSetName . '.xlsx' );
39
+    }
40
+    /**
41
+     */
42
+    static function cellColor($objPHPExcel, $cells, $color) {
43
+        $objPHPExcel->getActiveSheet ()->getStyle ( $cells )->getFill ()->applyFromArray ( array (
44
+                'type' => \PHPExcel_Style_Fill::FILL_SOLID,
45
+                'startcolor' => array (
46
+                        'rgb' => $color 
47
+                ) 
48
+        ) );
49
+    }
50
+    /**
51
+     */
52
+    static function styleActiveSheet($objPHPExcel) {
53
+        $objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getFont ()->setName ( 'Arial' )->setSize ( 8 )->setBold ( false );
54
+        $objPHPExcel->getActiveSheet ()->getDefaultStyle ()->getNumberFormat ()->setFormatCode ( \PHPExcel_Style_NumberFormat::FORMAT_TEXT );
55
+        $objPHPExcel->getActiveSheet ()->freezePane ( 'A3' );
56
+        $style = array (
57
+                'alignment' => array (
58
+                        'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
59
+                        'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER 
60
+                ) 
61
+        );
62
+        $objWorksheet = $objPHPExcel->getActiveSheet ();
63
+        $objWorksheet->getDefaultStyle ()->applyFromArray ( $style );
64
+        $objWorksheet->getStyle ( 'A1:AA2' )->getFont ()->setBold ( true );
65
+        for($col = ord ( 'a' ); $col <= ord ( 'z' ); $col ++) {
66
+            $objWorksheet->getColumnDimension ( chr ( $col ) )->setAutoSize ( true );
67
+        }
68
+        return $objPHPExcel;
69
+    }
70
+    /**
71
+     *
72
+     * @param unknown $objPHPExcel        	
73
+     */
74
+    private static function downloadExcel($objPHPExcel, $filename) {
75
+        ob_end_clean ();
76
+        ob_start ();
77
+        header ( "Content-type: application/vnd.ms-excel; charset=utf-8" );
78
+        header ( "Content-Transfer-Encoding: binary" );
79
+        header ( "Content-Description: File Transfer" );
80
+        header ( "Content-Disposition: attachment; filename=\"" . $filename . "\"" );
81
+        header ( "Cache-Control: max-age=0" );
82
+        header ( "Expires: 0" );
83
+        header ( "Pragma: no-cache" );
84 84
 		
85
-		$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel2007' );
86
-		$objWriter->setPreCalculateFormulas ( true );
87
-		$objWriter->save ( 'php://output' );
88
-		exit ();
89
-	}
90
-	/**
91
-	 * remove special chars and words from string 
92
-	 * @param unknown $string        	
93
-	 */
94
-	private static function clearName($string, $removeWords) {
95
-		$string = str_replace ( ' ', '-', $string );
96
-		$string = preg_replace ( '/[^A-Za-z0-9\-]/', '', $string );
97
-		foreach ( $removeWords as $word ) {
98
-			$string = str_replace ( $word, '', $string );
99
-		}
100
-		$string = substr ( $string, 0, 29 );
101
-		return $string;
102
-	}
103
-	/**
104
-	 * @param unknown $objPHPExcel        	
105
-	 * @param unknown $title        	
106
-	 */
107
-	static function printTitle($objPHPExcel, $title) {
108
-		$objPHPExcel->getActiveSheet ()->setTitle ( ExcelExport::clearName ( $title, array('ddzia') ), true );
109
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
110
-	}
111
-	/**
112
-	 *
113
-	 * @param unknown $objPHPExcel
114
-	 */
115
-	static function newSheet($objPHPExcel, $index = -1) {
116
-		if ($index < 0) {
117
-			$index = $objPHPExcel->getSheetCount ();
118
-		}
119
-		$objPHPExcel->createSheet ( $index );
120
-		$objPHPExcel->setActiveSheetIndex ( $index );
121
-		$sheet = $objPHPExcel->getActiveSheet ();
122
-		return $sheet;
123
-	}
85
+        $objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel2007' );
86
+        $objWriter->setPreCalculateFormulas ( true );
87
+        $objWriter->save ( 'php://output' );
88
+        exit ();
89
+    }
90
+    /**
91
+     * remove special chars and words from string 
92
+     * @param unknown $string        	
93
+     */
94
+    private static function clearName($string, $removeWords) {
95
+        $string = str_replace ( ' ', '-', $string );
96
+        $string = preg_replace ( '/[^A-Za-z0-9\-]/', '', $string );
97
+        foreach ( $removeWords as $word ) {
98
+            $string = str_replace ( $word, '', $string );
99
+        }
100
+        $string = substr ( $string, 0, 29 );
101
+        return $string;
102
+    }
103
+    /**
104
+     * @param unknown $objPHPExcel        	
105
+     * @param unknown $title        	
106
+     */
107
+    static function printTitle($objPHPExcel, $title) {
108
+        $objPHPExcel->getActiveSheet ()->setTitle ( ExcelExport::clearName ( $title, array('ddzia') ), true );
109
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
110
+    }
111
+    /**
112
+     *
113
+     * @param unknown $objPHPExcel
114
+     */
115
+    static function newSheet($objPHPExcel, $index = -1) {
116
+        if ($index < 0) {
117
+            $index = $objPHPExcel->getSheetCount ();
118
+        }
119
+        $objPHPExcel->createSheet ( $index );
120
+        $objPHPExcel->setActiveSheetIndex ( $index );
121
+        $sheet = $objPHPExcel->getActiveSheet ();
122
+        return $sheet;
123
+    }
124 124
 	
125 125
 }
126 126
\ No newline at end of file
Please login to merge, or discard this patch.
src/utils/ExcelExportInfections.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -6,62 +6,62 @@
 block discarded – undo
6 6
 use Hospitalplugin\Entities\Infections;
7 7
 
8 8
 class ExcelExportInfections {
9
-	private static function getData() {
10
-		$wardId = (! empty ( $_POST ['wardId'] ) ? $_POST ['wardId'] : 0);
11
-		$date = (! empty ( $_POST ['date'] ) ? $_POST ['date'] : (new \DateTime ())->format ( "Y-m" ));
12
-		$from = new \DateTime ( $date . '-01' );
13
-		$fromStr = $from->format ( 'Y-m-01' );
14
-		$toStr = $from->format ( 'Y-m-t' );
15
-		$infections = InfectionsCRUD::getInfections ( $fromStr, $toStr, $wardId, 'Infections' );
16
-		return $infections;
17
-	}
18
-	private static function getColumns() {
19
-		return Infections::getFields ();
20
-	}
21
-	private static function printHeaders($objPHPExcel, $cols) {
22
-		$count = 0;
23
-		foreach ( $cols as $col => $sym ) {
24
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
25
-		}
26
-	}
27
-	/**
28
-	 */
29
-	private static function printData($objPHPExcel, $data, $cols) {
30
-		$row = 3;
31
-		foreach ( $data as $rowValue ) {
32
-			$count = 0;
33
-			foreach ( $cols as $col => $sym ) {
34
-				$value = $rowValue->$sym;
35
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
36
-			}
37
-			$row ++;
38
-		}
39
-		return $row;
40
-	}
41
-	private static function printTitle($objPHPExcel, $title) {
42
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
43
-	}
44
-	/**
45
-	 *
46
-	 * @param PHPExcel $objPHPExcel        	
47
-	 */
48
-	private static function printFooter($objPHPExcel, $cols, $row) {
49
-		$objPHPExcel->getActiveSheet ()->getStyle ( 'A' . $row . ':AA' . ($row + 1) )->getFont ()->setBold ( true );
50
-		// SUM
51
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, $row, "SUMA" );
52
-		for($i = 2; $i < count ( $cols ); $i ++) {
53
-			$colLetter = chr ( 65 + $i );
54
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $i, $row, "=sum(" . $colLetter . "3" . ":" . $colLetter . ($row - 1) . ")" );
55
-		}
56
-		ExcelExport::cellColor ( $objPHPExcel, 'A' . $row . ':AA' . ($row + 1), 'DDDDDD' );
57
-	}
58
-	static function fillData($objPHPExcel) {
59
-		$data = ExcelExportInfections::getData ();
60
-		$cols = ExcelExportInfections::getColumns ();
9
+    private static function getData() {
10
+        $wardId = (! empty ( $_POST ['wardId'] ) ? $_POST ['wardId'] : 0);
11
+        $date = (! empty ( $_POST ['date'] ) ? $_POST ['date'] : (new \DateTime ())->format ( "Y-m" ));
12
+        $from = new \DateTime ( $date . '-01' );
13
+        $fromStr = $from->format ( 'Y-m-01' );
14
+        $toStr = $from->format ( 'Y-m-t' );
15
+        $infections = InfectionsCRUD::getInfections ( $fromStr, $toStr, $wardId, 'Infections' );
16
+        return $infections;
17
+    }
18
+    private static function getColumns() {
19
+        return Infections::getFields ();
20
+    }
21
+    private static function printHeaders($objPHPExcel, $cols) {
22
+        $count = 0;
23
+        foreach ( $cols as $col => $sym ) {
24
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
25
+        }
26
+    }
27
+    /**
28
+     */
29
+    private static function printData($objPHPExcel, $data, $cols) {
30
+        $row = 3;
31
+        foreach ( $data as $rowValue ) {
32
+            $count = 0;
33
+            foreach ( $cols as $col => $sym ) {
34
+                $value = $rowValue->$sym;
35
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
36
+            }
37
+            $row ++;
38
+        }
39
+        return $row;
40
+    }
41
+    private static function printTitle($objPHPExcel, $title) {
42
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
43
+    }
44
+    /**
45
+     *
46
+     * @param PHPExcel $objPHPExcel        	
47
+     */
48
+    private static function printFooter($objPHPExcel, $cols, $row) {
49
+        $objPHPExcel->getActiveSheet ()->getStyle ( 'A' . $row . ':AA' . ($row + 1) )->getFont ()->setBold ( true );
50
+        // SUM
51
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, $row, "SUMA" );
52
+        for($i = 2; $i < count ( $cols ); $i ++) {
53
+            $colLetter = chr ( 65 + $i );
54
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $i, $row, "=sum(" . $colLetter . "3" . ":" . $colLetter . ($row - 1) . ")" );
55
+        }
56
+        ExcelExport::cellColor ( $objPHPExcel, 'A' . $row . ':AA' . ($row + 1), 'DDDDDD' );
57
+    }
58
+    static function fillData($objPHPExcel) {
59
+        $data = ExcelExportInfections::getData ();
60
+        $cols = ExcelExportInfections::getColumns ();
61 61
 		
62
-		ExcelExportInfections::printTitle ( $objPHPExcel, "Raport" );
63
-		ExcelExportInfections::printHeaders ( $objPHPExcel, $cols );
64
-		$lastRow = ExcelExportInfections::printData ( $objPHPExcel, $data, $cols );
65
-		ExcelExportInfections::printFooter ( $objPHPExcel, $cols, $lastRow );
66
-	}
62
+        ExcelExportInfections::printTitle ( $objPHPExcel, "Raport" );
63
+        ExcelExportInfections::printHeaders ( $objPHPExcel, $cols );
64
+        $lastRow = ExcelExportInfections::printData ( $objPHPExcel, $data, $cols );
65
+        ExcelExportInfections::printFooter ( $objPHPExcel, $cols, $lastRow );
66
+    }
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
src/utils/ExcelExportPunction.php 1 patch
Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -9,133 +9,133 @@
 block discarded – undo
9 9
 
10 10
 class ExcelExportPunction {
11 11
 	
12
-	/**
13
-	 *
14
-	 * @param unknown $id        	
15
-	 */
16
-	private static function getData($id, $type) {
17
-		$raport = PatientRaport::getRaportBetweenDates ( $id, $type, '2014-06-01', (new \DateTime ())->format ( "Y-m-d" ) );
18
-		return $raport;
19
-	}
20
-	/**
21
-	 *
22
-	 * @param unknown $objPHPExcel        	
23
-	 * @param unknown $cols        	
24
-	 */
25
-	private static function printHeaders($objPHPExcel, $cols) {
26
-		$count = 1;
27
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 2, "Data" );
28
-		foreach ( $cols as $col ) {
29
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
30
-		}
31
-	}
32
-	/**
33
-	 */
34
-	private static function printData($objPHPExcel, $data, $type) {
35
-		$row = 3;
36
-		$lastColumn = 1;
37
-		$colNumberOfPatients = ExcelExport::getColumnLetter ( 1 );
38
-		$indexes = PatientRaport::getIndexes ( $type );
39
-		foreach ( $data as $rowKey => $rowValue ) {
40
-			// 1 col: date
41
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row, json_encode ( $rowKey ) );
42
-			$count = 1;
43
-			// 2-5 cols: N1 N2 N3 N0
44
-			foreach ( $indexes as $index ) {
45
-				$value = isset ( $rowValue [$index] ) ? $rowValue [$index] : "0";
46
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
47
-			}
48
-			// 6 col: num of categorized (N = N1+N2+N3)
49
-			$colHighestCategory = ExcelExport::getColumnLetter ( $count - 2 );
50
-			$colNumberOfPatients = ExcelExport::getColumnLetter ( $count );
51
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(B' . $row . ':' . $colHighestCategory . $row . ')' );
52
-			$tpb = PatientRaport::getTpb ( $type );
53
-			// 7-11 tpb1, tpb2, tpb3, 0 (no-cat), 2 (add)
54
-			foreach ( $tpb as $tpbn ) {
55
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $tpbn );
56
-			}
57
-			// 9-11: Tpb1*N1,Tpb2*N2,Tpb3*N3+2xN
58
-			$tpbSize = count ( $tpb );
59
-			foreach ( $tpb as $tpbn ) {
60
-				$col1Letter = ExcelExport::getColumnLetter ( $count - 2 * $tpbSize );
61
-				$col2Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
62
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=' . $col1Letter . $row . "*" . $col2Letter . $row );
63
-			}
64
-			// SUM Tpb
65
-			$col3Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
66
-			$col4Letter = ExcelExport::getColumnLetter ( $count - 1 );
67
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(' . $col3Letter . $row . ":" . $col4Letter . $row . ")" );
68
-			$row ++;
69
-			$lastColumn = $count - 1;
70
-		}
71
-		// number of categorization days
72
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, 1, '=COUNTIFS(' . $colNumberOfPatients . '3:' . $colNumberOfPatients . ($row - 1) . ',">0")' );
73
-		// sum
74
-		$col5Letter = ExcelExport::getColumnLetter ( $lastColumn );
75
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 2, 1, '=SUM(' . $col5Letter . '3:' . $col5Letter . ($row - 1) . ')/60' );
76
-		return $row;
77
-	}
12
+    /**
13
+     *
14
+     * @param unknown $id        	
15
+     */
16
+    private static function getData($id, $type) {
17
+        $raport = PatientRaport::getRaportBetweenDates ( $id, $type, '2014-06-01', (new \DateTime ())->format ( "Y-m-d" ) );
18
+        return $raport;
19
+    }
20
+    /**
21
+     *
22
+     * @param unknown $objPHPExcel        	
23
+     * @param unknown $cols        	
24
+     */
25
+    private static function printHeaders($objPHPExcel, $cols) {
26
+        $count = 1;
27
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 2, "Data" );
28
+        foreach ( $cols as $col ) {
29
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, 2, sprintf ( "%7s", $col ) );
30
+        }
31
+    }
32
+    /**
33
+     */
34
+    private static function printData($objPHPExcel, $data, $type) {
35
+        $row = 3;
36
+        $lastColumn = 1;
37
+        $colNumberOfPatients = ExcelExport::getColumnLetter ( 1 );
38
+        $indexes = PatientRaport::getIndexes ( $type );
39
+        foreach ( $data as $rowKey => $rowValue ) {
40
+            // 1 col: date
41
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row, json_encode ( $rowKey ) );
42
+            $count = 1;
43
+            // 2-5 cols: N1 N2 N3 N0
44
+            foreach ( $indexes as $index ) {
45
+                $value = isset ( $rowValue [$index] ) ? $rowValue [$index] : "0";
46
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $value );
47
+            }
48
+            // 6 col: num of categorized (N = N1+N2+N3)
49
+            $colHighestCategory = ExcelExport::getColumnLetter ( $count - 2 );
50
+            $colNumberOfPatients = ExcelExport::getColumnLetter ( $count );
51
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(B' . $row . ':' . $colHighestCategory . $row . ')' );
52
+            $tpb = PatientRaport::getTpb ( $type );
53
+            // 7-11 tpb1, tpb2, tpb3, 0 (no-cat), 2 (add)
54
+            foreach ( $tpb as $tpbn ) {
55
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, $tpbn );
56
+            }
57
+            // 9-11: Tpb1*N1,Tpb2*N2,Tpb3*N3+2xN
58
+            $tpbSize = count ( $tpb );
59
+            foreach ( $tpb as $tpbn ) {
60
+                $col1Letter = ExcelExport::getColumnLetter ( $count - 2 * $tpbSize );
61
+                $col2Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
62
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=' . $col1Letter . $row . "*" . $col2Letter . $row );
63
+            }
64
+            // SUM Tpb
65
+            $col3Letter = ExcelExport::getColumnLetter ( $count - $tpbSize );
66
+            $col4Letter = ExcelExport::getColumnLetter ( $count - 1 );
67
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( $count ++, $row, '=SUM(' . $col3Letter . $row . ":" . $col4Letter . $row . ")" );
68
+            $row ++;
69
+            $lastColumn = $count - 1;
70
+        }
71
+        // number of categorization days
72
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 1, 1, '=COUNTIFS(' . $colNumberOfPatients . '3:' . $colNumberOfPatients . ($row - 1) . ',">0")' );
73
+        // sum
74
+        $col5Letter = ExcelExport::getColumnLetter ( $lastColumn );
75
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 2, 1, '=SUM(' . $col5Letter . '3:' . $col5Letter . ($row - 1) . ')/60' );
76
+        return $row;
77
+    }
78 78
 	
79
-	/**
80
-	 *
81
-	 * @param unknown $objPHPExcel        	
82
-	 */
83
-	static function fillSummary($objPHPExcel) {
84
-		ExcelExport::newSheet ( $objPHPExcel, 0 );
85
-		ExcelExport::printTitle ( $objPHPExcel, "Raport" );
86
-		$sheetCount = $objPHPExcel->getSheetCount ();
87
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'A2', 'Oddz.' );
88
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'B2', 'Dni' );
89
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'C2', 'Tpb' );
90
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'D2', 'Tśpb' );
91
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'E2', 'Tśpc*' );
92
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'F2', 'Tśpc**' );
93
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'G2', 'Td***' );
94
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'H2', 'Le*' );
95
-		$objPHPExcel->getActiveSheet ()->setCellValue ( 'I2', 'Le**' );
96
-		for($i = 1; $i < $sheetCount; $i ++) {
97
-			$loadedSheetNames = $objPHPExcel->getSheetNames ();
98
-			foreach ( $loadedSheetNames as $sheetIndex => $loadedSheetName ) {
99
-				if ($sheetIndex == 0) {
100
-					continue;
101
-				}
102
-				$row = $sheetIndex + 2;
103
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, "='" . $loadedSheetName . "'!A1" );
104
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, "='" . $loadedSheetName . "'!B1" );
105
-				$objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, "='" . $loadedSheetName . "'!C1" );
106
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 3, $row, "=IF(C" . $row . ">0,C" . $row . "/B" . $row . ",0)" );
107
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 4, $row, "=D" . $row . "*110%" );
108
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 5, $row, "=D" . $row . "*125%" );
109
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 6, $row, "1531" );
110
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 7, $row, "=IF(E" . $row . ">0,E" . $row . "*365/G" . $row . ",\"-\")" );
111
-				$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 8, $row, "=IF(F" . $row . ">0,F" . $row . "*365/G" . $row . ",\"-\")" );
112
-			}
113
-			$objPHPExcel->getActiveSheet ()->getStyle ( 'C3:I100' )->getNumberFormat ()->setFormatCode ( '#,##0.0' );
114
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej" );
115
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej" );
116
-			$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h" );
117
-			ExcelExport::styleActiveSheet ( $objPHPExcel );
118
-		}
119
-	}
120
-	static function fillData($objPHPExcel) {
121
-		// no time limit for this script
122
-		set_time_limit ( 0 );
123
-		$time_start = microtime ( true );
124
-		// remove first default sheet
125
-		$objPHPExcel->removeSheetByIndex ( 0 );
126
-		// get wards
127
-		$wards = WardCRUD::getWardsArray ();
128
-		foreach ( $wards as $ward ) {
129
-			ExcelExport::newSheet ( $objPHPExcel );
130
-			$wardName = $ward->name . " (" . $ward->getTypOddzialu () . ")";
131
-			ExcelExport::printTitle ( $objPHPExcel, $wardName );
132
-			$data = ExcelExportPunction::getData ( $ward->id, $ward->getTypOddzialu () );
133
-			$cols = PatientRaport::getColumns ( $ward->getTypOddzialu () );
134
-			ExcelExportPunction::printHeaders ( $objPHPExcel, $cols );
135
-			ExcelExportPunction::printData ( $objPHPExcel, $data, $ward->getTypOddzialu () );
136
-			ExcelExport::styleActiveSheet ( $objPHPExcel );
137
-		}
138
-		ExcelExportPunction::fillSummary ( $objPHPExcel );
139
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 100, "summary " . ($time_start - microtime ( true )) . " s" );
140
-	}
79
+    /**
80
+     *
81
+     * @param unknown $objPHPExcel        	
82
+     */
83
+    static function fillSummary($objPHPExcel) {
84
+        ExcelExport::newSheet ( $objPHPExcel, 0 );
85
+        ExcelExport::printTitle ( $objPHPExcel, "Raport" );
86
+        $sheetCount = $objPHPExcel->getSheetCount ();
87
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'A2', 'Oddz.' );
88
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'B2', 'Dni' );
89
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'C2', 'Tpb' );
90
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'D2', 'Tśpb' );
91
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'E2', 'Tśpc*' );
92
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'F2', 'Tśpc**' );
93
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'G2', 'Td***' );
94
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'H2', 'Le*' );
95
+        $objPHPExcel->getActiveSheet ()->setCellValue ( 'I2', 'Le**' );
96
+        for($i = 1; $i < $sheetCount; $i ++) {
97
+            $loadedSheetNames = $objPHPExcel->getSheetNames ();
98
+            foreach ( $loadedSheetNames as $sheetIndex => $loadedSheetName ) {
99
+                if ($sheetIndex == 0) {
100
+                    continue;
101
+                }
102
+                $row = $sheetIndex + 2;
103
+                $objPHPExcel->getActiveSheet ()->setCellValue ( 'A' . $row, "='" . $loadedSheetName . "'!A1" );
104
+                $objPHPExcel->getActiveSheet ()->setCellValue ( 'B' . $row, "='" . $loadedSheetName . "'!B1" );
105
+                $objPHPExcel->getActiveSheet ()->setCellValue ( 'C' . $row, "='" . $loadedSheetName . "'!C1" );
106
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 3, $row, "=IF(C" . $row . ">0,C" . $row . "/B" . $row . ",0)" );
107
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 4, $row, "=D" . $row . "*110%" );
108
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 5, $row, "=D" . $row . "*125%" );
109
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 6, $row, "1531" );
110
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 7, $row, "=IF(E" . $row . ">0,E" . $row . "*365/G" . $row . ",\"-\")" );
111
+                $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 8, $row, "=IF(F" . $row . ">0,F" . $row . "*365/G" . $row . ",\"-\")" );
112
+            }
113
+            $objPHPExcel->getActiveSheet ()->getStyle ( 'C3:I100' )->getNumberFormat ()->setFormatCode ( '#,##0.0' );
114
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 1, "* Czas pielęgnacji pośredniej jako 10% czasu pielęgnacji bezpośredniej" );
115
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 2, "** Czas pielęgnacji pośredniej jako 25% czasu pielęgnacji bezpośredniej" );
116
+            $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, $row + 3, "*** Czas dyspozycyjny - propozycja z Rozporządzenia MZ: 202 dni x 7,58 h" );
117
+            ExcelExport::styleActiveSheet ( $objPHPExcel );
118
+        }
119
+    }
120
+    static function fillData($objPHPExcel) {
121
+        // no time limit for this script
122
+        set_time_limit ( 0 );
123
+        $time_start = microtime ( true );
124
+        // remove first default sheet
125
+        $objPHPExcel->removeSheetByIndex ( 0 );
126
+        // get wards
127
+        $wards = WardCRUD::getWardsArray ();
128
+        foreach ( $wards as $ward ) {
129
+            ExcelExport::newSheet ( $objPHPExcel );
130
+            $wardName = $ward->name . " (" . $ward->getTypOddzialu () . ")";
131
+            ExcelExport::printTitle ( $objPHPExcel, $wardName );
132
+            $data = ExcelExportPunction::getData ( $ward->id, $ward->getTypOddzialu () );
133
+            $cols = PatientRaport::getColumns ( $ward->getTypOddzialu () );
134
+            ExcelExportPunction::printHeaders ( $objPHPExcel, $cols );
135
+            ExcelExportPunction::printData ( $objPHPExcel, $data, $ward->getTypOddzialu () );
136
+            ExcelExport::styleActiveSheet ( $objPHPExcel );
137
+        }
138
+        ExcelExportPunction::fillSummary ( $objPHPExcel );
139
+        $objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 100, "summary " . ($time_start - microtime ( true )) . " s" );
140
+    }
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
src/utils/PersonGenerator.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * PersonGenerator
4
- *
5
- * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
- * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
- *
8
- * Permission is hereby granted to use or copy this program
9
- * for any purpose, provided the above notices are retained on all copies.
10
- * Permission to modify the code and to distribute modified code is granted,
11
- * provided the above notices are retained, and a notice that the code was
12
- * modified is included with the above copyright notice.
13
- *
14
- * @category  Wp
15
- * @package   Punction
16
- * @author    Andrzej Marcinkowski <[email protected]>
17
- * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
- * @license   MIT http://opensource.org/licenses/MIT
19
- * @version   1.0 $Id: a88997670673063e272ee5666aa86ed1ec9a1561 $ $Format:%H$
20
- * @link      http://
21
- * @since     File available since Release 1.0.0
22
- * PHP Version 5
23
- */
3
+     * PersonGenerator
4
+     *
5
+     * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
+     * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
+     *
8
+     * Permission is hereby granted to use or copy this program
9
+     * for any purpose, provided the above notices are retained on all copies.
10
+     * Permission to modify the code and to distribute modified code is granted,
11
+     * provided the above notices are retained, and a notice that the code was
12
+     * modified is included with the above copyright notice.
13
+     *
14
+     * @category  Wp
15
+     * @package   Punction
16
+     * @author    Andrzej Marcinkowski <[email protected]>
17
+     * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
+     * @license   MIT http://opensource.org/licenses/MIT
19
+     * @version   1.0 $Id: a88997670673063e272ee5666aa86ed1ec9a1561 $ $Format:%H$
20
+     * @link      http://
21
+     * @since     File available since Release 1.0.0
22
+     * PHP Version 5
23
+     */
24 24
 namespace Hospitalplugin\utils;
25 25
 
26 26
 use Hospitalplugin\Entities\Patient;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
     /**
52 52
      * @return \Hospitalplugin\Entities\Patient
53
-	 */
53
+     */
54 54
     public static function getRandomPerson()
55 55
     {
56 56
         // TODO extract paths
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
     }
94 94
 
95 95
     /**
96
-	 *
97
-	 * @param $date        	
98
-	 * @param $sex
99
-	 *        	'm' / 'f'
100
-	 */
96
+     *
97
+     * @param $date        	
98
+     * @param $sex
99
+     *        	'm' / 'f'
100
+     */
101 101
     public static function getRandomPesel($date, $sex = 'm')
102 102
     {
103 103
         $datetime = new \DateTime($date);
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
         $intSum = 0;
126 126
         for ($i = 0; $i < 10; $i ++) {
127 127
             $intSum += $arrSteps[$i] * $x[$i]; // mnożymy każdy ze znaków
128
-                                                   // przez wagć i sumujemy
129
-                                                   // wszystko
128
+                                                    // przez wagć i sumujemy
129
+                                                    // wszystko
130 130
         }
131 131
         $int = 10 - $intSum % 10; // obliczamy sumć kontrolną
132 132
         $intControlNr = ($int == 10) ? 0 : $int;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * 
140 140
      * @param unknown $arr
141 141
      * @return string random element
142
-	 */
142
+     */
143 143
     public static function getRandom($arr)
144 144
     {
145 145
         return implode('', $arr[array_rand($arr)]);
Please login to merge, or discard this patch.
src/utils/Utils.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -330,7 +330,7 @@
 block discarded – undo
330 330
             
331 331
             // ź
332 332
             chr(0x9F) => '&#378;',
333
-        	chr(0xBC) => '&#378;'
333
+            chr(0xBC) => '&#378;'
334 334
         );
335 335
         return html_entity_decode(mb_convert_encoding(strtr($text, $map), 'UTF-8', 'ISO-8859-2'), ENT_QUOTES, 'UTF-8');
336 336
     }
Please login to merge, or discard this patch.
src/DB/DoctrineBootstrap.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -44,76 +44,76 @@
 block discarded – undo
44 44
  */
45 45
 class DoctrineBootstrap {
46 46
 	
47
-	/**
48
-	 * entity manager
49
-	 *
50
-	 * @var _entityManager EnitytManager
51
-	 */
52
-	private static $_entityManager;
47
+    /**
48
+     * entity manager
49
+     *
50
+     * @var _entityManager EnitytManager
51
+     */
52
+    private static $_entityManager;
53 53
 	
54
-	/**
55
-	 * loading envs
56
-	 */
57
-	private static function _loadEnv() {
58
-		if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
59
-			return;
60
-		}
61
-		if (defined ( 'ABSPATH' )) {
62
-			\Dotenv::load ( ABSPATH );
63
-		} else {
64
-			\Dotenv::load ( getenv ( 'HOME' ) );
65
-		}
66
-	}
67
-	private static function getPaths() {
68
-		if (file_exists ( getcwd () . "/src/Entities" )) {
69
-			return array (
70
-					getcwd () . "/src/Entities" 
71
-			);
72
-		} else {
73
-			return array (
74
-					getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75
-			);
76
-		}
77
-	}
54
+    /**
55
+     * loading envs
56
+     */
57
+    private static function _loadEnv() {
58
+        if (getenv ( 'DB_NAME' ) != null && getenv ( 'DB_NAME' ) != "") {
59
+            return;
60
+        }
61
+        if (defined ( 'ABSPATH' )) {
62
+            \Dotenv::load ( ABSPATH );
63
+        } else {
64
+            \Dotenv::load ( getenv ( 'HOME' ) );
65
+        }
66
+    }
67
+    private static function getPaths() {
68
+        if (file_exists ( getcwd () . "/src/Entities" )) {
69
+            return array (
70
+                    getcwd () . "/src/Entities" 
71
+            );
72
+        } else {
73
+            return array (
74
+                    getcwd () . "/vendor/amarcinkowski/hospitalplugin/src/Entities" 
75
+            );
76
+        }
77
+    }
78 78
 	
79
-	/**
80
-	 *
81
-	 * @return entityManager EntityManager
82
-	 */
83
-	private static function _getInstance() {
84
-		$isDevMode = true;
85
-		$config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
-		self::_loadEnv ();
87
-		$conn = array (
88
-				'dbname' => getenv ( 'DB_NAME' ),
89
-				'user' => getenv ( 'DB_USER' ),
90
-				'password' => getenv ( 'DB_PASSWORD' ),
91
-				'host' => getenv ( 'DB_HOST' ),
92
-				'driver' => 'pdo_mysql',
93
-				'charset' => 'utf8',
94
-				'driverOptions' => array (
95
-						1002 => 'SET NAMES utf8' 
96
-				),
97
-				'mapping_types' => 'enum:string' 
98
-		);
99
-		return EntityManager::create ( $conn, $config );
100
-	}
79
+    /**
80
+     *
81
+     * @return entityManager EntityManager
82
+     */
83
+    private static function _getInstance() {
84
+        $isDevMode = true;
85
+        $config = Setup::createAnnotationMetadataConfiguration ( self::getPaths (), $isDevMode );
86
+        self::_loadEnv ();
87
+        $conn = array (
88
+                'dbname' => getenv ( 'DB_NAME' ),
89
+                'user' => getenv ( 'DB_USER' ),
90
+                'password' => getenv ( 'DB_PASSWORD' ),
91
+                'host' => getenv ( 'DB_HOST' ),
92
+                'driver' => 'pdo_mysql',
93
+                'charset' => 'utf8',
94
+                'driverOptions' => array (
95
+                        1002 => 'SET NAMES utf8' 
96
+                ),
97
+                'mapping_types' => 'enum:string' 
98
+        );
99
+        return EntityManager::create ( $conn, $config );
100
+    }
101 101
 	
102
-	/**
103
-	 * returns enitytManager
104
-	 *
105
-	 * @return EntityManager
106
-	 */
107
-	public static function getEntityManager() {
108
-		if (self::$_entityManager == null) {
109
-			self::$_entityManager = self::_getInstance ();
110
-		}
111
-		return self::$_entityManager;
112
-	}
113
-	public static function getCli() {
114
-		$em = DoctrineBootstrap::getEntityManager ();
115
-		$em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
-		return ConsoleRunner::createHelperSet ( $em );
117
-	}
102
+    /**
103
+     * returns enitytManager
104
+     *
105
+     * @return EntityManager
106
+     */
107
+    public static function getEntityManager() {
108
+        if (self::$_entityManager == null) {
109
+            self::$_entityManager = self::_getInstance ();
110
+        }
111
+        return self::$_entityManager;
112
+    }
113
+    public static function getCli() {
114
+        $em = DoctrineBootstrap::getEntityManager ();
115
+        $em->getConnection ()->getDatabasePlatform ()->registerDoctrineTypeMapping ( 'enum', 'string' );
116
+        return ConsoleRunner::createHelperSet ( $em );
117
+    }
118 118
 }
119 119
 
Please login to merge, or discard this patch.
src/Entities/Patient.php 1 patch
Indentation   +361 added lines, -361 removed lines patch added patch discarded remove patch
@@ -57,365 +57,365 @@
 block discarded – undo
57 57
  */
58 58
 class Patient {
59 59
 	
60
-	/**
61
-	 *
62
-	 * @var string $typ typ pacjenta
63
-	 */
64
-	protected $typ = "";
65
-	
66
-	/**
67
-	 * id
68
-	 * @Id @Column(type="integer") @GeneratedValue
69
-	 */
70
-	public $id;
71
-	
72
-	/**
73
-	 * name
74
-	 * @Column(type="string", length=50)
75
-	 */
76
-	public $name;
77
-	
78
-	/**
79
-	 * @Column(type="string", length=11)
80
-	 */
81
-	public $pesel;
82
-	
83
-	/**
84
-	 * @Column(type="integer") *
85
-	 */
86
-	public $numerHistorii;
87
-	
88
-	/**
89
-	 * $dataKategoryzacji datetime
90
-	 * @Column(type="datetime") *
91
-	 */
92
-	public $dataKategoryzacji;
93
-	
94
-	/**
95
-	 * @Column(type="integer") *
96
-	 */
97
-	protected $oddzialId;
98
-	
99
-	/**
100
-	 * @Column(columnDefinition="TINYINT(4) NOT NULL DEFAULT 0")
101
-	 */
102
-	public $kategoriaPacjenta = 0;
103
-	
104
-	/**
105
-	 * @ManyToOne(targetEntity="Hospitalplugin\Entities\User")
106
-	 * @JoinColumn(name="userId", referencedColumnName="id", nullable=true)
107
-	 * @Column(columnDefinition="INT(11) NOT NULL DEFAULT 0")
108
-	 */
109
-	public $user;
110
-	
111
-	/**
112
-	 * Constructor
113
-	 *
114
-	 * @param unknown $args        	
115
-	 */
116
-	function __construct($args) {
117
-		if (! isset ( $args ) || empty ( $args )) {
118
-			return;
119
-		}
120
-		foreach ( $args as $key => $value ) {
121
-			if ($key == 'dataKategoryzacji') {
122
-				$value = new \DateTime ( $value . ' 12:00:00' );
123
-			}
124
-			call_user_func ( array (
125
-					$this,
126
-					'set' . $key 
127
-			), $value );
128
-		}
129
-	}
130
-	
131
-	/**
132
-	 * getId
133
-	 *
134
-	 * @return id
135
-	 */
136
-	public function getId() {
137
-		return $this->id;
138
-	}
139
-	
140
-	/**
141
-	 * sets id
142
-	 *
143
-	 * @param int $id
144
-	 *        	ID
145
-	 *        	
146
-	 * @return \Hospitalplugin\Entities\Patient
147
-	 */
148
-	public function setId($id) {
149
-		$this->id = $id;
150
-		return $this;
151
-	}
152
-	
153
-	/**
154
-	 * getName
155
-	 *
156
-	 * @return name
157
-	 */
158
-	public function getName() {
159
-		return $this->name;
160
-	}
161
-	
162
-	/**
163
-	 * setName
164
-	 *
165
-	 * @param string $name
166
-	 *        	string name
167
-	 *        	
168
-	 * @return Patient
169
-	 */
170
-	public function setName($name) {
171
-		$this->name = $name;
172
-		return $this;
173
-	}
174
-	
175
-	/**
176
-	 * getDataKategoryzacji
177
-	 *
178
-	 * @return \DateTime dataKategoryzacji
179
-	 */
180
-	public function getDataKategoryzacji() {
181
-		return $this->dataKategoryzacji;
182
-	}
183
-	
184
-	/**
185
-	 * setDataKategoryzacji
186
-	 *
187
-	 * @param \DateTime $dataKategoryzacji
188
-	 *        	data kategoryzyzacji
189
-	 *        	
190
-	 * @return Patient
191
-	 */
192
-	public function setDataKategoryzacji(\DateTime $dataKategoryzacji) {
193
-		$this->dataKategoryzacji = $dataKategoryzacji;
194
-		return $this;
195
-	}
196
-	
197
-	/**
198
-	 * getOddzialId
199
-	 *
200
-	 * @return oddzialId
201
-	 */
202
-	public function getOddzialId() {
203
-		return $this->oddzialId;
204
-	}
205
-	
206
-	/**
207
-	 * setOddzialId
208
-	 *
209
-	 * @param int $oddzialId
210
-	 *        	oddzial id
211
-	 *        	
212
-	 * @return Patient
213
-	 */
214
-	public function setOddzialId($oddzialId) {
215
-		$this->oddzialId = $oddzialId;
216
-		return $this;
217
-	}
218
-	
219
-	/**
220
-	 *
221
-	 * @param Ward $ward        	
222
-	 */
223
-	public function setWard($ward) {
224
-		$this->oddzialId = $ward->id;
225
-		return $this;
226
-	}
227
-	
228
-	/**
229
-	 * getOddzialId
230
-	 *
231
-	 * @return oddzialId
232
-	 */
233
-	public function getNumerHistorii() {
234
-		return $this->numerHistorii;
235
-	}
236
-	
237
-	/**
238
-	 * setOddzialId
239
-	 *
240
-	 * @param int $oddzialId
241
-	 *        	oddzial id
242
-	 *        	
243
-	 * @return Patient
244
-	 */
245
-	public function setNumerHistorii($numerHistorii) {
246
-		$this->numerHistorii = $numerHistorii;
247
-		return $this;
248
-	}
249
-	
250
-	/**
251
-	 * getPesel
252
-	 *
253
-	 * @return pesel
254
-	 */
255
-	public function getPesel() {
256
-		return $this->pesel;
257
-	}
258
-	
259
-	/**
260
-	 * setPesel
261
-	 *
262
-	 * @param string $pesel
263
-	 *        	nr pesel
264
-	 *        	
265
-	 * @return Patient
266
-	 */
267
-	public function setPesel($pesel) {
268
-		$this->pesel = $pesel;
269
-		return $this;
270
-	}
271
-	
272
-	/**
273
-	 * getKategoriaPacjenta
274
-	 *
275
-	 * @return kategoriaPacjenta
276
-	 */
277
-	public function getKategoriaPacjenta() {
278
-		return $this->kategoriaPacjenta;
279
-	}
280
-	
281
-	/**
282
-	 * setKategoriaPacjenta
283
-	 *
284
-	 * @param int $kategoriaPacjenta
285
-	 *        	kategoriaPacjenta
286
-	 *        	
287
-	 * @return Patient
288
-	 */
289
-	public function setKategoriaPacjenta($kategoriaPacjenta) {
290
-		$this->kategoriaPacjenta = $kategoriaPacjenta;
291
-		return $this;
292
-	}
293
-	
294
-	/**
295
-	 * getTyp
296
-	 *
297
-	 * @return typ
298
-	 */
299
-	public function getTyp() {
300
-		return $this->typ;
301
-	}
302
-	
303
-	/**
304
-	 * setTyp
305
-	 *
306
-	 * @param string $typ        	
307
-	 *
308
-	 * @return \Hospitalplugin\Entities\Patient
309
-	 */
310
-	public function setTyp($typ) {
311
-		$this->typ = $typ;
312
-		return $this;
313
-	}
314
-	
315
-	/**
316
-	 * getUser
317
-	 */
318
-	public function getUser() {
319
-		return $this->user;
320
-	}
321
-	
322
-	/**
323
-	 *
324
-	 * @param User $user        	
325
-	 */
326
-	public function setUser($user) {
327
-		$this->user = $user;
328
-		return $this;
329
-	}
330
-	
331
-	/**
332
-	 * toString
333
-	 *
334
-	 * @return string
335
-	 */
336
-	public function toString() {
337
-		$txt = $this->getName ();
338
-		$txt .= $this->getPesel ();
339
-		$txt .= "id:";
340
-		$txt .= $this->getId ();
341
-		$txt .= "oid:";
342
-		$txt .= $this->getOddzialId ();
343
-		$txt .= "d:";
344
-		$data = $this->getDataKategoryzacji ();
345
-		if ($data instanceof \DateTime) {
346
-			$txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" );
347
-		} else {
348
-			$txt .= $this->getDataKategoryzacji ();
349
-		}
350
-		return $txt;
351
-	}
352
-	public function __toString() {
353
-		return $this->toString ();
354
-	}
355
-	
356
-	/**
357
-	 * getFields
358
-	 *
359
-	 * @return multitype:string
360
-	 */
361
-	protected static function getFields() {
362
-		$fields = array (
363
-				"id",
364
-				"name",
365
-				"pesel",
366
-				"numerHistorii",
367
-				"dataKategoryzacji",
368
-				"kategoriaPacjenta" 
369
-		);
370
-		return $fields;
371
-	}
372
-	
373
-	/**
374
-	 * toDatatablesJSONString
375
-	 *
376
-	 * @return string
377
-	 */
378
-	public function toDatatablesJSONString() {
379
-		$return_object_array = [ ];
380
-		$fields = $this->getFields ();
381
-		foreach ( $fields as $field ) {
382
-			$value = call_user_func ( array (
383
-					$this,
384
-					'get' . $field 
385
-			) );
386
-			if ($value instanceof \DateTime) {
387
-				$value = $value->format ( 'Y-m-d' );
388
-			}
389
-			array_push ( $return_object_array, array (
390
-					$field => $value 
391
-			) );
392
-		}
393
-		return json_encode ( $this );
394
-	}
395
-	
396
-	/**
397
-	 * String with comma separated values.
398
-	 *
399
-	 * @deprecated JSON used
400
-	 * @param unknown $patient        	
401
-	 *
402
-	 * @return string
403
-	 */
404
-	public function toDatatablesString() {
405
-		$string = "";
406
-		$fields = $this::getFields ();
407
-		foreach ( $fields as $field ) {
408
-			$value = call_user_func ( array (
409
-					$this,
410
-					'get' . $field 
411
-			) );
412
-			if ($value instanceof \DateTime) {
413
-				$value = $value->format ( 'Y-m-d' );
414
-			}
415
-			$string .= $value . ",";
416
-		}
417
-		$string = trim ( $string, "," );
418
-		$string = str_replace ( "\n", "", $string );
419
-		return $string;
420
-	}
60
+    /**
61
+     *
62
+     * @var string $typ typ pacjenta
63
+     */
64
+    protected $typ = "";
65
+	
66
+    /**
67
+     * id
68
+     * @Id @Column(type="integer") @GeneratedValue
69
+     */
70
+    public $id;
71
+	
72
+    /**
73
+     * name
74
+     * @Column(type="string", length=50)
75
+     */
76
+    public $name;
77
+	
78
+    /**
79
+     * @Column(type="string", length=11)
80
+     */
81
+    public $pesel;
82
+	
83
+    /**
84
+     * @Column(type="integer") *
85
+     */
86
+    public $numerHistorii;
87
+	
88
+    /**
89
+     * $dataKategoryzacji datetime
90
+     * @Column(type="datetime") *
91
+     */
92
+    public $dataKategoryzacji;
93
+	
94
+    /**
95
+     * @Column(type="integer") *
96
+     */
97
+    protected $oddzialId;
98
+	
99
+    /**
100
+     * @Column(columnDefinition="TINYINT(4) NOT NULL DEFAULT 0")
101
+     */
102
+    public $kategoriaPacjenta = 0;
103
+	
104
+    /**
105
+     * @ManyToOne(targetEntity="Hospitalplugin\Entities\User")
106
+     * @JoinColumn(name="userId", referencedColumnName="id", nullable=true)
107
+     * @Column(columnDefinition="INT(11) NOT NULL DEFAULT 0")
108
+     */
109
+    public $user;
110
+	
111
+    /**
112
+     * Constructor
113
+     *
114
+     * @param unknown $args        	
115
+     */
116
+    function __construct($args) {
117
+        if (! isset ( $args ) || empty ( $args )) {
118
+            return;
119
+        }
120
+        foreach ( $args as $key => $value ) {
121
+            if ($key == 'dataKategoryzacji') {
122
+                $value = new \DateTime ( $value . ' 12:00:00' );
123
+            }
124
+            call_user_func ( array (
125
+                    $this,
126
+                    'set' . $key 
127
+            ), $value );
128
+        }
129
+    }
130
+	
131
+    /**
132
+     * getId
133
+     *
134
+     * @return id
135
+     */
136
+    public function getId() {
137
+        return $this->id;
138
+    }
139
+	
140
+    /**
141
+     * sets id
142
+     *
143
+     * @param int $id
144
+     *        	ID
145
+     *        	
146
+     * @return \Hospitalplugin\Entities\Patient
147
+     */
148
+    public function setId($id) {
149
+        $this->id = $id;
150
+        return $this;
151
+    }
152
+	
153
+    /**
154
+     * getName
155
+     *
156
+     * @return name
157
+     */
158
+    public function getName() {
159
+        return $this->name;
160
+    }
161
+	
162
+    /**
163
+     * setName
164
+     *
165
+     * @param string $name
166
+     *        	string name
167
+     *        	
168
+     * @return Patient
169
+     */
170
+    public function setName($name) {
171
+        $this->name = $name;
172
+        return $this;
173
+    }
174
+	
175
+    /**
176
+     * getDataKategoryzacji
177
+     *
178
+     * @return \DateTime dataKategoryzacji
179
+     */
180
+    public function getDataKategoryzacji() {
181
+        return $this->dataKategoryzacji;
182
+    }
183
+	
184
+    /**
185
+     * setDataKategoryzacji
186
+     *
187
+     * @param \DateTime $dataKategoryzacji
188
+     *        	data kategoryzyzacji
189
+     *        	
190
+     * @return Patient
191
+     */
192
+    public function setDataKategoryzacji(\DateTime $dataKategoryzacji) {
193
+        $this->dataKategoryzacji = $dataKategoryzacji;
194
+        return $this;
195
+    }
196
+	
197
+    /**
198
+     * getOddzialId
199
+     *
200
+     * @return oddzialId
201
+     */
202
+    public function getOddzialId() {
203
+        return $this->oddzialId;
204
+    }
205
+	
206
+    /**
207
+     * setOddzialId
208
+     *
209
+     * @param int $oddzialId
210
+     *        	oddzial id
211
+     *        	
212
+     * @return Patient
213
+     */
214
+    public function setOddzialId($oddzialId) {
215
+        $this->oddzialId = $oddzialId;
216
+        return $this;
217
+    }
218
+	
219
+    /**
220
+     *
221
+     * @param Ward $ward        	
222
+     */
223
+    public function setWard($ward) {
224
+        $this->oddzialId = $ward->id;
225
+        return $this;
226
+    }
227
+	
228
+    /**
229
+     * getOddzialId
230
+     *
231
+     * @return oddzialId
232
+     */
233
+    public function getNumerHistorii() {
234
+        return $this->numerHistorii;
235
+    }
236
+	
237
+    /**
238
+     * setOddzialId
239
+     *
240
+     * @param int $oddzialId
241
+     *        	oddzial id
242
+     *        	
243
+     * @return Patient
244
+     */
245
+    public function setNumerHistorii($numerHistorii) {
246
+        $this->numerHistorii = $numerHistorii;
247
+        return $this;
248
+    }
249
+	
250
+    /**
251
+     * getPesel
252
+     *
253
+     * @return pesel
254
+     */
255
+    public function getPesel() {
256
+        return $this->pesel;
257
+    }
258
+	
259
+    /**
260
+     * setPesel
261
+     *
262
+     * @param string $pesel
263
+     *        	nr pesel
264
+     *        	
265
+     * @return Patient
266
+     */
267
+    public function setPesel($pesel) {
268
+        $this->pesel = $pesel;
269
+        return $this;
270
+    }
271
+	
272
+    /**
273
+     * getKategoriaPacjenta
274
+     *
275
+     * @return kategoriaPacjenta
276
+     */
277
+    public function getKategoriaPacjenta() {
278
+        return $this->kategoriaPacjenta;
279
+    }
280
+	
281
+    /**
282
+     * setKategoriaPacjenta
283
+     *
284
+     * @param int $kategoriaPacjenta
285
+     *        	kategoriaPacjenta
286
+     *        	
287
+     * @return Patient
288
+     */
289
+    public function setKategoriaPacjenta($kategoriaPacjenta) {
290
+        $this->kategoriaPacjenta = $kategoriaPacjenta;
291
+        return $this;
292
+    }
293
+	
294
+    /**
295
+     * getTyp
296
+     *
297
+     * @return typ
298
+     */
299
+    public function getTyp() {
300
+        return $this->typ;
301
+    }
302
+	
303
+    /**
304
+     * setTyp
305
+     *
306
+     * @param string $typ        	
307
+     *
308
+     * @return \Hospitalplugin\Entities\Patient
309
+     */
310
+    public function setTyp($typ) {
311
+        $this->typ = $typ;
312
+        return $this;
313
+    }
314
+	
315
+    /**
316
+     * getUser
317
+     */
318
+    public function getUser() {
319
+        return $this->user;
320
+    }
321
+	
322
+    /**
323
+     *
324
+     * @param User $user        	
325
+     */
326
+    public function setUser($user) {
327
+        $this->user = $user;
328
+        return $this;
329
+    }
330
+	
331
+    /**
332
+     * toString
333
+     *
334
+     * @return string
335
+     */
336
+    public function toString() {
337
+        $txt = $this->getName ();
338
+        $txt .= $this->getPesel ();
339
+        $txt .= "id:";
340
+        $txt .= $this->getId ();
341
+        $txt .= "oid:";
342
+        $txt .= $this->getOddzialId ();
343
+        $txt .= "d:";
344
+        $data = $this->getDataKategoryzacji ();
345
+        if ($data instanceof \DateTime) {
346
+            $txt .= $this->getDataKategoryzacji ()->format ( "Y-m-d" );
347
+        } else {
348
+            $txt .= $this->getDataKategoryzacji ();
349
+        }
350
+        return $txt;
351
+    }
352
+    public function __toString() {
353
+        return $this->toString ();
354
+    }
355
+	
356
+    /**
357
+     * getFields
358
+     *
359
+     * @return multitype:string
360
+     */
361
+    protected static function getFields() {
362
+        $fields = array (
363
+                "id",
364
+                "name",
365
+                "pesel",
366
+                "numerHistorii",
367
+                "dataKategoryzacji",
368
+                "kategoriaPacjenta" 
369
+        );
370
+        return $fields;
371
+    }
372
+	
373
+    /**
374
+     * toDatatablesJSONString
375
+     *
376
+     * @return string
377
+     */
378
+    public function toDatatablesJSONString() {
379
+        $return_object_array = [ ];
380
+        $fields = $this->getFields ();
381
+        foreach ( $fields as $field ) {
382
+            $value = call_user_func ( array (
383
+                    $this,
384
+                    'get' . $field 
385
+            ) );
386
+            if ($value instanceof \DateTime) {
387
+                $value = $value->format ( 'Y-m-d' );
388
+            }
389
+            array_push ( $return_object_array, array (
390
+                    $field => $value 
391
+            ) );
392
+        }
393
+        return json_encode ( $this );
394
+    }
395
+	
396
+    /**
397
+     * String with comma separated values.
398
+     *
399
+     * @deprecated JSON used
400
+     * @param unknown $patient        	
401
+     *
402
+     * @return string
403
+     */
404
+    public function toDatatablesString() {
405
+        $string = "";
406
+        $fields = $this::getFields ();
407
+        foreach ( $fields as $field ) {
408
+            $value = call_user_func ( array (
409
+                    $this,
410
+                    'get' . $field 
411
+            ) );
412
+            if ($value instanceof \DateTime) {
413
+                $value = $value->format ( 'Y-m-d' );
414
+            }
415
+            $string .= $value . ",";
416
+        }
417
+        $string = trim ( $string, "," );
418
+        $string = str_replace ( "\n", "", $string );
419
+        return $string;
420
+    }
421 421
 }
Please login to merge, or discard this patch.