@@ -12,7 +12,7 @@ |
||
12 | 12 | * @return void |
13 | 13 | */ |
14 | 14 | spl_autoload_register( |
15 | - function ($class) { |
|
15 | + function($class) { |
|
16 | 16 | |
17 | 17 | // project-specific namespace prefix |
18 | 18 | //$prefix = 'Foo\\Bar\\'; |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | * |
7 | 7 | */ |
8 | 8 | |
9 | -class CHTMLTable{ |
|
9 | +class CHTMLTable { |
|
10 | 10 | |
11 | 11 | private $data; |
12 | 12 | |
13 | 13 | //tar emot en headline som enkel array och data som tvådimensionell array |
14 | - public function __construct($headline, $data){ |
|
14 | + public function __construct($headline, $data) { |
|
15 | 15 | $this->data = $data; |
16 | 16 | $this->headline = $headline; |
17 | 17 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return string $html, sträng innehållande en tabell |
25 | 25 | */ |
26 | 26 | |
27 | - public function getTable(){ |
|
27 | + public function getTable() { |
|
28 | 28 | |
29 | 29 | $table = ""; |
30 | 30 | |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | <table class> |
33 | 33 | <tr class='rows'>"; |
34 | 34 | |
35 | - foreach($this->headline as $h) { |
|
36 | - $table.= "<th>" . $h ."</th>"; |
|
35 | + foreach ($this->headline as $h) { |
|
36 | + $table .= "<th>" . $h . "</th>"; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $table .= "</tr>"; |
40 | - foreach($this->data as $d){ |
|
40 | + foreach ($this->data as $d) { |
|
41 | 41 | $table .= "<tr>"; |
42 | 42 | foreach ($d as $v) { |
43 | 43 | $table .= "<td>$v</td>"; |
44 | 44 | } |
45 | 45 | $table .= "</tr>"; |
46 | 46 | } |
47 | - $table .="</table></div>"; |
|
47 | + $table .= "</table></div>"; |
|
48 | 48 | |
49 | 49 | return $table; |
50 | 50 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | //gör om arrayen av objekt till en array av arrayer |
32 | 32 | foreach ($all as $key1=>$value) { |
33 | - foreach ($value as $key2=>$v){ |
|
33 | + foreach ($value as $key2=>$v) { |
|
34 | 34 | if (!in_array($key2, $noListing)) { //$noListing, parametrar som inte ska vara med |
35 | 35 | $aContent[$key1][$key2] = $v; |
36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | //hittar objektens parametrar/tabellens kolumnnamn och skapar |
43 | 43 | //en ny array av rubriker |
44 | 44 | foreach ($all as $key1=>$value) { |
45 | - foreach ($value as $key2=>$v){ |
|
45 | + foreach ($value as $key2=>$v) { |
|
46 | 46 | if (!in_array($key2, $noListing)) { //$noListing, parametrar som inte ska vara med |
47 | 47 | $aHeading[] = $key2; |
48 | 48 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ]); |
64 | 64 | } |
65 | 65 | |
66 | - public function initAction($model){ //används för att befolka databasen, bara för att testa |
|
66 | + public function initAction($model) { //används för att befolka databasen, bara för att testa |
|
67 | 67 | $model->setDI($this->di); |
68 | 68 | $model->init(); |
69 | 69 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/config_with_app.php'; |
|
3 | +require __DIR__ . '/config_with_app.php'; |
|
4 | 4 | |
5 | 5 | $app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN); |
6 | 6 | |
7 | 7 | |
8 | 8 | // Create services and inject into the app. |
9 | -$di = new \Anax\DI\CDIFactoryDefault(); |
|
9 | +$di = new \Anax\DI\CDIFactoryDefault(); |
|
10 | 10 | |
11 | 11 | $di->set('TableController', function() use ($di){ |
12 | 12 | $controller = new \Jovis\HTMLTable\TableController(); |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | |
33 | 33 | $app->theme->setTitle("HTML-tabell"); |
34 | 34 | |
35 | - $model = new Jovis\DatabaseModel\Movie(); // modellen man vill skriva ut som html-tabell |
|
35 | + $model = new Jovis\DatabaseModel\Movie(); // modellen man vill skriva ut som html-tabell |
|
36 | 36 | |
37 | 37 | |
38 | - $app->dispatcher->forward([ //används bara för att skapa tabell och befolka databasen, för test |
|
38 | + $app->dispatcher->forward([//används bara för att skapa tabell och befolka databasen, för test |
|
39 | 39 | 'controller' => 'table', |
40 | 40 | 'action' => 'init', |
41 | 41 | 'params' => [$model], |
@@ -140,7 +140,7 @@ |
||
140 | 140 | */ |
141 | 141 | public function update($values) |
142 | 142 | { |
143 | - $keys = array_keys($values); |
|
143 | + $keys = array_keys($values); |
|
144 | 144 | $values = array_values($values); |
145 | 145 | |
146 | 146 | // Its update, remove id and use as where-clause |