EliteConf
 All Data Structures Namespaces Files Functions Variables Pages
Assignment_function_conferenceController.php
Go to the documentation of this file.
1 <?php
2 
9 {
10  public function actionIndex()
11  {
12  $this->render('index');
13  }
14 
19  public function assignment()
20  {
22  //echo "fdsfsdg";
23 
24  if(Yii::app()->user->id != NULL)
25  $usid = Yii::app()->user->id;
26  else
27  $usid = 0;
28 
29 $confid = $_GET['confid'];
30 // auto assignment
31 $interest_id = $_POST['interestid'];
32 // select all papers from conference
33 
34 for($a=1; $a<100; $a++)
35  $rank[$a]=0;
36 
37 for($a=1; $a<1000; $a++)
38  $refereenames[$a]=" ";
39 
40 
41 $papers = mysql_query("SELECT * FROM paper WHERE id IN (SELECT paperid FROM conference_paper WHERE conferenceid=$confid) AND id IN
42  (SELECT paper_id FROM paper_interest WHERE interest_id=$interest_id)");
43 
44 echo "<form action='index.php?r=assignment_function_submit_conference/index&confid=$confid' method='post'>";
45 
46 $i = 1;
47 $j = 1;
48 $papnum = 1;
49 if(mysql_num_rows($papers)!=0)
50 {
51 while( $pap = mysql_fetch_array($papers))
52 {
53 $pap_id = $pap['id'];
54 $pap_name = $pap['name'];
55 
56 $paperid[$papnum] = $pap_id;
57 
58 $paper_interest = mysql_query("SELECT * FROM paper_interest WHERE paper_id=$pap_id");
59  //echo $pap_id . " " . "<br> ";
60 if(mysql_num_rows($paper_interest)!=0)
61 {
62 while( $int = mysql_fetch_array($paper_interest))
63 {
64  $paper_int = $int['interest_id'];
65 
66 $referees = mysql_query("SELECT * FROM users WHERE userid IN
67  (SELECT userid FROM conference_user_type WHERE conferenceid=$confid AND usertype=3)");
68 
69  while($referee = mysql_fetch_array($referees))
70  {
71  $refid = $referee['userid'];
72  $refname = $referee['firstname'] . " " . $referee['lastname'];
73  $referee_interest = mysql_query("SELECT * FROM interest_user WHERE userid=$refid AND interestid=$paper_int");
74 
75  if(mysql_num_rows($referee_interest)!=0)
76  {
77  while ($ref_int = mysql_fetch_array($referee_interest))
78  {
79 
80  $knowledge = $ref_int['knowledge'];
81 
82  }
83  }
84  else {$knowledge = 0;}
85 
86  $rank[$i] += $knowledge;
87  $refereenames[$i] = $refname;
88  $refereeids[$i] = $refid;
89  $i++;
90  }
91  $refcount = $i;
92  $i=1;
93 
94  }
95 }
96 else
97 {
98 
99  $refcount=0;
100 }
101  echo "<h3>Paper : <a href=\" ./index.php?r=paper/view&id=$pap_id\">$pap_name</a></h3>";
102 // echo "<h3>Paper : " . $pap_name . "</h3>";
103  $max = 0;
104  for($j=1;$j<$refcount; $j++)
105  {
106 
107  if($max < $rank[$j]) {$max=$rank[$j]; $maxref=$refereeids[$j]; $maxrefname=$refereenames[$j];}
108 
109  }
110 
111  if($max!=0)
112 
113  echo "<input type='checkbox' name='refid[]' value='$pap_id|$maxref' checked>Paperid: " . $pap_id . " Name :" . "<a href=\" ./index.php?r=user_profile&usid=$maxref\">$maxrefname</a>" . " Rank :" . $max . "</><br>";
114  //echo "<input type='checkbox' name='refid[]' value='$pap_id|$maxref' checked>Paperid: " . $pap_id . " Username :" . $maxrefname . " Rank :" . $max . "</><br>";
115  else
116  {
117  echo "There are not any qualified referees.<br>";
118  echo "<a href=\" ./index.php?r=inviteuser/index&va=$confid\">Invite New Referees</a>";
119  echo "<br/>";
120 
121  }
122 
123  echo "<br>";
124 
125  for($j=1; $j<5; $j++)
126  $rank[$j]=0;
127  }
128  echo "<input hidden name='paperid[]' value=$paperid[$papnum]/>";
129 
130  echo "<br>";
131  $papnum++;
132 }
133 else echo "There Are No Submitted Papers.<br><br><br>";
134 
135  echo "<input type='submit' name=\'formSubmit' value='Assign Referees' />";
136  echo "</form><br>";
137 
138 }
139 
144  public function selectinterest()
145  {
146 
148  //echo "fdsfsdg";
149 
150  if(Yii::app()->user->id != NULL)
151  $usid = Yii::app()->user->id;
152  else
153  $usid = 0;
154 
155  $confid = $_GET['confid'];
156 
157  echo "<h3>Select Interest Topics of Papers You Want To View</h3>";
158 
159  $interests = mysql_query("SELECT * FROM interests_topics WHERE id IN
160  (SELECT topicid FROM topic_subtopic WHERE subtopicid IN
161  (SELECT titleid FROM conference_title WHERE conferenceid=$confid))");
162 
163 
164  if(mysql_num_rows($interests)!=0)
165  {
166  echo "<form action='index.php?r=assignment_function_conference/index&confid=$confid' method='post'>";
167  $i=1;
168  while($inter = mysql_fetch_array($interests))
169  {
170  $interestid = $inter['id'];
171  $interestname = $inter['name'];
172 
173  $subs = mysql_query("SELECT * FROM interests_subtopics WHERE id IN
174  (SELECT subtopicid FROM topic_subtopic WHERE topicid=$interestid) AND id IN
175  (SELECT titleid FROM conference_title WHERE conferenceid=$confid)");
176 
177  echo "<b>$interestname</b><br>";
178  while($sub = mysql_fetch_array($subs))
179  {
180 
181  $subid = $sub['id'];
182  $subname = $sub['name'];
183  echo "<input type='radio' name='interestid' value=$subid /> $subname<br>";
184 
185  }
186  $i++;
187  echo "<br>";
188  }
189 
190 
191  echo "<input type='submit' name=\'formSubmit' value='View Automatic Assignment Suggestions' />";
192  echo "</form><br>";
193  }
194  else echo "No topics specified.<br>";
195 
196  }
197  // Uncomment the following methods and override them if needed
198  /*
199  public function filters()
200  {
201  // return the filter configuration for this controller, e.g.:
202  return array(
203  'inlineFilterName',
204  array(
205  'class'=>'path.to.FilterClass',
206  'propertyName'=>'propertyValue',
207  ),
208  );
209  }
210 
211  public function actions()
212  {
213  // return external action classes, e.g.:
214  return array(
215  'action1'=>'path.to.ActionClass',
216  'action2'=>array(
217  'class'=>'path.to.AnotherActionClass',
218  'propertyName'=>'propertyValue',
219  ),
220  );
221  }
222  */
223 }