forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdifficultyForm.php
More file actions
52 lines (36 loc) · 1.27 KB
/
difficultyForm.php
File metadata and controls
52 lines (36 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use Utils\View\View;
use Utils\Uri\Uri;
require_once('./lib/common.inc.php');
set_tpl_subtitle('Geocache Difficulty Rating System');
$view = tpl_getView();
$view->addLocalCss(Uri::getLinkWithModificationTime('tpl/stdstyle/cacheEdit/difficultyForm.css'));
if ( isset($_POST["Rating"]) && $_POST["Rating"] == "TRUE") {
// print results
tpl_set_tplname('cacheEdit/difficultyFormResult');
$Equipment = $_POST["Equipment"];
$Night = $_POST["Night"];
$Length = $_POST["Length"];
$Trail = $_POST["Trail"];
$Overgrowth = $_POST["Overgrowth"];
$Elevation = $_POST["Elevation"];
$Difficulty = $_POST["Difficulty"];
$maximum = max($Equipment, $Night, $Length, $Trail, $Overgrowth, $Elevation);
if ($maximum > 0) {
$terrain = $maximum
+ 0.25 * ($Equipment == $maximum)
+ 0.25 * ($Night == $maximum)
+ 0.25 * ($Length == $maximum)
+ 0.25 * ($Trail == $maximum)
+ 0.25 * ($Overgrowth == $maximum)
+ 0.25 * ($Elevation == $maximum) - 0.25 + 1;
}else{
$terrain = 1;
}
$view->setVar('diffResult', $Difficulty);
$view->setVar('terrainResult', $terrain);
} else {
// print form
tpl_set_tplname('cacheEdit/difficultyForm');
}
tpl_BuildTemplate();