-
Notifications
You must be signed in to change notification settings - Fork 3
/
common_rg_race.inc.php
132 lines (120 loc) · 3.37 KB
/
common_rg_race.inc.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?
function _DateDiffInDays(&$date1,&$date2)
{
$diff = (int)($date1 - $date2);
$diff = _todays($diff);
$diff = abs($diff);
return $diff;
}
function _GetOldReg($zaznam,$curr_date)
{
if($zaznam['prihlasky'] == 1)
{
return ($zaznam['prihlasky1'] < $curr_date ) ? array($zaznam['prihlasky1'],0) : array(0,0);
}
else
{
if ($zaznam['prihlasky'] >= 5 && $zaznam['prihlasky5'] < $curr_date )
return array($zaznam['prihlasky5'],5);
if ($zaznam['prihlasky'] >= 4 && $zaznam['prihlasky4'] < $curr_date )
return array($zaznam['prihlasky4'],4);
if ($zaznam['prihlasky'] >= 3 && $zaznam['prihlasky3'] < $curr_date )
return array($zaznam['prihlasky3'],3);
if ($zaznam['prihlasky'] >= 2 && $zaznam['prihlasky2'] < $curr_date )
return array($zaznam['prihlasky2'],2);
if ($zaznam['prihlasky'] >= 1 && $zaznam['prihlasky1'] < $curr_date )
return array($zaznam['prihlasky1'],1);
return array(0,0);
}
return array(0,0);
}
function _GetNewReg(&$zaznam,$curr_date)
{
if($zaznam['prihlasky'] == 1)
{
return ($zaznam['prihlasky1'] >= $curr_date ) ? array($zaznam['prihlasky1'],0) : array(0,0);
}
else
{
if ($zaznam['prihlasky'] >= 1 && $zaznam['prihlasky1'] >= $curr_date )
return array($zaznam['prihlasky1'],1);
if ($zaznam['prihlasky'] >= 2 && $zaznam['prihlasky2'] >= $curr_date )
return array($zaznam['prihlasky2'],2);
if ($zaznam['prihlasky'] >= 3 && $zaznam['prihlasky3'] >= $curr_date )
return array($zaznam['prihlasky3'],3);
if ($zaznam['prihlasky'] >= 4 && $zaznam['prihlasky4'] >= $curr_date )
return array($zaznam['prihlasky4'],4);
if ($zaznam['prihlasky'] >= 5 && $zaznam['prihlasky5'] >= $curr_date )
return array($zaznam['prihlasky5'],5);
return array(0,0);
}
return array(0,0);
}
function _GetRegsColors($reg,$curr_date)
{
$class = 'center';
if($reg != 0)
{
$diff = _DateDiffInDays($reg,$curr_date);
if ($diff < 3)
$class = 'center_alert2';
else if ($diff < 8)
$class = 'center_alert7';
else if ($diff < 22)
$class = 'center_alert21';
}
else
{
$class = 'center_gray';
}
return $class;
}
function _GetOldRegClass($zaznam,$curr_date)
{
$reg = _GetOldReg($zaznam,$curr_date);
$rg = (is_array($reg)) ? $reg[0] : $reg;
return _GetRegsColors($rg,$curr_date);
}
function _GetNewRegClass(&$zaznam,$curr_date)
{
$reg = _GetNewReg($zaznam,$curr_date);
$rg = (is_array($reg)) ? $reg[0] : $reg;
return _GetRegsColors($rg,$curr_date);
}
function _Reg2Str($reg)
{
if(is_array($reg))
{
if ($reg[0] != 0)
return ($reg[1] != 0) ? Date2String($reg[0]).' / '.$reg[1] : Date2String($reg[0]);
else
return '-';
}
else
return Date2String($reg);
}
function Term_list(&$zaznam)
{
if($zaznam['prihlasky'] == 0 || $zaznam['prihlasky1'] == 0)
{
return '-';
}
else if($zaznam['prihlasky'] == 1)
{
return _Reg2Str($zaznam['prihlasky1']);
}
else
{
$export = _Reg2Str(array($zaznam['prihlasky1'],1));
if ($zaznam['prihlasky'] >= 2 )
$export .= ' | '._Reg2Str(array($zaznam['prihlasky2'],2));
if ($zaznam['prihlasky'] >= 3 )
$export .= ' | '._Reg2Str(array($zaznam['prihlasky3'],3));
if ($zaznam['prihlasky'] >= 4 )
$export .= ' | '._Reg2Str(array($zaznam['prihlasky4'],4));
if ($zaznam['prihlasky'] >= 5 )
$export .= ' | '._Reg2Str(array($zaznam['prihlasky5'],5));
return $export;
}
}
?>