EliteConf
 All Data Structures Namespaces Files Functions Variables Pages
InterestsController.php
Go to the documentation of this file.
1 <?php
2 
9 {
10  public function actionIndex()
11  {
12  $this->render('index');
13  }
14 
18  public function autocomplete_topics()
19  {
20 
22 
23  $ar = mysql_query("SELECT * FROM interests_topics");
24 
25  $i=0;
26 
27  while($row = mysql_fetch_array($ar))
28  {
29  $nam[$i] = $row['name'];
30 
31  $i++;
32  }
33 
34  return $nam;
35 
36  }
37 
41  public function view_subtopics()
42  {
43 
44 
46 
47  $topname = $_POST['topic'];
48 
49  echo "</form>";
50  echo "<form action='index.php?r=interests_selection/index' method='post'>";
51 
52  $topics = mysql_query("SELECT * FROM interests_topics WHERE name='$topname'");
53 
54  $i=0;
55  $k=0;
56  $o=0;
57  if(mysql_num_rows($topics)!=0)
58  {
59  while($row = mysql_fetch_array($topics))
60  {
61  $as[$o] = $row['name'];
62  $asd[$o] = $row['id'];
63  $result1 = mysql_query("SELECT subtopicid FROM topic_subtopic WHERE topicid='$asd[$o]'");
64  echo "<h3>$as[$o]</h3>" . "";
65 
66  while($row2 = mysql_fetch_array($result1))
67  {
68  $asd2 = $row2['subtopicid'];
69 
70  $result2 = mysql_query("SELECT name FROM interests_subtopics WHERE id='$asd2'");
71 
72  while($row3 = mysql_fetch_array($result2))
73  {
74 
75  $asd3[$k] = $row3['name'];
76 
77  echo "<B>".($k+1)."</B>" . ") ";
78 
79  echo "<input type='checkbox' name='topicid[]' value=$asd2>";
80 
81 // echo "<a href=\" ./index.php?r=user_profile/index&username=$asd3[$k]\">" . $asd3[$k] . "</a><br><br>";
82  echo $asd3[$k] . "</a><br><br>";
83 
84 
85  }
86  $k++;
87 
88  }
89  $co = $row2['subtopicid'];
90  $k=0;
91  $o++;
92  $i++;
93  }
94 
95  $j=0;
96  $l=0;
97 
98 
99  echo "<input type='radio' name='knowledge' value='1' /> Mediocre Knowledge";
100  echo "<input type='radio' name='knowledge' value='2' /> Good Knowledge";
101  echo "<input type='radio' name='knowledge' value='3' /> Excellent Knowledge";
102  echo "<br>";
103  echo "<input type='submit' name=\'formSubmit' value='Select Interests' />";
104  echo "</form><br>";
105 
106 
107  echo "<form action='index.php?r=interests_request/index' method='post'>";
108  echo "<textarea hidden name='topname'>" . $topname . "</textarea>";
109  echo "<input type='submit' name=\'formSubmit2' value='Add Subtopics For This Interest' />";
110  echo "</form>";
111 
112  }
113 
114  else if($topname!=null)
115  {
116  echo "</form>";
117  echo "<form action='index.php?r=interests_request/index' method='post'>";
118  echo "No Subtopics For " . $topname . "<br><br>";
119  //echo "<input hidden name='topname' value=$topname >";
120  echo "<textarea hidden name='topname'>" . $topname . "</textarea>";
121  echo "<input type='submit' name=\'formSubmit2' value='Add Subtopics For This Interest' />";
122  echo "</form>";
123  }
124  else
125  {
126  echo "</form>";
127  echo "No Topic Specified.";
128  }
129 
130  }
131 
135  public function view_topics()
136  {
137 
139 
140  echo "<form action='index.php?r=interests_selection/index' method='post'>";
141 
142  $topics = mysql_query("SELECT * FROM interests_topics");
143 
144  $i=0;
145  $k=0;
146  $o=0;
147  while($row = mysql_fetch_array($topics))
148  {
149  $as[$o] = $row['name'];
150  $asd[$o] = $row['id'];
151  $result1 = mysql_query("SELECT subtopicid FROM topic_subtopic WHERE topicid='$asd[$o]'");
152  echo "<h3>$as[$o]</h3>" . "";
153 
154  while($row2 = mysql_fetch_array($result1))
155  {
156  $asd2 = $row2['subtopicid'];
157 
158  $result2 = mysql_query("SELECT name FROM interests_subtopics WHERE id='$asd2'");
159 
160  while($row3 = mysql_fetch_array($result2))
161  {
162 
163  $asd3[$k] = $row3['name'];
164 
165  echo "<B>".($k+1)."</B>" . ") ";
166 
167  echo "<input type='checkbox' name='topicid[]' value=$asd2>";
168 
169 // echo "<a href=\" ./index.php?r=user_profile/index&username=$asd3[$k]\">" . $asd3[$k] . "</a><br><br>";
170  echo $asd3[$k] . "</a><br><br>";
171 
172 
173  }
174  $k++;
175 
176  }
177  $co = $row2['subtopicid'];
178  $k=0;
179  $o++;
180  $i++;
181  }
182 
183  $j=0;
184  $l=0;
185 
186 
187  echo "<input type='radio' name='knowledge' value='1' /> Mediocre Knowledge";
188  echo "<input type='radio' name='knowledge' value='2' /> Good Knowledge";
189  echo "<input type='radio' name='knowledge' value='3' /> Excellent Knowledge";
190  echo "<br>";
191  echo "<input type='submit' name=\'formSubmit' value='Select Interests' />";
192  echo "</form>";
193 
194 
195  /*
196 while($l<sizeof($as))
197 {
198 
199  echo "<h3>$as[$l]</h3>" . "";
200 
201  while($j<sizeof($asd3))
202  {
203  echo "<B>".($j+1)."</B>" . ") ";
204 
205  echo "<input type='checkbox' name='names[]' value=$asd3[$j]>";
206 
207  echo "<a href=\" /test/index.php?r=user_profile/index&username=$asd3[$j]\">" . $asd3[$j] . "</a><br><br>";
208  $j++;
209  }
210 
211  $l++;
212 }
213  */
214 
215 
216 
217  }
218 
219  // Uncomment the following methods and override them if needed
220  /*
221  public function filters()
222  {
223  // return the filter configuration for this controller, e.g.:
224  return array(
225  'inlineFilterName',
226  array(
227  'class'=>'path.to.FilterClass',
228  'propertyName'=>'propertyValue',
229  ),
230  );
231  }
232 
233  public function actions()
234  {
235  // return external action classes, e.g.:
236  return array(
237  'action1'=>'path.to.ActionClass',
238  'action2'=>array(
239  'class'=>'path.to.AnotherActionClass',
240  'propertyName'=>'propertyValue',
241  ),
242  );
243  }
244  */
245 }