|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Klass AndelAjax. |
|
5
|
|
|
* @author Niklas Dougherty |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
declare(strict_types=1); |
|
9
|
|
|
|
|
10
|
|
|
namespace Tips\Moduler\Ajax; |
|
11
|
|
|
|
|
12
|
|
|
use Tips\Klasser\Preludium; |
|
13
|
|
|
use Tips\Egenskaper\Ajax; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Ajaxanrop ligger utanför ordinarie ordning. |
|
17
|
|
|
*/ |
|
18
|
1 |
|
require_once dirname(__FILE__) . '/../../../vendor/autoload.php'; |
|
19
|
1 |
|
new Preludium(); |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Klass AndelAjax. |
|
23
|
|
|
* @SuppressWarnings("PHPMD.UnusedPrivateMethod") |
|
24
|
|
|
*/ |
|
25
|
|
|
final class AndelAjax { |
|
26
|
|
|
use Ajax; |
|
|
|
|
|
|
27
|
|
|
|
|
28
|
3 |
|
public function __construct() { |
|
29
|
3 |
|
$this->förgrena(); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Håll andel ettor inom godtagbara intervall. |
|
34
|
|
|
*/ |
|
35
|
1 |
|
private function andel_1_min(): void { |
|
|
|
|
|
|
36
|
1 |
|
$andel_1_min = $this->db_preferenser->validera_indata('andel_1_min', 0, 13, 3, 'andel.andel_1_min'); |
|
37
|
1 |
|
$andel_1_max = $this->db_preferenser->validera_indata('andel_1_max', 0, 13, 8, 'andel.andel_1_max'); |
|
38
|
1 |
|
$this->db_preferenser->komparera_preferenser($andel_1_min, $andel_1_max, 3, 8, 'andel.andel_1_min', 'andel.andel_1_max'); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Håll andel kryss inom godtagbara intervall. |
|
43
|
|
|
*/ |
|
44
|
1 |
|
private function andel_x_min(): void { |
|
|
|
|
|
|
45
|
1 |
|
$andel_x_min = $this->db_preferenser->validera_indata('andel_x_min', 0, 13, 1, 'andel.andel_x_min'); |
|
46
|
1 |
|
$andel_x_max = $this->db_preferenser->validera_indata('andel_x_max', 0, 13, 6, 'andel.andel_x_max'); |
|
47
|
1 |
|
$this->db_preferenser->komparera_preferenser($andel_x_min, $andel_x_max, 1, 6, 'andel.andel_x_min', 'andel.andel_x_max'); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Håll andel tvåor inom godtagbara intervall. |
|
52
|
|
|
*/ |
|
53
|
1 |
|
private function andel_2_min(): void { |
|
|
|
|
|
|
54
|
1 |
|
$andel_2_min = $this->db_preferenser->validera_indata('andel_2_min', 0, 13, 2, 'andel.andel_2_min'); |
|
55
|
1 |
|
$andel_2_max = $this->db_preferenser->validera_indata('andel_2_max', 0, 13, 7, 'andel.andel_2_max'); |
|
56
|
1 |
|
$this->db_preferenser->komparera_preferenser($andel_2_min, $andel_2_max, 2, 7, 'andel.andel_2_min', 'andel.andel_2_max'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Spara attraktionsfaktor. |
|
61
|
|
|
*/ |
|
62
|
1 |
|
private function attraktionsfaktor(): void { |
|
|
|
|
|
|
63
|
1 |
|
$this->ändra_attraktionsfaktor('andel'); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
new AndelAjax(); |
|
68
|
|
|
|