@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | } else { |
70 | 70 | $roles .= '</ul>'; |
71 | 71 | } |
72 | - $roles .= '<p><strong>'.$groupName.'</strong></p>'; |
|
72 | + $roles .= '<p><strong>' . $groupName . '</strong></p>'; |
|
73 | 73 | $roles .= '<ul>'; |
74 | 74 | } |
75 | - $roles .= '<li>'.$row['roleName'].'</li>'; |
|
75 | + $roles .= '<li>' . $row['roleName'] . '</li>'; |
|
76 | 76 | } |
77 | 77 | $roles .= '</ul>'; |
78 | 78 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | <li> |
120 | 120 | <a class="js-no-link" href="addUser.php?action=edit&user=<?php echo $user->getId() ?>" data-toggle='modal' data-target='#user<?php echo $user->getId() ?>'> |
121 | 121 | <img src="<?php echo getProfileImageUrl($user->getId(), 'large') ?>" alt="User Image"> |
122 | - <span class="users-list-name"><?php echo $user->getFirstName().' '.$user->getLastName() ?></span> |
|
122 | + <span class="users-list-name"><?php echo $user->getFirstName() . ' ' . $user->getLastName() ?></span> |
|
123 | 123 | </a> |
124 | 124 | <?php if (isAdmin($user->getId())): ?> |
125 | 125 | <span class="label label-warning">Admin</span> |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | <div class="modal-header"> |
141 | 141 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
142 | 142 | <h4 class="modal-title"> |
143 | - <?php echo $user->getFirstName().' '.$user->getLastName() ?> |
|
143 | + <?php echo $user->getFirstName() . ' ' . $user->getLastName() ?> |
|
144 | 144 | <?php if (isAdmin($user->getId())): ?> |
145 | 145 | <span class="label label-warning">Admin</span> |
146 | 146 | <?php endif ?> |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | </h4> |
154 | 154 | </div> |
155 | 155 | <div class="modal-body"> |
156 | - <p><strong>Email address:</strong> <a href="<?php echo $user->getEmail() ? 'mailto:'.$user->getEmail() : '' ?>"><?php echo $user->getEmail() ? $user->getEmail() : 'none' ?></a></p> |
|
156 | + <p><strong>Email address:</strong> <a href="<?php echo $user->getEmail() ? 'mailto:' . $user->getEmail() : '' ?>"><?php echo $user->getEmail() ? $user->getEmail() : 'none' ?></a></p> |
|
157 | 157 | <p><strong>Mobile:</strong> <?php echo $user->getMobile() ? $user->getMobile() : 'none' ?></p> |
158 | 158 | <p><strong>Roles:</strong></p> |
159 | 159 | <?php $userRoles = $user->getUserRoles() ?> |
160 | 160 | <ul> |
161 | - <?php echo $userRoles->count() > 0 ? '' : '<li class="text-red">'.$user->getFirstName().' has no roles</li>' ?> |
|
161 | + <?php echo $userRoles->count() > 0 ? '' : '<li class="text-red">' . $user->getFirstName() . ' has no roles</li>' ?> |
|
162 | 162 | <?php foreach ($userRoles as $userRole): ?> |
163 | 163 | <li> |
164 | 164 | <?php echo $userRole->getRole()->getGroup()->getName() ?>: <?php echo $userRole->getRole()->getName() ?> |
@@ -6,31 +6,31 @@ |
||
6 | 6 | // To help the built-in PHP dev server, check if the request was actually for |
7 | 7 | // something which should probably be served as a static file |
8 | 8 | $url = parse_url($_SERVER['REQUEST_URI']); |
9 | - $file = __DIR__.$url['path']; |
|
9 | + $file = __DIR__ . $url['path']; |
|
10 | 10 | if (is_file($file)) { |
11 | 11 | return false; |
12 | 12 | } |
13 | 13 | } |
14 | 14 | |
15 | -require __DIR__.'/../vendor/autoload.php'; |
|
15 | +require __DIR__ . '/../vendor/autoload.php'; |
|
16 | 16 | |
17 | 17 | // setup Propel (autoload configured though composer) |
18 | -require_once __DIR__.'/../generated-conf/config.php'; |
|
18 | +require_once __DIR__ . '/../generated-conf/config.php'; |
|
19 | 19 | |
20 | 20 | session_start(); |
21 | 21 | |
22 | 22 | // Instantiate the app |
23 | -$settings = require __DIR__.'/../src/settings.php'; |
|
23 | +$settings = require __DIR__ . '/../src/settings.php'; |
|
24 | 24 | $app = new \Slim\App($settings); |
25 | 25 | |
26 | 26 | // Set up dependencies |
27 | -require __DIR__.'/../src/dependencies.php'; |
|
27 | +require __DIR__ . '/../src/dependencies.php'; |
|
28 | 28 | |
29 | 29 | // Register middleware |
30 | -require __DIR__.'/../src/middleware.php'; |
|
30 | +require __DIR__ . '/../src/middleware.php'; |
|
31 | 31 | |
32 | 32 | // Register routes |
33 | -require __DIR__.'/../src/routes.php'; |
|
33 | +require __DIR__ . '/../src/routes.php'; |
|
34 | 34 | |
35 | 35 | // Run app |
36 | 36 | $app->run(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function getUpSQL() |
41 | 41 | { |
42 | 42 | return [ |
43 | - 'default' => ' |
|
43 | + 'default' => ' |
|
44 | 44 | # This is a fix for InnoDB in MySQL >= 4.1.x |
45 | 45 | # It "suspends judgement" for fkey relationships until are tables are set. |
46 | 46 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function getDownSQL() |
173 | 173 | { |
174 | 174 | return [ |
175 | - 'default' => ' |
|
175 | + 'default' => ' |
|
176 | 176 | # This is a fix for InnoDB in MySQL >= 4.1.x |
177 | 177 | # It "suspends judgement" for fkey relationships until are tables are set. |
178 | 178 | SET FOREIGN_KEY_CHECKS = 0; |
@@ -22,16 +22,16 @@ |
||
22 | 22 | } |
23 | 23 | //$acceptedFileExtensions = ['jpg', 'png', 'jpeg', 'gif', 'docx', 'pdf', 'xlsx', 'pptx']; |
24 | 24 | $acceptedFileTypes = ['image/gif', 'image/png', 'image/jpeg', 'application/pdf', 'application/msword', 'application/excel']; |
25 | - $target_dir = __DIR__.'/../documents/'; |
|
25 | + $target_dir = __DIR__ . '/../documents/'; |
|
26 | 26 | $this->setUrl($file->getClientFilename()); |
27 | 27 | //$fileExtension = pathinfo(basename($file->getName()),PATHINFO_EXTENSION); |
28 | 28 | |
29 | 29 | // Allow certain file formats only |
30 | 30 | if (!in_array($file->getClientMediaType(), $acceptedFileTypes)) { |
31 | - throw new InvalidArgumentException('Sorry, only '.implode(', ', $acceptedFileTypes).' files are allowed.'); |
|
31 | + throw new InvalidArgumentException('Sorry, only ' . implode(', ', $acceptedFileTypes) . ' files are allowed.'); |
|
32 | 32 | } |
33 | 33 | $this->save(); |
34 | - $target_file = $target_dir.$this->getId(); |
|
34 | + $target_file = $target_dir . $this->getId(); |
|
35 | 35 | |
36 | 36 | // Check if file already exists |
37 | 37 | if (file_exists($target_file)) { |
@@ -19,11 +19,11 @@ |
||
19 | 19 | { |
20 | 20 | return EventQuery::create() |
21 | 21 | ->useEventPersonQuery() |
22 | - ->useUserRoleQuery() |
|
22 | + ->useUserRoleQuery() |
|
23 | 23 | ->useRoleQuery() |
24 | - ->filterByGroup($this) |
|
24 | + ->filterByGroup($this) |
|
25 | + ->endUse() |
|
25 | 26 | ->endUse() |
26 | - ->endUse() |
|
27 | 27 | ->endUse() |
28 | 28 | ->orderByDate('desc') |
29 | 29 | ->findOne(); |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | $serviceContainer->setAdapterClass('default', 'mysql'); |
8 | 8 | $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); |
9 | 9 | $manager->setConfiguration([ |
10 | - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
|
11 | - 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], |
|
12 | - 'user' => $config['db']['user'], |
|
13 | - 'password' => $config['db']['pass'], |
|
14 | - 'attributes' => [ |
|
10 | + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
|
11 | + 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], |
|
12 | + 'user' => $config['db']['user'], |
|
13 | + 'password' => $config['db']['pass'], |
|
14 | + 'attributes' => [ |
|
15 | 15 | 'ATTR_EMULATE_PREPARES' => false, |
16 | 16 | 'ATTR_TIMEOUT' => 30, |
17 | - ], |
|
18 | - 'model_paths' => [ |
|
17 | + ], |
|
18 | + 'model_paths' => [ |
|
19 | 19 | 0 => 'src', |
20 | 20 | 1 => 'vendor', |
21 | - ], |
|
21 | + ], |
|
22 | 22 | ]); |
23 | 23 | $manager->setName('default'); |
24 | 24 | $serviceContainer->setConnectionManager('default', $manager); |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | $serviceContainer->setAdapterClass('test', 'sqlite'); |
27 | 27 | $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); |
28 | 28 | $manager->setConfiguration([ |
29 | - 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
|
30 | - 'dsn' => 'sqlite:/var/tmp/test.db', |
|
31 | - 'attributes' => [ |
|
29 | + 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
|
30 | + 'dsn' => 'sqlite:/var/tmp/test.db', |
|
31 | + 'attributes' => [ |
|
32 | 32 | 'ATTR_EMULATE_PREPARES' => false, |
33 | 33 | 'ATTR_TIMEOUT' => 30, |
34 | - ], |
|
35 | - 'model_paths' => [ |
|
34 | + ], |
|
35 | + 'model_paths' => [ |
|
36 | 36 | 0 => 'src', |
37 | 37 | 1 => 'vendor', |
38 | - ], |
|
38 | + ], |
|
39 | 39 | ]); |
40 | 40 | $manager->setName('test'); |
41 | 41 | $serviceContainer->setConnectionManager('test', $manager); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include __DIR__.'/../config/database.php'; |
|
3 | +include __DIR__ . '/../config/database.php'; |
|
4 | 4 | $serviceContainer = \Propel\Runtime\Propel::getServiceContainer(); |
5 | 5 | $serviceContainer->checkVersion('2.0.0-dev'); |
6 | 6 | |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); |
9 | 9 | $manager->setConfiguration([ |
10 | 10 | 'classname' => 'Propel\\Runtime\\Connection\\ConnectionWrapper', |
11 | - 'dsn' => 'mysql:host='.$config['db']['host'].';dbname='.$config['db']['dbname'], |
|
11 | + 'dsn' => 'mysql:host=' . $config['db']['host'] . ';dbname=' . $config['db']['dbname'], |
|
12 | 12 | 'user' => $config['db']['user'], |
13 | 13 | 'password' => $config['db']['pass'], |
14 | 14 | 'attributes' => [ |
@@ -28,13 +28,13 @@ |
||
28 | 28 | $currentTimestamp = $date = strftime('%F %T', time()); |
29 | 29 | |
30 | 30 | $data = [ |
31 | - ['field' => 'name', 'type' => 'string', 'value' => $this->name], |
|
32 | - ['field' => 'date', 'type' => 'string', 'value' => $this->datetime], |
|
33 | - ['field' => 'eventGroup', 'type' => 'int', 'value' => $this->series->getId()], |
|
34 | - ['field' => 'type', 'type' => 'int', 'value' => $this->type->getId()], |
|
35 | - ['field' => 'subType', 'type' => 'int', 'value' => $this->sub_type->getId()], |
|
36 | - ['field' => 'location', 'type' => 'int', 'value' => $this->location->getId()], |
|
37 | - ['field' => 'created', 'type' => 'datetime', 'value' => $currentTimestamp], |
|
31 | + ['field' => 'name', 'type' => 'string', 'value' => $this->name], |
|
32 | + ['field' => 'date', 'type' => 'string', 'value' => $this->datetime], |
|
33 | + ['field' => 'eventGroup', 'type' => 'int', 'value' => $this->series->getId()], |
|
34 | + ['field' => 'type', 'type' => 'int', 'value' => $this->type->getId()], |
|
35 | + ['field' => 'subType', 'type' => 'int', 'value' => $this->sub_type->getId()], |
|
36 | + ['field' => 'location', 'type' => 'int', 'value' => $this->location->getId()], |
|
37 | + ['field' => 'created', 'type' => 'datetime', 'value' => $currentTimestamp], |
|
38 | 38 | ]; |
39 | 39 | |
40 | 40 | if (isset($this->notes)) { |
@@ -24,12 +24,12 @@ |
||
24 | 24 | public function createInDb(Database $db) |
25 | 25 | { |
26 | 26 | if (empty($this->name) || empty($this->datetime) || empty($this->series) || empty($this->type) || empty($this->sub_type) || empty($this->location)) { |
27 | - $message = 'Series name ('.$this->name.')'; |
|
28 | - $message .= ' or date ('.$this->datetime.')'; |
|
29 | - $message .= ' or series ('.$this->series.')'; |
|
30 | - $message .= ' or type ('.$this->type.')'; |
|
31 | - $message .= ' or sub_type ('.$this->sub_type.')'; |
|
32 | - $message .= ' or location ('.$this->location.')'; |
|
27 | + $message = 'Series name (' . $this->name . ')'; |
|
28 | + $message .= ' or date (' . $this->datetime . ')'; |
|
29 | + $message .= ' or series (' . $this->series . ')'; |
|
30 | + $message .= ' or type (' . $this->type . ')'; |
|
31 | + $message .= ' or sub_type (' . $this->sub_type . ')'; |
|
32 | + $message .= ' or location (' . $this->location . ')'; |
|
33 | 33 | $message .= ' cannot be empty.'; |
34 | 34 | |
35 | 35 | throw new Exception($message); |
@@ -38,14 +38,14 @@ |
||
38 | 38 | |
39 | 39 | $id = urlencode($id); |
40 | 40 | |
41 | -$url = 'http://localhost/api/v1/series/'.$id; |
|
41 | +$url = 'http://localhost/api/v1/series/' . $id; |
|
42 | 42 | $response = file_get_contents($url); |
43 | 43 | |
44 | -echo 'URL: '.$url; |
|
44 | +echo 'URL: ' . $url; |
|
45 | 45 | |
46 | 46 | $responseData = json_decode($response, true); |
47 | 47 | $data = $responseData['data']; |
48 | 48 | |
49 | 49 | echo var_dump($responseData); |
50 | 50 | |
51 | -echo 'series '.$id.': id = '.$data['id'].', name = '.$data['name'].', description = '.$data['description']; |
|
51 | +echo 'series ' . $id . ': id = ' . $data['id'] . ', name = ' . $data['name'] . ', description = ' . $data['description']; |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | $data = [ |
23 | - ['field' => 'name', 'type' => 'string', 'value' => $this->name], |
|
24 | - ['field' => 'description', 'type' => 'string', 'value' => $this->description], |
|
23 | + ['field' => 'name', 'type' => 'string', 'value' => $this->name], |
|
24 | + ['field' => 'description', 'type' => 'string', 'value' => $this->description], |
|
25 | 25 | ]; |
26 | 26 | |
27 | 27 | $db->insert($this->db_table, $data); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | $whereCondition = 'id = '.$id; |
41 | 41 | $where = [ |
42 | - $whereCondition, |
|
42 | + $whereCondition, |
|
43 | 43 | ]; |
44 | 44 | |
45 | 45 | if ($db->delete($this->db_table, $where)) { |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | $columns = [ |
62 | - 'id', |
|
63 | - 'name', |
|
64 | - 'description', |
|
62 | + 'id', |
|
63 | + 'name', |
|
64 | + 'description', |
|
65 | 65 | ]; |
66 | 66 | |
67 | 67 | $whereCondition = 'id = '.$id; |
68 | 68 | $where = [ |
69 | - $whereCondition, |
|
69 | + $whereCondition, |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | $result = $db->selectSingle('Type', $this->db_table, $columns, $where); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | public function createInDb(Database $db) |
17 | 17 | { |
18 | 18 | if (empty($this->name) || empty($this->description)) { |
19 | - throw new Exception('Series name ('.$this->name.') or description ('.$this->description.') cannot be empty.'); |
|
19 | + throw new Exception('Series name (' . $this->name . ') or description (' . $this->description . ') cannot be empty.'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | $data = [ |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $id = $this->id; |
38 | 38 | } |
39 | 39 | |
40 | - $whereCondition = 'id = '.$id; |
|
40 | + $whereCondition = 'id = ' . $id; |
|
41 | 41 | $where = [ |
42 | 42 | $whereCondition, |
43 | 43 | ]; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | 'description', |
65 | 65 | ]; |
66 | 66 | |
67 | - $whereCondition = 'id = '.$id; |
|
67 | + $whereCondition = 'id = ' . $id; |
|
68 | 68 | $where = [ |
69 | 69 | $whereCondition, |
70 | 70 | ]; |