EliteConf
 All Data Structures Namespaces Files Functions Variables Pages
ViewusermessageController.php
Go to the documentation of this file.
1 <?php
2 
8 {
9  public function actionIndex()
10  {
11  $this->render('index');
12  }
13 
18  public function viewall()
19  {
21 
22 
23  if(Yii::app()->user->id != NULL)
24  $usid = Yii::app()->user->id;
25  else
26  $usid = 0;
27 
28 
29  $userid = $_GET['userid'];
30 
31 
32  // AND receiverid='$userid') OR (senderid='$userid' AND receiverid='$usid')
33  $mess = mysql_query("SELECT * FROM message WHERE (senderid=$usid AND receiverid=$userid) OR (senderid=$userid AND receiverid=$usid)");
34 
35  $i=0;
36 
37  while($row = mysql_fetch_array($mess))
38  {
39 
40  $asd = $row['id'];
41  $senderid = $row['senderid'];
42  $sender = mysql_query("SELECT * FROM users WHERE userid=$senderid");
43 
44  while($row2 = mysql_fetch_array($sender))
45  {
46  $sendername = $row2['username'];
47  $date = $row['date'];
48  echo "(". $date . ") " . "<B>". $row2['firstname'] . " " . $row2['lastname'] ." :</B>" . " " . $row['content'];
49  echo "<br>";
50 
51  }
52 
53  if($row['receiverid'] == $usid)
54  {
55  }
56  else
57  {
58 
59  $sql_read="UPDATE message SET read_unread=1 WHERE (receiverid='$usid' AND senderid='$userid')";
60  mysql_query($sql_read) or die (mysql_error());
61 
62  }
63  // echo "<br />";
64  // echo "Conference ID : " . $row['conferenceid']; echo "<br />";
65  // echo CHtml::link("View Conference",array('conference/index', '&va'=>$co));
66 
67  echo "<br>";
68  $i++;
69  }
70 
71  if($i==0) echo "You don't have any message history with this user.";
72 
73  }
74 
75 
76 
77  // Uncomment the following methods and override them if needed
78  /*
79  public function filters()
80  {
81  // return the filter configuration for this controller, e.g.:
82  return array(
83  'inlineFilterName',
84  array(
85  'class'=>'path.to.FilterClass',
86  'propertyName'=>'propertyValue',
87  ),
88  );
89  }
90 
91  public function actions()
92  {
93  // return external action classes, e.g.:
94  return array(
95  'action1'=>'path.to.ActionClass',
96  'action2'=>array(
97  'class'=>'path.to.AnotherActionClass',
98  'propertyName'=>'propertyValue',
99  ),
100  );
101  }
102  */
103 }