EliteConf
 All Data Structures Namespaces Files Functions Variables Pages
ConferenceController2.php
Go to the documentation of this file.
1 <?php
2 
4 {
9  public $layout='//layouts/column2';
10 
14  public function filters()
15  {
16  return array(
17  'accessControl', // perform access control for CRUD operations
18  'postOnly + delete', // we only allow deletion via POST request
19  );
20  }
21 
27  public function accessRules()
28  {
29  return array(
30  array('allow', // allow authenticated user to perform 'index' and 'view' actions
31  'actions'=>array('index','view'),
32  'users'=>array('@'),
33  ),
34  array('allow', // allow authenticated user to perform 'create' and 'update' actions
35  'actions'=>array('create','update'),
36  'users'=>array('@'),
37  ),
38  array('allow', // allow admin user to perform 'admin' and 'delete' actions
39  'actions'=>array('admin','delete'),
40  'users'=>array('admin'),
41  ),
42  array('deny', // deny all users
43  'users'=>array('*'),
44  ),
45  );
46  }
47 
52  public function actionView($id)
53  {
54  $this->render('view',array(
55  'model'=>$this->loadModel($id),
56 
57  )
58  );
59 
60  }
61 
62 
63  public function attends()
64  {
65 
67 
68  if(Yii::app()->user->id != NULL)
69  $usid = Yii::app()->user->id;
70  else
71  $usid = 0;
72 
73  $id = $_GET['id'];
74 
75  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND userid=$usid AND usertype=4");
76 
77  while($row = mysql_fetch_array($participates))
78  {
79  if($usid == $row['userid']) {echo "hidden";}
80  else echo "visible";
81  }
82  }
83 
84  public function attends2()
85  {
86 
88 
89  if(Yii::app()->user->id != NULL)
90  $usid = Yii::app()->user->id;
91  else
92  $usid = 0;
93 
94  $id = $_GET['id'];
95 
96  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND usertype=4");
97 
98  $i=0;
99  while($row = mysql_fetch_array($participates))
100  {
101 
102  if($row['userid']==$usid) $i++;
103  else "";
104 
105  }
106 
107  if($i==0) echo "hidden";
108  else echo "visible";
109  }
110 
111  public function authors()
112  {
113 
115 
116  if(Yii::app()->user->id != NULL)
117  $usid = Yii::app()->user->id;
118  else
119  $usid = 0;
120 
121  $id = $_GET['id'];
122 
123  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND userid=$usid AND usertype=2");
124 
125  while($row = mysql_fetch_array($participates))
126  {
127  if($usid == $row['userid']) {echo "hidden";}
128  else echo "visible";
129  }
130  }
131 
132 
133  public function authors2()
134  {
135 
137 
138  if(Yii::app()->user->id != NULL)
139  $usid = Yii::app()->user->id;
140  else
141  $usid = 0;
142 
143  $id = $_GET['id'];
144 
145  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND usertype=2");
146 
147  $i=0;
148  while($row = mysql_fetch_array($participates))
149  {
150 
151  if($row['userid']==$usid) $i++;
152  else "";
153 
154  }
155 
156  if($i==0) echo "hidden";
157  else echo "visible";
158 
159  }
160 
161  public function referees()
162  {
163 
165 
166  if(Yii::app()->user->id != NULL)
167  $usid = Yii::app()->user->id;
168  else
169  $usid = 0;
170 
171  $id = $_GET['id'];
172 
173  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND userid=$usid AND usertype=3");
174 
175  while($row = mysql_fetch_array($participates))
176  {
177  if($usid == $row['userid']) {echo "hidden";}
178  else echo "visible";
179  }
180  }
181 
182  public function referees2()
183  {
184 
186 
187  if(Yii::app()->user->id != NULL)
188  $usid = Yii::app()->user->id;
189  else
190  $usid = 0;
191 
192  $id = $_GET['id'];
193 
194  $participates = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id AND usertype=3");
195 
196  $i=0;
197  while($row = mysql_fetch_array($participates))
198  {
199 
200  if($row['userid']==$usid) $i++;
201  else "";
202 
203  }
204 
205  if($i==0) echo "hidden";
206  else echo "visible";
207 
208 
209  }
210 
211  public function usersView($id)
212  {
213 
215 
216 
217 //
219 // KONFERANS KULLANICILARINI GORUNTULE
220 
221 if(Yii::app()->user->id != NULL)
222 $usid = Yii::app()->user->id;
223 else
224 $usid = 0;
225 
226 
227 //select all users that participate in this conference
228 $participants = mysql_query("SELECT DISTINCT userid FROM conference_user_type WHERE conferenceid=$id");
229 $i=0;
230 
231 
232 
233 while($row = mysql_fetch_array($participants))
234  {
235 
236  $asd = $row['userid'];
237 
238  $result1 = mysql_query("SELECT * FROM users WHERE userid=$asd");
239  if($result1!=NULL){
240  while($row2 = mysql_fetch_array($result1))
241  {
242 
243  $co = $row2['userid'];
244  echo "<B>".($i+1)."</B>" . ") User Name : " ;//. $row2['username'];
245  echo "<a href=\" /test/index.php?r=user_profile/index&usid=$co\">" . $row2['username'] . "</a>";
246  echo "<br/>";
247  echo "<br/>";
248  $i++;
249  }
250  }
251  else {echo "<br/>";echo "<br/>";echo "<br/>";}
252  }
253 }
254 
255 
256  public function papersView($id)
257  {
259 
260 //
262 // KONFERANS PAPER'LARINI GORUNTULE
263 
264 if(Yii::app()->user->id != NULL)
265 $usid = Yii::app()->user->id;
266 else
267 $usid = 0;
268 
269 
270 
271 
272 //select all papers that belong to the conference
273 $papers = mysql_query("SELECT DISTINCT paperid FROM conference_paper WHERE conferenceid=$id");
274 $i=0;
275 
276 
277 while($row = mysql_fetch_array($papers))
278  {
279 
280  $asd = $row['paperid'];
281 
282  $result1 = mysql_query("SELECT * FROM paper WHERE id=$asd");
283  if($result1!=NULL){
284  while($row2 = mysql_fetch_array($result1))
285  {
286 
287  $co = $row2['id'];
288  echo "<B>".($i+1)."</B>" . ") Paper Name : " ;//. $row2['username'];
289  echo "<a href=\" /test/index.php?r=paper/view&id=$co\">" . $row2['paper_name'] . "</a>";
290  echo "<br/>";
291  echo "<br/>";
292 
293  $i++;
294 
295  }
296 
297  }
298  else {echo "<br/>";}
299 
300 }
301  if($i==0) echo "No Papers Submitted Yet";
302  else ;
303 
304 
305  }
306 
307 
312  public function actionCreate()
313  {
314  $model=new Conference;
315 
316  // Uncomment the following line if AJAX validation is needed
317  // $this->performAjaxValidation($model);
318 
319  if(isset($_POST['Conference']))
320  {
321  $model->attributes=$_POST['Conference'];
322  if($model->save())
323  $this->redirect(array('view','id'=>$model->conferenceid));
324  }
325 
326  $this->render('create',array(
327  'model'=>$model,
328  ));
329  }
330 
336  public function actionUpdate($id)
337  {
338  $model=$this->loadModel($id);
339 
340  // Uncomment the following line if AJAX validation is needed
341  // $this->performAjaxValidation($model);
342 
343  if(isset($_POST['Conference']))
344  {
345  $model->attributes=$_POST['Conference'];
346  if($model->save())
347  $this->redirect(array('view','id'=>$model->conferenceid));
348  }
349 
350  $this->render('update',array(
351  'model'=>$model,
352  ));
353  }
354 
360  public function actionDelete($id)
361  {
362  $this->loadModel($id)->delete();
363 
364  // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
365  if(!isset($_GET['ajax']))
366  $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
367  }
368 
372  public function actionIndex()
373  {
374  $dataProvider=new CActiveDataProvider('Conference');
375  $this->render('index',array(
376  'dataProvider'=>$dataProvider,
377  ));
378  }
379 
383  public function actionAdmin()
384  {
385  $model=new Conference('search');
386  $model->unsetAttributes(); // clear any default values
387  if(isset($_GET['Conference']))
388  $model->attributes=$_GET['Conference'];
389 
390  $this->render('admin',array(
391  'model'=>$model,
392  ));
393  }
394 
400  public function loadModel($id)
401  {
402  $model=Conference::model()->findByPk($id);
403  if($model===null)
404  throw new CHttpException(404,'The requested page does not exist.');
405  return $model;
406  }
407 
412  protected function performAjaxValidation($model)
413  {
414  if(isset($_POST['ajax']) && $_POST['ajax']==='conference-form')
415  {
416  echo CActiveForm::validate($model);
417  Yii::app()->end();
418  }
419  }
420 }