EliteConf
 All Data Structures Namespaces Files Functions Variables Pages
MymessagesController.php
Go to the documentation of this file.
1 <?php
2 
8 {
9  public function actionIndex()
10  {
11  $this->render('index');
12  }
13 
17  public function viewreceivedmessages()
18  {
19 
21 
22  if(Yii::app()->user->id != NULL)
23  $usid = Yii::app()->user->id;
24  else
25  $usid = 0;
26 
27  //select all conferences that the user has admin as his user type
28  $message = mysql_query("SELECT * FROM (SELECT * FROM message WHERE receiverid='$usid' ORDER BY id DESC) tmp GROUP BY senderid ORDER BY id DESC ");
29 
30  $i=0;
31 
32  while($row = mysql_fetch_array($message))
33  {
34 
35  $asd = $row['senderid'];
36  $result1 = mysql_query("SELECT * FROM users WHERE userid='$asd'");
37 
38  while($row2 = mysql_fetch_array($result1))
39  {
40 
41  echo "<B>".($i+1)."</B>" . ") User Name : " . $row2['firstname'] . " " . $row2['lastname'];
42  //echo "<br>";
43  if($row['read_unread']==0) echo " " . " NEW!<br>";
44  else echo "<br>";
45 
46  }
47  //echo $row['read_unread'] . "<br>";
48 
49  echo "<a href=\" ./index.php?r=viewusermessage/index&userid=$asd\">View Message History With This User </a>";
50 
51  echo "<br><br><br>";
52  $i++;
53  }
54 
55  if($i==0) echo "You don't have any received messages.";
56 
57  }
58 
62  public function viewsentmessages()
63  {
64 
66 
67  if(Yii::app()->user->id != NULL)
68  $usid = Yii::app()->user->id;
69  else
70  $usid = 0;
71 
72  //select all conferences that the user has admin as his user type
73 // $message = mysql_query("SELECT DISTINCT receiverid FROM message ORDER BY id WHERE senderid='$usid' ");
74 
75  $message = mysql_query("SELECT * FROM (SELECT * FROM message WHERE senderid='$usid' ORDER BY id DESC) tmp GROUP BY receiverid ORDER BY id DESC ");
76 
77  $i=0;
78 
79  while($row = mysql_fetch_array($message))
80  {
81 
82  $asd = $row['receiverid'];
83  $result1 = mysql_query("SELECT * FROM users WHERE userid='$asd'");
84 
85  while($row2 = mysql_fetch_array($result1))
86  {
87  echo "<B>".($i+1)."</B>" . ") User Name : " . $row2['firstname'] . " " . $row2['lastname'];
88  echo "<br>";
89  }
90 
91  echo "<a href=\" ./index.php?r=viewusermessage/index&userid=$asd\">View Message History With This User </a>";
92 
93  echo "<br><br><br>";
94  $i++;
95  }
96 
97  if($i==0) echo "You don't have any sent messages.";
98 
99  }
100 
101 
102 
103 
104 
105 
106  // Uncomment the following methods and override them if needed
107  /*
108  public function filters()
109  {
110  // return the filter configuration for this controller, e.g.:
111  return array(
112  'inlineFilterName',
113  array(
114  'class'=>'path.to.FilterClass',
115  'propertyName'=>'propertyValue',
116  ),
117  );
118  }
119 
120  public function actions()
121  {
122  // return external action classes, e.g.:
123  return array(
124  'action1'=>'path.to.ActionClass',
125  'action2'=>array(
126  'class'=>'path.to.AnotherActionClass',
127  'propertyName'=>'propertyValue',
128  ),
129  );
130  }
131  */
132 }