12 const TABLE_NAME =
"UserGroupAccount";
15 public $IdAccount = 0;
20 public function __construct($src = null, $stripSlashes =
false) {
26 $this->_loadByRow($src, $stripSlashes);
36 public static function Exists($idGroup, $idAccount) {
38 $where = sprintf(
"IdGroup = %d AND IdAccount = %d", $idGroup, $idAccount);
39 $recs = self::_load(self::GetTableName(__CLASS__),
"", $where);
40 return (count($recs) > 0);
49 public static function Load ($idGroup = 0, $idAccount = 0, $returnArray =
false) {
52 $where .= ($where ?
" AND " :
"") . sprintf(
"(IdGroup = %d)", $idGroup);
54 $where .= ($where ?
" AND " :
"") . sprintf(
"(IdAccount = %d)", $idAccount);
55 return self::_load(self::GetTableName(__CLASS__), ($returnArray ?
"" : __CLASS__), $where);
65 if ($this->IdGroup <= 0 || $this->IdAccount <= 0)
67 $query = sprintf(
"REPLACE INTO %s (IdGroup, IdAccount) VALUES (%d, %d)",
68 self::GetTableName(__CLASS__),
71 return $Database->Query($query);
80 if ($this->IdGroup > 0 && $this->IdAccount > 0) {
81 return $this->_Delete(self::GetTableName(__CLASS__), sprintf(
"IdGroup = %d AND IdAccount = %d", $this->IdGroup, $this->IdAccount));
static Exists($idGroup, $idAccount)
static Load($idGroup=0, $idAccount=0, $returnArray=false)
__construct($src=null, $stripSlashes=false)