-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinterface.php
240 lines (208 loc) · 5.63 KB
/
interface.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
/**
* All model interfaces
*/
include_once "class.event.php";
include_once 'class.participant.php';
include_once 'class.registration.php';
include_once 'class.accommodation.php';
/**
* Returns participant results JSON.
* Tested.
*/
function participantSearch($arg){
return json_encode(participant::search($arg));
}
/**
* Returns participant Info.
* Tested.
*/
function participantInfo($tid){
$p = new participant($tid);
$arr = array("tathva_id" => $p->getTatId(),
"name" => $p->getName(),
"college" => $p->getCollege(),
"contact"=>$p->getContact(),
"state" => $p->getAccomRequest(),
"roll"=>$p->getNitcRollNo(),
"status"=>$p->getConfirmStatus());
return json_encode($arr);
}
/** Updates a Participant's personal details
*/
function updateParticipantInfo($tid, $pname, $pemail, $pcoll, $pcntct, $pstate, $preq, $pnitc){
$part=new participant($tid);
$part->updateInfo($pname, $pemail, $pcoll, $pcntct, $pstate, $preq, $pnitc);
}
/**
* Returns the status of a Tathva ID
* Tested.
*/
function participantStatus($tid){
$p = new participant($tid);
return json_encode($p->getConfirmStatus());
}
/**
* Confirms a Tathva ID of a participant.
* Tested.
*/
function participantConfirm($tid){
$p = new participant($tid);
$p->updateStatus("Y");
registration::confirmEventParticipation($tid);
}
/**
* Returns a list of all participant events and team ids.
* Tested.
*/
function participantEvents($tid){
$r = registration::participantEvents($tid);
return json_encode($r);
}
/**
* Generates new Tathva ID's
* Tested.
*/
function genTathvaId(){
$obj=new participant();
$temp=$obj->getLastId();
$temp=$temp+2002;
$str='TAT'."$temp";
return $str;
}
/**
* Deregisters a user from a hospitality
* Tested
*/
function deReg($tatid){
$y=0;
$obj=new participant($tatid);
$obj1=new accommodation($obj->getAccomCaptain());
$x=$obj1->getDereg();
if($x=='Y')
$y=$obj->updateStatus('D');
return $y;
}
/**
* function creates a new user/participant
* Tested
*/
function newUser($pname, $pemail, $pcoll, $pcntct, $pstate, $pgen, $preq) {
$pid = genTathvaId();
$obj = new participant($pid, $pname, $pemail, $pcoll, $pcntct, $pstate, $pgen, $preq,"");
return $pid;
}
/*
* Gets all info for a particular event.
* Tested
*/
function getEventInfo($evid) {
$ob = new event($evid);
$evarray = $ob -> getResourceVar();
return json_encode($evarray);
}
/*
* Gets details of 3 winners of a particular event.
* Tested
*/
function getEventWinnersInfo($evid) {
$ob = new event($evid);
$winners['ev_prize1'] = $ob -> getPrize1();
$winners['ev_prize2'] = $ob -> getPrize2();
$winners['ev_prize3'] = $ob -> getPrize3();
return($winners);
}
/*
* Gets a list of all eventids stored in database.
* Tested
*/
function getAllEventIds() {
return (event::listAllEventIds());
}
/**
* Update prize information of an event
* Tested
*/
function updatePrizelist($evid,$pz1,$pz2,$pz3) {
$ob = new event($evid);
$ob -> setPrize1($pz1);
$ob -> setPrize2($pz2);
$ob -> setPrize3($pz3);
$ob -> updateEvent();
}
function accommodationCreateTeam($captid,$items,$room,$team) {
$obj = new accommodation($captid,$items,$room);
participant::insertAccomCaptain($team,$captid);
}
function accommodationUpdateCapt($oldcapt,$newcapt,$items,$room,$dereg) {
$obj = new accommodation($oldcapt);
$obj -> updateInfo($newcapt,$items,$room,$dereg);
participant::updateAccomCaptain($oldcapt,$newcapt);
}
function accommodationDeleteTeam($captid) {
$obj = new accommodation($captid);
$obj -> deleteTeam();
participant::updateAccomCaptain($captid,'');
}
function listAccommodationData(){
return (accommodation::getAllData());
}
function genTeamId($eventid){
$temp1=substr($eventid,0,3);
$obj=new registration();
$temp=$obj->getLastId($eventid);
$temp=$temp+3001;
$str="$temp1"."$temp";
return $str;
}
function partEventList($tathvaId){
$obj=new registration();
$arr=$obj->participantEvents($tathvaId);
return $arr;
}
function updateTeam($rgEventId,$rgTeamId,$rgCaptainId,$rgPart1,$rgPart2,$rgPart3,$rgPart4,$rgPart5,$rgPart6){
$obj=new registration();
$obj->updateTeamReg($rgEventId,$rgTeamId,$rgCaptainId,$rgPart1,$rgPart2,$rgPart3,$rgPart4,$rgPart5,$rgPart6);
}
function searchTeam($key){
return registration::searchRegisteredTeam($key);
}
function createTeam($rgEventId,$rgTeamId,$rgCaptainId,$rgPart1,$rgPart2,$rgPart3,$rgPart4,$rgPart5,$rgPart6){
$rgTeamId=genTeamId($rgEventId);
$obj=new registration($rgEventId,$rgTeamId,$rgCaptainId,$rgPart1,$rgPart2,$rgPart3,$rgPart4,$rgPart5,$rgPart6);
return $rgTeamId;
}
function listEventTeams($eventid){
$allteams = registration::getTeamIds($eventid);
$cnt=count($allteams);
$ev = new event($eventid);
$min = $ev->getMinimum();
$max = $ev->getMaximum();
$res=array();
$i=0;
while($i<$cnt)
{
$teamid = $allteams[$i]['rg_teamid'];
$obj = new registration($allteams[$i]['rg_teamid']);
$str = $obj -> eventConfirm($min,$max);
if($str=="Confirm")
{
$pc1 = array($obj->getRgCaptainConfirm(), $obj->getRgConfirm1(), $obj->getRgConfirm2(), $obj->getRgConfirm3(), $obj->getRgConfirm4(), $obj->getRgConfirm5(), $obj->getRgConfirm6());
$pc = array($obj->getRgCaptainId(), $obj->getRgPart1(), $obj->getRgPart2(), $obj->getRgPart3(), $obj->getRgPart4(), $obj->getRgPart5(), $obj->getRgPart6());
$ct=count($pc);
$j=0;
$csv="";
while($j<$ct)
{
if($pc[$j]!='' && $pc1[$j]!='N')
$csv.="$pc[$j],";
$j++;
}
$csv=trim($csv,",");
$res[$teamid]=$csv;
}
$i++;
}
return $res;
}
?>