12 const TABLE_NAME =
"UserFilesActivity";
16 public $IdAccount = 0;
19 public $LastActivity =
"";
24 public function __construct($src = null, $stripSlashes =
false) {
30 $this->_loadByRow($src, $stripSlashes);
31 }
else if (is_numeric($src) && intval($src) > 0) {
33 $this->_loadFilter(self::GetTableName(__CLASS__),
"Id = " . intval($src));
45 public static function Load ($idFile = 0, $idAccount = 0, $returnArray =
false) {
48 $where .= ($where ?
" AND " :
"") . sprintf(
"(IdFile = %d)", $idFile);
50 $where .= ($where ?
" AND " :
"") . sprintf(
"(IdAccount = %d)", $idAccount);
51 return self::_load(self::GetTableName(__CLASS__), ($returnArray ?
"" : __CLASS__), $where);
61 $this->LastActivity = date(
"Y-m-d H:i:s");
63 $query = sprintf(
"UPDATE %s SET Likes = %d, Views = %d, LastActivity = %s WHERE Id = %d",
64 self::GetTableName(__CLASS__),
67 $Database->EscapeDate($this->LastActivity),
70 $query = sprintf(
"INSERT INTO %s (IdFile, IdAccount, LastActivity, Likes, Views) VALUES (%d, %d, %s, %d, %d)",
71 self::GetTableName(__CLASS__),
74 $Database->EscapeDate($this->LastActivity),
78 if ($Database->Query($query)) {
80 $this->Id = $Database->InsertedId();
94 return $this->_Delete(self::GetTableName(__CLASS__),
"Id = " . $this->Id);
static Load($idFile=0, $idAccount=0, $returnArray=false)
__construct($src=null, $stripSlashes=false)