XOOPS  2.6.0
privmessage.php
Go to the documentation of this file.
1 <?php
23 
33 {
37  public function __construct()
38  {
39  $this->initVar('msg_id', XOBJ_DTYPE_INT, null, false);
40  $this->initVar('msg_image', XOBJ_DTYPE_OTHER, null, false, 100);
41  $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, true, 255);
42  $this->initVar('from_userid', XOBJ_DTYPE_INT, null, true);
43  $this->initVar('to_userid', XOBJ_DTYPE_INT, null, true);
44  $this->initVar('msg_time', XOBJ_DTYPE_OTHER, time(), false);
45  $this->initVar('msg_text', XOBJ_DTYPE_TXTAREA, null, true);
46  $this->initVar('read_msg', XOBJ_DTYPE_INT, 0, false);
47  }
48 
53  public function id($format = 'n')
54  {
55  return $this->getVar('msg_id', $format);
56  }
57 
62  public function msg_id($format = '')
63  {
64  return $this->getVar('msg_id', $format);
65  }
66 
71  public function msg_image($format = '')
72  {
73  return $this->getVar('msg_image', $format);
74  }
75 
80  public function subject($format = '')
81  {
82  return $this->getVar('subject', $format);
83  }
84 
89  public function from_userid($format = '')
90  {
91  return $this->getVar('from_userid', $format);
92  }
93 
98  public function to_userid($format = '')
99  {
100  return $this->getVar('to_userid', $format);
101  }
102 
107  public function msg_time($format = '')
108  {
109  return $this->getVar('msg_time', $format);
110  }
111 
116  public function msg_text($format = '')
117  {
118  return $this->getVar('msg_text', $format);
119  }
120 
125  public function read_msg($format = '')
126  {
127  return $this->getVar('read_msg', $format);
128  }
129 
130 }
131 
146 {
152  public function __construct(Connection $db = null)
153  {
154  parent::__construct($db, 'priv_msgs', 'XoopsPrivmessage', 'msg_id', 'subject');
155  }
156 
163  public function setRead(XoopsPrivmessage &$pm)
164  {
165  $qb = $this->db2->createXoopsQueryBuilder()
166  ->update($this->table, 'pm')
167  ->set('pm.read_msg', ':readmsg')
168  ->where('pm.msg_id = :msgid')
169  ->setParameter(':readmsg', 1, \PDO::PARAM_INT)
170  ->setParameter(':msgid', $pm->getVar('msg_id'), \PDO::PARAM_INT);
171  $result = $qb->execute();
172 
173  if (!$result) {
174  return false;
175  }
176  return true;
177  }
178 }
msg_text($format= '')
$result
Definition: pda.php:33
read_msg($format= '')
setRead(XoopsPrivmessage &$pm)
getVar($key, $format= 's')
msg_image($format= '')
Definition: privmessage.php:71
id($format= 'n')
Definition: privmessage.php:53
subject($format= '')
Definition: privmessage.php:80
msg_id($format= '')
Definition: privmessage.php:62
__construct(Connection $db=null)
const XOBJ_DTYPE_TXTAREA
Definition: XoopsObject.php:21
to_userid($format= '')
Definition: privmessage.php:98
msg_time($format= '')
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')
from_userid($format= '')
Definition: privmessage.php:89