XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
commentuser.php
Go to the documentation of this file.
1 <?php
2 // $Id: commentuser.php 902 2012-01-03 07:09:16Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
11 class RMCommentUser extends RMObject
12 {
13  public function __construct($id=null){
14  $this->db = XoopsDatabaseFactory::getDatabaseConnection();
15  $this->_dbtable = $this->db->prefix("rmc_comusers");
16  $this->setNew();
17  $this->initVarsFromTable();
18  if ($id==null){
19  return;
20  }
21 
22  if ($this->loadValues($id)){
23  $this->unsetNew();
24  return;
25  }
26 
27  $this->primary = 'email';
28  if ($this->loadValues($id)){
29  $this->unsetNew();
30  $this->primary = 'id_user';
31  return;
32  }
33 
34  $this->primary = 'id_user';
35  return;
36 
37  }
38 
39  public function id(){
40  return $this->getVar('id_user');
41  }
42 
43  public function save(){
44  if($this->isNew()){
45  return $this->saveToTable();
46  } else {
47  return $this->updateTable();
48  }
49  }
50 
51 }