Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
FriendsListWidget.php
1 <?php
2 /**
3  *
4  */
5 $user_id = Yii::app()->user->id;
6 ?>
7 
8 
9 <div class="friends-friends-list-widget">
10  <a name="FriendsListWidget"></a>
11  <?php if ($message = Yii::app()->user->getFlash('friends-success')): ?>
12  <div class="success">
13  <?php echo $message?>
14  </div>
15  <?php endif?>
16  <?php if ($message = Yii::app()->user->getFlash('friends-error')): ?>
17  <div class="error">
18  <?php echo $message?>
19  </div>
20  <?php endif?>
21  <table>
22  <tr>
23  <th><?php echo User::model()->getAttributeLabel('username')?></th>
24  <th><?php echo Profile::model()->getAttributeLabel('firstname')?></th>
25  <th><?php echo Profile::model()->getAttributeLabel('lastname')?></th>
26  <th></th>
27  </tr>
28  <?php foreach ($friendships as $friendship):
29  $friend = $friendship->friend($user_id);
30 
31  ?>
32  <tr>
33  <td>
34  <?php echo $friend->username ?>
35  </td>
36  <td>
37  <?php echo $friend->profile->firstname ?>
38  </td>
39  <td>
40  <?php echo $friend->profile->lastname ?>
41  </td>
42  <td>
43  <?php if ($friendship->status == Friendship::STATUS_APPROVED): ?>
44  <div><?php echo FriendsModule::t('Friends')?></div>
45  <?php else: ?>
46  <div>
47  <?php if ($friendship->myRequest($user_id)): ?>
48  <div>
49  <div><?php echo FriendsModule::t('Waiting')?>...</div>
50  </div>
51  <?php else: ?>
52  <div>
53  <?php echo CHtml::beginForm(Yii::app()->createUrl('/friends/friends/approve', array('return_url' => Yii::app()->request->getRequestUri() . '#FriendsListWidget')), 'GET')?>
54  <input type="hidden" name="user_id" value="<?php echo $friend->id?>">
55  <input type="hidden" name="key"
56  value="<?php echo FriendsModule::encrypting($friend->id)?>"
57  >
58  <?php echo CHtml::submitButton(FriendsModule::t('Approve'))?>
59  <?php echo CHtml::endForm()?>
60  </div>
61  <?php endif ?>
62  </div>
63  <?php endif ?>
64  </td>
65  <td>
66  <?php if ($friendship->status != Friendship::STATUS_CANCELED): ?>
67  <?php echo CHtml::beginForm(Yii::app()->createUrl('/friends/friends/cancel', array('return_url' => Yii::app()->request->getRequestUri() . '#FriendsListWidget')), 'GET') ?>
68  <input type="hidden" name="user_id" value="<?php echo $friend->id?>">
69  <input type="hidden" name="key"
70  value="<?php echo FriendsModule::encrypting($friend->id)?>"
71  >
72  <?php echo CHtml::submitButton(FriendsModule::t('Cancel')) ?>
73  <?php echo CHtml::endForm() ?>
74  <?php endif?>
75  </td>
76  </tr>
77  <?php endforeach;?>
78  </table>
79 </div>