1 | <?php
|
---|
2 |
|
---|
3 | class BxDolUserStatusView
|
---|
4 | {
|
---|
5 | // contain path to the site's home URL;
|
---|
6 | var $sHomeUrl;
|
---|
7 |
|
---|
8 | // contain all possible statuses for member;
|
---|
9 | var $aStatuses;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Class constructor ;
|
---|
13 | */
|
---|
14 | function BxDolUserStatusView()
|
---|
15 | {
|
---|
16 | $this -> sHomeUrl = BX_DOL_URL_ROOT;
|
---|
17 | $this -> aStatuses = array(
|
---|
18 |
|
---|
19 | 'online' => array(
|
---|
20 | 'icon8' => 'sys_status_online.png',
|
---|
21 | 'icon' => 'status_online.png',
|
---|
22 | 'title' => _t('_Online'),
|
---|
23 | ),
|
---|
24 |
|
---|
25 | 'offline' => array(
|
---|
26 | 'icon8' => 'sys_status_offline.png',
|
---|
27 | 'icon' => 'status_offline.png',
|
---|
28 | 'title' => _t('_Offline'),
|
---|
29 | ),
|
---|
30 |
|
---|
31 | 'away' => array(
|
---|
32 | 'icon8' => 'sys_status_away.png',
|
---|
33 | 'icon' => 'status_away.png',
|
---|
34 | 'title' => _t('_Away'),
|
---|
35 | ),
|
---|
36 |
|
---|
37 | 'busy' => array(
|
---|
38 | 'icon8' => 'sys_status_busy.png',
|
---|
39 | 'icon' => 'status_busy.png',
|
---|
40 | 'title' => _t('_Busy'),
|
---|
41 | ),
|
---|
42 | );
|
---|
43 | }
|
---|
44 |
|
---|
45 | /**
|
---|
46 | * Function will cheack recived status into registered statuses array;
|
---|
47 | *
|
---|
48 | * @param : $sStatus (string) - member's status;
|
---|
49 | * @return : (integer) - 1 if status was registered or 0 if not;
|
---|
50 | */
|
---|
51 | function getRegisteredStatus($sStatus)
|
---|
52 | {
|
---|
53 | if( array_key_exists($sStatus, $this -> aStatuses) ) {
|
---|
54 | return 1;
|
---|
55 | }
|
---|
56 | else {
|
---|
57 | return 0;
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Function will return member's status icon ;
|
---|
63 | *
|
---|
64 | * @param : $iMemberId (integer) - logged member's Id ;
|
---|
65 | * @return : (string) - icon's name;
|
---|
66 | */
|
---|
67 | function getStatusIcon($iMemberId, $sSize = 'icon')
|
---|
68 | {
|
---|
69 | // default value;
|
---|
70 | $sMemberIcon = $this -> aStatuses['offline'][$sSize];
|
---|
71 |
|
---|
72 | if ( get_user_online_status($iMemberId) ) {
|
---|
73 | $sMemberStatus = db_value("SELECT `UserStatus` FROM `Profiles` WHERE `ID` = {$iMemberId}");
|
---|
74 | if( array_key_exists($sMemberStatus, $this -> aStatuses) ) {
|
---|
75 | $sMemberIcon = $this -> aStatuses[$sMemberStatus][$sSize];
|
---|
76 | }
|
---|
77 | }
|
---|
78 |
|
---|
79 | return $sMemberIcon;
|
---|
80 | }
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * Function will return member's status icon ;
|
---|
84 | *
|
---|
85 | * @param : $iMemberId (integer) - logged member's Id ;
|
---|
86 | * @return : (string) - icon's name;
|
---|
87 | */
|
---|
88 | function getStatus($iMemberId)
|
---|
89 | {
|
---|
90 | // default value;
|
---|
91 | $sMemberStatus = $this -> aStatuses['offline']['title'];
|
---|
92 |
|
---|
93 | if ( get_user_online_status($iMemberId) ) {
|
---|
94 | // get profile status;
|
---|
95 | $sMemberStatus = db_value("SELECT `UserStatus` FROM `Profiles` WHERE `ID` = {$iMemberId}");
|
---|
96 | }
|
---|
97 |
|
---|
98 | return $sMemberStatus;
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Function will generate field for input memeber's status text;
|
---|
103 | *
|
---|
104 | * @param : $iMemberID (integer) - logged member's Id;
|
---|
105 | * @return : Html presentation data;
|
---|
106 | */
|
---|
107 | function getStatusField($iMemberId)
|
---|
108 | {
|
---|
109 | global $oSysTemplate;
|
---|
110 |
|
---|
111 | $aMemberInfo = getProfileInfo($iMemberId);
|
---|
112 | $sStatusMessage = process_line_output($aMemberInfo['UserStatusMessage']);
|
---|
113 |
|
---|
114 | $aTemplateKeys = array (
|
---|
115 | 'status_message' => $sStatusMessage,
|
---|
116 | );
|
---|
117 |
|
---|
118 | return $oSysTemplate -> parseHtmlByName('member_menu_status_text_field.html', $aTemplateKeys);
|
---|
119 | }
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Function will generate text box for changes member's status text;
|
---|
123 | *
|
---|
124 | * @param : $iMemberId (integer) - logged member's id;
|
---|
125 | * @return : Html presentation data;
|
---|
126 | */
|
---|
127 | function getStatusPageLight($iMemberId)
|
---|
128 | {
|
---|
129 | global $oSysTemplate;
|
---|
130 |
|
---|
131 | $aProfileInfo = getProfileInfo($iMemberId);
|
---|
132 | $aTemplateKeys = array (
|
---|
133 | 'status_message' => $aProfileInfo['UserStatusMessage'],
|
---|
134 | );
|
---|
135 |
|
---|
136 | return $oSysTemplate -> parseHtmlByName( 'user_status_light.html', $aTemplateKeys );
|
---|
137 | }
|
---|
138 | }
|
---|
139 |
|
---|
140 | ?> |
---|