diff --git a/app/models/Data/ActivityLog.php b/app/models/Data/ActivityLog.php new file mode 100644 index 0000000..91f3158 --- /dev/null +++ b/app/models/Data/ActivityLog.php @@ -0,0 +1,131 @@ +id; + } + + /** + * @param mixed $id + * @return User + */ + public function setId($id) + { + $this->id = $id; + return $this; + } + + /** + * @return mixed + */ + public function getTimestamp() + { + return $this->timestamp; + } + + /** + * @param mixed $timestamp + * @return ActivityLog + */ + public function setTimestamp($timestamp) + { + $this->timestamp = $timestamp; + return $this; + } + + /** + * @return mixed + */ + public function getUserId() + { + return $this->user_id; + } + + /** + * @param mixed $user_id + * @return ActivityLog + */ + public function setUserId($user_id) + { + $this->user_id = $user_id; + return $this; + } + + /** + * @return mixed + */ + public function getIp() + { + return $this->ip; + } + + /** + * @param mixed $ip + * @return ActivityLog + */ + public function setIp($ip) + { + $this->ip = $ip; + return $this; + } + + /** + * @return mixed + */ + public function getMessage() + { + return $this->message; + } + + /** + * @param mixed $message + * @return ActivityLog + */ + public function setMessage($message) + { + $this->message = $message; + return $this; + } + + /** + * @param $userid + * @param int $page + * @param int $limit + * @return \Phalcon\Paginator\AdapterInterface + */ + public static function getPaginationList($userid, $page = 1, $limit = 30) + { + $builder = (new self())->getModelsManager()->createBuilder(); + + $builder->from(self::class) + ->where('user_id = :uid:', array('uid' => $userid)) + ->orderBy('timestamp DESC'); + + $paginator = new QueryBuilder(array( + 'builder' => $builder, + 'page' => $page, + 'limit' => $limit + )); + + return $paginator; + } +}