XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
Service.class.php
1<?php
12
13if (!defined('XOOPS_ROOT_PATH')) {
14 exit();
15}
16
18{
19 public $mServiceName = 'Message_Service';
20 public $mNameSpace = 'Message';
21 public $mClassName = 'Message_Service';
22
23 public function prepare()
24 {
25 $this->addFunction(S_PUBLIC_FUNC('string getPmInboxUrl(int uid)'));
26 $this->addFunction(S_PUBLIC_FUNC('string getPmliteUrl(int fromUid, int toUid)'));
27 $this->addFunction(S_PUBLIC_FUNC('int getCountUnreadPM(int uid)'));
28 }
29
30 public function getPmInboxUrl()
31 {
32 $root = XCube_Root::getSingleton();
33 $uid = $root->mContext->mRequest->getRequest('uid');
34
35 if ($uid > 0) {
36 return XOOPS_URL.'/modules/message/index.php';
37 }
38
39 return '';
40 }
41
42 public function getPmliteUrl()
43 {
44 $root = XCube_Root::getSingleton();
45
46 $fromUid = $root->mContext->mRequest->getRequest('fromUid');
47 $toUid = $root->mContext->mRequest->getRequest('toUid');
48
49 if ($fromUid > 0 && $toUid > 0) {
50 return XOOPS_URL.'/modules/message/index.php?action=new&to_userid='.$toUid;
51 }
52
53 return '';
54 }
55
56 public function getCountUnreadPM()
57 {
58 $root = XCube_Root::getSingleton();
59 $uid = $root->mContext->mRequest->getRequest('uid');
60
61 if ($uid > 0) {
62 $modHand = xoops_getmodulehandler('inbox', 'message');
63 return $modHand->getCountUnreadByFromUid($uid);
64 }
65
66 return 0;
67 }
68}