Completed
Push — master ( 1fd7e7...a2c36e )
by Andrzej
03:49
created
src/Entities/PatientPOR.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @return multitype:string
271 271
 	 */
272 272
 	public static function getFields() {
273
-		$superFields = parent::getFields ();
274
-		$fields = array_merge ( $superFields, array (
273
+		$superFields = parent::getFields();
274
+		$fields = array_merge($superFields, array(
275 275
 				"iCiaza",
276 276
 				"iWywiad",
277 277
 				"iPozycja",
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				"iVPomiarParametrowZyciowych",
314 314
 				"iVKarmienie",
315 315
 				"iVEdukacjaZdrowotnaIWsparciePsychiczne" 
316
-		) );
316
+		));
317 317
 		return $fields;
318 318
 	}
319 319
 	public function getICiaza() {
Please login to merge, or discard this patch.
src/Entities/PatientRaport.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 	 * @param unknown $date        	
15 15
 	 */
16 16
 	public static function getRaport($wardId, $date, $wardType) {
17
-		$startDate = $date . '-01';
18
-		$endDate = date ( "Y-m-t 23:59:59", strtotime ( $startDate ) );
17
+		$startDate = $date.'-01';
18
+		$endDate = date("Y-m-t 23:59:59", strtotime($startDate));
19 19
 		
20
-		return PatientRaport::getRaportBetweenDates ( $wardId, $wardType, $startDate, $endDate );
20
+		return PatientRaport::getRaportBetweenDates($wardId, $wardType, $startDate, $endDate);
21 21
 	}
22 22
 	private static function getQuery($type) {
23 23
 		if ($type == 'POR') {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 			$dql2 .= " FROM Hospitalplugin\Entities\PatientPOR p ";
32 32
 			$dql2 .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3 AND (p.iICzas <> 3 OR p.iICzas IS NULL)";
33 33
 			$dql2 .= " GROUP BY data, p.kategoriaPacjenta";
34
-			return array (
34
+			return array(
35 35
 					$dql1,
36 36
 					$dql2 
37 37
 			);
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			$dql .= " FROM Hospitalplugin\Entities\Patient p ";
42 42
 			$dql .= " WHERE p.dataKategoryzacji BETWEEN ?1 AND ?2 AND p.oddzialId = ?3";
43 43
 			$dql .= " GROUP BY data, p.kategoriaPacjenta";
44
-			return array (
44
+			return array(
45 45
 					$dql 
46 46
 			);
47 47
 		}
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	 * @return array
56 56
 	 */
57 57
 	public static function getRaportBetweenDates($wardId, $type, $startDate, $endDate) {
58
-		$em = DoctrineBootstrap::getEntityManager ();
59
-		$em->getConfiguration ()->addCustomDatetimeFunction ( 'DATE', 'Hospitalplugin\DQLFunctions\DateFunction' );
60
-		$dql = PatientRaport::getQuery ( $type );
61
-		$allResults = array ();
62
-		foreach ( $dql as $query ) {
63
-			$result = $em->createQuery ( $query )->setParameter ( 1, $startDate )->setParameter ( 2, $endDate )->setParameter ( 3, $wardId )->getResult ();
64
-			$allResults = array_merge ( $result, $allResults );
58
+		$em = DoctrineBootstrap::getEntityManager();
59
+		$em->getConfiguration()->addCustomDatetimeFunction('DATE', 'Hospitalplugin\DQLFunctions\DateFunction');
60
+		$dql = PatientRaport::getQuery($type);
61
+		$allResults = array();
62
+		foreach ($dql as $query) {
63
+			$result = $em->createQuery($query)->setParameter(1, $startDate)->setParameter(2, $endDate)->setParameter(3, $wardId)->getResult();
64
+			$allResults = array_merge($result, $allResults);
65 65
 		}
66 66
 		
67
-		$table = array ();
68
-		foreach ( $allResults as $row ) {
67
+		$table = array();
68
+		foreach ($allResults as $row) {
69 69
 			$table [$row ['data']] [$row ['kategoria']] = $row ['suma'];
70 70
 		}
71 71
 		return $table;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	static function getColumns($type) {
77 77
 		if ($type == 'POR') {
78
-			return array (
78
+			return array(
79 79
 					'N1 naturalny',
80 80
 					'N2 naturalny',
81 81
 					'N3 naturalny',
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 					'Tpb/dzień'
104 104
 			);
105 105
 		} else {
106
-			return array (
106
+			return array(
107 107
 					'N1',
108 108
 					'N2',
109 109
 					'N3',
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	}
126 126
 	static function getIndexes($type) {
127 127
 		if ($type == 'POR') {
128
-			return array (
128
+			return array(
129 129
 					'1',
130 130
 					'2',
131 131
 					'3',
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 					'0'
136 136
 			);
137 137
 		} else {
138
-			return array (
138
+			return array(
139 139
 					'1',
140 140
 					'2',
141 141
 					'3',
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	static function getTpb($type) {
155 155
 		if ($type == 'ZZ' || $type == 'PED') {
156
-			return array (
156
+			return array(
157 157
 					38,
158 158
 					95,
159 159
 					159,
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 					2
162 162
 			);
163 163
 		} else if ($type == 'PSY') {
164
-			return array (
164
+			return array(
165 165
 					40,
166 166
 					100,
167 167
 					160,
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 					2
170 170
 			);
171 171
 		} else if ($type == 'POR') {
172
-			return array (
172
+			return array(
173 173
 					137,
174 174
 					274,
175 175
 					328,
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 					2
181 181
 			);
182 182
 		} else if ($type == 'POL') {
183
-			return array (
183
+			return array(
184 184
 					72,
185 185
 					100,
186 186
 					98,
Please login to merge, or discard this patch.
src/Entities/PatientRaportOptimized.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 	 * @param unknown $date        	
15 15
 	 */
16 16
 	public static function getRaport($wardId, $date) {
17
-		$startDate = $date . '-01';
18
-		$endDate = date ( "Y-m-t 23:59:59", strtotime ( $startDate ) );
17
+		$startDate = $date.'-01';
18
+		$endDate = date("Y-m-t 23:59:59", strtotime($startDate));
19 19
 		
20
-		return PatientRaportOptimized::getRaportBetweenDatesNative ( $wardId, $startDate, $endDate );
20
+		return PatientRaportOptimized::getRaportBetweenDatesNative($wardId, $startDate, $endDate);
21 21
 	}
22 22
 	private static function updateNativeRaport() {
23
-		$em = DoctrineBootstrap::getEntityManager ();
24
-		$conn = $em->getConnection ();
23
+		$em = DoctrineBootstrap::getEntityManager();
24
+		$conn = $em->getConnection();
25 25
 		// create report table
26 26
 		$sql1 = "CREATE TABLE IF NOT EXISTS kategoria_view 
27 27
 					(data DATETIME, oddzialId INT, kategoria INT, suma INT,
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 					kategoriaPacjenta";
51 51
 		// select
52 52
 		try {
53
-			$conn->query ( $sql1 );
54
-			$conn->query ( $sql2 );
55
-		} catch ( Exception $e ) {
53
+			$conn->query($sql1);
54
+			$conn->query($sql2);
55
+		} catch (Exception $e) {
56 56
 			// echo 'Caught exception: ', $e->getMessage(), "\n";
57 57
 		}
58 58
 	}
@@ -63,19 +63,19 @@  discard block
 block discarded – undo
63 63
 	 * @param unknown $endDate
64 64
 	 */
65 65
 	public static function getRaportBetweenDatesNative($wardId, $startDate, $endDate) {
66
-		$em = DoctrineBootstrap::getEntityManager ();
66
+		$em = DoctrineBootstrap::getEntityManager();
67 67
 		PatientRaportOptimized::updateNativeRaport();
68
-		$conn = $em->getConnection ();
68
+		$conn = $em->getConnection();
69 69
 		$sql3 = "SELECT kategoria, date(data) as data, suma FROM kategoria_view WHERE data between :data1 AND :data2 and oddzialId = :oddzialId";
70
-		$stmt = $conn->prepare ( $sql3 );
71
-		$stmt->execute ( array (
70
+		$stmt = $conn->prepare($sql3);
71
+		$stmt->execute(array(
72 72
 				'data1' => $startDate,
73 73
 				'data2' => $endDate,
74 74
 				'oddzialId' => $wardId 
75
-		) );
75
+		));
76 76
 		$result = $stmt->fetchAll();
77
-		$table = array ();
78
-		foreach ( $result as $row ) {
77
+		$table = array();
78
+		foreach ($result as $row) {
79 79
 			$table [$row ['data']] [$row ['kategoria']] = $row ['suma'];
80 80
 		}
81 81
 		return $table;
Please login to merge, or discard this patch.
src/Entities/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 		return $this;
83 83
 	}
84 84
 	public function toString() {
85
-		return $this->getId() . $this->getName() . $this->getWard();
85
+		return $this->getId().$this->getName().$this->getWard();
86 86
 	}
87 87
 }
88 88
 
Please login to merge, or discard this patch.
src/Entities/Ward.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	private $users;
115 115
 	public function __construct() {
116
-		$this->users = new ArrayCollection ();
116
+		$this->users = new ArrayCollection();
117 117
 	}
118 118
 	
119 119
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 * @return string
123 123
 	 */
124 124
 	public function __toString() {
125
-		return $this->getName ();
125
+		return $this->getName();
126 126
 	}
127 127
 	public function getId() {
128 128
 		return $this->id;
Please login to merge, or discard this patch.
src/Twig/GetPropertiesExtension.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
             return array();
26 26
         }
27 27
         $class = new \ReflectionClass($class);
28
-        $properties = array_filter($class->getProperties(), function ($prop) use($class)
28
+        $properties = array_filter($class->getProperties(), function($prop) use($class)
29 29
         {
30 30
             return $prop->getDeclaringClass()->name == $class->name;
31 31
         });
Please login to merge, or discard this patch.
src/Twig/PLTwig.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@
 block discarded – undo
12 12
 	 * @return void|\Twig_Environment
13 13
 	 */
14 14
 	public static function load($viewsDir) {
15
-		if (! class_exists ( 'Twig_Loader_Filesystem' )) {
15
+		if (!class_exists('Twig_Loader_Filesystem')) {
16 16
 			echo 'Twig not activated. Make sure you activate the plugin in
17 17
     <a href="/wp-admin/plugins.php#timber">/wp-admin/plugins.php</a>';
18 18
 			return;
19 19
 		}
20
-		\Twig_Autoloader::register ();
20
+		\Twig_Autoloader::register();
21 21
 		try {
22
-			$loader = new \Twig_Loader_Filesystem ( $viewsDir );
23
-			$twig = new \Twig_Environment ( $loader, array () );
22
+			$loader = new \Twig_Loader_Filesystem($viewsDir);
23
+			$twig = new \Twig_Environment($loader, array());
24 24
 			// 'debug' => true
25 25
 			// 'cache' => '/tmp/'
26
-			$twig->getExtension ( 'core' )->setTimezone ( 'Europe/Warsaw' ); //
27
-			$twig->addExtension ( new EscapePLCharsExtension () );
26
+			$twig->getExtension('core')->setTimezone('Europe/Warsaw'); //
27
+			$twig->addExtension(new EscapePLCharsExtension());
28 28
 			return $twig;
29
-		} catch ( Exception $e ) {
30
-			echo "ERR: " . $e;
29
+		} catch (Exception $e) {
30
+			echo "ERR: ".$e;
31 31
 		}
32 32
 	}
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
src/WP/ScriptsAndStyles.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function hospitalRegisterStyle($file)
83 83
     {
84
-        wp_register_style('hospital_admin_style' . $file, $this->path . '/css/' . $file, array(), '1', 'screen');
85
-        wp_enqueue_style('hospital_admin_style' . $file);
84
+        wp_register_style('hospital_admin_style'.$file, $this->path.'/css/'.$file, array(), '1', 'screen');
85
+        wp_enqueue_style('hospital_admin_style'.$file);
86 86
     }
87 87
 
88 88
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function hospitalRegisterScript($file, $required = null, $hook = null)
94 94
     {
95
-        wp_enqueue_script('hospital_admin_script' . $file, $this->path . '/js/' . $file, $required);
95
+        wp_enqueue_script('hospital_admin_script'.$file, $this->path.'/js/'.$file, $required);
96 96
     }
97 97
 
98 98
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $params = array(
107 107
             'my_arr' => $json_dates
108 108
         );
109
-        wp_localize_script('hospital_admin_script' . $file, 'php_params', $params);
109
+        wp_localize_script('hospital_admin_script'.$file, 'php_params', $params);
110 110
     }
111 111
 
112 112
     /**
Please login to merge, or discard this patch.
src/utils/ExcelExport.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -10,60 +10,60 @@  discard block
 block discarded – undo
10 10
 	/**
11 11
 	 */
12 12
 	public static function init() {
13
-		add_action ( 'admin_init', array (
13
+		add_action('admin_init', array(
14 14
 				'Hospitalplugin\utils\ExcelExport',
15 15
 				'excel_export' 
16
-		), 1 );
16
+		), 1);
17 17
 	}
18 18
 	/**
19 19
 	 * 
20 20
 	 */
21 21
 	public static function getColumnLetter($num) {
22
-		return chr ( 65 + $num );
22
+		return chr(65 + $num);
23 23
 	}
24 24
 	/**
25 25
 	 */
26 26
 	static function excel_export() {
27
-		if (! isset ( $_POST ['excel'] )) {
27
+		if (!isset ($_POST ['excel'])) {
28 28
 			return;
29 29
 		} else {
30 30
 			// dataSetName: Infections, Punction
31 31
 			$dataSetName = $_POST ['dataSetName'];
32
-			$classname = '\Hospitalplugin\utils\ExcelExport' . $dataSetName;
32
+			$classname = '\Hospitalplugin\utils\ExcelExport'.$dataSetName;
33 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' );
38
+		ExcelExport::downloadExcel($objPHPExcel, $dataSetName.'.xlsx');
39 39
 	}
40 40
 	/**
41 41
 	 */
42 42
 	static function cellColor($objPHPExcel, $cells, $color) {
43
-		$objPHPExcel->getActiveSheet ()->getStyle ( $cells )->getFill ()->applyFromArray ( array (
43
+		$objPHPExcel->getActiveSheet()->getStyle($cells)->getFill()->applyFromArray(array(
44 44
 				'type' => \PHPExcel_Style_Fill::FILL_SOLID,
45
-				'startcolor' => array (
45
+				'startcolor' => array(
46 46
 						'rgb' => $color 
47 47
 				) 
48
-		) );
48
+		));
49 49
 	}
50 50
 	/**
51 51
 	 */
52 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 (
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 58
 						'horizontal' => \PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
59 59
 						'vertical' => \PHPExcel_Style_Alignment::VERTICAL_CENTER 
60 60
 				) 
61 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 );
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 67
 		}
68 68
 		return $objPHPExcel;
69 69
 	}
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 * @param unknown $objPHPExcel        	
73 73
 	 */
74 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" );
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' );
85
+		$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
86
+		$objWriter->setPreCalculateFormulas(true);
87
+		$objWriter->save('php://output');
88 88
 		exit ();
89 89
 	}
90 90
 	/**
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 	 * @param unknown $string        	
93 93
 	 */
94 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 );
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 99
 		}
100
-		$string = substr ( $string, 0, 29 );
100
+		$string = substr($string, 0, 29);
101 101
 		return $string;
102 102
 	}
103 103
 	/**
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param unknown $title        	
106 106
 	 */
107 107
 	static function printTitle($objPHPExcel, $title) {
108
-		$objPHPExcel->getActiveSheet ()->setTitle ( ExcelExport::clearName ( $title, array('ddzia') ), true );
109
-		$objPHPExcel->getActiveSheet ()->setCellValueByColumnAndRow ( 0, 1, $title );
108
+		$objPHPExcel->getActiveSheet()->setTitle(ExcelExport::clearName($title, array('ddzia')), true);
109
+		$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, $title);
110 110
 	}
111 111
 	/**
112 112
 	 *
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	static function newSheet($objPHPExcel, $index = -1) {
116 116
 		if ($index < 0) {
117
-			$index = $objPHPExcel->getSheetCount ();
117
+			$index = $objPHPExcel->getSheetCount();
118 118
 		}
119
-		$objPHPExcel->createSheet ( $index );
120
-		$objPHPExcel->setActiveSheetIndex ( $index );
121
-		$sheet = $objPHPExcel->getActiveSheet ();
119
+		$objPHPExcel->createSheet($index);
120
+		$objPHPExcel->setActiveSheetIndex($index);
121
+		$sheet = $objPHPExcel->getActiveSheet();
122 122
 		return $sheet;
123 123
 	}
124 124
 	
Please login to merge, or discard this patch.